From: Thorsten Date: Sat, 16 Jan 2016 22:30:47 +0000 (+0100) Subject: hopefully fixes the problems with the logging being available with firebug open only... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=d0e3af88cfc19c5c0cd6824745630139e9a3c6ff;p=dfde%2Fquickmods.git hopefully fixes the problems with the logging being available with firebug open only... and GM_Log is deprecated. --- 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( {