From 61b9e2a277137d71cb4ce15a6fb8520b1d5fd29b Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Thu, 30 Jun 2022 18:44:58 -0700 Subject: [PATCH] Merge report_window.js into post.js Signed-off-by: Alek Ratzloff --- board/static/board/post.js | 24 +++++++++++++++++++++++ board/static/board/report_window.js | 20 ------------------- board/templates/board/post_detail.html | 4 ---- board/templates/board/report_success.html | 4 ---- 4 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 board/static/board/report_window.js diff --git a/board/static/board/post.js b/board/static/board/post.js index 7ec269e..5749d2f 100644 --- a/board/static/board/post.js +++ b/board/static/board/post.js @@ -2,6 +2,7 @@ const OPEN = "open"; const CLOSED = "closed"; const replyWindowName = "reply-window"; const postWindowName = "post-window"; +const reportWindowName = "report-window" function documentClick(e) { let sender = e.target; @@ -124,6 +125,29 @@ function getPostWindow() { return window.top.jsFrame.getWindowByName(postWindowName); } +//////////////////////////////////////////////////////////////////////////////// +// Report window +//////////////////////////////////////////////////////////////////////////////// + +function getReportWindow() { + return window.top.jsFrame.getWindowByName(reportWindowName); +} + +function openReportWindow(reportUrl) { + // If there's already a report window open, close it and open this one. + if (window.top.jsFrame.containsWindowName(reportWindowName)) { + getReportWindow().closeFrame(); + } + let reportWindow = window.top.jsFrame.create({ + url: reportUrl, + name: reportWindowName, + modal: true, + width: 360, + height: 95, + }); + reportWindow.show(); +} + //////////////////////////////////////////////////////////////////////////////// // Events //////////////////////////////////////////////////////////////////////////////// diff --git a/board/static/board/report_window.js b/board/static/board/report_window.js deleted file mode 100644 index 3703246..0000000 --- a/board/static/board/report_window.js +++ /dev/null @@ -1,20 +0,0 @@ -const reportWindowName = "report-window" - -function getReportWindow() { - return window.top.jsFrame.getWindowByName(reportWindowName); -} - -function openReportWindow(reportUrl) { - // If there's already a report window open, close it and open this one. - if (window.top.jsFrame.containsWindowName(reportWindowName)) { - getReportWindow().closeFrame(); - } - let reportWindow = window.top.jsFrame.create({ - url: reportUrl, - name: reportWindowName, - modal: true, - width: 360, - height: 95, - }); - reportWindow.show(); -} \ No newline at end of file diff --git a/board/templates/board/post_detail.html b/board/templates/board/post_detail.html index 8888547..95d2d4b 100644 --- a/board/templates/board/post_detail.html +++ b/board/templates/board/post_detail.html @@ -7,10 +7,6 @@ {% endwith %} {% endblock title %} -{% block extrajs %} - -{% endblock extrajs %} - {% block content %} {# board header #}
diff --git a/board/templates/board/report_success.html b/board/templates/board/report_success.html index c452826..5974af8 100644 --- a/board/templates/board/report_success.html +++ b/board/templates/board/report_success.html @@ -2,10 +2,6 @@ {% load i18n static %} {# Title #} {% block title %}{% translate "Report success" %}{% endblock %} -{# Extra JS #} -{% block extrajs %} - -{% endblock extrajs %} {# Body #} {% block content %}