lash's Zetaboards Improvement Script

An all-in-one script that works on pretty much every Zetaboards forum, adding a sidebar and other code.

当前为 2015-09-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name lash's Zetaboards Improvement Script
  3. // @namespace zetaboards-improvement
  4. // @description An all-in-one script that works on pretty much every Zetaboards forum, adding a sidebar and other code.
  5. // @include http://stackoverflow.com/questions/14722302/*
  6. // @include http://starforcerp.com/*
  7. // @include starforcerp.com/*
  8. // @include http://sonic-cyclone.net/*
  9. // @version 1
  10. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
  11. // @grant GM_addStyle
  12. // ==/UserScript==
  13. $('.topic-buttons').prepend(" <a href='"+$('#foot_links a:contains(Track Topic)').attr('href')+"'><img src='http://z5.ifrm.com/9054/18/0/f5307276/track_topic.png' alt='track topic' /></a>");
  14.  
  15. $("body").append ( ' \
  16. <div id="gmRightSideBar"> \
  17. <p>F9 toggles visibility</p> \ \
  18. <div id="user_control_panel" class="cat_head"> \
  19. </div> \
  20. </div> \
  21. ' );
  22. var itm = document.getElementById("cboxdiv");
  23. var cln = itm.cloneNode(true);
  24. document.getElementById("user_control_panel").appendChild(cln);
  25. //-- Fade panel when not in use
  26. var kbShortcutFired = false;
  27. var rightSideBar = $('#gmRightSideBar');
  28. rightSideBar.hover (
  29. function () {
  30. $(this).stop (true, false).fadeTo (50, 1 );
  31. kbShortcutFired = false;
  32. },
  33. function () {
  34. if ( ! kbShortcutFired ) {
  35. $(this).stop (true, false).fadeTo (900, 0.1);
  36. }
  37. kbShortcutFired = false;
  38. }
  39. );
  40. rightSideBar.fadeTo (2900, 0.1);
  41.  
  42. //-- Keyboard shortcut to show/hide our sidebar
  43. $(window).keydown (keyboardShortcutHandler);
  44.  
  45. function keyboardShortcutHandler (zEvent) {
  46. //--- On F9, Toggle our panel's visibility
  47. if (zEvent.which == 120) { // F9
  48. kbShortcutFired = true;
  49.  
  50. if (rightSideBar.is (":visible") ) {
  51. rightSideBar.stop (true, false).hide ();
  52. }
  53. else {
  54. //-- Reappear opaque to start
  55. rightSideBar.stop (true, false).show ();
  56. rightSideBar.fadeTo (0, 1);
  57. rightSideBar.fadeTo (2900, 0.1);
  58. }
  59.  
  60. zEvent.preventDefault ();
  61. zEvent.stopPropagation ();
  62. return false;
  63. }
  64. }
  65.  
  66. GM_addStyle ( " \
  67. #gmRightSideBar { \
  68. position: fixed; \
  69. top: 0; \
  70. left: 0; \
  71. margin: 1ex; \
  72. background-color: rgba(255, 0, 0, 0.5) \
  73. width: 200px; \
  74. max-width:200px; \
  75. z-index: 6666; \
  76. opacity: 0.9; \
  77. height: 100%; \
  78. overflow: auto; \
  79. } \
  80. #gmRightSideBar p { \
  81. font-size: 80%; \
  82. } \
  83. #gmRightSideBar ul { \
  84. margin: 0ex; \
  85. } \
  86. #gmRightSideBar a { \
  87. color: blue; \
  88. } \
  89. " );
  90. jQuery(function() {
  91. var base_url = window.location.origin;
  92. jQuery.get(base_url+"/home"+"?forceads", "", function (data) {
  93. //jQuery(data).find("#boardmeta").appendTo ("#user_control_panel");
  94. //jQuery(data).find("#ucp_splash").appendTo ("#user_control_panel");
  95.  
  96. jQuery(data).find("#subscriptions").appendTo("#user_control_panel");
  97. jQuery(data).find(".ucp:has(thead tr th:contains(Forum Subscriptions))").appendTo ("#user_control_panel");
  98. jQuery("#subscriptions thead tr th").attr("colspan","2");
  99.  
  100. jQuery("#subscriptions .c_foot form").remove();
  101. jQuery(".ucp:has(thead tr th:contains(Forum Subscriptions)) .c_foot form").remove();
  102. }, "html");
  103.  
  104. });
  105. function addGlobalStyle(css) {
  106. var head, style;
  107. head = document.getElementsByTagName('head')[0];
  108. if (!head) { return; }
  109. style = document.createElement('style');
  110. style.type = 'text/css';
  111. style.innerHTML = css;
  112. head.appendChild(style);
  113. }
  114. addGlobalStyle('iframe {width:100% !important;}');
  115. addGlobalStyle('table#subscriptions tbody > tr th:nth-child(3), table#subscriptions tbody > tr th:nth-child(4), table#subscriptions tbody > tr th:nth-child(2), table#subscriptions tr[class*="row"] td:nth-child(3), table#subscriptions tr[class*="row"] td:nth-child(4), table#subscriptions tr[class*="row"] td:nth-child(2),table#subscriptions tr[class*="row"] td:nth-child(6), table#subscriptions tbody > tr th:nth-child(6) {display: none;}');