From d0e3af88cfc19c5c0cd6824745630139e9a3c6ff Mon Sep 17 00:00:00 2001 From: Thorsten Date: Sat, 16 Jan 2016 23:30:47 +0100 Subject: [PATCH] hopefully fixes the problems with the logging being available with firebug open only... and GM_Log is deprecated. --- quickmod.user.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/quickmod.user.js b/quickmod.user.js index 5ba50c7..26eb305 100644 --- a/quickmod.user.js +++ b/quickmod.user.js @@ -7,7 +7,12 @@ // @version 0.3 // ==/UserScript== -_log = console.log; // TODO: check GM_log +_log = function(x) { + try { + console.log(x); + } catch(e) { + } +}; ARCHIVFORUMID = 35; boardurl = "/forum/"; user_id = "18865"; @@ -18,13 +23,13 @@ function get_post_id(_this) { } function get_thread_id() { - return window.location.search.match('t=([0-9]+)')[1]; + return window.location.search.match(/t=([0-9]+)/)[1]; } function get_forum_id() { - return window.location.search.match('f=([0-9]+)')[1]; + return window.location.search.match(/f=([0-9]+)/)[1]; } function get_session_id() { - return $("a[href*='?sid']:last").attr("href").match("sid=([a-z0-9]+)")[1]; + return $("a[href*='?sid']:last").attr("href").match(/sid=([a-z0-9]+)/)[1]; } function removepost(event) { @@ -58,7 +63,7 @@ function removepost(event) { _log(a, b, c); }, success: function(data, status) { - key = data.match("confirm_key=([A-Z0-9]+)")[1]; + key = data.match(/confirm_key=([A-Z0-9]+)/)[1]; _removepost(post_id, key); } } @@ -81,10 +86,10 @@ function removepost(event) { "redirect": "/", "sess": get_session_id(), "start": "0", - "subject": "[spam] " + $('#page-body h2').text(), + "subject": "[spam] " + $('#page-body').find('h2').text(), "t": thread_id, "to_forum_id": ARCHIVFORUMID - } + }; $.ajax( { -- 2.39.2