]> git.aero2k.de Git - dfde/quickmods.git/commitdiff
hopefully fixes the problems with the logging being available with firebug open only...
authorThorsten <mail@aero2k.de>
Sat, 16 Jan 2016 22:30:47 +0000 (23:30 +0100)
committerThorsten <mail@aero2k.de>
Sat, 16 Jan 2016 22:30:47 +0000 (23:30 +0100)
quickmod.user.js

index 5ba50c79f4fe888b93a7049167559f9924aa74ef..26eb305d2b4e424b96263f426c0544d5f2a6f394 100644 (file)
@@ -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(
         {