Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Google "Userscripts"
  2. Btw, for when you get Tampermonkey/Greasemonkey,
  3. [code]// ==UserScript==
  4. // @name          HF Midnight
  5. // @namespace  
  6. // @version       4.2
  7. // @description   Dark theme for HackForums & Custom userbars
  8. // @include       *hackforums.net/*
  9. // @include       http://www.hackforums.net/*
  10. // @copyright     2013-2014 fbn
  11. // @author        Sasori
  12. // @updateURL     http://userscripts.org/scripts/source/390415.meta.js
  13. // @downloadURL   http://userscripts.org/scripts/source/390415.user.js
  14. // @run-at        document-start
  15. // ==/UserScript==
  16.  
  17. var link = window.document.createElement('link');
  18. link.rel = 'stylesheet';
  19. link.type = 'text/css';
  20. link.href = 'https://dl.dropbox.com/s/s2ossnve7hdsvam/style.css';
  21. document.getElementsByTagName("HEAD")[0].appendChild(link);[/code]
  22. HF Midnight
  23. [code]// ==UserScript==
  24. // @name            Hack Forums Matte Black Theme
  25. // @namespace       +mK or OMGWTFISTHIS
  26. // @description     Changes Hack Forums to a dark, sleek theme! Style 2.
  27. // @include         http://www.hackforums.net/*
  28. // @include         http://hackforums.net/*
  29. // @version         1.5
  30. // @downloadURL     https://userscripts.org/scripts/source/414767.user.js
  31. // @updateURL       https://userscripts.org/scripts/source/414767.user.js
  32. // @run-at         document-start
  33. // ==/UserScript==
  34. //I would like to thank Snorlax (Profile: http://www.hackforums.net/member.php?action=profile&uid=44755) from Hack Forum for helping me with an issue with this script.
  35.  
  36. //I would also like to thank Jason Aller (Profile: http://stackoverflow.com/users/214143/jason-aller) from Stack Overflow for helping me consolidate my script.
  37.  
  38. //For future reference: Anyone wanting to modify this script and release a new variant of it, feel free to without asking. Do NOT make it look tacky, though. I hate tacky designs.
  39.  
  40. function addGlobalStyle(css) {
  41.     var head, style;
  42.     head = document.getElementsByTagName('head')[0];
  43.     if (!head) { return; }
  44.     style = document.createElement('style');
  45.     style.type = 'text/css';
  46.     style.innerHTML = css;
  47.     head.appendChild(style);
  48. }
  49.  
  50. var styles = [];
  51.  
  52. styles.push('body {background: #072948 url(http://i.imgur.com/D7s6Acp.png) fixed !important; }');
  53. //If you want to change the background image to your own, simply change the image link in the above line.
  54.  
  55. styles.push('.logo, div.largetext {display: none!important;}');
  56. //If you want the logo to be added back, simply remove the above line.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. styles.push('.thead {background: url(http://i.imgur.com/SRMEIpU.png) repeat scroll right top #111111 !important; height: 20px;}');
  70. styles.push('.tcat {background: url(http://i.imgur.com/SRMEIpU.png) repeat scroll 0 0 !important; }');
  71. styles.push('.tborder {background: #111111 !important; border: 1px solid #1D1D1D !important;}');
  72. styles.push('input.bitButton {background-color: #1E1E1E !important; box-shadow: 0 1px 0 0 #505050 inset !important; }');
  73. styles.push('a.bitButton {background-color: #1E1E1E !important; box-shadow: 0 1px 0 0 #505050 inset !important; }');
  74. styles.push('#panel {border: 1px solid #111111 !important; }');
  75. styles.push('.menu ul, .tfoot  {background: #111111 !important; }');
  76. styles.push('.pm_alert {border: 1px solid #0AFF00 !important; }');
  77. styles.push('.bottommenu {background: #111111; border: 1px solid #000000 !important;}');
  78. styles.push('input.button {background-color: #1E1E1E !important; box-shadow: 0 1px 0 0 #505050 inset !important; }');
  79. styles.push('a:hover, a:active, .menu ul a:hover, .menu ul a:active {color: #cccccc !important; }');
  80. styles.push('.pagination_current {background: #383737 !important; }');
  81. styles.push('.pagination a, .pagination a:hover {background-color: #181818 !important;}');
  82. styles.push('.navButton:hover {border-top: 1px solid #919191 !important; background: #333333 !important;}');
  83. styles.push('.tcat a:hover, .tcat a:active, .tfoot a:hover, .tfoot a:active, .navigation a:hover, .navigation a:active {color: #949494 !important; }');
  84. styles.push('.pagination a:hover {color: #949494 !important; }');
  85. styles.push('textarea:focus, input.textbox:focus, textarea, #message {border: 1px solid #000000 !important}');
  86. styles.push('#menutabs.shadetabs li a {box-shadow: 0 1px 0 0 #505050 inset!important; }');
  87. styles.push('.shadetabs li a {background-color: #181818 !important; }');
  88. styles.push('.shadetabs li a.selected {background-color: #111111  !important; color: #7C7C7C !important;}');
  89. styles.push('.shadetabs li a:hover {background-color: #111111  !important; color: #7C7C7C !important; }');
  90. styles.push('.popup_menu, .popup_item {background-color: #1E1E1E !important;}');
  91. styles.push('.prefix {color: #838383!important;}');
  92. styles.push('span.button {background-color: #1E1E1E !important; box-shadow: 0 1px 0 0 #505050 inset !important; }');
  93. styles.push('.button:hover {color: #7C7C7C !important; }');
  94. styles.push('input.bitButton:hover {color: #7C7C7C!important; }');
  95. styles.push('.thread_options a:link {color: #fff!important; }');
  96. styles.push('.thread_options a:link:hover {color: #ccc!important; }');
  97. styles.push('a.quick_jump {color: #838383!important; }');
  98. styles.push('img.subforumicon.ajax_mark_read {display: none!important; }');
  99. styles.push('div.smalltext ul li {list-style-image: url(http://i.imgur.com/6XZ4FxQ.gif)!important; margin-left: -4px!important; }');
  100. styles.push('div.smalltext ul {margin-left: 23px!important; margin-top: 5px!important; }');
  101. styles.push('.trow_reputation_positive {/* background: #333;!important; }');
  102.  
  103. styles.push('.subject_new, a.subject_new {font-weight: bold !important;');
  104.  
  105. addGlobalStyle(styles.join(''));
  106. [/code]
  107. Matte Black
  108. [code]// ==UserScript==
  109. // @name        HF Enhancement Suite
  110. // @author      Emylbus
  111. // @namespace   http://www.sublyme.net
  112. // @description This userscript defines general enhancement tweaks that apply to the entire HackForums site.
  113. // @include     *hackforums.net/*
  114. // @version     0.50
  115. // @downloadURL http://sublyme.net/site_media/userscripts/HFES.user.js
  116. // @grant       GM_addStyle
  117. // @grant       GM_xmlhttpRequest
  118. // @grant       GM_getValue
  119. // @grant       GM_setValue
  120. // @grant       GM_log
  121. // @grant       GM_info
  122. // @require     http://sublyme.net/site_media/userscripts/GM_Config.js
  123. // @require     http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
  124. // @require     http://sublyme.net/site_media/userscripts/GM_SuperValues.user.js
  125. // ==/UserScript==
  126.  
  127. debug = false;
  128.  
  129. // CM_config settings
  130. var vsstring = 'HF Enhancement Suite by Emylbus - v'+GM_info.script.version;
  131. //GM_config.init(vsstring,
  132. var configInit = {
  133.     'citeStyle':{
  134.         'label':'Choose your thread citing format:',
  135.         'type':'select',
  136.         'options': {
  137.             'standard':'Title by User',
  138.             'withdash': 'Title - User',
  139.             'title': 'Title',
  140.         },
  141.         'default':'standard',
  142.         'section':['','Forum']
  143.     },
  144.     'ratingInfo':{
  145.         'label':'Show detailed thread rating info?',
  146.         'type':'checkbox',
  147.         'default':true,
  148.     },
  149.     'multiquote':{
  150.         'label':'Enable multiquoting in threads?',
  151.         'type':'checkbox',
  152.         'default':true,
  153.     },
  154.     'pmfrompost':{
  155.         'label':'Enable PM from Post?',
  156.         'type':'checkbox',
  157.         'default':true,
  158.     },
  159.     'threadpreview':{
  160.         'label':'Enable thread previewing?',
  161.         'type':'checkbox',
  162.         'default':false,
  163.     },
  164.     'theadstyle':{
  165.         'label':'Post Header Style:',
  166.         'type':'select',
  167.         'default':'none',
  168.         'options': {
  169.             'none' : 'None',
  170.             'light' : 'Light',
  171.             'dark' : 'Dark'
  172.         }
  173.     },
  174.     'prettyQuote':{
  175.         'label':'Enable fancy quotations?',
  176.         'type':'checkbox',
  177.         'default':false
  178.     },
  179.     'warnUnload':{
  180.         'label':'Warn if page change will lose data?',
  181.         'type':'checkbox',
  182.         'default':false
  183.     },
  184.     'cleanThreads':{
  185.         'label':'Hide Quote and Edit buttons on closed threads?',
  186.         'type':'checkbox',
  187.         'default':true
  188.     },
  189.     'quickPM':{
  190.         'label':'Enable Quick PM?',
  191.         'type':'checkbox',
  192.         'default':true,
  193.         'section':['','Private Messaging']
  194.     },
  195.     'trackingLink':{
  196.         'label':'Enable links in message tracking? (L33T+ only)',
  197.         'type':'checkbox',
  198.         'default':false
  199.     },
  200.     'pmDeny':{
  201.         'label':'Enable quick denying on PM notices? (UB3R only)',
  202.         'type':'checkbox',
  203.         'default': false
  204.     },
  205.     'prettyPM':{
  206.         'label':'Enable pretty PMs?',
  207.         'type':'checkbox',
  208.         'default':true
  209.     },
  210.     'profileCiting':{
  211.         'label':'Enable profile citing?',
  212.         'type':'checkbox',
  213.         'default':true,
  214.         'section':['','Profile']
  215.     },
  216.     'usertagging':{
  217.         'label':'Enable user tagging?',
  218.         'type':'checkbox',
  219.         'default':true
  220.     },
  221.     'banReason':{
  222.         'label':'Show ban reason on profile? (UB3R only)',
  223.         'type':'checkbox',
  224.         'default':false
  225.     },
  226.     'staffOnline':{
  227.         'label':'Enable checking online status of staff and moderators?',
  228.         'type':'checkbox',
  229.         'default':true,
  230.         'section':['','Staff/Mod']
  231.     },
  232.     'showStaffLink':{
  233.         'label':'Display "Show Staff" link?',
  234.         'type': 'checkbox',
  235.         'default':true,
  236.         'section':['','Quick Links']
  237.     },
  238.     'showModLink':{
  239.         'label':'Display "Show Mods" link?',
  240.         'type':'checkbox',
  241.         'default':true
  242.     },
  243.     'showGroupLink':{
  244.         'label':'Display "Show Groups" link?',
  245.         'type':'checkbox',
  246.         'default':true
  247.     },
  248.     'showTrackingLink':{
  249.         'label':'Display "PM Tracking" link? (L33T+ only)',
  250.         'type':'checkbox',
  251.         'default':false
  252.     },
  253.     'showBansLink':{
  254.         'label':'Display "Show Bans" link? (UB3R only)',
  255.         'type':'checkbox',
  256.         'default':false
  257.     },
  258.     'showBuddyLink':{
  259.         'label':'Display "Buddy List" link?',
  260.         'type':'checkbox',
  261.         'default':false
  262.     },
  263.     'showAwardList':{
  264.         'label':'Display "Award List" link?',
  265.         'type':'checkbox',
  266.         'default':false
  267.     },
  268.     'showPaidLink':{
  269.         'label':'Display "Paid Stickies" link?',
  270.         'type':'checkbox',
  271.         'default':false
  272.     },
  273.     'toggleSFW':{
  274.         'label':'Display "Toggle SFW/NSFW" link?',
  275.         'type':'checkbox',
  276.         'default':true
  277.     },
  278.     'showSubscribed':{
  279.         'label':'Display "Subscribed Threads" link?',
  280.         'type':'checkbox',
  281.         'default':true
  282.     },
  283.     'lastLink':{
  284.         'label':'Add last post links to search pages?',
  285.         'type':'checkbox',
  286.         'default':true,
  287.         'section':['','Other']
  288.     },
  289.     'forcesfw':{
  290.         'label':'Force either SFW or NSFW pages?',
  291.         'type':'select',
  292.         'options':{
  293.             'none':'None',
  294.             'sfw':'Force nsfw.hackforums',
  295.             'nsfw':'Force www.hackforums'
  296.         },
  297.         'default':'none'
  298.     },
  299.     'locationhider':{
  300.         'label':'Hide your location?',
  301.         'type':'checkbox',
  302.         'default':false
  303.     },
  304.     'removeWelcome':{
  305.         'label':'Hide the welcome text at the top of each page?',
  306.         'type':'checkbox',
  307.         'default':false
  308.     },
  309.     'hidetwitter':{
  310.         'label':'Hide twitter widget?',
  311.         'type':'checkbox',
  312.         'default':true
  313.     },
  314.     'groupLeaderUserList':{
  315.         'label':'Easy member list: ',
  316.         'type':'select',
  317.         'options':{
  318.             'none':'None',
  319.             'standard':'Standard with BB List',
  320.             'standardnolink':'Standard without BB List',
  321.             'nolistwithlink':'Comma Deliminated with Links',
  322.             'nolistnolink': 'Comma Deliminated without Links',
  323.         },
  324.         'default':'standard',
  325.         'section':['','Group Leader']
  326.     },
  327.     'groupAlertHide':{
  328.         'label':'Hide group join requests?',
  329.         'type':'checkbox',
  330.         'default':false,
  331.     },
  332.     'userBarSwitch':{
  333.         'label':'Set your userbar (client-side change only): ',
  334.         'type':'select',
  335.         'options':{
  336.             'none':'-----',
  337.             'strange':'#@&%!',
  338.             '143':'143',
  339.             '3p1c':'3p1c',
  340.             'alliance':'The Alliance',
  341.             'blackdiamond':'Black Diamond',
  342.             'brotherhood':'The Brotherhood',
  343.             'complexity':'Complexity',
  344.             'empire':'The Empire',
  345.             'flybynight':'Fly By Night',
  346.             'graphicmasters':'Graphic Masters',
  347.             'guardians':'Guardians',
  348.             'illuminati':'Illuminati',
  349.             'infamous':'Infamous',
  350.             'innovation':'Innovation',
  351.             'lannisters':'Lannisters',
  352.             'leet':'L33T',
  353.             'legacy':'Legacy',
  354.             'legion':'Legion',
  355.             'redlion':'Red Lion',
  356.             'skill':'Skill',
  357.             'uber':'UB3R',
  358.             'void':'Void',
  359.             'blank':'Blank'
  360.         },
  361.         'default':'none',
  362.         'section':['','Fun']
  363.     }
  364. };
  365.  
  366. function initConfig(){
  367.     var configCSS, configCSS_Blue, configCSS_Purple;
  368.     configCSS_Blue = "\
  369.    #HFES_config {background:#333; color:#CCC; font-size:14px; } \
  370.    #HFES_config_header {color:#FFF;} \
  371.    #HFES_config .section_desc {background:#072948; color:#FFF; border:none; font-size:14px;} \
  372.    #HFES_config .section_header {display:none !important;} \
  373.    #HFES_config .config_var {text-align:left;} \
  374.    #HFES_config .field_label {font-size:14px; font-weight:normal} \
  375.    #HFES_config * {font-family:Verdana, Arial, Sans-Serif; font-weight:normal}\
  376.    ";
  377.     configCSS_Purple = "\
  378.    #HFES_config {background:#333; color:#CCC; font-size:14px; border-radius:5px;} \
  379.    #HFES_config_header {color:#FFF;} \
  380.    #HFES_config .section_desc {background:#4F3A6B; color:#FFF; border:none; font-size:14px;} \
  381.    #HFES_config .section_header {display:none !important;} \
  382.    #HFES_config .config_var {text-align:left;} \
  383.    #HFES_config .field_label {font-size:14px; font-weight:normal} \
  384.    #HFES_config * {font-family:Verdana, Arial, Sans-Serif; font-weight:normal}\
  385.    #HFES_config_buttons_holder {text-align:left}\
  386.    ";
  387.    
  388.     if(GM_getValue('forumTheme', 'theme3') == 'theme5'){
  389.         configCSS = configCSS_Blue;
  390.     }else{
  391.         configCSS = configCSS_Purple;
  392.     }
  393.     //configCSS = configCSS_Purple;
  394.     GM_config.init({
  395.         'id':'HFES_config',
  396.         'title':vsstring,
  397.         'fields':configInit,
  398.         'css':configCSS
  399.     });
  400. }
  401.  
  402. initConfig();
  403. var defaultusertags = {
  404.     '956054':'HFES Developer',
  405. };
  406.  
  407. var urlBase = "http://www.sublyme.net/site_media/"
  408.  
  409. var defaultfav = {
  410.         '2':'Rules, Announcements, News and Feedback',
  411.     };
  412.  
  413. var panelFlag = false;
  414. var postkeyFlag = false;
  415. var myPostKey = '';
  416.  
  417. // CSS to inject:
  418.  
  419. var emyNotice = [
  420.     ".emy_alert {",
  421.     "background: #333333;",
  422.     "border-top: 1px solid #F4D639;",
  423.     "border-bottom: 1px solid #F4D639;",
  424.     "text-align: center;",
  425.     "padding: 5px 20px;",
  426.     "font-size: 11px;",
  427.     "margin-bottom: 15px;}",
  428.     ].join("");
  429.  
  430. var emyUpdate = [
  431.     ".emy_update {",
  432.     "background: #333333;",
  433.     "border-top: 1px solid #FFF;",
  434.     "border-bottom: 1px solid #FFF;",
  435.     "text-align: center;",
  436.     "padding: 5px 20px;",
  437.     "font-size: 11px;",
  438.     "margin-bottom: 15px;}",
  439.     ].join("");
  440.    
  441. var leftUnReadBubble = [
  442.     '.pm_left_unread {',
  443.     'border-radius: 5px;',
  444.     'border: 1px solid black;',
  445.     'width: 98%;',
  446.     'padding:5px 5px 5px 5px;',
  447.     'background-color:#E3A3A3;',
  448.     'color:#000000;',
  449.     'float:left;',
  450.     '}'
  451.     ].join('');
  452.  
  453. var leftReadBubble = [
  454.     '.pm_left_read {',
  455.     'border-radius: 5px;',
  456.     'border: 1px solid black;',
  457.     'width: 98%;',
  458.     'padding:5px 5px 5px 5px;',
  459.     'background-color:#AAA3A3;',
  460.     'color:#333333;',
  461.     'float:left;',
  462.     '}'
  463.     ].join('');
  464.  
  465. var rightUnReadBubble = [
  466.     '.pm_right_unread {',
  467.     'border-radius: 5px;',
  468.     'border: 1px solid black;',
  469.     'width: 98%;',
  470.     'padding:5px 5px 5px 5px;',
  471.     'background-color:#A3E3A3;',
  472.     'color:#000000;',
  473.     'text-align:right;',
  474.     'float:right;',
  475.     '}'
  476.     ].join('');
  477.  
  478. var rightReadBubble = [
  479.     '.pm_right_read {',
  480.     'border-radius: 5px;',
  481.     'border: 1px solid black;',
  482.     'width: 98%;',
  483.     'padding:5px 5px 5px 5px;',
  484.     'background-color:#A3AAA3;',
  485.     'color:#333333;',
  486.     'text-align:right;',
  487.     'float:right;',
  488.     '}'
  489.     ].join('');
  490.  
  491. var fixedTable = [
  492.     'table.fixed { table-layout:fixed; }',
  493.     'table.fixed td { overflow: hidden; }',
  494.     ].join('');
  495.  
  496. var tagBubble = [
  497.     '.tag_bubble {',
  498.     'border-radius: 5px;',
  499.     'border: 1px solid black;',
  500.     'padding: 1px 4px 1px 4px;',
  501.     'background-color:#B6E5CB;', // C19CBC  F88180  F4F0ED E6E6CF FA909E FDCBC7 D0BB9F  
  502.     'color:#000000;',
  503.     '}'
  504.     ].join('');
  505.  
  506. var prettyQuotes = [
  507.     'blockquote {',
  508.     'border-radius: 5px;',
  509.     'border: 1px solid black;',
  510.     'padding: 1px 4px 1px 4px;',
  511.     'background-color:#AAA;', // C5C8BD
  512.     'color:#111;',
  513.     '}'
  514.     ].join('');
  515.  
  516. var prettyCite = [
  517.     'blockquote cite {',
  518.     'border-bottom: 1px solid #999;',
  519.     'color:#000',
  520.     '}'
  521.     ].join('');
  522.  
  523. // HFES code
  524.  
  525. function injectCSS(){
  526.     GM_addStyle(emyNotice);
  527.     GM_addStyle(emyUpdate);
  528.     GM_addStyle(leftUnReadBubble);
  529.     GM_addStyle(leftReadBubble);
  530.     GM_addStyle(rightUnReadBubble);
  531.     GM_addStyle(rightReadBubble);
  532.     GM_addStyle(fixedTable);
  533.     GM_addStyle(tagBubble);
  534. }
  535.  
  536. function debugPrint(astr){
  537.     if(debug == true){
  538.         console.log("[HFES] "+astr)
  539.     }
  540. }
  541.  
  542. function replaceAll(str, find, replace) {
  543.     /* I didn't write this, but it's damn useful */
  544.   return str.replace(new RegExp(find, 'g'), replace);
  545. }
  546.  
  547. function decodeHtmlNumeric(str) {
  548.     /* I didn't write this, but it's damn useful */
  549.     return str.replace( /&#([0-9]{1,7});/g, function( g, m1 ){
  550.         return String.fromCharCode( parseInt( m1, 10 ) );
  551.     }).replace( /&#[xX]([0-9a-fA-F]{1,6});/g, function( g, m1 ){
  552.         return String.fromCharCode( parseInt( m1, 16 ) );
  553.     });
  554. }
  555.  
  556. function replaceAllMap(str,mapObj){
  557.     var re = new RegExp(Object.keys(mapObj).join("|"),"gi");
  558.    
  559.     return str.replace(re, function(matched){
  560.         return mapObj[matched];
  561.     });
  562. }
  563.    
  564. function trimString (str) {
  565.     /* Also didn't write this, but it's very useful and so elegant! */
  566.     return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  567. }
  568.  
  569. /**
  570.  * Adds and Removes links in the header.
  571.  */
  572. function addToMenu() {
  573.     debugPrint("Header Links", 1);
  574.     $(".menu ul li:eq(0)").after("<li><a href=\"/favorites.php\" class=\"navButton\">Favorites</a></li>");
  575.     $(".menu ul").append("<li><a href=\"/showthread.php?tid=3692117\" class=\"navButton\">Support HFES</a></li>");
  576. };
  577.    
  578. function uberPMDeny() {
  579.     try{
  580.         var pmNotice, firstPart, secondPart, pmid, denyURL;
  581.         pmNotice = document.getElementsByClassName('pm_alert')[0].innerHTML;
  582.         pmNotice = pmNotice.split('\n');
  583.         firstPart = pmNotice[1];
  584.         secondPart = pmNotice[2];
  585.         pmid = secondPart.split('pmid=')[1].split('" style')[0];
  586.         denyURL = "http://www.hackforums.net/private.php?action=read&pmid="+pmid+"&denyreceipt=1";
  587.         secondPart = secondPart.split('</div>')[0]+"&nbsp;&nbsp;<small><i><a href="+denyURL+">[deny receipt]</a></i></small></div>";
  588.         document.getElementsByClassName('pm_alert')[0].innerHTML = firstPart + "\n" + secondPart;
  589.     }catch(err){
  590.     }
  591. }
  592.  
  593. function showSettings(){
  594.     debugPrint("Opening settings window...");
  595.     GM_config.open();
  596. }
  597.  
  598. function addSpecialLinks(){
  599.    
  600.     var bodyList, buddyIndex, i, currDir, elementLink, specialLinks = [];
  601.    
  602.     if(document.URL.indexOf("misc.php?action=buddypopup") != -1){
  603.         return;
  604.     }
  605.    
  606.     if(GM_config.get('toggleSFW', true)){
  607.         currDir = document.URL.split('.net/')[1];
  608.         if(document.URL.indexOf("nsfw.hackforums") != -1){
  609.             specialLinks.push('<a href="http://www.hackforums.net/'+currDir+'">Toggle NSFW</a>');
  610.         }else{
  611.             specialLinks.push('<a href="http://nsfw.hackforums.net/'+currDir+'">Toggle SFW</a>');
  612.         }
  613.     }
  614.     if(GM_config.get('showSubscribed', true)){
  615.         specialLinks.push('<a href="/usercp.php?action=subscriptions">Subscribed Threads</a>');
  616.     }
  617.     if(GM_config.get('showBuddyLink', true)){
  618.         specialLinks.push('<a href="javascript:void(0);" id="buddylist">Buddy List</a>');
  619.         //$("#buddylist").live("click", function(){MyBB.popupWindow("http://www.hackforums.net/misc.php?action=buddypopup", "buddyList", 350, 350);});
  620.         $("#buddylist").live("click", function(){window.open('/misc.php?action=buddypopup','Buddy List','width=350,height=350,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0')});
  621.     }
  622.     if(GM_config.get('showStaffLink', true)){
  623.         specialLinks.push('<a href="/showstaff.php">Show Staff</a>');
  624.     }
  625.     if(GM_config.get('showModLink', true)){
  626.         specialLinks.push('<a href="/showmods.php">Show Mods</a>');
  627.     }
  628.     if(GM_config.get('showGroupLink', true)){
  629.         specialLinks.push('<a href="/showgroups.php">Show Groups</a>');
  630.     }
  631.     if(GM_config.get('showTrackingLink', false)){
  632.         specialLinks.push('<a href="/private.php?action=tracking">PM Tracking</a>');
  633.     }
  634.     if(GM_config.get('showBansLink', true) /*&& GM_config.get('accstatus') == 'uber'*/){
  635.         specialLinks.push('<a href="/bans.php">Show Bans</a>');
  636.     }
  637.     if(GM_config.get('showPaidLink', false)){
  638.         specialLinks.push('<a href="/paidstickies.php">Paid Stickies</a>');
  639.     }
  640.     if(GM_config.get('showAwardList', false)){
  641.         specialLinks.push('<a href="/myawards.php">Award List</a>');
  642.     }
  643.    
  644.     specialLinks.push('<a title="" href="javascript:void(0);" id="settings">HFES Settings</a>');
  645.    
  646.     specialLinks = specialLinks.join(" | ");
  647.     bodyList = document.getElementById('panel').innerHTML.split('\n');//document.body.innerHTML.split('\n');
  648.     for(i = 0; i < bodyList.length; i++){
  649.         if(bodyList[i].indexOf('buddypopup') != -1){
  650.             buddyIndex = i;
  651.         }
  652.     }
  653.     bodyList[buddyIndex] = specialLinks;
  654.    
  655.     document.getElementById('panel').innerHTML = bodyList.join('\n');
  656.     $("#settings").live("click", function(){ showSettings(); });
  657. }
  658.  
  659. function showBuddyList(){
  660.     window.open('http://www.hackforums.net/misc.php?action=buddypopup', 'HF Buddy List', 'height=350,width=350,resizable=0,location=0,left=0,top=0');
  661. }
  662.  
  663. function emyMessage(){
  664.     try{
  665.         GM_xmlhttpRequest({
  666.             method: "GET",
  667.             url: "http://sublyme.net/site_media/emymessage.html" + "?nc=" + Math.random(),
  668.             onload: function(response){
  669.                 var emyHTML, emyMessageText, elementzLink, res, newres = [], i;
  670.                 //debugPrint("Emy Message: "+response.responseText);                
  671.                 if(GM_getValue("previousEmyMessage", "\n") == response.responseText && GM_getValue("hideEmyMsg", true)){
  672.                     debugPrint("Not displaying Emy Message because it is the same as before and was hidden.");
  673.                     return;
  674.                 }
  675.                 res = trimString(response.responseText);
  676.                 newres = res.split('\n');
  677.                 /*for(i=0; i < res.length-1; i++){
  678.                     if(res[i].indexOf("<") != 0 && res[i] != "\n"){
  679.                         newres.push(res[i]);
  680.                     }
  681.                 }*/
  682.                 //newres.push(res[i]);
  683.                 GM_setValue("previousEmyMessage", response.responseText);
  684.                 GM_setValue("hideEmyMsg", false);
  685.                 debugPrint("Displaying new Emy Message: "+newres.join(" | "));
  686.                 hideButton = '<div class="float_right"><a href="javascript:void(0);" title="Dismiss this notice" id="hider"><img src="http://x.hackforums.net/images/modern_bl/dismiss_notice.gif" alt="Dismiss this notice" title="[x]"></a></div>';
  687.                 emyHTML = '<br><div class="emy_alert" id="emy_msg"><div><strong>HFES Notice: </strong>'+newres.join(" | ")+hideButton+'</div></div>';
  688.                 if(response.responseText != "\n"){
  689.                     $("#header").append(emyHTML);
  690.                     $("#hider").live("click",function(){hideEmyMessage();});
  691.                 }
  692.             },
  693.         });
  694.     }catch(err){
  695.         debugPrint(err.message);
  696.     }
  697. }
  698.  
  699. function hideEmyMessage(){
  700.     $(".emy_alert").fadeOut();
  701.     GM_setValue("hideEmyMsg", true);
  702. }
  703.  
  704. function emyUpdateMsg(){
  705.     try{
  706.         GM_xmlhttpRequest({
  707.             method: "GET",
  708.             url: "http://sublyme.net/site_media/HFESversion.txt" + "?nc=" + Math.random(),
  709.             onload: function(response){
  710.                 var updateHTML, emyMessageText, elementzLink, res, newres = [], i, version, changelog = '';
  711.                 res = trimString(response.responseText);
  712.                 res = res.split('\n');
  713.                 version = res[0];
  714.                 if(parseFloat(version) <= parseFloat(GM_info.script.version)){
  715.                     debugPrint('Version is current.');
  716.                     return;
  717.                 }
  718.                 res.shift();
  719.                 //for(i=1;i < res.length; i++){
  720.                 //    res[i-1] = res[i];
  721.                 //}
  722.                 debugPrint('----');
  723.                 debugPrint(response.responseText);
  724.                 debugPrint(res);
  725.                 debugPrint(changelog);
  726.                 debugPrint(GM_info.script.version);
  727.                 debugPrint('----');
  728.                 debugPrint("Displaying new update alert: "+res.join(" | "));
  729.                 updateHTML = '<br><a href="http://www.sublyme.net/site_media/userscripts/HFES.user.js""><div class="emy_update" id="updatemsg"><div><strong>HFES Update: New Version (v'+version+') Available. Click here to update.</strong> Changelog: '+res.join(" | ")+'</div></div></a>';
  730.                 if(response.responseText != "\n"){
  731.                     $("#header").append(updateHTML);
  732.                 }
  733.             },
  734.         });
  735.     }catch(err){
  736.         debugPrint(err.message);
  737.     }
  738. }
  739.  
  740. function displayThreadRating(){
  741.     var docSplit, tempString, i, currRate;
  742.     docSplit = document.getElementById('content').innerHTML.split('\n');
  743.     for(i=0; i < docSplit.length; i++){
  744.         //debugPrint(docSplit[i]);
  745.         if(docSplit[i].indexOf('rating_table_') != -1){
  746.             currRate = docSplit[i].split('rating_table_')[1].split('">')[0].split('"')[0];
  747.         }else if(docSplit[i].indexOf("Rating.build_forumdisplay") != -1){
  748.             //alert("tete");
  749.             tempString = docSplit[i].split("current_average: '")[1].split(" in")[0];
  750.             if(tempString.indexOf("1 ")==0){
  751.                 tempString = tempString.replace("(s)","");
  752.             }else{
  753.                 tempString = tempString.replace("(s)","s");
  754.             }
  755.             //docSplit[i+2] = docSplit[i+2]+'<span style="font-size: x-small;">'+tempString.replace(" - ","<br>")+'</span>';
  756.             $('#rating_table_'+currRate).append('<span style="font-size: x-small;">'+tempString.replace(" - ","<br>")+'</span>');
  757.         }
  758.     }
  759.     //document.getElementById('content').innerHTML = docSplit.join("\n");
  760. }
  761.  
  762. function displayThreadRatingT(){
  763.     var docSplit, tempString, tempScore, i;
  764.     if($('.inline_rating').length > 0) {
  765.         docSplit = document.getElementsByClassName("inline_rating")[0].innerHTML.split('\n');
  766.         tempString = docSplit[2].split('>')[1].split('<')[0];
  767.         tempScore = tempString.split(' - ')[1].split(' ')[0] + " Avg";
  768.         tempString = tempString.split(' - ')[0];
  769.         if(tempString.indexOf("1 Votes") == 0){
  770.             tempString = "1 Vote";
  771.         }
  772.        
  773.         tempString = '<span style="font-size: x-small;">'+tempString +" - "+tempScore+'</span>';
  774.         $(".inline_rating").append(tempString);
  775.     }
  776. }
  777.  
  778. function onlineStaff(){
  779.     var adminURL, adminDict, adminLine, docDJ, msgWithStatus, splitLine, i;
  780.     adminDict = {};
  781.     docDJ = document.getElementsByClassName('tborder')[0].innerHTML.split('\n');
  782.     for(i=0; i < docDJ.length; i++){
  783.         if(docDJ[i].indexOf("member.php") != -1){
  784.             adminURL = docDJ[i].split('a href="')[1].split('"')[0].replace("\&amp;","\&");
  785.             adminDict[adminURL] = i;
  786.             try{
  787.                 GM_xmlhttpRequest({
  788.                     method: "GET",
  789.                     url: adminURL,
  790.                     onload: function(response){
  791.                         var imageHTML;
  792.                         splitList = document.getElementsByClassName('tborder')[0].innerHTML.split('\n');
  793.                         adminLine = splitList[adminDict[response.finalUrl]];
  794.                         if(response.responseText.indexOf("member_profile_online") != -1){
  795.                             imageHTML = '<img src="http://x.hackforums.net/images/modern_bl/buddy_offline.gif" alt="Online" title="Online">  ';
  796.                         }else{
  797.                             imageHTML = '<img src="http://x.hackforums.net/images/modern_bl/buddy_offline.gif" alt="Offline" title="Offline">  ';
  798.                         }
  799.                        
  800.                         msgWithStatus = imageHTML + adminLine;
  801.                         splitList[adminDict[response.finalUrl]] = msgWithStatus;
  802.                         document.getElementsByClassName('tborder')[0].innerHTML = splitList.join("\n");
  803.                     },
  804.                 });
  805.             }catch(err){
  806.                 return;
  807.             }
  808.         }
  809.     }
  810. }
  811.  
  812. function createCiteLink(citation){
  813.     debugPrint("Citation should be: "+citation);
  814.     window.prompt("Press Ctrl+C to copy thread citation!", citation); // Get rid of
  815. }
  816.  
  817. function threadCiting(){
  818.     var author, title;
  819.     if(document.URL.indexOf("page=") != -1){
  820.         debugPrint("WRONG PAGE");
  821.         wrongPageCiteHandle();
  822.     }else{
  823.         correctPageCite();
  824.     }
  825. }
  826.  
  827. function correctPageCite(){
  828.     var author, authorURL, threadTitle, threadURL, finalCite="undefined error";
  829.     author = $($('.post_author a[href*="member.php?action=profile"]')[0]).text();
  830.     authorURL = $($('.post_author a[href*="member.php?action=profile"]')[0]).attr('href').replace('nsfw.','www.');
  831.     threadTitle = $('.navigation .active').text();
  832.     threadURL = document.URL.split('&')[0].replace('nsfw.','www.');
  833.    
  834.     if(GM_config.get('citeStyle') == 'title'){
  835.         finalCite = "[url="+threadURL+"][b]"+threadTitle+"[/b][/url]";
  836.     }else if(GM_config.get('citeStyle') == 'standard'){
  837.         finalCite = "[url="+threadURL+"][b]"+threadTitle+"[/b][/url] by [url="+authorURL+"]"+author+"[/url]";
  838.     }else{
  839.         finalCite = "[url="+threadURL+"][b]"+threadTitle+"[/b][/url] - [url="+authorURL+"]"+author+"[/url]";
  840.     }
  841.     createCiteLink(finalCite);
  842. }
  843.  
  844. function wrongPageCiteHandle(){ //HOLDER5
  845.     threadURL = document.URL.split('&')[0].replace('nsfw.','www.');
  846.     threadTitle = $('.navigation .active').text();
  847.  
  848.     GM_xmlhttpRequest({
  849.         method: "GET",
  850.         url: threadURL,
  851.         onload: function(response){
  852.             wrongPageCiter(threadURL, threadTitle, response.responseText);
  853.         }
  854.     });
  855. }
  856.  
  857. function wrongPageCiter(threadURL, threadTitle, responseText){
  858.     var author = $($($(responseText).find(".post_author a[href*='member.php?action=profile']"))[0]).text();
  859.     var authorURL = $($($(responseText).find(".post_author a[href*='member.php?action=profile']"))[0]).attr('href').replace('nsfw.','www.');
  860.  
  861.     if(GM_config.get('citeStyle') == 'title'){
  862.         finalCite = "[url="+threadURL+"][b]"+threadTitle+"[/b][/url]";
  863.     }else if(GM_config.get('citeStyle') == 'standard'){
  864.         finalCite = "[url="+threadURL+"][b]"+threadTitle+"[/b][/url] by [url="+authorURL+"]"+author+"[/url]";
  865.     }else{
  866.         finalCite = "[url="+threadURL+"][b]"+threadTitle+"[/b][/url] - [url="+authorURL+"]"+author+"[/url]";
  867.     }
  868.     createCiteLink(finalCite);
  869. }
  870.  
  871. function forumCiting(){
  872.     window.prompt("Press Ctrl+C to copy forum citation!", citePage());
  873. }
  874.  
  875. function citePage(){
  876.     if(document.URL.indexOf("hid=") != -1){
  877.         return '[url='+document.URL.replace('nsfw.','www.')+'][b]'+$('.navigation .active').text()+' Help Document[/b][/url]';
  878.     }else{
  879.         return '[url='+document.URL.split('&')[0].replace('nsfw.','www.')+'][b]'+$('.navigation .active').text()+'[/b][/url]';
  880.     }
  881. }
  882.  
  883. function getThreadOP(htmlCode){ // HOLDER2
  884.     var infoHolder, uid, author, authorString, finalHTML, inc;
  885.      
  886.     if(htmlCode.indexOf('<div id="content">') != -1){
  887.         htmlCode = htmlCode.split('<div id="content">')[1];
  888.     }else{}
  889.     infoHolder = htmlCode.split('largetext">')[1].split('</span')[0];
  890.     infoHolder = infoHolder.replace(" ","").replace("<strong>","").replace("</strong>","");
  891.    
  892.     uid = infoHolder.split('uid=')[1].split('">')[0];
  893.    
  894.     author = infoHolder.replace("</a>","");
  895.     author = author.split(">");
  896.     author = author[author.length-1];
  897.    
  898.     authorString = "[url=http://www.hackforums.net/member.php?action=profile&uid="+uid+"]"+author+"[/url]";
  899.    
  900.     return authorString;
  901. }
  902.  
  903. function groupAlertRemover(){
  904.     $(".pm_alert:contains('pending group membership join request')").hide();
  905. }
  906.  
  907. function getPMOP(htmlCode){
  908.     var infoHolder, uid, author, authorString, finalHTML, inc;
  909.     infoHolder = htmlCode.split('largetext">')[1].split('</span')[0];
  910.     infoHolder = infoHolder.replace(" ","").replace("<strong>","").replace("</strong>","");    
  911.     uid = infoHolder.split('uid=')[1].split('">')[0];
  912.    
  913.     author = infoHolder.replace("</a>","");
  914.     author = author.split(">");
  915.     author = author[author.length-1];
  916.    
  917.     return author;
  918. }
  919.  
  920. function addQuickMsg(){
  921.     var msgBox, formButton, finalHtml, postKey, recipient, subject, messageToSend, pmid, postBody;
  922.     postKey = document.getElementsByTagName('head')[0].innerHTML.split('my_post_key = "')[1].split('";')[0];
  923.     recipient = getPMOP(document.getElementsByClassName("post_author")[0].innerHTML);
  924.     subject = document.getElementsByClassName("thead")[1].innerHTML.split('>')[1].split('<')[0];
  925.     if(subject.indexOf("Re:") != 0){
  926.         subject = "Re: "+subject;
  927.     }
  928.     pmid = document.URL.split("pmid=")[1];
  929.    
  930.     postBody = '[HFES] Loading...';
  931.    
  932.     finalHtml = [
  933.         '<div align="center"; background: #000;>',
  934.         '<form action="private.php" method="POST">',
  935.         '<textarea style="width: 75%; align:"center"; padding: 4px; margin: 0;" rows="10" cols="80" name="message" id="message" tabindex="1">'+postBody+'</textarea><br>',
  936.         '<input type="hidden" name="action" value="do_send" />',
  937.         '<input type="hidden" name="my_post_key" value="'+postKey+'" />',
  938.         '<input type="hidden" name="to" id="to" value="'+recipient+'" />',
  939.         '<input type="hidden" name="pmid" value="'+pmid+'" />',
  940.         '<input type="hidden" name="do" value="reply" />',
  941.         '<input type="hidden" name="subject" value="'+subject+'" />',
  942.         '<input type="hidden" name="options[readreceipt]" value="1" />',
  943.         '<input type="hidden" name="options[savecopy]" value="1" />',
  944.         '<input type="submit" class="bitButton" name="submit" value="Send Quick Reply" tabindex="9" accesskey="s" title="Quick reply with the above box" />',
  945.         '  <a href="private.php?action=send&pmid='+pmid+'&do=reply" class="bitButton" rel="nofollow" title="Open full reply mode">Full Reply Mode</a>',
  946.         '  <a href="private.php?action=send&pmid='+pmid+'&do=forward" class="bitButton" rel="nofollow" title="Forward the message to someone">Forward Message</a>',
  947.         '  <a href="private.php?action=delete&pmid='+pmid+'&my_post_key='+postKey+'" class="bitButton" rel="nofollow" onclick="return confirm(\'Are you sure that you want to delete this PM?\');" title="Delete this message">Delete Message</a>',
  948.         '</form>',
  949.         '</div>'].join('');
  950.    
  951.     $(".author_buttons").hide();
  952.     $(".post_management_buttons").replaceWith(finalHtml);
  953.    
  954.     GM_xmlhttpRequest({
  955.         method: "GET",
  956.         url: "http://www.hackforums.net/private.php?action=send&pmid="+pmid,
  957.         onload: function(response){
  958.             $('#message').text($($($($($($.parseHTML(response.responseText)).filter("#container")[0].children).filter("#content")[0].children).filter(".quick_keys")[0].children).filter("form")[0][4]).text());
  959.             //debugPrint($($($($($($($($.parseHTML(response.responseText)).filter("#container")[0].children).filter("#content")[0].children).filter(".quick_keys")[0].children).filter("form")[0].children).filter("table")[0].children).filter("tbody")[0].children));
  960.             if(GM_config.get("locationhider") && document.URL.indexOf('favorites.php') == -1){
  961.                 if(GM_config.get("locationhider") && document.URL.indexOf('favorites.php') == -1){
  962.                     if(document.URL.indexOf("nsfw.") != -1){
  963.                         $.get("http://nsfw.hackforums.net/misc.php", function(){});
  964.                     }else if(document.URL.indexOf("www.") != -1){
  965.                         $.get("http://www.hackforums.net/misc.php", function(){});
  966.                     }else{
  967.                         $.get("http://hackforums.net/misc.php", function(){});
  968.                     }
  969.                
  970.                 }
  971.             }
  972.         }
  973.     });
  974.    
  975. }
  976.  
  977. function getUser(){
  978.     return document.getElementById('panel').innerHTML.split('uid=')[1].split('">')[1].split('</a')[0];
  979. }
  980.  
  981. function setUserbarInThread(){
  982.     var userInfoHTML, userInfoHTMLsplit, username, newindex;
  983.     username = getUser();
  984.     try{
  985.         userInfoHTML = $('.post_author:contains("'+username+'")')[0].innerHTML;
  986.         userInfoHTMLsplit = userInfoHTML.split('\n');
  987.         if(userInfoHTML.indexOf('postbit_groupimage') != -1){
  988.         // This is a little hacky way to do it, but it works! :P
  989.             newindex = - 4;
  990.         }else{
  991.             newindex = - 2;
  992.         }
  993.         userInfoHTMLsplit[userInfoHTMLsplit.length + newindex] = '<img src="http://sublyme.net/site_media/hfuserbars/'+GM_config.get('userBarSwitch')+'.gif" alt="[HFES] '+GM_config.get('userBarSwitch')+' userbar" title="[HFES] '+GM_config.get('userBarSwitch')+' userbar">';
  994.         userInfoHTML = userInfoHTMLsplit.join('\n');
  995.         $('.post_author:contains("'+username+'")').html(userInfoHTML);
  996.     }catch(err){debugPrint("Error attempting to set Userbars: "+err);}
  997. }
  998.  
  999. function addMsgTracking(){ //TURKEYHOLD
  1000.     var docSplit, i, messageID, inner;
  1001.     $('input[name*="readcheck"]').each(function(){
  1002.         messageID = parseInt($(this).attr("name").split('[')[1].split(']')[0])+1;
  1003.         //inner = $($($($($(this)[0].parentNode)[0].parentNode)[0].children)[1].children);
  1004.         inner = $($($($($(this)[0].parentNode)[0].parentNode)[0].children)[1]);
  1005.         debugPrint(inner);
  1006.         inner.html('<a href="/private.php?action=read&pmid='+messageID+'">'+inner.html()+'</a>');
  1007.         //inner.wrap('<a href="/private.php?action=read&pmid='+messageID+'"></a>');
  1008.         //$($($($($(this)[0].parentNode)[0].parentNode)[0].children)[0].children).prepend('<a href="/private.php?action=read&pmid='+messageID+'">');
  1009.         //$($($($($(this)[0].parentNode)[0].parentNode)[0].children)[0].children).append('</a>');
  1010.     });
  1011.    
  1012.     /*//try{
  1013.         docSplit = document.body.innerHTML.split('\n');
  1014.         for(i=0;i<docSplit.length;i++){
  1015.             if(docSplit[i].indexOf("start: private_tracking") != -1){
  1016.                 messageLine = docSplit[i+3].split(">")[1].split("<")[0];
  1017.                 messageID = (parseInt(docSplit[i+6].split("readcheck[")[1].split("]")[0])+1).toString();
  1018.                 messageLine = '<td class="trow2"><a href="/private.php?action=read&pmid='+messageID+'">'+messageLine+'</a></td>';
  1019.                 docSplit[i+3] = messageLine;
  1020.             }
  1021.         }
  1022.         document.body.innerHTML = docSplit.join('\n');
  1023.     //}catch(err){debugPrint("Error attempting to add Msg Tracking links");}*/
  1024. }
  1025.  
  1026. function addLastLinks(){
  1027.     var docSplit, i, lastURL, prevLine, flag;
  1028.     docSplit = document.getElementById("content").innerHTML.split('\n');
  1029.     flag = false;
  1030.     for(i=0; i<docSplit.length; i++){
  1031.         if((docSplit[i].indexOf('<img src="http://x.hackforums.net/images') != -1 || docSplit[i].indexOf('http://www.hackforums.net:8080/images') != -1) && flag == false){
  1032.             prevLine = i;
  1033.             flag = true;
  1034.         }
  1035.         if(docSplit[i].indexOf("showthread.php") != -1 && docSplit[i].indexOf("pid=") == -1 && flag == true){
  1036.             try{
  1037.                 lastURL = '<a href="'+docSplit[i].split('="')[1].split('">')[0]+'&action=lastpost"><img';
  1038.                 docSplit[prevLine] = docSplit[prevLine].replace('<img',lastURL).replace('</td','</a></td');
  1039.                 flag = false;
  1040.             }catch(err){
  1041.             }
  1042.            
  1043.         }
  1044.     }
  1045.     document.getElementById("content").innerHTML = docSplit.join("\n");
  1046. }
  1047.  
  1048. function groupMemberGen(leaders, members, groupName, method){
  1049.     var finalBB = [], i, delim = '|!@|';
  1050.     if(method == 'standard'){
  1051.         // Standard, for creating generic lists
  1052.         finalBB.push('[size=x-large][b]'+groupName+' Member List[/b][/size]');
  1053.         finalBB.push('[b]Leaders:[/b]');
  1054.         finalBB.push('[list]');
  1055.         for(i=0; i<leaders.length; i++){
  1056.             finalBB.push('[*] [url=http://'+document.URL.split('/')[2]+'/member.php?action=profile&uid='+leaders[i].split(delim)[0]+']'+leaders[i].split(delim)[1]+'[/url]');
  1057.         }
  1058.         finalBB.push('[/list]');
  1059.        
  1060.         finalBB.push('[b]Members:[/b]');
  1061.         finalBB.push('[list]');
  1062.         for(i=0; i<members.length; i++){
  1063.             finalBB.push('[*] [url=http://'+document.URL.split('/')[2]+'/member.php?action=profile&uid='+members[i].split(delim)[0]+']'+members[i].split(delim)[1]+'[/url]');
  1064.         }
  1065.         finalBB.push('[/list]');
  1066.         finalBB = finalBB.join('\n');
  1067.     }else if(method == 'standardnolink'){
  1068.         // Standard, without BB list
  1069.         finalBB.push('[size=x-large][b]'+groupName+' Member List[/b][/size]');
  1070.         finalBB.push('[b]Leaders:[/b]');
  1071.         for(i=0; i<leaders.length; i++){
  1072.             finalBB.push('[url=http://'+document.URL.split('/')[2]+'/member.php?action=profile&uid='+leaders[i].split(delim)[0]+']'+leaders[i].split(delim)[1]+'[/url]');
  1073.         }
  1074.         finalBB.push('[b]Members:[/b]');
  1075.         for(i=0; i<members.length; i++){
  1076.             finalBB.push('[url=http://'+document.URL.split('/')[2]+'/member.php?action=profile&uid='+members[i].split(delim)[0]+']'+members[i].split(delim)[1]+'[/url]');
  1077.         }
  1078.         finalBB = finalBB.join('\n');
  1079.     }else if(method == 'nolistnolink'){
  1080.         // No list, for use with PM's, no links
  1081.         for(i=0; i<leaders.length; i++){
  1082.             finalBB.push(leaders[i].split(delim)[1]);
  1083.         }
  1084.         for(i=0; i<members.length; i++){
  1085.             finalBB.push(members[i].split(delim)[1]);
  1086.         }
  1087.         finalBB = finalBB.join(', ');
  1088.     }else if(method == 'nolistwithlink'){
  1089.         // No list, with links
  1090.         for(i=0; i<leaders.length; i++){
  1091.             finalBB.push('[url=http://'+document.URL.split('/')[2]+'/member.php?action=profile&uid='+leaders[i].split(delim)[0]+']'+leaders[i].split(delim)[1]+'[/url]');
  1092.         }
  1093.         for(i=0; i<members.length; i++){
  1094.             finalBB.push('[url=http://'+document.URL.split('/')[2]+'/member.php?action=profile&uid='+members[i].split(delim)[0]+']'+members[i].split(delim)[1]+'[/url]');
  1095.         }
  1096.         finalBB = finalBB.join(', ');
  1097.     }else{
  1098.         finalBB = '';
  1099.     }
  1100.     return finalBB;
  1101. }
  1102.  
  1103. function listMembers(){
  1104.     var trowls, i, members = [], leaders = [], groupName, uid, delim = '|!@|', nameList, textboxHTML, tableHTML, docSplit;
  1105.     trowls = document.getElementsByClassName("tborder")[0].innerHTML.split("\n");
  1106.     for(i=0; i<trowls.length; i++){
  1107.         if(trowls[i].indexOf('action=profile') != -1){
  1108.             uid = trowls[i].split('uid=')[1].split('">')[0]+delim;
  1109.             if(trowls[i].indexOf('</a> (Leader)') != -1){
  1110.                 leaders.push(uid+trimString(trowls[i].replace(/<(?:.|\n)*?>/gm, '').replace(' (Leader)','')));
  1111.                 //alert(trowls[i]+" is a leader");
  1112.             }else{
  1113.                 members.push(uid+trimString(trowls[i].replace(/<(?:.|\n)*?>/gm, '')));
  1114.                 //alert(trowls[i]+" is a member");
  1115.             }
  1116.         }
  1117.     }
  1118.     groupName = getThreadTitle(document.getElementsByClassName('navigation')[0].innerHTML, document.URL).split('[b]')[1].split('[/b]')[0];
  1119.     groupName = groupName.replace(" Group Management", '');
  1120.     nameList = groupMemberGen(leaders, members, groupName, GM_config.get('groupLeaderUserList', 'standard'));
  1121.     textboxHTML = '<textarea rows="5" cols=100%>'+nameList+'</textarea>';
  1122.     tableHTML = '<table border="0" cellspacing="1" cellpadding="4" class="tborder" id="HFESlist"><tbody><tr><td class="thead" colspan="6"><strong>[HFES] Easy Member List</strong></td></tr><tr><td class="trow1">Userlist:      </td><td class="trow1">'+textboxHTML+'</td></tr></tbody></table><br><br>';
  1123.  
  1124.     docSplit = document.getElementById('content').innerHTML.split('\n');
  1125.     for(i=0; i< docSplit.length; i++){
  1126.         if(docSplit[i].indexOf('end: managegroup_leaders ') != -1){
  1127.             docSplit[i] = docSplit[i]+tableHTML;
  1128.             document.getElementById('content').innerHTML = docSplit.join('\n');
  1129.             return;
  1130.         }
  1131.     }
  1132. }
  1133.  
  1134.  
  1135. function prettyPMDisplay(finalArray){
  1136.     var tempHTML, bubbleList = [], i, user;
  1137.     user = getUser();
  1138.     bubbleList.push('<table class="fixed" border="0" width=95% align="center" cellpadding="3">');
  1139.     bubbleList.push('<col width=50%>');
  1140.     bubbleList.push('<col width=50%>');
  1141.     for(i=0; i<finalArray.length; i++){
  1142.         bubbleList.push('<tr>');
  1143.         if(finalArray[i][0] == user){
  1144.             if(finalArray[i][1] == 1){
  1145.                 bubbleList.push('<td></td><td><div class="pm_right_unread" width="45%" align="right"><b>'+finalArray[i][0]+' Wrote:</b><br>'+finalArray[i][2].join('\n')+'</div></td>');
  1146.             }else{
  1147.                 bubbleList.push('<td></td><td><div class="pm_right_read" width="45%" align="right"><b>'+finalArray[i][0]+' Wrote:</b><br>'+finalArray[i][2].join('\n')+'</div></td>');
  1148.             }
  1149.         }else{
  1150.             if(finalArray[i][1] == 1){
  1151.                 bubbleList.push('<td><div class="pm_left_unread" width=45%><b>'+finalArray[i][0]+' Wrote:</b><br>'+finalArray[i][2].join('\n')+'</div></td><td></td>');
  1152.             }else{
  1153.                 bubbleList.push('<td><div class="pm_left_read" width="45%"><b>'+finalArray[i][0]+' Wrote:</b><br>'+finalArray[i][2].join('\n')+'</div></td><td></td>');
  1154.             }
  1155.         }
  1156.         bubbleList.push('</tr>');
  1157.     }
  1158.    
  1159.     document.getElementById('pid_').innerHTML = bubbleList.join('');
  1160. }
  1161.  
  1162. function parsePMPretty(){
  1163.     var tempArray = [], originalAuthor, authorList = [], i, docSplit, newAuthor, finalArray = [], tempvar, quoteLink;
  1164.     docSplit = document.getElementsByClassName("post_body")[0].innerHTML;
  1165.     docSplit = trimString(docSplit);
  1166.     docSplit = replaceAll(docSplit, ">", ">\n");
  1167.     docSplit = replaceAll(docSplit, "</blockquote>", "\n</blockquote>");
  1168.     docSplit = docSplit.split('\n');
  1169.  
  1170.     //debugPrint(docSplit);
  1171.    
  1172.     originalAuthor = getThreadOP(document.getElementsByClassName("post_author")[0].innerHTML).split(']')[1].split('[')[0];
  1173.     tempArray[tempArray.length] = [originalAuthor, 1, []];
  1174.     authorList.push(originalAuthor);
  1175.     //debugPrint("Current status of temparray: "+tempArray);
  1176.    
  1177.     for(i=0; i<docSplit.length; i++){
  1178.         if(docSplit[i].indexOf("Wrote:</cite>") != -1 && docSplit[i-1].indexOf("<cite>") != -1){
  1179.             newAuthor = docSplit[i].split(" Wrote:")[0];
  1180.             if(tempArray.length == 1 && tempArray[0][2].length > 0){
  1181.                 tempvar = tempArray.pop();
  1182.                 finalArray.push(tempvar);
  1183.                 tempArray.push([originalAuthor, 1, []]);
  1184.             }
  1185.             tempArray.push([newAuthor, 0, []]);
  1186.             authorList.push(newAuthor);
  1187.         }else if(docSplit[i].indexOf("Quote:</cite>") != -1 && docSplit[i-1].indexOf("<cite>") != -1){
  1188.             newAuthor = 'Unattributed Quote';
  1189.             if(tempArray.length == 1 && tempArray[0][2].length > 0){
  1190.                 tempvar = tempArray.pop();
  1191.                 finalArray.push(tempvar);
  1192.                 tempArray.push([originalAuthor, 1, []]);
  1193.             }
  1194.             tempArray.push([newAuthor, 0, []]);
  1195.             authorList.push(newAuthor);
  1196.         }else if(docSplit[i].indexOf('hr style="width: 20%;background: #000') != -1){
  1197.             tempvar = tempArray.pop();
  1198.             finalArray.push(tempvar);
  1199.             return finalArray;
  1200.         }else if(docSplit[i].indexOf("Wrote:") != -1){
  1201.             if(docSplit.length >= 2){
  1202.                 if(docSplit[i-2].indexOf('span') != -1){
  1203.                     newAuthor = docSplit[i].split(' Wrote:')[0];
  1204.                     quoteLink = '/'+docSplit[i].split('="')[1].split('" ')[0].split('/')[3];
  1205.                     if(tempArray.length == 1 && tempArray[0][2].length > 0){
  1206.                         tempvar = tempArray.pop();
  1207.                         finalArray.push(tempvar);
  1208.                         tempArray.push([originalAuthor, 1, []]);
  1209.                         tempArray.push([newAuthor, 1, ['<small><i>Quoted post from <a href="'+quoteLink+'">here</a></i></small>']]);
  1210.                     }else{
  1211.                         tempArray.push([newAuthor, 0, ['<small><i>Quoted post from <a href="'+quoteLink+'">here</a></i></small>']]);
  1212.                     }
  1213.                     authorList.push(newAuthor);
  1214.                 }else{
  1215.                     tempArray[tempArray.length-1][2].push(docSplit[i]);
  1216.                 }
  1217.             }else{
  1218.                 tempArray[tempArray.length-1][2].push(docSplit[i]);
  1219.             }
  1220.         }else if(docSplit[i].indexOf("</blockquote>") != -1){
  1221.             tempvar = tempArray.pop();
  1222.             authorList.pop();
  1223.             finalArray.push(tempvar);
  1224.         }else if(docSplit[i] != "" && docSplit[i].indexOf("<blockquote>") != 0 && docSplit[i].indexOf("<cite>") != 0 && docSplit[i].indexOf("<br>") != 0){
  1225.             if(i >= 1){
  1226.                 if(docSplit[i-1].indexOf("<span") != 0 || docSplit[i-1].indexOf('style=') != -1){
  1227.                     tempArray[tempArray.length-1][2].push(docSplit[i]);
  1228.                 }
  1229.             }else{
  1230.                 tempArray[tempArray.length-1][2].push(docSplit[i]);
  1231.             }
  1232.         }
  1233.     }
  1234.     tempvar = tempArray.pop();
  1235.     finalArray.push(tempvar);
  1236.     return finalArray;
  1237. }
  1238.  
  1239. function prettyPM(){
  1240.     var finalArray;
  1241.     finalArray = parsePMPretty();
  1242.     //debugPrint(finalArray);
  1243.     prettyPMDisplay(finalArray);
  1244. }
  1245.  
  1246. function asc2hex(astring){
  1247.     var bstring, i,charcode;
  1248.     bstring = '';
  1249.     for(i=0; i<astring.length; i++) {
  1250.         charcode = astring.charCodeAt(i);
  1251.         if(charcode >= 32 && charcode <= 126){
  1252.             bstring += '%'+astring.charCodeAt(i).toString(16);
  1253.         }
  1254.     }
  1255.     return bstring;
  1256. }
  1257.  
  1258. function addPostPM(){
  1259.     var postData, i, pid, tid, message, holder, j, threadtitle, postcounter;
  1260.     postcounter = 0;
  1261.     postData = $('.tborder');
  1262.     tid = document.URL.split('tid=')[1].split('&')[0];
  1263.     for(i=1; i<postData.length; i++){
  1264.         if(postData[i].innerHTML.indexOf('id="post_') != -1 && postData[i].innerHTML.indexOf('href="private.php?action=send') != -1){
  1265.             pid = postData[i].innerHTML.split('id="post_meta_')[1].split('">')[0];
  1266.             message = '&subject=Re%3A%20Your%20Post&message=[align%3Dright][size%3Dx-small][i][This%20PM%20is%20in%20regards%20to%20[url=http://www.hackforums.net/showthread.php?tid%3D'+tid+'%26pid%3D'+pid+'%23pid'+pid+']a%20post%20you%20made[/url]][/i][/size][/align]';
  1267.             $('.author_buttons a:contains("PM")')[postcounter].href += message;
  1268.             postcounter += 1;
  1269.         }
  1270.     }
  1271.    
  1272. }
  1273.  
  1274. function getProfileName(){
  1275.     var namecolorString, usernameColor, usernameClass, username, profileGenerator, profileStatsHTML;
  1276.     if($(".largetext strong span").length == 3){
  1277.         namecolorString = $($(".largetext strong span")[0]);
  1278.     }else if($(".largetext strong span").length == 4){
  1279.         namecolorString = $($(".largetext strong span")[1]);
  1280.     }
  1281.     username = namecolorString.html();
  1282.     usernameClass = namecolorString.attr('class');
  1283.     if(!usernameClass){
  1284.         usernameColor = '#383838'; // Closed Accounts
  1285.     }else if(usernameClass=="group4"){
  1286.         usernameColor = '#FF66FF'; // Admins
  1287.     }else if(usernameClass == "group3"){
  1288.         usernameColor = '#9999FF';  // Staff
  1289.     }else if(usernameClass == "group9"){
  1290.         usernameColor = '#99FF00'; // L33T
  1291.     }else if(usernameClass == "group29"){
  1292.         usernameColor = '#00AAFF';  // Ub3r
  1293.     }else if(usernameClass == "group7"){
  1294.         usernameColor = 'black'; // Banned
  1295.     }else{
  1296.         usernameColor = '#EFEFEF';
  1297.     }
  1298.     profileGenerator = '[url='+document.URL.replace('nsfw.','www.')+']';
  1299.     if(usernameColor != ''){
  1300.         profileGenerator = profileGenerator+'[color='+usernameColor+'][b]'+username+'[/b][/color][/url]';
  1301.     }else{
  1302.         profileGenerator = profileGenerator+'[b]'+username+'[/b][/url]';
  1303.     }
  1304.     window.prompt("Press Ctrl+C to copy profile citation!",profileGenerator);
  1305. }
  1306.  
  1307. function threadTagger(){
  1308.     var i, authorPosts, apHolder, tagNameHolder, tagNameKeys, uid, uidpos;
  1309.     authorPosts = document.getElementsByClassName('post_author');
  1310.     tagNameHolder = GM_SuperValue.get('usertags');
  1311.     tagNameKeys = Object.keys(tagNameHolder);
  1312.    
  1313.     for(i=0; i<authorPosts.length; i++){
  1314.         if(authorPosts[i].innerHTML.indexOf('uid=') != -1){
  1315.             uid = authorPosts[i].innerHTML.split('uid=')[1].split('">')[0];
  1316.             uidpos = tagNameKeys.indexOf(uid);
  1317.             if(uidpos != -1){
  1318.                 if(tagNameHolder[uid] != ''){
  1319.                     apHolder = authorPosts[i].innerHTML.split('\n');
  1320.                     apHolder[3] = apHolder[3].replace('<br>','</span><span class="tag_bubble" >'+tagNameHolder[uid]+'</span><br>');
  1321.                     document.getElementsByClassName('post_author')[i].innerHTML = apHolder.join('\n');
  1322.                 }
  1323.             }
  1324.         }
  1325.     }
  1326. }
  1327.  
  1328. function profileTagger(){
  1329.     var tag, uid, tagNameHolder;
  1330.     uid = document.URL.split('uid=')[1];
  1331.     tagNameHolder = GM_SuperValue.get('usertags');
  1332.     if(Object.keys(tagNameHolder).indexOf(uid) != -1 && tagNameHolder[uid] != ''){
  1333.         tag = tagNameHolder[uid];
  1334.     }else{
  1335.         tag = '<small><small><i>Click to add tag</i></small></small>'; // HOLDER
  1336.     }
  1337.     $($('.largetext strong span')[0].parentNode).append('&nbsp<span class="tag_bubble" style="font-style:normal;" id="profileTag"><small>'+tag+'</small></span>');
  1338.     $("#profileTag").live("click", function(){ tagEditor(); });
  1339. }
  1340.  
  1341. function tagEditor(){
  1342.     var newTag, tagNameHolder, uid;
  1343.     uid = document.URL.split('uid=')[1];
  1344.     tagNameHolder = GM_SuperValue.get('usertags');
  1345.     if(Object.keys(tagNameHolder).indexOf(uid) != -1){
  1346.         newTag = tagNameHolder[uid];
  1347.     }else{
  1348.         newTag = '';
  1349.     }
  1350.     newTag = prompt('Enter tag for user: ',newTag);
  1351.     if(newTag == null){
  1352.         return;
  1353.     }
  1354.     if(newTag != ''){
  1355.         tagNameHolder[uid] = newTag;
  1356.         GM_SuperValue.set('usertags', tagNameHolder);
  1357.     }
  1358.     if(newTag == '' || newTag == null || !newTag){
  1359.         tagNameHolder[uid] = '';
  1360.         GM_SuperValue.set('usertags', tagNameHolder);
  1361.     }
  1362. }
  1363.  
  1364. function repsgivenFix(){
  1365.     var index, holder, i;
  1366.     holder = document.getElementsByClassName("tfoot");  //($('.tfoot')[0].html().replace('reputation.php','repsgiven.php'));
  1367.     for(i=0; i<holder.length; i++){
  1368.         if(holder[i].innerHTML.indexOf('reputation.php') != -1){
  1369.             holder[i].innerHTML = holder[i].innerHTML.replace('reputation.php','repsgiven.php');
  1370.         }
  1371.     }
  1372.    
  1373.     holder = document.getElementsByClassName('trow1')[0].getElementsByTagName('a');
  1374.     for(i=0; i<holder.length; i++){
  1375.         holder[i].href = holder[i].href.replace('reputation','repsgiven');
  1376.     }
  1377. }
  1378.  
  1379. function forceSFW(){
  1380.     var url;
  1381.     url = document.URL;
  1382.     if(GM_config.get('forcesfw') == 'sfw'){
  1383.         if(url.indexOf('nsfw.') == -1){
  1384.             if(url.indexOf('www.') != -1){
  1385.                 window.location.href = url.replace('www', 'nsfw');
  1386.             }else{
  1387.                 window.location.href = url.replace('hackforums.net', 'nsfw.hackforums.net');
  1388.             }
  1389.         }
  1390.     }else{
  1391.         if(url.indexOf('nsfw.') != -1){
  1392.             window.location.href = url.replace('nsfw','www');
  1393.         }
  1394.     }
  1395. }
  1396.  
  1397. /**
  1398.  * Parse out the page title
  1399.  * @param {jQuery} pageObject - The object containing the page to parse
  1400.  * @return {Object} Returns an object with the page tile and url.
  1401.  */
  1402. var getPageTitle = function($pageObject) {
  1403.     var pageTitle = $pageObject.find('.navigation .active').text();
  1404.     try {
  1405.         var url = $pageObject[0].URL;
  1406.     } catch(e) {
  1407.         var url = null;
  1408.     }
  1409.    
  1410.     return {"title": pageTitle, "url": url};
  1411. };
  1412.  
  1413. ////////// Forum Favorites
  1414.  
  1415. /**
  1416.  * Add link to favorite forums on the forum page itself.
  1417.  */
  1418. var linkAddFavorite = function() {
  1419.     debugPrint("Adding Favorite Link", 1);
  1420.     var favList = GM_SuperValue.get('favList');
  1421.     var currFid = document.URL.split('fid=')[1].split('&')[0];
  1422.     var linkText = (currFid in favList ? "Unfavorite" : "Favorite") + " this forum";
  1423.     var adderHTML = "<a href='javascript:void(0);' id='add-fav' style='float:right; color:#888888'>"+linkText+"</a>";
  1424.     $('.navigation').append(adderHTML);
  1425.     $('#add-fav').on('click', function(event) {
  1426.         addRemoveFavoriteCallback(currFid);
  1427.     });
  1428. };
  1429.  
  1430. var addRemoveFavoriteCallback = function(fid) {
  1431.     debugPrint("Adding/Removing Favorite Link", 1);
  1432.    
  1433.     var favList = GM_SuperValue.get('favList');
  1434.    
  1435.     if (fid in favList) {
  1436.         delete favList[fid];
  1437.     } else {
  1438.         favList[fid] = getPageTitle($(document))['title'];
  1439.     }
  1440.    
  1441.     var linkText = (fid in favList ? "Unfavorite" : "Favorite") + " this forum";
  1442.  
  1443.     $('#add-fav').text(linkText);
  1444.     GM_SuperValue.set('favList', favList);
  1445. };
  1446.  
  1447. /**
  1448.  * List the favorite forums in the left column.
  1449.  */
  1450. var listFavorites = function(favList) {
  1451.     for (var fid in favList) {
  1452.         var forumURL = "/forumdisplay.php?fid=" + fid;
  1453.         var entryHTML = "<tr class='trow1 smalltext' data-fid='" + fid + "'><td><a href='" + forumURL + "'>" + favList[fid] +
  1454.             "</a> <a href class='remove-fav' data-fid='" + fid + "'>(x)</a></td></tr>";
  1455.         $('#favorite-forums').append(entryHTML);
  1456.     }
  1457.     $('#favorite-forums').live('click', '.remove-fav', removeFavoriteFromFavs);
  1458.     $('#read-forums').live('click', readAllFavForums);
  1459.     //$('.remove-fav').on('click', removeFavoriteFromFavs);
  1460. };
  1461.  
  1462. /**
  1463.  * Callback to remove all fid entries from the favorites page as well as remove the forum from the favorites list.
  1464.  * @param {Event} event - Event param passed along to function by jQuery.
  1465.  */
  1466. var removeFavoriteFromFavs = function(event) {
  1467.     event.preventDefault();
  1468.    
  1469.     var byeFid = $(event.target).data('fid');
  1470.     $('tr[data-fid="'+byeFid+'"]').remove();
  1471.     var currFavList = GM_SuperValue.get('favList');
  1472.     delete currFavList[byeFid];
  1473.     GM_SuperValue.set('favList', currFavList);
  1474. };
  1475.  
  1476. /**
  1477.  * Mark all threads in all favorited forums as read.
  1478.  */
  1479.  
  1480. var readAllFavForums = function(event) {
  1481.     event.preventDefault();
  1482.     var favList = GM_SuperValue.get('favList');
  1483.     for (fid in favList) {
  1484.         debugPrint(fid);
  1485.         $.get("/misc.php?action=markread&fid="+fid+"&my_post_key="+postKey);
  1486.     }
  1487. };
  1488.  
  1489. /**
  1490.  * Replace current HTML with the Forum Favorites HTML, then initiate populating the list of threads.
  1491.  */
  1492. var initializeFavorites = function() {
  1493.     var that = this
  1494.     var nsfwness = (document.URL.indexOf('nsfw.hackforums') !== -1 ? "NSFW" : "");
  1495.     var favoritesURL = urlBase + "HFESpages/HFESfavorites"+nsfwness+".html";
  1496.     var postKey = "";
  1497.    
  1498.     // Get your post key.
  1499.     $.ajax({
  1500.         type: 'GET',
  1501.         url: 'forumdisplay.php?fid=2',
  1502.         success: function(response) {
  1503.             that.postKey = response.split('my_post_key = "')[1].split('";')[0];
  1504.         }
  1505.     });
  1506.    
  1507.     // Relying on GreaseMonkey's API to bypass the same origin policy boundaries. Impossible with standard ajax requests in a sandboxed userscript.
  1508.     GM_xmlhttpRequest({
  1509.         url: favoritesURL,
  1510.         method: "GET",
  1511.         onload: function(response) {
  1512.             document.title = (nsfwness === "NSFW" ? "HF - Favorites" : "Hack Forums - Favorites");
  1513.             document.head.innerHTML += '<link type="text/css" rel="stylesheet" href="http://www.hackforums.net/cache/themes/theme5/global.css">'
  1514.             document.body.innerHTML = response.responseText;
  1515.             // Since now the DOM should be ready, let's run the rest of HFES's mods.
  1516.             start();
  1517.            
  1518.             $('#readforums').on('click', readAllFavForums);
  1519.            
  1520.             // Start populating favorites list.
  1521.             var favList = GM_SuperValue.get('favList');
  1522.             listFavorites(favList);
  1523.            
  1524.             for (var fid in favList) {
  1525.                 getForumThreadsUnread(fid);
  1526.             }
  1527.         },
  1528.         onerror: function(response) {
  1529.             debugPrint("Error attempting to retreive data from " + favoritesURL);
  1530.         }
  1531.     });
  1532. };
  1533.  
  1534. /**
  1535.  * Grab all unread threads from a specific subforum. Passes list onto stripper.
  1536.  * @param {Number} fid - A valid forum ID.
  1537.  */
  1538. var getForumThreadsUnread = function(fid) {
  1539.     debugPrint("Favorites - Starting journey for fid="+fid);
  1540.     var fid = fid;
  1541.     $.get("/forumdisplay.php?fid=" + fid, function(response){
  1542.         var $allThreadIconsNew = $(response).find("table").last().find("img[src*='new']");
  1543.         var $panel = $(response).find('#panel');
  1544.         if($('#panel').html().indexOf('header_welcomeblock_member')  === -1) {
  1545.             $('#panel').html($panel.html());
  1546.         }
  1547.        
  1548.         var $allUnreadThreadRows = $allThreadIconsNew.parent().parent();
  1549.         var pageTitle = getPageTitle($(response));
  1550.         stripAddThreadInfo($allUnreadThreadRows, pageTitle["title"], fid);
  1551.     });
  1552. };
  1553.  
  1554. /**
  1555.  * We don't want every part of the row, we also want to add some things. Let's do it here.
  1556.  * @param {jQuery} $threadRows - List of unread threads
  1557.  * @param {String} forumName - Name of the section the threads are from.
  1558.  * @param {String} fid - Forum ID
  1559.  */
  1560. var stripAddThreadInfo = function($threadRows, forumName, fid) {
  1561.     debugPrint("Favorites - Removing thread ratings and adding Forum name");
  1562.     var forumURL = "/forumdisplay.php?fid="+fid;
  1563.     $threadRows.each(function(aRow) {
  1564.         $($threadRows[aRow]).find("td[id^='rating_table']").remove(); // Remove thread ratings.
  1565.         $($threadRows[aRow]).children().eq(2).before("<td class='trow1 forumdisplay_regular'><a href='" + forumURL + "'>" + forumName + "</a></td>"); // Add forum name
  1566.        
  1567.         $($threadRows[aRow]).attr("data-fid", fid); // Add the forum id to the table row for easy row removal
  1568.  
  1569.     });
  1570.     renderFavoriteThreads($threadRows);
  1571. };
  1572.  
  1573. /**
  1574.  * Finally render the found threads to the favorites page!
  1575.  * @param {jQuery} $unreadThreads - List of unread threads.
  1576.  */
  1577. var renderFavoriteThreads = function($unreadThreads) {
  1578.     debugPrint("Favorites - Rendering unread threads to the page.");
  1579.     $('#favorite-unread-threads').append($unreadThreads);
  1580.     addLastLinks();
  1581. };
  1582.  
  1583. //////////
  1584.  
  1585.  
  1586. function addQuoteToMulti(buttonId){
  1587.     var tid, pid, multiData, multiDataKeys, newText, multilength;
  1588.     tid = buttonId.split('_')[2];
  1589.     pid = buttonId.split('_')[3];
  1590.     multiData = localStorage.getItem('hfes_multi_'+tid);
  1591.    
  1592.     if(!multiData){
  1593.         localStorage.setItem('hfes_multi_'+tid, JSON.stringify({'':''}));
  1594.     }
  1595.     multiData = localStorage.getItem('hfes_multi_'+tid);
  1596.    
  1597.     multiData = JSON.parse(multiData);
  1598.     multiDataKeys = Object.keys(multiData);
  1599.     multilength = multiDataKeys.length-1;
  1600.    
  1601.     if($('#'+buttonId)[0].innerHTML.indexOf('+') != -1){
  1602.         $('#'+buttonId).html('<img src="http://sublyme.net/site_media/images/loading.gif"></img> Multiquote');
  1603.         GM_xmlhttpRequest({
  1604.             method: "GET",
  1605.             url: 'http://nsfw.hackforums.net/newreply.php?tid='+tid+'&replyto='+pid,
  1606.             onload: function(response){
  1607.                 try{
  1608.                     var tid, newmulti, pid;
  1609.                     tid = response.finalUrl.split('tid=')[1].split('&')[0];
  1610.                     pid = response.finalUrl.split('replyto=')[1];
  1611.                     newmulti = JSON.parse(localStorage.getItem('hfes_multi_'+tid));
  1612.                     newmulti[pid] = $($.parseHTML(response.responseText)).find('#message')[0].innerHTML;
  1613.                     localStorage.setItem('hfes_multi_'+tid, JSON.stringify(newmulti));
  1614.                     $('#hfes_multi_'+tid+'_'+pid).html('- Multiquote');
  1615.                 }catch(err){debugPrint('[HFES] Err attempting to get multiquote info: '+err.message);}
  1616.             },
  1617.         });
  1618.         multilength += 1;
  1619.     }else if($('#'+buttonId)[0].innerHTML.indexOf('-') != -1){
  1620.         $('#'+buttonId).html('<img src="http://sublyme.net/site_media/images/loading.gif"></img> Multiquote');
  1621.         delete multiData[pid];
  1622.         localStorage.setItem('hfes_multi_'+tid, JSON.stringify(multiData));
  1623.         $('#'+buttonId).html('+ Multiquote');
  1624.         multilength -= 1;
  1625.     }else{
  1626.         debugPrint('[HFES] Error trying to add multiquote');
  1627.         return;
  1628.     }
  1629.     newText = 'Clear Multiquotes ('+multilength+')';
  1630.     $('#clearMulti').html(newText);
  1631.     $('#clearMulti2').html(newText);
  1632.     $('#quickMulti').html('Insert Multiquotes ('+multilength+')');
  1633. }
  1634.  
  1635. function addMultiQuoteButtons(){
  1636.     var postData, tid, i, pid, id, button, multiData, multiDataKeys, multilength;
  1637.     if(typeof(Storage)!="undefined"){
  1638.         if($('a[title*="Thread Closed"]').length > 0){
  1639.             return;
  1640.         }
  1641.         postData = $('#posts .tborder');
  1642.         tid = document.URL.split('tid=')[1].split('&')[0];
  1643.         multiData = localStorage.getItem('hfes_multi_'+tid);
  1644.        
  1645.         if(!multiData){
  1646.             localStorage.setItem('hfes_multi_'+tid, JSON.stringify({'':''}));
  1647.         }
  1648.         multiData = localStorage.getItem('hfes_multi_'+tid);
  1649.         multiData = JSON.parse(multiData);
  1650.         multiDataKeys = Object.keys(multiData);
  1651.        
  1652.         for(i=0; i<postData.length; i++){
  1653.             if(postData[i].outerHTML.indexOf('id="post_meta_') != -1){                
  1654.                 pid = postData[i].outerHTML.split('id="post_meta_')[1].split('">')[0];
  1655.                 id = 'hfes_multi_'+tid+'_'+pid;
  1656.                 if(multiDataKeys.indexOf(pid) == -1){
  1657.                     button = '<a href="javascript:void(0);" class="bitButton" id="'+id+'" title="[HFES] Multiquoting" style="margin-right:5px">+ Multiquote</a>';
  1658.                 }else{
  1659.                     button = '<a href="javascript:void(0);" class="bitButton" id="'+id+'" title="[HFES] Multiquoting" style="margin-right:5px">- Multiquote</a>';
  1660.                 }
  1661.                
  1662.                 //$('.post_management_buttons')[i-1].innerHTML = button + $('.post_management_buttons')[i-1].innerHTML;
  1663.                 $($('.post_management_buttons')[i]).prepend(button);
  1664.                 id = '#'+id;
  1665.                 $(id).live("click", function(event){addQuoteToMulti(event.target.id);});
  1666.             }
  1667.         }
  1668.         multilength = multiDataKeys.length -1;
  1669.         $($('.float_right:contains("New Reply")')[0]).html('<a href="javascript:void(0);" class="bitButton" id="clearMulti">Clear Multiquotes ('+multilength+')</a>' + $($('.float_right:contains("New Reply")')[0]).html());
  1670.         $($('.float_right:contains("New Reply")')[1]).html('<a href="javascript:void(0);" class="bitButton" id="clearMulti2">Clear Multiquotes ('+multilength+')</a>' + $($('.float_right:contains("New Reply")')[1]).html());
  1671.         $($('#quickreply_e .trow1')[0]).html($($('#quickreply_e .trow1')[0]).html() + '<br><br><a href="javascript:void(0);" class="bitButton" id="quickMulti">Insert Multiquotes ('+multilength+')</a>');
  1672.         $('#clearMulti').live("click", function(){ clearMultis();});
  1673.         $('#clearMulti2').live("click", function(){ clearMultis();});
  1674.         $('#quickMulti').live("click", function(){ addMultiToQuickReply();});
  1675.        
  1676.        
  1677.     }else{
  1678.         alert('This browser does not support local storage and cannot use HFES multiquoting');
  1679.         GM_config.set('multiquote', false);
  1680.     }
  1681. }
  1682.  
  1683. function clearMultis(){
  1684.     var tid, multiData, multiDataKeys, i;
  1685.     tid = document.URL.split('tid=')[1].split('&')[0];
  1686.     multiData = localStorage.getItem('hfes_multi_'+tid);
  1687.     multiData = JSON.parse(multiData);
  1688.     multiDataKeys = Object.keys(multiData);
  1689.    
  1690.     for(i=0; i<multiDataKeys.length; i++){
  1691.         $('#hfes_multi_'+tid+'_'+multiDataKeys[i]).text('+ Multiquote');
  1692.         //debugPrint(multiData[multiDataKeys[i]]);
  1693.         multiData[multiDataKeys[i]] = multiData[multiDataKeys[i]].replace('-','+');
  1694.     }
  1695.    
  1696.     $('#clearMulti').html('Clear Multiquotes (0)');
  1697.     $('#clearMulti2').html('Clear Multiquotes (0)');
  1698.     $('#quickMulti').html('Insert Multiquotes (0)');
  1699.     localStorage.setItem('hfes_multi_'+tid, JSON.stringify({'':''}));
  1700. }
  1701.  
  1702. function addMultiToQuickReply(){
  1703.     var tid, multiData, multiDataKeys, quotes = [], i, tempquote, quotestring;
  1704.     tid = document.URL.split('tid=')[1].split('&')[0];
  1705.     multiData = localStorage.getItem('hfes_multi_'+tid);
  1706.    
  1707.     if(!multiData){
  1708.         return;
  1709.     }
  1710.    
  1711.     multiData = JSON.parse(multiData);
  1712.     multiDataKeys = Object.keys(multiData);
  1713.    
  1714.     if(multiDataKeys.length < 2){
  1715.         return;
  1716.     }
  1717.    
  1718.     for(i=0; i<multiDataKeys.length; i++){
  1719.         tempquote = multiData[multiDataKeys[i]];
  1720.         quotes.push(tempquote);
  1721.     }
  1722.     quotestring = quotes.join('\n');
  1723.     $('#message').html(quotestring);
  1724.     clearMultis();
  1725. }
  1726.  
  1727.  
  1728. function addMultiToReply(){
  1729.     var tid, multiData, multiDataKeys, quotes = [], i, tempquote, quotestring;
  1730.     tid = document.URL.split('tid=')[1].split('&')[0];
  1731.     multiData = localStorage.getItem('hfes_multi_'+tid);
  1732.    
  1733.     if(!multiData){
  1734.         return;
  1735.     }
  1736.    
  1737.     multiData = JSON.parse(multiData);
  1738.     multiDataKeys = Object.keys(multiData);
  1739.    
  1740.     if(multiDataKeys.length < 2){
  1741.         return;
  1742.     }
  1743.    
  1744.     for(i=0; i<multiDataKeys.length; i++){
  1745.         tempquote = multiData[multiDataKeys[i]];
  1746.         quotes.push(tempquote);
  1747.     }
  1748.     quotestring = quotes.join('\n');
  1749.     $('textarea').html(quotestring);
  1750.     localStorage.removeItem('hfes_multi_'+tid);
  1751. }
  1752.  
  1753. function threadPreviewForum(){
  1754.     var results = [], i, j;
  1755.     for(i=0; i<$('.author').length; i++){
  1756.         var reshold, url, tid, previewDict = {};
  1757.         reshold = $($($('.author')[i].parentNode.children)[0].children);
  1758.        
  1759.         if(reshold.filter('.subject_old').length > 0){
  1760.             url = reshold.filter('.subject_old')[0].href;
  1761.             tid = url.split("tid=")[1].split("&")[0];
  1762.         }else if(reshold.filter('.subject_new').length > 0){
  1763.             url = reshold.filter('.subject_new')[0].href;
  1764.             tid = url.split("tid=")[1].split("&")[0];
  1765.         }else{
  1766.             url = "";
  1767.             tid = "0";
  1768.         }
  1769.        
  1770.         $($($('.author')[i].parentNode.children)[0]).append("&nbsp;<a href='javascript:void(0);' id='preview_"+tid+"' title='Preview Thread'>+</a>");
  1771.         $('#preview_'+tid).live("click",function(res){previewThreadsForum(res);});
  1772.     }
  1773. }
  1774.  
  1775. function previewThreadsForum(result){
  1776.     var tid, res;
  1777.     tid = result.target.id.split("_")[1];
  1778.     //debugPrint(tid);
  1779.    
  1780.     if($('#preview_'+tid+'_fin').length <= 0){
  1781.         $('#preview_'+tid)[0].innerHTML = "<img src='http://sublyme.net/site_media/images/loading.gif'></img>";
  1782.  
  1783.         GM_xmlhttpRequest({
  1784.             method: "GET",
  1785.             url: 'http://nsfw.hackforums.net/showthread.php?tid='+tid,
  1786.            
  1787.             onload: function(response){
  1788.                 var postData, previd, turkey, chicken;
  1789.                 previd = "preview_"+response.finalUrl.split('tid=')[1];
  1790.                 postData = $($($($(response.responseText).filter("#container")[0].children).filter("#content")[0].children).filter(".quick_keys")[0].children).filter("#posts")[0].children[1].children[0].children[2].children[0];
  1791.                 $("#"+previd)[0].innerHTML = "-";
  1792.                 turkey = $($($($("#"+previd)[0].parentNode)[0].parentNode)[0].parentNode)[0].parentNode;
  1793.                 chicken = turkey.outerHTML+"<td colspan='7' id='"+previd+"_fin' class='trow1'>"+$(postData).html()+"</td>";
  1794.                 turkey.outerHTML = chicken;
  1795.             }
  1796.         });
  1797.     }else{
  1798.         if($('#preview_'+tid)[0].innerHTML == '-'){
  1799.             $('#preview_'+tid+'_fin').fadeOut();
  1800.             $('#preview_'+tid)[0].innerHTML = '+';
  1801.         }else if($('#preview_'+tid)[0].innerHTML == '+'){
  1802.             $('#preview_'+tid+'_fin').fadeIn();
  1803.             $('#preview_'+tid)[0].innerHTML = '-';
  1804.         }else{
  1805.             return;
  1806.         }
  1807.     }
  1808. }
  1809.    
  1810. function addSmileyLink(){
  1811.     $($('#clickable_smilies')[0].children).append('<tr><td style="text-align: center" colspan="3"><a href="javascript:void(0);" id="smileyPop">View All</a></td></tr>');
  1812.     $("#smileyPop").live("click", function(){window.open('/misc.php?action=smilies&hfes=true','Smiley List','width=350,height=350,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0')});
  1813. }
  1814.  
  1815. function addQuickSmileyLink(){
  1816.     $($('#quickreply_e tr .trow1')[0]).append('<br \><a href="javascript:void(0);" id="smileyPop">View Emoticons</a>');
  1817.     $("#smileyPop").live("click", function(){window.open('/misc.php?action=smilies&hfes=true','Smiley List','width=350,height=350,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0')});
  1818.  
  1819. }
  1820.  
  1821. function fixSmileyPage(){
  1822.     var smileyList = [
  1823.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/rofl.gif"></td><td class="trow1">Rofl</td><td class="trow1">:rofl:</td></tr>',
  1824.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/nerd.gif"></td><td class="trow1">Nerd</td><td class="trow1">:nerd:</td></tr>',
  1825.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/heart.gif"></td><td class="trow1">Heart</td><td class="trow1">:heart:</td></tr>',
  1826.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/devil.gif"></td><td class="trow1">Devil</td><td class="trow1">:devil:</td></tr>',
  1827.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/party.gif"></td><td class="trow1">Party</td><td class="trow1">:party:</td></tr>',
  1828.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/kookoo.gif"></td><td class="trow1">KooKoo</td><td class="trow1">:kookoo:</td></tr>',
  1829.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/doh.gif"></td><td class="trow1">D\'oh</td><td class="trow1">:doh:</td></tr>',
  1830.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/yawn.gif"></td><td class="trow1">Yawn</td><td class="trow1">:yawn:</td></tr>',
  1831.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/orly.gif"></td><td class="trow1">Oh Really?</td><td class="trow1">:orly:</td></tr>',
  1832.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/moo.gif"></td><td class="trow1">Cow</td><td class="trow1">:moo:</td></tr>',
  1833.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/chicken.gif"></td><td class="trow1">Chicken</td><td class="trow1">:chicken:</td></tr>',
  1834.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/oink.gif"></td><td class="trow1">Pig</td><td class="trow1">:oink:</td></tr>',
  1835.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/dog.gif"></td><td class="trow1">Dog</td><td class="trow1">:puppy:</td></tr>',
  1836.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/monkey.gif"></td><td class="trow1">Monkey</td><td class="trow1">:monkey:</td></tr>',
  1837.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/buzz.gif"></td><td class="trow1">Bee</td><td class="trow1">:buzz:</td></tr>',
  1838.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/nonono.gif"></td><td class="trow1">No No No!</td><td class="trow1">:nonono:</td></tr>',
  1839.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/pray.gif"></td><td class="trow1">Pray</td><td class="trow1">:pray:</td></tr>',
  1840.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/alien.gif"></td><td class="trow1">Alien</td><td class="trow1">:alien:</td></tr>',
  1841.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/yinyang.gif"></td><td class="trow1">Yin Yang</td><td class="trow1">:yinyang:</td></tr>',
  1842.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/bigmoney.gif"></td><td class="trow1">Big Money</td><td class="trow1">:bigmoney:</td></tr>',
  1843.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/omni.png"></td><td class="trow1">Omni</td><td class="trow1">:omni:</td></tr>',
  1844.     '<tr><td class="trow1" align="center"><img src="http://sublyme.net/site_media/images/smileys/beard.png"></td><td class="trow1">One Sexy Beard</td><td class="trow1">:beard:</td></tr>',
  1845.     '<tr><td class="trow1" align="center"><b>ಠ_ಠ<b></td><td class="trow1">Look of Disapproval</td><td class="trow1">:disapprove:</td></tr>'
  1846.     ].join('');
  1847.    
  1848.     $($('#content .tborder tbody')[0]).append(smileyList);
  1849.     if(document.URL.indexOf('hfes=true') != -1){
  1850.         $('body').html($('#content .tborder')[0]);
  1851.     }
  1852. }
  1853.    
  1854. function postAddSmiley(){
  1855.     var i, posts;
  1856.     var allSmileys = {
  1857.         ":pinch:":"<img src='http://x.hackforums.net/images/smilies/pinch.gif'>",
  1858.         ":victoire:":"<img src='http://x.hackforums.net/images/smilies/victoire.gif'>",
  1859.         ":hehe:":"<img src='http://x.hackforums.net/images/smilies/hehe.gif'>",
  1860.         ":oui:":"<img src='http://x.hackforums.net/images/smilies/oui.gif'>",
  1861.         ":bebe-pleure:":"<img src='http://x.hackforums.net/images/smilies/bebe-pleure.gif'>",
  1862.         ":ohmy:":"<img src='http://x.hackforums.net/images/smilies/ohmy.gif'>",
  1863.         ":blink:":"<img src='http://x.hackforums.net/images/smilies/blink.gif'>",
  1864.         ":superman:":"<img src='http://x.hackforums.net/images/smilies/superman.gif'>",
  1865.         ":nono:":"<img src='http://x.hackforums.net/images/smilies/nono.gif'>",
  1866.         ":biggrin:":"<img src='http://x.hackforums.net/images/smilies/biggrin.gif'>",
  1867.         ":sad:":"<img src='http://x.hackforums.net/images/smilies/sad.gif'>",
  1868.         ":unsure:":"<img src='http://x.hackforums.net/images/smilies/unsure.gif'>",
  1869.         ":glare:":"<img src='http://x.hackforums.net/images/smilieslare.gif'>",
  1870.         ":roflmao:":"<img src='http://x.hackforums.net/images/smilies/roflmao.gif'>",
  1871.         ":devlish:":"<img src='http://x.hackforums.net/images/smilies/devlish.gif'>",
  1872.         ":rolleyes:":"<img src='http://x.hackforums.net/images/smilies/rolleyes.gif'>",
  1873.         ":cool:":"<img src='http://x.hackforums.net/images/smilies/cool.gif'>",
  1874.         ":gratte:":"<img src='http://x.hackforums.net/images/smiliesratte.gif'>",
  1875.         ":confused:":"<img src='http://x.hackforums.net/images/smilies/confused.gif'>",
  1876.         ":blackhat:":"<img src='http://x.hackforums.net/images/smilies/blackhat.gif'>",
  1877.         ":ninja:":"<img src='http://x.hackforums.net/images/smilies/ninja.gif'>",
  1878.         ":blush:":"<img src='http://x.hackforums.net/images/smilies/blush.gif'>",
  1879.         ":lipssealed:":"<img src='http://x.hackforums.net/images/smilies/lipssealed.gif'>",
  1880.         ":yeye:":"<img src='http://x.hackforums.net/images/smilies/yeye.gif'>",
  1881.         ":non:":"<img src='http://x.hackforums.net/images/smilies/non.gif'>",
  1882.         ":smile:":"<img src='http://x.hackforums.net/images/smilies/smile.gif'>",
  1883.         ":whistle:":"<img src='http://x.hackforums.net/images/smilies/whistle.gif'>",
  1884.         ":sleep:":"<img src='http://x.hackforums.net/images/smilies/sleep.gif'>",
  1885.         ":evilgrin:":"<img src='http://x.hackforums.net/images/smilies/evilgrin.gif'>",
  1886.         ":omg:":"<img src='http://x.hackforums.net/images/smilies/omg.gif'>",
  1887.         ":tongue:":"<img src='http://x.hackforums.net/images/smilies/tongue.gif'>",
  1888.         ":mad:":"<img src='http://x.hackforums.net/images/smilies/mad.gif'>",
  1889.         ":huh:":"<img src='http://x.hackforums.net/images/smilies/huh.gif'>",
  1890.         ":thumbsup:":"<img src='http://x.hackforums.net/images/smilies/thumbsup.gif'>",
  1891.         ":wacko:":"<img src='http://x.hackforums.net/images/smilies/wacko.gif'>",
  1892.         ":pirate:":"<img src='http://x.hackforums.net/images/smilies/pirate.gif'>",
  1893.        
  1894.         ":rofl:":"<img src='http://sublyme.net/site_media/images/smileys/rofl.gif'>",
  1895.         ":nerd:":"<img src='http://sublyme.net/site_media/images/smileys/nerd.gif'>",
  1896.         ":heart:":"<img src='http://sublyme.net/site_media/images/smileys/heart.gif'>",
  1897.         ":devil:":"<img src='http://sublyme.net/site_media/images/smileys/devil.gif'>",
  1898.         ":party:":"<img src='http://sublyme.net/site_media/images/smileys/party.gif'>",
  1899.         ":kookoo:":"<img src='http://sublyme.net/site_media/images/smileys/kookoo.gif'>",
  1900.         ":doh:":"<img src='http://sublyme.net/site_media/images/smileys/doh.gif'>",
  1901.         ":yawn:":"<img src='http://sublyme.net/site_media/images/smileys/yawn.gif'>",
  1902.         ":orly:":"<img src='http://sublyme.net/site_media/images/smileys/orly.gif'>",
  1903.         ":nonono:":"<img src='http://sublyme.net/site_media/images/smileys/nonono.gif'>",
  1904.         ":dog:":"<img src='http://sublyme.net/site_media/images/smileys/dog.gif'>",
  1905.         ":puppyeyes:":"<img src='http://sublyme.net/site_media/images/smileys/dog.gif'>",
  1906.         ":puppy:":"<img src='http://sublyme.net/site_media/images/smileys/dog.gif'>",
  1907.         ":oink:":"<img src='http://sublyme.net/site_media/images/smileys/oink.gif'>",
  1908.         ":moo:":"<img src='http://sublyme.net/site_media/images/smileys/moo.gif'>",
  1909.         ":monkey:":"<img src='http://sublyme.net/site_media/images/smileys/monkey.gif'>",
  1910.         ":chicken:":"<img src='http://sublyme.net/site_media/images/smileys/chicken.gif'>",
  1911.         ":yinyang:":"<img src='http://sublyme.net/site_media/images/smileys/yinyang.gif'>",
  1912.         ":buzz:":"<img src='http://sublyme.net/site_media/images/smileys/buzz.gif'>",
  1913.         ":alien:":"<img src='http://sublyme.net/site_media/images/smileys/alien.gif'>",
  1914.         ":pray:":"<img src='http://sublyme.net/site_media/images/smileys/pray.gif'>",
  1915.         ":bigmoney:":"<img src='http://sublyme.net/site_media/images/smileys/bigmoney.gif'>",
  1916.         ":omni:":"<img src='http://sublyme.net/site_media/images/smileys/omni.png'>",
  1917.         ":beard:":"<img src='http://sublyme.net/site_media/images/smileys/beard.png'>",
  1918.         ":disapprove:":"<b>ಠ_ಠ</b>"
  1919.     };
  1920.     posts = $('.post_body');
  1921.     for(i=0; i<posts.length; i++){
  1922.         posts[i].innerHTML = replaceAllMap(posts[i].innerHTML, allSmileys);
  1923.     }
  1924.    
  1925. }
  1926.  
  1927. function warnIfPostModified(){
  1928.     //debugPrint('in warnIfPostModified');
  1929.     hasText = false;
  1930.    
  1931.     $('textarea#message_new').keyup('change', function() {
  1932.         if($('textarea#message_new').val() != ''){
  1933.             hasText = true;
  1934.         }else{
  1935.             hasText = false;
  1936.         }
  1937.         warnUserOnUnload();
  1938.  
  1939.     });
  1940.    
  1941.     $('textarea#message').keyup('change', function() {
  1942.         if($('textarea#message').val() != ''){
  1943.             hasText = true;
  1944.         }else{
  1945.             hasText = false;
  1946.         }
  1947.         warnUserOnUnload();
  1948.     });
  1949.    
  1950.    
  1951.     for(var i = 0; i < $('form input[type="submit"]').length; i++){
  1952.         if($($('form input[type="submit"]')[i]).val().indexOf('Search Thread') == -1){
  1953.             $($('form input[type="submit"]')[i]).live('click', function() {
  1954.                 hasText = false;
  1955.                 warnUserOnUnload();
  1956.             });
  1957.         }
  1958.     }
  1959. }
  1960.  
  1961.  
  1962. function warnUserOnUnload(){
  1963.     if(hasText){
  1964.         window.onbeforeunload = function(event){
  1965.             return "HFES has indicated that you have written out a reply, leaving this page will lose your progress.";
  1966.         };
  1967.     }else{
  1968.         window.onbeforeunload = function(event){
  1969.         };
  1970.     }
  1971. }
  1972.  
  1973. function getBanReasonProfile(){
  1974.     if($('.group7').length > 0){
  1975.         var bannedUserName;
  1976.         bannedUserName = $('.group7').text();
  1977.         //$($('tbody:contains("Forum Info")')[0]).prepend('<table><tr><td class="trow1"><strong>Ban Reason:</strong></td><td class="trow1" id="ban_reason">Loading...</td></tr><tr><td class="trow1"><strong>Unban Date:</strong></td><td class="trow1" id="ban_unban">Loading...</td></tr></table>');
  1978.         $($($($('tbody:contains("Forum Info")')[0].children)[0].children)[2]).prepend('<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tbody><tr><td colspan="2" class="thead"><strong>'+bannedUserName+'\'s Ban Info</strong><span style="font-size:10px; float:right; margin-top:3px;">brought to you by HFES</span></td></tr><tr><td class="trow1"><strong>Ban Reason:</strong></td><td class="trow1" id="ban_reason">Loading...</td></tr><tr><td class="trow1"><strong>Banned By:</strong></td><td class="trow1" id="ban_by">Loading...</td></tr><tr><td class="trow1"><strong>Unban Date:</strong></td><td class="trow1" id="ban_unban">Loading...</td></tr></tbody></table>');
  1979.        
  1980.        
  1981.         uid = document.URL.split('&uid=')[1].split('&')[0];
  1982.         GM_xmlhttpRequest({
  1983.             method: "GET",
  1984.             url: 'http://www.hackforums.net/bans.php',
  1985.            
  1986.             onload: function(response){
  1987.                 var banRow, banReason, banUnbanDate, banBy;
  1988.                 banRow = $($($($(response.responseText).find("a[href*='"+uid+"']"))[0].parentNode)[0].parentNode)[0];
  1989.                 banReason = $($(banRow)[0].children[1]).html();
  1990.                 banUnbanDate = $($(banRow)[0].children[4]).text();
  1991.                 banBy = $($(banRow)[0].children[2]).text();
  1992.                 $('#ban_reason').html(banReason);
  1993.                 $('#ban_unban').text(banUnbanDate);
  1994.                 $('#ban_by').text(banBy);
  1995.             }
  1996.         });
  1997.     }
  1998.    
  1999.     if(GM_config.get("locationhider")){
  2000.         if(document.URL.indexOf("nsfw.") != -1){
  2001.             $.get("http://nsfw.hackforums.net/misc.php", function(){});
  2002.         }else if(document.URL.indexOf("www.") != -1){
  2003.             $.get("http://www.hackforums.net/misc.php", function(){});
  2004.         }else{
  2005.             $.get("http://hackforums.net/misc.php", function(){});
  2006.         }
  2007.        
  2008.     }
  2009. }
  2010.  
  2011. function removeQuoteOnClosedThread(){
  2012.     //return;
  2013.     if($('.float_right a:contains("Closed")').length > 0){
  2014.         $('.post_management_buttons > .bitButton:not(:contains("Report"))').each(function(){
  2015.             $(this).hide();
  2016.         });
  2017.     }
  2018. }
  2019.  
  2020. function removeWelcomeText(){
  2021.     $('#container > .largetext:contains("Welcome")').remove();
  2022. }
  2023.  
  2024. function getTheme(){
  2025.     var themeName = $('link[href*="global.css"]')[0].href.split('themes/')[1].split('/global')[0];
  2026.     if(themeName != "theme5" && themeName != "theme3"){
  2027.         themeName = "theme3";
  2028.     }
  2029.     debugPrint('Theme found and set as '+ themeName);
  2030.     GM_setValue('forumTheme', themeName);
  2031. }
  2032.  
  2033. // ------------------------ Donor Perks ------------------------------------- //
  2034. function addDonorPerksThread(donorList){
  2035.     /* takes donorlist as a map as such
  2036.      * { 'uid':[userbar, somethingelse]}
  2037.      */
  2038.     var uid, i, posts, userlinks, donorKeys;
  2039.     posts = $('.post_author');
  2040.     userlinks = $('.post_author .largetext a');
  2041.     donorKeys = Object.keys(donorList);
  2042.     for(i=0; i<posts.length; i++){
  2043.         var donorStar, donorStarMsg, gilded;
  2044.         uid = userlinks[i].href.split('uid=')[1];        
  2045.        
  2046.         if(donorKeys.indexOf(uid) != -1){
  2047.             if(donorList[uid][0]=='g'){
  2048.                 donorStar = "<span class='HFES_Star'><img src='http://sublyme.net/site_media/hfesdonorstuff/happystar.png' title='"+donorList[uid][2]+"'></img></span>";
  2049.                 if(donorList[uid][1] != ''){
  2050.                     donorStar = "<a href='"+donorList[uid][1]+"'>"+donorStar+"</a>";
  2051.                 }
  2052.                
  2053.                 $(posts[i]).prepend(donorStar);
  2054.             }else if(donorList[uid][0]=='s'){
  2055.                 donorStar = "<span class='HFES_Star'><img src='http://sublyme.net/site_media/hfesdonorstuff/alert.png' title='"+donorList[uid][2]+"'></img></span>";
  2056.                 if(donorList[uid][1] != ''){
  2057.                     donorStar = "<a href='"+donorList[uid][1]+"'>"+donorStar+"</a>";
  2058.                 }
  2059.                 $(posts[i]).prepend(donorStar);
  2060.             }else if(donorList[uid][0]=='d'){
  2061.                 donorStar = "<span class='HFES_Star' style='margin-right:4px'><img src='http://sublyme.net/site_media/hfesdonorstuff/developer.png' title='"+donorList[uid][2]+"'></img></span>";
  2062.                 if(donorList[uid][1] != ''){
  2063.                     donorStar = "<a href='"+donorList[uid][1]+"'>"+donorStar+"</a>";
  2064.                 }
  2065.                 $(posts[i]).prepend(donorStar);
  2066.             }else{
  2067.             }
  2068.             //GM_addStyle('.gilded{background:#FFCC00;}');
  2069.  
  2070.             if(donorList[uid][3] =='gilded' || donorList[uid][3] =='gilded2'){
  2071.                 var topbar;
  2072.                 //$($($($($($($($(posts[i].parentNode)[0].parentNode)[0].parentNode)[0].parentNode)[0].parentNode)[0].parentNode)[0].parentNode)[0]).attr('class','tborder gilded'); // #FFCC00
  2073.                 topbar = $($($($($($($(posts[i].parentNode)[0].parentNode)[0].parentNode)[0].parentNode)[0].parentNode)[0].parentNode)[0].children)[0].children;
  2074.                 $(topbar).attr('class','');
  2075.                 $(topbar).attr('style','background-color:#FFCC00; color:#333'); // FFCC00  EAD902
  2076.                 //$(topbar).attr('style','background-image:url("http://sublyme.net/site_media/images/goldthead.png");background-repeat: repeat; background-position: center;color:#333');
  2077.                 $(topbar).attr('title','[HFES] Gilded Supporter');
  2078.             }
  2079.            
  2080.             if(donorList[uid][4] == 'g'){
  2081.                
  2082.                 $($(posts[i].children).filter("strong")[0].children).attr("style","background-image:url('http://sublyme.net/site_media/images/shinyname.gif')");
  2083.                 $($(posts[i].children).filter("strong")[0].children).attr("title","[HFES] Shiny Supporter");
  2084.             }                
  2085.         }
  2086.     }
  2087. }
  2088.  
  2089. function addDonorPerksProfile(donorList){
  2090.     var uid, i, oldbar, donorKeys, src, title;
  2091.     donorKeys = Object.keys(donorList);
  2092.     uid = document.URL.split('&uid=')[1].split('&')[0];
  2093.     if(donorKeys.indexOf(uid) != -1){
  2094.         var donorStar;
  2095.         if(donorList[uid][0]=='g'){
  2096.             donorStar = "<span class='HFES_Star'><img src='http://sublyme.net/site_media/hfesdonorstuff/happystar.png' title='"+donorList[uid][2]+"'></img></span>";
  2097.             if(donorList[uid][1] != ''){
  2098.                 donorStar = "<a href='"+donorList[uid][1]+"'>"+donorStar+"</a>";
  2099.             }
  2100.             $($('.largetext strong span')[0].parentNode).prepend(donorStar);
  2101.         }else if(donorList[uid][0]=='s'){
  2102.             donorStar = "<span class='HFES_Star'><img src='http://sublyme.net/site_media/hfesdonorstuff/alert.png' title='"+donorList[uid][2]+"'></img></span>";
  2103.             if(donorList[uid][1] != ''){
  2104.                 donorStar = "<a href='"+donorList[uid][1]+"'>"+donorStar+"</a>";
  2105.             }
  2106.             $($('.largetext strong span')[0].parentNode).prepend(donorStar);
  2107.         }else if(donorList[uid][0]=='d'){
  2108.             donorStar = "<span class='HFES_Star' style='margin-right:4px'><img src='http://sublyme.net/site_media/hfesdonorstuff/developer.png' title='"+donorList[uid][2]+"'></img></span>";
  2109.             if(donorList[uid][1] != ''){
  2110.                 donorStar = "<a href='"+donorList[uid][1]+"'>"+donorStar+"</a>";
  2111.             }
  2112.             $($('.largetext strong span')[0].parentNode).prepend(donorStar);
  2113.         }else{
  2114.         }
  2115.         if(donorList[uid][0]=='s'){
  2116.             $($('.tborder')[0]).attr('style','background-color:#FF0000;');
  2117.         }else if(donorList[uid][3] =='gilded' || donorList[uid][3] =='gilded2'){
  2118.             var topbar;
  2119.             $($('.tborder')[0]).attr('style','background-color:#ddc700;');
  2120.             //$($('.tborder')[0]).attr('title','[HFES] Gilded Supporter');
  2121.         }else{}
  2122.        
  2123.         if(donorList[uid][4] == 'g'){
  2124.             if($(".largetext strong span").length == 3){
  2125.                 $($('.largetext strong span')[0]).attr("style","background-image:url('http://sublyme.net/site_media/images/shinyname.gif')");
  2126.                 $($('.largetext strong span')[0]).attr("title","[HFES] Shiny Supporter");
  2127.             }else if($(".largetext strong span").length == 4){
  2128.                 $($('.largetext strong span')[1]).attr("style","background-image:url('http://sublyme.net/site_media/images/shinyname.gif')");
  2129.                 $($('.largetext strong span')[1]).attr("title","[HFES] Shiny Supporter");
  2130.             }
  2131.            
  2132.         }          
  2133.     }
  2134. }
  2135.  
  2136. function getDonorList(){
  2137.     GM_xmlhttpRequest({
  2138.         method: "GET",
  2139.         url: "http://sublyme.net/site_media/HFESdonor.txt"+ "?nc=" + Math.random(),
  2140.         onload: function(response){
  2141.             var reslines, templine, i, j, donorMap = {};
  2142.             reslines = response.responseText.split('\n');
  2143.             for(i=0; i<reslines.length; i++){
  2144.                 templine = reslines[i].split('|');
  2145.                 donorMap[templine[0]] = []
  2146.                 for(j=1; j<templine.length; j++){
  2147.                     donorMap[templine[0]].push(templine[j]);
  2148.                 }
  2149.             }
  2150.             //debugPrint(donorMap);
  2151.             if(document.URL.indexOf('showthread.php?tid') != -1 || document.URL.indexOf('private.php?action=read') != -1 || document.URL.indexOf('showthread.php?pid') != -1){
  2152.                 addDonorPerksThread(donorMap);
  2153.             }else if(document.URL.indexOf('member.php?action=profile') != -1){
  2154.                 addDonorPerksProfile(donorMap);
  2155.             }
  2156.         }
  2157.     });
  2158.            
  2159. }
  2160.  
  2161. function customCSS(){
  2162.     var tid = document.URL.split('tid=')[1].split('&')[0];
  2163.     GM_xmlhttpRequest({
  2164.         method: "GET",
  2165.         url: "http://sublyme.net/site_media/hfcss/"+tid+".css"+ "?nc=" + Math.random(),
  2166.         onload: function(response){
  2167.             GM_addStyle(response.responseText);
  2168.         }
  2169.     });
  2170. }
  2171.  
  2172. // ---------------------------- Important Stuff ----------------------------------- //
  2173.  
  2174. function coreMods(){
  2175.     getTheme();
  2176.     injectCSS();
  2177.     if(GM_config.get('theadstyle') == 'dark'){
  2178.         var darkTheme = [
  2179.             ".tcat {",
  2180.             "background: #955A85 url(http://sublyme.net/site_media/images/darkthead.png) top left repeat-x;",
  2181.             "color : #DDD;",
  2182.             "}"
  2183.         ].join("");
  2184.         GM_addStyle(darkTheme);
  2185.     }else if(GM_config.get('theadstyle') == 'light'){
  2186.         var lightTheme = [
  2187.             ".tcat {",
  2188.             "background: #955A85 url(http://sublyme.net/site_media/images/lightthead.png) top left repeat-x;",
  2189.             "color : #333;",
  2190.             "}"
  2191.         ].join("");
  2192.         GM_addStyle(lightTheme);
  2193.     }else{}
  2194.     if(GM_config.get('prettyQuote')){
  2195.         GM_addStyle(prettyQuotes);
  2196.         GM_addStyle(prettyCite);
  2197.     }
  2198.    
  2199.     GM_SuperValue.set('favList', GM_SuperValue.get('favList', defaultfav));
  2200.    
  2201.     if(GM_config.get("locationhider") && document.URL.indexOf('favorites.php') == -1){
  2202.         if(GM_config.get("locationhider") && document.URL.indexOf('favorites.php') == -1){
  2203.             if(document.URL.indexOf("nsfw.") != -1){
  2204.                 $.get("http://nsfw.hackforums.net/misc.php", function(){});
  2205.             }else if(document.URL.indexOf("www.") != -1){
  2206.                 $.get("http://www.hackforums.net/misc.php", function(){});
  2207.             }else{
  2208.                 $.get("http://hackforums.net/misc.php", function(){});
  2209.             }
  2210.        
  2211.         }
  2212.     }
  2213.     if(GM_config.get("usertagging")){
  2214.         GM_SuperValue.set('usertags', GM_SuperValue.get('usertags', defaultusertags));
  2215.     }
  2216.     emyMessage();
  2217.     emyUpdateMsg();
  2218.    
  2219.     addSpecialLinks();
  2220.     if(GM_config.get("pmDeny")){
  2221.         debugPrint("Loading Uber PM Deny Mod...");
  2222.         uberPMDeny();
  2223.     }
  2224.     if(GM_config.get("groupAlertHide")){
  2225.         debugPrint("Removing group leader alerts...");
  2226.         groupAlertRemover();
  2227.     }
  2228.     if(GM_config.get('forcesfw') != 'none'){
  2229.         debugPrint("Forcing SFW/NSFW...");
  2230.         forceSFW();
  2231.     }
  2232.     if(GM_config.get("threadpreview")){
  2233.         debugPrint("Loading Thread Preview Mod...");
  2234.         threadPreviewForum();
  2235.     }
  2236.     if(GM_config.get('hidetwitter')){
  2237.         debugPrint("Hiding twitter widget...");
  2238.         $('iframe[src*="platform.twitter.com"]').remove();
  2239.     }
  2240.     if(document.URL.indexOf('repsgiven.php') != -1){
  2241.         repsgivenFix();
  2242.     }
  2243.     if(GM_config.get('removeWelcome')){
  2244.         debugPrint("Removing Welcome Text...");
  2245.         removeWelcomeText();
  2246.     }
  2247. }
  2248.  
  2249. function staffPageMods(){
  2250.     if(GM_config.get("staffOnline", true)){
  2251.         debugPrint("Loading Online Staff mod...");
  2252.         onlineStaff();
  2253.     }
  2254. }
  2255.  
  2256. function groupLeaderPageMods(){
  2257.     if(GM_config.get("groupLeaderUserList") != 'none'){
  2258.         debugPrint("Loading Easy Member List mod...");
  2259.         listMembers();
  2260.     }
  2261. }
  2262.  
  2263. function threadPageMods(){
  2264.     getDonorList();
  2265.     postAddSmiley();
  2266.     addQuickSmileyLink();
  2267.     debugPrint("Adding Thread Citer...");
  2268.    
  2269.     document.getElementsByClassName('navigation')[0].innerHTML = document.getElementsByClassName('navigation')[0].innerHTML + '<small><a title="Cite this thread!" href="javascript:void(0);" id="citer">[cite]</a></small>';
  2270.     $("#citer").live("click", function(){ threadCiting(); });
  2271.     if(GM_config.get("userBarSwitch") != "none"){
  2272.         debugPrint("userBarSwitch set to "+GM_config.get('userBarSwitch'));
  2273.         setUserbarInThread();
  2274.     }
  2275.     if(GM_config.get("cleanThreads")){
  2276.         debugPrint("Removing Quote/Edit on closed threads");
  2277.         removeQuoteOnClosedThread();
  2278.     }
  2279.     if(GM_config.get("ratingInfo")){
  2280.         debugPrint("Loading Detailed Rating Mod...");
  2281.         displayThreadRatingT();
  2282.     }
  2283.     if(GM_config.get("usertagging")){
  2284.         debugPrint("Loading User Tagging in Thread Mod...");
  2285.         threadTagger();
  2286.     }
  2287.     if(GM_config.get("pmfrompost")){
  2288.         debugPrint("Loading PM from Post mod...");
  2289.         addPostPM();
  2290.     }
  2291.     if(GM_config.get("multiquote")){
  2292.         addMultiQuoteButtons();
  2293.     }
  2294.     if(GM_config.get("warnUnload")){
  2295.         debugPrint("Loading Warn Unload Mod...");
  2296.         warnIfPostModified();
  2297.     }
  2298. }
  2299.  
  2300. function replyMods(){
  2301.     if(GM_config.get("multiquote")){
  2302.         addMultiToReply();
  2303.     }
  2304.     if(GM_config.get("warnUnload")){
  2305.         debugPrint("Loading Warn Unload Mod...");
  2306.         warnIfPostModified();
  2307.     }
  2308.     addSmileyLink();
  2309. }
  2310.  
  2311. function newThreadMods(){
  2312.     addSmileyLink();
  2313. }
  2314.  
  2315. function pmMods(){
  2316.     getDonorList();
  2317.     postAddSmiley();
  2318.     if(GM_config.get("quickPM")){
  2319.         debugPrint("Loading Quick Message mod...");
  2320.         addQuickMsg();
  2321.     }
  2322.     if(GM_config.get("userBarSwitch") != "none"){
  2323.         debugPrint("userBarSwitch set to "+GM_config.get('userBarSwitch'));
  2324.         setUserbarInThread();
  2325.     }
  2326.     if(GM_config.get("prettyPM")){
  2327.         debugPrint("Loading Pretty PM mod...");
  2328.         prettyPM();
  2329.     }
  2330.     if(GM_config.get("usertagging")){
  2331.         debugPrint("Loading User Tagging in PM Mod...");
  2332.         threadTagger();
  2333.     }
  2334.     if(GM_config.get("warnUnload")){
  2335.         debugPrint("Loading Warn Unload Mod...");
  2336.         warnIfPostModified();
  2337.     }
  2338. }
  2339.  
  2340. function sendPMMods(){
  2341.     if(GM_config.get("warnUnload")){
  2342.         debugPrint("Loading Warn Unload Mod...");
  2343.         warnIfPostModified();
  2344.     }
  2345.     addSmileyLink();
  2346. }
  2347.  
  2348. function trackingMods(){
  2349.     if(GM_config.get("trackingLink")){
  2350.         debugPrint("Loading Links for PM Tracking Page...");
  2351.         addMsgTracking();
  2352.     }
  2353. }
  2354.  
  2355. function profileMods(){
  2356.     getDonorList();
  2357.     if(GM_config.get("usertagging")){
  2358.         profileTagger();
  2359.     }
  2360.     if(GM_config.get("profileCiting")){
  2361.         $($('.largetext strong span')[0].parentNode).append('&nbsp<span class="HFES_Citer" style="font-size:x-small"><a title="Cite this user!" href="javascript:void();" id="profilegenerator">[cite]</a></span>');
  2362.         $("#profilegenerator").live("click", function(){ getProfileName(); });
  2363.     }
  2364.     if(GM_config.get("banReason")){
  2365.         getBanReasonProfile();
  2366.     }
  2367. }
  2368.  
  2369. function searchMods(){
  2370.     if(GM_config.get("lastLink")){
  2371.         debugPrint("Loading Last Link mod...");
  2372.         addLastLinks();
  2373.     }
  2374. }
  2375.  
  2376. function fMods(){
  2377.     document.getElementsByClassName('navigation')[0].innerHTML = document.getElementsByClassName('navigation')[0].innerHTML + '<small><a title="Cite this forum!" href="javascript:void(0);" id="fciter">[cite]</a></small>';
  2378.     $("#fciter").live("click", function(){ forumCiting(); });
  2379.    
  2380.     linkAddFavorite();
  2381.    
  2382.     if(GM_config.get("ratingInfo")){
  2383.         debugPrint("Loading Rating Info mod...");
  2384.         displayThreadRating();
  2385.     }
  2386. }
  2387.  
  2388. function smilePageMods(){
  2389.     fixSmileyPage();
  2390. }
  2391.  
  2392. function helpMods(){
  2393.     document.getElementsByClassName('navigation')[0].innerHTML = document.getElementsByClassName('navigation')[0].innerHTML + '<small><a title="Cite this forum!" href="javascript:void(0);" id="fciter">[cite]</a></small>';
  2394.     $("#fciter").live("click", function(){ forumCiting(); });
  2395. }
  2396.  
  2397. function main(){
  2398.     debugPrint("Loading core mods...");
  2399.     coreMods();
  2400.     addToMenu();
  2401.     if(document.URL.indexOf("misc.php?action=smilies") != -1){
  2402.         smilePageMods();
  2403.     }
  2404.     if(document.URL.indexOf("showstaff.php") != -1 || document.URL.indexOf("showmods.php") != -1){
  2405.         debugPrint("Loading staff page mods...");
  2406.         staffPageMods();
  2407.     }
  2408.     if(document.URL.indexOf("showthread.php") != -1){
  2409.         debugPrint("Loading thread page mods...");
  2410.         threadPageMods();
  2411.     }
  2412.     if(document.URL.indexOf("private.php?action=read") != -1){
  2413.         debugPrint("Loading Private Message mods...");
  2414.         pmMods();
  2415.     }
  2416.     if(document.URL.indexOf("private.php?action=send") != -1){
  2417.         sendPMMods();
  2418.     }
  2419.     if(document.URL.indexOf("forumdisplay.php") != -1){
  2420.         debugPrint("Loading Forum mods...");
  2421.         fMods();
  2422.     }
  2423.     if(document.URL.indexOf("private.php?action=tracking") != -1){
  2424.         trackingMods();
  2425.     }
  2426.     if(document.URL.indexOf("search.php?action=results") != -1){
  2427.         searchMods();
  2428.     }
  2429.     if(document.URL.indexOf("hfgrouptest") != -1 || document.URL.indexOf("managegroup.php") != -1){
  2430.         groupLeaderPageMods();
  2431.     }
  2432.     if(document.URL.indexOf("member.php?action=profile") != -1){
  2433.         profileMods();
  2434.     }
  2435.     if(document.URL.indexOf("newreply.php?tid=") != -1){
  2436.         replyMods();
  2437.     }
  2438.     if(document.URL.indexOf("newthread.php?fid=") != -1){
  2439.         newThreadMods();
  2440.     }
  2441.     if(document.URL.indexOf("misc.php?action=help") != -1){
  2442.         helpMods();
  2443.     }
  2444.     if(document.URL.indexOf("nsfw.") != -1){
  2445.         document.title = document.title.replace('Hack Forums','HF');
  2446.     }
  2447. }
  2448.  
  2449. var start = function() {
  2450.     $(function() {
  2451.         main();
  2452.     });
  2453. };
  2454.  
  2455. if (document.URL.indexOf("favorites.php") !== -1) {
  2456.     // Try to make the favorites page start to load as quickly as possible.
  2457.     // We also want to control when start() runs on the favorites page.
  2458.     initializeFavorites();
  2459. } else {
  2460.     start();
  2461. }
  2462. [/code]
  2463. HFES
  2464. [code]// ==UserScript==
  2465. // @name            HackForums Reputations Link Clickable
  2466. // @namespace       xerotic/clickreplink
  2467. // @description     Makes links surrounded by either whitespace or dots (periods) clickable.
  2468. // @include         *hackforums.net/reputation.php*
  2469. // @include         http://www.hackforums.net/reputation.php*
  2470. // @version         1.0
  2471. // ==/UserScript==
  2472.  
  2473.  
  2474. document.getElementById('content').innerHTML=document.getElementById('content').innerHTML.replace(/\shttp\:\/\/(.*?)\s/g, " <a href='http://$1'>http://$1</a> ");
  2475. document.getElementById('content').innerHTML=document.getElementById('content').innerHTML.replace(/\.http\:\/\/(.*?)\s/g, ".<a href='http://$1'>http://$1</a> ");
  2476. document.getElementById('content').innerHTML=document.getElementById('content').innerHTML.replace(/\shttp\:\/\/(.*?)\./g, " <a href='http://$1'>http://$1</a>.");
  2477. document.getElementById('content').innerHTML=document.getElementById('content').innerHTML.replace(/\.http\:\/\/(.*?)\./g, ".<a href='http://$1'>http://$1</a>.");
  2478. [/code]
  2479. Clickable Links In Rep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement