-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcht.js
More file actions
67 lines (64 loc) · 4.46 KB
/
cht.js
File metadata and controls
67 lines (64 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//Code Helper
function lr(l){
(m=>{m.id='browser';m.style='position:absolute;top:0%;left:0%;z-index:100;width:100%;height:100%;background-color:whitesmoke',document.body.appendChild(m)})(document.createElement('div'));
(n=>{n.innerHTML='<strong>内置浏览器</strong>';n.id='browser-head';n.style='position:absolute;top:0%;left:0%;width:100.5%;height:5%;background-color:whitesmoke;z-index:101',document.getElementById('browser').appendChild(n)})(document.createElement('div'));
(n=>{n.value='https://tiao2.github.io/';n.id='browser-input';n.style='position:absolute;top:5%;left:0%;width:100.5%;height:5%;background-color:whitesmoke;z-index:100.5;border:1px solid black;border-radius:0px;';n.type='search';document.getElementById('browser').appendChild(n)})(document.createElement('input'));
(n=>{n.innerHTML='<div class="tag tag-hover" id="tag-0"><code class="tn" id="tn-0">https://tiao2.github.io/</code><button class="dt" id="dt-0">×</button></div>';n.id='browser-tags';n.style='position:absolute;top:10%;left:0%;width:100.5%;height:3%;background-color:whitesmoke;z-index:101',document.getElementById('browser').appendChild(n)})(document.createElement('div'));
(n=>{n.src='https://tiao2.github.io/';n.id='browser-main';n.style='position:absolute;top:13%;left:0%;width:100%;height:87%;background-color:white;z-index:101',document.getElementById('browser').appendChild(n)})(document.createElement('iframe'));
(n=>{n.innerHTML='×';n.onclick=()=>document.getElementById('browser').remove();n.style='position:absolute;top:10%;left:95%;width:3%;height:80%;background-color:whitesmoke;border:none;z-index:102',document.getElementById('browser-head').appendChild(n)})(document.createElement('div'));
(n=>{n.innerHTML='+';n.onclick=()=>Editor.BrowserTab.addTag('');n.style='position:absolute;top:10%;left:95%;width:5%;height:80%;background-color:whitesmoke;border:none;z-index:102',document.getElementById('browser-tags').appendChild(n)})(document.createElement('button'));
var style = document.createElement('style');
style.textContent =atob("LnRhZyB7CiAgcG9zaXRpb246IGFic29sdXRlOwogIHRvcDogMCU7CiAgaGVpZ2h0OiAxMDAlOwogIGxpbmUtaGVpZ2h0OiAxMDAlOwogIHdpZHRoOiA1MCU7CiAgdGV4dC1hbGlnbjogY2VudGVyOwogIHotaW5kZXg6IDEwNTsKfQouZHQgewogIHBvc2l0aW9uOiBhYnNvbHV0ZTsKICBiYWNrZ3JvdW5kLWNvbG9yOiB3aGl0ZTsKICBib3JkZXI6IG5vbmU7CiAgdG9wOiAxMCU7CiAgbGVmdDogOTAlOwogIGhlaWdodDogODAlOwogIHdpZHRoOiAxMCU7CiAgei1pbmRleDogMTA1Owp9CgojdGFnLTAgeyBsZWZ0OiAwJTsgfQojdGFnLTEgeyBsZWZ0OiA1MCU7IH0KLnRhZy1ob3ZlciB7CiAgYmFja2dyb3VuZC1jb2xvcjogd2hpdGU7Cn0KLnRhZy11bmhvdmVyIHsKICBiYWNrZ3JvdW5kLWNvbG9yOiAjZWVlOwp9");
document.head.appendChild(style);
document.getElementById('browser-input').addEventListener('keydown', function(e){
if(e.key==='Enter'){
document.getElementById('browser-main').src=document.getElementById('browser-input').value;
document.getElementById('tn'+document.querySelector(".tag-hover").id.match(/-\d/)[0]).innerText=ur(document.getElementById('browser-input').value);
};
});
function ur(s){
var imp = /https?:\/\/[^\/]*\//i;
var a=s.match(imp);
if(a==null || a==undefined) a=(s+"/").match(imp);
if(a==null || a==undefined) return s;
return(a);
};
}
function st(){
var bl=document.createElement("div");
bl.style="position: absolute; top: 40%; left: 20%; height: 30%; width: 60%; background-color: skyblue;";
bl.id='0000';
document.body.appendChild(bl);
//边框
var bl1=document.createElement("h1");
bl1.style="color: white; font-size: 50px;";
bl1.innerHTML='<center>Code Helper</center>';
bl.appendChild(bl1);
//文字
var bl2=document.createElement("h1");
bl2.style="color: white; font-size: 30px;";
bl2.innerHTML='<center>正在加载中…</center>';
bl.appendChild(bl2);
//加载标识
var bl3=document.createElement("a");
bl3.style="color: white;";
bl3.href='javascript:lr("ol://console")'
bl3.innerHTML='<center>Console</center>';
bl.appendChild(bl3);
setTimeout(()=>{bl.style.display='none';}, 2000);
zbgz();
};
function edt(){
return((Editor.CommandTab.Visible)?'Console':'Editor');
}
function zbgz() {
setInterval(()=>{
if(document.getElementsByClassName('enter').length<2){
(m=>{m.className='enter';m.innerHTML='<a href="javascript:void(0)">打开 <strong>内置浏览器</strong></a>';document.getElementsByClassName('options')[0].appendChild(m);})(document.createElement('li'));
document.getElementsByClassName('enter')[1].addEventListener('click',function(){
lr("ol://");
});
};
},10);
}
st();