Skip to content

Commit

Permalink
更新检测器
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperIceCN committed May 13, 2020
1 parent dbb21f6 commit 3871147
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
41 changes: 41 additions & 0 deletions check.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>bn插件判别器</title>
</head>
<body>
<script>
function uploadandtest(){
var reader = new FileReader();
reader.onload = function()
{
var str = this.result
if(str!=undefined&&str.length>=10){
var httpRequest = new XMLHttpRequest();//第一步:创建需要的对象
httpRequest.open('POST', 'https://blocklunukkit-1488c9.service.tcloudbase.com/checkifEditor', true); //第二步:打开连接
httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");//设置请求头 注:post方式必须设置请求头(在建立连接后设置请求头)
httpRequest.send(str);//发送请求 将情头体写在send中
httpRequest.onreadystatechange = function () {//请求后的回调接口,可将请求成功后要执行的程序写在其中
if (httpRequest.readyState == 4 && httpRequest.status == 200) {//验证请求是否发送成功
var back = httpRequest.responseText;//获取到服务端返回的数据
if(back == "0"){
alert("非机制")
}else if(back == "1"){
alert("疑似机制")
}else if(back == "2"){
alert("确认机制")
}
}
};
}
}
var f = document.getElementById("sefile").files[0];
reader.readAsText(f);
}
</script>
<p>bn机制检测系统</p>
<input type="file" name="file" class="btn btn-outline-primary" id="sefile"></input>
<button onclick="uploadandtest()">进行检测</button>
</body>
</html>
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
<category name="JSON" colour=78>
<block type="json_emptyJSON"></block>
<block type="json_set"></block>
<block type="json_delete"></block>
</category>
</category>
<category name="动态">
Expand Down
34 changes: 34 additions & 0 deletions js/custom/JSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,38 @@ Blockly.JavaScript['json_set'] = function(block) {
Blockly.JavaScript.ORDER_FUNCTION_CALL) || '\'\'';
var text=jsontmp+'['+Key+'] = '+valuetmp+";\n"
return text;
};
Blockly.Blocks['json_delete'] = {
init: function() {
this.jsonInit({
"message0": "删除 %1 的键 %2 和其对应的值",
"args0": [
{
"type": "input_value",
"name": "JSON",
"check": "json"
},
{
"type": "input_value",
"name": "KEY",
"check": "String"
}
],
"nextStatement": null,
"previousStatement": null,
"inputsInline": false,
"colour": 97,
"tooltip": "删除json的指定键",
"helpUrl": "#"
});
}
};
Blockly.JavaScript['json_delete'] = function(block) {
//String or array length.
var jsontmp = Blockly.JavaScript.valueToCode(block, 'JSON',
Blockly.JavaScript.ORDER_FUNCTION_CALL) || '\'\'';
var keytmp = Blockly.JavaScript.valueToCode(block, 'KEY',
Blockly.JavaScript.ORDER_FUNCTION_CALL) || '\'\'';
var text="delete "+jsontmp+"["+keytmp+"];\n"
return text;
};

0 comments on commit 3871147

Please sign in to comment.