HF ToolBar Lite

HFTB without GM_config (mobile friendly)

当前为 2017-02-16 提交的版本,查看 最新版本

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