-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
160 lines (139 loc) · 6.03 KB
/
index.html
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html>
<head>
<title>HTML Editor Online and Save</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="@tranchausky">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<script src="jquery.min.js"></script>
<script type="text/javascript">
var editboxHTML =
'<html class="expand close">' +
'<head>' +
'<style type="text/css">' +
'.expand { width: 100%; height: 100%; }' +
'.close { border: none; margin: 0px; padding: 0px; }' +
'.c-save { position: absolute; background: #3F51B5; color: white; padding: 3px; right: 0; top: 0; }' +
'.overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:rgba(0,0,0,.7);transition:opacity .5s;visibility:hidden;opacity:0}.overlay:target{visibility:visible;opacity:1}.overlay .popup{margin:70px auto;padding:20px;background:#fff;border-radius:5px;width:30%;position:relative;transition:all 5s ease-in-out}.overlay .popup h2{margin-top:0;color:#333;font-family:Tahoma,Arial,sans-serif}.overlay .popup .close{position:absolute;top:20px;right:30px;transition:all .2s;font-size:30px;font-weight:700;text-decoration:none;color:#333}.overlay .popup .close:hover{color:#06d85f}.overlay .popup .content{max-height:30%;overflow:auto}@media screen and (max-width:700px){.overlay .popup{width:70%}}' +
'#gorun{margin-top: 20px; font-weight: bold; font-style: italic;}'+
'.c-save:hover,a:hover{cursor: pointer;}'+
'html,body { overflow: hidden; }' +
'<\/style>' +
'<\/head>' +
'<body class="expand close" onload="document.f.ta.focus(); document.f.ta.select();">' +
'<form class="expand close" name="f">' +
'<textarea class="expand close" style="background: #def;" name="ta" wrap="hard" spellcheck="false">' +
'<\/textarea><div class="c-save" id="runsave">save</div>' +
'<\/form>' +
'<div id="popup1" class="overlay">' +
'<div class="popup">' +
' <h2>Here i am<\/h2>' +
' <a class="close" href="#">×<\/a>' +
' <div class="content">' +
' Thank to use click here to see' +
' <div id="gorun"><\/div>'
' <\/div>' +
' <\/div>' +
'<\/div>' +
'<\/body>' +
'<\/html>';
var defaultStuff = '<div style="float:left"><h3>Welcome to the real-time HTML Online!<\/h3>\n' +
'<p>It is free, public, no condition, no limit, for everyone :D.<\/p><\/div>'+
'<img width="120" src="https://i.imgur.com/vuZMAUD.gif">\n\n<br>\n <p>'+
`
<ul>
<li><a href="qr" target="_blank" rel="noopener">QR Code Generator</a></li>
<li><a href="pingpong" target="_blank" rel="noopener">Game PingPong</a></li>
</ul>
by tranchausky[@]gmail[.]com
`+ '</p>';
// I don't want this stuff to appear in the box at the top because I feel it's likely to be distracting.
var extraStuff = '';
var old = '';
function init() {
window.editbox.document.write(editboxHTML);
window.editbox.document.close();
window.editbox.document.f.ta.value = defaultStuff;
window.editbox.document.f.ta.value = defaultStuff;
update();
var select_click = window.editbox.document.getElementById("runsave")
var current_window =window.editbox.document
select_click.onclick = function () {
// console.log(old)
send_data(old, current_window)
}
}
function removespace(str){
//return str
return str.replace(/>\s+</g, "><");
}
var is_load = false
function send_data(datasend,current_window) {
var select_click =current_window.getElementById("runsave")
//alert('123')
if (is_load) return
var data_in = {};
//data_in.content = datasend;
data_in.content = removespace(datasend);
is_load = true
$.ajax(
{
method: 'POST',
//contentType: 'application/json',
dataType: 'Json',
url: 'https://public.03way.com/sendedata',
data: data_in,
beforeSend: function (xhr) {
select_click.innerHTML = 'loading...'
//xhr.setRequestHeader ('Authorization', 'Basic xxxx');
},
})
.done(function (data, textStatus, jqXHR) {
// do something here...
//console.log(jqXHR.responseJSON.id)
select_click.innerHTML = 'done'
window.setTimeout(function(){select_click.innerHTML = 'save';}, 150);
is_load = false
//window.editbox.document.getElementById('popup1').scrollIntoView();
//var el = current_window.getElementById('popup1');
//el.onclick();
var lik = 'view.html?id='+jqXHR.responseJSON.id;
var al = current_window.getElementById('link_go'); //or grab it by tagname etc
var gorun = current_window.getElementById('gorun'); //or grab it by tagname etc
// al.href = lik
contenvt = '<a onclick=" window.open(''+lik+'')">Link view<a/>';
gorun.innerHTML = contenvt;
//window.open(lik);
current_window.location.href = "#popup1";//open
})
.fail(function (jqXHR, textStatus, errMsg) {
is_load = false
// do something here...
select_click.innerHTML = 'false...'
});
}
function update() {
var textarea = window.editbox.document.f.ta;
var d = dynamicframe.document;
if (old != textarea.value) {
old = textarea.value;
d.open();
d.write(old);
if (old.replace(/[\r\n]/g, '') == defaultStuff.replace(/[\r\n]/g, ''))
d.write(extraStuff);
d.close();
//console.log('run1')
}
//console.log('run')
window.setTimeout(update, 150);
}
</script>
</head>
<frameset resizable="yes" rows="50%,*" onload="init();">
<!-- about:blank confuses opera, so use javascript: URLs instead -->
<frame name="editbox" src="javascript:'';">
<frame name="dynamicframe" src="javascript:'';">
</frameset>
<a href="list.html">List</a>
</html>