From 95a9b7b72bde0a3b529154fc1f25d64dabd51ddb Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 28 Feb 2015 05:06:50 -0800 Subject: Completely rewrite fix-report-delete-submit.js, add report/delete to menu --- templates/main.js | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'templates/main.js') diff --git a/templates/main.js b/templates/main.js index 59a632d7..b3aebcfb 100644 --- a/templates/main.js +++ b/templates/main.js @@ -71,25 +71,40 @@ var datelocale = function alert(a) { - var handler, div; - var close = function() { - handler.fadeOut(400, function() { handler.remove(); }); - return false; - }; +function alert(a, do_confirm, confirm_ok_action, confirm_cancel_action) { + var handler, div, bg, closebtn, okbtn; + var close = function() { + handler.fadeOut(400, function() { handler.remove(); }); + return false; + }; - handler = $("
").hide().appendTo('body'); + handler = $("
").hide().appendTo('body'); - $("
").click(close).appendTo(handler); + bg = $("
").appendTo(handler); - div = $("
").appendTo(handler); - $("") - .click(close).appendTo(div); + div = $("
").appendTo(handler); + closebtn = $("
") + .appendTo(div); - $("
").html(a).appendTo(div); + $("
").html(a).appendTo(div); - $("").click(close).appendTo(div); + okbtn = $("").appendTo(div); - handler.fadeIn(400); + if (do_confirm) { + confirm_ok_action = (typeof confirm_ok_action !== "function") ? function(){} : confirm_ok_action; + confirm_cancel_action = (typeof confirm_cancel_action !== "function") ? function(){} : confirm_cancel_action; + okbtn.click(confirm_ok_action); + $("").click(confirm_cancel_action).click(close).appendTo(div); + bg.click(confirm_cancel_action); + okbtn.click(confirm_cancel_action); + closebtn.click(confirm_cancel_action); + } + + bg.click(close); + okbtn.click(close); + closebtn.click(close); + + handler.fadeIn(400); } var saved = {}; -- cgit v1.3 From 6991ca270eb7ecd879a06971cc9df0334aab7687 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 5 May 2016 13:53:52 +0200 Subject: fix bad merge --- templates/main.js | 1 - 1 file changed, 1 deletion(-) (limited to 'templates/main.js') diff --git a/templates/main.js b/templates/main.js index b3aebcfb..7e3b2dc1 100644 --- a/templates/main.js +++ b/templates/main.js @@ -70,7 +70,6 @@ var datelocale = }; -function alert(a) { function alert(a, do_confirm, confirm_ok_action, confirm_cancel_action) { var handler, div, bg, closebtn, okbtn; var close = function() { -- cgit v1.3 From 02c3c28a16127511a785e428547f8a4dc60abaf7 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 5 May 2016 14:38:24 +0200 Subject: main.js: a bit more sane code --- js/thread-watcher.js | 4 ++-- templates/index.html | 6 ++++-- templates/main.js | 11 ++++------- templates/page.html | 2 +- templates/themes/catalog/catalog.html | 3 ++- templates/thread.html | 4 +++- 6 files changed, 16 insertions(+), 14 deletions(-) (limited to 'templates/main.js') diff --git a/js/thread-watcher.js b/js/thread-watcher.js index 960aa59f..c31a6e74 100644 --- a/js/thread-watcher.js +++ b/js/thread-watcher.js @@ -79,8 +79,8 @@ watchlist.add = function(sel) { } else { postCount = $(sel).parents('.op').siblings('.post').length+1; } - //Grab the reply link. - var threadLink = $(sel).siblings('a:contains("['+_('Reply')+']")').attr('href'); + //Grab the reply link.; + var threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href'); //Figure out the thread name. If anon, use the thread id. if ($(sel).parent().find('.subject').length) { threadName = $(sel).parent().find('.subject').text().substring(0,20); diff --git a/templates/index.html b/templates/index.html index 41e4867d..d4c56707 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,10 +4,12 @@ diff --git a/templates/main.js b/templates/main.js index 7e3b2dc1..c2a6f6c0 100644 --- a/templates/main.js +++ b/templates/main.js @@ -115,7 +115,10 @@ var styles = { {% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}', {% endraw %}{% endfor %}{% raw %} }; -var board_name = false; + +if (typeof board_name === 'undefined') { + var board_name = false; +} function changeStyle(styleName, link) { {% endraw %} @@ -159,13 +162,7 @@ function changeStyle(styleName, link) { {% endraw %} {% if config.stylesheets_board %} - {# This is such an unacceptable mess. There needs to be an easier way. #} - {# Needs fix for slugify #} - var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }})/); {% raw %} - if (matches) { - board_name = matches[1]; - } if (!localStorage.board_stylesheets) { localStorage.board_stylesheets = '{}'; diff --git a/templates/page.html b/templates/page.html index 3522702f..816bb72b 100644 --- a/templates/page.html +++ b/templates/page.html @@ -3,7 +3,7 @@ {% include 'header.html' %} {{ title }} diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 1011fdaf..1f5e8b05 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -4,7 +4,8 @@ {% include 'header.html' %} {{ settings.title }} diff --git a/templates/thread.html b/templates/thread.html index b7bb5f6b..506b9cc2 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -4,7 +4,9 @@ {% include 'header.html' %} -- cgit v1.3