diff options
| author | Benjamin Southall <applemansigloo@gmail.com> | 2017-09-03 23:18:05 +0900 |
|---|---|---|
| committer | Benjamin Southall <applemansigloo@gmail.com> | 2017-09-03 23:18:05 +0900 |
| commit | a58c213a4ee531fa1e1f5a0382d25f3984dd243e (patch) | |
| tree | 08f375d95d47889d57003f9364ac172ad7d651aa /js/loadsummernote.js | |
| parent | f78db77a81994917021dcff4c08e756a3f29c8f2 (diff) | |
Add summernote WYSIWIG post editor (experimental)
Diffstat (limited to 'js/loadsummernote.js')
| -rw-r--r-- | js/loadsummernote.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/js/loadsummernote.js b/js/loadsummernote.js new file mode 100644 index 00000000..f58624cf --- /dev/null +++ b/js/loadsummernote.js @@ -0,0 +1,34 @@ +if (active_page === "thread" || active_page === "index" || active_page === "ukko") { + +$(document).on("ready", function() { +if (window.Options && Options.get_tab('general')) { + Options.extend_tab("general", + "<fieldset><legend>Editor Dialog </legend>" + + ("<label class='summer-note' id='summernote'><input type='checkbox' /> Enable Summernote WYSIWYG Editor</label>") + + "</fieldset>"); +} + +$('.summer-note').on('change', function(){ + var setting = $(this).attr('id'); + + localStorage[setting] = $(this).children('input').is(':checked'); + location.reload(); +}); + +if (!localStorage.summernote) { + localStorage.summernote = 'false'; +} + +function getSetting(key) { + return (localStorage[key] == 'true'); +} + +if (getSetting('summernote')) $('#summernote>input').prop('checked', 'checked'); + +function initsummernote() { + if (!getSetting("summernote")) {return;} + $('#body').summernote(); +} +initsummernote(); +}); +} |
