diff options
author | Andrew Dolgov <[email protected]> | 2021-02-18 21:51:18 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-18 21:51:18 +0300 |
commit | 70fa4230268a422d0b7eef1ea223ca5cc1c14646 (patch) | |
tree | a4dd25afda189691afbdeecc2f32c4ab09969e5e /js/Article.js | |
parent | 0b6a71f8eac719070747f22273f4bc7dee0526b6 (diff) |
initial for RIP prototype/scriptaculous
Diffstat (limited to 'js/Article.js')
-rw-r--r-- | js/Article.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/js/Article.js b/js/Article.js index 81917fd47..e7498f0b3 100644 --- a/js/Article.js +++ b/js/Article.js @@ -36,19 +36,19 @@ const Article = { const score = prompt(__("Please enter new score for selected articles:")); if (!isNaN(parseInt(score))) { - ids.each((id) => { - const row = $("RROW-" + id); + ids.forEach((id) => { + const row = App.byId("RROW-" + id); if (row) { row.setAttribute("data-score", score); - const pic = row.select(".icon-score")[0]; + const pic = row.querySelector(".icon-score"); pic.innerHTML = Article.getScorePic(score); pic.setAttribute("title", score); ["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"] - .each(function(scl) { + .forEach(function(scl) { if (row.hasClassName(scl)) row.removeClassName(scl); }); @@ -72,13 +72,13 @@ const Article = { if (!isNaN(parseInt(score))) { row.setAttribute("data-score", score); - const pic = row.select(".icon-score")[0]; + const pic = row.querySelector(".icon-score"); pic.innerHTML = Article.getScorePic(score); pic.setAttribute("title", score); ["score-low", "score-high", "score-half-low", "score-half-high", "score-neutral"] - .each(function(scl) { + .forEach(function(scl) { if (row.hasClassName(scl)) row.removeClassName(scl); }); @@ -104,7 +104,7 @@ const Article = { } }, */ cdmUnsetActive: function (event) { - const row = $("RROW-" + Article.getActive()); + const row = App.byId("RROW-" + Article.getActive()); if (row) { row.removeClassName("active"); @@ -249,7 +249,7 @@ const Article = { container.innerHTML += " "; // in expandable mode, save content for later, so that we can pack unfocused rows back - if (App.isCombinedMode() && $("main").hasClassName("expandable")) + if (App.isCombinedMode() && App.byId("main").hasClassName("expandable")) row.setAttribute("data-content-original", row.getAttribute("data-content")); row.removeAttribute("data-content"); @@ -351,7 +351,7 @@ const Article = { if (data) { const id = data.id; - const tags = $("ATSTR-" + id); + const tags = App.byId("ATSTR-" + id); const tooltip = dijit.byId("ATSTRTIP-" + id); if (tags) tags.innerHTML = data.content; @@ -370,13 +370,13 @@ const Article = { xhrJson("backend.php", {op: "article", method: "printArticleTags", id: id}, (reply) => { - dijit.getEnclosingWidget($("tags_str")) + dijit.getEnclosingWidget(App.byId("tags_str")) .attr('value', reply.tags.join(", ")) .attr('disabled', false); - new Ajax.Autocompleter("tags_str", "tags_choices", + /* new Ajax.Autocompleter("tags_str", "tags_choices", "backend.php?op=article&method=completeTags", - {tokens: ',', paramName: "search"}); + {tokens: ',', paramName: "search"}); */ }); }); @@ -386,8 +386,8 @@ const Article = { cdmMoveToId: function (id, params = {}) { const force_to_top = params.force_to_top || false; - const ctr = $("headlines-frame"); - const row = $("RROW-" + id); + const ctr = App.byId("headlines-frame"); + const row = App.byId("RROW-" + id); if (!row || !ctr) return; @@ -399,12 +399,12 @@ const Article = { if (id != Article.getActive()) { console.log("setActive", id, "was", Article.getActive()); - $$("div[id*=RROW][class*=active]").each((row) => { + App.findAll("div[id*=RROW][class*=active]").forEach((row) => { row.removeClassName("active"); Article.pack(row); }); - const row = $("RROW-" + id); + const row = App.byId("RROW-" + id); if (row) { Article.unpack(row); @@ -425,10 +425,10 @@ const Article = { return 0; }, scrollByPages: function (page_offset) { - App.Scrollable.scrollByPages($("content-insert"), page_offset); + App.Scrollable.scrollByPages(App.byId("content-insert"), page_offset); }, scroll: function (offset) { - App.Scrollable.scroll($("content-insert"), offset); + App.Scrollable.scroll(App.byId("content-insert"), offset); }, mouseIn: function (id) { this.post_under_pointer = id; |