Support Forums
Support Forums Userscripts? - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Computer Support Topics (https://www.supportforums.net/forumdisplay.php?fid=4)
+---- Forum: Networking, Wifi, and Internet Connection Help (https://www.supportforums.net/forumdisplay.php?fid=29)
+----- Forum: Web Browser Help (https://www.supportforums.net/forumdisplay.php?fid=45)
+----- Thread: Support Forums Userscripts? (/showthread.php?tid=28798)



Support Forums Userscripts? - xadamxk - 10-09-2014

Do any of the older members have any SF userscripts?

If so, would you mind sharing them with us?


RE: Support Forums Userscripts? - D3xus - 10-09-2014

Most of the HF userscripts would presumably run the same here as on HF. You would just have to edit the domains from *hackforums.net* to *supportforums.net*, if I understand how they work correctly.


RE: Support Forums Userscripts? - Eternal. - 10-09-2014

(10-09-2014, 11:20 AM)D3xus Wrote: Most of the HF userscripts would presumably run the same here as on HF. You would just have to edit the domains from *hackforums.net* to *supportforums.net*, if I understand how they work correctly.

Yes that is correct. From Nico, a forum bookmarker.

Code:
// ==UserScript==
// @name       Forum-Bookmarker
// @namespace  TheEmpire
// @version    0.1
// @description  Allows you to bookmark some forums and add them to the header on HF.
// @include      *supportforums.net*
// @copyright  2014+, 1n9i9c7om
// @require      http://code.jquery.com/jquery-1.10.2.min.js
// @grant      GM_setValue
// @grant      GM_getValue
// @grant      GM_deleteValue
// @grant      GM_xmlhttpRequest
// ==/UserScript==

$(document).ready(function()
{

//GM_setValue("addedLinks", "fid=242|Empire|fid=280|Brotherhood|");
    console.log("addedLinks: " + GM_getValue("addedLinks"));
if(!GM_getValue("addedLinks") || GM_getValue("addedLinks") == "")
{
    GM_setValue("addedLinks", "empty");
}
    var addToHeader = "";
if(GM_getValue("addedLinks") != "empty")
{
       var linkList = GM_getValue("addedLinks").slice(0, -1).split("|");
      
       for (var i = 0; i < linkList.length; i++)
       {
           addToHeader += " | <a href='/forumdisplay.php?" + linkList[i] + "#remove'>";
           i++;
           addToHeader += linkList[i] + "</a>";
       }
}

var regex = /\(Unread(.*?)\)/;
var revised = "(Unread $1)" + addToHeader;
document.getElementById('panel').innerHTML = document.getElementById('panel').innerHTML.replace(regex,revised);
    
$("a").dblclick(function(event){
  if($(this).attr("href").indexOf("forumdisplay.php") > -1)
  {
    if($(this).attr("href").indexOf("#remove") > -1)
    {
        var url = $(this).attr("href");
         var fid = "fid=" + url.split("fid=")[1].split("#remove")[0];
         var fName = $(this).text();
        console.log("Before: " + GM_getValue("addedLinks"));
        GM_setValue("addedLinks", GM_getValue("addedLinks").replace(fid + "|" + fName + "|", ""));
        if(GM_getValue("addedLinks") == "")
        {
         GM_setValue("empty");  
        }
        console.log("After: " + GM_getValue("addedLinks"));
        alert(fName + " has been unbookmarked.");
         location.reload();
        return true;
    }
     var url = $(this).attr("href");
     var fid = "fid=" + url.split("fid=")[1];
     var fName = $(this).text();
     console.log(fid + "|" + fName + "|");
     if(GM_getValue("addedLinks") == "empty")
     {
         GM_setValue("addedLinks", fid + "|" + fName + "|");
     }
     else
     {
     GM_setValue("addedLinks", GM_getValue("addedLinks") + fid + "|" + fName + "|");
     }
     alert(fName + " has been bookmarked.");
     location.reload();
  }
});

});