tianta/_docs/index.html

198 lines
7.2 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="ch_ZN">
<head>
<meta charset="UTF-8">
<title>HTML5魔塔样板</title>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link href="vue.css" rel="stylesheet">
<script>
//先下载着
/*
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://cdn.bootcss.com/docsify/4.5.5/docsify.min.js', true);
xhr.send(null);
xhr = new XMLHttpRequest();
xhr.open('GET', 'https://cdn.bootcss.com/docsify/4.5.5/plugins/search.min.js', true);
xhr.send(null);
(function(){
window.bg={replaceToken:{}}
bg.guid=function () {
return 'id_' + 'xxxxxxxx_xxxx_4xxx_yxxx_xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
bg.table=function(ths,tdss,args){
return `<table class="${((args||{}).class||[]).join(' ')}"><thead><tr>${ths.map(v=>`<th style="text-align:left">${v}</th>`).join('')}</tr></thead><tbody>${tdss.map(tds=>`<tr>${tds.map(v=>`<td style="text-align:left">${v}</td>`).join('')}</tr>`).join('')}</tbody></table>`;
}
bg.pattern=/```\s*MotaAction.*?\r?\n[^]*?\r?\n\s*```/g;
bg.replaceFunc=function(str){
var content=null;
try {
content=eval(str.split('\n').slice(1,-1).join('\n'))
} catch (ee) {
}
var match=/```\s*MotaAction(\.)?(\w+)?/.exec(str);
var blocksvg=''
if (!match[2] || match[2]=='action')blocksvg= bg.parseList(content);
else blocksvg=bg.parse(content,match[2]);
return '<p>'+blocksvg+'</p>\n\n';
}
bg.parse=function(obj,type){
MotaActionFunctions.workspace().clear();
xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event');
xml = Blockly.Xml.textToDom('<xml>'+xml_text+'</xml>');
Blockly.Xml.domToWorkspace(xml, MotaActionFunctions.workspace());
svgBlock=document.querySelector("g.blocklyBlockCanvas > g.blocklyDraggable")
svgBlock.setAttribute('transform','translate(0,0)')
tmp={width:svgBlock.getBBox().width,height:svgBlock.getBBox().height}
var id=`<span>${bg.guid()}</span>`
bg.replaceToken[id]=`<svg width="${tmp.width}px" height="${tmp.height}px">`+svgBlock.outerHTML+'</svg>'
return id;
}
bg.parseList=function(obj){
MotaActionFunctions.workspace().clear();
xml_text = MotaActionFunctions.actionParser.parseList(obj);
xml = Blockly.Xml.textToDom('<xml>'+xml_text+'</xml>');
Blockly.Xml.domToWorkspace(xml, MotaActionFunctions.workspace());
svgBlock=document.querySelector("g.blocklyBlockCanvas > g.blocklyDraggable")
svgBlock.setAttribute('transform','translate(0,0)')
tmp={width:svgBlock.getBBox().width,height:svgBlock.getBBox().height}
var id=`<span>${bg.guid()}</span>`
bg.replaceToken[id]=`<svg width="${tmp.width}px" height="${tmp.height}px">`+svgBlock.outerHTML+'</svg>'
return id;
}
})()
*/
</script>
</head>
<body>
<div id="app"></div>
<xml id="toolbox" style="display:none"></xml>
<div id="blocklyArea" style="opacity: 0;z-index: -1;"><div id="blocklyDiv"></div></div>
<textarea id="codeArea" style="display:none" spellcheck="false"></textarea>
<script>
window.$docsify = {
homepage: 'index.md',
loadSidebar: true,
name: 'HTML5魔塔样板',
repo: 'https://github.com/ckcz123/mota-js',
// basepath: '../docs/',
// Search Support
search: {
maxAge: 43200000, // 过期时间,单位毫秒,默认一天
paths: 'auto',
placeholder: {
'/': '搜索文档...',
},
noData: {
'/': '找不到结果',
},
},
// load sidebar from _sidebar.md
loadSidebar: '_sidebar',
subMaxLevel: 2,
autoHeader: true,
auto2top: true,
mergeNavbar: true,
formatUpdated: '{YYYY}-{MM}-{DD} {HH}:{mm}:{ss}',
plugins: [
/*
function(hook){
var renderScriptNode=function(str){
return str.replace(/```.*?\r?\n['"]run['"];[^]*?\r?\n```/g,function(x){
return eval(`(function(){${x.replace(/```.*?\r?\n['"]run['"];/,'').slice(0,-3)}})()`)
})
}
var renderMotaAction=function(str){
return str.replace(bg.pattern,function(x){
return bg.replaceFunc(x)
})
}
hook.beforeEach(function(content){
return renderMotaAction(renderScriptNode(
content
))
})
hook.doneEach(function(){
var map=bg.replaceToken
var node=document.querySelector('.markdown-section')
var str=node.innerHTML
for(var id in map){
str=str.replace(id,map[id])
}
node.innerHTML=str
})
}
*/
]
}
</script>
<!-- 为了保证时序用脚本加载这两个 -->
<script src="docsify.min.js"></script>
<script src="search.min.js"></script>
<!--
<script src="../_server/blockly/Converter.bundle.min.js"></script>
<script src="../_server/blockly/blockly_compressed.js"></script>
<script src="../_server/blockly/blocks_compressed.js"></script>
<script src="../_server/blockly/javascript_compressed.js"></script>
<script src="../_server/blockly/zh-hans.js"></script>
<script src='../_server/MotaActionParser.js'></script>
<script>
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState != 4) return;
if (xhr.status != 200) {
alert("图块描述文件加载失败, 请在'启动服务.exe'中打开编辑器");
return;
}
var grammerFile = xhr.responseText;
converter = new Converter().init();
converter.generBlocks(grammerFile);
//printf(converter.blocks);
converter.renderGrammerName();
//converter.generToolbox();
converter.generMainFile();
//printf(converter.mainFile.join(''));
//console.log(converter);
var script = document.createElement('script');
script.innerHTML = converter.mainFile[5] + converter.mainFile[6];
window.core={material:{items:[],enemys:[]}}
document.body.appendChild(script);
MotaActionFunctions.disableReplace = true;
MotaActionFunctions.disableExpandCompare = true;
script = document.createElement('script');
script.src='https://cdn.bootcss.com/docsify/4.5.5/docsify.min.js'
document.body.appendChild(script);
script = document.createElement('script');
script.src='https://cdn.bootcss.com/docsify/4.5.5/plugins/search.min.js'
document.body.appendChild(script);
}
xhr.open('GET', '../_server/MotaAction.g4', true);
xhr.send(null);
</script> -->
</body>
</html>