HF ToolBar Lite

HFTB without GM_config (mobile friendly)

  1. // ==UserScript==
  2. // @name HF ToolBar Lite
  3. // @author xadamxk
  4. // @namespace https://github.com/xadamxk/HF-Scripts
  5. // @version 1.0.2
  6. // @description HFTB without GM_config (mobile friendly)
  7. // @require https://code.jquery.com/jquery-3.1.1.js
  8. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery.sticky/1.0.4/jquery.sticky.js
  9. // @match *hackforums.net/showthread.php?tid=*
  10. // @match *hackforums.net/usercp.php
  11. // @match *hackforums.net/forumdisplay.php?fid=*
  12. // @match *hackforums.net/private.php*
  13. // @match *hackforums.net
  14. // @copyright 2016+
  15. // @iconURL https://raw.githubusercontent.com/xadamxk/HF-Userscripts/master/scripticon.jpg
  16. // ------------------------------ Change Log ----------------------------
  17. // version 1.0.0: Beta Release
  18. // ==/UserScript==
  19. // ------------------------------ Dev Notes -----------------------------
  20. //
  21. // ------------------------------ SETTINGS ------------------------------
  22. if (!window.location.href.includes("hackforums.net/newreply.php?tid=")){
  23. createStickyHeader();
  24. }
  25. // ------------------------------ Page Load ------------------------------
  26. function createStickyHeader(){
  27. var headerHeight = "18px";
  28. // Create toolbar
  29. $("#panel").append($("<div>").attr("id","Sticky")
  30. .css("height","22px").css("background-color","#333333")
  31. .css("border-style","solid").css("border-color","white").css("border-width","0px 0px 1px 0px")
  32. .css("align-items","center").css("z-index","100"));
  33. // Left
  34. $("#Sticky").append($("<div>").attr("id","leftSticky").addClass("float_left").text("")
  35. .css("padding-left","5px").css("display","block").css("height",headerHeight));
  36. // Center
  37. $("#leftSticky").append($("<a>").attr("href","https://hackforums.net/forumdisplay.php?fid=25").text("Lounge"));
  38. $("#leftSticky").append(" | ");
  39. $("#leftSticky").append($("<a>").attr("href","https://hackforums.net/forumdisplay.php?fid=2").text("RANF"));
  40. $("#leftSticky").append(" | ");
  41. $("#leftSticky").append($("<a>").attr("href","https://hackforums.net/forumdisplay.php?fid=53").text("Groups"));
  42. $("#leftSticky").append(" | ");
  43. $("#leftSticky").append($("<a>").attr("href","https://hackforums.net/private.php?action=tracking").text("PM Tracking"));
  44. $("#leftSticky").append(" | ");
  45. $("#leftSticky").append($("<a>").attr("href","https://hackforums.net/forumdisplay.php?fid=247").text("Web Browsers"));
  46. $("#leftSticky").append(" | ");
  47. // Right
  48. $("#Sticky").append($("<div>").attr("id","rightSticky").css("float","right").css("height",headerHeight));
  49. $("#rightSticky").append($("<a>").text("New Posts").attr("href","https://hackforums.net/search.php?action=getnew").attr("onClick",""));
  50. $("#rightSticky").append(" | ");
  51. // Your Threads (right)
  52. $("#rightSticky").append($("<a>").text("Your Threads").attr("href","https://hackforums.net/search.php?action=finduserthreads&uid="+getUID()).attr("onClick",""));
  53. $("#rightSticky").append(" | ");
  54. // Your Posts (right)
  55. $("#rightSticky").append($("<a>").text("Your Posts").attr("href","https://hackforums.net/search.php?action=finduser&uid="+getUID()).attr("onClick",""));
  56.  
  57. // Sticky
  58. $(document).ready(function(){
  59. $("#Sticky").sticky();
  60. });
  61. }
  62.  
  63. function getUID(){
  64. var profileLink = "";
  65. if ($("#panel a:eq(0)").length > 0)
  66. profileLink = $("#panel a:eq(0)").attr("href");
  67. if (profileLink.includes("hackforums.net/member.php?action=profile&uid="))
  68. profileLink = profileLink.replace(/\D/g,'');
  69. return profileLink;
  70. }