diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/note/note.js | 12 | ||||
| -rw-r--r-- | plugins/share/share.js | 18 | ||||
| -rw-r--r-- | plugins/shorten_expanded/init.js | 7 |
3 files changed, 10 insertions, 27 deletions
diff --git a/plugins/note/note.js b/plugins/note/note.js index 00deb0543..98b639358 100644 --- a/plugins/note/note.js +++ b/plugins/note/note.js @@ -5,7 +5,7 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { Plugins.Note = { set_click_handler: function() { - App.findAll(".article-note[data-note-for]").forEach((note) => { + document.querySelectorAll('.article-note[data-note-for]').forEach((note) => { note.onclick = function() { Plugins.Note.edit(this.getAttribute('data-note-for')); } @@ -23,13 +23,9 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { dialog.hide(); if (reply) { - App.findAll(`div[data-note-for="${reply.id}"]`).forEach((elem) => { - elem.querySelector(".body").innerHTML = reply.note; - - if (reply.note) - elem.show(); - else - elem.hide(); + document.querySelectorAll(`div[data-note-for="${reply.id}"]`).forEach((elem) => { + elem.querySelector('.body').innerHTML = reply.note; + reply.note ? elem.show() : elem.hide(); }); } }); diff --git a/plugins/share/share.js b/plugins/share/share.js index f27e06678..0ae4b2031 100644 --- a/plugins/share/share.js +++ b/plugins/share/share.js @@ -23,10 +23,7 @@ Plugins.Share = { target.href = target.href.replace(/&key=.*$/, "&key=" + new_link); - const icon = document.querySelector(".share-icon-" + id); - - if (icon) - icon.addClassName("is-shared"); + document.querySelector('.share-icon-' + id)?.classList.add('is-shared'); Notify.close(); @@ -42,12 +39,7 @@ Plugins.Share = { if (confirm(__("Remove sharing for this article?"))) { xhr.post("backend.php", App.getPhArgs("share", "unshare", {id: id}), (reply) => { Notify.info(reply); - - const icon = document.querySelector(".share-icon-" + id); - - if (icon) - icon.removeClassName("is-shared"); - + document.querySelector('.share-icon-' + id)?.classList.remove('is-shared'); dialog.hide(); }); } @@ -61,11 +53,7 @@ Plugins.Share = { xhr.post("backend.php", App.getPhArgs("share", "shareDialog", {id: id}), (reply) => { dialog.attr('content', reply) - - const icon = document.querySelector(".share-icon-" + id); - - if (icon) - icon.addClassName("is-shared"); + document.querySelector('.share-icon-' + id)?.classList.add('is-shared'); }); }); diff --git a/plugins/shorten_expanded/init.js b/plugins/shorten_expanded/init.js index a89fe8e92..b541b750e 100644 --- a/plugins/shorten_expanded/init.js +++ b/plugins/shorten_expanded/init.js @@ -52,13 +52,12 @@ Plugins.Shorten_Expanded = { this.observer.observe(row); }, expand: function(id) { - const row = App.byId(id); + const row = document.getElementById(id); if (row) { - const content = row.querySelector(".content-shrink-wrap"); - const link = row.querySelector(".expand-prompt"); + const link = row.querySelector('.expand-prompt'); - if (content) content.removeClassName("content-shrink-wrap"); + row.querySelector('.content-shrink-wrap')?.classList.remove('content-shrink-wrap'); if (link) Element.hide(link); } |