-
Notifications
You must be signed in to change notification settings - Fork 11
/
demo.html
125 lines (93 loc) · 4.42 KB
/
demo.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
<html>
<head>
</head>
<body>
<script
src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js"
integrity="sha512-3tlegnpoIDTv9JHc9yJO8wnkrIkq7WO7QJLi5YfaeTmZHvfrb1twMwqT4C0K8BLBbaiR6MOo77pLXO1/PztcLg=="
crossorigin="anonymous"
></script>
<script>
$(document).ready(function () {
$.ajax({
url: "https://languagetool.org/api/v2/languages",
dataType: "json",
}).done(function(data) {
$.each(data,function(i,rec) {
$('#setLanguage').append($('<option>', {value:rec['longCode'], text:rec['name']+' ['+rec['longCode']+']' }));
});
});
});
</script>
<div id="showNotice" style="position: absolute; width: 100%; height: 100%; background-color: #FFFFFF">
<div>
<b>Welcome to the LanguageTool TinyMCE 4.X Demo!</b>
<hr size=1>
Feel free to try out all kinds of settings. If you find any errors, please report it.<br>
For advanced users, the demo is set to debug mode so you can monitor the console.log for any additional errors that may not be apperent.<br>
<hr size=1>
Please set a few configuration options before we begin:
Language: <select id="setLanguage"><option value="en-US">English (US)</option></select>
<br><br>
Suggestions Context Menu: <select id="setMenu"><option value="right" selected>Right Click</option><option value="left">Left Click</option></select>
<br><br>
Context Menu Message Size: <select id="setMessage"><option value="0" selected>Short Message if available</option><option value="1">Long Message</option></select>
<br><br>
Set Processing Mode: <select id="setMode"><option value="new_sentence" selected>Send for processing only when sentence has finished</option><option value="new_word">Send for processing when word has finished</option><option value="manual">Process manually</option></select><br>
<br><br>
Emulate Instance: <select id="setInstance"><option value="500" selected>Private Server</option><option value="10000">Public Server</option></select><br>
<i>Private server is an example of the responsiveness you will get if you set your own languagetool private server (500ms or 0.5 seconds), public server is an example of the responsiveness you will get using the public server (10000ms or 10 seconds). The server will begin processing after you finish writing the line/paragraph</i>
<br><br>
Debug Level: <select id="setDebug"><option value="5" selected>DEBUG(5)</option><option value="0">NONE(0)</option><option value="4">INFO(4)</option><option value="6">TRACE(6)</option></select><br>
<i>0 would be the fastest but least preferable since you would not be able to debug via console.log, but if you want to just check speed, that would be the best option. For highest debug level is TRACE at 6.</i>
<hr size=1>
<input type="Button" value="Continue" id="startEditor">
</div>
</div>
<script>
$(document).on('click','#startEditor',function () {
if ( /^\w+?\.github\.io/i.test( window.location.hostname ) ) {
console.log( "HOST1="+window.location.hostname );
} else {
console.log( "HOST0="+window.location.hostname );
}
tinymce.init({
selector: "#mytextarea",
toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | languagetool',
height: 700,
lt_debug: $('#setDebug').val(),
lt_lang: $('#setLanguage').val(),
lt_mode: $('#setMode').val(),
lt_highlight_click: $('#setMenu').val(),
lt_full_message: $('#setMessage').val(),
lt_timer: $('#setInstance').val(),
plugins: ['code paste'],
external_plugins: {
'languagetool': 'https://knowzero.github.io/tinymce4-languagetool/languagetool/plugin.min.js'
}
});
$('#showNotice').hide();
});
$(document).on('click','#shMail',function () {
$(this).html( atob(atob('YTI1dmQzcGxjbTk0'))+'@'+atob('eWFob28uY29t') );
});
$(document).on('click','#processManual',function() {
tinymce.get('mytextarea').execCommand( 'mceLTProcess');
});
</script>
<hr size=1>
<button id="processManual">MANUAL PROCESS</button>
<hr size=1>
Github for bug reports:(Please mention browser and version)
<br>
Preferred Method:<br>
<a href="https://github.com/KnowZero/tinymce4-languagetool" target="_blank">https://github.com/KnowZero/tinymce4-languagetool</a><br>
Alternative method:(Email)<br>
<div id="shMail"><b>Click Here to Show</b></div>
<hr size=1>
<textarea id="mytextarea"></textarea>
</body>
</html>