-
Notifications
You must be signed in to change notification settings - Fork 0
/
injectAceDinamicly.html
212 lines (185 loc) · 7.75 KB
/
injectAceDinamicly.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="http://yandex.st/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
<textarea class="processed" name="form[html_header]" rows="10" cols="55"><!-- Внешние Библеотеки-->
<script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/ace.js" type="text/javascript"
charset="utf-8"></script>
<script src="https://ajaxorg.github.io/ace-builds/src-min-noconflict/ext-language_tools.js"></script>
<!-- Полупрозрачные баннеры-->
<style type="text/css">
a img {
filter: progid: DXImageTransform.Microsoft.Alpha(opacity=50);
-moz-opacity: 0.5; /* Mozilla 1.6 */
-khtml-opacity: 0.5; /* Konqueror 3.1, Safari 1.1 */
opacity: 0.5; /* CSS3 - Mozilla 1.7b +, Firefox 0.9 +, Safari 1.2+, Opera 9 */
filter: alpha(opacity=50); /* IE 5.5+*/
}
a:hover img {
filter: progid: DXImageTransform.Microsoft.Alpha(opacity=50);
-moz-opacity: 0.5; /* Mozilla 1.6 */
-khtml-opacity: 0.5; /* Konqueror 3.1, Safari 1.1 */
opacity: 1.0; /* CSS3 - Mozilla 1.7b +, Firefox 0.9 +, Safari 1.2+, Opera 9 */
filter: alpha(opacity=50); /* IE 5.5+*/
}
</style>
<!-- Стрелочки-->
<div style="position:fixed;z-index:1003; right :0.5%; bottom: 45%;">
<a href="#top" onclick="scrollTo(0,0); return false;" title="Вверх страницы">
<img src="http://i.imgur.com/SIo96ZC.png" alt="Вверх страницы">
</a>
<br>
<br>
<a href="#top" onclick="scrollTo(0, document.body.scrollHeight); return false;" title="Вниз страницы">
<img src="http://i.imgur.com/h1T23ld.png" alt="Вниз страницы">
</a>
</div>
<!--Запрет перехода на первую страницу при удалении тем и сообщений -->
<script type="text/javascript" src="http://premod.mybb.ru/files/0010/b4/f8/33839.js"></script>
<!-- Отключение репутации-->
<script type="text/javascript">
RusffCore.sets.reputation = 0;
</script>
<!-- Отключить функцию "Граффити"-->
<script type="text/javascript">
RusffCore.sets.graffiti = false;
</script>
<!-- Отключение "Поделиться"-->
<script type="text/javascript">
RusffCore.sets.share = false;
</script>
<!-- сервисных смайлов-->
<script type="text/javascript">
RusffCore.sets.rusff_smilepack = 0;
</script>
<!-- Отключение жалоб-->
<script type="text/javascript">
RusffCore.sets.show_reportBtn = 0;
</script>
<!-- Отключить функцию "Теги"-->
<script type="text/javascript">
RusffCore.sets.tags = false;
</script>
</textarea>
<script type="text/javascript">
function ValidURL(str) {
var pattern = new RegExp('^(https?:\/\/)?' + // protocol
'((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|' + // domain name
'((\d{1,3}\.){3}\d{1,3}))' + // OR ip (v4) address
'(\:\d+)?(\/[-a-z\d%_.~+]*)*' + // port and path
'(\?[;&a-z\d%_.~+=-]*)?' + // query string
'(\#[-a-z\d_]*)?$', 'i'); // fragment locater
if (!pattern.test(str)) {
alert("Please enter a valid URL.");
return false;
} else {
return true;
}
}
var urls = [
"https://ajaxorg.github.io/ace-builds/src-min-noconflict/ace.js",
"https://ajaxorg.github.io/ace-builds/src-min-noconflict/ext-language_tools.js"];
String.prototype.endsWith = function (suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
function createResource(url) {
var script;
if (url.endsWith(".js")) {
script = document.createElement('script');
script.sType = 'text/javascript';
script.src = url;
}
if (url.endsWith(".css")) {
script = document.createElement('style');
script.sType = 'text/css';
script.src = url;
}
return script;
}
function loadResource(url) {
var head = document.getElementsByTagName('head')[0];
head.appendChild(createResource(url));
}
function loadResourceWithCallback(url, callback) {
var head = document.getElementsByTagName('head')[0];
var script = createResource(url);
// Fire the loading
head.appendChild(script);
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
script.onload = script.onerror = function() {
if (!this.executed) { // выполнится только один раз
this.executed = true;
callback();
}
};
script.onreadystatechange = function() {
var self = this;
if (this.readyState == "complete" || this.readyState == "loaded") {
setTimeout(function() { self.onload() }, 0);// сохранить "this" для onload
}
};
}
function loadResourcesWithCallback(urls, callback, index) {
if(index == urls.length - 1) {
loadResourceWithCallback(urls[index], callback);
return;
}
// Adding the script tag to the head as suggested before
var head = document.getElementsByTagName('head')[0];
var script = createResource(urls[index]);
// Fire the loading
head.appendChild(script);
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
script.onload = script.onerror = function() {
if (!this.executed) { // выполнится только один раз
this.executed = true;
loadResourcesWithCallback(urls, callback, index + 1);
}
};
script.onreadystatechange = function() {
var self = this;
if (this.readyState == "complete" || this.readyState == "loaded") {
setTimeout(function() { self.onload() }, 0);// сохранить "this" для onload
}
};
}
var replaceProcessed = function () {
$('.processed').each(function () {
var textarea = $(this);
var mode = "html";
var editDiv = $('<div>', {
position: 'absolute',
width: textarea.width(),
height: textarea.height(),
'class': textarea.attr('class')
}).insertBefore(textarea);
textarea.hide();
// trigger extension
ace.require("ace/ext/language_tools");
var editor = ace.edit(editDiv[0]);
editor.$blockScrolling = Infinity;
editor.setTheme("ace/theme/cobalt");
editor.getSession().setMode("ace/mode/" + mode);
editor.getSession().setValue(textarea.val());
// enable autocompletion and snippets
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
// copy back to textarea on form submit...
textarea.closest('form').submit(function () {
textarea.val(editor.getSession().getValue());
});
});
};
$(document).ready(loadResourcesWithCallback(urls, replaceProcessed, 0));
</script>
</body>
</html>