GHQEditor

GHQ Site Editor for Chrome and Firefox

  1. // ==UserScript==
  2. // @name GHQEditor
  3. // @namespace GHQEditor
  4. // @author Jabroni1134
  5. // @description GHQ Site Editor for Chrome and Firefox
  6. // @include http://*.ghqnet.com/*
  7. // @match http://*.ghqnet.com/*
  8. // @version 2.22
  9. // @grant GM_addStyle
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // @grant GM_listValues
  13. // @grant GM_xmlhttpRequest
  14. // ==/UserScript==
  15.  
  16. var scriptVersion=2.22;
  17. var ChangeLog = scriptVersion+" Change Log: *Updated 'BotList' to include the new 'Cash' Column.";
  18. /*
  19. ----------------------
  20. Disclaimer
  21. ----------------------
  22. Certain parts of this script are taken from other similar projects, all rights
  23. on those sections are owned by their respective creators.
  24. This program is free software: you can redistribute it and/or modify
  25. it under the terms of the GNU General Public License as published by
  26. the Free Software Foundation, either version 3 of the License, or
  27. (at your option) any later version.
  28. This program is distributed in the hope that it will be useful,
  29. but WITHOUT ANY WARRANTY; without even the implied warranty of
  30. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. GNU General Public License for more details.
  32. For a full copy of the GNU General Public License, see
  33. http://www.gnu.org/licenses/.
  34. */
  35. var DEBUGNEWCODE = 0;
  36.  
  37. var scriptName='GHQEditor';
  38. var scriptId='74664';
  39.  
  40.  
  41. var path = window.location.toString(); // get the URL of the current page
  42. var page = path.substring(0, path.indexOf('.asp')); // extract page name from URL
  43. page = page.substring(page.lastIndexOf('/')+1); // extract page name from URL
  44.  
  45. var browser = 'Firefox';
  46. var isChrome = !!window.chrome && !!window.chrome.webstore;
  47. if (isChrome) {
  48. browser = 'Chrome';
  49. }
  50.  
  51.  
  52. if(!GM_getValue('UNIQUEKEY',false)){
  53. var rand = Math.floor(Math.random()*10000000000000);
  54. GM_setValue('UNIQUEKEY',rand.toString());
  55. }
  56. var UNIQUEKEY = GM_getValue('UNIQUEKEY', false);
  57.  
  58. //==========================================
  59. //Debug Setup
  60. //==========================================
  61. var DEBUG_KEY = "config_debug";
  62. var LOG_LEVEL_KEY = "config_logLevel";
  63.  
  64. var LOG_LEVEL_DEBUG = 1;
  65. var LOG_LEVEL_INFO = 2;
  66. var LOG_LEVEL_WARN = 3;
  67. var LOG_LEVEL_ERROR = 4;
  68.  
  69. var location = window.location.href;
  70. var LOG_LEVEL = getSetting(LOG_LEVEL_KEY,0);
  71.  
  72. if(!getSetting(DEBUG_KEY,false)) LOG_LEVEL = 0;
  73.  
  74. try{
  75. var console = {
  76. log: function () // Basic logging function for loading etc
  77. {
  78. if( LOG_LEVEL >= 1 ) { notify( "\nError: "+arguments[0] ,MESSAGE_CLASS_ERROR); return; }
  79. },
  80. info: function () // Show data relevent to any functions being worked on
  81. {
  82. if( LOG_LEVEL >= 2 ) { notify( "Location: "+location+" \nError: "+arguments[0] ,MESSAGE_CLASS_ERROR); return; }
  83. },
  84. warn: function () // Show any non-fatal errors
  85. {
  86. if( LOG_LEVEL >= 3 ) { notify( "Location: "+location+" \nError: "+arguments[0] ,MESSAGE_CLASS_ERROR); return; }
  87. },
  88. error: function () // If error is breaking entire script
  89. {
  90. if( LOG_LEVEL == 4 ) { notify( "Location: "+location+" \nError: "+arguments[0] ,MESSAGE_CLASS_ERROR); return; }
  91. }
  92. };
  93.  
  94. } catch (e) {notify("Console exception: "+e,MESSAGE_CLASS_ERROR);}
  95.  
  96. if(document.title.indexOf("Error")!= -1) return; // try to break out if connections down to avoid messing up error page
  97.  
  98. //==========================================
  99. //Get/Set Functions
  100. //Prefixes server name to settings
  101. //==========================================
  102. function getSetting(key,value){
  103. try
  104. {
  105. if (typeof value == "float") value+="";
  106. return GM_getValue(getClan()+"_"+key,value);
  107. } catch (e) { console.warn ("Line Number: "+e.lineNumber+"\n getSetting error: "+e); console.info("\nKey: "+key+"\nValue: "+value); }
  108. }
  109.  
  110. function setSetting(key,value){
  111. try
  112. {
  113. if (typeof value == "float") value+="";
  114. return GM_setValue(getClan()+"_"+key,value);
  115. } catch (e) { console.log ("Line Number: "+e.lineNumber+"\n setSetting error: "+e); console.log("\nKey: "+key+"\nValue: "+value); }
  116. }
  117.  
  118. // Simple replacement of getelementbyid with $ to save typing
  119. function $(variable){
  120. if(!variable) return;
  121. if (document.getElementById(variable)) return document.getElementById(variable);
  122. }
  123. function $n(variable){
  124. if(!variable) return;
  125. if (document.getElementsByName(variable)) return document.getElementsByName(variable);
  126. }
  127. //==========================================
  128. //-----------Preset Definitions-------------
  129. //==========================================
  130. //NOTE: These are simpy defaults. There's no need to edit these here in the script.
  131. var MESSAGE_CLASS = "notifier";
  132. var MESSAGE_CLASS_ERROR = "notifierError";
  133.  
  134. GM_addStyle(+
  135. '.notifier {background-color: Black;border: solid 2px;color: red;padding: 20px 20px 20px 20px;}}'+
  136. '.notifierError {background-color: Black;border: solid 2px;color: red;padding: 10px 10px 10px 10px;}}'+
  137. 'hr.cphr {color: orange; width: 400px;}'+
  138. '.cpscripttimes {text-align: center;margin:0 auto;width:200px;background-color: #191919;border: #333333 solid 1px;padding-bottom: 10px;color: white;margin-top: 10px;font-size: 8px;opacity: 0.82; z-index: 0;}'+
  139. '#gm_update_alert {position: relative;top: 0px;left: 0px;margin:0 auto;width:'+getTableWidth()+'px;background-color: #191919;text-align: center;font-size: 11px;font-family: Tahoma;border: #333333 solid 1px;margin-bottom: 10px;padding-left: 0px;padding-right: 0px;padding-top: 10px;padding-bottom: 10px;opacity: 0.82;color: white;}'+
  140. '.gm_update_alert_buttons {'+
  141. ' position: relative;'+
  142. ' top: -5px;'+
  143. ' margin: 5px;'+
  144. '}'+
  145. '#gm_update_alert_button_close {'+
  146. ' position: absolute;'+
  147. ' right: 20px;'+
  148. ' top: 20px;'+
  149. ' padding: 3px 5px 3px 5px;'+
  150. ' border-style: outset;'+
  151. ' border-width: thin;'+
  152. ' z-index: 11;'+
  153. ' background-color: orange;'+
  154. ' color: #FFFFFF;'+
  155. ' cursor:pointer;'+
  156. '}'+
  157. '.gm_update_alert_buttons span, .gm_update_alert_buttons span a {'+
  158. ' text-decoration:underline;'+
  159. ' color: #003399;'+
  160. ' font-weight: bold;'+
  161. ' cursor:pointer;'+
  162. '}'+
  163. '.gm_update_alert_buttons span a:hover {'+
  164. ' text-decoration:underline;'+
  165. ' color: #990033;'+
  166. ' font-weight: bold;'+
  167. ' cursor:pointer;'+
  168. '}'+
  169. '#gm_update_title {'+
  170. ' font-weight:bold;'+
  171. ' color:orange;'+
  172. '}'+
  173. '.right_Menu {'+
  174. ' color: gold;'+
  175. ' font-weight: bold;'+
  176. ' font-size: 11px;'+
  177. ' cursor:pointer;'+
  178. '}'+
  179. '.right_MenuHeader {'+
  180. ' color: gold;'+
  181. ' font-weight: bold;'+
  182. ' font-size: 11px;'+
  183. '}'+
  184. '.left_Menu {'+
  185. ' color: #DDDDDD;'+
  186. ' font-size: 12px;'+
  187. ' font-weight: bold;'+
  188. '}');
  189.  
  190. var totalStart = new Date();
  191. var startTime = totalStart;
  192. var endTime;
  193. var timerMessage = "";
  194.  
  195. //==========================================
  196. //Returns the clan abbr
  197. //==========================================
  198.  
  199. var _clan = null;
  200. function getClan(){
  201. //console.log("retreiving clan. Clan: "+_clan);
  202. if(_clan == null)
  203. {
  204. //console.log("setting clan. Location: "+window.location);
  205. var regex = /http:\/\/([a-z]+)\.ghqnet\.com/;
  206. var result = regex.exec(document.referrer);
  207. //console.log("Result: "+result);
  208. if(result == null)
  209. {
  210. //console.log(document.referrer);
  211. regex = /http:\/\/([a-z]+)\.ghqnet\.com/;
  212. result = regex.exec(document.URL);
  213. }
  214. if (result != null)
  215. {
  216. _clan = result[1];
  217. }
  218. // else console.log ("Referrer error");
  219. }
  220. //console.log("Clan: "+_clan);
  221. return _clan;
  222. }
  223.  
  224. //==========================================
  225. //---------Display Functions----------------
  226. //==========================================
  227.  
  228. function zeroPad(num){
  229. if(num <= 9){
  230. return "0" + num;
  231. }
  232. return num;
  233. }
  234.  
  235. function getTableWidth(){
  236. var tables = document.evaluate(
  237. "//table[@class='top']",
  238. document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
  239. //console.log('Found '+ tables.snapshotLength + ' tables.');
  240. if(tables.snapshotLength==0) return 900;
  241. var topTable = tables.snapshotItem(0);
  242. return topTable.getAttribute("width");
  243. }
  244.  
  245. function URLDecode (encodedString) {
  246. var output = encodedString;
  247. var binVal, thisString;
  248. var myregexp = /(%[^%]{2})/;
  249. while ((match = myregexp.exec(output)) != null
  250. && match.length > 1
  251. && match[1] != '') {
  252. binVal = parseInt(match[1].substr(1),16);
  253. thisString = String.fromCharCode(binVal);
  254. output = output.replace(match[1], thisString);
  255. }
  256. return output;
  257. }
  258.  
  259. //Notifier Utility Code
  260. //http://javascript.nwbox.com/asyncAlert/
  261. //-----------------------------------
  262. var notifycount = 1;
  263. function notify(m,c){
  264. if($('Message'))
  265. {
  266. document.body.removeChild($('Message'));
  267. }
  268. // create a block element
  269. var b=document.createElement('div');
  270. b.id='Message';
  271. b.className=c||'';
  272. b.style.cssText='position:absolute;white-space:nowrap;z-index:10;';
  273. // classname not passed, set default classname
  274. if(b.className.length==0){
  275. b.className = MESSAGE_CLASS;
  276. }
  277. // insert block in to body
  278. b=document.body.insertBefore(b,document.body.firstChild);
  279. // write HTML fragment to it
  280. b.innerHTML=m;
  281. // save width/height before hiding
  282. var bw=b.offsetWidth;
  283. var bh=b.offsetHeight;
  284. // hide, move and then show
  285. b.style.display='none';
  286. b.style.top = (document.body.clientHeight/2 + window.pageYOffset - bh/2)+"px";
  287. b.style.left = (document.body.clientWidth/2 + window.pageXOffset - bw/2)+"px";
  288.  
  289. //console.log( b.style.top);
  290. //console.log("window height: "+document.body.clientHeight);
  291. //console.log("window width: "+document.body.clientWidth);
  292. //console.log("window scroll x: "+window.pageXOffset);
  293. //console.log("window scroll y: "+window.pageYOffset);
  294.  
  295. b.style.display='block';
  296. var duration = 4000;
  297. var endOpacity = 0;
  298. if(c==MESSAGE_CLASS_ERROR)
  299. {
  300. b.className = "notifierError";
  301. b.id='errorMessage';
  302. var pos = notifycount * 40;
  303. b.style.top = (document.body.clientHeight/2 + window.pageYOffset - bh/2) - (400 - pos);
  304. duration = 4000;
  305. if(DEBUGNEWCODE) duration = 8000;
  306. endOpacity = 50;
  307. }
  308.  
  309. notifycount++;
  310. // fadeout block if supported
  311. setFading(b,100,endOpacity,duration,function(){document.body.removeChild(b);});
  312. }
  313.  
  314. // apply a fading effect to an object
  315. // by applying changes to its style
  316. // @o = object style
  317. // @b = begin opacity
  318. // @e = end opacity
  319. // @d = duration (millisec)
  320. // @f = function (optional)
  321. function setFading(o,b,e,d,f){
  322. var t=setInterval(
  323. function(){
  324. b=stepFX(b,e,2);
  325. setOpacity(o,b/100);
  326. if(b==e){
  327. if(t){clearInterval(t);t=null;}
  328. if(typeof f=='function'){f();}
  329. }
  330. },d/20
  331. );
  332. }
  333. // set opacity for element
  334. // @e element
  335. // @o opacity
  336. function setOpacity(e,o){
  337. // for IE
  338. e.style.filter='alpha(opacity='+o*100+')';
  339. // for others
  340. e.style.opacity=o;
  341. }
  342.  
  343. // increment/decrement value in steps
  344. // checking for begin and end limits
  345. //@b begin
  346. //@e end
  347. //@s step
  348. function stepFX(b,e,s){
  349. return b>e?b-s>e?b-s:e:b<e?b+s<e?b+s:e:b;
  350. }
  351.  
  352. function insertNotification(message){
  353. if (message != null)
  354. {
  355. var notification = document.createElement("div");
  356. notification.setAttribute('id', 'gm_update_alert');
  357. var close = document.createElement("div");
  358. close.setAttribute('id', 'gm_update_alert_button_close');
  359. close.innerHTML = "Click to hide";
  360. close.addEventListener('click', function(event) {
  361. document.body.removeChild($('gm_update_alert'));
  362. document.body.removeChild($('gm_update_alert_button_close'));
  363. }, true);
  364. notification.innerHTML = ''
  365. +' <div id="gm_update_title">GHQEditor Notification</div>'
  366. +' <hr class="cphr" /><p>' + message
  367. +'</p>';
  368. notification.appendChild(close);
  369. document.body.insertBefore(notification, document.body.firstChild);
  370. }
  371. }
  372.  
  373. function cleanBoards(){
  374. var thisTime = new Date().getTime();
  375. var clean = thisTime - 60*60*24;
  376. if(getSetting( 'LastCleaned', '0' ) < clean){
  377. var keys = GM_listValues();
  378. //var curTime = new Date().getTime();
  379. var youngestTime = curTime - 60*60*24*8*1000;
  380. for(var i=0; i<keys.length; ++i){
  381. if(keys[i].substr(0,6) == 'Posts_'){
  382. var Posts = getSetting( keys[i], ':' );
  383. var postarr = Posts.split(':');
  384. for(var x=0; x<postarr.length; ++x){
  385. if(postarr[x] == ''){ continue; }
  386. var lastReadTime = postarr[x].split('-')[1];
  387. if(youngestTime >= lastReadTime){
  388. postarr.splice(x, 1);
  389. x--;
  390. }
  391. }
  392. Posts = postarr.join(':');
  393. setSetting( keys[i], Posts );
  394. }
  395. }
  396. setSetting( 'LastCleaned', thisTime.toString() );
  397. }
  398. }
  399.  
  400.  
  401.  
  402.  
  403. //-----------------------------------
  404. //Auto Launch count down script
  405. //-----------------------------------
  406.  
  407. function timeToCounter(milliseconds){
  408. milliseconds = milliseconds/1000;
  409. var h = Math.floor(milliseconds/3600);
  410. var m = Math.floor((milliseconds % 3600)/60);
  411. var s = Math.floor((milliseconds % 3600) % 60);
  412. var counterString = "";
  413. if(h > 0)
  414. counterString += h+"h ";
  415. if(m > 0)
  416. counterString += m+"m ";
  417. if(s > 0)
  418. counterString += s+"s";
  419. return counterString;
  420. }
  421.  
  422. //-----------------------------------
  423. //End Auto Launch count down script
  424. //-----------------------------------
  425. //==========================================
  426. // Check if new install
  427. //==========================================
  428. function installCheck(){
  429. try{
  430. var OldVersion = parseFloat(GM_getValue("scriptVersion",0+""));
  431. var NewVersion = parseFloat(scriptVersion);
  432. var LastMessage = GM_getValue("scriptLastMessage",'');
  433. var LatestVersion = 0.0;
  434. var lastCheck = parseInt(GM_getValue("updateCheckTime",0+""));
  435. var currTime = (new Date).getTime();
  436. //console.log("LastChecked: " + lastCheck);
  437. //console.log("Current Time: " + currTime);
  438. //console.log("Difference: " + (currTime - lastCheck));
  439. //console.log(scriptVersion);
  440. var Clan_Clan = getClan();
  441. if (OldVersion==null || OldVersion==""){
  442. GM_setValue("scriptVersion",NewVersion+"");
  443. insertNotification("You have sucessfully installed "+scriptName+" Version: "+NewVersion+" to your web browser.<br /><br/>"+ChangeLog);
  444. return;
  445. } else if (NewVersion>OldVersion){
  446. GM_setValue("scriptVersion",NewVersion+"");
  447. insertNotification("You have sucessfully upgraded "+scriptName+" From ("+OldVersion+") To ("+NewVersion+").<br/><br/>"+ChangeLog);
  448. }
  449. delete OldVersion;
  450. delete NewVersion;
  451. delete LatestVersion;
  452. delete lastCheck;
  453. delete currTime;
  454. } catch (e) { console.log ("Line Number: "+e.lineNumber+"\ninstallCheck(): "+e); }
  455. }
  456.  
  457. //==========================================
  458. //Config Page
  459. //==========================================
  460.  
  461. var ANIMATE_SERVER_TIME_KEY = "config_animateServerTime";
  462. var GAME_TIME_SHOW_KEY = "config_gameTime";
  463. var LOCAL_TIME_SHOW_KEY = "config_localTime";
  464. var HOUR24_KEY = "config_24Hour";
  465. var POST_AREA_KEY = "config_postArea";
  466. var LEFT_MENU_KEY = "config_leftMenu";
  467. var NEW_POSTS_KEY = "config_newPosts";
  468. var TARGET_SELECTOR_KEY = "config_targetSelector";
  469. var BOT_LIST_KEY = "config_botlist";
  470. var EDIT_USER_KEY = "config_editUser";
  471. var SITE_MANAGER_KEY = "config_siteManager";
  472. var GHQEDITOR_HEADER = "config_ghqeditorHeader";
  473.  
  474. function configBody(){
  475. var url = location;
  476. GM_addStyle('.configHeading {'
  477. +' color: gold;'
  478. +' font-weight: bold;'
  479. +'}'
  480. +'.featureName {'
  481. +' color: #EEDC82;'
  482. +'}'
  483. +'.subFeatureName {'
  484. +' color: #8B814C;'
  485. +' padding-left:20'
  486. +'}'
  487. +'.footnote {'
  488. +' color: gold;'
  489. +' font-weight: bold;'
  490. +'}');
  491. var width = getTableWidth();
  492. if (width<900) width = 900;
  493. var newbody = "<div align='center'>"+
  494. "<h2>GHQEditor - Settings</h2>"+
  495. "<small>Script Version: "+scriptVersion+"<span id='pageDate'></span></small> <br/>"+
  496. "<table width='"+width+"'>"+
  497. "<tr bgcolor='#222222'><th width='230' colspan='2'>Feature</th><th>Description</th></tr>";
  498.  
  499. newbody = newbody +"<tr bgcolor='#222222'><td colspan='3' class='configHeading'>General</td></tr>"+
  500.  
  501. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_ghqeditorHeader' /> Move GHQEditor Header</td>"+
  502. "<td style='padding-left:20'>Displays the \"GHQEditor Settings\" and \"GHQEditor Website\" at the bottom of every page instead of in the Header.</td></tr>";
  503.  
  504. newbody = newbody +"<tr bgcolor='#222222'><td colspan='3' class='configHeading'>Times</td></tr>"+
  505.  
  506. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_24Hour' /> 24 Hour Format</td>"+
  507. "<td style='padding-left:20'>Displays clocks in a 24 Hour format instead of AM/PM.</td></tr>"+
  508.  
  509. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_animateServerTime' /> Animate Times</td>"+
  510. "<td style='padding-left:20'>Display constantly updated server time.</td></tr>"+
  511.  
  512. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_gameTime' /> Game Time</td>"+
  513. "<td style='padding-left:20'>Shows additional timer to show EarthEmpires GameTime.</td></tr>"+
  514.  
  515. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_localTime' /> Local Time</td>"+
  516. "<td style='padding-left:20'>Shows additional timer to show your current local time.</td></tr>";
  517.  
  518. newbody = newbody +"<tr bgcolor='#222222'><td colspan='3' class='configHeading'>Page Changes</td></tr>"+
  519.  
  520. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_newPosts' /> Show New Posts</td>"+
  521. "<td style='padding-left:20'>Tracks all New Posts on boards and posts a \"New Post\" Image next to topics with new posts.<br>*All posts older then a week will not be shown as \"New\"</td></tr>"+
  522.  
  523. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_leftMenu' /> Left Menu</td>"+
  524. "<td style='padding-left:20'>Allows user you decide what links to show and what not to.</td></tr>"+
  525.  
  526. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_postArea' /> PostArea</td>"+
  527. "<td style='padding-left:20'>Augments the PostArea of Boards to include extra information like HTML quicklinks.</td></tr>"+
  528.  
  529. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_editUser' /> Edit Users</td>"+
  530. "<td style='padding-left:20'>Adds groups and other usefull information to the page.</td></tr>"+
  531.  
  532. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_siteManager' /> Site Manager</td>"+
  533. "<td style='padding-left:20'>Adds an easier way to edit the header of a site.</td></tr>";
  534.  
  535.  
  536. newbody = newbody +"<tr bgcolor='#222222'><td colspan='5' class='configHeading'>Earth Empire GHQ Sites (Only for EarthEmpire Sites)</td></tr>"+
  537.  
  538. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_targetSelector' /> Target Selector</td>"+
  539. "<td style='padding-left:20'>Adds extra options and coloring to the Target Selector page.</td></tr>"+
  540.  
  541. "<tr bgcolor='#222222'><td class='featureName' colspan='2'><input type='checkbox' id='config_botlist' /> Bot List</td>"+
  542. "<td style='padding-left:20'>Adds extra options and coloring to the Bot Selector/Land Grabs page.</td></tr>";
  543.  
  544. newbody = newbody +"<tr bgcolor='#222222'><td colspan='3' align='center'><input id='saveButton' type=submit name='Save' value='Save' /> - <input id='resetButton' type=submit name='Reset to defaults' value='Reset to defaults' /></td></tr></table>"+
  545. "<a id='backLink' href='"+url+"'>Return to GHQ</a><br><br>"+
  546.  
  547.  
  548. "<table width='"+width+"'>";
  549.  
  550. newbody = newbody +"<tr bgcolor='#222222'><td colspan='2' class='configHeading'>Board Monitoring<br>GHQEditor will not check for new posts on these boards<br>NOTE: This change will not take affect until GHQ is competely reloaded.</td></tr>"+
  551. "<tr bgcolor='#222222'><th>Do NOT Monitor Board</th><th>Description</th></tr>";
  552.  
  553. var links = getSetting( 'menuBoards', '' );
  554. var linksarr = links.split('::::::');
  555. var boardsignore = getSetting( 'boards_ignore', ' ' );
  556.  
  557. if(linksarr.length != 0){
  558. for(var i=0; i<linksarr.length; ++i){
  559. if(boardsignore.indexOf('::::::'+linksarr[i]+'::::::') != -1){
  560. checked = 'checked';
  561. }else{
  562. checked = '';
  563. }
  564. newbody = newbody +"<tr bgcolor='#222222'><td class='featureName'><input type='checkbox' Name='config_ignoreBoard' value='"+linksarr[i]+"' "+checked+"/> "+linksarr[i]+"</td>"+
  565. "<td style='padding-left:20'>Ignore Board when searching for new Posts?</td></tr>";
  566. }
  567. }
  568.  
  569. newbody = newbody +"<tr bgcolor='#222222'><td colspan='2' align='center'><input id='saveButton2' type=submit name='Save' value='Save' /> - <input id='resetButton' type=submit name='Reset to defaults' value='Reset to defaults' /></td></tr>";
  570. newbody = newbody +"</table>"+
  571. "<small>GHQEditor created by Jabroni1134. Portions of the script are from Vigs AE Script (Config Page, Popups, Alerts)</small><br /><br />"+
  572.  
  573. "<br /><br /><a id='backLink' href='"+url+"'>Return to GHQ</a>"+
  574. "</div>";
  575. return newbody;
  576. }
  577. function showConfig(){
  578. document.body.innerHTML = "<html><body background='' bgcolor='black' link='#00C0FF' text='#DDDDDD' vlink='#d3d3d3'>";
  579. document.body.appendChild(Title);
  580. document.body.innerHTML = document.body.innerHTML+configBody()+"</body></html>";
  581. loadConfig();
  582. $('saveButton').addEventListener('click', function(event) {
  583. saveConfig();
  584. }
  585. , true);
  586. $('saveButton2').addEventListener('click', function(event) {
  587. saveConfig();
  588. }
  589. , true);
  590. $('resetButton').addEventListener('click', function(event) {
  591. resetConfig();
  592. }
  593. , true);
  594. }
  595.  
  596. //==========================================
  597. //Save/Load Config
  598. //==========================================
  599.  
  600. function saveConfig(){
  601. //console.log("Saving config");
  602. try{
  603. setSetting(ANIMATE_SERVER_TIME_KEY,$(ANIMATE_SERVER_TIME_KEY).checked);
  604. setSetting(LOCAL_TIME_SHOW_KEY,$(LOCAL_TIME_SHOW_KEY).checked);
  605. setSetting(GAME_TIME_SHOW_KEY,$(GAME_TIME_SHOW_KEY).checked);
  606. setSetting(HOUR24_KEY,$(HOUR24_KEY).checked);
  607. setSetting(POST_AREA_KEY,$(POST_AREA_KEY).checked);
  608. setSetting(LEFT_MENU_KEY,$(LEFT_MENU_KEY).checked);
  609. setSetting(NEW_POSTS_KEY,$(NEW_POSTS_KEY).checked);
  610. setSetting(TARGET_SELECTOR_KEY,$(TARGET_SELECTOR_KEY).checked);
  611. setSetting(BOT_LIST_KEY,$(BOT_LIST_KEY).checked);
  612. setSetting(EDIT_USER_KEY,$(EDIT_USER_KEY).checked);
  613. setSetting(SITE_MANAGER_KEY,$(SITE_MANAGER_KEY).checked);
  614. setSetting(GHQEDITOR_HEADER,$(GHQEDITOR_HEADER).checked);
  615. setSetting(DEBUG_KEY,$(DEBUG_KEY).checked);
  616.  
  617. var logLevel = LOG_LEVEL_WARN;
  618. var radioButtons = document.evaluate(
  619. "//input[@type='radio']",
  620. document,
  621. null,
  622. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
  623. null);
  624. //console.log(redCells.snapshotLength);
  625. for(var i=0;i<radioButtons.snapshotLength;i++)
  626. {
  627. //console.log(radioButtons.snapshotItem(i));
  628. if (radioButtons.snapshotItem(i).checked==true) {
  629. logLevel = radioButtons.snapshotItem(i).value;
  630. }
  631.  
  632. }
  633. setSetting(LOG_LEVEL_KEY,logLevel);
  634.  
  635.  
  636. var boxes = document.getElementsByName('config_ignoreBoard');
  637. var txt = "::::::";
  638. for (i = 0; i < boxes.length; i++) {
  639. if (boxes[i].checked) {
  640. txt = txt + boxes[i].value+"::::::";
  641. }
  642. }
  643. setSetting('boards_ignore',txt);
  644.  
  645. } catch (e) {console.log("Save settings on "+getClan()+": "+e);}
  646. notify("Settings successfully saved.");
  647. }
  648. function loadConfig(){
  649. try{
  650.  
  651. //console.log("Loading config");
  652. if ($(ANIMATE_SERVER_TIME_KEY)) $(ANIMATE_SERVER_TIME_KEY).checked = getSetting(ANIMATE_SERVER_TIME_KEY,true);
  653. if ($(LOCAL_TIME_SHOW_KEY)) $(LOCAL_TIME_SHOW_KEY).checked = getSetting(LOCAL_TIME_SHOW_KEY,true);
  654. if ($(GAME_TIME_SHOW_KEY)) $(GAME_TIME_SHOW_KEY).checked = getSetting(GAME_TIME_SHOW_KEY,true);
  655. if ($(HOUR24_KEY)) $(HOUR24_KEY).checked = getSetting(HOUR24_KEY,false);
  656. if ($(POST_AREA_KEY)) $(POST_AREA_KEY).checked = getSetting(POST_AREA_KEY,true);
  657. if ($(LEFT_MENU_KEY)) $(LEFT_MENU_KEY).checked = getSetting(LEFT_MENU_KEY,true);
  658. if ($(NEW_POSTS_KEY)) $(NEW_POSTS_KEY).checked = getSetting(NEW_POSTS_KEY,true);
  659. if ($(TARGET_SELECTOR_KEY)) $(TARGET_SELECTOR_KEY).checked = getSetting(TARGET_SELECTOR_KEY,true);
  660. if ($(BOT_LIST_KEY)) $(BOT_LIST_KEY).checked = getSetting(BOT_LIST_KEY,true);
  661. if ($(EDIT_USER_KEY)) $(EDIT_USER_KEY).checked = getSetting(EDIT_USER_KEY,true);
  662. if ($(SITE_MANAGER_KEY)) $(SITE_MANAGER_KEY).checked = getSetting(SITE_MANAGER_KEY,true);
  663. if ($(DEBUG_KEY)) $(DEBUG_KEY).checked = getSetting(DEBUG_KEY,false);
  664. if ($(GHQEDITOR_HEADER)) $(GHQEDITOR_HEADER).checked = getSetting(GHQEDITOR_HEADER,false);
  665.  
  666. var logLevel = getSetting(LOG_LEVEL_KEY,LOG_LEVEL_WARN);
  667. //console.log("Log level: "+logLevel);
  668. var radioButtons = document.evaluate(
  669. "//input[@type='radio']",
  670. document,
  671. null,
  672. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
  673. null);
  674. //console.log(redCells.snapshotLength);
  675. for(var i=0;i<radioButtons.snapshotLength;i++)
  676. {
  677. //console.log(radioButtons.snapshotItem(i));
  678. if (radioButtons.snapshotItem(i).value==logLevel) {
  679. radioButtons.snapshotItem(i).checked = true;
  680. }
  681.  
  682. }
  683.  
  684. } catch (e) { console.log("Config loaded: "+e); return; }
  685. }
  686. function resetConfig(install){
  687. try{
  688.  
  689. setSetting(ANIMATE_SERVER_TIME_KEY,true);
  690. setSetting(GAME_TIME_SHOW_KEY,true);
  691. setSetting(LOCAL_TIME_SHOW_KEY,true);
  692. setSetting(HOUR24_KEY,false);
  693. setSetting(POST_AREA_KEY,true);
  694. setSetting(LEFT_MENU_KEY,true);
  695. setSetting(NEW_POSTS_KEY,true);
  696. setSetting(TARGET_SELECTOR_KEY,true);
  697. setSetting(BOT_LIST_KEY,true);
  698. setSetting(EDIT_USER_KEY,true);
  699. setSetting(SITE_MANAGER_KEY,true);
  700. setSetting(DEBUG_KEY,false);
  701. setSetting(GHQEDITOR_HEADER,false);
  702.  
  703. if(install == "newInstall") { notify ("Settings set to default for new install."); return; }
  704. } catch (e) { console.log("Config reset: "+e); return; }
  705. notify("Settings successfully reset reloading page to update.");
  706.  
  707. window.location.reload();
  708. }
  709. //==========================================
  710. //AUGMENT FUNCTIONS
  711. //==========================================
  712.  
  713. /*
  714. * POSTAREA AUGMENTATION
  715. */
  716. function postAreaAugment() {
  717. function postAreaAugment_TextEditor(span) {
  718. id = span.id;
  719. if(subjectfocus){
  720. var box = Subject;
  721. }else{
  722. var box = Message;
  723. }
  724.  
  725. var start = box.selectionStart;
  726. var end = box.selectionEnd;
  727. switch (id){
  728. case 'BoldStart':
  729. text = '<b>';
  730. break;
  731. case 'Bold':
  732. if(start != end){
  733. box.value = box.value.substr(0, end) + '</b>' + box.value.substr(end, box.value.length);
  734. box.value = box.value.substr(0, start) + '<b>' + box.value.substr(start, box.value.length);
  735. }else{
  736. text = '<b> </b>';
  737. }
  738. break;
  739. case 'BoldEnd':
  740. text = '</b>';
  741. break;
  742. case 'UnderlineStart':
  743. text = '<u>';
  744. break;
  745. case 'Underline':
  746. if(start != end){
  747. box.value = box.value.substr(0, end) + '</u>' + box.value.substr(end, box.value.length);
  748. box.value = box.value.substr(0, start) + '<u>' + box.value.substr(start, box.value.length);
  749. }else{
  750. text = '<u> </u>';
  751. }
  752. break;
  753. case 'UnderlineEnd':
  754. text = '</u>';
  755. break;
  756. case 'ItalicsStart':
  757. text = '<i>';
  758. break;
  759. case 'Italics':
  760. if(start != end){
  761. box.value = box.value.substr(0, end) + '</i>' + box.value.substr(end, box.value.length);
  762. box.value = box.value.substr(0, start) + '<i>' + box.value.substr(start, box.value.length);
  763. }else{
  764. text = '<i> </i>';
  765. }
  766. break;
  767. case 'ItalicsEnd':
  768. text = '</i>';
  769. break;
  770. case 'ColorIA':
  771. if(start != end){
  772. box.value = box.value.substr(0, end) + '</font>' + box.value.substr(end, box.value.length);
  773. box.value = box.value.substr(0, start) + '<font color="orange">' + box.value.substr(start, box.value.length);
  774. }else{
  775. text = '<font color="orange">';
  776. }
  777. break;
  778. case 'ColorWar':
  779. if(start != end){
  780. box.value = box.value.substr(0, end) + '</font>' + box.value.substr(end, box.value.length);
  781. box.value = box.value.substr(0, start) + '<font color="dodgerblue">' + box.value.substr(start, box.value.length);
  782. }else{
  783. text = '<font color="dodgerblue">';
  784. }
  785. break;
  786. case 'ColorFR':
  787. if(start != end){
  788. box.value = box.value.substr(0, end) + '</font>' + box.value.substr(end, box.value.length);
  789. box.value = box.value.substr(0, start) + '<font color="mediumseagreen">' + box.value.substr(start, box.value.length);
  790. }else{
  791. text = '<font color="mediumseagreen">';
  792. }
  793. break;
  794. case 'ColorEnd':
  795. text = '</font>';
  796. break;
  797. case 'Fontx-Small':
  798. case 'FontSmall':
  799. case 'FontLarge':
  800. case 'Fontx-Large':
  801. var size = id.substr(4);
  802. if(start != end){
  803. box.value = box.value.substr(0, end) + '</span>' + box.value.substr(end, box.value.length);
  804. box.value = box.value.substr(0, start) + '<span style="font-size: '+size+'">' + box.value.substr(start, box.value.length);
  805. }else{
  806. text = '<span style="font-size: '+size+'"> ';
  807. }
  808. break;
  809. case 'FontEnd':
  810. text = '</span>';
  811. break;
  812. case 'AddURL':
  813. var url = prompt('What URL would you like to Add? (Paste URL)');
  814. var text = prompt('What Text would you like shown to the user for the link? (Text Header shown to user for link)');
  815. text = '<a href="'+url+'">'+text+'</a>';
  816. break;
  817. case 'AddImage':
  818. var image = prompt('What is the URL to the Image? (Paste URL)');
  819. text = '<img border="0" src="'+image+'">';
  820. break;
  821. case 'Emotessmile':
  822. text = ' :) ';
  823. break;
  824. case 'Emoteswink':
  825. text = ' ;) ';
  826. break;
  827. case 'Emotesfrown':
  828. text = ' :( ';
  829. break;
  830. case 'Emotescool':
  831. text = ' 8) ';
  832. break;
  833. case 'Emotesmad':
  834. text = ' >:{ ';
  835. break;
  836. case 'Emotestongue':
  837. text = ' :P ';
  838. break;
  839. case 'Emotescrazy':
  840. text = ' ~:~ ';
  841. break;
  842. case 'Emotesshocked':
  843. text = ' :O ';
  844. break;
  845. case 'Emotesdetermined':
  846. text = ' >:) ';
  847. break;
  848. case 'Emotesundecided':
  849. text = ' :/ ';
  850. break;
  851. case 'Emotesyelling':
  852. text = ' >:O ';
  853. break;
  854. case 'Emotessealed':
  855. text = ' :X ';
  856. break;
  857. case 'Emoteslaugh':
  858. text = ' :D ';
  859. break;
  860. case 'Emotescrying':
  861. text = ' :*( ';
  862. break;
  863. case 'Emotesblush':
  864. text = ' *blush* ';
  865. break;
  866. default:
  867. if(id.substr(0, 5) != 'Color'){ return; }
  868. var color = id.substr(5);
  869. if(start != end){
  870. box.value = box.value.substr(0, end) + '</font>' + box.value.substr(end, box.value.length);
  871. box.value = box.value.substr(0, start) + '<font color="'+color+'">' + box.value.substr(start, box.value.length);
  872. }else{
  873. text = '<font color="'+color+'">';
  874. }
  875.  
  876.  
  877. break;
  878. }
  879. if(text !== undefined){
  880. box.value = box.value.substr(0, start) + text + box.value.substr(end, box.value.length);
  881. }
  882. box.focus();
  883. }
  884. var subjectfocus = false;
  885. var Message = document.getElementsByTagName("textarea")[0];
  886. Message.cols = '75';
  887. Message.rows = '20';
  888. Message.addEventListener("focus", function(){ subjectfocus = false; }, false);
  889. var table = Message.parentNode.parentNode.parentNode;
  890. var rowindex = Message.parentNode.parentNode.sectionRowIndex;
  891. var editor = table.rows[rowindex].cells[0];
  892. editor.align = 'center';
  893. editor.vAlign = 'middle';
  894. var colorstext = '';
  895. var colors = new Array('Aqua', 'Blue', 'Crimson', 'DarkBlue', 'DarkCyan', 'DarkGreen', 'DarkViolet', 'DodgerBlue', 'Gray', 'Green', 'Lime', 'Maroon', 'Navy', 'Orange', 'Purple', 'Red', 'RoyalBlue', 'SeaGreen', 'Teal', 'Yellow');
  896. for(var i=0; i<colors.length; ++i){
  897. if(i == 5 || i == 10 || i == 15 || i == 20){
  898. colorstext += '<br>';
  899. }
  900. colorstext += '<span id="Color'+colors[i]+'" style="color: '+colors[i]+'" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">'+colors[i]+',</span> ';
  901. }
  902. editor.innerHTML = '<font style="color: DarkOrange; font-size: small"><span id="BoldStart" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">[B]</span> - <span id="Bold" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'"><b>Bold</b></span> - <span id="BoldEnd" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">[/B]</span><br><span id="UnderlineStart" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">[U]</span> - <span id="Underline" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'"><u>Underline</u></span> - <span id="UnderlineEnd" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">[/U]</span><br><span id="ItalicsStart" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">[I]</span> - <span id="Italics" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'"><i>Italics</i></span> - <span id="ItalicsEnd" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">[/I]</span><br><br>Colors: <span id="ColorIA" style="color: orange" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">IA,</span> <span id="ColorWar" style="color: dodgerblue" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">War,</span> <span id="ColorFR" style="color: mediumseagreen" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">FR</span><br>'+colorstext+'<br><span id="ColorEnd" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">End Color</span><br><br><span style="font-size: medium; text-decoration: underline"><strong>Size</strong></span><br><span id="Fontx-Small" style="font-size: x-Small" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">x-Small</span>, <span id="FontSmall" style="font-size: Small" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">Small</span>, <span id="FontLarge" style="font-size: Large" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">Large</span>, <span id="Fontx-Large" style="font-size: x-Large" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">x-Large</span><br><span id="FontEnd" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">End Size</span><br><br><span id="AddURL" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">Add URL</span><br><span id="AddImage" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">Add Image</span><br><br><span id="Emotessmile" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/smile.gif"></span> <span id="Emoteswink" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/wink.gif"></span> <span id="Emotesfrown" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/frown.gif"></span> <span id="Emotescool" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/cool.gif"></span> <span id="Emotesmad" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/mad.gif"></span><br><span id="Emotestongue" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/tongue.gif"></span> <span id="Emotescrazy" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/crazy.gif"></span> <span id="Emotesshocked" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/shocked.gif"></span> <span id="Emotesdetermined" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/determined.gif"></span> <span id="Emotesundecided" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/undecided.gif"></span><br><span id="Emotesyelling" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/yelling.gif"></span> <span id="Emotessealed" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/sealed.gif"></span> <span id="Emoteslaugh" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/laugh.gif"></span> <span id="Emotescrying" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/crying.gif"></span> <span id="Emotesblush" onmouseover="this.style.cursor=\'pointer\'"><img border="0" src="http://sol.ghqnet.com/images/Emotes/blush.gif"></span>';
  903.  
  904. document.getElementById("BoldStart").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  905. document.getElementById("Bold").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  906. document.getElementById("BoldEnd").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  907. document.getElementById("UnderlineStart").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  908. document.getElementById("Underline").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  909. document.getElementById("UnderlineEnd").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  910. document.getElementById("ItalicsStart").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  911. document.getElementById("Italics").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  912. document.getElementById("ItalicsEnd").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  913. document.getElementById("ColorIA").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  914. document.getElementById("ColorWar").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  915. document.getElementById("ColorFR").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  916. document.getElementById("ColorEnd").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  917. document.getElementById("Fontx-Small").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  918. document.getElementById("FontSmall").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  919. document.getElementById("FontLarge").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  920. document.getElementById("Fontx-Large").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  921. document.getElementById("FontEnd").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  922. document.getElementById("AddURL").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  923. document.getElementById("AddImage").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  924. document.getElementById("Emotessmile").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  925. document.getElementById("Emoteswink").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  926. document.getElementById("Emotesfrown").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  927. document.getElementById("Emotescool").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  928. document.getElementById("Emotesmad").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  929. document.getElementById("Emotestongue").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  930. document.getElementById("Emotescrazy").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  931. document.getElementById("Emotesshocked").addEventListener("click", function(){TextEditor(this);}, false);
  932. document.getElementById("Emotesdetermined").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  933. document.getElementById("Emotesundecided").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  934. document.getElementById("Emotesyelling").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  935. document.getElementById("Emotessealed").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  936. document.getElementById("Emoteslaugh").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  937. document.getElementById("Emotescrying").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  938. document.getElementById("Emotesblush").addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  939.  
  940. for(var i=0; i<colors.length; ++i){
  941. var name = "Color"+colors[i];
  942. document.getElementById(name).addEventListener("click", function(){postAreaAugment_TextEditor(this);}, false);
  943. }
  944. var allInputs = document.getElementsByTagName("input");
  945. for(var i=0; i<allInputs.length; ++i){
  946. if(allInputs[i].name == 'Subject'){
  947. var Subject = allInputs[i];
  948. allInputs[i].addEventListener("focus", function(){ subjectfocus = true; }, false);
  949. allInputs[i].size = '70';
  950. }
  951. }
  952. }
  953.  
  954.  
  955. /*
  956. * NEW POSTS
  957. */
  958. function newPosts() {
  959. function newPosts_MarkAllRead() {
  960. var allNew = document.getElementsByName("NEW");
  961. for(var i=0; i<allNew.length; ++i){
  962. allNew[i].parentNode.removeChild( allNew[i] );
  963. i--;
  964. }
  965. setSetting( 'Posts_'+BoardID, ':AllRead-'+curTime+':' );
  966. notify('All topics marked as Read.');
  967. }
  968. var allTR = document.getElementsByTagName('tr'); // get all TD elements
  969. var allInputs = document.getElementsByTagName("input");
  970. for(var i=0; i<allInputs.length; ++i){
  971. if(allInputs[i].name == 'BoardID'){
  972. BoardID = allInputs[i].value;
  973. break;
  974. }
  975. }
  976. var Posts = getSetting( 'Posts_'+BoardID, ':' );
  977. var t = Posts.indexOf(':AllRead-');
  978. if(t!=-1){
  979. var tEnd = Posts.indexOf(':', t+1);
  980. var val = Posts.slice(t, tEnd);
  981. val = val.replace(':', '');
  982. var allReadTime = val.split('-')[1];
  983. }else{
  984. var allReadTime = 0;
  985. }
  986. if(document.forms[0].name == 'EditBoard'){
  987. colnum = 3;
  988. }else{
  989. colnum = 0;
  990. }
  991. var youngestTime = curTime - 60*60*24*7*1000;
  992. for(var i=0; i < allTR.length; ++i){
  993. if(allTR[i].firstChild.colSpan == 4 || allTR[i].firstChild.colSpan == 4+colnum){
  994. if(allTR[i].firstChild.firstChild != 'undefined' && allTR[i].lastChild.firstChild != 'undefined'){
  995. if(allTR[i].lastChild.firstChild.innerHTML == 'View Emotes' ){
  996. var row = allTR[i].parentNode.insertRow(0);
  997. var cell = row.insertCell(0);
  998. cell.bgColor = 'black';
  999. cell.colSpan = 4+colnum;
  1000. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';" id="MarkRead"><font style="color: Orange; font-size: small"><strong>Mark all as "Read"</strong></font></span>';
  1001. $('MarkRead').addEventListener("click", function(){newPosts_MarkAllRead();}, false);
  1002. i++;
  1003. }
  1004. }
  1005. continue;
  1006. }
  1007. if(allTR[i].cells.length != 5+colnum){
  1008. continue;
  1009. }
  1010. if(allTR[i].cells[4+colnum].innerHTML == 'Last Post'){
  1011. continue;
  1012. }
  1013. var PostDate = allTR[i].lastChild.innerHTML;
  1014. PostDate = Date.parse(PostDate);
  1015. if(youngestTime >= PostDate || allReadTime >= PostDate){
  1016. continue;
  1017. }
  1018. if(allTR[i].cells[3+colnum].firstChild.innerHTML == Clan_Username){
  1019. continue;
  1020. }
  1021. var ThreadID = allTR[i].childNodes[0+colnum].firstChild.href.split('&')[1];
  1022. ThreadID = ThreadID.split('=')[1];
  1023. var t = Posts.indexOf(':'+ThreadID+'-');
  1024. if(t!=-1){
  1025. var tEnd = Posts.indexOf(':', t+1);
  1026. var val = Posts.slice(t, tEnd);
  1027. val = val.replace(':', '');
  1028. var lastReadTime = val.split('-')[1];
  1029. if(PostDate <= lastReadTime){
  1030. continue;
  1031. }
  1032. //allTR[i].childNodes[0+colnum].innerHTML = '<span id="t_'+ThreadID+'" name="NEW"> <font style="color: Red; font-size: x-small">*NEW* </font></span>'+allTR[i].childNodes[0+colnum].innerHTML;
  1033. allTR[i].childNodes[0+colnum].innerHTML = '<span id="t_'+ThreadID+'" name="NEW"><img src="http://www.ghqnet.com/sites/SOL/Files/newpost.png"> </span>'+allTR[i].childNodes[0+colnum].innerHTML;
  1034. }else{
  1035. //allTR[i].childNodes[0+colnum].innerHTML = '<span id="t_'+ThreadID+'" name="NEW"><font style="color: Red; font-size: x-small">*NEW* </font></span>'+allTR[i].childNodes[0+colnum].innerHTML;
  1036. allTR[i].childNodes[0+colnum].innerHTML = '<span id="t_'+ThreadID+'" name="NEW"><img src="http://www.ghqnet.com/sites/SOL/Files/newpost.png"> </span>'+allTR[i].childNodes[0+colnum].innerHTML;
  1037. }
  1038. }
  1039. }
  1040. function newPostMarkRead() {
  1041. var BoardID = path.split('&')[0].split('=')[1];
  1042. var Posts = getSetting( 'Posts_'+BoardID, ':' );
  1043. var t = Posts.indexOf(':AllRead-');
  1044. if(t!=-1){
  1045. var tEnd = Posts.indexOf(':', t+1);
  1046. var val = Posts.slice(t, tEnd);
  1047. val = val.replace(':', '');
  1048. var allReadTime = val.split('-')[1];
  1049. }else{
  1050. var allReadTime = 0;
  1051. }
  1052. var PostDate = path.split('&')[3].split('=')[1];
  1053. PostDate = Date.parse(URLDecode(PostDate));
  1054. //var curTime = new Date().getTime();
  1055. var youngestTime = curTime - 60*60*24*7*1000;
  1056. if(youngestTime < PostDate && allReadTime < PostDate){
  1057. var ThreadID = path.split('&')[1].split('=')[1];
  1058. t = Posts.indexOf(':'+ThreadID+'-');
  1059. if(t!=-1){
  1060. tEnd = Posts.indexOf(':', t+1);
  1061. var val = Posts.slice(t, tEnd);
  1062. Posts = Posts.replace(val, ':'+ThreadID+'-'+PostDate+':');
  1063. }else{
  1064. Posts = Posts+ThreadID+'-'+PostDate+':';
  1065. }
  1066. setSetting( 'Posts_'+BoardID, Posts );
  1067. }
  1068. }
  1069. // ########################################################################################################################################################
  1070. // ########################################################################################################################################################
  1071. // ########################################################################################################################################################
  1072. // ########################################################################################################################################################
  1073. // ########################################################################################################################################################
  1074. // ########################################################################################################################################################
  1075. // ########################################################################################################################################################
  1076. function cleanBoard() {
  1077. function cleanBoard_onChange(t) {
  1078. var Value = t.value;
  1079. switch (Value){
  1080. case 'Choose One':
  1081. $("CleanBoard_SpanOlderThen").style.display = 'none';
  1082. $("CleanBoard_SpanSortOrder").style.display = 'none';
  1083. $("CleanBoard_SortOrder").selectedIndex = $("CleanBoard_SortOrder").options[0].index;
  1084. $("CleanBoard_SpanStartingWithA").style.display = 'none';
  1085. $("CleanBoard_SpanCustom").style.display = 'none';
  1086. $("CleanBoard_SpanExplain").style.display = 'none';
  1087. $("CleanBoard_SpanCleanBoard").style.display = 'none';
  1088. break;
  1089. case 'Check Boxes':
  1090. $("CleanBoard_SpanOlderThen").style.display = '';
  1091. $("CleanBoard_SpanSortOrder").style.display = 'none';
  1092. $("CleanBoard_SortOrder").selectedIndex = $("CleanBoard_SortOrder").options[0].index;
  1093. $("CleanBoard_SpanStartingWithA").style.display = 'none';
  1094. $("CleanBoard_SpanCustom").style.display = 'none';
  1095. $("CleanBoard_SpanExplain").style.display = '';
  1096. $("CleanBoard_SpanCleanBoard").style.display = '';
  1097. break;
  1098. default:
  1099. $("CleanBoard_SpanOlderThen").style.display = '';
  1100. $("CleanBoard_SpanSortOrder").style.display = '';
  1101. $("CleanBoard_SortOrder").selectedIndex = $("CleanBoard_SortOrder").options[0].index;
  1102. $("CleanBoard_SpanStartingWithA").style.display = 'none';
  1103. $("CleanBoard_SpanCustom").style.display = 'none';
  1104. $("CleanBoard_SpanExplain").style.display = 'none';
  1105. $("CleanBoard_SpanCleanBoard").style.display = 'none';
  1106. break;
  1107. }
  1108. }
  1109. function cleanBoard_onChangeSortOrder(t) {
  1110. var Value = t.value;
  1111. switch (Value){
  1112. case 'Keep Current Sort Order':
  1113. $("CleanBoard_SpanStartingWithA").style.display = 'none';
  1114. $("CleanBoard_SpanCustom").style.display = 'none';
  1115. $("CleanBoard_SpanExplain").style.display = '';
  1116. $("CleanBoard_SpanCleanBoard").style.display = '';
  1117. break;
  1118. case 'Alphabetically':
  1119. $("CleanBoard_SpanStartingWithA").style.display = '';
  1120. $("CleanBoard_SpanCustom").style.display = 'none';
  1121. $("CleanBoard_SpanExplain").style.display = '';
  1122. $("CleanBoard_SpanCleanBoard").style.display = '';
  1123. break;
  1124. case 'Custom':
  1125. $("CleanBoard_SpanStartingWithA").style.display = 'none';
  1126. $("CleanBoard_SpanCustom").style.display = '';
  1127. $("CleanBoard_SpanExplain").style.display = '';
  1128. $("CleanBoard_SpanCleanBoard").style.display = '';
  1129. break;
  1130. default:
  1131. $("CleanBoard_SpanStartingWithA").style.display = 'none';
  1132. $("CleanBoard_SpanCustom").style.display = 'none';
  1133. $("CleanBoard_SpanExplain").style.display = 'none';
  1134. $("CleanBoard_SpanCleanBoard").style.display = 'none';
  1135. break;
  1136. }
  1137. }
  1138. function cleanBoard_Explain() {
  1139. var CleanBoard = $("CleanBoard");
  1140. var Value = CleanBoard.value;
  1141. switch (Value){
  1142. case 'Choose One':
  1143. return;
  1144. break;
  1145. case 'Check Boxes':
  1146. var days = $('CleanBoard_Days');
  1147. alert('"Check Boxes" on any posts older then "'+days.value+'" Days.');
  1148. break;
  1149. default:
  1150. var SortOrder = $("CleanBoard_SortOrder");
  1151. var Value2 = SortOrder.value;
  1152. var days = $('CleanBoard_Days');
  1153. switch (Value2){
  1154. case 'Keep Current Sort Order':
  1155. alert('"Move to selected board" any posts older then "'+days.value+'" Days while "Keeping the Current Sort Order".');
  1156. break;
  1157. case 'Alphabetically':
  1158. var StartingWithA = $('CleanBoard_StartingWithA');
  1159. var InStepsOfSign = $('CleanBoard_InStepsOfSign');
  1160. var InStepsOf = $('CleanBoard_InStepsOf');
  1161. if(InStepsOfSign.value == '+'){
  1162. var b = Number(StartingWithA.value) + Number(InStepsOf.value);
  1163. var c = b + Number(InStepsOf.value);
  1164. var d = c + Number(InStepsOf.value);
  1165. }else{
  1166. var b = Number(StartingWithA.value) - Number(InStepsOf.value);
  1167. var c = b - Number(InStepsOf.value);
  1168. var d = c - Number(InStepsOf.value);
  1169. }
  1170. alert('"Move to selected board" any posts older then "'+days.value+'" Days while sorting "Alphabetically" starting with "A" at "'+StartingWithA.value+'" and in steps of "'+InStepsOfSign.value+InStepsOf.value+'". So A="'+StartingWithA.value+'", B="'+b+'", C="'+c+'", D="'+d+'", etc.');
  1171. break;
  1172. case 'Custom':
  1173. var Custom = $('CleanBoard_Custom');
  1174. alert('"Move to selected board" any posts older then "'+days.value+'" Days while placing all moved topics at position "'+Custom.value+'".');
  1175. break;
  1176. default:
  1177. return;
  1178. break;
  1179. }
  1180. break;
  1181. }
  1182. }
  1183. function cleanBoard_CleanBoard() {
  1184. var CleanBoard = $("CleanBoard");
  1185. var Value = CleanBoard.value;
  1186. switch (Value){
  1187. case 'Choose One':
  1188. return;
  1189. break;
  1190. case 'Check Boxes':
  1191. var days = $('CleanBoard_Days');
  1192. var allChecks = table.getElementsByTagName('input'); // get all TD elements
  1193. var dif = parseInt(days.value) * 24 * 60 * 60 * 1000;
  1194. currentTime = curTime - dif;
  1195. var count = 0;
  1196. for(var i=0; i<allChecks.length; ++i){
  1197. if(allChecks[i].parentNode.parentNode.childNodes[6] == undefined){
  1198. continue;
  1199. }else if(allChecks[i].parentNode.parentNode.childNodes[6].innerHTML == undefined){
  1200. continue;
  1201. }
  1202. if(allChecks[i].parentNode.parentNode.childNodes[6].innerHTML == ''){
  1203. continue;
  1204. }
  1205. var date = allChecks[i].parentNode.parentNode.childNodes[6].innerHTML;
  1206. date = Date.parse(date);
  1207. if(isNaN(date)){ continue; }
  1208. if(currentTime > date){
  1209. allChecks[i].checked = true;
  1210. count++;
  1211. }
  1212. }
  1213. alert('"'+count+'" Topics have been selected. You may now use the GHQ functions to Move the topics or Delete them.');
  1214. break;
  1215. default:
  1216. var SortOrder = $("CleanBoard_SortOrder");
  1217. var Value2 = SortOrder.value;
  1218. var days = $('CleanBoard_Days');
  1219. switch (Value2){
  1220. case 'Keep Current Sort Order':
  1221. var days = $('CleanBoard_Days');
  1222. var allChecks = table.getElementsByTagName('input'); // get all TD elements
  1223. var dif = parseInt(days.value) * 24 * 60 * 60 * 1000;
  1224. currentTime = curTime - dif;
  1225. var count = 0;
  1226. for(var i=0; i<allChecks.length; ++i){
  1227. if(allChecks[i].parentNode.parentNode.childNodes[6] == undefined){
  1228. continue;
  1229. }else if(allChecks[i].parentNode.parentNode.childNodes[6].innerHTML == undefined){
  1230. continue;
  1231. }
  1232. if(allChecks[i].parentNode.parentNode.childNodes[6].innerHTML == ''){
  1233. continue;
  1234. }
  1235. var date = allChecks[i].parentNode.parentNode.childNodes[6].innerHTML;
  1236. date = Date.parse(date);
  1237. if(isNaN(date)){ continue; }
  1238. if(currentTime > date){
  1239. allChecks[i].checked = true;
  1240. count++;
  1241. }
  1242. }
  1243. if(confirm('Are you sure you want to move these "'+count+'" Topics to the selected board while keeping the current Sort Order?')){
  1244. $('NewBoardID').value = Value;
  1245. document.forms[0].submit();
  1246. }
  1247.  
  1248. break;
  1249. case 'Alphabetically':
  1250. var StartingWithA = $('CleanBoard_StartingWithA');
  1251. var InStepsOfSign = $('CleanBoard_InStepsOfSign');
  1252. var InStepsOf = $('CleanBoard_InStepsOf');
  1253.  
  1254.  
  1255.  
  1256.  
  1257. break;
  1258. case 'Custom':
  1259. var Custom = $('CleanBoard_Custom');
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265. break;
  1266. default:
  1267. return;
  1268. break;
  1269. }
  1270. break;
  1271. }
  1272. }
  1273. var allInputs = document.getElementsByTagName('input'); // get all TD elements
  1274. for(var i=0; i<allInputs.length; ++i){
  1275. if(allInputs[i].name == 'Delete'){
  1276. var deleteElem = allInputs[i];
  1277. }
  1278. if(allInputs[i].name == 'Move'){
  1279. allInputs[i].id = 'Move';
  1280. }
  1281. }
  1282. if(deleteElem === undefined){ return; }
  1283. if(document.forms[0].name == 'EditBoard'){
  1284. }else{
  1285. return;
  1286. }
  1287. var table = deleteElem.parentNode.parentNode.parentNode;
  1288. var row = table.insertRow(-1);
  1289. var cell = row.insertCell(0);
  1290. row.bgColor = deleteElem.parentNode.parentNode.bgColor;
  1291. cell.colSpan = '7';
  1292. var options = "<option>Choose One</option><option>Check Boxes</option>";
  1293. var allSelects = document.getElementsByTagName('select'); // get all TD elements
  1294. for(var i=0; i<allSelects.length; ++i){
  1295. if(allSelects[i].name == 'NewBoardID'){
  1296. var moveElem = allSelects[i];
  1297. allSelects[i].id = 'NewBoardID';
  1298. break;
  1299. }
  1300. }
  1301. if(moveElem === undefined){
  1302. }else{
  1303. for(var i=0; i<moveElem.options.length; ++i){
  1304. options += '<option value="'+moveElem.options[i].value+'">MoveTo: '+moveElem.options[i].text+'</option>';
  1305. }
  1306. }
  1307. cell.innerHTML = '</form>CleanBoard: <select id="CleanBoard">'+options+'</select>'+
  1308. '<span id="CleanBoard_SpanOlderThen" style="display: none;"> any Posts Older Then <select id="CleanBoard_Days"><option value="0">0 Days</option><option value="7">7 Days</option><option value="14">14 Days</option><option selected value="30">1 Month</option><option value="60">2 Months</option><option value="90">3 Months</option><option value="120">4 Months</option><option value="150">5 Months</option><option value="180">6 Months</option><option value="365">1 Year</option></select></span>'+
  1309. '<span id="CleanBoard_SpanSortOrder" style="display: none;"> and set at Sort Order <select id="CleanBoard_SortOrder"><option>Choose One</option><option>Keep Current Sort Order</option><option>Alphabetically</option><option>Custom</option></select></span>'+
  1310. '<span id="CleanBoard_SpanStartingWithA" style="display: none;"> starting with A at <input value="0" size="5" id="CleanBoard_StartingWithA" /> and in steps of <select id="CleanBoard_InStepsOfSign"><option selected>-</option><option>+</option></select><input value="2" size="3" id="CleanBoard_InStepsOf"/></span>'+
  1311. '<span id="CleanBoard_SpanCustom" style="display: none;"> at SortOrder <input value="0" size="5" id="CleanBoard_Custom" /></span>'+
  1312. '<span id="CleanBoard_SpanExplain" style="display: none;"><button id="CleanBoard_Explain" onclick="return false"> Explain</button></span>'+
  1313. '<span id="CleanBoard_SpanCleanBoard" style="display: none;"><button id="CleanBoard_CleanBoard" onclick="return false"> CleanBoard</button></span>';
  1314. $("CleanBoard").addEventListener("change", function(){cleanBoard_onChange(this);}, false);
  1315. $("CleanBoard_SortOrder").addEventListener("change", function(){cleanBoard_onChangeSortOrder(this);}, false);
  1316. $("CleanBoard_Explain").addEventListener("click", function(){cleanBoard_Explain(this);}, false);
  1317. $("CleanBoard_CleanBoard").addEventListener("click", function(){cleanBoard_CleanBoard();}, false);
  1318.  
  1319. }
  1320. // ########################################################################################################################################################
  1321. // ########################################################################################################################################################
  1322. // ########################################################################################################################################################
  1323. // ########################################################################################################################################################
  1324. // ########################################################################################################################################################
  1325. // ########################################################################################################################################################
  1326. // ########################################################################################################################################################
  1327. function links() {
  1328. function links_ShowEdits() {
  1329. var links = getSetting( 'Links', '' );
  1330. var linksarr = links.split('::::::');
  1331. if(!editing){
  1332. alert('This function will allow you to select Menu Items you dont use and move them to the bottom of the Menu to get them out of the way. - Simply click the X next to the Menu Item.');
  1333. var row = allTR[0].parentNode.insertRow(2);
  1334. var cell = row.insertCell(0);
  1335. cell.colSpan = 2;
  1336. cell.bgColor = allTR[1].bgColor;
  1337. row.bgColor = allTR[1].bgColor;
  1338. cell.align = 'center';
  1339. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: 12px;">Reset Menu Items</font></span>';
  1340. cell.addEventListener("click", function(){links_ResetMenuVerify();}, false);
  1341. for(var i=0; i<allTR.length; ++i){
  1342. if(i<=2 || allTR[i].id.slice(0, 14) == 'EditMenuTitle_'){
  1343. allTR[i].firstChild.colSpan = 2;
  1344. if(allTR[i].style.display == 'none'){
  1345. allTR[i].style.display = '';
  1346. EditMenuIndex = i;
  1347. }
  1348. }else{
  1349. var cell = allTR[i].insertCell(0);
  1350. cell.align = 'center';
  1351. if(allTR[i].id.slice(0, 6) == 'Moved_'){
  1352. allTR[i].style.display = '';
  1353. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: x-small">+</font></span>';
  1354. cell.addEventListener("click", function(){links_UnMoveMenuItem(this);}, false);
  1355. }else{
  1356. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: x-small">X</font></span>';
  1357. cell.addEventListener("click", function(){links_MoveMenuItem(this);}, false);
  1358. }
  1359. }
  1360. }
  1361. editing = true;
  1362. }else{
  1363. x = allTR[0].parentNode.deleteRow(2);
  1364. for(var i=0; i<allTR.length; ++i){
  1365. if(allTR[i].firstChild.colSpan == 2){
  1366. allTR[i].firstChild.colSpan = 1;
  1367. }else{
  1368. var cell = allTR[i].deleteCell(0);
  1369. if(allTR[i].id.slice(0, 6) == 'Moved_'){
  1370. allTR[i].style.display = 'none';
  1371. }
  1372. }
  1373. }
  1374. allTR[EditMenuIndex].style.display = 'none';
  1375. x = EditMenuIndex-1;
  1376. allTR[x].style.display = 'none';
  1377. editing = false;
  1378. }
  1379. }
  1380. function links_MoveMenuItem(t) {
  1381. var row = t.parentNode;
  1382. var obj = row.cloneNode(true);
  1383. var id = obj.id.substr(9);
  1384. obj.id = 'Moved_'+id;
  1385. var s = row.parentNode.appendChild(obj);
  1386. s.firstChild.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: x-small">+</font></span>';
  1387. s.firstChild.addEventListener("click", function(){links_UnMoveMenuItem(this);}, false);
  1388. row.style.display = 'none';
  1389. val = row.lastChild.firstChild.innerHTML;
  1390. var links = getSetting( 'Links', '' );
  1391. if(links == ''){
  1392. setSetting( 'Links', ':::'+val+':::' );
  1393. return;
  1394. }
  1395. if(links.indexOf(':::'+val+':::')!=-1){
  1396. return;
  1397. }
  1398. setSetting( 'Links', links+':::'+val+':::' );
  1399. }
  1400. function links_UnMoveMenuItem(t) {
  1401. var row = t.parentNode;
  1402. var id = row.id.substr(6);
  1403. var s = document.getElementById('EditMenu_'+id);
  1404. s.style.display = '';
  1405. row.parentNode.deleteRow(row.rowIndex);
  1406. var links = getSetting( 'Links', '' );
  1407. links = links.replace(':::'+row.lastChild.firstChild.innerHTML+':::', '');
  1408. setSetting( 'Links', links );
  1409. }
  1410. function links_ResetMenuVerify(t) {
  1411. var answer = confirm("Are you sure you want to clear your Menu Filter Links?");
  1412. if(answer){ links_ResetMenu(t); }else{ return; }
  1413. }
  1414. function links_ResetMenu(t) {
  1415. x = allTR[0].parentNode.deleteRow(2);
  1416. setSetting( 'Links', '' );
  1417. for(var i=0; i<allTR.length; ++i){
  1418. if(allTR[i] === undefined){
  1419. break;
  1420. }
  1421. if(allTR[i].firstChild.colSpan == 2){
  1422. allTR[i].firstChild.colSpan = 1;
  1423. }else{
  1424. var cell = allTR[i].deleteCell(0);
  1425. allTR[i].style.display = '';
  1426.  
  1427. if(allTR[i].id.slice(0, 6) == 'Moved_'){
  1428. allTR[i].parentNode.deleteRow(allTR[i].rowIndex);
  1429. i--;
  1430. }
  1431. }
  1432. }
  1433. editing = false;
  1434. allTR[allTR.length-1].style.display = 'none';
  1435. allTR[allTR.length].style.display = 'none';
  1436. }
  1437. function links_MarkBoardRead(t) {
  1438. var boardIDVal = t.id.substr(9);
  1439. var s = myRef.document.getElementById('table_'+boardIDVal);
  1440. s.style.display = 'none';
  1441. var boardNameVal = myRef.document.getElementById('boardIDName_'+boardIDVal).innerHTML;
  1442. setSetting( 'Posts_'+boardIDVal, ':AllRead-'+curTime+':' );
  1443. //notify('All topics marked as Read in '+boardNameVal+'.');//GOES TO WRONG WINDOW
  1444. }
  1445. function links_IgnoreBoard(t) {
  1446. var boardIDVal = t.id.substr(12);
  1447. var boardNameVal = myRef.document.getElementById('boardIDName_'+boardIDVal).innerHTML;
  1448. var s = myRef.document.getElementById('table_'+boardIDVal);
  1449. s.style.display = 'none';
  1450. setSetting( 'Posts_'+boardIDVal, ':AllRead-'+curTime+':' );
  1451. var ignoredBoards = getSetting( 'boards_ignore', '::::::' );
  1452. setSetting('boards_ignore', ignoredBoards+boardNameVal+'::::::');
  1453. //notify('All topics marked as Read in '+boardNameVal+'.');//GOES TO WRONG WINDOW
  1454. }
  1455. function links_RefreshBoard(t) {
  1456. var boardIDVal = t.id.substr(8);
  1457. var boardNameVal = myRef.document.getElementById('boardIDName_'+boardIDVal).innerHTML;
  1458. var s = myRef.document.getElementById('Refresh_'+boardIDVal);
  1459. s.innerHTML = 'Refreshing... ';
  1460. var id = myRef.document.getElementById('ID_'+boardIDVal).innerHTML;
  1461. links_CheckforNewPostsOnBoard(id, 1);
  1462. }
  1463.  
  1464. function links_CheckforNewPostsVerify(t) {
  1465. var answer = confirm("This process loads all Boards and checks them for new posts. This may take awhile on slower internets as it runs in the background. You must have Popup blocker disabled for GHQ in order to get the full experience. Are you sure you want to continue?");
  1466. if(answer){ links_CheckforNewPosts(t); }else{ return; }
  1467. }
  1468. function links_CheckforNewPostsOnBoard(i, update) {
  1469. if(boardLinks[i] === undefined || boardLinks[i] === null){ myRef.document.close(); return; }
  1470. var patt4=/ShowPost\.asp\?BoardID=[0-9]{1,}&ThreadID=[0-9]{1,}&site=[A-z]{1,8}&lastpost=.{14,20}(AM|PM)\b/i; //SHowPost URLS
  1471. var patt1=/ShowPost\.asp\?BoardID=[0-9]{1,}/; //BoardID
  1472. var patt2=/=.{14,20}(AM|PM)/gi; //PostTime
  1473. var patt3=/ThreadID=[0-9]{1,}/i; //ThreadID
  1474. var patt5=/[0-9]{1,2}.[0-9]{1,2}.[0-9]{4}.[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}.(AM|PM)/i; //PostTime
  1475.  
  1476. var OldBoardID = 0;
  1477. var count = 0;
  1478. var newPostsText = '';
  1479. GM_xmlhttpRequest({
  1480. method: 'GET',
  1481. url: menuLinksArr[boardLinks[i]].href,
  1482. headers: {
  1483. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
  1484. 'main': 'application/scriptVersion+xml,application/xml,text/xml',
  1485. },
  1486. onload: function(responseDetails) {
  1487. if(curTime == "" || curTime === undefined){
  1488. curTime = responseDetails.responseText.match(patt5);
  1489. curTime = Date.parse(curTime[0]);
  1490. }
  1491. var youngestTime = curTime - 60*60*24*7*1000;
  1492.  
  1493. var rows = responseDetails.responseText.split(/<\/TR>/i); //Gets every ShowPost Link
  1494. if(rows === null){ i++; links_CheckforNewPostsOnBoard(i, 0); }
  1495. for(var x=0; x<rows.length; ++x){
  1496. var response = rows[x].match(patt4); //Gets every ShowPost Link
  1497. if(response === null){ continue; }
  1498. BoardID = response[0].match(patt1);
  1499. BoardID = BoardID[0].slice(21);
  1500. if(BoardID == 0){
  1501. continue;
  1502. }
  1503. if(BoardID != OldBoardID){
  1504. OldBoardID = BoardID;
  1505. var Posts = getSetting( 'Posts_'+BoardID, ':' );
  1506. var t = Posts.indexOf(':AllRead-');
  1507. if(t!=-1){
  1508. var tEnd = Posts.indexOf(':', t+1);
  1509. var val = Posts.slice(t, tEnd);
  1510. val = val.replace(':', '');
  1511. var allReadTime = val.split('-')[1];
  1512. }else{
  1513. var allReadTime = 0;
  1514. }
  1515. }
  1516. var PostDate = response[0].match(patt2);
  1517. var PostDate = PostDate[0].slice(1);
  1518. PostDate = Date.parse(PostDate);
  1519. if(youngestTime >= PostDate || allReadTime >= PostDate){
  1520. continue;
  1521. }
  1522. var ThreadID = response[0].match(patt3);
  1523. var ThreadID = ThreadID[0].slice(9);
  1524. var t = Posts.indexOf(':'+ThreadID+'-');
  1525. if(t!=-1){
  1526. var tEnd = Posts.indexOf(':', t+1);
  1527. var val = Posts.slice(t, tEnd);
  1528. val = val.replace(':', '');
  1529. var lastReadTime = val.split('-')[1];
  1530. if(PostDate <= lastReadTime){
  1531. continue;
  1532. }
  1533. }
  1534. count++;
  1535. if(newPostsArr[BoardID] === undefined){
  1536. newPostsArr[BoardID] = new Array;
  1537. }
  1538. if(newPostsArr[BoardID][ThreadID] === undefined){
  1539. var cols = rows[x].split(/<\/td>/i); //Gets every TD of a row
  1540. if(cols === null){ continue; }
  1541. if(cols[6] === undefined){ //NO EDIT BOARDS
  1542. var t = cols[0].indexOf('>');
  1543. var Topic = cols[0].slice(t+1);
  1544. //var Topic = cols[0].slice(t+10);
  1545. //var Topic = '<a target="main" href=\'Boards/'+Topic;
  1546. var t = cols[1].indexOf('>');
  1547. var Originator = cols[1].slice(t+1);
  1548. var t = cols[2].indexOf('>');
  1549. var Posts = cols[2].slice(t+1);
  1550. var t = cols[3].indexOf('>');
  1551. var Last_Poster = cols[3].slice(t+1);
  1552. var t = cols[4].indexOf('>');
  1553. var Last_Post = cols[4].slice(t+1);
  1554. var t = cols[5].indexOf('>');
  1555. var Last_Posted = cols[5].slice(t+1);
  1556. }else{
  1557. var t = cols[2].indexOf('>');
  1558. var Topic = cols[2].slice(t+1);
  1559. //var Topic = cols[3].slice(t+10);
  1560. //var Topic = '<a target="main" href=\'Boards/'+Topic;
  1561. var t = cols[3].indexOf('>');
  1562. var Originator = cols[3].slice(t+1);
  1563. var t = cols[4].indexOf('>');
  1564. var Posts = cols[4].slice(t+1);
  1565. var t = cols[5].indexOf('>');
  1566. var Last_Poster = cols[5].slice(t+1);
  1567. var t = cols[6].indexOf('>');
  1568. var Last_Post = cols[6].slice(t+1);
  1569. var t = cols[7].indexOf('>');
  1570. var Last_Posted = cols[7].slice(t+1);
  1571. }
  1572. newPostsText = newPostsText+'<tr bgcolor="#222222">'+Topic+'</td><td width="15%" nowrap>'+Originator+'</td><td align="center" width="5%" nowrap>'+Posts+'</td><td width="25%" nowrap>'+Last_Poster+'</td><td width="25%" nowrap>'+Last_Post+'</td><td width="25%" nowrap>'+Last_Posted+'</td></tr>';
  1573. }
  1574. }
  1575. if(count >= 1){
  1576. if(update === 1){
  1577. if(count >= 2){ pleral = 's'; }else{ pleral = ''; }
  1578. var t = '<br><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr bgcolor="#222222"><td colspan=5><table width="100%"><tr><td><span onmouseover="this.style.cursor=\'pointer\';" id="Refresh_'+BoardID+'"><img src="http://www.ghqnet.com/sites/SOL/Files/refresh-icon.png"></span> '+menuLinksArr[boardLinks[i]].parentNode.innerHTML+' - '+count+' New Post'+pleral+' - <span onmouseover="this.style.cursor=\'pointer\';" id="MarkRead_'+BoardID+'"><font style="color: Orange; font-size: small"><strong>Mark Board as "Read"</strong></font></span></td><td align="right"><span onmouseover="this.style.cursor=\'pointer\';" id="IgnoreBoard_'+BoardID+'"><font style="color: Orange; font-size: small"><strong>Permanently Ignore Board</strong></font></span></td></tr></table></td></tr><tr bgcolor="#222222"><td width="47.5%"><b>Topic</b></td><td><b>Originator</b></td><td align="center"><b>Posts</b></td><td><b>Last Poster</b></td><td><b>Last Post</b></td></tr>';
  1579. t = t + newPostsText;
  1580. var s = myRef.document.getElementById('table_'+BoardID);
  1581. s.innerHTML = t;
  1582. myRef.document.getElementById('MarkRead_'+BoardID).addEventListener("click", function(){links_MarkBoardRead(this);}, false);
  1583. myRef.document.getElementById('IgnoreBoard_'+BoardID).addEventListener("click", function(){links_IgnoreBoard(this);}, false);
  1584. myRef.document.getElementById('Refresh_'+BoardID).addEventListener("click", function(){links_RefreshBoard(this);}, false);
  1585. return;
  1586. }else{
  1587. menuLinksArr[boardLinks[i]].parentNode.innerHTML = '<span name="NEW"><img src="http://www.ghqnet.com/sites/SOL/Files/newpost.png"> </span>'+menuLinksArr[boardLinks[i]].parentNode.innerHTML;
  1588. if(count >= 2){ pleral = 's'; }else{ pleral = ''; }
  1589. myRef.document.write('<span id="ID_'+BoardID+'" style="display:none">'+i+'</span><span id="boardIDName_'+BoardID+'" style="display:none">'+menuLinksArr[boardLinks[i]].innerHTML+'</span><span id="table_'+BoardID+'"><br><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr bgcolor="#222222"><td colspan=5><table width="100%"><tr><td><span onmouseover="this.style.cursor=\'pointer\';" id="Refresh_'+BoardID+'"><img src="http://www.ghqnet.com/sites/SOL/Files/refresh-icon.png"></span> '+menuLinksArr[boardLinks[i]].parentNode.innerHTML+' - '+count+' New Post'+pleral+' - <span onmouseover="this.style.cursor=\'pointer\';" id="MarkRead_'+BoardID+'"><font style="color: Orange; font-size: small"><strong>Mark Board as "Read"</strong></font></span></td><td align="right"><span onmouseover="this.style.cursor=\'pointer\';" id="IgnoreBoard_'+BoardID+'"><font style="color: Orange; font-size: small"><strong>Permanently Ignore Board</strong></font></span></td></tr></table></td></tr><tr bgcolor="#222222"><td width="47.5%"><b>Topic</b></td><td><b>Originator</b></td><td align="center"><b>Posts</b></td><td><b>Last Poster</b></td><td><b>Last Post</b></td></tr>');
  1590. myRef.document.write(newPostsText);
  1591. myRef.document.write('</table></span>');
  1592. myRef.document.getElementById('MarkRead_'+BoardID).addEventListener("click", function(){links_MarkBoardRead(this);}, false);
  1593. myRef.document.getElementById('IgnoreBoard_'+BoardID).addEventListener("click", function(){links_IgnoreBoard(this);}, false);
  1594. myRef.document.getElementById('Refresh_'+BoardID).addEventListener("click", function(){links_RefreshBoard(this);}, false);
  1595. }
  1596. }else{
  1597. if(update === 1){
  1598. var t = '<br><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr bgcolor="#222222"><td colspan=5><table width="100%"><tr><td><span onmouseover="this.style.cursor=\'pointer\';" id="Refresh_'+BoardID+'"><img src="http://www.ghqnet.com/sites/SOL/Files/refresh-icon.png"></span> '+menuLinksArr[boardLinks[i]].parentNode.innerHTML+' - 0 New Posts</td><td align="right"><span onmouseover="this.style.cursor=\'pointer\';" id="IgnoreBoard_'+BoardID+'"><font style="color: Orange; font-size: small"><strong>Permanently Ignore Board</strong></font></span></td></tr></table></td></tr><tr bgcolor="#222222"><td width="47.5%"><b>Topic</b></td><td><b>Originator</b></td><td align="center"><b>Posts</b></td><td><b>Last Poster</b></td><td><b>Last Post</b></td></tr><tr bgcolor="#222222"><td colspan="5" align="center">No New Posts</td></tr>';
  1599. var s = myRef.document.getElementById('table_'+BoardID);
  1600. s.innerHTML = t;
  1601. myRef.document.getElementById('IgnoreBoard_'+BoardID).addEventListener("click", function(){links_IgnoreBoard(this);}, false);
  1602. myRef.document.getElementById('Refresh_'+BoardID).addEventListener("click", function(){links_RefreshBoard(this);}, false);
  1603. return;
  1604. }else{
  1605. // menuLinksArr[boardLinks[i]].parentNode.innerHTML = '<span name="NEW"><img src="http://www.ghqnet.com/sites/SOL/Files/newpost.png"> </span>'+menuLinksArr[boardLinks[i]].parentNode.innerHTML;
  1606. myRef.document.write('<span id="ID_'+BoardID+'" style="display:none">'+i+'</span><span id="boardIDName_'+BoardID+'" style="display:none">'+menuLinksArr[boardLinks[i]].innerHTML+'</span><span id="table_'+BoardID+'"><br><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr bgcolor="#222222"><td colspan=4><table width="100%"><tr><td><span onmouseover="this.style.cursor=\'pointer\';" id="Refresh_'+BoardID+'"><img src="http://www.ghqnet.com/sites/SOL/Files/refresh-icon.png"></span> '+menuLinksArr[boardLinks[i]].parentNode.innerHTML+' - 0 New Posts - <span onmouseover="this.style.cursor=\'pointer\';" id="MarkRead_'+BoardID+'"><font style="color: Orange; font-size: small"><strong>Mark Board as "Read"</strong></font></span></td><td align="right"><span onmouseover="this.style.cursor=\'pointer\';" id="IgnoreBoard_'+BoardID+'"><font style="color: Orange; font-size: small"><strong>Permanently Ignore Board</strong></font></span></td></tr></table></td></tr><tr bgcolor="#222222"><td colspan="5" align="center">No New Posts</td></tr>');
  1607. // myRef.document.write(newPostsText);
  1608. myRef.document.write('</table></span>');
  1609. myRef.document.getElementById('MarkRead_'+BoardID).addEventListener("click", function(){links_MarkBoardRead(this);}, false);
  1610. myRef.document.getElementById('IgnoreBoard_'+BoardID).addEventListener("click", function(){links_IgnoreBoard(this);}, false);
  1611. myRef.document.getElementById('Refresh_'+BoardID).addEventListener("click", function(){links_RefreshBoard(this);}, false);
  1612. }
  1613. }
  1614. notify('<center>'+menuLinksArr[boardLinks[i]].innerHTML+'<br>'+count+' New Posts</center>');
  1615. i++;
  1616. percentage = i / totalboards;
  1617. percentage = Math.round(percentage * 100);
  1618. myRef.document.getElementById('progress').innerHTML = i;
  1619. myRef.document.getElementById('percent').innerHTML = percentage;
  1620. var a = myRef.document.getElementsByTagName('a');
  1621. for (var z = 0; z <a.length; z++){
  1622. a[z].target = "main";
  1623. if(a[z].href.indexOf('ShowPost.asp') != -1 && a[z].href.indexOf('Boards/') == -1){
  1624. //if(a[z].innerHTML == 'Newest'){
  1625. t = a[z].href.indexOf('ghqnet.com/') //SPLIT THE HTTP:SOL SHIT OUT AND PUT IN BOARDS/
  1626.  
  1627.  
  1628. if(t!=-1){
  1629. var val = a[z].href.slice(t+11);
  1630. a[z].href = 'Boards/'+val;
  1631. }
  1632. }
  1633.  
  1634. }
  1635. links_CheckforNewPostsOnBoard(i, 0);
  1636. }
  1637. });
  1638. }
  1639. function links_CheckforNewPosts(t) {
  1640. var allNew = document.getElementsByName("NEW");
  1641. for(var i=0; i<allNew.length; ++i){
  1642. allNew[i].parentNode.removeChild( allNew[i] );
  1643. i--;
  1644. }
  1645. myRef = window.open('about:blank','newPostsPage','left=20,top=20,width=1000,height=500,scrollbars=1');
  1646. if(ignorecount >= 2){ pleral = 's'; }else{ pleral = ''; }
  1647. myRef.document.body.innerHTML = ''; //FIREFOX OLD
  1648. myRef.document.write('<meta content="Earth, Military, Army, Navy, Marines, Air Force, Jets, Troops, Spies, Games" name="keywords"><html><head><meta content="en-us" http-equiv="Content-Language"></head><body background="" bgcolor="black" link="#00C0FF" text="#DDDDDD" vlink="#d3d3d3"><style type="text/css"> a:hover { text-decoration: underline; } td { font-family: verdana, ariel, Helvetica, sans-serif; font-size: 14px; } .style1 { text-align: center; font-size: small; } .style2 { font-size: x-small; } </style><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr bgcolor="#222222"><td class="style1"><strong>Boards with New Posts<br><span id="progress">0</span> of '+count+' Processed - <span id="percent">0</span>% Completed - Ignoring '+ignorecount+' Board'+pleral+'<br></strong><span class="style2">Click on a Board Name or a Post to go to that page.<br>Click on &quot;Mark Board Read&quot; to mark all posts as read.<br>Click &quot;Ignore Board&quot; to no longer parse this board for new Posts. (Less Boards Monitored = Quicker Processing)</span></td></tr></table>');
  1649. links_CheckforNewPostsOnBoard(0, 0);
  1650. }
  1651. var curTime = "";
  1652. var myRef = '';
  1653. var patt5=/ShowBoard\.asp\?board=.+/i; //Is it a board link?
  1654. var menuLinksArr = document.getElementsByTagName("a");
  1655. var boardLinks = new Array();
  1656. var newPostsArr = new Array();
  1657. var temp = '';
  1658. var count = 0;
  1659. var ignorecount = 0;
  1660. var boardsignore = getSetting( 'boards_ignore', ' ' );
  1661. for(var i = 0; i<menuLinksArr.length; i++) {
  1662. var isBoard = menuLinksArr[i].href.match(patt5);
  1663. if(isBoard === null){ continue; }
  1664. if(count == 0 && ignorecount == 0){
  1665. temp = menuLinksArr[i].innerHTML;
  1666. }else{
  1667. temp = temp+'::::::'+menuLinksArr[i].innerHTML;
  1668. }
  1669. if(boardsignore.indexOf('::::::'+menuLinksArr[i].innerHTML+'::::::') != -1){
  1670. ignorecount++;
  1671. continue;
  1672. }
  1673. boardLinks[count] = i;
  1674. count++;
  1675. }
  1676. var totalboards = count;
  1677. setSetting( 'menuBoards', temp );
  1678. var allTR = document.getElementsByTagName('tr'); // get all TD elements
  1679. var editing = false;
  1680. var row = allTR[0].parentNode.insertRow(0);
  1681. var cell = row.insertCell(0);
  1682. cell.bgColor = allTR[1].bgColor;
  1683. row.bgColor = allTR[1].bgColor;
  1684. cell.align = 'center';
  1685. cell.innerHTML = '<font color="orange"><strong>GHQEditor</strong></font>';
  1686.  
  1687. var row = allTR[0].parentNode.insertRow(1);
  1688. var cell = row.insertCell(0);
  1689. cell.bgColor = allTR[3].bgColor;
  1690. row.bgColor = allTR[3].bgColor;
  1691. cell.align = 'center';
  1692. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: 12px;">Edit Menu Items</font></span>';
  1693. cell.addEventListener("click", function(){links_ShowEdits();}, false);
  1694. /*
  1695. var row = allTR[0].parentNode.insertRow(2);
  1696. var cell = row.insertCell(0);
  1697. cell.bgColor = allTR[1].bgColor;
  1698. row.bgColor = allTR[1].bgColor;
  1699. cell.align = 'center';
  1700. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: 12px;">Reset Menu Items</font></span>';
  1701. cell.addEventListener("click", function(){links_ResetMenuVerify();}, false);
  1702. */
  1703. var row = allTR[0].parentNode.insertRow(2);
  1704. var cell = row.insertCell(0);
  1705. cell.bgColor = allTR[1].bgColor;
  1706. row.bgColor = allTR[1].bgColor;
  1707. cell.align = 'center';
  1708.  
  1709. if(browser === 'Firefox'){
  1710. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: 12px; text-decoration: line-through;">Check 4 New Posts</font></span>';
  1711. }else{
  1712. cell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\';"><font style="color: Orange; font-size: 12px;">Check 4 New Posts</font></span>';
  1713. cell.addEventListener("click", function(){links_CheckforNewPostsVerify();}, false);
  1714. }
  1715.  
  1716. var row = allTR[0].parentNode.insertRow(-1);
  1717. var cell = row.insertCell(0);
  1718. cell.align = 'center';
  1719. cell.innerHTML = '<font style="color: Orange; font-size: 14px;"><b>____________</b></font>';
  1720. row.style.display = 'none';
  1721. row.id = 'EditMenuTitle_'+row.rowIndex;
  1722. var row = allTR[0].parentNode.insertRow(-1);
  1723. var cell = row.insertCell(0);
  1724. cell.bgColor = allTR[0].bgColor;
  1725. row.bgColor = allTR[0].bgColor;
  1726. row.id = 'EditMenuTitle_'+row.rowIndex;
  1727. cell.align = 'center';
  1728. cell.innerHTML = '<font style="color: Orange; font-size: 14px;"><b>HIDDEN ITEMS</b></font>';
  1729. row.style.display = 'none';
  1730. row.id = 'EditMenuTitle_'+row.rowIndex;
  1731. var links = getSetting( 'Links', '' );
  1732. var linksarr = links.split('::::::');
  1733. if(linksarr.length != 0){
  1734. for(var i=0; i<allTR.length; ++i){
  1735. var val = allTR[i].firstChild.firstChild.innerHTML;
  1736. if(allTR[i].id.slice(0, 14) == 'EditMenuTitle_' || allTR[i].id.slice(0, 6) == 'Moved_'){
  1737. break;
  1738. }
  1739. if(allTR[i].id == ''){
  1740. allTR[i].id = 'EditMenu_'+allTR[i].rowIndex;
  1741. }
  1742. if(links.indexOf(':::'+val+':::')!=-1){
  1743. var obj = allTR[i].cloneNode(true);
  1744. var id = obj.id.substr(9);
  1745. obj.id = 'Moved_'+id;
  1746. var s = allTR[i].parentNode.appendChild(obj);
  1747. s.firstChild.addEventListener("click", function(){links_UnMoveMenuItem(this);}, false);
  1748. allTR[i].style.display = 'none';
  1749. s.style.display = 'none';
  1750. }
  1751. }
  1752. }
  1753. }
  1754. // ########################################################################################################################################################
  1755. // ########################################################################################################################################################
  1756. // ########################################################################################################################################################
  1757. // ########################################################################################################################################################
  1758. // ########################################################################################################################################################
  1759. // ########################################################################################################################################################
  1760. // ########################################################################################################################################################
  1761. function siteManager() {
  1762. var allTA = document.getElementsByTagName('textarea'); // get all TD elements
  1763. for(var i=0; i<allTA.length; ++i){
  1764. if(allTA[i].name == 'HeadlineTitle'){
  1765. allTA[i].cols = 75;
  1766. allTA[i].rows = 6;
  1767. }
  1768. }
  1769. }
  1770. // ########################################################################################################################################################
  1771. // ########################################################################################################################################################
  1772. // ########################################################################################################################################################
  1773. // ########################################################################################################################################################
  1774. // ########################################################################################################################################################
  1775. // ########################################################################################################################################################
  1776. // ########################################################################################################################################################
  1777. function targetInfo() {
  1778. function targetInfo_hideRow(t, type) {
  1779. if(Hide[t.id] === undefined){
  1780. Hide[t.id] = new Array();
  1781. }
  1782. if(Hide[t.id][type] === undefined){
  1783. Hide[t.id][type] = true;
  1784. }
  1785. t.style.display = 'none';
  1786. }
  1787. function targetInfo_unHideRow(t, type) {
  1788. if(Hide[t.id] === undefined){
  1789. return;
  1790. }
  1791. if(Hide[t.id][type] === undefined){
  1792. return;
  1793. }
  1794. delete Hide[t.id][type];
  1795. for (var i = 0; i < Hide[t.id].length; ++i){ //CHROME FIX - WAS a for each
  1796. if(Hide[t.id][i]){
  1797. return;
  1798. }
  1799. }
  1800. delete Hide[t.id];
  1801. t.style.display = '';
  1802. }
  1803. function targetInfo_filter(t) {
  1804. var Name = t.id.substr(7);
  1805. var Value = t.value;
  1806. var CellIndex = t.parentNode.cellIndex;
  1807. switch (Name){
  1808. case 'GDI':
  1809. for(var i=0; i<allTR.length; ++i){
  1810. if(allTR[i].id === undefined){ continue; }
  1811. if(allTR[i].id == ''){ continue; }
  1812. if(Value == ''){
  1813. targetInfo_unHideRow(allTR[i], Name);
  1814. continue;
  1815. }
  1816. if(Value == allTR[i].cells[CellIndex].firstChild.innerHTML){
  1817. targetInfo_unHideRow(allTR[i], Name);
  1818. }else{
  1819. targetInfo_hideRow(allTR[i], Name);
  1820. }
  1821. }
  1822. break;
  1823. case 'Age':
  1824. case 'NW':
  1825. case 'Land':
  1826. case 'Spal':
  1827. case 'SDI':
  1828. var Operator = Value.substr(0, 1);
  1829. var Value = Value.substr(1);
  1830. for(var i=0; i<allTR.length; ++i){
  1831. if(allTR[i].id === undefined){ continue; }
  1832. if(allTR[i].id == ''){ continue; }
  1833. if(Value == ''){
  1834. targetInfo_unHideRow(allTR[i], Name);
  1835. continue;
  1836. }
  1837. if(Name == 'Age'){
  1838. var TRValue = allTR[i].cells[CellIndex].firstChild.firstChild.innerHTML;
  1839. }else if( Name == 'Spal'){
  1840. var TRValue = allTR[i].cells[CellIndex].firstChild.innerHTML;
  1841. }else if( Name == 'SDI'){
  1842. var TRValue = allTR[i].cells[CellIndex].firstChild.firstChild.innerHTML.slice(0, -1);
  1843. }else if( Name == 'Land'){
  1844. var TRValue = allTR[i].cells[CellIndex].firstChild.innerHTML.replace(/\,/g,'');
  1845. }else{
  1846. var TRValue = allTR[i].cells[CellIndex].firstChild.innerHTML;
  1847. }
  1848.  
  1849. if(Operator == '>'){
  1850. if(parseFloat(TRValue) >= parseFloat(Value)){
  1851. targetInfo_unHideRow(allTR[i], Name);
  1852. }else{
  1853. targetInfo_hideRow(allTR[i], Name);
  1854. }
  1855. }else{
  1856. if(parseFloat(TRValue) < parseFloat(Value)){
  1857. targetInfo_unHideRow(allTR[i], Name);
  1858. }else{
  1859. targetInfo_hideRow(allTR[i], Name);
  1860. }
  1861. }
  1862. }
  1863. break;
  1864. case 'NWDiff':
  1865. case 'LandDiff':
  1866. for(var i=0; i<allTR.length; ++i){
  1867. if(allTR[i].id === undefined){ continue; }
  1868. if(allTR[i].id == ''){ continue; }
  1869. if(Value == ''){
  1870. targetInfo_unHideRow(allTR[i], Name);
  1871. continue;
  1872. }
  1873. if(allTR[i].cells[CellIndex].firstChild.innerHTML != '' && allTR[i].cells[CellIndex].firstChild.innerHTML != '0'){
  1874. targetInfo_unHideRow(allTR[i], Name);
  1875. }else{
  1876. targetInfo_hideRow(allTR[i], Name);
  1877. }
  1878. }
  1879. break;
  1880. default:
  1881. break;
  1882. }
  1883. }
  1884. function targetInfo_quickSets(t) {
  1885. if(t == 'UnHide'){
  1886. for(var i=0; i<allTR.length; ++i){
  1887. targetInfo_unHideRow(allTR[i], 'Hide');
  1888. }
  1889. }else if(t == 'Filters'){
  1890. var allSelects = document.getElementsByTagName('select');
  1891. for(var i=0; i<allSelects.length; ++i){
  1892. for(var x=0; x<allSelects[i].length; ++x){
  1893. if(allSelects[i].options[x].value == ''){
  1894. allSelects[i].selectedIndex = allSelects[i].options[x].index;
  1895. break;
  1896. }
  1897. }
  1898. }
  1899. for(var x=0; x<allTR.length; ++x){
  1900. var Name = allTR[x].id.substr(7);
  1901. allTR[x].style.display = '';
  1902. delete Hide;
  1903. var Hide = new Array;
  1904. }
  1905. }else{
  1906. var NW = $('Filter_NWDiff');
  1907. var Land = $('Filter_LandDiff');
  1908. var NW_Name = NW.id.substr(7);
  1909. var NW_Value = NW.value;
  1910. var NW_CellIndex = NW.parentNode.cellIndex;
  1911. var Land_Name = Land.id.substr(7);
  1912. var Land_Value = Land.value;
  1913. var Land_CellIndex = Land.parentNode.cellIndex;
  1914. for(var x=0; x<allTR.length; ++x){
  1915. var Name = allTR[x].id.substr(7);
  1916. allTR[x].style.display = '';
  1917. delete Hide;
  1918. var Hide = new Array;
  1919. if(allTR[x].id === undefined){ continue; }
  1920. if(allTR[x].id === ''){ continue; }
  1921. if(allTR[x].cells[NW_CellIndex].firstChild.innerHTML == '0' && allTR[x].cells[Land_CellIndex].firstChild.innerHTML == '0'){
  1922. targetInfo_hideRow(allTR[x], Name);
  1923. }else{
  1924. targetInfo_unHideRow(allTR[x], Name);
  1925. }
  1926. }
  1927. }
  1928. }
  1929. var allTR = document.getElementsByTagName('tr'); // get all TD elements
  1930. Hide = new Array();
  1931. Data = new Array();
  1932. var allTH = document.getElementsByTagName('th'); // get all TD elements
  1933. for(var i=0; i<allTH.length; ++i){
  1934. if(allTH[i].innerHTML.slice(-11, -4) == 'Country' ){
  1935. var table = allTH[i].parentNode.parentNode;
  1936. table.id = 'CountryTable';
  1937. var header = 'Number';
  1938. num = 10000;
  1939. for (var x=0; x<table.rows.length; x++) {
  1940. var newCell = table.rows[x].insertCell(i+1);
  1941. newCell.bgColor = '#222222';
  1942. newCell.align = 'center';
  1943. if(x == 0){
  1944. newCell.innerHTML = '<text color=#DDDDDD><b>'+header+'</b></font>';
  1945. }else{
  1946. newCell.innerHTML = '';
  1947. newCell.id = num+'_CountryNumber';
  1948. num++;
  1949. }
  1950. var newCell = table.rows[x].insertCell(i);
  1951. newCell.bgColor = '#222222';
  1952. newCell.align = 'center';
  1953. if(x == 0){
  1954. newCell.innerHTML = '<text color=#DDDDDD><b>Hide Country</b></font>';
  1955. }else{
  1956. newCell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'">Hide</span>';
  1957. newCell.id = 'Hide_'+x;
  1958. newCell.addEventListener("click", function(){targetInfo_hideRow(this.parentNode, 'Hide');}, false);
  1959. }
  1960. }
  1961. }
  1962. }
  1963. var sp1 = document.createElement("span");
  1964. sp1.innerHTML = '<table width="100%"><tr><td align="right">QUICKSETS: <button style="color: orange; font-family: Verdana, Helvetica, Arial; font-size: 10 pt; font-weight: bold; background-color: #191919; border: 2px #444444 solid" id="QuickSet_NWLandChange" onClick="return false;">Show only NW OR Land Changes</button> - <button style="color: red; font-family: Verdana, Helvetica, Arial; font-size: 10 pt; font-weight: bold; background-color: #191919; border: 2px #444444 solid" id="QuickSet_UnHide" onClick="return false;">UnHide All Rows</button><button style="color: red; font-family: Verdana, Helvetica, Arial; font-size: 10 pt; font-weight: bold; background-color: #191919; border: 2px #444444 solid" id="QuickSet_Filters" onClick="return false;"><strong>Reset Filters</strong></button></td></td></table>';
  1965. table.parentNode.parentNode.insertBefore(sp1, table.parentNode);
  1966. document.getElementById("QuickSet_NWLandChange").addEventListener("click", function(){targetInfo_quickSets("NWLandChange");}, false);
  1967. document.getElementById("QuickSet_UnHide").addEventListener("click", function(){targetInfo_quickSets("UnHide");}, false);
  1968. document.getElementById("QuickSet_Filters").addEventListener("click", function(){targetInfo_quickSets("Filters");}, false);
  1969.  
  1970. var row = table.insertRow(0);
  1971. var cell = row.insertCell(0);
  1972. cell.colSpan = table.rows[1].cells.length;
  1973. cell.innerHTML = '';
  1974. var allTH = table.getElementsByTagName('th'); // get all TD elements
  1975. var row = table.insertRow(1);
  1976. for(var i=0; i<allTH.length; ++i){
  1977. var column = allTH[i].firstChild.innerHTML;
  1978. Data[allTH[i].cellIndex] = column;
  1979. }
  1980. for(var i=0; i<table.rows[2].cells.length; ++i){
  1981. var cell = row.insertCell(i);
  1982. cell.bgColor = 'black';
  1983. if(i == 0){
  1984. cell.align = 'center';
  1985. cell.innerHTML = '<a href="javascript:location.reload()">Refresh this page</a>';
  1986. continue;
  1987. }
  1988. if(i == 2){
  1989. cell.align = 'right';
  1990. cell.innerHTML = 'FILTERS: ';
  1991. continue;
  1992. }
  1993. cell.align = 'center';
  1994. if(Data[i] === undefined){
  1995. cell.innerHTML = ' ';
  1996. continue;
  1997. }
  1998.  
  1999. switch (Data[i])
  2000. {
  2001. case 'GDI':
  2002. cell.innerHTML = '<select name="Filter_GDI" id="Filter_GDI" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option> </option><option>Y</option></select>';
  2003. document.getElementById("Filter_GDI").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2004. break;
  2005. case 'Age(h)':
  2006. cell.innerHTML = '<select name="Filter_Age" id="Filter_Age" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<24"><24</option><option value="<6"><6</option><option value="<2"><2</option><option selected value=""> </option><option value=">2">>2</option><option value=">6">>6</option><option value=">12">>12</option><option value=">24">>24</option></select>';
  2007. document.getElementById("Filter_Age").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2008. break;
  2009. case 'NW(M)':
  2010. cell.innerHTML = '<select name="Filter_NW" id="Filter_NW" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<5"><5m</option><option value="<1"><1m</option><option value="<0.5"><500k</option><option selected value=""> </option><option value=">0.5">>500k</option><option value=">1">>1m</option><option value=">2">>2m</option><option value=">5">>5m</option></select>';
  2011. document.getElementById("Filter_NW").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2012. break;
  2013. case 'NW Diff':
  2014. cell.innerHTML = '<select name="Filter_NWDiff" id="Filter_NWDiff" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value=""> </option><option value="Changed">Changed</option></select>';
  2015. document.getElementById("Filter_NWDiff").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2016. break;
  2017. case 'Land':
  2018. cell.innerHTML = '<select name="Filter_Land" id="Filter_Land" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<10000"><10000</option><option value="<5000"><5000</option><option selected value=""> </option><option value=">1000">>1000</option><option value=">5000">>5000</option><option value=">10000">>10000</option><option value=">20000">>20000</option></select>';
  2019. document.getElementById("Filter_Land").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2020. break;
  2021. case 'Land Diff':
  2022. cell.innerHTML = '<select name="Filter_LandDiff" id="Filter_LandDiff" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value=""> </option><option value="Changed">Changed</option></select>';
  2023. document.getElementById("Filter_LandDiff").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2024. break;
  2025. case 'Spal':
  2026. cell.innerHTML = '<select name="Filter_Spal" id="Filter_Spal" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<75"><75</option><option value="<50"><50</option><option value="<25"><25</option><option value="<15"><15</option><option selected value=""> </option></select>';
  2027. document.getElementById("Filter_Spal").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2028. break;
  2029. case 'SDI':
  2030. cell.innerHTML = '<select name="Filter_SDI" id="Filter_SDI" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<50"><50%</option><option value="<25"><25%</option><option value="<10"><10%</option><option selected value=""> </option></select>';
  2031. document.getElementById("Filter_SDI").addEventListener("change", function(){targetInfo_filter(this);}, false);
  2032. break;
  2033. default:
  2034. continue;
  2035. break;
  2036. }
  2037. }
  2038. var allTD = table.getElementsByTagName('td'); // get all TD elements
  2039. var number = 10000;
  2040. for(var i=0; i<allTD.length; ++i){
  2041. if(allTD[i].parentNode.rowIndex <= 2){
  2042. continue;
  2043. }
  2044. var Name = Data[allTD[i].cellIndex];
  2045. if(Name != undefined){
  2046. allTD[i].id = number+'_'+Name;
  2047. number++;
  2048. }
  2049. if(allTD[i].id == ''){
  2050. continue;
  2051. }
  2052. if(allTD[i].id.substr(6) == 'CountryNumber'){
  2053. var last = i-1;
  2054. // var num = allTD[last].innerHTML.split('#'); // OLD FIREFOX
  2055. // allTD[i].innerHTML = num[1].slice(0, -5); // OLD FIREFOX
  2056. var num = allTD[last].firstChild.innerHTML.split('#'); //CHROME FIX
  2057. allTD[i].innerHTML = num[1].slice(0, -1); //CHROME FIX
  2058. allTD[last].noWrap = true;
  2059. allTD[i].parentNode.id = 'TR_'+num[1].slice(0, -1);
  2060. }
  2061. if(Name == undefined){
  2062. continue;
  2063. }
  2064. switch (Name)
  2065. {
  2066. case 'GDI':
  2067. var val = allTD[i].innerHTML;
  2068. if(val!=''){
  2069. allTD[i].bgColor = 'DarkRed';
  2070. }
  2071. break;
  2072. case 'Age(h)':
  2073. var val = allTD[i].firstChild.firstChild.innerHTML;
  2074. if(val <= 2 && val!=''){
  2075. allTD[i].bgColor = 'DarkGreen';
  2076. }else if(val >= 12){
  2077. allTD[i].bgColor = 'DarkRed';
  2078. }else if(val >= 3){
  2079. allTD[i].bgColor = '#800080';
  2080. }else{
  2081. allTD[i].bgColor = '#222222';
  2082. }
  2083. break;
  2084. case 'NW Diff':
  2085. var val = allTD[i].firstChild.innerHTML;
  2086. if(val!='' && val != 0){
  2087. allTD[i].bgColor = 'DarkRed';
  2088. }
  2089. break;
  2090. case 'Land Diff':
  2091. var val = allTD[i].firstChild.innerHTML;
  2092. if(val!='' && val!='0'){
  2093. allTD[i].bgColor = 'DarkRed';
  2094. }
  2095. break;
  2096. case 'Spal':
  2097. var val = allTD[i].firstChild.innerHTML;
  2098. if(val == ''){ continue; }
  2099. if(val <= 25){
  2100. allTD[i].bgColor = 'DarkGreen';
  2101. }else if(val >= 50){
  2102. allTD[i].bgColor = 'DarkRed';
  2103. }else{
  2104. allTD[i].bgColor = '#800080';
  2105. }
  2106. break;
  2107. case 'SDI':
  2108. var val = allTD[i].firstChild.innerHTML.slice(0, -1);
  2109. if(val <= 24 && val!=''){
  2110. allTD[i].bgColor = 'DarkGreen';
  2111. }else if(val >= 50){
  2112. allTD[i].bgColor = 'DarkRed';
  2113. }else if(val >= 25){
  2114. allTD[i].bgColor = '#800080';
  2115. }else{
  2116. allTD[i].bgColor = '#222222';
  2117. }
  2118. break;
  2119.  
  2120. default:
  2121. continue;
  2122. break;
  2123. }
  2124. }
  2125. var NW = $('Filter_NWDiff');
  2126. var Land = $('Filter_LandDiff');
  2127. if(NW === undefined || Land === undefined){
  2128. var b = $('QuickSet_NWLandChange');
  2129. b.parentNode.removeChild(b);
  2130. }
  2131.  
  2132. }
  2133. // ########################################################################################################################################################
  2134. // ########################################################################################################################################################
  2135. // ########################################################################################################################################################
  2136. // ########################################################################################################################################################
  2137. // ########################################################################################################################################################
  2138. // ########################################################################################################################################################
  2139. // ########################################################################################################################################################
  2140. function targetSelector() {
  2141. function targetSelector_quickSets(t) {
  2142. for(var i=0; i<allInputs.length; ++i){
  2143. if(allInputs[i].type == 'checkbox'){
  2144. allInputs[i].checked = false;
  2145. }
  2146. }
  2147. for(var i=0; i<Data[t].length; ++i){
  2148. var temp = Data[t][i];
  2149. document.getElementById(temp).checked = true;
  2150. }
  2151. }
  2152. var Data = new Array();
  2153. Data['SiG'] = new Array('Tag', 'Age', 'Networth', 'NWDiff', 'Land', 'LandDiff', 'Spies', 'Spal', 'Missiles');
  2154. Data['Warmod'] = new Array();
  2155. var allTD; // holds collection of all TD elements
  2156. allTD = document.getElementsByTagName('td'); // get all TD elements
  2157. var allInputs = document.getElementsByTagName("input");
  2158. var number = 0;
  2159. for(var i=0; i<allInputs.length; ++i){
  2160. allInputs[i].id = allInputs[i].name;
  2161. if(allInputs[i].type == 'checkbox'){
  2162. if(allInputs[i].checked == true){
  2163. Data['Warmod'][number] = allInputs[i].id;
  2164. number++;
  2165. }
  2166. }
  2167. }
  2168. for(var i=0; i<allTD.length; ++i){
  2169. if(allTD[i].innerHTML == "Select your desired fields"){
  2170. allTD[i].innerHTML = allTD[i].innerHTML + '<BR>QUICKSETS: <button style="color: darkturquoise; font-family: Verdana, Helvetica, Arial; font-size: 10 pt; font-weight: bold; background-color: #191919; border: 2px #444444 solid" id="QuickSet_Warmod" onClick="return false;"><strong>Warmod</strong></button> | <button style="color: DarkViolet; font-family: Verdana, Helvetica, Arial; font-size: 10 pt; font-weight: bold; background-color: #191919; border: 2px #444444 solid" id="QuickSet_SiG" onClick="return false;"><strong>SiG</strong></button>';
  2171. document.getElementById("QuickSet_Warmod").addEventListener("click", function(){targetSelector_quickSets("Warmod");}, false);
  2172. document.getElementById("QuickSet_SiG").addEventListener("click", function(){targetSelector_quickSets("SiG");}, false);
  2173. }
  2174. }
  2175. }
  2176. // ########################################################################################################################################################
  2177. // ########################################################################################################################################################
  2178. // ########################################################################################################################################################
  2179. // ########################################################################################################################################################
  2180. // ########################################################################################################################################################
  2181. // ########################################################################################################################################################
  2182. // ########################################################################################################################################################
  2183. function botList() {
  2184. function targetInfo_UnhideAll() {
  2185. Hide = [];
  2186. targetInfo_FullFilter();
  2187. }
  2188. function targetInfo_hideRow(t) {
  2189. Hide.push(t.id);
  2190. t.style.display = 'None';
  2191. }
  2192. function targetInfo_FullFilter() {
  2193. var Filter_Gov = document.getElementById("Filter_Gov").value;
  2194. var Filter_Gov2 = document.getElementById("Filter_Gov2").value;
  2195. var Filter_NWOperator = document.getElementById("Filter_NWOperator").value;
  2196. var Filter_NW = document.getElementById("Filter_NW").value;
  2197. var Filter_NWDiff = document.getElementById("Filter_NWDiff").value;
  2198. var Filter_LandOperator = document.getElementById("Filter_LandOperator").value;
  2199. var Filter_Land = document.getElementById("Filter_Land").value;
  2200. var Filter_LandDiff = document.getElementById("Filter_LandDiff").value;
  2201. var Filter_GDI = document.getElementById("Filter_GDI").value;
  2202. var Filter_Age = document.getElementById("Filter_Age").value;
  2203. var Filter_Def24 = document.getElementById("Filter_Def24").value;
  2204. var Filter_Def48 = document.getElementById("Filter_Def48").value;
  2205. var Filter_Def72 = document.getElementById("Filter_Def72").value;
  2206. var Filter_Strat = document.getElementById("Filter_Strat").value;
  2207. var Filter_Strat2 = document.getElementById("Filter_Strat2").value;
  2208. var Filter_StratPlanned = document.getElementById("Filter_StratPlanned").value;
  2209. var Filter_StratPlanned2 = document.getElementById("Filter_StratPlanned2").value;
  2210. var Filter_Tech = document.getElementById("Filter_Tech").value;
  2211. var Filter_JetsOperator = document.getElementById("Filter_JetsOperator").value;
  2212. var Filter_Jets = document.getElementById("Filter_Jets").value;
  2213. for (i = 2, row; row = table.rows[i]; i++) {
  2214. row.style.display = '';
  2215. if(Hide.includes(row.id)){
  2216. row.style.display = 'None';
  2217. }
  2218. var Value_Gov = row.cells[colID_Gov].firstChild.innerHTML;
  2219. var Value_NW = row.cells[colID_NW].firstChild.innerHTML;
  2220. var Value_NWDiff = row.cells[colID_NWDiff].firstChild.innerHTML;
  2221. var Value_Land = Number(row.cells[colID_Land].firstChild.innerHTML.replace(/\D/g,''));
  2222. var Value_LandDiff = row.cells[colID_LandDiff].firstChild.innerHTML;
  2223. var Value_GDI = row.cells[colID_GDI].firstChild.innerHTML;
  2224. var Value_Age = Number(row.cells[colID_Age].firstChild.innerHTML);
  2225. var Value_Def24 = Number(row.cells[colID_Def24].firstChild.innerHTML);
  2226. var Value_Def48 = Number(row.cells[colID_Def48].firstChild.innerHTML);
  2227. var Value_Def72 = Number(row.cells[colID_Def72].firstChild.innerHTML);
  2228. var Value_Strat = row.cells[colID_Strat].firstChild.innerHTML;
  2229. var Value_StratPlanned = row.cells[colID_StratPlanned].firstChild.innerHTML;
  2230. var Value_Tech = Number(row.cells[colID_Tech].firstChild.innerHTML.replace(/\D/g,''));
  2231. var Value_Jets = Number(row.cells[colID_Jets].firstChild.innerHTML.replace(/\D/g,''));
  2232. //CHECK GOV
  2233. document.getElementById("Filter_Gov2").style.display = 'none';
  2234. if(Filter_Gov != ""){
  2235. document.getElementById("Filter_Gov2").style.display = '';
  2236. }
  2237. if(Filter_Gov != Value_Gov && Filter_Gov2 != Value_Gov && Filter_Gov != ""){
  2238. row.style.display = 'none';
  2239. continue;
  2240. }
  2241. //CHECK Filter_NW
  2242. if(Filter_NWOperator == ">"){
  2243. if(Filter_NW > Value_NW && Filter_NW != ""){
  2244. row.style.display = 'none';
  2245. continue;
  2246. }
  2247. }else{
  2248. if(Filter_NW < Value_NW && Filter_NW != ""){
  2249. row.style.display = 'none';
  2250. continue;
  2251. }
  2252. }
  2253. //CHECK Filter_NWDiff
  2254. if(Filter_NWDiff == "Unchanged"){
  2255. if(Value_NWDiff != '' && Value_NWDiff != '0'){
  2256. row.style.display = 'none';
  2257. continue;
  2258. }
  2259. }else if(Filter_NWDiff == "Changed"){
  2260. if(Value_NWDiff == '' || Value_NWDiff == '0'){
  2261. row.style.display = 'none';
  2262. continue;
  2263. }
  2264. }
  2265. //CHECK Filter_Land
  2266. if(Filter_LandOperator == ">"){
  2267. if(Filter_Land >= Value_Land && Filter_Land != ""){
  2268. row.style.display = 'none';
  2269. continue;
  2270. }
  2271. }else{
  2272. if(Filter_Land <= Value_Land && Filter_Land != ""){
  2273. row.style.display = 'none';
  2274. continue;
  2275. }
  2276. }
  2277. //CHECK Filter_LandDiff
  2278. if(Filter_LandDiff == "Unchanged"){
  2279. if(Value_LandDiff != '' && Value_LandDiff != '0'){
  2280. row.style.display = 'none';
  2281. continue;
  2282. }
  2283. }else if(Filter_LandDiff == "Changed"){
  2284. if(Value_LandDiff == '' || Value_LandDiff == '0'){
  2285. row.style.display = 'none';
  2286. continue;
  2287. }
  2288. }
  2289. //CHECK Filter_GDI
  2290. if(Filter_GDI == "Y"){
  2291. if(Value_GDI != 'Y'){
  2292. row.style.display = 'none';
  2293. continue;
  2294. }
  2295. }else if(Filter_GDI == "N"){
  2296. if(Value_GDI == 'Y'){
  2297. row.style.display = 'none';
  2298. continue;
  2299. }
  2300. }
  2301. //CHECK Filter_Age
  2302. if(Filter_Age <= Value_Age && Filter_Age != ""){
  2303. row.style.display = 'none';
  2304. continue;
  2305. }
  2306. //CHECK Filter_Def24
  2307. if(Filter_Def24 < Value_Def24 && Filter_Def24 != ""){
  2308. row.style.display = 'none';
  2309. continue;
  2310. }
  2311. //CHECK Filter_Def48
  2312. if(Filter_Def48 < Value_Def48 && Filter_Def48 != ""){
  2313. row.style.display = 'none';
  2314. continue;
  2315. }
  2316. //CHECK Filter_Def72
  2317. if(Filter_Def72 < Value_Def72 && Filter_Def72 != ""){
  2318. row.style.display = 'none';
  2319. continue;
  2320. }
  2321. //CHECK Filter_Strat
  2322. document.getElementById("Filter_Strat2").style.display = 'none';
  2323. if(Filter_Strat != ""){
  2324. document.getElementById("Filter_Strat2").style.display = '';
  2325. }
  2326. if(Filter_Strat != Value_Strat && Filter_Strat2 != Value_Strat && Filter_Strat != ""){
  2327. row.style.display = 'none';
  2328. continue;
  2329. }
  2330. //CHECK Filter_StratPlanned
  2331. document.getElementById("Filter_StratPlanned2").style.display = 'none';
  2332. if(Filter_StratPlanned != ""){
  2333. document.getElementById("Filter_StratPlanned2").style.display = '';
  2334. }
  2335. if(Filter_StratPlanned != Value_StratPlanned && Filter_StratPlanned2 != Value_StratPlanned && Filter_StratPlanned != ""){
  2336. row.style.display = 'none';
  2337. continue;
  2338. }
  2339. //CHECK Filter_Tech
  2340. if(Filter_Tech > Value_Tech && Filter_Tech != ""){
  2341. row.style.display = 'none';
  2342. continue;
  2343. }
  2344. //CHECK Filter_Jets
  2345. if(Filter_JetsOperator == ">"){
  2346. if(Filter_Jets > Value_Jets && Filter_Jets != ""){
  2347. row.style.display = 'none';
  2348. continue;
  2349. }
  2350. }else{
  2351. if(Filter_Jets < Value_Jets && Filter_Jets != ""){
  2352. row.style.display = 'none';
  2353. continue;
  2354. }
  2355. }
  2356. }
  2357. }
  2358.  
  2359. var colID_Country = 1;
  2360. var colID_Gov = 3;
  2361. var colID_NW = 4;
  2362. var colID_NWDiff = 5;
  2363. var colID_Land = 6;
  2364. var colID_LandDiff = 7;
  2365. var colID_GDI = 9;
  2366. var colID_Age = 10;
  2367. var colID_Def24 = 11;
  2368. var colID_Def48 = 12;
  2369. var colID_Def72 = 13;
  2370. var colID_Strat = 14;
  2371. var colID_StratPlanned = 15;
  2372. var colID_Tech = 16;
  2373. var colID_Jets = 17;
  2374. var i = 0;
  2375. var Hide = new Array();
  2376. var row;
  2377. var table = document.getElementsByTagName('table')[3];
  2378. var sp1 = document.createElement("span");
  2379. sp1.innerHTML = '<table width="100%"><tr><td align="left"><a href="javascript:location.reload()">Refresh this page</a></td><td align="right">QUICKSETS: <button style="color: red; font-family: Verdana, Helvetica, Arial; font-size: 10 pt; font-weight: bold; background-color: #191919; border: 2px #444444 solid" id="QuickSet_UnHide" onClick="return false;">UnHide All Rows</button><button style="color: red; font-family: Verdana, Helvetica, Arial; font-size: 10 pt; font-weight: bold; background-color: #191919; border: 2px #444444 solid" id="QuickSet_Save" onClick="return false;"><strong><strike>Save Settings</strike></strong></button></td></td></table>';
  2380. table.parentNode.insertBefore(sp1, table);
  2381. $("QuickSet_UnHide").addEventListener("click", function(){targetInfo_UnhideAll();}, false);
  2382. var num = 0;
  2383. for (i = 0, row; row = table.rows[i]; i++) {
  2384. row.id = 'Row_'+i;
  2385. var newCell = row.insertCell(1);
  2386. newCell.align = 'center';
  2387. if(i == 0){
  2388. newCell.innerHTML = '<text color=#DDDDDD><b>#</b></font>';
  2389. }else{
  2390. num = row.cells[0].firstChild.innerHTML.split('#')[1].slice(0, -1);
  2391. newCell.innerHTML = num;
  2392. newCell.id = 'row_'+num;
  2393. }
  2394. newCell = row.insertCell(0);
  2395. newCell.align = 'center';
  2396. if(i == 0){
  2397. newCell.innerHTML = '';
  2398. }else{
  2399. newCell.innerHTML = '<span onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'" style="color:red">X</span>';
  2400. newCell.id = 'Hide_'+i;
  2401. newCell.addEventListener("click", function(){targetInfo_hideRow(this.parentNode, 'Hide');}, false);
  2402. }
  2403. if(i % 2 == 0){
  2404. }else{
  2405. row.style.backgroundColor = '#313131';
  2406. }
  2407. //ADD COLORS TO AGE FIELD
  2408. var val = Number(row.cells[colID_Age].firstChild.innerHTML);
  2409. if(val <= 3 && val != '' || isNaN(val) && i != 0){
  2410. row.cells[colID_Age].bgColor = 'DarkGreen';
  2411. }
  2412. //ADD COLORS TO DEF24
  2413. val = Number(row.cells[colID_Def24].firstChild.innerHTML);
  2414. if(val == 0 && !isNaN(val)){
  2415. row.cells[colID_Def24].bgColor = 'DarkGreen';
  2416. }else if(val <= 2 && !isNaN(val)){
  2417. row.cells[colID_Def24].bgColor = 'Green';
  2418. }else if(val <= 6 && !isNaN(val)){
  2419. row.cells[colID_Def24].bgColor = '#800080';
  2420. }else if(!isNaN(val)){
  2421. row.cells[colID_Def24].bgColor = 'DarkRed';
  2422. }
  2423. /*
  2424. //ADD COLORS TO NW DIFF
  2425. val = row.cells[colID_NWDiff].firstChild.innerHTML;
  2426. if(val!='' && val != 0){
  2427. row.cells[colID_NWDiff].bgColor = 'DarkRed';
  2428. }
  2429. //ADD COLORS TO LAND DIFF
  2430. val = row.cells[colID_LandDiff].firstChild.innerHTML;
  2431. if(val!='' && val!='0'){
  2432. row.cells[colID_LandDiff].bgColor = 'DarkRed';
  2433. }
  2434. */
  2435. }
  2436. //CREATE HEADER ROW
  2437. row = table.insertRow(0);
  2438. row.style.backgroundColor = '#222222';
  2439. var cell = row.insertCell(0);
  2440. cell.colSpan = 3;
  2441. cell.align = "right";
  2442. cell.innerHTML = 'FILTERS: ';
  2443. //GOV
  2444. cell = row.insertCell(-1);
  2445. cell.align = "center";
  2446. cell.innerHTML = '<select name="Filter_Gov" id="Filter_Gov" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="Communism">Comm</option><option value="Democracy">Democ</option><option value="Fascism">Fasc</option><option value="Theocracy">Theo</option><option value="Dictatorship">Dict</option><option value="Monarchy">Mon</option><option value="Republic">Rep</option><option value="Tyranny">Tyr</option></select>';
  2447. cell.innerHTML += '<br><select name="Filter_Gov2" id="Filter_Gov2" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value=""></option><option value="Communism">Comm</option><option value="Democracy">Democ</option><option value="Fascism">Fasc</option><option value="Theocracy">Theo</option><option value="Dictatorship">Dict</option><option value="Monarchy">Mon</option><option value="Republic">Rep</option><option value="Tyranny">Tyr</option></select>';
  2448. document.getElementById("Filter_Gov").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2449. document.getElementById("Filter_Gov2").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2450. document.getElementById("Filter_Gov2").style.display = 'none';
  2451. //NETWORTH
  2452. cell = row.insertCell(-1);
  2453. cell.align = "center";
  2454. cell.innerHTML = '<select name="Filter_NWOperator" id="Filter_NWOperator" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<"><</option><option selected value=">">></option></select>';
  2455. cell.innerHTML += '<select name="Filter_NW" id="Filter_NW" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="0.5">500k</option><option value="1">1m</option><option value="2">2m</option><option value="3">3m</option><option value="4">4m</option><option value="5">5m</option><option value="6">6m</option><option value="7">7m</option><option value="8">8m</option><option value="9">9m</option><option value="10">10m</option><option value="15">15m</option><option value="20">20m</option></select>';
  2456. document.getElementById("Filter_NWOperator").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2457. document.getElementById("Filter_NW").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2458. //NWDiff
  2459. cell = row.insertCell(-1);
  2460. cell.align = "center";
  2461. cell.innerHTML = '<select name="Filter_NWDiff" id="Filter_NWDiff" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="Changed">Changed</option><option value="Unchanged">Unchanged</option></select>';
  2462. document.getElementById("Filter_NWDiff").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2463. //LAND
  2464. cell = row.insertCell(-1);
  2465. cell.align = "center";
  2466. cell.innerHTML = '<select name="Filter_LandOperator" id="Filter_LandOperator" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<"><</option><option selected value=">">></option></select>';
  2467. cell.innerHTML += '<select name="Filter_Land" id="Filter_Land" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="5000">5k</option><option value="6000">6k</option><option value="7000">7k</option><option value="8000">8k</option><option value="9000">9k</option><option value="10000">10k</option><option value="15000">15k</option><option value="20000">20k</option><option value="30000">30k</option><option value="40000">40k</option><option value="50000">50k</option><option value="750000">75k</option><option value="100000">100k</option></select>';
  2468. document.getElementById("Filter_LandOperator").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2469. document.getElementById("Filter_Land").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2470. //LandDiff
  2471. cell = row.insertCell(-1);
  2472. cell.align = "center";
  2473. cell.innerHTML = '<select name="Filter_LandDiff" id="Filter_LandDiff" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="Changed">Changed</option><option value="Unchanged">Unchanged</option></select>';
  2474. document.getElementById("Filter_LandDiff").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2475. //SKIP
  2476. cell = row.insertCell(-1);
  2477. cell.align = "center";
  2478. //GDI
  2479. cell = row.insertCell(-1);
  2480. cell.align = "center";
  2481. cell.innerHTML = '<select name="Filter_GDI" id="Filter_GDI" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="Y">Y</option><option value="N">N</option></select>';
  2482. document.getElementById("Filter_GDI").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2483. //AGE
  2484. cell = row.insertCell(-1);
  2485. cell.align = "center";
  2486. cell.innerHTML = '<select name="Filter_Age" id="Filter_Age" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="2"><2</option><option value="4"><4</option><option value="6"><6</option><option value="8"><8</option><option value="10"><10</option><option value="12"><12</option><option value="24"><24</option><option value="48"><48</option><option value="72"><72</option></select>';
  2487. document.getElementById("Filter_Age").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2488. //DEF24
  2489. cell = row.insertCell(-1);
  2490. cell.align = "center";
  2491. cell.innerHTML = '<select name="Filter_Def24" id="Filter_Def24" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="0">None</option><option value="1"><1</option><option value="2"><2</option><option value="3"><3</option><option value="4"><4</option><option value="5"><5</option><option value="6"><6</option><option value="8"><8</option><option value="10"><10</option><option value="12"><12</option></select>';
  2492. document.getElementById("Filter_Def24").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2493. //DEF48
  2494. cell = row.insertCell(-1);
  2495. cell.align = "center";
  2496. cell.innerHTML = '<select name="Filter_Def48" id="Filter_Def48" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="0">None</option><option value="1"><1</option><option value="2"><2</option><option value="3"><3</option><option value="4"><4</option><option value="5"><5</option><option value="6"><6</option><option value="8"><8</option><option value="10"><10</option><option value="12"><12</option></select>';
  2497. document.getElementById("Filter_Def48").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2498. //DEF72
  2499. cell = row.insertCell(-1);
  2500. cell.align = "center";
  2501. cell.innerHTML = '<select name="Filter_Def72" id="Filter_Def72" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="0">None</option><option value="1"><1</option><option value="2"><2</option><option value="3"><3</option><option value="4"><4</option><option value="5"><5</option><option value="6"><6</option><option value="8"><8</option><option value="10"><10</option><option value="12"><12</option></select>';
  2502. document.getElementById("Filter_Def72").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2503. //Strat
  2504. cell = row.insertCell(-1);
  2505. cell.align = "center";
  2506. var data = new Array();
  2507. var data2 = new Array();
  2508. var row2 = '';
  2509. for (i = 2, row2; row2 = table.rows[i]; i++) {
  2510. if(data.includes("<option>"+row2.cells[colID_Strat].firstChild.innerHTML+"</option>")){
  2511. }else{
  2512. data.push("<option>"+row2.cells[colID_Strat].firstChild.innerHTML+"</option>");
  2513. }
  2514. if(data2.includes("<option>"+row2.cells[colID_StratPlanned].firstChild.innerHTML+"</option>")){
  2515. }else{
  2516. data2.push("<option>"+row2.cells[colID_StratPlanned].firstChild.innerHTML+"</option>");
  2517. }
  2518. }
  2519. cell.innerHTML = '<select name="Filter_Strat" id="Filter_Strat" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">All</option>'+data.join()+'</select>';
  2520. cell.innerHTML += '<br><select name="Filter_Strat2" id="Filter_Strat2" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value=""></option>'+data.join()+'</select>';
  2521. document.getElementById("Filter_Strat").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2522. document.getElementById("Filter_Strat2").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2523. document.getElementById("Filter_Strat2").style.display = 'none';
  2524. //STRAT2
  2525. cell = row.insertCell(-1);
  2526. cell.align = "center";
  2527. cell.innerHTML = '<select name="Filter_StratPlanned" id="Filter_StratPlanned" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">All</option>'+data.join()+'</select>';
  2528. cell.innerHTML += '<br><select name="Filter_StratPlanned2" id="Filter_StratPlanned2" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value=""></option>'+data.join()+'</select>';
  2529. document.getElementById("Filter_StratPlanned").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2530. document.getElementById("Filter_StratPlanned2").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2531. document.getElementById("Filter_StratPlanned2").style.display = 'none';
  2532. //TECH
  2533. cell = row.insertCell(-1);
  2534. cell.align = "center";
  2535. cell.innerHTML = '<select name="Filter_Tech" id="Filter_Tech" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="10000">>10k</option><option value="20000">>20k</option><option value="40000">>40k</option><option value="60000">>60k</option><option value="80000">>80k</option><option value="100000">>100k</option><option value="150000">>150</option><option value="200000">>200k</option><option value="250000">>250k</option><option value="300000">>300k</option><option value="400000">>400k</option><option value="500000">>500k</option><option value="600000">>600k</option><option value="700000>>700k</option><option value="800000">>800k</option><option value="900000">>900k</option><option value="1000000">>1m</option></select>';
  2536. document.getElementById("Filter_Tech").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2537. //TECH
  2538. cell = row.insertCell(-1);
  2539. cell.align = "center";
  2540. //Jets
  2541. cell = row.insertCell(-1);
  2542. cell.align = "center";
  2543. cell.innerHTML = '<select name="Filter_JetsOperator" id="Filter_JetsOperator" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option value="<"><</option><option selected value=">">></option></select>';
  2544. cell.innerHTML += '<select name="Filter_Jets" id="Filter_Jets" style="color: white; font-family: Verdana, Helvetica, Arial; font-size: 8 pt; background-color: #191919; border: 1px #444444 solid"><option selected value="">Any</option><option value="50000">50k</option><option value="100000">100k</option><option value="200000">200k</option><option value="300000">300k</option><option value="400000">400k</option><option value="500000">500k</option><option value="750000">750k</option><option value="1000000">1m</option><option value="2000000">2m</option><option value="3000000">3m</option><option value="4000000">4m</option><option value="5000000">5m</option><option value="6000000">6m</option><option value="7000000">7m</option><option value="8000000">8m</option><option value="9000000">9m</option><option value="10000000">10m</option></select>';
  2545. document.getElementById("Filter_JetsOperator").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2546. document.getElementById("Filter_Jets").addEventListener("change", function(){targetInfo_FullFilter(this);}, false);
  2547. }
  2548.  
  2549. // ########################################################################################################################################################
  2550. // ########################################################################################################################################################
  2551. // ########################################################################################################################################################
  2552. // ########################################################################################################################################################
  2553. // ########################################################################################################################################################
  2554. // ########################################################################################################################################################
  2555. // ########################################################################################################################################################
  2556. function userManager(){
  2557. var Names = new Array();
  2558. var allTR = document.getElementsByTagName('tr'); // get all TD elements
  2559. var table = document.forms[0].parentNode;
  2560. allTR = table.getElementsByTagName('tr'); // get all TD elements
  2561. var CountryID = false;
  2562. var LastLoginID = false;
  2563. var DisplayNameID = false;
  2564. var day = (1000*60*60*24);
  2565. var hour = (1000*60*60);
  2566. var min = (1000*60);
  2567. var nUser = 0;
  2568. var runNumber = 0;
  2569. var PermList = new Array();
  2570. var totalUsers = 0;
  2571. var stopProcess = 'false';
  2572. var Clan_Clan = getClan();
  2573. var bgcolor = '#454545';
  2574. var bgcolor1 = '#454545';
  2575. var bgcolor2 = '#333333';
  2576. var Perms = new Array();
  2577. var PermNames = new Array();
  2578. var Data = new Array();
  2579. var totalCols = 0;
  2580. for(var i=0; i<allTR[1].cells.length; ++i){
  2581. if(allTR[1].cells[i].innerHTML.indexOf("Country")!=-1){
  2582. CountryID = i;
  2583. } else if(allTR[1].cells[i].innerHTML.indexOf("Login")!=-1){
  2584. LastLoginID = i;
  2585. } else if(allTR[1].cells[i].innerHTML.indexOf("Display")!=-1){
  2586. DisplayNameID = i;
  2587. }
  2588. }
  2589. for(i=1; i<allTR.length; ++i){
  2590. if(allTR[i].firstChild.colSpan >= 2){
  2591. continue;
  2592. }
  2593. var cell = allTR[i].insertCell(-1);
  2594. cell.bgColor = allTR[i].bgColor;
  2595. cell.noWrap = true;
  2596. if(i == 1){
  2597. allTR[i].cells[LastLoginID+1].innerHTML = '<font color="Orange">How Long Ago</font><input name="Delete" type="hidden" value"Delete Selected">';
  2598. allTR[i].cells[LastLoginID+1].align = 'center';
  2599. continue;
  2600. }
  2601. if(LastLoginID != false){
  2602. var LastLogin = allTR[i].cells[LastLoginID].innerHTML;
  2603. allTR[i].cells[LastLoginID].noWrap = true;
  2604. if(LastLogin == ''){
  2605. allTR[i].cells[LastLoginID+1].bgColor = 'DarkRed';
  2606. continue;
  2607. }
  2608. LastLogin = Date.parse(LastLogin);
  2609. var dif = curTime - LastLogin;
  2610. if(dif >= day){
  2611. var d = Math.floor(dif/day);
  2612. t = dif - d * day;
  2613. var h = Math.floor(t/hour);
  2614. var timestring = d+" Day(s) "+h+" Hours Ago";
  2615. if(d >= 30){
  2616. allTR[i].cells[LastLoginID+1].bgColor = 'DarkRed';
  2617. }else if(d >= 7){
  2618. allTR[i].cells[LastLoginID+1].bgColor = '#0080C0';
  2619. }
  2620. }else if(dif >= hour){
  2621. var h = Math.floor(dif/hour);
  2622. t = dif - h * hour;
  2623. var m = Math.floor(t/min);
  2624. var timestring = h+" Hours "+m+" Mins Ago";
  2625. }else{
  2626. var m = Math.floor(dif/min);
  2627. var timestring = m+" Mins Ago";
  2628.  
  2629. }
  2630. allTR[i].cells[LastLoginID+1].innerHTML = timestring;
  2631. }
  2632. if(CountryID != false){
  2633. var Country = allTR[i].cells[CountryID].innerHTML;
  2634. if(Country == ''){
  2635. allTR[i].cells[CountryID].bgColor = 'DarkRed';
  2636. }
  2637. }
  2638. }
  2639. }
  2640.  
  2641. // ########################################################################################################################################################
  2642. // ########################################################################################################################################################
  2643. // ########################################################################################################################################################
  2644. // ########################################################################################################################################################
  2645. // ########################################################################################################################################################
  2646. // ########################################################################################################################################################
  2647. // ########################################################################################################################################################
  2648. function editUser() {
  2649. function CheckForNewPerms(url) {
  2650. notify("<font color='Red' size='+2'>Checking for perm updates for the specified group.");
  2651. var Clan_Clan = getClan();
  2652. GM_xmlhttpRequest({
  2653. method: 'GET',
  2654. url: 'http://'+Clan_Clan+'.ghqnet.com/Admin/EditGroup.asp?GroupID='+url,
  2655. headers: {
  2656. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
  2657. 'main': 'application/scriptVersion+xml,application/xml,text/xml',
  2658. },
  2659. onload: function(responseDetails) {
  2660. var response = responseDetails.responseText;
  2661. var div = document.createElement('div');
  2662. div.innerHTML = response;
  2663. var allInputs = div.getElementsByTagName('input'); // get all Input elements
  2664. var groupPerms = getSetting('GroupPerms',false);
  2665. if(groupPerms === false){
  2666. groupPerms = new Array();
  2667. }else{
  2668. groupPerms = JSON.parse(groupPerms);
  2669. }
  2670. var groupID = url;
  2671. groupPerms[groupID] = new Array();
  2672. groupPerms[groupID][0] = new Array();
  2673. var allSelects = div.getElementsByTagName('select');
  2674. groupPerms[groupID][0][1] = allSelects[0].options[allSelects[0].selectedIndex].value;
  2675. var num = 1;
  2676. for (var i=0;i<allInputs.length;i++){
  2677. if(allInputs[i].name == "GroupName"){
  2678. groupPerms[groupID][0][0] = allInputs[i].value;
  2679. continue;
  2680. }
  2681. if(allInputs[i].name == "GroupColor"){
  2682. groupPerms[groupID][0][1] = allInputs[i].value;
  2683. continue;
  2684. }
  2685. if(allInputs[i].type == "checkbox"){
  2686. if(allInputs[i].checked == true){
  2687. groupPerms[groupID][num] = allInputs[i].value;
  2688. num++;
  2689. }
  2690. }
  2691. }
  2692. setSetting( 'GroupPerms', JSON.stringify(groupPerms) );
  2693. editUser_ParseGroups(groupPerms);
  2694. }
  2695. });
  2696. }
  2697.  
  2698. function editUser_ParseGroups(groupPerms){
  2699. var bgcolor = '#454545';
  2700. var moves = '';
  2701. var list = '';
  2702. var userhave = 1;
  2703.  
  2704. for (var i=0;i<permListByID.length;i++){ // FOR EACH GROUP
  2705. Perms[permListByID[i]]['InGroup'] = 0;
  2706. Perms[permListByID[i]]['UserCount'] = 0;
  2707. }
  2708. for (var i=1;i<Groups.length;i++){ // FOR EACH GROUP
  2709. userhave = 1;
  2710. groupID = Groups[i]['ID'];
  2711. if(groupPerms[groupID] == undefined){
  2712. continue;
  2713. }
  2714. if(groupPerms[groupID].length == 1){
  2715. continue;
  2716. }
  2717. list = groupPerms[groupID];
  2718. for (var x=1;x<list.length;x++){ // FOR EACH PERM IN THAT GROUP, SEE IF THE USER HAS ALL PERMS IN THE GROUP.
  2719. if(Perms[list[x]] === undefined){
  2720. userhave = 0;
  2721. continue;
  2722. }
  2723. if(Perms[list[x]]['UserHas'] === 0){
  2724. userhave = 0;
  2725. continue;
  2726. }
  2727. }
  2728. if(userhave === 1){
  2729. for (var x=1;x<list.length;x++){ // IF USER IS IN THE GROUP THEN REPARSE PERMS AND ADD IN INDICATORS FOR IT.
  2730. Perms[list[x]]['InGroup'] = 1;
  2731. Perms[list[x]]['UserCount']++;
  2732. }
  2733. }
  2734. }
  2735. for (var i=1;i<Groups.length;i++){ // FOR EACH GROUP
  2736. userhave = 1;
  2737. if(bgcolor == bgcolor1){ bgcolor = bgcolor2; }else{ bgcolor = bgcolor1; }
  2738. groupID = Groups[i]['ID'];
  2739. groupName = Groups[i]['Name'];
  2740. if(groupPerms[groupID] ==undefined){
  2741. moves = moves + '<tr><td bgcolor="'+bgcolor+'"><button id="UpdateGroup_' + groupID + '" name="'+ i +'">UpdateGroup</button></td><td align="right" bgcolor="'+bgcolor+'" id="_'+ groupID +'">' + groupName + '<font color="YELLOW"> - Error: No perms Saved.</font></td><td bgcolor="'+bgcolor+'"><button id="Move_' + groupID + '" name="'+ i +'">Update</button></td><td bgcolor="'+bgcolor+'"></td></tr>';
  2742. continue;
  2743. }
  2744. if(groupPerms[groupID].length == 1){
  2745. moves = moves + '<tr><td bgcolor="'+bgcolor+'"><button id="UpdateGroup_' + groupID + '" name="'+ i +'">UpdateGroup</button></td><td align="right" bgcolor="'+bgcolor+'" id="_'+ groupID +'">' + groupName + '<font color="YELLOW"> - Error: No perms listed.</font></td><td bgcolor="'+bgcolor+'"><button id="Move_' + groupID + '" name="'+ i +'">Update</button></td><td bgcolor="'+bgcolor+'"></td></tr>';
  2746. continue;
  2747. }
  2748. var showpermslisthave = '';
  2749. var showpermslistdonthave = '';
  2750. var PermID = '';
  2751. ///////////////////////////////FOR SOME REASON ADMINISTRATOR (PERM 1) DOES NOT WORK. MIGHT HAVE SOMETHING TO WITH THE 1 ALSO MEANING TRUE IS SOME CASES.
  2752. list = groupPerms[groupID];
  2753. for (var x=1;x<list.length;x++){ // FOR EACH PERM IN THAT GROUP, SEE IF THE USER HAS ALL PERMS IN THE GROUP.
  2754. PermID = list[x];
  2755. if(Perms[PermID] === undefined){
  2756. continue;
  2757. }
  2758. if(Perms[PermID]['UserCount'] > 1){
  2759. var color = 'grey';
  2760. }else{
  2761. var color = 'green';
  2762. }
  2763. if(Perms[PermID]['UserHas'] == 1){
  2764. showpermslisthave = showpermslisthave + '<font color="'+ color +'">' + Perms[PermID]['Name'] + '</font><BR>';
  2765. }else{
  2766. showpermslistdonthave = showpermslistdonthave + '<font color="'+ color +'">' + Perms[PermID]['Name'] + '</font><BR>';
  2767. userhave = 0;
  2768. }
  2769. }
  2770. var spanhave = '<span id="spanhave_'+ groupID +'" class="box" return false;" style="display:none">'+showpermslisthave+'</span>';
  2771. var spandonthave = '<span id="spandonthave_'+ groupID +'" class="box" return false;" style="display:none">'+showpermslistdonthave+'</span>';
  2772. var color = groupPerms[groupID][0][1];
  2773.  
  2774. if(userhave == 1){
  2775. moves = moves + '<tr><td bgcolor="'+bgcolor+'"><button id="UpdateGroup_' + groupID + '" name="'+ i +'">UpdateGroup</button></td><td align="right" bgcolor="'+bgcolor+'"><br>'+spandonthave+'</td><td bgcolor="'+bgcolor+'"><button style="color: #FF0000" id="Move_'+ groupID +'" name="'+ groupID +'"><strong><<<</strong></button></td><td bgcolor="'+bgcolor+'" id="_'+ groupID +'"><font color="'+ color +'">' + groupName + '</font>' + spanhave + '</td></tr>';
  2776. }else{
  2777. moves = moves + '<tr><td bgcolor="'+bgcolor+'"><button id="UpdateGroup_' + groupID + '" name="'+ i +'">UpdateGroup</button></td><td align="right" bgcolor="'+bgcolor+'" id="_'+ groupID +'"><font color="'+ color +'">' + groupName + '</font>' + spandonthave +'</td><td bgcolor="'+bgcolor+'"><button id="Move_' + groupID + '" name="'+ groupID +'"><strong>>>></strong></button></td><td bgcolor="'+bgcolor+'"><br>' + spanhave + '</td></tr>';
  2778. }
  2779.  
  2780. }
  2781. var moves2 = '';
  2782. var showpermslisthave = '';
  2783. var showpermslistdonthave = '';
  2784. for (var i=0;i<permListByID.length;i++){
  2785. if(bgcolor == bgcolor1){ bgcolor = bgcolor2; }else{ bgcolor = bgcolor1; }
  2786. var temp = permListByID[i];
  2787. var name = Perms[temp]['Name'];
  2788. var color = 'white';
  2789. var cellcolor = bgcolor;
  2790. if (Perms[temp]['InGroup'] == 0){
  2791. cellcolor = 'darkred';
  2792. }
  2793. if(Perms[temp]['UserHas'] == 1){
  2794. showpermslisthave = showpermslisthave + '<font color="'+ color +'">' + temp + '</font><BR>';
  2795. moves2 = moves2 + '<tr><td align="right" bgcolor="'+bgcolor+'"><br></td><td bgcolor="'+bgcolor+'"><button style="color: #FF0000" id="MovePerm_' + temp + '" name="'+ i +'"><strong><<<</strong></button></td><td bgcolor="'+cellcolor+'" id="_'+ temp +'"><font color="'+color+'">' + name + '</font></td></tr>';
  2796. }else{
  2797. showpermslistdonthave = showpermslistdonthave + '<font color="'+ color +'">' + temp + '</font><BR>';
  2798. moves2 = moves2 + '<tr><td align="right" bgcolor="'+bgcolor+'" id="_'+ temp +'"><font color="'+color+'">' + name +'</font></td><td bgcolor="'+bgcolor+'"><button id="MovePerm_' + temp + '" name="'+ i +'"><strong>>>></strong></button></td><td bgcolor="'+bgcolor+'"><br></td></tr>';
  2799. }
  2800. }
  2801. allTD[tableIndex].innerHTML = tableHeader + moves + tableMiddle + moves2 + tableFooter;
  2802. for (var i=0;i<permListByID.length;i++){
  2803. var temp = permListByID[i];
  2804. var t = $('MovePerm_'+temp);
  2805. t.addEventListener("click", function(){editUser_setPerm(this.id);}, false);
  2806. }
  2807. for (var i=1;i<Groups.length;i++){ // FOR EACH GROUP
  2808. var temp = Groups[i]['ID'];
  2809. var t = $('Move_'+temp);
  2810. var te = $('_'+temp);
  2811. var ug = $('UpdateGroup_'+temp);
  2812. te.addEventListener("click", function(){editUser_ShowText(this.id);}, false);
  2813. ug.addEventListener("click", function(){CheckForNewPerms(Groups[this.name]['ID']);}, false);
  2814. if(t.innerHTML == '<strong>&lt;&lt;&lt;</strong>'){
  2815. t.addEventListener("click", function(){editUser_setPerms(this.name, "have");}, false);
  2816. }else if(t.innerHTML == 'Update'){
  2817. t.addEventListener("click", function(){CheckForNewPerms(Groups[this.name]['ID']);}, false);
  2818. }else{
  2819. t.addEventListener("click", function(){editUser_setPerms(this.name, "donthave");}, false);
  2820. }
  2821. }
  2822.  
  2823. }
  2824. function editUser_setPerms(DataID, current){
  2825. for (var i=1;i<groupPerms[DataID].length;i++){ // FOR EACH PERM IN THAT GROUP, SEE IF THE USER HAS ALL PERMS IN THE GROUP.
  2826. var temp = groupPerms[DataID][i];
  2827. if(Perms[temp] === undefined){
  2828. }else{
  2829. if(current == 'donthave'){
  2830. Perms[temp]['UserHas'] = 1;
  2831. Perms[temp]['UserCount']++;
  2832. $("checkbox_"+temp).checked = true;
  2833. }else{
  2834. if(Perms[temp]['UserCount'] <= 1){
  2835. Perms[temp]['UserHas'] = 0;
  2836. Perms[temp]['UserCount'] = 0;
  2837. $("checkbox_"+temp).checked = false;
  2838. }else{
  2839. Perms[temp]['UserCount']--;
  2840. }
  2841. }
  2842. }
  2843. }
  2844. editUser_ParseGroups(groupPerms);
  2845. }
  2846. function editUser_setPerm(permID){ // SETS AN INDIVIDUAL PERM ON OR OFF
  2847. permID = permID.substr(9);
  2848. if(Perms[permID]['UserHas'] === 1){
  2849. Perms[permID]['UserHas'] = 0;
  2850. Perms[permID]['UserCount'] = 0;
  2851. $("checkbox_"+permID).checked = false;
  2852. }else{
  2853. Perms[permID]['UserHas'] = 1;
  2854. Perms[permID]['UserCount']++;
  2855. $("checkbox_"+permID).checked = true;
  2856. }
  2857.  
  2858. editUser_ParseGroups(groupPerms);
  2859. }
  2860. function editUser_ShowText(id) {
  2861. var t = document.getElementById('spanhave'+id);
  2862. var t2 = document.getElementById('spandonthave'+id);
  2863. if(t.style.display == 'block'){
  2864. t.style.display = 'none';
  2865. t2.style.display = 'none';
  2866. }else{
  2867. t.style.display = 'block';
  2868. t2.style.display = 'block';
  2869. }
  2870. }
  2871. function editUser_checkedBox(t) {
  2872. temp = t.id.substr(9);
  2873. if(t.checked == true){
  2874. Perms[temp]['UserHas'] = 1;
  2875. Perms[temp]['UserCount']++;
  2876. }else{
  2877. Perms[temp]['UserHas'] = 0;
  2878. Perms[temp]['UserCount']--;
  2879. }
  2880. editUser_ParseGroups(groupPerms);
  2881. }
  2882. var allTH;
  2883. var allTD; // holds collection of all TD elements
  2884. var td_index; // var used to index
  2885. allTD = document.getElementsByTagName('td'); // get all TD elements
  2886. allTH = document.getElementsByTagName('th'); // get all TH elements
  2887.  
  2888. var allTextAreas = document.getElementsByTagName("textarea");
  2889. for(var i=0; i<allTextAreas.length; ++i){
  2890. if(allTextAreas[i].name == 'Comments'){
  2891. allTextAreas[i].cols = 50;
  2892. allTextAreas[i].rows = 8;
  2893. }
  2894. }
  2895. var allInputs = document.getElementsByTagName("input");
  2896. for(var i=0; i<allInputs.length; ++i){
  2897. if(allInputs[i].name == 'Permissions'){ continue; }
  2898. allInputs[i].id = allInputs[i].name;
  2899. }
  2900. var allSelects = document.getElementsByTagName("select");
  2901. for(var i=0; i<allSelects.length; ++i){
  2902. allSelects[i].id = allSelects[i].name;
  2903. }
  2904. var allTextAreas = document.getElementsByTagName("textarea");
  2905. for(var i=0; i<allTextAreas.length; ++i){
  2906. if(allTextAreas[i].name == 'Comments'){
  2907. allTextAreas[i].cols = 50;
  2908. allTextAreas[i].rows = 8;
  2909. }
  2910. }
  2911.  
  2912. var bgcolor = '#454545';
  2913. var bgcolor1 = '#454545';
  2914. var bgcolor2 = '#333333';
  2915. var style = '<style type="text/css"><!-- .box { background-color: #504D6F; border: 1px solid #FFF; width: 250; padding: 5px; } --> </style>';
  2916. for(var i=0; i<allTD.length; ++i){
  2917. if(allTD[i].innerHTML == '<b><font size="+1">Edit User Permissions</font></b>'){ // find td object with keyword in it
  2918. var tableIndex = i;
  2919.  
  2920. allTD[i].bgColor = 'black';
  2921. allTD[i].parentNode.bgColor = 'black';
  2922.  
  2923. var tableHeader = '<table align=center border="0" cellspacing="1" cellpadding="2"><tr><td valign="top"> <table align=center border="0" cellspacing="1" cellpadding="2"><tr><th bgcolor="'+bgcolor+'" colspan=4>Quick Groups Editing<br><font color=gray size=small>*Click a group to see associated perms.<br>*Gray Perms are duplicate perms and are being used by other groups as well.<br>*Green Perms will be transfered when the group is transfered.<br>*To edit/update the perms list for each group, go to the GHQ Group manager page.</font></th></tr><tr><th bgcolor="'+bgcolor+'"></th><th width=300px bgcolor="'+bgcolor+'">Dont Have</th> <th bgcolor="'+bgcolor+'">M</th><th width=300px bgcolor="'+bgcolor+'">Have</th></tr>';
  2924. save = '<tr><td bgcolor="'+bgcolor+'"></td><td align="right"></td><td></td><td align=left></td></tr>';
  2925. var tableMiddle = '</table></td><td valign="top"><table align=center border="0" cellspacing="1" cellpadding="2"><tr><th bgcolor="'+bgcolor+'" colspan=3>Quick Permission Editing<br><font color=gray size=small>*Cells in <font color=red>RED</font> are perms not associated with a Group.</font></th></tr><tr><th width=300px bgcolor="'+bgcolor+'">Dont Have</th><th bgcolor="'+bgcolor+'">M</th><th width=300px bgcolor="'+bgcolor+'">Have</th></tr>';
  2926. save2 = '<tr><td align="right"></td><td></td><td align=left></td></tr>';
  2927. var tableFooter = '</td></tr></table></td></tr></table></td></tr><tr bgcolor="#22222"><td colspan=3 bgcolor="#222222"><b>Edit User Permissions</b>';
  2928.  
  2929. allTD[i].innerHTML = tableHeader + save + tableMiddle + save2 + tableFooter;
  2930. break;
  2931. }
  2932. }
  2933. var groupPerms = getSetting('GroupPerms',false);
  2934. if(groupPerms !== false){
  2935. groupPerms = JSON.parse(groupPerms);
  2936. }
  2937.  
  2938. var GroupsT= $n('Group')[0];
  2939. var Groups = new Array();
  2940. for (var i=1;i<GroupsT.length;i++){
  2941. Groups[i] = new Array();
  2942. Groups[i]['Name'] = GroupsT.options[i].text;
  2943. Groups[i]['ID'] = GroupsT.options[i].value;
  2944. }
  2945. var permList = $n('Permissions');
  2946. var permListByID = new Array();
  2947. var Perms = new Array();
  2948.  
  2949. for (var i=0;i<permList.length;i++){
  2950. permListByID[i] = permList[i].value;
  2951. Perms[permList[i].value] = new Array();
  2952. Perms[permList[i].value]['Name'] = permList[i].parentNode.parentNode.childNodes[1].innerHTML;
  2953. Perms[permList[i].value]['InGroup'] = 0;
  2954. //permname = permname.replace('&amp;', '&');
  2955. if (permList[i].checked === true){
  2956. Perms[permList[i].value]['UserHas'] = 1;
  2957. }else{
  2958. Perms[permList[i].value]['UserHas'] = 0;
  2959. }
  2960. Perms[permList[i].value]['UserCount'] = 0;
  2961. permList[i].id = 'checkbox_'+permList[i].value;
  2962. $('checkbox_'+permList[i].value).addEventListener("click", function(){editUser_checkedBox(this);}, false);
  2963. Perms[permList[i].value]['InUsersGroup'] = 0;
  2964. }
  2965.  
  2966. editUser_ParseGroups(groupPerms);
  2967. }
  2968.  
  2969.  
  2970. // ########################################################################################################################################################
  2971. // ########################################################################################################################################################
  2972. // ########################################################################################################################################################
  2973. // ########################################################################################################################################################
  2974. // ########################################################################################################################################################
  2975. // ########################################################################################################################################################
  2976. // ########################################################################################################################################################
  2977.  
  2978. function editGroupCheck() {
  2979. function Verify2() {
  2980. if (document.EditGroup.GroupName.value=='') {
  2981. alert('You must enter a Force Name.');
  2982. return false;
  2983. }
  2984. if (document.EditGroup.GroupColor.value=='') {
  2985. alert('You must enter a Force Name.');
  2986. return false;
  2987. }
  2988. SavePerms();
  2989. document.EditGroup.submit();
  2990. return false;
  2991. }
  2992. function SavePerms() {
  2993. var group = getSetting('GroupPerms',false);
  2994. if(group === false){
  2995. group = new Array();
  2996. }else{
  2997. group = JSON.parse(group);
  2998. }
  2999. var groupID = $n('GroupID')[0].value;
  3000. group[groupID] = new Array();
  3001. group[groupID][0] = new Array();
  3002. group[groupID][0][0] = $n('GroupName')[0].value;
  3003. group[groupID][0][1] = $n('GroupColor')[0].value;
  3004. group[groupID][0][2] = $n('GroupNumber')[0].options[$n('GroupNumber')[0].selectedIndex].value;
  3005. var defaultPerms = $n('DefaultPermissions');
  3006. var num = 1;
  3007. for (var i=0;i<defaultPerms.length;i++){
  3008. if(defaultPerms[i].checked == true){
  3009. group[groupID][num] = defaultPerms[i].value;
  3010. num++;
  3011. }
  3012. }
  3013. setSetting( 'GroupPerms', JSON.stringify(group) );
  3014. }
  3015. SavePerms();
  3016. $n('Submit')[0].onclick = Verify2;
  3017. }
  3018.  
  3019. // ########################################################################################################################################################
  3020. // ########################################################################################################################################################
  3021. // ########################################################################################################################################################
  3022. // ########################################################################################################################################################
  3023. // ########################################################################################################################################################
  3024. // ########################################################################################################################################################
  3025. // ########################################################################################################################################################
  3026.  
  3027. function accessManager() {
  3028. function CheckforAccessListVerify(t) {
  3029. var answer = confirm("This process will add several columns to this page that will display where each perm is used. This may take awhile on slower internets as it has to load several pages in the background. Are you sure you want to continue?");
  3030. if(answer){ GetAccessList_Menu(t); }else{ return; }
  3031. }
  3032.  
  3033. function GetAccessList_Menu() {
  3034. notify("<font color='Red' size='+2'>Checking for Access List for Menu Items.");
  3035. var Clan_Clan = getClan();
  3036. GM_xmlhttpRequest({
  3037. method: 'GET',
  3038. url: 'http://'+Clan_Clan+'.ghqnet.com/Admin/Menu/MenuManager.asp',
  3039. headers: {
  3040. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
  3041. 'main': 'application/scriptVersion+xml,application/xml,text/xml',
  3042. },
  3043. onload: function(responseDetails) {
  3044. var response = responseDetails.responseText;
  3045. var div = document.createElement('div');
  3046. div.innerHTML = response;
  3047. var table = div.getElementsByTagName('table');
  3048. for (var i=0;i<table.length;i++){
  3049. if(table[i].id == "main"){
  3050. table = table[i];
  3051. break;
  3052. }
  3053. }
  3054. var perms = getSetting('AccessPerms',false);
  3055. if(perms === false){
  3056. return;
  3057. }else{
  3058. perms = JSON.parse(perms);
  3059. }
  3060. for (var i=2;i<table.rows.length;i++){
  3061. if(table.rows[i].cells.length < 5){ continue; }
  3062. var title = table.rows[i].cells[2].innerText;
  3063. var perm = table.rows[i].cells[4].innerHTML;
  3064. if(perm == ""){ continue; }
  3065. if(perms[perm] === undefined){
  3066. if(perm === 'Administrator'){ continue; }
  3067. alert("'"+perm+"' was not found in the Access Manager. Please Verify this is set up correctly.");
  3068. continue;
  3069. }
  3070. perms[perm][2].push(title.trim());
  3071. }
  3072. setSetting( 'AccessPerms', JSON.stringify(perms) );
  3073. delete perms;
  3074. delete table;
  3075. delete div;
  3076. delete response;
  3077. GetAccessList_Page();
  3078. }
  3079. });
  3080. }
  3081.  
  3082. function GetAccessList_Page() {
  3083. notify("<font color='Red' size='+2'>Checking the Access List for WebPages.");
  3084. var Clan_Clan = getClan();
  3085. GM_xmlhttpRequest({
  3086. method: 'GET',
  3087. url: 'http://'+Clan_Clan+'.ghqnet.com/Admin/PageManager.asp',
  3088. headers: {
  3089. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
  3090. 'main': 'application/scriptVersion+xml,application/xml,text/xml',
  3091. },
  3092. onload: function(responseDetails) {
  3093. var response = responseDetails.responseText;
  3094. var div = document.createElement('div');
  3095. div.innerHTML = response;
  3096. var table = div.getElementsByTagName('table');
  3097. for (var i=0;i<table.length;i++){
  3098. if(table[i].id == "main"){
  3099. table = table[i];
  3100. break;
  3101. }
  3102. }
  3103. var perms = getSetting('AccessPerms',false);
  3104. if(perms === false){
  3105. return;
  3106. }else{
  3107. perms = JSON.parse(perms);
  3108. }
  3109. for (var i=2;i<table.rows.length;i++){
  3110. if(table.rows[i].cells.length < 5){ continue; }
  3111. var title = table.rows[i].cells[2].innerText;
  3112. var viewperm = table.rows[i].cells[3].innerHTML;
  3113. var editperm = table.rows[i].cells[4].innerHTML;
  3114. if(perms[viewperm] === undefined){
  3115. if(viewperm !== "Administrator" && viewperm !== "<i>Public</i>"){
  3116. alert("'"+viewperm+"' was not found in the Access Manager. Please Verify this is set up correctly and that this perm is still used.");
  3117. }
  3118. }else{
  3119. perms[viewperm][3][0].push(title.trim());
  3120. }
  3121. if(perms[editperm] === undefined){
  3122. if(editperm !== "Administrator" && editperm !== "<i>Public</i>"){
  3123. alert("'"+editperm+"' was not found in the Access Manager. Please Verify this is set up correctly and that this perm is still used.");
  3124. }
  3125. }else{
  3126. perms[editperm][3][1].push(title.trim());
  3127. }
  3128. }
  3129. setSetting( 'AccessPerms', JSON.stringify(perms) );
  3130. delete perms;
  3131. delete table;
  3132. delete div;
  3133. delete response;
  3134. GetAccessList_Boards();
  3135. }
  3136. });
  3137. }
  3138.  
  3139. function GetAccessList_Boards() {
  3140. notify("<font color='Red' size='+2'>Checking the Access List for Baords.");
  3141. var Clan_Clan = getClan();
  3142. GM_xmlhttpRequest({
  3143. method: 'GET',
  3144. url: 'http://'+Clan_Clan+'.ghqnet.com/Admin/BoardManager.asp',
  3145. headers: {
  3146. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
  3147. 'main': 'application/scriptVersion+xml,application/xml,text/xml',
  3148. },
  3149. onload: function(responseDetails) {
  3150. var response = responseDetails.responseText;
  3151. var div = document.createElement('div');
  3152. div.innerHTML = response;
  3153. var table = div.getElementsByTagName('table');
  3154. for (var i=0;i<table.length;i++){
  3155. if(table[i].id == "main"){
  3156. table = table[i];
  3157. break;
  3158. }
  3159. }
  3160. var perms = getSetting('AccessPerms',false);
  3161. if(perms === false){
  3162. return;
  3163. }else{
  3164. perms = JSON.parse(perms);
  3165. }
  3166. for (var i=2;i<table.rows.length;i++){
  3167. if(table.rows[i].cells.length < 5){ continue; }
  3168. var title = table.rows[i].cells[1].innerText;
  3169. var readperm = table.rows[i].cells[2].innerHTML;
  3170. var postperm = table.rows[i].cells[3].innerHTML;
  3171. var moderateperm = table.rows[i].cells[4].innerHTML;
  3172. var moveperm = table.rows[i].cells[5].innerHTML;
  3173. if(perms[readperm] !== undefined){
  3174. perms[readperm][1][0].push(title.trim());
  3175. }
  3176. if(perms[postperm] !== undefined){
  3177. perms[postperm][1][1].push(title.trim());
  3178. }
  3179. if(perms[moderateperm] !== undefined){
  3180. perms[moderateperm][1][2].push(title.trim());
  3181. }
  3182. if(perms[moveperm] !== undefined){
  3183. perms[moveperm][1][3].push(title.trim());
  3184. }
  3185. }
  3186. setSetting( 'AccessPerms', JSON.stringify(perms) );
  3187. delete perms;
  3188. delete table;
  3189. delete div;
  3190. delete response;
  3191. UpdateAccessList();
  3192. }
  3193. });
  3194. }
  3195. function UpdateAccessList(t) {
  3196. var perms = getSetting('AccessPerms',false);
  3197. if(perms === false){
  3198. return;
  3199. }else{
  3200. perms = JSON.parse(perms);
  3201. }
  3202. var table = $('main');
  3203. var x = table.rows[1].cells[4].innerHTML = "MENU VIEW";
  3204. var x = table.rows[1].cells[5].innerHTML = "PAGE VIEW";
  3205. var x = table.rows[1].insertCell(-1);
  3206. x.innerHTML = "PAGE EDIT";
  3207. var x = table.rows[1].insertCell(-1);
  3208. x.innerHTML = "BOARD VIEW";
  3209. var x = table.rows[1].insertCell(-1);
  3210. x.innerHTML = "BOARD POST";
  3211. var x = table.rows[1].insertCell(-1);
  3212. x.innerHTML = "BOARD EDIT";
  3213. var x = table.rows[1].insertCell(-1);
  3214. x.innerHTML = "BOARD MOVE";
  3215. for (var i = 2, row; row = table.rows[i]; i++) {
  3216. if(row.cells.length < 4){ continue; }
  3217. var perm = row.cells[3].innerHTML;
  3218. if(perms[perm] === undefined){ continue; }
  3219. row.cells[4].innerHTML = perms[perm][2].toString().replace(/,/g, "<br />"); //MENU
  3220. row.cells[5].innerHTML = perms[perm][3][0].toString().replace(/,/g, "<br />"); //PAGE VIEW
  3221. var x = table.rows[i].insertCell(-1);
  3222. x.innerHTML = perms[perm][3][1].toString().replace(/,/g, "<br />"); //PAGE EDIT
  3223. var x = table.rows[i].insertCell(-1);
  3224. x.innerHTML = perms[perm][1][0].toString().replace(/,/g, "<br />"); //BOARDS VIEW
  3225. var x = table.rows[i].insertCell(-1);
  3226. x.innerHTMLL = perms[perm][1][1].toString().replace(/,/g, "<br />"); //BOARDS POST
  3227. var x = table.rows[i].insertCell(-1);
  3228. x.innerHTMLL = perms[perm][1][2].toString().replace(/,/g, "<br />"); //BOARDS EDIT
  3229. var x = table.rows[i].insertCell(-1);
  3230. x.innerHTML = perms[perm][1][3].toString().replace(/,/g, "<br />"); //BOARD MOVE
  3231. }
  3232. }
  3233.  
  3234.  
  3235. var allTD = document.getElementsByTagName('td'); // get all TD elements
  3236. var perms = {};
  3237. for(var i=0; i<allTD.length; i++){
  3238. if(allTD[i].cellIndex == 3){
  3239. if(allTD[i].firstChild.textContent == "Permission"){
  3240. var table = allTD[i].parentNode.parentNode;
  3241. }
  3242. }
  3243. }
  3244. table.rows[0].cells[0].innerHTML = "<font size=+1><b>Site Permissions </B></font><span onmouseover=\"this.style.cursor='pointer';\"><font color='Orange'><b> ----- Click here to use GHQEditor to get a list of where these perms are used. (Takes a few seconds)</b></font></span>";
  3245. table.rows[0].cells[0].addEventListener("click", function(){CheckforAccessListVerify();}, false);
  3246. for (var i = 2, row; row = table.rows[i]; i++) {
  3247. if(row.cells.length < 4){ continue; }
  3248. var perm = row.cells[3].innerHTML;
  3249. perms[perm] = new Array();
  3250. perms[perm][1] = new Array(); //WILL BE BOARDS
  3251. perms[perm][1][0] = new Array(); //WILL BE BOARDS
  3252. perms[perm][1][1] = new Array(); //WILL BE BOARDS
  3253. perms[perm][1][2] = new Array(); //WILL BE BOARDS
  3254. perms[perm][1][3] = new Array(); //WILL BE BOARDS
  3255. perms[perm][2] = new Array(); //MENUS
  3256. perms[perm][3] = new Array(); //PAGES
  3257. perms[perm][3][0] = new Array(); //PAGES
  3258. perms[perm][3][1] = new Array(); //PAGES
  3259. }
  3260. setSetting( 'AccessPerms', JSON.stringify(perms) );
  3261. }
  3262.  
  3263. // ########################################################################################################################################################
  3264. // ########################################################################################################################################################
  3265. // ########################################################################################################################################################
  3266. // ########################################################################################################################################################
  3267. // ########################################################################################################################################################
  3268. // ########################################################################################################################################################
  3269. // ########################################################################################################################################################
  3270.  
  3271. function clocks() {
  3272.  
  3273. var temp = new Date();
  3274. temp = temp - locTimeFirst;
  3275.  
  3276. ghqTime = ghqTimeFirst.getTime() + temp;
  3277.  
  3278. var ghqTime = new Date(ghqTime);
  3279. var month = ghqTime.getMonth()+1;
  3280. var day = ghqTime.getDate();
  3281. var year = ghqTime.getFullYear();
  3282. var hour = ghqTime.getHours();
  3283. var minute = ghqTime.getMinutes();
  3284. var second = ghqTime.getSeconds();
  3285. second = zeroPad(second);
  3286. minute = zeroPad(minute);
  3287.  
  3288. if(getSetting(HOUR24_KEY,false)){
  3289. hour = zeroPad(hour);
  3290. ghqTimeString = month+'/'+day+'/'+year+' '+hour+':'+minute+':'+second;
  3291. }else{
  3292. if (hour>=12){
  3293. AorP="P.M.";
  3294. }else{
  3295. AorP="A.M.";
  3296. }
  3297. if (hour>=13){
  3298. hour -=12;
  3299. }
  3300. if (hour==0){
  3301. hour=12;
  3302. }
  3303. ghqTimeString = month+'/'+day+'/'+year+' '+hour+':'+minute+':'+second+' '+AorP;
  3304. }
  3305. headerLeftMenu.innerHTML = 'GHQ: '+ghqTimeString;
  3306. if(getSetting(GAME_TIME_SHOW_KEY,true)){
  3307. var gameTime = new Date();
  3308. var month = gameTime.getUTCMonth()+1;
  3309. var day = gameTime.getUTCDate();
  3310. var year = gameTime.getUTCFullYear();
  3311. var hour = gameTime.getUTCHours();
  3312. var minute = gameTime.getUTCMinutes();
  3313. var second = gameTime.getUTCSeconds();
  3314. second = zeroPad(second);
  3315. minute = zeroPad(minute);
  3316. if(getSetting(HOUR24_KEY,false)){
  3317. hour = zeroPad(hour);
  3318. gameTime = month+'/'+day+'/'+year+' '+hour+':'+minute+':'+second;
  3319. }else{
  3320. if (hour>=12){
  3321. AorP="P.M.";
  3322. }else{
  3323. AorP="A.M.";
  3324. }
  3325. if (hour>=13){
  3326. hour -=12;
  3327. }
  3328. if (hour==0){
  3329. hour=12;
  3330. }
  3331. gameTime = month+'/'+day+'/'+year+' '+hour+':'+minute+':'+second+' '+AorP;
  3332. }
  3333. headerLeftMenu.innerHTML = headerLeftMenu.innerHTML+'<br>Game: '+gameTime;
  3334. }
  3335. if(getSetting(LOCAL_TIME_SHOW_KEY,true)){
  3336. var locTime = new Date();
  3337. var month = locTime.getMonth()+1;
  3338. var day = locTime.getDate();
  3339. var year = locTime.getFullYear();
  3340. var hour = locTime.getHours();
  3341. var minute = locTime.getMinutes();
  3342. var second = locTime.getSeconds();
  3343. second = zeroPad(second);
  3344. minute = zeroPad(minute);
  3345. if(getSetting(HOUR24_KEY,false)){
  3346. hour = zeroPad(hour);
  3347. locTime = month+'/'+day+'/'+year+' '+hour+':'+minute+':'+second;
  3348. }else{
  3349. if (hour>=12){
  3350. AorP="P.M.";
  3351. }else{
  3352. AorP="A.M.";
  3353. }
  3354. if (hour>=13){
  3355. hour -=12;
  3356. }
  3357. if (hour==0){
  3358. hour=12;
  3359. }
  3360. locTime = month+'/'+day+'/'+year+' '+hour+':'+minute+':'+second+' '+AorP;
  3361. }
  3362. var locTimeOffset = new Date().getTimezoneOffset() / 60 * -1;
  3363. headerLeftMenu.innerHTML = headerLeftMenu.innerHTML+'<br>Local: '+locTime+' (GMT'+locTimeOffset+')';
  3364. }
  3365. if(getSetting(ANIMATE_SERVER_TIME_KEY,true)){
  3366. setTimeout(clocks,1000);
  3367. }
  3368. }
  3369.  
  3370. //==========================================
  3371. //MAIN LOAD
  3372. //==========================================
  3373. try{
  3374. var Clan_Clan = getClan();
  3375. if($('title') !== undefined){
  3376. var Title = $('title');
  3377. var Headline = $('headline');
  3378. var center = Title.firstChild.firstChild.childNodes[1];
  3379. if(center !== undefined){
  3380. var Clan_Username = center.childNodes[2].innerHTML;
  3381. var Clan_Username = Clan_Username.substring(0, Clan_Username.indexOf(','));
  3382. setSetting('Clan_Username', Clan_Username);
  3383. Title.firstChild.firstChild.childNodes[0].width = '15%';
  3384. Title.firstChild.firstChild.childNodes[2].width = '15%';
  3385. bgcolor = Title.firstChild.firstChild.bgColor;
  3386. var html = '<table width="100%" cellspacing="1" cellpadding="0"><tr bgcolor="'+bgcolor+'"><td align="center">'+center.innerHTML+'</td></tr></table>';
  3387. center.innerHTML = html;
  3388. if(Headline !== undefined){
  3389. center.appendChild(Headline);
  3390. }
  3391. center.bgColor = 'black';
  3392. if(!getSetting(GHQEDITOR_HEADER,false)){ //Had to change to non-booleon for chrome
  3393. //HEADER RIGHT MENU
  3394. headerRightMenu = Title.firstChild.firstChild.childNodes[2];
  3395. var span = document.createElement("span");
  3396. span.id = 'SettingsLink';
  3397. span.innerHTML = 'GHQEditor Settings';
  3398. span.setAttribute('align','center');
  3399. span.setAttribute('class','right_Menu');
  3400. var lineBreak = document.createElement('br');
  3401. headerRightMenu.appendChild(lineBreak);
  3402. headerRightMenu.appendChild(span);
  3403. var span = document.createElement("span");
  3404. span.id = 'SettingsHomepage';
  3405. span.innerHTML = "GHQEditor Homepage";
  3406. span.setAttribute('align','center');
  3407. span.setAttribute('class','right_Menu');
  3408. var lineBreak = document.createElement('br');
  3409. headerRightMenu.appendChild(lineBreak);
  3410. headerRightMenu.appendChild(span);
  3411. }else{
  3412. var newdiv = document.createElement('div');
  3413. newdiv.innerHTML = '<center><span id="GHQSet">GHQEditor: <span id="SettingsLink">Settings</span> | <span id="SettingsHomepage">Homepage</span></span></center>';
  3414. document.body.appendChild(newdiv);
  3415. $('GHQSet').setAttribute('class','right_MenuHeader');
  3416. $('SettingsLink').setAttribute('class','right_Menu');
  3417. $('SettingsHomepage').setAttribute('class','right_Menu');
  3418. }
  3419. $('SettingsLink').addEventListener("click", function(){ showConfig(null); }, true);
  3420. $('SettingsHomepage').addEventListener("click", function(){ window.open('https://greatest.deepsurf.us/en/scripts/27100-ghqeditor'); }, true);
  3421. //HEADER LEFT MENU
  3422. headerLeftMenu = Title.firstChild.firstChild.childNodes[0];
  3423. headerLeftMenu.noWrap = true;
  3424. var ghqTimeFirst = headerLeftMenu.firstChild.firstChild.innerHTML;
  3425. curTime = headerLeftMenu.firstChild.firstChild.innerHTML;
  3426. curTime = Date.parse(curTime);
  3427. headerLeftMenu.setAttribute('class','left_Menu');
  3428. ghqTimeFirst = Date.parse(ghqTimeFirst);
  3429. ghqTimeFirst = new Date(ghqTimeFirst);
  3430. var locTimeFirst = new Date();
  3431. clocks();
  3432.  
  3433. //CLEAN BOARD NEW POSTS
  3434. cleanBoards();
  3435. installCheck();
  3436. }
  3437. }
  3438. switch (page){
  3439. case "AccessManager":
  3440. accessManager();
  3441. case "ShowBoard":
  3442. if(getSetting(NEW_POSTS_KEY,true)){
  3443. newPosts();
  3444. }
  3445. //cleanBoard();
  3446. case "ShowPost":
  3447. if(getSetting(POST_AREA_KEY,true)){
  3448. postAreaAugment();
  3449. }
  3450. if(getSetting(NEW_POSTS_KEY,true) && page === "ShowPost"){
  3451. newPostMarkRead();
  3452. }
  3453. break;
  3454. case "SiteManager":
  3455. if(getSetting(SITE_MANAGER_KEY,true)){
  3456. siteManager();
  3457. }
  3458. break;
  3459. case "TargetInfo":
  3460. if(getSetting(TARGET_SELECTOR_KEY,true)){
  3461. targetInfo();
  3462. }
  3463. break;
  3464. case "TargetSelector":
  3465. if(getSetting(TARGET_SELECTOR_KEY,true)){
  3466. targetSelector();
  3467. }
  3468. break;
  3469. case "UserManager":
  3470. if(getSetting(EDIT_USER_KEY,true)){
  3471. userManager();
  3472. }
  3473. break;
  3474. case "BotList":
  3475. if(getSetting(BOT_LIST_KEY,true)){
  3476. botList();
  3477. }
  3478. break;
  3479. case "EditUser":
  3480. if(getSetting(EDIT_USER_KEY,true)){
  3481. editUser();
  3482. }
  3483. break;
  3484. case "EditGroup":
  3485. if(getSetting(EDIT_USER_KEY,true)){
  3486. editGroupCheck();
  3487. }
  3488. break;
  3489. default:
  3490. if(getSetting(LEFT_MENU_KEY,true)){
  3491. var page2 = path.substring(0, path.indexOf('.ASP')); // extract page name from URL
  3492. page2 = page2.substring(page2.lastIndexOf('/')+1); // extract page name from URL
  3493. if(page2 == "LINKS"){
  3494. if(window.name != 'newPostsPage'){
  3495. links();
  3496. }
  3497. }
  3498. }
  3499. break;
  3500. }
  3501.  
  3502. } catch (e) { console.log("Main Load: "+e); return; }