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