From 6471b7d21bf571b4f1da911a5440239d0f936574 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 28 Apr 2017 17:53:46 +0200 Subject: Inline javascript for emoticon and markdown replacement has been outsourced into the main.js file. --- template/admin/html/page/form.php | 24 ++++++++++++------------ template/admin/html/post/form.php | 24 ++++++++++++------------ template/admin/html/user/form.php | 24 ++++++++++++------------ template/admin/rsrc/main.js | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 36 deletions(-) diff --git a/template/admin/html/page/form.php b/template/admin/html/page/form.php index 7d91af9..f254aeb 100644 --- a/template/admin/html/page/form.php +++ b/template/admin/html/page/form.php @@ -57,23 +57,23 @@
-
-
diff --git a/template/admin/html/post/form.php b/template/admin/html/post/form.php index 9603ded..8c894d0 100644 --- a/template/admin/html/post/form.php +++ b/template/admin/html/post/form.php @@ -57,23 +57,23 @@
-
-
diff --git a/template/admin/html/user/form.php b/template/admin/html/user/form.php index 374181c..73b5551 100644 --- a/template/admin/html/user/form.php +++ b/template/admin/html/user/form.php @@ -63,23 +63,23 @@
-
-
diff --git a/template/admin/rsrc/main.js b/template/admin/rsrc/main.js index 5405b29..a93b8be 100644 --- a/template/admin/rsrc/main.js +++ b/template/admin/rsrc/main.js @@ -118,4 +118,36 @@ addEventListener("DOMContentLoaded", function() { return confirm(e.target.getAttribute('data-text')); }; } +}, false); + +//============================================================================== +// Emoticon listener +//============================================================================== +addEventListener("DOMContentLoaded", function() { + if(document.getElementById("emoticon-list")) { + var list = document.getElementById("emoticon-list"); + var items = list.getElementsByTagName("li"); + + for(var i = 0; i < items.length; ++i) { + items[i].onmousedown = function(e) { + emoticonReplace(e.target.getAttribute('data-emoticon')); + }; + } + } +}, false); + +//============================================================================== +// Markdown listener +//============================================================================== +addEventListener("DOMContentLoaded", function() { + if(document.getElementById("markdown-list")) { + var list = document.getElementById("markdown-list"); + var items = list.getElementsByTagName("li"); + + for(var i = 0; i < items.length; ++i) { + items[i].onmousedown = function(e) { + markdownReplace(e.target.getAttribute('data-markdown')); + }; + } + } }, false); \ No newline at end of file -- cgit v1.2.3