Greasy Fork is available in English.

Flat Darkness - Stabless

Custom theme for Hack Forums. Base theme by Sasori.

  1. // ==UserScript==
  2. // @name Flat Darkness - Stabless
  3. // @namespace https://github.com/iHydra
  4. // @version 1.5.77
  5. // @description Custom theme for Hack Forums. Base theme by Sasori.
  6. // @include http://www.hackforums.net/*
  7. // @include http://hackforums.net/*
  8. // @author iHydra/Kondax/Sasori
  9. // @require https://code.jquery.com/jquery-2.1.4.min.js
  10. // @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js
  11. // @resource MainCSS https://raw.githubusercontent.com/StunningFX/StunningHFs/master/stylesheet_1.5.5.css
  12. // @resource HLCSS https://raw.githubusercontent.com/isagalaev/highlight.js/master/src/styles/monokai-sublime.css
  13. // @grant GM_addStyle
  14. // @grant GM_setValue
  15. // @grant GM_getValue
  16. // @grant GM_getResourceText
  17. // @run-at document-start
  18. // ==/UserScript==
  19.  
  20. var quotedPosts = GM_getValue("quotedPosts") == undefined ? [] : GM_getValue("quotedPosts");
  21. console.log(quotedPosts);
  22. //alert(GM_getValue("quotedPosts"));
  23.  
  24. /* INFORMATION - READ */
  25. // You can change Highlighter Theme: https://github.com/isagalaev/highlight.js/tree/master/src/styles || Demo of Themes: https://highlightjs.org/static/demo/
  26. // You can change the preview button shortcut key if you scroll down to USER EDITING.
  27.  
  28. // Copyright (c) 2011 Pete Boere (the-echoplex.net) Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
  29. !function(s){s.fn.alterClass=function(a,e){var r=this;if(-1===a.indexOf("*"))return r.removeClass(a),e?r.addClass(e):r;var n=new RegExp("\\s"+a.replace(/\*/g,"[A-Za-z0-9-_]+").split(" ").join("\\s|\\s")+"\\s","g");return r.each(function(a,e){for(var r=" "+e.className+" ";n.test(r);)r=r.replace(n," ");e.className=s.trim(r)}),e?r.addClass(e):r}}(jQuery);
  30.  
  31. var MainCSS = GM_getResourceText('MainCSS');
  32. GM_addStyle(MainCSS);
  33. var HLCSS = GM_getResourceText('HLCSS');
  34. GM_addStyle(HLCSS);
  35.  
  36. /*
  37. * USER EDITING
  38. */
  39.  
  40. var quotedColor = "#00ffd2"; // Color for when quoted by someone - Keep inside quotes - if you enter hex code, put # as prefix. Ex: "#282828" vs. "teal"
  41. var showLogo = false; // true to show logo, false to hide logo
  42. var enableSFW = false; // true to enable SFW, false to disable SFW (Safe For Work)
  43. var previewKey = 'w'; // ALT + {KEY} for Chrome || ALT + SHIFT + {KEY} for Firefox - More Info: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey
  44. var hideMenu = false; // true to remove menu nav links, false to show.
  45. var badges = false; // Badges Feature - false to disable feature. || **NOT DONE**
  46.  
  47. /*
  48. * END USER EDITING
  49. */
  50.  
  51. $(window).load(function () { // Theme Color Scheme Changer
  52. var cp = $('<div class=\'cp\'/>');
  53. var select = $('<div class=\'select\'/>');
  54. $('body').append(cp, select);
  55. var colours = {
  56. 'black': '#393939',
  57. 'blue': '#619ECB',
  58. 'green': '#44C146',
  59. 'orange': '#D29C2D',
  60. 'purple': '#724FAD',
  61. 'red': '#F72323',
  62. 'darkblue': '#00528f',
  63. 'darkgreen': '#44C146',
  64. 'darkorange': '#9A782E',
  65. 'darkpurple': '#4D2D5E',
  66. 'darkred': '#F72323'
  67. };
  68. if (!localStorage.getItem('theme'))
  69. localStorage.setItem('theme', 'cl-' + Object.keys(colours) [0]);
  70. $('body').addClass(localStorage.getItem('theme') ? localStorage.getItem('theme') : 'cl-' + Object.keys(colours) [0]);
  71. $('.cp').css('background', colours[$('body').attr('class').split(' ') [0].substring(3, $('body').attr('class').split(' ') [0].length)]);
  72. $.each(colours, function (key, value) {
  73. select.append($('<div class=\'part\' style=\'background: ' + value + ' !important;\' cid=\'' + key + '\'/>'));
  74. });
  75. $('.cp').click(function () {
  76. $('.select').toggleClass('show');
  77. });
  78. $('.part').click(function () {
  79. var cl = 'cl-' + $(this).attr('cid');
  80. $('.cp').css('background', colours[$(this).attr('cid')]);
  81. $('body').alterClass('cl-*', cl);
  82. localStorage.setItem('theme', cl);
  83. });
  84. });
  85.  
  86. /** START SETTINGS PANEL **/
  87.  
  88. // TBA
  89.  
  90. /** END SETTINGS PANEL **/
  91.  
  92.  
  93. /** Custom Functions **/
  94.  
  95.  
  96. $('code').each(function(i, block) { // Highlight Syntax
  97. hljs.highlightBlock(block);
  98.  
  99. });
  100.  
  101.  
  102. /*
  103. * Modifications (jQuery/jS for multi-browser support)
  104. */
  105.  
  106. $(document).ready(function () {
  107. $('div.menu > ul').attr('style','text-align:center !important;');
  108. $('img[src$="hackforums.net/images/modern_bl/starstaff.png"]').attr('style', 'filter: hue-rotate(5deg) saturate(8); -webkit-filter: hue-rotate(5deg) saturate(8)'); // Staff Stars Color Change
  109. $('img[src$="hackforums.net/images/modern_bl/dismiss_notice.gif"]').attr('src', 'http://i.imgur.com/uxvQQDI.png'); // PM Notif Dismiss Icon
  110. $('img[src$="hackforums.net/images/modern_bl/add_buddy.gif"]').attr('src', 'http://i.imgur.com/3d5FKNX.png'); // Add Buddy Icon
  111. $('img[src$="hackforums.net/images/modern_bl/remove_buddy.gif"]').attr('src', 'http://i.imgur.com/zDwBkq5.png'); // Remove Buddy Icon
  112. $('img[src$="hackforums.net/images/modern_bl/add_ignore.gif"]').attr('src', 'http://i.imgur.com/u3NZbDu.png'); // Add Ignore Icon
  113. $('img[src$="hackforums.net/images/modern_bl/remove_ignore.gif"]').attr('src', 'http://i.imgur.com/zDwBkq5.png'); // Remove Ignore Icon
  114. $('img[src$="/img/disable.png"]').attr('src', 'http://i.imgur.com/LXGekE9.png'); // Disable icon for multi-page loader userscript(not included)
  115. $('img[src$="/img/enable.png"]').attr('src', 'http://i.imgur.com/YHDATSF.png'); // Enable icon for multi-page loader userscript(not included)
  116. $('img[src$="hackforums.net/images/modern_bl/minioff.gif"]').attr('src', 'http://i.imgur.com/AP6vLRo.png').attr('style', 'padding-bottom: 2px;'); // No Posts SF Icon
  117. $('img[src$="hackforums.net/images/modern_bl/miniofflock.gif"]').attr('src', 'http://i.imgur.com/AP6vLRo.png').attr('style', 'padding-bottom: 2px;'); // No Posts SF Icon Locked
  118. $('img[src$="hackforums.net/images/modern_bl/minion.gif"]').attr('src', 'http://i.imgur.com/Wsl1Gfc.png').attr('style', 'padding-bottom: 3px;'); // New Posts SF icon
  119. $('img[src$="http://hackforums.net/images/modern_bl/spinner_big.gif"]').attr('src', 'http://i.imgur.com/y3wDcUA.gif'); // Quick Reply Spinner Change
  120. $('span:contains("Moderated")').addClass('sevenpad'); // Padding fix
  121. $('link[href*="star_ratings"]').remove(); // Star Ratings Change
  122. $('#pm_notice').removeClass('pm_alert').addClass('pm_alert2'); // Group vs. PM Alert
  123.  
  124. $('code[class="hljs markdown"]').dblclick(function() {
  125. $(this).select();
  126.  
  127. var text = this,
  128. range, selection;
  129.  
  130. if (document.body.createTextRange) {
  131. range = document.body.createTextRange();
  132. range.moveToElementText(text);
  133. range.select();
  134. } else if (window.getSelection) {
  135. selection = window.getSelection();
  136. range = document.createRange();
  137. range.selectNodeContents(text);
  138. selection.removeAllRanges();
  139. selection.addRange(range);
  140. }
  141. });
  142.  
  143. if($("img[id*='multiquote_']").attr("src") === "http://hackforums.net/images/modern_bl/english/postbit_multiquote_on.gif") { // Multiquote IMG to CSS - By Snorlax
  144. $("img[id*='multiquote_']").hide().after("<button class='button' style='bottom: 7px;position: relative;cursor: pointer;outline: none;'>MQ-</button>");
  145. } else {
  146. $("img[id*='multiquote_']").hide().after("<button class='button' style='bottom: 7px;position: relative;cursor: pointer;outline: none;'>MQ+</button>");
  147. }
  148. $(".trow1 .button").on("click", function() {
  149. var postId = $(this).parent().attr("id").match(/multiquote_link_([0-9]*)/)[1];
  150. if($(this).text() == "MQ-") {
  151. quotedPosts.splice(quotedPosts.indexOf(postId), 1);
  152. } else {
  153. quotedPosts.push(postId);
  154. console.log(quotedPosts);
  155. }
  156. GM_setValue("quotedPosts", quotedPosts);
  157. $(this).text($(this).text() == "MQ+" ? "MQ-" : "MQ+");
  158. });
  159.  
  160. $(".trow1 .button").each(function() {
  161. var postId = $(this).parent().attr("id").match(/multiquote_link_([0-9]*)/)[1];
  162. if(GM_getValue("quotedPosts").indexOf(postId) >= 0) {
  163. $(this).text("MQ-");
  164. console.log(postId);
  165. }
  166. });
  167.  
  168. $("body").on("click", "#quickreply_multiquote", function() {
  169. console.log("Clicked");
  170. quotedPosts = [];
  171. GM_setValue("quotedPosts", quotedPosts);
  172. $(".button").each(function() {
  173. $(this).text("MQ+");
  174. console.log("SET TO MQ+");
  175. });
  176. });
  177.  
  178. $('.button2[name="previewpost"]').attr('accesskey',previewKey); // Preview Key Hotkey Shortcut
  179.  
  180. if(window.location.href == "http://hackforums.net/misc.php?action=buddypopup"){ // Buddy List Online Status Fix
  181. $('img[src$="hackforums.net/images/modern_bl/buddy_away.gif"]').attr('src', 'http://i.imgur.com/x7dAaGE.png').attr('style', ''); // Away Status
  182. $('img[src$="hackforums.net/images/modern_bl/buddy_online.gif"]').attr('src', 'http://i.imgur.com/lpKaTIB.png').attr('style', ''); // Online Status
  183. $('img[src$="hackforums.net/images/modern_bl/buddy_offline.gif"]').attr('src', 'http://i.imgur.com/EKt4fXk.png').attr('style', ''); // Offline Status
  184. }else if(window.location.href == "http://hackforums.net/usercp.php?action=editlists"){
  185. $('img[src$="hackforums.net/images/modern_bl/buddy_away.gif"]').attr('src', 'http://i.imgur.com/x7dAaGE.png').attr('style', 'vertical-align: top;'); // Away Status
  186. $('img[src$="hackforums.net/images/modern_bl/buddy_online.gif"]').attr('src', 'http://i.imgur.com/lpKaTIB.png').attr('style', 'vertical-align: top;'); // Online Status
  187. $('img[src$="hackforums.net/images/modern_bl/buddy_offline.gif"]').attr('src', 'http://i.imgur.com/EKt4fXk.png').attr('style', 'vertical-align: top;'); // Offline Status
  188. }else{
  189. $('img[src$="hackforums.net/images/modern_bl/buddy_away.gif"]').attr('src', 'http://i.imgur.com/x7dAaGE.png').attr('style', 'position: absolute; padding-top: 4px;'); // Away Status
  190. $('img[src$="hackforums.net/images/modern_bl/buddy_online.gif"]').attr('src', 'http://i.imgur.com/lpKaTIB.png').attr('style', 'position: absolute; padding-top: 4px;'); // Online Status
  191. $('img[src$="hackforums.net/images/modern_bl/buddy_offline.gif"]').attr('src', 'http://i.imgur.com/EKt4fXk.png').attr('style', 'position: absolute; padding-top: 4px;'); // Offline Status
  192. }
  193.  
  194. $("td[class*='trow'] input:checkbox").on("click", function() { // Mods & Staf Only - Highlight checkboxed rows - Conflicts with HFES for me, please test and report back
  195. console.log("something");
  196. var selector = $(this).closest("tr").find("td");
  197. if($(this).is(":checked")) {
  198. selector.css("background", "#242424");
  199. } else {
  200. selector.css("background", "");
  201. }
  202. });
  203.  
  204. if(window.location.pathname == "/gauth.php"){
  205. $('span[class="float_right smalltext"]').attr('style','display: block !important'); // Gauth Reset Link Reveal
  206. }
  207.  
  208. if(window.location.pathname == "/reputation.php"){
  209. $('a[href$="&show=positive"]').attr('style','font-size: 14px; background-color: #2DA546; border: 1px solid #2CC330; padding: 5px 10px 5px 10px; font-weight: bold; color: white;').after("<br/>"); // Positive Rep Box
  210. $('a[href$="&show=neutral"]').attr('style','font-size: 14px; background-color: #777777; border: 1px solid #949494; padding: 5px 10px 5px 10px; font-weight: bold; color: white;').after("<br/>"); // Neutral Rep Box
  211. $('a[href$="&show=negative"]').attr('style','font-size: 14px; background-color: #CC4444; border: 1px solid #FF5656; padding: 5px 10px 5px 10px; font-weight: bold; color: white;'); // Negative Rep Box
  212. $('strong[class="reputation_positive"]:contains("Positives")').remove(); // Legend Text Remove
  213. $('strong[class="reputation_neutral"]:contains("Neutrals")').remove(); // Legend Text Remove
  214. $('strong[class="reputation_negative"]:contains("Negatives")').remove(); // Legend Text Remove
  215. $('span[class="smalltext"]:contains("Total Reputation:")').find("br").remove(); // Received Rep Boxes Layout
  216. $('strong:contains("Total Reputation:")').before("<br/><br/>"); // Received Rep Boxes Layout
  217. $('span[class^="repbox"]').after("<br/><br/>"); // Received Rep Boxes Layout
  218. }
  219. if(showLogo === true){ // Show Logo
  220. $('img[src$="http://hackforums.net/images/modern_bl/logo_bl.gif"]').attr('src', 'http://i.imgur.com/fAzkq6w.png');
  221. $('div[class="logo"]').removeClass("logo").attr('style','text-align:center');
  222. }
  223.  
  224. if(enableSFW === true) { // Enable Safe-For-Work
  225. $('div[style="overflow:hidden; max-height:200px;"]').attr('class','sigArea');
  226. $('div[style="overflow:hidden; max-height:200px;"] img').attr('class','sigImage');
  227. $('td[class="post_avatar"]').attr('style','display:none;');
  228. var sigShow = $('<input type="button" class="button sigButton" value="toggle" style="position:relative; float:right;" />');
  229.  
  230. $("table[id*='post_']").each(function() {
  231. src = $(this).find("tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(1) > div:nth-child(3) img").attr("src");
  232. if (src != null) {
  233. $(this).find("tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(1) > div:nth-child(3) img").attr('style','display:none;');
  234. $(this).find("tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(1) > div:nth-child(3)").prepend('<input type="button" class="bitButton sigButton" value="toggle" style="position:relative; float:right; outline:none;" />');
  235. }
  236. });
  237.  
  238. $('.sigButton').click(function() {
  239. $(this).parent().find('.sigImage').toggleClass("sigReveal");
  240. $(this).parent().toggleClass("sigResize");
  241.  
  242. });
  243. }
  244.  
  245. if(window.location.pathname != "/private.php") {
  246. var userName = $('strong > a[href^="http://hackforums.net/member.php?action=profile&uid="]').text();
  247. $('blockquote > cite:contains(' + userName + ')').css({'color': quotedColor, 'font-weight': 'bold','border-bottom': '1px dotted' + quotedColor});
  248. }
  249.  
  250. if(window.location.pathname == "/showstaff.php" || window.location.pathname == "/showmods.php") {
  251. $('head').append('<style>td.trow1:hover {background: none !important;}</style>')
  252. $('td[class="trow1"]').attr("style","background: none; border: 0px !important;");
  253. $('div[style="width: 48%; min-height: 120px;float: left; border: 1px #4F3A6B solid; margin: 4px; padding: 2px;"]').attr("style","").addClass("staffCard");
  254. $('div[style="width: 48%; float: left; border: 1px #4F3A6B solid; margin: 4px; padding: 2px;"]').attr("style","").addClass("staffCard");
  255. $('td[class="trow1"][width="75%"]').attr("width","90%").attr("style","border: 0px !important").removeClass('trow1').addClass('staffCardParts').addClass('trow2');
  256. $('td[width="25%"]').attr("style","").addClass('staffCardParts');
  257. }
  258.  
  259. if(window.location.pathname == "/showgroups.php") {
  260. $('head').append('<style>td.trow1:hover {background: none !important;}</style>')
  261. $('td[class="trow1"]').attr("style","background: none; border: 0px !important;");
  262. $('div[style="width: 46%; min-height:168px;float: left; border: 1px #4F3A6B solid; margin: 4px; padding: 2px;"]').attr("style","").addClass("groupsCard");
  263. $('td[class="trow1"][width="75%"]').attr("width","90%").attr("style","border: 0px !important").removeClass('trow1').addClass('groupsCardParts').addClass('trow2');
  264. $('td[width="25%"]').attr("style","").attr("valign","middle").addClass('groupsCardParts');
  265. $('td[valign="bottom"]').attr("style","background-color: #333; border-radius: 0px; vertical-align: baseline; font-size: 12px;");
  266. $('table[width="100%"]').attr("height","100%").attr("cellpadding","10");
  267. }
  268.  
  269. if(hideMenu === true) {
  270. $("div[class='menu']").hide();
  271. }
  272.  
  273. if(badges === true) {
  274. // BADGES - LIST OF UIDs
  275. var adminList = [1]; // Omniscient
  276. var staffList = [1292605,1093501,370510,1570078,992020,1450348]; // Skorp, Roger Waters, Alone Vampire, Sam Winchester, King of Hearts, Walt Disney
  277. var mentorList = [4066,330676,1320406]; // Judge Dredd, Diabolic, Froggy
  278. var groupLeadersList = []; //
  279. for(var I = 0; I < staffList.length; I++) {
  280. $("a[href='http://hackforums.net/member.php?action=profile&uid=" + staffList[I] + "']").append('<img title="HF Staff" src="http://i.imgur.com/mfqIyM9.png" style="position: relative;top: 3px;left: 3px;">');
  281. }
  282. for(var I = 0; I < mentorList.length; I++) {
  283. $("a[href='http://hackforums.net/member.php?action=profile&uid=" + mentorList[I] + "']").append('<img title="HF Mentor" src="http://i.imgur.com/mfqIyM9.png" style="position: relative;top: 3px;left: 3px;">');
  284. }
  285. for(var I = 0; I < adminList.length; I++) {
  286. $("a[href='http://hackforums.net/member.php?action=profile&uid=" + adminList[I] + "']").append('<img title="Omniscient" src="http://i.imgur.com/mfqIyM9.png" style="position: relative;top: 3px;left: 3px;">');
  287. }
  288. for(var I = 0; I < groupLeadersList.length; I++) {
  289. $("a[href='http://hackforums.net/member.php?action=profile&uid=" + groupLeadersList[I] + "']").append('<img title="HF Group Leader" src="http://i.imgur.com/mfqIyM9.png" style="position: relative;top: 3px;left: 3px;">');
  290. }
  291. }
  292.  
  293. $('img[src$="hackforums.net/images/modern_bl/groupimages/english/ub3r.png"]').attr('style', '-webkit-filter: hue-rotate(15deg); filter: hue-rotate(15deg);'); // Uber Userbar Color Change
  294. $('img[src$="hackforums.net/images/modern_bl/starub3r2.png"]').attr('style', '-webkit-filter: hue-rotate(15deg); filter: hue-rotate(15deg);'); // Uber Stars Color Change
  295. $('strong span[style="rgb(56, 56, 56)"]').addClass("closedGroup"); // Changes Closed Usergroup Color
  296. $('strong:contains("Post:") > a[href^="showthread.php?tid="]').attr('id','postLink').attr('style','padding-top: 3px; padding-right: 5px; display: inline-block;'); // Post # Centered
  297. $('span[style="color:#383838"]').attr('style','color:#444444;'); // Closed Account Username Color Change
  298. $('a[href="http://hackforums.net/member.php?action=profile&uid=561239"] > span[class^="group"]').append('<img title="Developer of Flat Darkness" src="http://i.imgur.com/EpQPylI.png" style="position: relative;top: 3px;left: 3px;"/>');
  299. $('a[href="http://hackforums.net/member.php?action=profile&uid=2377407"] > span[class^="group"]').append('<img title="Developer of Flat Darkness" src="http://i.imgur.com/EpQPylI.png" style="position: relative;top: 3px;left: 3px;"/>');
  300. });
  301.