Files
adventurelandX/utility/htmls/executor.html
T
2023-10-15 13:06:58 +03:00

83 lines
3.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="/js/jquery/jquery-{{domain.jquery_version}}.min.js"{%if domain.electron%} onload="if(typeof require!=='undefined') window.$=window.jQuery=module.exports;"{%endif%}></script>
<script src="/js/codemirror/{{domain.cm_version}}/codemirror.js"></script>
<link href="/js/codemirror/{{domain.cm_version}}/codemirror.css" rel="stylesheet" type="text/css"/>
<link href="/js/codemirror/{{domain.cm_version}}/material.css" rel="stylesheet" type="text/css"/>
<script src="/js/codemirror/{{domain.cm_version}}/python.js"></script>
<script src="/js/common_functions.js?v={{domain.v}}"></script>
<script src="/js/functions.js?v={{domain.v}}"></script>
<link href="/css/common.css?v={{domain.v}}" rel="stylesheet" type="text/css"/>
<style>
b{
font-size: 12px;
color: #4D4B4E;
}
html,body{
margin:0;
padding:0;
background: #ECECEC;
}
a{
text-decoration: none;
color: #1D8885;
font-weight: 400;
}
</style>
</head>
<body>
<div style="padding: 10px">
<div id="code" style="width: 100%; height: 600px" class="borderbox">
</div>
<div class="borderbox" style="width: 100%; font-size: 0px; margin-top: 5px">
<button class="button borderbox" style="width: 89%; margin-right: 0.2%" onclick="execute()">Execute</button>
<button class="button borderbox" style="width: 10.8%" onclick="execute(1)">Defer</button>
</div>
<div id="output">
<div id="outputjson"></div>
<script>
value=syntax_highlight(JSON.stringify({
"inspect":"inspect=element",
"output":"escaped output",
"json_output":"prettified json output",
"html_output":"non-escaped output",
"strhtml":"output_html=strhtml(\x27{{'{{'}}macro.torep(element|to_dict){{'}}'}}\x27,element=user)",
"get_by_iid":"get_by_iid('model_name|key')",
"monster_analysis":"monster_analysis(logging)",
"drop_analysis":"drop_analysis(logging)",
"character_analysis":"inspect=character_analysis(\x27NAME\x27,logging)",
"game_analysis":"game_analysis(logging)",
"servers_eval":"servers_eval(\x27reload_server(1,data.reason);\x27,data={'reason':''})",
"block_account":"block_account(\x27NAME\x27,days,\x27Reason\x27) | days<0: unblock",
"disable_email":"disable_email(\x27reporter@mail.ru\x27,logging)",
"mref":"add_referrer_manually(\x27invited@gmail.com\x27,\x27player@gmail.com\x27,logging=None)",
"!behaviour":"get operations should be before output declarations to not reset them",
},undefined,4));
value="<pre>"+value+"</pre>";
$("#outputjson").html(value);
</script>
</div>
</div>
<script>
var codemirror = CodeMirror(function(current){$("#code").replaceWith(current);},{
value: "domain=gdi(self); user=get_user(self,domain); user_data=get_user_data(user)\n",
mode: "python",
indentUnit:4,
indentWithTabs:true,
/*,lineNumbers:true*/
});
function execute(is_task)
{
code=codemirror.getValue();
// loading code
$.post("/admin/executor",{code:code,is_task:is_task},function(c){
$("#output").html(c);
// stop loading code
});
}
</script>
</body>
</html>