discourse-legacysite-perl/site/glist/templates/common/spellcheck_inline.html
2024-06-17 22:24:05 +10:00

71 lines
2.0 KiB
HTML

<script>
var interval_handle;
function init() {
var sc = parent.sc;
if (typeof(sc) == 'undefined') {
alert("Object spellcheck does not exist. Please check your template!");
return;
}
if (sc.loaded) {
clearInterval(interval_handle);
<%if do eq 'msg_addword'%>
<%if error%>alert("<%error%>")<%else%>alert("'<%word%>' has been added to the dictionary.")<%endif%>
<%endif%>
var objects = sc.objects;
objects.checkForm = document.result_form;
<%if words or $text_words%>
loadWords();
if (objects.checkContent != 'undefined' && objects.checkForm)
sc.check();
<%endif%>
sc.formLoaded = true;
}
}
function loadWords() {
var sc = parent.sc;
sc.words[0] = [
<%loop words%>
['<%escape_js word%>', <%if misspelled%>1, '<%escape_js word%>'<%else%>0<%endif%>]<%unless last%>,<%endunless%><%--
--%><%endloop%>
];
<%if misspellings%>
sc.corrections[0] = {
<%misspellings%>
};
sc.misspelled = true;
<%else%>
sc.misspelled = false;
<%endif%>
sc.words[1] = [
<%loop text_words%>
['<%escape_js word%>', <%if misspelled%>1, '<%escape_js word%>'<%else%>0<%endif%>]<%unless last%>,<%endunless%><%--
--%><%endloop%>
];
<%if text_misspellings%>
sc.corrections[1] = {
<%text_misspellings%>
};
sc.misspelled = true;
<%endif%>
}
window.onload = function() {
interval_handle = setInterval(init, 500);
}
</script>
<body>
<form name="result_form" action="glist.cgi" method="post">
<%hidden_objects%>
<input id="do" name="do" type="hidden" value="msg_spellcheck">
<input name="inline" type="hidden" value="1">
<input name="emode" type="hidden" value="<%if emode%><%emode%><%endif%>">
<input name="advanced_editor" type="hidden" value="0">
<input name="compose_is_html" type="hidden" value="0">
<input name="content" type="hidden" value="">
<%if emode eq 'multi'%><input name="content2" type="hidden" value=""><%endif%>
</form>
</body>