HumanGirl

ForTheGoodOfAll

Dec 30th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           SRDotDX - FortheGoodofAll
  3. // @namespace      tag://kongregate
  4. // @description    Easier Kongregate's Dawn of the Dragons
  5. // @author         SReject, chairmansteve, JHunz, wpatter6, MoW, true_heathen, HG
  6. // @version        1.6
  7. // @date           12.30.2012
  8. // @grant          none
  9. // @include        http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons*
  10. // @include        *pastebin.com*
  11. // @include        *web*.dawnofthedragons.com/kong*
  12. // ==/UserScript==
  13.  
  14.  
  15.  
  16.  
  17.  
  18. // @DELETE THIS LINE BEFORE PUBLIC RELEASE@       LAST EDITED BY: HumanGirl - On 30.12.12 at 19:10
  19.  
  20.  
  21.  
  22.  
  23. function main() {
  24. // if any1 needs a simple way to calculate damage: atk*4+def+legionpower*5
  25.     if (typeof GM_setValue == 'undefined' || typeof GM_getValue == 'undefined' || typeof GM_deleteValue == 'undefined') {
  26.         GM_setValue = function (name,value) {
  27.             localStorage.setItem(name, (typeof value).substring(0,1) + value);
  28.         }
  29.         GM_getValue = function (name,dvalue) {
  30.             var value = localStorage.getItem(name);
  31.             if (typeof value != 'string') {
  32.                 return dvalue;
  33.             }
  34.             else {
  35.                 var type = value.substring(0,1);
  36.                 value = value.substring(1);
  37.                 if (type == 'b') {
  38.                     return (value == 'true');
  39.                 }
  40.                 else if (type == 'n') {
  41.                     return Number(value);
  42.                 }
  43.                 else {
  44.                     return value;
  45.                 }
  46.             }
  47.         }
  48.         GM_deleteValue = function (name)  {
  49.             localStorage.removeItem(name);
  50.         }
  51.     }
  52.     window.FPX = {
  53.         tooltip:(function(){
  54.             var id = 'FPXtt';
  55.             var top = 3;
  56.             var left = 3;
  57.             var maxw = 300;
  58.             var speed = 10;
  59.             var timer = 20;
  60.             var endalpha = 95;
  61.             var alpha = 0;
  62.             var tt,t,c,b,h;
  63.             var ie = document.all ? true : false;
  64.            
  65.             var tmp={};
  66.             tmp.id = 'FPXtt';
  67.             tmp.top = 3;
  68.             tmp.left = 3;
  69.             tmp.maxw = 300;
  70.             tmp.speed = 10;
  71.             tmp.timer = 20;
  72.             tmp.endalpha = 95;
  73.             tmp.alpha = 0;
  74.             tmp.tt,tmp.t,tmp.c,tmp.b,tmp.h;
  75.             tmp.ie = document.all ? true : false;
  76.            
  77.             tmp.show=function(v,w){
  78.                     if(tt == null){
  79.                         tt = document.createElement('div');
  80.                         tt.setAttribute('id',id);
  81.                         t = document.createElement('div');
  82.                         t.setAttribute('id',id + 'top');
  83.                         c = document.createElement('div');
  84.                         c.setAttribute('id',id + 'cont');
  85.                         b = document.createElement('div');
  86.                         b.setAttribute('id',id + 'bot');
  87.                         tt.appendChild(t);
  88.                         tt.appendChild(c);
  89.                         tt.appendChild(b);
  90.                         document.body.appendChild(tt);
  91.                         tt.style.opacity = 0;
  92.                         tt.style.filter = 'alpha(opacity=0)';
  93.                         document.onmousemove = this.pos;
  94.                     }
  95.                     tt.style.display = 'block';
  96.                     c.innerHTML = v;
  97.                     tt.style.width = w ? w + 'px' : 'auto';
  98.                     if(!w && ie){
  99.                         t.style.display = 'none';
  100.                         b.style.display = 'none';
  101.                         tt.style.width = tt.offsetWidth;
  102.                         t.style.display = 'block';
  103.                         b.style.display = 'block';
  104.                     }
  105.                     if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
  106.                         h = parseInt(tt.offsetHeight) + top;
  107.                         clearInterval(tt.timer);
  108.                         tt.timer = setInterval(function(){FPX.tooltip.fade(1)},timer);
  109.                 };
  110.             tmp.pos=function(e){
  111.                     var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
  112.                     var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
  113.                     tt.style.top = (u - h) + 'px';
  114.                     tt.style.left = (l + left) + 'px';
  115.                 };
  116.             tmp.fade=function(d){
  117.                     var a = alpha;
  118.                     if((a != endalpha && d == 1) || (a != 0 && d == -1)){
  119.                         var i = speed;
  120.                         if(endalpha - a < speed && d == 1){
  121.                             i = endalpha - a;
  122.                         }else if(alpha < speed && d == -1){
  123.                             i = a;
  124.                         }
  125.                         alpha = a + (i * d);
  126.                         tt.style.opacity = alpha * .01;
  127.                         tt.style.filter = 'alpha(opacity=' + alpha + ')';
  128.                     }else{
  129.                         clearInterval(tt.timer);
  130.                         if(d == -1){tt.style.display = 'none'}
  131.                     }
  132.                 };
  133.                 tmp.hide=function(){
  134.                     clearInterval(tt.timer);
  135.                     tt.timer = setInterval(function(){FPX.tooltip.fade(-1)},timer);
  136.                 };
  137.             return tmp;
  138.         })()
  139.     }
  140.     //dateformatting utilities
  141.     window.dateFormat=function(){var token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val};return function(date,mask,utc){var dF=dateFormat;if(arguments.length==1&&Object.prototype.toString.call(date)=="[object String]"&&!/\d/.test(date)){mask=date;date=undefined}date=date?new Date(date):new Date;if(isNaN(date))throw SyntaxError("invalid date");mask=String(dF.masks[mask]||mask||dF.masks["default"]);if(mask.slice(0,4)=="UTC:"){mask=mask.slice(4);utc=true}var _=utc?"getUTC":"get",d=date[_+"Date"](),D=date[_+"Day"](),m=date[_+"Month"](),y=date[_+"FullYear"](),H=date[_+"Hours"](),M=date[_+"Minutes"](),s=date[_+"Seconds"](),L=date[_+"Milliseconds"](),o=utc?0:date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};return mask.replace(token,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1)})}}();dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};
  142.     window.timeSince=function(date,after){if(typeof date=='number')date=new Date(date);var seconds=Math.abs(Math.floor((new Date().getTime()-date.getTime())/1000));var interval=Math.floor(seconds/31536000);var pretext="about ";var posttext=" ago";if(after)posttext=" left";if(interval>=1){return pretext+interval+" year"+(interval==1?'':'s')+posttext}interval=Math.floor(seconds/2592000);if(interval>=1){return pretext+interval+" month"+(interval==1?'':'s')+posttext}interval=Math.floor(seconds/86400);if(interval>=1){return pretext+interval+" day"+(interval==1?'':'s')+posttext}interval=Math.floor(seconds/3600);if(interval>=1){return pretext+interval+" hour"+(interval==1?'':'s')+posttext}interval=Math.floor(seconds/60);if(interval>=1){return interval+" minute"+(interval==1?'':'s')+posttext}return Math.floor(seconds)+" second"+(seconds==1?'':'s')+posttext}
  143.     window.isNumber=function(n) {return !isNaN(parseFloat(n)) && isFinite(n);}
  144.     window.eliminateDuplicates=function(arr){var i,len=arr.length,out=[],obj={};for(i=0;i<len;i++){obj[arr[i]]=0}for(i in obj){out.push(i)}return out}
  145.     window.elfade=function(elem,time){if(typeof time!='number')time=500;if(typeof elem=='string')elem=document.getElementById(elem);if(elem==null)return;var startOpacity=elem.style.opacity||1;elem.style.opacity=startOpacity;var tick=1/(time/100);(function go(){elem.style.opacity=Math.round((elem.style.opacity-tick)*100)/100;if(elem.style.opacity>0)setTimeout(go,100);else elem.style.display='none'})()}
  146.    
  147.     window.SRDotDX = {
  148.         version: {major: "1.0", minor: "FortheGoodofAll"},
  149.         echo: function(msg){holodeck.activeDialogue().SRDotDX_echo(msg)},
  150.         config: (function(){
  151.             try {
  152.                 var tmp = JSON.parse(GM_getValue("SRDotDX","{}"));
  153.             }
  154.             catch (e) {var tmp = {}}
  155.             tmp.scrollbarFix = (typeof tmp.scrollbarFix == 'boolean'?tmp.scrollbarFix:true);
  156.             tmp.splitLongMsgs = (typeof tmp.splitLongMsgs == 'boolean'?tmp.splitLongMsgs:true);
  157.             tmp.hideRaidLinks = (typeof tmp.hideRaidLinks == 'boolean'?tmp.hideRaidLinks:false);
  158.             tmp.hideVisitedRaids = (typeof tmp.hideVisitedRaids == 'boolean'?tmp.hideVisitedRaids:false);
  159.             tmp.hideVisitedRaidsInRaidList = (typeof tmp.hideVisitedRaidsInRaidList == 'boolean'?tmp.hideVisitedRaidsInRaidList:false);
  160.             tmp.hideSeenRaids = (typeof tmp.hideSeenRaids == 'boolean'?tmp.hideSeenRaids:false);
  161.             tmp.FPXmarkRightClick = (typeof tmp.FPXmarkRightClick == 'boolean'?tmp.FPXmarkRightClick:false);
  162.             tmp.markMyRaidsVisted = (typeof tmp.markMyRaidsVisted == 'boolean'?tmp.markMyRaidsVisted:false);
  163.             tmp.whisperSpam = false;
  164.             tmp.autoWhisper = (typeof tmp.autoWhisper == 'boolean'?tmp.autoWhisper:false);
  165.             tmp.markImportedVisited = (typeof tmp.markImportedVisited == 'boolean'?tmp.markImportedVisited:false);
  166.             tmp.prettyPost = (typeof tmp.prettyPost == 'boolean'?tmp.prettyPost:false);
  167.             tmp.useMaxRaidCount = (typeof tmp.useMaxRaidCount =='boolean'?tmp.useMaxRaidCount:false);
  168.             tmp.maxRaidCount = (!(typeof tmp.maxRaidCount === 'undefined')?tmp.maxRaidCount:3000);
  169.             tmp.autoImportPaste = (typeof tmp.autoImportPaste =='boolean'?tmp.autoImportPaste:false);
  170.             tmp.confirmForLargePaste = (typeof tmp.confirmForLargePaste =='boolean' && tmp.confirmPasteSize?tmp.confirmForLargePaste:false);
  171.             tmp.confirmPasteSize = (typeof tmp.confirmPasteSize =='number'?tmp.confirmPasteSize:1000);
  172.             tmp.refreshGameToJoin = (typeof tmp.refreshGameToJoin == 'boolean'? tmp.refreshGameToJoin:true);
  173.             tmp.showStatusOverlay = (typeof tmp.showStatusOverlay == 'boolean'? tmp.showStatusOverlay:false);
  174.             tmp.confirmDeletes = (typeof tmp.confirmDeletes == 'boolean'?tmp.confirmDeletes:true);
  175.             tmp.asyncJoin = (typeof tmp.asyncJoin == 'boolean'?tmp.asyncJoin:false);
  176.             tmp.asyncJoinCount = (!(typeof tmp.asyncJoinCount === 'undefined')?tmp.asyncJoinCount:5);
  177.             tmp.autoPostPaste = (typeof tmp.autoPostPaste == 'boolean'?tmp.autoPostPaste:false);
  178.             tmp.whisperTo = (typeof tmp.whisperTo == 'string'?tmp.whisperTo:'');
  179.             tmp.showRaidLink = (typeof tmp.showRaidLink == 'boolean'?tmp.showRaidLink:(navigator.userAgent.toLowerCase().indexOf('chrome')>-1));
  180.             tmp.formatLinkOutput = (typeof tmp.formatLinkOutput == 'boolean'?tmp.formatLinkOutput:false);
  181.             tmp.FPXoptsMarkRightClickDelay = (typeof tmp.FPXoptsMarkRightClickDelay == 'number'?tmp.FPXoptsMarkRightClickDelay:2000);
  182.             tmp.formatRaidLinks = (typeof tmp.formatRaidLinks == 'boolean'?tmp.formatRaidLinks:true);
  183.             tmp.raidLinkFormat = (typeof tmp.raidLinkFormat == 'string'?tmp.raidLinkFormat:"<seen:(s) ><visited:(v) ><shortname> - <diff> - <fs>/<os>");
  184.             tmp.raidLinkFormat = tmp.raidLinkFormat.replace(/&#91;/g,"[").replace(/&#93;/g,"]").replace(/&#123;/g,"{").replace(/&#125;/g,"}")
  185.             tmp.unvisitedRaidPruningMode = (typeof tmp.unvisitedRaidPruningMode == 'number'? tmp.unvisitedRaidPruningMode : 1);
  186.             tmp.selectedRaids = (typeof tmp.selectedRaids == 'string'?tmp.selectedRaids:"");
  187.             tmp.pastebinUrl = (typeof tmp.pastebinUrl == 'string'?tmp.pastebinUrl:"");
  188.             tmp.lastUpdateCheck = (typeof tmp.lastUpdateCheck == 'number'?tmp.lastUpdateCheck:0);
  189.  
  190.             if (typeof tmp.mutedUsers != 'object')tmp.mutedUsers = {};
  191.             if (typeof tmp.raidList != 'object')tmp.raidList = {};
  192.             if (typeof tmp.pasteList != 'object')tmp.pasteList = {};
  193.  
  194.             // Raid list indexing upgrade code
  195.             tmp.pendingRaidListIndexingChange = (typeof tmp.pendingRaidListIndexingChange == 'boolean'?tmp.pendingRaidListIndexingChange:true);
  196.             if (tmp.pendingRaidListIndexingChange == true) {
  197.                 var raidList2 = {};
  198.  
  199.                 for (var hash in tmp.raidList) {
  200.                     if (tmp.raidList.hasOwnProperty(hash)) {
  201.                         raidList2[tmp.raidList[hash].id] = tmp.raidList[hash];
  202.                     }
  203.                 }
  204.  
  205.                 tmp.raidList = raidList2;
  206.                 tmp.pendingRaidListIndexingChange = false;
  207.             }
  208.  
  209.             // Delete expired raids
  210.             for (var id in tmp.raidList){
  211.                 if (tmp.raidList.hasOwnProperty(id)) {
  212.                     tmp.raidList[id].timeLeft = function (){
  213.                         return this.expTime - parseInt((new Date).getTime() / 1000);
  214.                     }
  215.                     if (tmp.raidList[id].timeLeft() < 0) {
  216.                         delete tmp.raidList[id];
  217.                     }
  218.                 }
  219.             }
  220.  
  221.             if (typeof tmp.filters != 'object') {
  222.                 tmp.filters = {}
  223.             }
  224.  
  225.             // Default filtering settings filter out guild raids and personal raids from chat
  226.             tmp.getFilter = function(raidid,diffIndex) {
  227.                 // Upgrade from raid id filtering to raid id/difficulty filtering data structure
  228.                 if (typeof SRDotDX.config.filters[raidid] == 'boolean') {
  229.                     var tempVal = SRDotDX.config.filters[raidid];
  230.                     SRDotDX.config.filters[raidid] = [tempVal, tempVal, tempVal, tempVal, tempVal, tempVal];
  231.                 } else if ((typeof SRDotDX.config.filters[raidid] != 'boolean') && (typeof SRDotDX.config.filters[raidid] != 'object')) {
  232.                     var raid = SRDotDX.raids[raidid];
  233.                     if (raid.size == 1 || raid.stat == 'H' || raid.stat == 'h') {
  234.                         SRDotDX.config.filters[raidid] = [true, true, true, true, true, true];
  235.                     } else {
  236.                         SRDotDX.config.filters[raidid] = [false, false, false, false, false];
  237.                     }
  238.                 }
  239.                    
  240.                 return SRDotDX.config.filters[raidid][diffIndex];
  241.             }
  242.             tmp.setFilter = function(raidid,diff,val) {
  243.                 SRDotDX.config.filters[raidid][diff] = val;
  244.             }
  245.  
  246.             tmp.filterChatLinks = (typeof tmp.filterChatLinks == 'boolean'?tmp.filterChatLinks:true);
  247.             tmp.filterRaidList = (typeof tmp.filterRaidList == 'boolean'?tmp.filterRaidList:false);
  248.             tmp.newRaidsAtTopOfList = (typeof tmp.newRaidsAtTopOfList == 'boolean'?tmp.newRaidsAtTopOfList:false);
  249.  
  250.             // Update old default for right click delay
  251.             // It's obvious this wasn't widely used, because a bug was preventing saving any value except the default
  252.             if (tmp.FPXoptsMarkRightClickDelay == 8000) { tmp.FPXoptsMarkRightClickDelay = 2000; }
  253.  
  254.             GM_setValue("SRDotDX",JSON.stringify(tmp));
  255.             tmp.addRaid = function(hash,id,boss,diff,seen,visited,user,ts,room) {
  256.                 if (typeof SRDotDX.config.getRaid(id) != 'object') {
  257.                     SRDotDX.config.raidList[id] = {
  258.                         hash: hash,
  259.                         id: id,
  260.                         boss: boss,
  261.                         diff: diff,
  262.                         seen: seen,
  263.                         visited: visited,
  264.                         user: user,
  265.                         lastUser: user,
  266.                         expTime: (typeof SRDotDX.raids[boss] == 'object'?SRDotDX.raids[boss].duration:168) * 3600+parseInt((new Date).getTime() / 1000),
  267.                         timeLeft: function (){return this.expTime - parseInt((new Date).getTime() / 1000)},
  268.                         timeStamp: ((typeof ts ==='undefined'||ts==null)?(new Date().getTime()):parseInt(ts)),
  269.                         room: ((typeof room ==='undefined'||room==null)?SRDotDX.getRoomName():parseInt(room)),
  270.                         nuked: false
  271.                     }
  272.                     SRDotDX.gui.addRaid(id);
  273.                     //onNewRaid
  274.                     setTimeout(function(){SRDotDX.purge()}, 1);
  275.                 }
  276.                 SRDotDX.config.raidList[id].lastUser = user;
  277.                 return SRDotDX.config.raidList[id]
  278.             }
  279.             tmp.addPaste = function(url,id,poster,user,newtotal,total){
  280.                 if (typeof SRDotDX.config.getPaste(id) != 'object') {
  281.                     SRDotDX.config.pasteList[id]={
  282.                         url: url,
  283.                         id: id,
  284.                         user: user || poster,
  285.                         poster: poster,
  286.                         lastUser: user,
  287.                         timeStamp: new Date().getTime(),
  288.                         lastseen: new Date().getTime(),
  289.                         newTotal:newtotal,
  290.                         total:total,
  291.                         favorite:false
  292.                     }
  293.                     console.log("[SRDotDX] New pastebin added " + id + " : " + user);
  294.                     SRDotDX.gui.addPaste(id);
  295.                 }
  296.                 SRDotDX.config.pasteList[id].lastuser = user;
  297.                 SRDotDX.config.pasteList[id].lastseen = new Date().getTime();
  298.                 return SRDotDX.config.pasteList[id]            
  299.             }
  300.             tmp.exprt = function () {
  301.                 SRDotDX.config.save();
  302.                 window.prompt("Export Data:",JSON.stringify(SRDotDX.config));
  303.             }
  304.             tmp.getRaid = function(id) {
  305.                 if (typeof SRDotDX.config.raidList[id] == 'object') {
  306.                     if (SRDotDX.config.raidList[id].timeLeft() > 1) {
  307.                         return SRDotDX.config.raidList[id];
  308.                     }
  309.                     else {
  310.                         delete SRDotDX.config.raidList[id];
  311.                     }
  312.                 }
  313.             }
  314.             tmp.getPaste = function(id) {
  315.                 if (typeof SRDotDX.config.pasteList[id] == 'object') {
  316.                     console.log("[SRDotDX] Returning paste " + id);
  317.                     return SRDotDX.config.pasteList[id];
  318.                 }
  319.             }
  320.             tmp.imprt = function (data) {
  321.             }
  322.             tmp.save = function (b) {
  323.                 b = (typeof b==='undefined'?true:b);
  324.                 for (var id in SRDotDX.config.raidList){
  325.                     if (SRDotDX.config.raidList.hasOwnProperty(id) && SRDotDX.config.raidList[id].timeLeft <= 0) {
  326.                         delete SRDotDX.config.raidList[id];
  327.                         SRDotDX.gui.raidListRemoveById(id);
  328.                     }
  329.                 }
  330.                 var a = SRDotDX.config.raidFormat;
  331.                 SRDotDX.config.raidFormat = SRDotDX.config.raidLinkFormat.replace(/\{/g,"&#123;").replace(/\}/g,"&#125;").replace(/\[/g,"&#91;").replace(/\]/g,"&#93;")
  332.                 GM_setValue("SRDotDX",JSON.stringify(SRDotDX.config));
  333.                 SRDotDX.config.raidFormat = a;
  334.                 if(b) setTimeout("SRDotDX.config.save(true);",30000);
  335.                 console.log("[SRDotDX] Config saved (repeat="+b+")");
  336.             }
  337.             return tmp;
  338.         })(),
  339.         purge: function() {
  340.             var el = document.getElementById('raid_list');
  341.             if(el){
  342.                 var diff = el.childNodes.length - SRDotDX.config.maxRaidCount;
  343.                 if(SRDotDX.config.useMaxRaidCount && diff > 0){
  344.                     if(!SRDotDX.gui.Importing){
  345.                         console.log("[SRDotDX] Purging started " + diff);
  346.                        
  347.                         var i=0, total=0;
  348.                         var draids = SRDotDX.gui.GetRaids('nuked_');
  349.                         draids.sort(function(a,b){
  350.                             if(a && !(typeof a.timeStamp === 'undefined' || typeof b.timeStamp === 'undefined'))
  351.                                 if(a.timeStamp < b.timeStamp) return -1;
  352.                             return 1;
  353.                         });
  354.                         console.log("[SRDotDX] Purging dead raids (" + diff + "/" + draids.length + ")");//dead raids first
  355.                         while(i<draids.length && diff > 0){
  356.                            
  357.                             SRDotDX.gui.deleteRaid(draids[i].ele.getElementsByClassName("FPXDeleteLink")[0], draids[i].id);
  358.                             i++; diff--;
  359.                         }
  360.                         console.log("[SRDotDX] Purged dead raids (" + i + "/" + draids.length + ")");
  361.                         delete draids;
  362.                         total+=i; i=0;
  363.                         if(diff > 0){
  364.                             var uraids = SRDotDX.gui.GetRaids('new_hidden_');
  365.                             uraids.sort(function(a,b){
  366.                                 if(a && !(typeof a.timeStamp === 'undefined' || typeof b.timeStamp === 'undefined'))
  367.                                     if(a.timeStamp < b.timeStamp) return -1;
  368.                                 return 1;
  369.                             });
  370.                             console.log("[SRDotDX] Purging hidden new raids (" + diff + "/" + uraids.length + ")");
  371.                             while(i<uraids.length && diff > 0){
  372.                                 SRDotDX.gui.deleteRaid(uraids[i].ele.getElementsByClassName("FPXDeleteLink")[0], uraids[i].id);
  373.                                 i++; diff--;
  374.                             }
  375.                             console.log("[SRDotDX] Purged hidden new raids (" + i + "/" + uraids.length + ")");
  376.                             delete uraids;
  377.                             total+=i; i=0;
  378.                         }
  379.                         if(diff > 0){
  380.                             var raids = SRDotDX.gui.GetRaids('hidden_');
  381.                             raids.sort(function(a,b){
  382.                                 if(a && !(typeof a.timeStamp === 'undefined' || typeof b.timeStamp === 'undefined'))
  383.                                     if(a.timeStamp < b.timeStamp) return -1;
  384.                                 return 1;
  385.                             });
  386.                             console.log("[SRDotDX] Purging raids (" + diff + "/" + raids.length + ")");
  387.                             while(i<raids.length && diff > 0){
  388.                                 //if((new Date).getTime() - raids[i].timeStamp > 3600000){//only if it's older than 1 hour
  389.                                     SRDotDX.gui.deleteRaid(raids[i].ele.getElementsByClassName("FPXDeleteLink")[0], raids[i].id);
  390.                                     i++; diff--;
  391.                                 //}
  392.                             }
  393.                             console.log("[SRDotDX] Purged raids (" + i + "/" + raids.length + ")");
  394.                             delete raids;
  395.                         }
  396.                         total += i;
  397.                         SRDotDX.gui.doStatusOutput('Exceeded max raids. ' + total + ' old raids purged.');
  398.                         console.log("[SRDotDX] Purging ended");
  399.                     }//else setTimeout("SRDotDX.purge();", 1000);
  400.                 }
  401.             }
  402.         },
  403.         getRaidDetailsBase: function(url) {
  404.             //if(!/^http:\/\/www\.kongregate\.com\/games\/5thplanetgames\/dawn-of-the-dragons(?:\/?$|\?|#)/i.test(url)) return null;//added security for pastebin import
  405.             var r = {diff: '', hash: '', boss: '', id: ''};
  406.             var reg = /[?&]([^=]+)=([^?&]+)/ig, p = url.replace(/&amp;/gi,"&");
  407.             while ((i = reg.exec(p)) != null) {
  408.                 if (!r.diff && i[1] == 'kv_difficulty'){
  409.                     r.diff=parseInt(i[2])
  410.                 }
  411.                 else if (!r.hash && i[1] == 'kv_hash'){
  412.                     r.hash=i[2]
  413.                 }
  414.                 else if (!r.boss && i[1] == 'kv_raid_boss'){
  415.                     r.boss=i[2]
  416.                 }
  417.                 else if (!r.id && i[1] == 'kv_raid_id'){
  418.                     r.id=i[2]
  419.                 }
  420.                 else if (i[1] != 'kv_action_type'){
  421.                     return
  422.                 }
  423.             }
  424.             if (typeof r != 'undefined' && typeof r.diff != 'undefined' && typeof r.hash != 'undefined' && typeof r.boss != 'undefined' && typeof r.id != 'undefined') {
  425.                 r.diffLongText = ['Normal','Hard','Legendary','Nightmare','Insane','Hell'][r.diff-1];
  426.                 r.diffShortText = ['N','H','L','NM','I','HL'][r.diff-1];
  427.                
  428.                 var stats = SRDotDX.raids[r.boss];
  429.                 if (typeof stats == 'object') {
  430.                     r.name = stats.name;
  431.                     r.shortname = stats.shortname;
  432.                     r.size = stats.size;
  433.                     r.dur = stats.duration;
  434.                     r.durText = stats.dur + "hrs";
  435.                     r.stat = stats.stat;
  436.                     r.statText = SRDotDX.getStatText(stats.stat);
  437.                     if (!isNaN(stats.health[r.diff-1])) {
  438.                         r.health = stats.health[r.diff-1];
  439.                         r.healthText = SRDotDX.getShortNum(r.health);
  440.                         if (r.boss == "dragons_lair") {
  441.                             r.fairShareText = "";
  442.                         } else {
  443.                             r.fairShare = r.health / r.size;
  444.                             r.fairShareText = SRDotDX.getShortNum(r.fairShare);
  445.  
  446.                         }
  447.  
  448.                         if (typeof stats.loottiers == 'object' && typeof stats.loottiers[r.diff-1] == 'object') {
  449.                             r.fairShareText = "";
  450.                             var tiers = stats.loottiers[r.diff-1];
  451.                             var text = 'Tiered loot: ' + SRDotDX.getLootTierText(stats.id,(r.diff - 1));
  452.                             r.optimalShare = 0;
  453.                             r.optimalShareText = text;
  454.  
  455.                         } else {
  456.  
  457.                             r.optimalShare = r.fairShare * {"1": 1, "10":1.25, "13":1.25, "15":1.25, "50": 2.2, "100":2.3, "250": 1, "500": 1.5}[r.size];                  
  458.                             r.optimalShareText = SRDotDX.getShortNum(r.optimalShare);
  459.                         }
  460.                        
  461.                     }
  462.                     else if (stats.health[0] == 'Unlimited') {
  463.                         r.health = '';
  464.                         r.healthText = 'Unlimited';
  465.                         if (typeof stats.loottiers == 'object' && typeof stats.loottiers[r.diff-1] == 'object' && stats.loottiers[r.diff-1][0]) {
  466.                             // TODO: At some point, make the numeric FS/OS numbers here line up with the correct textual ones
  467.                             r.fairshare = 1000000000;
  468.                             r.optimalShare = 1000000000;
  469.                             r.fairShareText = stats.loottiers[r.diff-1][0];
  470.                             r.optimalShareText = stats.loottiers[r.diff-1][stats.loottiers[r.diff-1].length-1];
  471.                         } else {
  472.                             r.fairShare = 1000000000;
  473.                             r.fairShareText = SRDotDX.getShortNum(r.fairShare);
  474.                             r.optimalShare = 1000000000;
  475.                             r.optimalShareText = SRDotDX.getShortNum(r.optimalShare);
  476.                         }
  477.                     }
  478.                     else {
  479.                         r.health = '';
  480.                         r.healthText = 'Unknown';
  481.                         r.fairShare = '';
  482.                         r.fairShareText = 'Unknown';
  483.                         r.fairShare = '';
  484.                         r.optimalShareText = 'Unknown';
  485.                     }
  486.                 }
  487.             }
  488.             return r;
  489.         },
  490.         getPasteDetails: function(url, user) {
  491.             user=(user?user:'');
  492.             var pb = {url: url, id: url.substring(url.length-8)};
  493.             pb.id = url.substring(url.length-8);
  494.             console.log("[SRDotDX] Getting paste");
  495.             var info = SRDotDX.config.getPaste(pb.id);
  496.             console.log(typeof info);
  497.             if(typeof info === 'undefined'){
  498.                 info = SRDotDX.config.addPaste(pb.url, pb.id, user);
  499.                 if(typeof info == 'object'){
  500.                     console.log("[SRDotDX] Paste is new");
  501.                     pb.isNew = true;
  502.                 }
  503.             } else pb.isNew = false;
  504.             pb.user = info.user;
  505.             pb.lastUser = info.lastUser;
  506.             return pb;
  507.         },
  508.         getRaidDetails: function(url,user,visited,seen,ts,room) {
  509.             user=(user?user:'');
  510.             visited=(visited?visited:(user==active_user.username() && SRDotDX.config.markMyRaidsVisted));
  511.             seen=(seen?seen:false);
  512.             var i;
  513.             var r = SRDotDX.getRaidDetailsBase(url);
  514.             if (typeof r != 'undefined' && typeof r.diff != 'undefined' && typeof r.hash != 'undefined' && typeof r.boss != 'undefined' && typeof r.id != 'undefined') {
  515.                 var info = SRDotDX.config.getRaid(r.id);
  516.                 if (typeof info != 'object') {
  517.                     info = SRDotDX.config.addRaid(r.hash, r.id, r.boss, r.diff,visited,seen,user,ts,room)
  518.                     if(typeof info == 'object') r.isNew = true;
  519.                     //inserting new raid
  520.                 } else r.isNew = false;
  521.                 r.timeStamp = info.timeStamp;
  522.                 r.seen = info.seen;
  523.                 r.visited = info.visited;
  524.                 r.nuked = info.nuked;
  525.  
  526.                 r.linkText = function () {
  527.                     if (SRDotDX.config.formatRaidLinks){
  528.                         var txt = SRDotDX.config.raidLinkFormat;
  529.                         txt = txt.replace(/<visited:([^>]*)>/gi,(this.visited?"$1":""));
  530.                         txt = txt.replace(/<seen:([^>]*)>/gi,(this.seen?"$1":""));
  531.                         txt = txt.replace(/<diff>/gi,this.diffShortText);
  532.                         txt = txt.replace(/<diff:Num>/gi,this.diff);
  533.                         txt = txt.replace(/<diff:Long>/gi,this.diffLongText);
  534.                         txt = txt.replace(/<bossId>/gi,this.boss);
  535.                         txt = txt.replace(/<raidId>/gi,this.id);
  536.                         txt = txt.replace(/<hash>/gi,this.hash);
  537.                         txt = txt.replace(/<name>/gi,(!this.name?'Unknown':this.name));
  538.                         txt = txt.replace(/<shortname>/gi,(!this.name?'Unknown':SRDotDX.raids[this.boss].shortname));
  539.                         txt = txt.replace(/<size>/gi,(!this.name?'':this.size));
  540.                         txt = txt.replace(/<dur>/gi,(!this.name?'':this.durText));
  541.                         txt = txt.replace(/<dur:Num>/gi,(!this.name?'':this.dur));
  542.                         txt = txt.replace(/<stat>/gi,(!this.name?'':this.stat));
  543.                         txt = txt.replace(/<stat:Long>/gi,(!this.name?'':this.statText));
  544.                         txt = txt.replace(/<health>/gi,(!this.name?'':this.healthText));
  545.                         txt = txt.replace(/<health:Num>/gi,(!this.name?'':this.health));
  546.                         txt = txt.replace(/<fs>/gi,(!this.name?'':this.fairShareText));
  547.                         txt = txt.replace(/<fs:Num>/gi,(!this.name?'':this.fairShare));
  548.                         txt = txt.replace(/<os>/gi,(!this.name?'':this.optimalShareText));
  549.                         txt = txt.replace(/<os:Num>/gi,(!this.name?'':this.optimalShare)); 
  550.                         txt = txt.replace(/</g,"&lt;").replace(/>/g,"&gt;");
  551.                         return txt.replace(/&lt;image&gt;/gi,'<image src="http://cdn2.kongregate.com/game_icons/0033/2679/i.gif" style="vertical-align: text-top; float: left;">');
  552.                     }
  553.                     else {
  554.                         return '<image src="http://cdn2.kongregate.com/game_icons/0033/2679/i.gif" style="vertical-align: text-top"> Legacy of a Thousand Suns'
  555.                     }
  556.                 }
  557.                 return r;
  558.             }
  559.         },
  560.         browser: {
  561.             ff:(navigator.userAgent.toLowerCase().indexOf("firefox")>-1),
  562.             chrome:(navigator.userAgent.toLowerCase().indexOf('chrome')>-1)
  563.         },
  564.         getRaidLink: function (msg,user) {
  565.             msg = msg.replace(/[\r\n]/g,"");
  566.             var m = /^((?:(?!<a[ >]).)*)<a.*? href="((?:(?:https?:\/\/)?(?:www\.)?kongregate\.com)?\/games\/5thPlanetGames\/dawn-of-the-dragons(\?[^"]+))".*?<\/a>((?:(?!<\/?a[ >]).)*(?:<a.*? class="reply_link"[> ].*)?)$/i.exec(msg);
  567.             if (m) {
  568.                 var raid = SRDotDX.getRaidDetails(m[3],user)
  569.                 if (typeof raid != 'undefined' && typeof raid != 'null') {
  570.                     SRDotDX.gui.UpdateSelectedRaidCount();
  571.                     raid.ptext = m[1];
  572.                     raid.url = m[2];
  573.                     raid.ntext = m[4];
  574.                     return raid;
  575.                 }
  576.             }
  577.         },
  578.         getPastebinLink: function (msg, user, pub) {
  579.             msg = msg.replace(/[\r\n]/g,"");
  580.             var m = /^((?:(?!<a[ >]).)*)?http:\/\/pastebin\.com\/\w{8}((?:(?!<\/?a[ >]).)*(?:<a.*? class="reply_link"[> ].*)?)$/i.exec(msg);
  581.             if (m) {
  582.                 console.log("[SRDotDX] Getting paste details");
  583.                 var pb = SRDotDX.getPasteDetails(/http:\/\/pastebin\.com\/\w{8}/i.exec(m[0])+"",user);
  584.                 if(!(typeof pb === 'undefined' || typeof pb === 'null')){  
  585.                     pb.ptext = m[1]||"";
  586.                     pb.ntext = m[2]||"";
  587.                 }
  588.                 return pb;
  589.             }
  590.         },
  591.         getRoomName: function() {
  592.             var els = document.getElementsByClassName('room_name_container');
  593.             for(var i=0;i<els.length;i++){
  594.                 if(els[i].innerHTML.indexOf('Room') > -1){
  595.                     var ret = els[i].firstChild.nextSibling.innerHTML
  596.                     if(ret.indexOf('#') > -1) return parseInt(ret.substring(ret.indexOf('#')+1, ret.length));
  597.                     return null
  598.                 }
  599.             }
  600.             return null
  601.         },
  602.         getShortNum: function (num) {
  603.             if (isNaN(num) || num < 0){return num}
  604.             else if (num>=1000000000000){return (num/1000000000000).toFixed(3)/1+"T"}
  605.             else if (num>=1000000000){return (num/1000000000).toFixed(2)/1+"B"}
  606.             else if (num>=1000000){return (num/1000000).toFixed(2)/1+"M"}
  607.             else if (num>=1000){return (num/1000).toFixed(1)/1+"K"}
  608.             else if (num>0){return num+""}
  609.         },
  610.         getStatText: function (stat) {
  611.             stat=stat.toLowerCase();
  612.             var r="";
  613.             if (stat=='?'||stat=='Unknown')return 'Unknown';
  614.             if (stat.indexOf("s")>-1)r="Stamina";
  615.             if (stat.indexOf("h")>-1)r+=(r!=''?(stat.indexOf("e")>-1?", ":" and "):"")+"Honor";
  616.             if (stat.indexOf("e")>-1)r+=(r!=''?" and ":"")+"Energy";
  617.             return r;
  618.         },
  619.         getLootTierText: function (raidid, diffIndex) {
  620.             if (typeof SRDotDX.raids[raidid] != 'object' || typeof SRDotDX.raids[raidid].loottiers != 'object' || typeof SRDotDX.raids[raidid].loottiers[diffIndex] != 'object') {
  621.                 return "";
  622.             }
  623.             var tiers = SRDotDX.raids[raidid].loottiers[diffIndex];
  624.             var text = tiers[0];
  625.             for (var i = 1;i<tiers.length;i+=1) {
  626.                 text = text + "/" + tiers[i] + " ";
  627.             }
  628.             return text;
  629.         },
  630.         gui: {
  631.             addRaid: function (id) {
  632.                 var r = id;
  633.                 if(typeof id == "string" || typeof id == "number") r = SRDotDX.config.raidList[id];
  634.                 if (r.boss) {
  635.                     var rd = SRDotDX.raids[r.boss];
  636.                     var a = document.getElementById("raid_list");
  637.                     if (typeof a != 'undefined' && a) {
  638.                         var b = 1
  639.                         if (a.hasChildNodes()) b += a.childNodes.length;
  640.                         var info = '<hr>';
  641.                         if (typeof rd != 'object') {
  642.                             rd = {name: 'Unknown'};
  643.                             info += '<div style="float: left;width: 49%;">Posted By:<br>In Room:<br>Timestamp:<br><br><hr>Boss Id:<br>Difficulty:</div>';
  644.                             info += '<div style="width: 49%; float: right; text-align: right;">'
  645.                             info += (r.user != ''?r.user:'Unknown')+"<br>";
  646.                             info += ((r.room!='undefined'&&r.room!= null&& r.room!= '')?r.room:'Unknown')+"<br>";
  647.                             info += (typeof r.timeStamp == 'number'?dateFormat(new Date(r.timeStamp), 'ddd, h:MM TT') :'Unknown')+"<br>";
  648.                             info += (typeof r.timeStamp == 'number'?'<span id="timeSince_'+r.id+'">'+timeSince(new Date(r.timeStamp))+'</span>' :'Unknown')+"<hr>";
  649.                             info += r.boss+"<br>";
  650.                             info += ["Normal","Hard","Legendary","Nightmare","Insane","Hell"][r.diff -1]+"</div>";
  651.                         }
  652.                         else if (rd.health[r.diff-1] == 'Unlimited') {
  653.                             info += '<div style="float: left;width: 49%;">Posted By:<br>In Room:<br>Timestamp:<br><br><hr>Stat Used:<br>Difficulty:<br>Health:<br>Best Share:</div>';
  654.                             info += '<div style="width: 49%; float: right; text-align: right;">'
  655.                             info += (r.user != ''?r.user:'Unknown')+"<br>";
  656.                             info += ((r.room!='undefined'&&r.room!= null&& r.room!= '')?r.room:'Unknown')+"<br>";
  657.                             info += (typeof r.timeStamp == 'number'?dateFormat(new Date(r.timeStamp), 'ddd, h:MM TT') :'Unknown')+"<br>";
  658.                             info += (typeof r.timeStamp == 'number'?'<span id="timeSince_'+r.id+'">'+timeSince(new Date(r.timeStamp))+'</span>' :'Unknown')+"<hr>";
  659.                             info += rd.stat+"<br>";
  660.                             info += ["Normal","Hard","Legendary","Nightmare","Insane","Hell"][r.diff -1]+"<br>";   
  661.                             info += "Unlimited<br>";
  662.                             if (typeof rd.loottiers == 'object' && typeof rd.loottiers[r.diff-1] == 'object') {
  663.                                 info += rd.loottiers[r.diff-1][rd.loottiers[r.diff-1].length-1] + "</div>";                            
  664.                             } else {
  665.                                 info += "Unlisted</div>";
  666.                             }
  667.                         }
  668.                        
  669.                         else if (!isNaN(rd.health[r.diff-1])) {
  670.                             var h = rd.health[r.diff -1];
  671.                             var f = h / rd.size;
  672.                             var o = f * {"1":1, "10":1.25, "15":1.25, "50":2.2, "100":2.3, "250":1,"500":1.5}[rd.size];
  673.                             info += '<div style="float: left; width: 49%;">';
  674.                             info += 'Posted By:<br>In Room:<br>Timestamp:<br><br><hr>Difficulty:<br>Stats Used:<br>Size:<br>Health:<br>';
  675.                             if (typeof rd.loottiers == 'object' && typeof rd.loottiers[r.diff-1] == 'object') {
  676.                                 info += 'Loot tiers:</div>';
  677.                             }
  678.                             else {
  679.                                 info += 'Fair Share:<br>Optimal Share:</div>';
  680.                             }
  681.                             info += '<div style="float: right; width: 49%;text-align: right;">';
  682.                             info += (r.user != ''?r.user:'Unknown')+"<br>";
  683.                             info += ((r.room!='undefined'&&r.room!= null&& r.room!= '')?r.room:'Unknown')+"<br>";
  684.                             info += (typeof r.timeStamp == 'number'?dateFormat(new Date(r.timeStamp), 'ddd, h:MM TT') :'Unknown')+"<br>";
  685.                             info += (typeof r.timeStamp == 'number'?'<span id="timeSince_'+r.id+'">'+timeSince(new Date(r.timeStamp))+'</span>' :'Unknown')+"<hr>";
  686.                             info += ["Normal","Hard","Legendary","Nightmare","Insane","Hell"][r.diff -1]+"<br>";
  687.                             info += rd.stat+"<br>";
  688.                             info += rd.size+"<br>";
  689.                             info += SRDotDX.getShortNum(h)+"<br>";
  690.                             if (typeof rd.loottiers == 'object' && typeof rd.loottiers[r.diff-1] == 'object') {
  691.                                 info += SRDotDX.getLootTierText(rd.id,(r.diff-1)) + "</div>";
  692.                             } else {
  693.                                 info += SRDotDX.getShortNum(f)+"<br>";
  694.                                 info += SRDotDX.getShortNum(o)+"</div>";
  695.                             }
  696.                         }
  697.                         else {
  698.                             info += '<div style="float: left; width: 49%;">';
  699.                             info += 'Posted By:<br>In Room:<br>Timestamp:<br><br><hr>Difficulty:<br>Stats Used:<br>Size:<br>Health:<br>Fair Share:<br>Optimal Share:</div>';
  700.                             info += '<div style="float: right; width: 49%;text-align: right;">';
  701.                             info += (r.user != ''?r.user:'Unknown')+"<br>";
  702.                             info += ((r.room!='undefined'&&r.room!= null&& r.room!= '')?r.room:'Unknown')+"<br>";
  703.                             info += (typeof r.timeStamp == 'number'?dateFormat(new Date(r.timeStamp), 'ddd, h:MM TT') :'Unknown')+"<br>";
  704.                             info += (typeof r.timeStamp == 'number'?'<span id="timeSince_'+r.id+'">'+'<span id="timeSince_'+r.id+'">'+timeSince(new Date(r.timeStamp))+'</span>'+'</span>':'Unknown')+"<hr>";
  705.                             info += ["Normal","Hard","Legendary","Nightmare","Insane","Hell"][r.diff -1]+"<br>";
  706.                             info += rd.stat+"<br>";
  707.                             info += rd.size+"<br>";
  708.                             info += "Unknown<br>";
  709.                             info += "Unknown<br>";
  710.                             info += "Unknown</div>";
  711.                         }
  712.                         info += '<div style="clear: both"></div><hr>';
  713.                         info += '<center><table><tr>';
  714.                         info += '<td style="width: 70px"><input class="FPXcbSeen" type="checkbox" '+(r.seen == true?' checked="checked"':'')+'> Seen</td>';
  715.                         info += '<td style="width: 70px"><input class="FPXcbVisited" type="checkbox" '+(r.visited == true?' checked="checked"':'')+'> Visited</td>';
  716.                         info += '</tr></table></center>';
  717.  
  718.                         var url = "/games/5thPlanetGames/dawn-of-the-dragons?kv_action_type=raidhelp&kv_difficulty="+r.diff+"&kv_hash="+r.hash+"&kv_raid_boss="+r.boss+"&kv_raid_id="+r.id;
  719.                         var filterClass = " SRDotDX_filteredRaidList" + rd.id + '_' + (r.diff - 1);
  720.                         var visitedClass = (r.visited == true ? " SRDotDX_visitedRaidList" : "");
  721.                         var nukedClass = (r.nuked == true ? " SRDotDX_nukedRaidList" : "");
  722.                         var lii = SRDotDX.gui.cHTML('div').set({
  723.                             class: 'raid_list_item raid_list_item_'+ r.id + filterClass + visitedClass + nukedClass,
  724.                             style: b%2==0?'background-color:#e0e0e0':'',
  725.                             raidId: r.id,
  726.                             raidHash: r.hash,
  727.                             raidDiff: r.diff,
  728.                             raidBoss: r.boss,
  729.                             raidVisited: r.visited,
  730.                             raidSeen: r.seen,
  731.                         });
  732.                         if (SRDotDX.config.newRaidsAtTopOfRaidList == true) {
  733.                             var arr = a.getElementsByClassName("raid_list_item");
  734.                             if (arr.length > 0) {
  735.                                 lii.attach("before",arr[0]);
  736.                             } else {
  737.                                 lii.attach("to",a);
  738.                             }
  739.                         } else {
  740.                             lii.attach("to",a);
  741.                         }
  742.                         var li = lii.ele();
  743.  
  744.                        
  745.                         var rh;
  746.  
  747.                         var diffColor = "";
  748.                         var diffText = "";
  749.                         if (r.diff == 1) {
  750.                             diffColor = "#00BB00";
  751.                             diffText = "N";
  752.                         } else if (r.diff == 2) {
  753.                             diffColor = "#DDAA00";
  754.                             diffText = "H";
  755.                         } else if (r.diff == 3) {
  756.                             diffColor = "#FF0000";
  757.                             diffText = "L";
  758.                         } else if (r.diff == 4) {
  759.                             diffColor = "#BB00BB";
  760.                             diffText = "NM";
  761.                         }
  762.                        
  763.                         rh=SRDotDX.gui.cHTML('div').set({class: 'raid_list_item_head'}).html(' \
  764.                             <a href="'+url+'" class="link">' + rd.name + '</a> \
  765.                             <span class="link" style="font-weight: normal !important; float: right"><a class="FPXDeleteLink" href="#">delete</a></span> \
  766.                             <span class="RaidQuickLink">[</span><a style="color:blue; text-decoration:underline; cursor:pointer" class="RaidQuickLink" href="'+url+'">Link</a><span class="RaidQuickLink">]</span> \
  767.                             <span class="FPXtext">' + rd.name + '</span> <span class="FPXtext" style="float: right">'+(r.visited?'visited':'')+'</span><span class="FPXtext" style="display: block; width: 25px; float: left; font-weight: bold; color: ' + diffColor + ';">' + diffText + '</span> \
  768.                         ').attach("to",li).ele();
  769.                         var ri = SRDotDX.gui.cHTML('div').set({
  770.                             class: 'raid_list_item_info'
  771.                         }).html(info).attach("to",li);
  772.                     }
  773.                 }
  774.                 else {
  775.                     delete SRDotDX.config.raidList[a];
  776.                 }
  777.             },
  778.             addPaste: function (id) {
  779.                 var p = id;
  780.                 if(typeof id == "string") p = SRDotDX.config.pasteList[id];
  781.                 if(p && p.url) {
  782.                     var a = document.getElementById("paste_list");
  783.                     if (typeof a != 'undefined' && a) {
  784.                         var b = 1
  785.                         if (a.hasChildNodes()) b += a.childNodes.length;
  786.                         var url = "http://pastebin.com/"+p.id;
  787.                         var lii = SRDotDX.gui.cHTML('div').set({
  788.                             class: 'paste_list_item paste_list_item_'+ p.id,
  789.                             pasteId: p.id
  790.                         });
  791.                         if (SRDotDX.config.newPasteAtTopOfPasteList == true) {
  792.                             var arr = a.getElementsByClassName("paste_list_item");
  793.                             if (arr.length > 0) {
  794.                                 lii.attach("before",arr[0]);
  795.                             } else {
  796.                                 lii.attach("to",a);
  797.                             }
  798.                         } else {
  799.                             lii.attach("to",a);
  800.                         }
  801.                         var li = lii.ele();
  802.                         var rh;
  803.                         var img = 'http://cdn1.iconfinder.com/data/icons/icojoy/shadow/standart/gif/24x24/001_17.gif';
  804.                         if(p.favorite) img = 'http://cdn1.iconfinder.com/data/icons/icojoy/noshadow/standart/png/24x24/001_15.png';
  805.                         rh=SRDotDX.gui.cHTML('div').set({class: 'paste_list_item_head'}).html(' \
  806.                             <table><tr style="'+(b%2==0?'background-color:#e0e0e0; ':'')+'"><td><img src="'+img+'" onclick="SRDotDX.gui.FavoritePaste(\''+p.id+'\', this);" style="cursor:pointer" title="Click to toggle this pastebin\'s favorited status.  Favorited raids will not be purged."/></td><td width="100%"> \
  807.                             <div style="float:left; width:49%; white-space:nowrap; overflow:hidden; '+(b%2==0?'background-color:#e0e0e0; ':'')+'"> \
  808.                                 <a href="'+url+'" class="link">' + p.user + '\'s Pastebin</a><br> \
  809.                                 <span class="imct_'+p.id+'">'+(typeof p.newTotal=='number' && typeof p.total=='number'?p.newTotal+'/'+p.total+' new raids':'Unimported')+'</span>\
  810.                             </div> \
  811.                             <div style="float:right; width: 51%; '+(b%2==0?'background-color:#e0e0e0; ':'')+'"> \
  812.                                 <span style="float:right" id="lastImport_'+p.id+'">'+(typeof p.lastImport == 'number'?dateFormat(new Date(p.lastImport), 'ddd, h:MM TT') :'Unimported') +'</span><br> \
  813.                                 <span style="float:right">&nbsp;<a class="FPXDeleteLink" pasteid="'+p.id+'" href="#" style="color:blue; text-decoration:underline; cursor:pointer;">Delete</a></span> \
  814.                                 <span style="float:right">&nbsp;<a style="color:blue; text-decoration:underline; cursor:pointer;" class="FPXImportLink" href="'+url+'" >Import</a></span> \
  815.                             </div></td></tr></table> \
  816.                         ').attach("to",li).ele();
  817.                     }
  818.                 }
  819.             },
  820.             FavoritePaste: function (id, el){
  821.                 var p = SRDotDX.config.pasteList[id];
  822.                 if (p) {
  823.                     p.favorite = (typeof p.favorite=='boolean'?!p.favorite:true);
  824.                     if(p.favorite) el.setAttribute("src","http://cdn1.iconfinder.com/data/icons/icojoy/noshadow/standart/png/24x24/001_15.png");
  825.                     else el.setAttribute("src","http://cdn1.iconfinder.com/data/icons/icojoy/shadow/standart/gif/24x24/001_17.gif");
  826.                 }
  827.             },
  828.             cHTML: function (ele) {
  829.                 function cEle(ele) {
  830.                     this._ele = ele;
  831.                     this.ele = function(){
  832.                         return this._ele
  833.                     }
  834.                     this.set = function (param) {
  835.                         for (var attr in param) {
  836.                             if (param.hasOwnProperty(attr)) {
  837.                                 this._ele.setAttribute(attr,param[attr]);
  838.                             }
  839.                         }
  840.                         return this
  841.                     }
  842.                     this.text = function(text){
  843.                         this._ele.appendChild(document.createTextNode(text));
  844.                         return this
  845.                     }
  846.                     this.html = function(text,overwrite){
  847.                         if (overwrite){
  848.                             this._ele.innerHTML=text
  849.                         }
  850.                         else {
  851.                             this._ele.innerHTML+=text
  852.                         }
  853.                         return this
  854.                     }
  855.                     this.attach = function (method,ele) {
  856.                         if (typeof ele == 'string') ele = document.getElementById(ele);
  857.                         if (!(ele instanceof Node)){
  858.                             throw "Invalid attachment element specified"
  859.                         }
  860.                         else if (!/^(?:to|before|after)$/i.test(method)){
  861.                             throw "Invalid append method specified"
  862.                         }
  863.                         else if (method == 'to'){
  864.                             ele.appendChild(this._ele)
  865.                         }
  866.                         else if (method == 'before'){
  867.                             ele.parentNode.insertBefore(this._ele,ele)
  868.                         }
  869.                         else if (typeof ele.nextSibling == 'undefined'){
  870.                             ele.parentNode.appendChild(this._ele)
  871.                         }
  872.                         else {
  873.                             ele.parentNode.insertBefore(this._ele,ele.nextSibling)
  874.                         }
  875.                         return this;
  876.                     }
  877.                     this.on=function(event,func,bubble){
  878.                         this._ele.addEventListener(event,func,bubble);
  879.                         return this;
  880.                     }
  881.                 }
  882.                 if (typeof ele == "string"){
  883.                     ele = (/^#/i.test(ele)?document.getElementById(ele.substring(1)):document.createElement(ele));
  884.                 }
  885.                 if (ele instanceof Node){
  886.                     return new cEle(ele)
  887.                 }
  888.                 else {
  889.                     throw "Invalid element type specified"
  890.                 }
  891.             },
  892.             errorMessage: function(s, tag){
  893.                 tag=(typeof tag==='undefined'?'b':tag);
  894.                 SRDotDX.gui.doStatusOutput('<'+tag+'>'+s+'</'+tag+'>');
  895.             },
  896.             updateMessage: function () {
  897.                 SRDotDX.gui.doStatusOutput(SRDotDX.gui.standardMessage(), false, false);
  898.             },
  899.             postingMessage: function(i, ct) {
  900.                 SRDotDX.gui.doStatusOutput('Posting message ' + i + (typeof ct==='undefined'?'': ' of ' + ct + '...'), false);
  901.             },
  902.             standardMessage: function (){//message to show
  903.                 return 'MoW - <span class="room_name_container h6_alt mbs">' +document.getElementById("raid_list").childNodes.length + ' raids stored</span>';
  904.             },
  905.             fadeChatOverlay: function (){
  906.                 elfade('chat_status_overlay');
  907.             },
  908.             doStatusOutput: function (str, msecs, showInChat){
  909.                 showInChat=(typeof showInChat === 'undefined'?true:showInChat);
  910.                 msecs=(typeof msecs === 'undefined'?4000:msecs);
  911.                 var el = document.getElementById('StatusOutput');
  912.                 el.innerHTML=str;
  913.                 if(SRDotDX.config.showStatusOverlay && showInChat){
  914.                     var ov=document.getElementById('chat_status_overlay')
  915.                     ov.innerHTML = str;
  916.                     ov.style.display="block";
  917.                     ov.style.opacity=1;
  918.                 }
  919.                 if(msecs) {
  920.                     if (SRDotDX.gui.CurrentStatusOutputTimer) {
  921.                         clearTimeout(SRDotDX.gui.CurrentStatusOutputTimer);
  922.                     }
  923.                     SRDotDX.gui.CurrentStatusOutputTimer = setTimeout(function(){ SRDotDX.gui.fadeChatOverlay();el.innerHTML=SRDotDX.gui.standardMessage(); }, msecs);
  924.                 }
  925.                 SRDotDX.gui.UpdateSelectedRaidCount();
  926.             },
  927.             raidsTabClicked: function (){
  928.                 var els = document.getElementsByClassName("SRDotDX_NewRaidsCount");
  929.                 for(var i=0;i<els.length;i++){
  930.                     i.innerHTML='0';
  931.                 }
  932.             },
  933.             toggleDisplay: function(el, sender, el2){
  934.                 if(typeof el == "string") el = document.getElementById(el);
  935.                 if(typeof el2 == "string") el2 = document.getElementById(el2);
  936.                 if(el.style.display == "none"){
  937.                     el.style.display = "block";
  938.                     if(typeof sender == "object") sender.className = sender.className.replace("closed_link", "opened_link");
  939.                     if(!(typeof el2 === "undefined")){
  940.                         //var oht = parseInt(String(el2.style.height).replace("px",""));
  941.                         console.log("[SRDotDX] Resizing "+el2.id+" : " + el2.offsetHeight + " : " + el.offsetHeight + " : " + parseInt(el.offsetHeight/13) + " : " + (el2.offsetHeight - el.offsetHeight - parseInt(el.offsetHeight/13)));
  942.                         el2.style.height = (el2.offsetHeight - el.offsetHeight - parseInt(el.offsetHeight/13)) + "px";
  943.                     }
  944.                 }else{
  945.                     h = el.offsetHeight;
  946.                     el.style.display = "none";
  947.                     if(typeof sender == "object") sender.className = sender.className.replace("opened_link", "closed_link");
  948.                     if(!(typeof el2 === "undefined")){
  949.                         //var oht = parseInt(String(el2.style.height).replace("px",""));
  950.                         console.log("[SRDotDX] Resizing "+el2.id+" : " + el2.offsetHeight + " : " + h + " : " + parseInt(h/13) + " : " + (el2.offsetHeight+h+parseInt(h/13)));
  951.                         el2.style.height = (el2.offsetHeight+h+parseInt(h/13)) + "px";
  952.                     }
  953.                 }
  954.             },
  955.             Importing:false,
  956.             FPXimportRaids: function(save){
  957.                 var linklist=document.FPXRaidSpamForm.FPXRaidSpamInput.value;
  958.                 if(linklist.length>10)
  959.                 {
  960.                     save = (typeof save ==="undefined"?true:save);
  961.                     console.log("[SRDotDX] Import started");
  962.                     SRDotDX.gui.Importing=true;
  963.                     document.FPXRaidSpamForm.FPXRaidSpamInput.value="";
  964.                     var link,tagged=false,haspb=false,imct=0,total=document.getElementById('raid_list').childNodes.length;
  965.                     var patt = new RegExp("http...www.kongregate.com.games.5thPlanetGames.dawn.of.the.dragons.[\\w\\s\\d_=&]+[^,]", "ig");
  966.                     //if(total > SRDotDX.config.maxRaidCount){
  967.                     //  if(!confirm("This import contains a large number of raids (" + total + ").  Too many raids can cause performance issues, and can even crash the browser. Continue?"))
  968.                     //      return;
  969.                     //}
  970.                    
  971.                     if(linklist.indexOf("!!OBJECT_IMPORT!!")>-1){
  972.                         var objs = linklist.split(";"), i=0;
  973.                         if(SRDotDX.config.confirmForLargePaste && SRDotDX.gui.importingPastebin && objs.length > SRDotDX.config.confirmPasteSize
  974.                             && !confirm("This pastebin import exceeds "+SRDotDX.config.confirmPasteSize+" raids.  Continue with import?")) return false;
  975.                         console.log("[SRDotDX] Objects importing "+objs.length);
  976.                         tagged=true;
  977.                         while(imct<objs.length){
  978.                             var obj = objs[imct].split(",");
  979.                             if(obj.length == 4){
  980.                                 console.log("[SRDotDX] Object importing " + imct + ": " + obj[2] + " : " + obj[1] + " : " + obj[3]);
  981.                                 SRDotDX.getRaidDetails(obj[0], obj[2], SRDotDX.config.markImportedVisited, SRDotDX.config.markImportedVisited, obj[1],obj[3]);
  982.                             }
  983.                             imct++;
  984.                         }
  985.                     }
  986.                     if(!tagged){
  987.                         if(SRDotDX.config.confirmForLargePaste && SRDotDX.gui.importingPastebin && linklist.split(",").length > SRDotDX.config.confirmPasteSize
  988.                             && !confirm("This pastebin import exceeds "+SRDotDX.config.confirmPasteSize+" raids.  Continue with import?")) return false;
  989.                         while(link = patt.exec(linklist))
  990.                         {
  991.                             imct++;
  992.                             SRDotDX.getRaidDetails(String(link), 'Untagged Import', SRDotDX.config.markImportedVisited, SRDotDX.config.markImportedVisited);
  993.                         }
  994.                     }
  995.  
  996.                     var pbpatt = new RegExp("http...pastebin.com.\\w{8}", "ig");
  997.                     while(link = pbpatt.exec(linklist)){
  998.                         haspb=true;
  999.                         SRDotDX.gui.FPXImportPasteBin(link);//recurse
  1000.                     }
  1001.                     if(!haspb){            
  1002.                         var diff = document.getElementById('raid_list').childNodes.length - total;
  1003.                         SRDotDX.gui.doStatusOutput('Import complete, ' + diff + ' of ' + imct + ' new raids');
  1004.                     }
  1005.                     SRDotDX.gui.Importing=false;
  1006.                     SRDotDX.gui.FPXFilterRaidListByName();
  1007.                     setTimeout(function(){SRDotDX.purge()}, 1);
  1008.                     if(save) setTimeout(SRDotDX.config.save(false), 250);
  1009.                     return {totalnew: diff, total:imct}
  1010.                 }
  1011.             },
  1012.             deletePaste: function (ele,id){
  1013.                 console.log("[SRDotDX] delete paste " + id);
  1014.                 if (SRDotDX.config.pasteList[id]) delete SRDotDX.config.pasteList[id];
  1015.                 while(ele.className != 'paste_list_item_head' && ele.parentNode) ele = ele.parentNode;
  1016.                 setTimeout(function(ele) { ele.parentNode.removeChild(ele); },1,ele);
  1017.             },
  1018.             deleteRaid: function (ele,id,upd) {
  1019.                 upd=(typeof upd === 'undefined'?true:upd);
  1020.                 if (SRDotDX.config.raidList[id]) {
  1021.                     delete SRDotDX.config.raidList[id];
  1022.                 }
  1023.                 setTimeout(function(ele,upd) {
  1024.                     ele.parentNode.removeChild(ele);
  1025.                 },1,ele.parentNode.parentNode.parentNode);
  1026.             },
  1027.             FPXdeleteAllRaids: function () {
  1028.                 if(!SRDotDX.config.confirmDeletes || confirm("This will delete all " + SRDotDX.config.raidList.length + " raids stored. Continue? \n (This message can be disabled on the options tab.)")){
  1029.                     console.log("[SRDotDX]::{FPX}:: DELETE ALL STARTED...");
  1030.                     for (var id in SRDotDX.config.raidList){                   
  1031.                             if (SRDotDX.config.raidList[id]) {
  1032.                                 delete SRDotDX.config.raidList[id];
  1033.                             }              
  1034.                     }
  1035.                     console.log("[SRDotDX]::{FPX}:: removing from raid_list div");
  1036.                     var raidlistDIV=document.getElementById('raid_list');
  1037.                     while (raidlistDIV.hasChildNodes()) {
  1038.                         raidlistDIV.removeChild(raidlistDIV.lastChild);
  1039.                     }
  1040.                     console.log("[SRDotDX]::{FPX}:: removing from local storage...");
  1041.                     localStorage.removeItem('raidList');
  1042.                     SRDotDX.gui.updateMessage();
  1043.                     console.log("[SRDotDX]::{FPX}:: DELETE ALL FINISHED...");
  1044.                 }
  1045.             },
  1046.             FPXdoWork: function (param1, whisper, whisperTo) {
  1047.                 console.log("[SRDotDX]::{FPX}::"+param1+"\n");
  1048.                 var matchClass="chat_input";                       
  1049.                 var elems= document.getElementsByClassName('chat_input');//document.getElementById("chat_rooms_container").firstChild.getElementsByTagName('textarea');
  1050.                 if(whisper && ((whisperTo||"") != "")){
  1051.                     console.log("[SRDotDX] Whispering spam to " + SRDotDX.config.whisperTo);
  1052.                     param1 = "/w " + SRDotDX.config.whisperTo + " " + param1;
  1053.                 }
  1054.                 var txt = [];
  1055.                 for(i=0;i<elems.length;i++){
  1056.                     txt[i] = elems[i].value;
  1057.                     elems[i].value = param1;
  1058.                 }
  1059.                 holodeck.activeDialogue().sendInput();
  1060.                 for(i=0;i<txt.length;i++){
  1061.                     elems[i].value = txt[i];
  1062.                 }
  1063.             },
  1064.             FPXformatRaidOutput: function(url) {
  1065.                 if(!SRDotDX.config.formatLinkOutput) return url;
  1066.                 var r = SRDotDX.getRaidDetailsBase(String(url));
  1067.                 return r.shortname + ' ' + r.diffShortText + ' ' + url             
  1068.             },
  1069.             FPXprettyPost: function () {
  1070.                 console.log("[SRDotDX]::{FPX}:: Pretty post...");
  1071.                 try
  1072.                 {
  1073.                     var linklist=document.FPXRaidSpamForm.FPXRaidSpamInput.value;
  1074.                    
  1075.                     if(linklist.length>10){
  1076.                         var patt = new RegExp("http...www.kongregate.com.games.5thPlanetGames.dawn.of.the.dragons.[\\w\\s\\d_=&]+[^,]", "ig");
  1077.                         var link,links=[];
  1078.                         while(link = patt.exec(linklist)) links.push(link);
  1079.                        
  1080.                         var fullList = eliminateDuplicates(links);
  1081.                         var fullCount = fullList.length;
  1082.                         var bossArray = [];
  1083.                         var finalOutput = ["Train starting. " + fullCount + " total raids including "];
  1084.                        
  1085.                         for(var i=0; i< SRDotDX.raidArray.length; i++)
  1086.                         {
  1087.                             var curBoss = SRDotDX.raidArray[i]
  1088.                             var filtList = fullList.filter(function (e){
  1089.                                 return SRDotDX.getRaidDetailsBase(String(e)).boss==curBoss;//new RegExp('kv_raid_boss=' + curBoss,'i').test(e);
  1090.                             });
  1091.                             if(filtList.length > 0){
  1092.                                 var raid = SRDotDX.raids[curBoss];
  1093.                                 bossArray.push(raid.shortname);
  1094.                                 finalOutput.push(raid.name + " x" + filtList.length);
  1095.                                 console.log("[SRDotDX] Pretty post sorting " + raid.shortname);
  1096.                                 filtList.sort(function(a,b){
  1097.                                     a=SRDotDX.getRaidDetailsBase(String(a)),b=SRDotDX.getRaidDetailsBase(String(b));
  1098.                                     if(a.diff < b.diff) return -1
  1099.                                     return 1
  1100.                                 });
  1101.                                 for(var j=0; j< filtList.length; j++){
  1102.                                     var r = SRDotDX.getRaidDetailsBase(String(filtList[j]));
  1103.                                     finalOutput.push((j+1) + ") " + r.diffShortText + " " + filtList[j]);
  1104.                                 }
  1105.                             }
  1106.                         }
  1107.                         if(bossArray.length > 0){
  1108.                             finalOutput.push("Train finished");
  1109.                             var bossStr = "";
  1110.                             for(var i=0; i<bossArray.length; i++){
  1111.                                 if(bossStr != "") bossStr += ", ";
  1112.                                 bossStr += bossArray[i];
  1113.                             }
  1114.                             finalOutput[0] = finalOutput[0] + bossStr;
  1115.                             var timer = 500, ttw=3050, ct=0;
  1116.                             for(var i=0; i<finalOutput.length; i++){
  1117.                                 if(!SRDotDX.gui.isPosting) break;
  1118.                                 var link = finalOutput[i];
  1119.                                 (function(param1) {return SRDotDX.gui.FPXTimerArray[i]=setTimeout(function() {
  1120.                                     if(!SRDotDX.gui.isPosting)return;
  1121.                                     SRDotDX.gui.FPXdoWork(param1, SRDotDX.config.whisperSpam, SRDotDX.config.whisperTo);
  1122.                                     SRDotDX.gui.postingMessage(++ct, finalOutput.length);
  1123.                                 },timer); })(link);
  1124.                                 timer+=ttw;                            
  1125.                             }
  1126.                         }
  1127.                     }
  1128.                     SRDotDX.gui.FPXTimerArray[SRDotDX.gui.FPXTimerArray.length] = setTimeout(function() {   SRDotDX.gui.FPXEndPosting();console.log("[SRDotDX]::{FPX}:: Pretty post finished"); },timer);
  1129.                    
  1130.                 }catch(error){console.log("[SRDotDX]::{FPX}::ERROR:: "+error);}
  1131.             },
  1132.             isPosting:false,
  1133.             FPXTimerArray: [],
  1134.             FPXStopPosting: function(){
  1135.                 SRDotDX.gui.FPXEndPosting();
  1136.                 console.log("[SRDotDX]::{FPX}:: SPAMMER CANCELLED...");
  1137.                 SRDotDX.echo('Raid posting cancelled');
  1138.             },
  1139.             FPXEndPosting: function(){
  1140.                 for(var i=0;i<SRDotDX.gui.FPXTimerArray.length;i++){
  1141.                     clearTimeout(SRDotDX.gui.FPXTimerArray[i]);
  1142.                 }
  1143.                 SRDotDX.gui.isPosting = false;
  1144.                 document.getElementById('PostRaidsButton').Value='Post';
  1145.                 document.FPXRaidSpamForm.Submit.disabled=false;
  1146.                 document.FPXRaidSpamForm.Submit1.disabled=true;
  1147.                 document.FPXRaidSpamForm.Submit2.disabled=false;
  1148.                 document.FPXRaidSpamForm.Submit3.disabled=false;
  1149.                 SRDotDX.gui.doStatusOutput('Posting finished');
  1150.                 //document.getElementById("FPXShareTab").innerHTML="Share";
  1151.                 SRDotDX.gui.FPXTimerArray = [];
  1152.                 SRDotDX.config.save(true);
  1153.             },
  1154.             FPXStartPosting: function() {
  1155.                 SRDotDX.gui.isPosting = true;
  1156.                 document.getElementById('PostRaidsButton').Value='Cancel';
  1157.                 document.FPXRaidSpamForm.Submit.disabled=true;
  1158.                 document.FPXRaidSpamForm.Submit1.disabled=false;
  1159.                 document.FPXRaidSpamForm.Submit2.disabled=true;
  1160.                 document.FPXRaidSpamForm.Submit3.disabled=true;
  1161.                 SRDotDX.gui.doStatusOutput('Posting started...', false);
  1162.                 //document.getElementById("FPXShareTab").innerHTML="Working...";
  1163.             },
  1164.             FPXspamRaids: function () {
  1165.                 if(SRDotDX.config.whisperSpam && ((SRDotDX.config.whisperTo||"") == "")){
  1166.                     alert("You must select a user to whisper to if whispering is selected.");
  1167.                     return false;
  1168.                 }
  1169.                 SRDotDX.gui.FPXStartPosting();
  1170.                 if(SRDotDX.config.prettyPost){
  1171.                     SRDotDX.gui.FPXprettyPost();
  1172.                 }else{         
  1173.                     console.log("[SRDotDX]::{FPX}:: SPAMMER STARTED...");
  1174.                     try
  1175.                     {
  1176.                         var linklist=document.FPXRaidSpamForm.FPXRaidSpamInput.value;
  1177.                         var ct=0;
  1178.                         if(linklist.length>10)
  1179.                         {
  1180.                             document.FPXRaidSpamForm.FPXRaidSpamInput.value="";
  1181.                             var patt = new RegExp("http...www.kongregate.com.games.5thPlanetGames.dawn.of.the.dragons.[\\w\\s\\d_=&]+[^,]", "ig");
  1182.                             var link, i=0;
  1183.                             var timer=500,ttw=3050;
  1184.                             var total = linklist.split(patt).length;
  1185.                            
  1186.                             while((link = patt.exec(linklist)) && SRDotDX.gui.isPosting)
  1187.                             {
  1188.                                 (function(param1) {return SRDotDX.gui.FPXTimerArray[i]=setTimeout(function() {
  1189.                                     if(!SRDotDX.gui.isPosting)return;
  1190.                                     SRDotDX.gui.FPXdoWork(SRDotDX.gui.FPXformatRaidOutput(param1), SRDotDX.config.whisperSpam, SRDotDX.config.whisperTo);
  1191.                                     SRDotDX.gui.postingMessage(++ct, total);},timer);
  1192.                                 })(link);
  1193.                                 timer+=ttw;
  1194.                                 i++;
  1195.                             }
  1196.                         }
  1197.                         SRDotDX.gui.FPXTimerArray[SRDotDX.gui.FPXTimerArray.length]=setTimeout(function() { SRDotDX.gui.FPXEndPosting(); console.log("[SRDotDX]::{FPX}:: SPAMMER FINISHED..."); },timer);
  1198.                     }catch(error)
  1199.                     {
  1200.                         console.log("[SRDotDX]::{FPX}::ERROR:: "+error);
  1201.                     }
  1202.                 }
  1203.             },
  1204.             FPXFilterRaidListByName: function () {
  1205.                 //console.log("[SRDotDX]::{FPX}:: FILTERING RAID LIST...");
  1206.                
  1207.                 var roomNameFilter = document.FPXRaidFilterForm.FPXRoomNameFilter.value;
  1208.                 if(!isNumber(roomNameFilter) && roomNameFilter != ""){
  1209.                     alert("Enter room number only for room filtering");
  1210.                     return;
  1211.                 }
  1212.                
  1213.                 var raidList=document.getElementById('raid_list').childNodes,raidName;
  1214.                 var classReg = /(SRDotDX_filteredRaidList[0-9a-z_]+)/i;
  1215.                 var visitReg = /SRDotDX_visitedRaidList/i;
  1216.                
  1217.                 var diffFilter=document.FPXRaidFilterForm.FPXRaidBossDifficultyFilter.value;
  1218.                 var posterSwitch = document.FPXRaidFilterForm.FPXPostedNameSwitch.value;
  1219.                 var roomSwitch = document.FPXRaidFilterForm.FPXRoomNameSwitch.value;
  1220.                 var roomFilter = document.FPXRaidFilterForm.FPXRoomNameFilter.value;
  1221.  
  1222.                 // Split the search string by the defined delimiters
  1223.                 var splits = document.FPXRaidFilterForm.FPXRaidBossNameFilter.value.split(/\||,|(\sor\s)/i);
  1224.  
  1225.                 // Make substitutions for search keywords
  1226.                 for (i in SRDotDX.searchKeywords) {
  1227.                     if (SRDotDX.searchKeywords.hasOwnProperty(i)) {
  1228.                         var keyWord = SRDotDX.searchKeywords[i];
  1229.  
  1230.                         for (j=0;j<splits.length;j+=2) {
  1231.                             if (keyWord.reg && keyWord.sub && keyWord.reg.test(splits[j])) {
  1232.                                 splits[j] = keyWord.sub;
  1233.                             }
  1234.                         }
  1235.  
  1236.                     }
  1237.                 }
  1238.  
  1239.                 // Construct the final regex string to use in search
  1240.                 var reString = "";
  1241.                 for(i=0;i<splits.length;i+=2) {
  1242.                     if (splits[i].trim() != "") {
  1243.                         reString += (i==0)?"":"|";
  1244.                         reString += "(";
  1245.                         reString += splits[i];
  1246.                         reString += ")";
  1247.                     }
  1248.                 }
  1249.                
  1250.                 //var str = (!(typeof SRDotDX.zoneRaidRegex[document.FPXRaidFilterForm.FPXRaidBossNameFilter.value]==='undefined')?SRDotDX.zoneRaidRegex[document.FPXRaidFilterForm.FPXRaidBossNameFilter.value]:document.FPXRaidFilterForm.FPXRaidBossNameFilter.value);
  1251.                
  1252.                 var re = new RegExp(reString, "i");
  1253.                 var p_re = new RegExp(document.FPXRaidFilterForm.FPXPostedNameFilter.value, "i");
  1254.                
  1255.                 for(i=0; i< raidList.length; i++)
  1256.                 {
  1257.                     SRDotDX.gui.FPXFilterRaidSingle(raidList[i], re, diffFilter, p_re, posterSwitch, roomFilter, roomSwitch);
  1258.                 }
  1259.                 SRDotDX.gui.UpdateSelectedRaidCount();
  1260.                 //console.log("[SRDotDX]::{FPX}:: RAID LIST FILTER COMPLETED...");
  1261.                 return false;
  1262.             },
  1263.             FPXFilterRaidSingle: function(el, re, diffFilter, p_re, posterSwitch, roomFilter, roomSwitch){
  1264.                 re=(re?re:new RegExp(document.FPXRaidFilterForm.FPXRaidBossNameFilter.value, "i"));
  1265.                 if(typeof el == "undefined") return;
  1266.                 var id = el;
  1267.                
  1268.                 if(typeof el != "string" && typeof el != "number") id = el.getAttribute("raidid");
  1269.                 else el = document.getElementsByClassName("raid_list_item_"+id)[0];
  1270.                
  1271.                 var r = SRDotDX.config.raidList[id];
  1272.                
  1273.                
  1274.                 if(typeof r == 'object')
  1275.                 {
  1276.                     if(re.test(el.firstChild.childNodes[1].textContent) &&  //Name
  1277.                         (diffFilter==0 || diffFilter==r.diff) &&  //Difficulty
  1278.                         ((posterSwitch==0 && p_re.test(r.user)) || (posterSwitch==1 && !p_re.test(r.user))) && //Poster
  1279.                         ((roomFilter=="") || (roomSwitch==0 && roomFilter==r.room) || (roomSwitch==1 && roomFilter != r.room))){ //Room
  1280.                         el.className = el.className.replace(/raid_list_item (hidden )?(.*)/i,"raid_list_item $2");
  1281.                         return true;
  1282.                     }else{
  1283.                         el.className = el.className.replace(/raid_list_item (hidden )?(.*)/i,"raid_list_item hidden $2");
  1284.                         return false;
  1285.                     }
  1286.                 }
  1287.             },
  1288.             FPXImportPasteBin: function(url){
  1289.                 url=url+"";
  1290.                 if(/pastebin\.com\//i.test(url)){
  1291.                     if(!SRDotDX.gui.importingPastebin && !SRDotDX.gui.ExportingPaste){
  1292.                         url= 'http://pastebin.com/raw.php?i='+url.substring(url.length-8);
  1293.                         console.log("[SRDotDX] Importing pastebin " +url);
  1294.                         SRDotDX.gui.importingPastebin=true;
  1295.                         document.getElementById("SRDotDX_pastebin").src = url;
  1296.                         setTimeout("if(SRDotDX.gui.importingPastebin){SRDotDX.gui.doStatusOutput('The pastebin request timed out. Please try again.');SRDotDX.gui.importingPastebin=false; for(i=0;i<document.getElementsByClassName('pb_"+url.substring(url.length-8)+"').length;i++){document.getElementsByClassName('pb_"+url.substring(url.length-8)+"')[i].innerHTML='<a href=\"#\" onClick=\"return false;\" onMouseDown=\"SRDotDX.gui.FPXImportPasteBin(\'"+url+"\');\">Import</a>';}}", 20000);//not found in 20 secs error occured
  1297.                     } else {
  1298.                         console.log("[SRDotDX] Pastebin collision, trying again in 1 second");
  1299.                         setTimeout("SRDotDX.gui.FPXImportPasteBin('"+url+"');", 1000);
  1300.                     }
  1301.                 }
  1302.             },
  1303.             importingPastebin:false,
  1304.             FPXSortPaste: function () {
  1305.                 var pasteArray = [];
  1306.                 var selectedSort = document.getElementById("FPXPasteSortSelection").value;
  1307.                 var selectedDir = document.getElementById("FPXPasteSortDirection").value;
  1308.                
  1309.                 console.log("[SRDotDX] Sorting started " + selectedSort + " : " + selectedDir);
  1310.                 var pastelistDIV=document.getElementById('paste_list');
  1311.                 var pasteList = pastelistDIV.childNodes;
  1312.                 for(i=0; i<pasteList.length; i+=1) {
  1313.                     var item = SRDotDX.config.pasteList[pasteList[i].getAttribute("pasteid")];
  1314.                     pasteArray.push(item);
  1315.                 }
  1316.                 var sortFunc;
  1317.                 if(selectedSort == "Time")
  1318.                     if(selectedDir == "asc")
  1319.                         sortFunc = function(a,b){
  1320.                             if(!(typeof a.lastImport === 'undefined' || typeof b.lastImport === 'undefined')){
  1321.                                 if(a.lastImport < b.lastImport) return -1;
  1322.                             }else return -1;
  1323.                             return 1;
  1324.                         }
  1325.                     else
  1326.                         sortFunc = function(a,b){
  1327.                             if(!(typeof a.lastImport === 'undefined' || typeof b.lastImport === 'undefined')){
  1328.                                 if(a.lastImport > b.lastImport) return -1;
  1329.                             }else return -1;
  1330.                             return 1;
  1331.                         }
  1332.                 else if(selectedSort == "Name")
  1333.                     if(selectedDir == "asc")
  1334.                         sortFunc = function(a,b){
  1335.                             if(!(typeof a.user === 'undefined' || typeof b.user === 'undefined'))
  1336.                                 if(a.user > b.user) return -1
  1337.                             return 1;
  1338.                         }
  1339.                     else
  1340.                         sortFunc = function(a,b){
  1341.                             if(!(typeof a.user === 'undefined' || typeof b.user === 'undefined'))
  1342.                                 if(a.user < b.user) return -1
  1343.                             return 1;
  1344.                         }
  1345.                 try{
  1346.                     pasteArray.sort(sortFunc);
  1347.                 }catch(e){
  1348.                     console.log("[SRDotDX] Sorting error: " +e);
  1349.                     return;
  1350.                 }
  1351.                
  1352.                 while (pastelistDIV.hasChildNodes()) {
  1353.                     pastelistDIV.removeChild(pastelistDIV.lastChild);
  1354.                 }
  1355.                
  1356.                 for(var i=0; i<pasteArray.length; i++){
  1357.                     SRDotDX.gui.addPaste(pasteArray[i]);
  1358.                 }
  1359.                
  1360.                 console.log("[SRDotDX] Sorting finished");
  1361.             },
  1362.             FPXSortRaids: function () {
  1363.                 var raidArray = [];
  1364.                 var selectedSort = document.getElementById("FPXRaidSortSelection").value;
  1365.                 var selectedDir = document.getElementById("FPXRaidSortDirection").value;
  1366.                
  1367.                 console.log("[SRDotDX] Sorting started " + selectedSort + " : " + selectedDir);
  1368.                 var raidlistDIV=document.getElementById('raid_list');
  1369.                 var raidList = raidlistDIV.childNodes;
  1370.                 for(i=0; i<raidList.length; i+=1) {
  1371.                     var item = SRDotDX.config.raidList[raidList[i].getAttribute("raidid")];
  1372.                     raidArray.push(item);
  1373.                 }
  1374.                 var sortFunc;
  1375.                 if(selectedSort == "Id")
  1376.                     if(selectedDir == "asc")
  1377.                         sortFunc = function(a,b){
  1378.                             if(!(typeof a.id === 'undefined' || typeof b.id === 'undefined'))
  1379.                                 if(a.id < b.id) return -1;
  1380.                             return 1;
  1381.                         }
  1382.                     else
  1383.                         sortFunc = function(a,b){
  1384.                             if(!(typeof a.id === 'undefined' || typeof b.id === 'undefined'))
  1385.                                 if(a.id > b.id) return -1;
  1386.                             return 1;
  1387.                         }
  1388.                 else if(selectedSort == "Time")
  1389.                     if(selectedDir == "asc")
  1390.                         sortFunc = function(a,b){
  1391.                             if(!(typeof a.timeStamp === 'undefined' || typeof b.timeStamp === 'undefined'))
  1392.                                 if(a.timeStamp < b.timeStamp) return -1;
  1393.                             return 1;
  1394.                         }
  1395.                     else
  1396.                         sortFunc = function(a,b){
  1397.                             if(!(typeof a.timeStamp === 'undefined' || typeof b.timeStamp === 'undefined'))
  1398.                                 if(a.timeStamp > b.timeStamp) return -1;
  1399.                             return 1;
  1400.                         }
  1401.                 else if(selectedSort == "Name")
  1402.                     if(selectedDir == "asc")
  1403.                         sortFunc = function(a,b){
  1404.                             a=SRDotDX.raids[a.boss]; b=SRDotDX.raids[b.boss];
  1405.                             console.log(a + " : " + b + " : " + (typeof a === 'undefined') + " : " + (typeof b === 'undefined'));
  1406.                             if(!(typeof a === 'undefined' || typeof b === 'undefined'))
  1407.                                 if(a.name > b.name) return -1
  1408.                             return 1;
  1409.                         }
  1410.                     else
  1411.                         sortFunc = function(a,b){
  1412.                             a=SRDotDX.raids[a.boss]; b=SRDotDX.raids[b.boss];
  1413.                             if(!(typeof a === 'undefined' || typeof b === 'undefined'))
  1414.                                 if(a.name < b.name) return -1
  1415.                             return 1;
  1416.                         }
  1417.                 else if(selectedSort == "Diff")
  1418.                     if(selectedDir == "asc")
  1419.                         sortFunc = function(a,b){
  1420.                             if(a.diff > b.diff) return -1
  1421.                             return 1
  1422.                         }
  1423.                     else
  1424.                         sortFunc = function(a,b){
  1425.                             if(a.diff < b.diff) return -1
  1426.                             return 1
  1427.                         }
  1428.                 try{
  1429.                     raidArray.sort(sortFunc);
  1430.                 }catch(e){
  1431.                     console.log("[SRDotDX] Sorting error: " +e);
  1432.                     return;
  1433.                 }
  1434.                
  1435.                 var raidlistDIV=document.getElementById('raid_list');
  1436.                 while (raidlistDIV.hasChildNodes()) {
  1437.                     raidlistDIV.removeChild(raidlistDIV.lastChild);
  1438.                 }
  1439.                
  1440.                 for(var i=0; i<raidArray.length; i++){
  1441.                     //SRDotDX.config.raidList[r.id] = r;
  1442.                     SRDotDX.gui.addRaid(raidArray[i]);
  1443.                 }
  1444.                 SRDotDX.gui.FPXFilterRaidListByName();
  1445.                
  1446.                 console.log("[SRDotDX] Sorting finished");
  1447.             },
  1448.             UpdateSelectedRaidCount: function () {
  1449.                 var el = document.getElementById("selected_raid_count");
  1450.                 if(el.offsetHeight + el.offsetWidth > 0){
  1451.                     //console.log("[SRDotDX] Updating selected raid count");
  1452.                     var raids = SRDotDX.gui.GetRaids();
  1453.                     el.innerHTML = raids.length + " selected";
  1454.                     delete raids;
  1455.                 }
  1456.             },
  1457.             GetAncestorAttribute: function(el, att){
  1458.                 if(el.getAttribute && el.getAttribute(att) != null) return el.getAttribute(att);
  1459.                 if(el.parentNode) SRDotDX.gui.GetAncestorAttribute(el.parentNode, att);
  1460.                 else return null;
  1461.             },
  1462.             GetRaid: function(id) {
  1463.                 if(isNumber(id)){
  1464.                     var raidList = document.getElementById('raid_list').childNodes;
  1465.                     for(i=0; i<raidList.length; i++) {
  1466.                         var item = raidList[i];
  1467.                         if(item.getAttribute("raidid")==id){
  1468.                             var raid = JSON.parse(JSON.stringify(SRDotDX.config.raidList[id]));
  1469.                             raid.ele = item;
  1470.                             return raid;
  1471.                         }
  1472.                     }
  1473.                 }
  1474.                 return null;
  1475.             },
  1476.             GetRaids: function (s) {//pass string to get raids you want, false to get selected non-dead raids, anything else to get selected raids,
  1477.                 var r = [];
  1478.                 s = (typeof s=='boolean'?(s?SRDotDX.config.selectedRaids:SRDotDX.config.selectedRaids.replace('nuked_', '')):(typeof s == 'string'?s:SRDotDX.config.selectedRaids));
  1479.                 if(!/visible/.test(s) && !/hidden/.test(s)) s += 'visible_hidden_';
  1480.                 if(!/visited/.test(s) && !/new/.test(s)) s += 'visited_new_';
  1481.                 if(!/nuked/.test(s) && !/alive/.test(s)) s += 'nuked_alive_';
  1482.                 //console.log("[SRDotDX] Getting " + s);
  1483.                 if(s != ""){
  1484.                     var raidList = document.getElementById('raid_list').childNodes;
  1485.                     for(i=0; i<raidList.length; i++) {
  1486.                         var item = raidList[i];
  1487.                         var raid = SRDotDX.config.raidList[item.getAttribute("raidid")];
  1488.                         if (!(typeof raid === 'undefined') && (
  1489.                             (/all/.test(s)) ||
  1490.                             (((/visited/.test(s) && raid.visited) || (/new/.test(s) && !raid.visited)) &&
  1491.                             ((/visible/.test(s) && item.offsetWidth+item.offsetHeight>0) || (/hidden/.test(s) && item.offsetWidth+item.offsetHeight==0)) &&
  1492.                             ((/nuked/.test(s) && raid.nuked) || (/alive/.test(s) && !raid.nuked)))
  1493.                         )) {
  1494.                             try {
  1495.                                 r.push(JSON.parse(JSON.stringify(raid)));
  1496.                                 r[r.length-1].ele = item
  1497.                             } catch(err){console.log("[SRDotDX]::{FPX}:: error::"+err+"   raid var"+raidList[i]+raidList[i].innerHTML);return false;}
  1498.                         }
  1499.                     }
  1500.                 }
  1501.                 //console.log("[SRDotDX] Got selected " + r.length);
  1502.                 return r;
  1503.             },
  1504.             currentJoinFrame: 0,
  1505.             getCurrentJoinFrame: function () {
  1506.                 var r = SRDotDX.gui.currentJoinFrame;
  1507.                 if(++SRDotDX.gui.currentJoinFrame == SRDotDX.config.asyncJoinCount)SRDotDX.gui.currentJoinFrame=0;
  1508.                 return r;
  1509.             },
  1510.             createJoinFrames: function (){
  1511.                 SRDotDX.gui.currentJoinFrame = 0;
  1512.                 var els = document.getElementsByClassName("SRDotDX_JoinFrame");
  1513.                 console.log("[SRDotDX] Create join frames " + SRDotDX.config.asyncJoin + " : " + SRDotDX.config.asyncJoinCount + "/" + els.length);
  1514.                 if(SRDotDX.config.asyncJoin && els.length != SRDotDX.config.asyncJoinCount){
  1515.                     var el = document.getElementById("SRDotDX_hidden_iframes");
  1516.                    
  1517.                     while(el.hasChildNodes()) el.removeChild(el.lastChild);
  1518.                     for(i=0;i<SRDotDX.config.asyncJoinCount;i++){
  1519.                         var iframe = document.createElement('iframe');
  1520.                         iframe.id = "SRDotDX_JoinFrame_"+i;
  1521.                         iframe.className = "SRDotDX_JoinFrame";
  1522.                         el.appendChild(iframe);
  1523.                     }
  1524.                 }
  1525.             },
  1526.             AutoJoin: false,
  1527.             AutoJoinRaids: [],
  1528.             AutoJoinVisibleClicked: false,
  1529.             AutoJoinCurrentIndex: 0,
  1530.             AutoJoinCurrentLanded: 0,
  1531.             AutoJoinCurrentSuccesses: 0,
  1532.             AutoJoinCurrentDeads: 0,
  1533.             AutoJoinCurrentInvalids: 0,
  1534.             AutoJoinCurrentTotal: 0,
  1535.             AutoJoinNext: function(){
  1536.                 console.log("[SRDotDX] Auto join next " + SRDotDX.gui.AutoJoinCurrentIndex);
  1537.                 if(SRDotDX.gui.AutoJoinCurrentIndex < SRDotDX.gui.AutoJoinRaids.length){
  1538.                     SRDotDX.loadRaid(SRDotDX.gui.AutoJoinRaids[SRDotDX.gui.AutoJoinCurrentIndex].ele.firstChild.getElementsByTagName('a')[0].href);
  1539.                     SRDotDX.gui.AutoJoinCurrentIndex++;
  1540.                 }
  1541.             },
  1542.             AutoJoinVisible: function (b, r) {
  1543.                 console.log("[SRDotDX] Join started " + (typeof r == 'object'?r.length:""));
  1544.                 if(typeof b === 'undefined' || b == null){
  1545.                     b=!SRDotDX.gui.AutoJoin;
  1546.                 }
  1547.                 document.getElementById('AutoJoinVisibleButton').value=b?"Cancel":"Join";
  1548.                 SRDotDX.gui.AutoJoin = b;
  1549.                 SRDotDX.gui.AutoJoinVisibleClicked = true;
  1550.                 SRDotDX.gui.AutoJoinCurrentIndex = 0;
  1551.                 SRDotDX.gui.AutoJoinCurrentLanded = 0;
  1552.                 SRDotDX.gui.AutoJoinCurrentSuccesses = 0;
  1553.                 SRDotDX.gui.AutoJoinCurrentDeads = 0;              
  1554.                 SRDotDX.gui.AutoJoinCurrentInvalids = 0;
  1555.                 if(b && typeof r == 'object'){
  1556.                     SRDotDX.gui.AutoJoinRaids = r;
  1557.                     console.log("[SRDotDX] Joining " + SRDotDX.gui.AutoJoinRaids.length + " raids");
  1558.                     if(SRDotDX.gui.AutoJoinRaids.length > 0){
  1559.                         SRDotDX.gui.AutoJoinCurrentTotal = SRDotDX.gui.AutoJoinRaids.length;
  1560.                         if(SRDotDX.config.asyncJoin){
  1561.                             var ct = Math.min(SRDotDX.config.asyncJoinCount, r.length);
  1562.                             for(i=0;i<ct;i++){
  1563.                                 setTimeout("SRDotDX.gui.AutoJoinNext();SRDotDX.gui.doStatusOutput('Joining "+(i+1)+" of '+ SRDotDX.gui.AutoJoinCurrentTotal);", 50);
  1564.                             }
  1565.                         } else {   
  1566.                             SRDotDX.gui.doStatusOutput('Joining 1 of '+ SRDotDX.gui.AutoJoinCurrentTotal);
  1567.                             SRDotDX.loadRaid(SRDotDX.gui.AutoJoinRaids[0].ele.firstChild.getElementsByTagName('a')[0].href);
  1568.                         }
  1569.  
  1570.                         console.log("[SRDotDX] Joining Started");
  1571.                     }
  1572.                 } else {
  1573.                     console.log("[SRDotDX] Joining Cancelled.");
  1574.                     SRDotDX.gui.doStatusOutput('Cancelled Auto Joining');
  1575.                 }
  1576.                 return b;
  1577.             },
  1578.             DeleteRaids: function (raids) {
  1579.                 console.log("[SRDotDX] Deleting visible raids");
  1580.                 if(typeof raids == 'object'){
  1581.                     if(!SRDotDX.config.confirmDeletes || confirm("This will delete " + raids.length + " raids. Continue? \n (This message can be disabled on the options tab.)")){
  1582.                         for(i=0; i<raids.length; i++){
  1583.                             var raid = raids[i];
  1584.                             SRDotDX.gui.deleteRaid(raid.ele.getElementsByClassName("FPXDeleteLink")[0], raid.id, false);
  1585.                         }
  1586.                         SRDotDX.gui.doStatusOutput(raids.length + ' raids deleted');
  1587.                         console.log("[SRDotDX] Deleting complete");
  1588.                     }
  1589.                 }
  1590.             },
  1591.             GetDumpText: function (raids) {
  1592.                 if(typeof raids == 'object'){
  1593.                     var dumptext = "";
  1594.                     for(i=0; i<raids.length; i++){
  1595.                         var raid = raids[i];
  1596.                         if (raid.nuked == true) { continue; }
  1597.                         var txt = raid.ele.firstChild.getElementsByTagName('a')[0].href+"\n";
  1598.                         dumptext += txt;
  1599.                     }
  1600.                     return dumptext;
  1601.                 }
  1602.             },
  1603.             ExportingPaste: false,
  1604.             RaidsForPaste: [],
  1605.             DumpRaidsToPaste: function(v) {
  1606.                 console.log("[SRDotDX] Dumping to paste " + 'http://pastebin.com/edit.php?i='+SRDotDX.config.pastebinUrl.substring(SRDotDX.config.pastebinUrl.length-8));
  1607.                 if(SRDotDX.config.pastebinUrl != ""){
  1608.                     SRDotDX.gui.ExportingPaste = true;
  1609.                     SRDotDX.gui.RaidsForPaste = v;
  1610.                     document.getElementById('SRDotDX_pastebinExport').src = 'http://pastebin.com/edit.php?i='+SRDotDX.config.pastebinUrl.substring(SRDotDX.config.pastebinUrl.length-8);
  1611.                 } else alert("You must have a valid pastebin url entered on the options tab to perform this action.");
  1612.             },
  1613.             RaidAction: function(f) {
  1614.                 console.log("[SRDotDX] Do action " + f);
  1615.                 var r = (f=='delete'?SRDotDX.gui.GetRaids():SRDotDX.gui.GetRaids(false));
  1616.                 if(r.length==0){
  1617.                     alert("You have selected 0 raids.  Deletion is the only action that can be performed on dead raids.");
  1618.                     return;
  1619.                 }
  1620.                 switch(f){
  1621.                     case 'share':
  1622.                         SRDotDX.gui.DumpRaidsToShare(r, true);
  1623.                         break;
  1624.                     case 'post':
  1625.                         if(SRDotDX.gui.isPosting){
  1626.                             SRDotDX.gui.FPXStopPosting();
  1627.                         }else{
  1628.                             SRDotDX.gui.DumpRaidsToShare(r);
  1629.                             SRDotDX.gui.FPXspamRaids();
  1630.                         }
  1631.                         break;
  1632.                     case 'paste':
  1633.                         SRDotDX.gui.DumpRaidsToPaste(r);
  1634.                         break;
  1635.                     case 'delete':
  1636.                         SRDotDX.gui.DeleteRaids(r);
  1637.                         break;
  1638.                     case 'join':
  1639.                         SRDotDX.gui.AutoJoinVisible(null, r);
  1640.                         break;
  1641.                 }
  1642.                 delete r;
  1643.                 return false;
  1644.             },
  1645.             DumpRaidsToShare: function(v, b) {
  1646.                 var txt = SRDotDX.gui.GetDumpText(v);
  1647.                 document.getElementById('FPXRaidSpamTA').value = txt;
  1648.                 if(b){
  1649.                     var el = document.getElementById('QuickShareText');
  1650.                     el.value = txt;
  1651.                     el.style.display="block";
  1652.                     el.focus();
  1653.                     el.select();
  1654.                 }
  1655.                 SRDotDX.gui.doStatusOutput("Dumped " + v.length + " raids to share tab.");
  1656.                 console.log("[SRDotDX] Dumped " + v.length + " to share");
  1657.             },
  1658.             BeginDeletingExpiredUnvisitedRaids: function() {
  1659.                 SRDotDX.gui.DeleteExpiredUnvisitedRaids();
  1660.                 setInterval('SRDotDX.gui.DeleteExpiredUnvisitedRaids();',600000);
  1661.             },
  1662.             DeleteExpiredUnvisitedRaids: function() {
  1663.                 console.log("[SRDotDX] Deleting expired unvisited raids");
  1664.                 if (SRDotDX.config.unvisitedRaidPruningMode <= 2 && SRDotDX.config.unvisitedRaidPruningMode >= 0) {
  1665.                     var raidList = document.getElementById('raid_list').childNodes;
  1666.                     var pruneTime = new Date().getTime();
  1667.                     var ct = 0;
  1668.                     for(i=0; i<raidList.length; i+=1) {
  1669.                         var item = raidList[i];
  1670.                         var raidid = item.getAttribute("raidid");
  1671.                         if (SRDotDX.config.raidList[raidid]) {
  1672.                             try {
  1673.                                 var raid = SRDotDX.config.raidList[raidid];
  1674.                                 if (SRDotDX.raids[raid.boss]) {
  1675.                                     var raidInfo = SRDotDX.raids[raid.boss];
  1676.                                     if (!raid.visited || raid.nuked) {
  1677.                                         if(SRDotDX.raidSizes[raidInfo.size] && SRDotDX.raidSizes[raidInfo.size].pruneTimers && SRDotDX.raidSizes[raidInfo.size].pruneTimers[SRDotDX.config.unvisitedRaidPruningMode]) {
  1678.                                             var pruneTimer = SRDotDX.raidSizes[raidInfo.size].pruneTimers[SRDotDX.config.unvisitedRaidPruningMode];
  1679.                                             if(raid.nuked) pruneTimer = pruneTimer / 2;//double time nuked pruning
  1680.                                             if ((pruneTime - raid.timeStamp) >= pruneTimer) {
  1681.                                                 SRDotDX.gui.deleteRaid(item.getElementsByClassName("FPXDeleteLink")[0], raidid);
  1682.                                                 ct++;
  1683.                                             }
  1684.                                         }
  1685.                                     }
  1686.                                 } else {
  1687.                                     SRDotDX.gui.deleteRaid(item.getElementsByClassName("FPXDeleteLink")[0], raidid);
  1688.                                     ct++;
  1689.                                 }
  1690.  
  1691.                             } catch(err){console.log("[SRDotDX]::{FPX}:: error::"+err+"   raid var"+raidList[i]+raidList[i].innerHTML);return false;}
  1692.  
  1693.                         }
  1694.                     }
  1695.                     if(ct>0)SRDotDX.gui.doStatusOutput(ct + " old unvisited raids pruned.");
  1696.                 }
  1697.  
  1698.                 var pasteList = document.getElementById('paste_list').childNodes, ct=0;
  1699.                 console.log("[SRDotDX] Pruning pastebins");
  1700.                 for(i=0;i<pasteList.length;i++){
  1701.                     var item = pasteList[i];
  1702.                     var p = SRDotDX.config.pasteList[item.getAttribute("pasteid")];                
  1703.                     if(p && (p.timeStamp < (new Date().getTime() - (3600000*24)) && (typeof p.favorite != 'boolean' || !p.favorite))){
  1704.                         SRDotDX.gui.deletePaste(item.getElementsByClassName('FPXDeleteLink')[0], p.id);
  1705.                         ct++;
  1706.                     }
  1707.                 }
  1708.                 if(ct>0)SRDotDX.gui.doStatusOutput(ct + " old unfavorited pastebins pruned.");
  1709.                 console.log("[SRDotDX] " + ct + " pastebins pruned");
  1710.             },
  1711.             help: function (item) {
  1712.             },
  1713.             getElementsByAttribute: function (tagname,attr,value,ele) {
  1714.                 var eles = (ele?ele.getElementsByTagName(tagname):document.getElementsByTagName(tagname));
  1715.                 var result = new Array();
  1716.                 for (var i=0;i<eles.length;i++) {
  1717.                     if (eles[i].getAttribute("attr") == value) {
  1718.                         result.push(eles[i]);
  1719.                     }
  1720.                 }
  1721.                 return result;
  1722.             },
  1723.             toggleCollapse: function (aId, toggleDivId,text) {
  1724.                 var a = document.getElementById(aId);
  1725.                 var div = document.getElementById(toggleDivId);
  1726.  
  1727.                 if (div.style.display == "block") {
  1728.                     div.style.display = "none";
  1729.                     a.innerHTML = text + " [+]";
  1730.                 }
  1731.                 else {
  1732.                     div.style.display = "block";
  1733.                     a.innerHTML = text + " [-]";
  1734.                 }
  1735.             },
  1736.             load: function () {
  1737.                 if (typeof holodeck == 'object' && typeof holodeck._tabs == 'object' && typeof holodeck._tabs.addTab == 'function') {
  1738.                     SRDotDX.gui.cHTML('style').set({type: "text/css",id: 'SRDotDX_raidClass'}).text('.SRDotDX_raid{display:'+(SRDotDX.config.hideRaidLinks == true?'none !important':'block')+'}').attach('to',document.head);
  1739.                     SRDotDX.gui.cHTML('style').set({type: "text/css",id: 'SRDotDX_visitedRaidClass'}).text('.SRDotDX_visitedRaid{display: '+(SRDotDX.config.hideVisitedRaids == true?'none !important':'block')+'}').attach('to',document.head);
  1740.                     SRDotDX.gui.cHTML('style').set({type: "text/css",id:'SRDotDX_visitedRaidListClass'}).text('.SRDotDX_visitedRaidList{display: '+(SRDotDX.config.hideVisitedRaidsInRaidList == true?'none !important':'block')+'}').attach('to',document.head);
  1741.                     SRDotDX.gui.cHTML('style').set({type: "text/css",id: 'SRDotDX_seenRaidClass'}).text('.SRDotDX_seenRaid{display: '+(SRDotDX.config.hideSeenRaids == true?'none !important':'block')+'}').attach('to',document.head);
  1742.                     SRDotDX.gui.cHTML('style').set({type: "text/css",id: 'SRDotDX_nukedRaidClass'}).text('.SRDotDX_nukedRaid{display:none !important}').attach('to',document.head);
  1743.                     SRDotDX.gui.cHTML('style').set({type: "text/css",id: 'SRDotDX_nukedRaidListClass'}).text('.SRDotDX_nukedRaidList{display:none !important}').attach('to',document.head);
  1744.                     for (var i in SRDotDX.raids) {
  1745.                         if (SRDotDX.raids.hasOwnProperty(i)) {
  1746.                             var raid = SRDotDX.raids[i];
  1747.                             for (j=0; j<4; j++) {
  1748.                                 SRDotDX.gui.cHTML('style').set({type: "text/css",id: 'SRDotDX_filteredRaidChat' + raid.id + '_' + j + 'Class'}).text('.SRDotDX_filteredRaidChat' + raid.id + '_' + j + '{display: ' + ((SRDotDX.config.getFilter(raid.id,j) == true && SRDotDX.config.filterChatLinks == true)?'none !important':'block')+'}').attach('to',document.head);
  1749.                                 SRDotDX.gui.cHTML('style').set({type: "text/css",id: 'SRDotDX_filteredRaidList' + raid.id + '_' + j + 'Class'}).text('.SRDotDX_filteredRaidList' + raid.id + '_' + j + '{display: ' + ((SRDotDX.config.getFilter(raid.id,j) == true && SRDotDX.config.filterRaidList == true)?'none !important':'block')+'}').attach('to',document.head);
  1750.                             }
  1751.                         }
  1752.                     }
  1753.                    
  1754.                     SRDotDX.gui.cHTML('style').set({type: "text/css"}).text(" \
  1755.                         #FPXtt { position:absolute; display:block; background:url(data:image/gif;base64,R0lGODlhBQCWAIABAGZmZv///yH5BAEAAAEALAAAAAAFAJYAAAIgjG8AqaH9opy02ouz3rz7D4biSJbmiabqyrbuC8eyWgAAOw==) top left no-repeat; } \
  1756.                         #FPXtttop { display:block; height:5px; margin-left:5px; background:url(data:image/gif;base64,R0lGODlhkAEFAIABAGZmZv///yH5BAEAAAEALAAAAACQAQUAAAI0hI+py+0Po5y02ouz3rz7XwWiCJbmiabqyrauOr7yTNf2jecPqff+DwwKZ4Gh8YhMKoWBAgA7) top right no-repeat; overflow:hidden; } \
  1757.                         #FPXttcont { display:block; padding:2px 12px 3px 7px; margin-left:5px; background:#666; color:#fff; } \
  1758.                         #FPXttbot {display:block;height:5px;margin-left:5px;background:url(data:image/gif;base64,R0lGODlhkAEFAIABAGZmZv///yH5BAEAAAEALAAAAACQAQUAAAI1hI+py+0Po5y02ouz3rz7nwXgSJbmiabqyqpiC8fyTNf27QQvzvf+DwyydDuh8YhMKm9EXQEAOw==) top right no-repeat;overflow:hidden;} \
  1759.                         #kong_game_ui ul.main_tabs li#lots_tab a {width: 33px; color:white; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAAAwCAIAAAAOxbS1AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAARfSURBVFhH1Vk/SFtBGL9ot46RjI1GealkajJFBGOhdJBgEQczmmImty6COAUhS5fipDROJR0kIOJQBJNA0C1bkDxK2oBT2uBUxMl+9+7evXv33t2ZNLbpDfLeve/P777v933vyzPQbrfRyKyxkUGCgWA09/f3I4IJowkEAiOEZkSg0Ex50Qwxd32ZEllMsjbE3PVlyoUGNPs6ytBT7ELz2FC09h00btHO4WrEXquHHT4K1W14sF1lWyBqS/BaLhlLJzI9PS3YEqLroPEkOL5TgUbdbhej+UXHeedwr5XJxEtnDhyXSVurXdlpZSPEeXU726LGNr/uSxTt7qdJf+pVxpHonJ+ipVxuSQ7Hlg2vHxUzjbzgPLW7m5L7e8CboXpWis9MERMWmJfh8PpmRhodxxk+R+tbB6V2cXwjNFKKw48xungo1sAGYO3NVI7WwzwYuAZHpT03n/y9RKewamoXUl5ZOtVAGmN0kfCmsoPy76jb6n6+YWPMllDj9NxFbw8cPqrwEHLX/phRaWkrPLz+HvBY2cfGKRktdisNW9wtxSGtCCrNroLO9xYi0fJdYvfzEbJIAlnBYLBxe0GyfM5pxy4SyaJi20oxGEBZ0i4W89GigsaB/2Da0jZNTVOQP5YXjbzfEEYPjEmhKC8aDxrBivr1q3XpFdAe7wEsloRdOyqwAAMIsvgdfU3JsJN97ckEB0QeELBFBMitHo1XiFkkVvoib7/y2EUulyOevKRhUIQLhokn+x8Sn9ikvFEwjq9JWfBIHnkjisAoHoksVlthTJSFk4VNUZ6+j4hf8T2loKqWy1pdL/kIQxhPHjDfSKjbb4kRM4KWcEJnouirXh5JmE5bA1TjYwCisRks7EMHJH4V+LdBot3Pc8rQwkY2GSTbvcviQa3LRGIrW2nDPCmUm2QLRJfRsSXBayHEyVg6PrYEv+OJRELordbt08nEs+vPHz59qddvJjNrszf1qx/U95sXt9e3xsSdvQOiz1Gr0fnl0qqb4/NrmcS4CQ9iK2+jZtEydpd4HbqipryJdmXKnz3NlunohWYNZNbrZs+IxtS06dYOTsxgct4t1izbIfXTdr5tSRkTixq9HgkMssBcdbu1C1MLByF8juBECDXLJ71kdmtrYyGkPoH4O5zDFMQGYM31GG0oGDAJjow5nXGLKD8x45rlQqFQNA0NJEUvBvJiE5couUzdxuaTQRsjkDJozKrPykcVIEHuCpA8hRZFwyYgD3W6tWPAY2UfG7cQkqU2DOIraaMHacWVtkLZE5oI0mj5puwJ2eVfzqIcJskWzkoQjBedSodkpedmQ7UrlwKOXZLsQIUfWF2gdoEg42l7k3YGfCvMVdJpS023R3oqTlt/sxcLAzLcSr8mDQZLpsXvs2t+6CZscVU4n0XfTujrjN9UvH15EPw1r6L9RkF/KngHcuGIvkySefUWjTOJek+smMZJSNlfNZ0VAWaPCHvIrf9/PXgrQx99vMMo2/kN5y+czr7nW8kAAAAASUVORK5CYII=) !important;background-position: 0px -25px}\r\n \
  1760.                         #kong_game_ui ul.main_tabs li#lots_tab a.active {background-position: 0px 0px;} \
  1761.                         #kong_game_ui div#lots_tab_pane {padding: 8px; text-align: left;} \
  1762.                         #kong_game_ui div#lots_tab_pane ul { margin: 0px; padding: 0px; list-style-type: none; position: relative;} \
  1763.                         #kong_game_ui div#lots_tab_pane ul li.tab { float: left; height: 100%; } \
  1764.                         #kong_game_ui div#lots_tab_pane ul li.tab div.tab_head  { font-family: Verdana, Arial, sans-serif;font-size: 10px;padding: 3px 5px 4px 5px; background-color: #c0c0c0; cursor: pointer; text-decoration: underline; margin-right: 1px; } \
  1765.                         #kong_game_ui div#lots_tab_pane ul li.tab div.tab_pane  { padding: 2px 5px; background-color: #ffffff; display: none;} \
  1766.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_head { background-color: #ffffff; cursor: default; text-decoration: none; }\
  1767.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane { position: absolute; display: block; left: 0px}\
  1768.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list {overflow-y: scroll; font-family: Verdana, Arial, sans-serif; font-size: 11px;height:550px;} \
  1769.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item {cursor: pointer; position: relative; padding: 2px; border-bottom: 1px solid #b0b0b0;} \
  1770.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item .raid_list_item_head .link {display:none;} \
  1771.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item .raid_list_item_head .FPXlink {display:block;width:10px;height:10px; padding-right: 5px;float: left;Background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAVklEQVR4Xn3PgQkAMQhDUXfqTu7kTtkpd5RA8AInfArtQ2iRXFWT2QedAfttj2FsPIOE1eCOlEuoWWjgzYaB/IkeGOrxXhqB+uA9Bfcm0lAZuh+YIeAD+cAqSz4kCMUAAAAASUVORK5CYII=') no-repeat scroll left center transparent;} \
  1772.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item.hidden {display:none;} \
  1773.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item .raid_list_item_info {display:none;} \
  1774.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item .raid_list_item_info hr {clear:both; margin: 5px 15px; } \
  1775.                         "+(!SRDotDX.config.showRaidLink?'#kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item .raid_list_item_head .RaidQuickLink{display:none;}':'') + "\
  1776.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item.active {cursor: default; background-color: #DEEAF6 !important;} \
  1777.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item.active .raid_list_item_head .text{display:none;} \
  1778.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item.active .raid_list_item_head .FPXtext{display:none;} \
  1779.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item.active .raid_list_item_head .RaidQuickLink{display:none !important;} \
  1780.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item.active .raid_list_item_head .link{display: inline-block; font-weight: bold;} \
  1781.                         #kong_game_ui div#lots_tab_pane ul li.tab.active div.tab_pane #raid_list .raid_list_item.active .raid_list_item_info {display:block;} \
  1782.                     ").attach("to",document.head);
  1783.                     var link = SRDotDX.gui.cHTML('a').set({href: '#lots_tab_pane',class: ''}).html("<span class='SRDotDX_new'>&nbsp;</span>").attach("to",SRDotDX.gui.cHTML('li').set({class: 'tab', id: 'lots_tab', onclick:'SRDotDX.gui.raidsTabClicked()'}).attach("after","game_tab").ele()).ele();
  1784.                    
  1785.                     var pane = SRDotDX.gui.cHTML('div').set({id: 'lots_tab_pane'}).html(' \
  1786.                         <div class="room_name_container h6_alt mbs">DotD Extension - <span class="room_name" id="StatusOutput"></span></div> \
  1787.                         <div class="room_name_container h6_alt mbs" id="UpdateNotification" style="display:none">Your script version is out of date.  <a href="http://userscripts.org/scripts/show/140080" target="_blank">Update</a> <a href="#" onclick="document.getElementById(\'UpdateNotification\').style.display=\'none\'; return false;">Dismiss</a></div> \
  1788.                         <ul id="SRDotDX_tabpane_tabs"> \
  1789.                             <li class="tab active"> \
  1790.                                 <div class="tab_head" id="raids_tab">Raids</div> \
  1791.                                 <div class="tab_pane"> \
  1792.                                     <div id="FPXRaidFilterDiv" class="collapsible_panel"> \
  1793.                                         <p class="panel_handle spritegame mts closed_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXRaidFiltering\', this, \'raid_list\')"> <a> Raid Filtering </a> </p> \
  1794.                                         <div id="FPXRaidFiltering" style="display:none"> \
  1795.                                             <FORM name="FPXRaidFilterForm" onSubmit="return false;"> \
  1796.                                                 <table><tr><td align="right">Boss:</td> \
  1797.                                                 <td><select name="FPXRaidBossDifficultyFilter" tabIndex="50" onchange="SRDotDX.gui.FPXFilterRaidListByName()"> \
  1798.                                                     <option value="0" selected>All or Any</option> \
  1799.                                                     <option value="1">Normal</option> \
  1800.                                                     <option value="2">Hard</option> \
  1801.                                                     <option value="3">Legendary</option> \
  1802.                                                     <option value="4">Nightmare</option> \
  1803.                                                     <!--<option value="5">Insane</option> \
  1804.                                                     <option value="6">Hell</option>--> \
  1805.                                                 </select></td><td> <INPUT NAME="FPXRaidBossNameFilter" size="10" tabIndex="51" onkeyup="SRDotDX.gui.FPXFilterRaidListByName()"></td></tr> \
  1806.                                                 <tr><td>Poster:</td>\
  1807.                                                 <td><select name="FPXPostedNameSwitch" tabIndex="-1"> \
  1808.                                                     <option value="0" selected>Contains</option> \
  1809.                                                     <option value="1">Not Contains</option> \
  1810.                                                 </select></td><td> <INPUT NAME="FPXPostedNameFilter" size="10" tabIndex="52" onkeyup="SRDotDX.gui.FPXFilterRaidListByName()"></td></tr> \
  1811.                                                 <tr><td>Room:</td>\
  1812.                                                 <td><select name="FPXRoomNameSwitch" tabIndex="-1"> \
  1813.                                                     <option value="0" selected>Equals</option> \
  1814.                                                     <option value="1">Not Equals</option> \
  1815.                                                 </select></td><td> <INPUT NAME="FPXRoomNameFilter" size="10" tabIndex="53" onkeyup="SRDotDX.gui.FPXFilterRaidListByName()"></td></tr> \
  1816.                                                 <tr><td colspan="3" align="left"><input type="checkbox" tabIndex="54" id="SRDotDX_options_hideVisitedRaidsInRaidList"> Hide visited </td></tr> \
  1817.                                                 <!--<tr><td colspan="3" align="right"><input name="button" tabIndex="-1" type="submit" value="Search" onClick=";return false"/></td></tr>--></table> \
  1818.                                             </FORM> \
  1819.                                         </div> \
  1820.                                     </div> \
  1821.                                     <div id="FPXRaidSortingDiv" class="collapsible_panel"> \
  1822.                                         <p class="panel_handle spritegame mts closed_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXRaidSort\', this, \'raid_list\')"> <a> Raid Sorting </a> </p> \
  1823.                                         <div id="FPXRaidSort" style="display:none"> \
  1824.                                             Sort By: \
  1825.                                             <select id="FPXRaidSortSelection" tabIndex="-1"> \
  1826.                                                 <option value="Time" selected>TimeStamp</option> \
  1827.                                                 <option value="Name">Raid Name</option> \
  1828.                                                 <option value="Diff">Difficulty</option> \
  1829.                                                 <option value="Id">Raid Id</option> \
  1830.                                             </select> \
  1831.                                             <select id="FPXRaidSortDirection" tabIndex="-1"> \
  1832.                                                 <option value="asc" selected>Ascending</option> \
  1833.                                                 <option value="desc">Descending</option> \
  1834.                                             </select> \
  1835.                                             <input type="button" onClick="SRDotDX.gui.FPXSortRaids();return false;" value="Sort"> \
  1836.                                             <input type="checkbox" id="SRDotDX_options_newRaidsAtTopOfRaidList"> New raids at top of raid list <br> \
  1837.                                         </div> \
  1838.                                     </div> \
  1839.                                     <div id="FPXRaidActionsDiv" class="collapsible_panel"> \
  1840.                                         <p class="panel_handle spritegame mts closed_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXRaidActions\', this, \'raid_list\');SRDotDX.gui.UpdateSelectedRaidCount();"> <a> Raid Actions </a> </p> \
  1841.                                         <div id="FPXRaidActions" style="display:none"> \
  1842.                                             <hr> \
  1843.                                             <form name="RaidActionsForm" onsubmit="return false">\
  1844.                                             <input type="checkbox" id="selection_all_checkbox"> All Raids <span style="float:right" id="selected_raid_count">&nbsp;</span>\
  1845.                                             <table style="width;100%">\
  1846.                                             <tr><td style="padding-right:5px">\
  1847.                                             <input type="radio" class="raid_selection" name="radio_raid_visibility" value="visible_">Visible<br/>\
  1848.                                             <input type="radio" class="raid_selection" name="radio_raid_visibility" value="hidden_">Hidden<br/>\
  1849.                                             <input type="radio" class="raid_selection" name="radio_raid_visibility" value="visible_hidden_">Both<br/>\
  1850.                                             </td><td style="padding-right:5px">\
  1851.                                             <input type="radio" class="raid_selection" name="radio_raid_new_visited" value="visited_">Visited<br/>\
  1852.                                             <input type="radio" class="raid_selection" name="radio_raid_new_visited" value="new_">New<br/>\
  1853.                                             <input type="radio" class="raid_selection" name="radio_raid_new_visited" value="new_visited_">Both<br/>\
  1854.                                             </td><td style="padding-right:5px">\
  1855.                                             <input type="radio" class="raid_selection" name="radio_raid_alive_dead" value="alive_">Alive<br/>\
  1856.                                             <input type="radio" class="raid_selection" name="radio_raid_alive_dead" value="nuked_">Dead<br/>\
  1857.                                             <input type="radio" class="raid_selection" name="radio_raid_alive_dead" value="alive_nuked_">Both<br/>\
  1858.                                             </td></tr><table>\
  1859.                                             </td><td align="center"> \
  1860.                                             <input name="JoinRaids" id="AutoJoinVisibleButton" style="padding:5px" onclick="SRDotDX.gui.RaidAction(\'join\');return false;" tabIndex="-1" type="button" value="Join" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Join all selected (not dead) raids.\');"> \
  1861.                                             <input name="DumpRaids" style="padding:5px" onclick="SRDotDX.gui.RaidAction(\'share\');return false;" tabIndex="-1" type="button" value="Share" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Copy all selected (not dead) raids to the share tab.\');"> \
  1862.                                             <input name="PostRaids" id="PostRaidsButton" style="padding:5px" onclick="SRDotDX.gui.RaidAction(\'post\');return false;" tabIndex="-1" type="button" value="Post" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Post all selected (not dead) raids to chat.\');"> \
  1863.                                             <input name="PasteRaids" style="padding:5px" onclick="SRDotDX.gui.RaidAction(\'paste\');return false;" tabIndex="-1" type="button" value="Paste" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Update your pastebin with the selected (not dead) raids.\');">\
  1864.                                             <input name="DeleteRaids" style="padding:5px" onclick="SRDotDX.gui.RaidAction(\'delete\'); return false;" tabIndex="-1" type="button" value="Delete" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Delete selected raids.\');"> \
  1865.                                             </td></tr></table> \
  1866.                                             <textarea id="QuickShareText" style="display:none;height:16px;width:90%;"></textarea> \
  1867.                                             </form>\ \
  1868.                                             <hr> \
  1869.                                         </div> \
  1870.                                     </div> \
  1871.                                     <div id="raid_list" tabIndex="-1"> \
  1872.                                     </div> \
  1873.                                     <iframe id="SRDotDX_pastebinExport" style="height:0px;width:0px"></iframe> \
  1874.                                 </div> \
  1875.                             </li> \
  1876.                             <li class="tab"> \
  1877.                                 <div class="tab_head">Pastebins</div> \
  1878.                                 <div class="tab_pane"> \
  1879.                                     <div id="FPXPasteSortingDiv" class="collapsible_panel"> \
  1880.                                         <p class="panel_handle spritegame mts closed_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXPasteSort\', this, \'paste_list\')"> <a> Pastebin Sorting </a> </p> \
  1881.                                         <div id="FPXPasteSort" style="display:none"> \
  1882.                                             Sort By: \
  1883.                                             <select id="FPXPasteSortSelection" tabIndex="-1"> \
  1884.                                                 <option value="Time" selected>TimeStamp</option> \
  1885.                                                 <option value="Name">Posted By</option> \
  1886.                                             </select> \
  1887.                                             <select id="FPXPasteSortDirection" tabIndex="-1"> \
  1888.                                                 <option value="asc" selected>Ascending</option> \
  1889.                                                 <option value="desc">Descending</option> \
  1890.                                             </select> \
  1891.                                             <input type="button" onClick="SRDotDX.gui.FPXSortPaste();return false;" value="Sort"> \
  1892.                                             <input type="checkbox" id="SRDotDX_options_newPasteAtTopOfRaidList"> New pastebins at top of raid list <br> \
  1893.                                         </div> \
  1894.                                     </div><br> \
  1895.                                     <div id="paste_list" tabIndex="-1" style="overflow:auto; height:557px"> No pastys :( \
  1896.                                     </div> \
  1897.                                 </div> \
  1898.                             </li> \
  1899.                             <li class="tab"> \
  1900.                             <div class="tab_head">Options</div> \
  1901.                                 <div class="tab_pane"><br> \
  1902.                                     <div id="FPXRaidOptionsDiv" class="collapsible_panel"> \
  1903.                                         <p class="panel_handle spritegame mts opened_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXRaidOptions\', this)"> <a> Raid Options </a> </p> \
  1904.                                         <div id="FPXRaidOptions"> \
  1905.                                             <hr> \
  1906.                                                 <input type="checkbox" id="FPX_options_markVisitedRightClick"> Mark raids as visited on RightClick (<a href="#" onclick="return false;" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'When you right-click on a raid (generally, to copy and paste), that raid will be marked as visited.\');">?</a>)<br> \
  1907.                                                 &nbsp;&nbsp;&nbsp;&nbsp;Delay(milliseconds) (<a href="#" onclick="return false;" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Number of milliseconds to wait before marking raid link visited when it is right clicked.<br><strong>Only enabled if <i>\\\'Mark right click\\\'</i> is enabled.</strong> \');">?</a>) :: \
  1908.                                                 <INPUT id="FPX_options_markVisitedRightClickDelay" size="8"> <br>\
  1909.                                                 <input type="checkbox" id="SRDotDX_options_markMyRaidsVisited"> Mark raids posted by me as visited <br> \
  1910.                                                 <input type="checkbox" id="SRDotDX_options_refreshGameToJoin"> Refresh game to join raids (<a href="#" onclick="return false;" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Unchecking this will cause raids to be joined behind the scenes without refreshing the game.  You will have to refresh your raid list in game for newly added raids to show up.\');">?</a>) <br> \
  1911.                                                 <input type="checkbox" id="FPX_options_doAsyncJoining"> Enable asynchronous raid joining <input type="text" id="FPX_options_asyncCount" size="2"> (<a href="#" onclick="return false;" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Enabling this feature will dramatically increase raid joining speed.  Increasing the number will increase the amount of asynchronous requests for joining raids.  The higher this number, the more bandwidth and memory that will be used when joining raids, which may cause performance issues.  This must be a number between 1 and 20.\');">?</a>)<br>\
  1912.                                                 <input type="checkbox" id="SRDotDX_options_confirmWhenDeleting"> Confirm when manually deleting raids <br> \
  1913.                                                 <input type="checkbox" id="SRDotDX_options_showRaidLink"> Show raid link in raid list <br><br> \
  1914.                                                 Unvisited raid pruning (<a href="#" onclick="return false;" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'How fast the script will automatically remove unvisited raids.  Small and Medium raids: Aggressive 1h, Moderate 2h, Slow 3h.  Large Raids: Aggressive 4h, Moderate 12h, Slow 36h.  Epic and Colossal raids: Aggressive 24h, Moderate 48h, Slow 72h.\');">?</a>)<br> \
  1915.                                                 <input type="radio" id="FPX_options_unvisitedPruningAggressive" name="unvisitedPruning" value="Aggressive"/>Aggressive&nbsp;&nbsp; \
  1916.                                                 <input type="radio" id="FPX_options_unvisitedPruningModerate" name="unvisitedPruning" value="Moderate"/>Moderate&nbsp;&nbsp; \
  1917.                                                 <input type="radio" id="FPX_options_unvisitedPruningSlow" name="unvisitedPruning" value="Slow"/>Slow&nbsp;&nbsp; \
  1918.                                                 <input type="radio" id="FPX_options_unvisitedPruningNone" name="unvisitedPruning" value="None"/>None&nbsp;&nbsp;<br> \
  1919.                                                 <input type="checkbox" id="FPX_options_useMaxRaidCount"> Enable max raid count <input type="text" id="FPX_options_maxRaidCount" size="5">(<a href="#" onclick="return false;" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'This will specify the maximum number of raids to store in the script. Once this number is reached, it will automatically purge the oldest raid as a new one is added.  Lowering this number could improve issues like shockwave crashes, etc.\');">?</a>)<br> \
  1920.                                             <hr> \
  1921.                                         </div> \
  1922.                                     </div> \
  1923.                                     <div id="FPXChatOptionsDiv" class="open_link"> \
  1924.                                         <p class="panel_handle spritegame mts opened_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXChatOptions\', this)"> <a> Chat Options </a> </p> \
  1925.                                         <div id="FPXChatOptions"> \
  1926.                                             <hr> \
  1927.                                             <input type="checkbox" id="SRDotDX_options_hideRaidLinks"> Hide all raid links in chat <br> \
  1928.                                             <input type="checkbox" id="SRDotDX_options_hideSeenRaids"> Hide seen raids in chat <br> \
  1929.                                             <input type="checkbox" id="SRDotDX_options_hideVisitedRaids"> Hide visited raids in chat <br> \
  1930.                                             <input type="checkbox" id="SRDotDX_options_statusChatOverlay"> Show status output chat overlay <br> \
  1931.                                             <input type="checkbox" id="SRDotDX_options_formatRaids"> Enable Raid Link Formatting (<a href="#" onclick="return false;" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'Set formatting options for raid links posted in chat.<br><strong>See the userscript page for a list of all formatting options.</strong> \');">?</a>)<br> \
  1932.                                             <textarea id="SRDotDX_options_raidLinkFormat"></textarea> \
  1933.                                             <hr> \
  1934.                                         </div> \
  1935.                                     </div> \
  1936.                                     <div id="FPXPasteOptionsDiv" class="open_link"> \
  1937.                                         <p class="panel_handle spritegame mts opened_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXPasteOptions\', this)"> <a> Pastebin Options </a> </p> \
  1938.                                         <div id="FPXPasteOptions"> \
  1939.                                             <hr> \
  1940.                                             <input type="checkbox" id="SRDotDX_options_autoImportPaste"> Auto import pastebins <br> \
  1941.                                             <input type="checkbox" id="SRDotDX_options_confirmForLargePaste"> Confirm if paste exceeds <input type="text" id="SRDotDX_options_confirmPasteSize" size="4"><br/> \
  1942.                                             <input type="checkbox" id="SRDotDX_options_autoPostPaste"> Auto post paste after update <br> \
  1943.                                             Your pastebin url: <input type="text" id="SRDotDX_options_pastebinUrl"> \
  1944.                                             <hr> \
  1945.                                         </div> \
  1946.                                     </div> \
  1947.                                         </div> \
  1948.                             </li> \
  1949.                             <li class="tab"> \
  1950.                                 <div class="tab_head" id="FPXShareTab">Share</div> \
  1951.                                 <div class="tab_pane"> \
  1952.                                 <div id="FPXRaidSpamDiv"> \
  1953.                                         <FORM name="FPXRaidSpamForm" onSubmit="return false"> \
  1954.                                             <div id="FPXShareDiv" class="collapsible_panel"> \
  1955.                                                 <p class="panel_handle spritegame mts opened_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXShare\', this)"> <a> Sharing </a> </p> \
  1956.                                                 <div id="FPXShare"> <hr>\
  1957.                                                     <input name="Submit"  type="submit" tabIndex="-1" value="Post Links to Chat" onClick="SRDotDX.gui.FPXspamRaids();return false;"/> \
  1958.                                                     <input name="Submit1" type="submit" disabled="disabled" tabIndex="-1" value="Cancel Posting" onClick="SRDotDX.gui.FPXStopPosting();return false;"/><br> \
  1959.                                                     <input type="checkbox" id="SRDotDX_options_formatLinkOutput"> Enable simple formatting for link spam <br> \
  1960.                                                     <input type="checkbox" id="SRDotDX_options_prettyPost"> Enable counting and sorting for link spam <br> \
  1961.                                                     <input type="checkbox" id="SRDotDX_options_whisperRaids"> Whisper to <input type="text" id="SRDotDX_options_whisperTo"> <br>\
  1962.                                                     <!--<input type="checkbox" id="SRDotDX_options_autoWhipser"> Auto Whisper <br>--> \
  1963.                                                 <hr></div> \
  1964.                                             </div> \
  1965.                                             <div id="FPXShareDiv" class="collapsible_panel"> \
  1966.                                                 <p class="panel_handle spritegame mts opened_link" onclick="SRDotDX.gui.toggleDisplay(\'FPXImport\', this)"> <a> Import </a> </p> \
  1967.                                                 <div id="FPXImport"> <hr>\
  1968.                                                     <input name="Submit2"  type="submit" tabIndex="-1" value="Import to Raid Tab" onClick="SRDotDX.gui.FPXimportRaids();return false;"/> (<a href="#" onclick="return false" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'This will add any new raids in the share box below to the raid tab.\');">?</a>)\
  1969.                                                     <input name="Submit3"  type="submit" tabIndex="-1" value="Delete and Import" onClick="SRDotDX.gui.FPXdeleteAllRaids();SRDotDX.gui.FPXimportRaids();return false;"/>(<a href="#" onclick="return false" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'This will delete all raids on the raid tab and refresh the data with any raids in the share box below.\');">?</a>)<br> \
  1970.                                                     <!--<input name="Submit4" type="submit" tabIndex="-1" value="Import Pastebin" onClick="SRDotDX.gui.FPXImportPasteBin();return false;"> <input type="text" id="SRDotDX_FPX_ImportPastebin">(<a href="#" onclick="return false" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'This is currently only working in chrome.  Before this is fixed, Firefox users should simply navigate to the pastebin url, copy the raw data, and paste it into box below and import the raids. \');">?</a>)<br> -->\
  1971.                                                     <input type="checkbox" id="SRDotDX_options_markImportedRaidsVisited"> Mark imported raids visited <br> \
  1972.                                                 <hr></div> \
  1973.                                             </div> \
  1974.                                             <textarea id="FPXRaidSpamTA" name="FPXRaidSpamInput" ></textarea><br> \
  1975.                                         </FORM> \
  1976.                                     </div> \
  1977.                                 </div> \
  1978.                             </li> \
  1979.                             <li class="tab"> \
  1980.                                 <div class="tab_head">Filtering</div> \
  1981.                                 <div class="tab_pane"> \
  1982.                                     <div id="FPXRaidFilterDiv"> \
  1983.                                         <div id="FPXRaidFilterWhereDiv"> \
  1984.                                             <input type="checkbox" id="SRDotDX_options_perRaidFilterLinks">Activate filtering on raid links (<a href="#" onclick="return false" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'All raids unchecked below will be hidden when linked in chat, in addition to all other link hiding options\');">?</a>)<br> \
  1985.                                             <input type="checkbox" id="SRDotDX_options_perRaidFilterRaidList">Activate filtering on raid list tab (<a href="#" onclick="return false" onmouseout="FPX.tooltip.hide();" onmouseover="FPX.tooltip.show(\'All raids unchecked below will be hidden in the Raids tab, in addition to the search options specified there\');">?</a>)<br> \
  1986.                                         </div> \
  1987.                                         <hr> \
  1988.                                         <div id="FPXRaidFilterWhatDiv"> \
  1989.                                             <div> \
  1990.                                                 <div> \
  1991.                                                     <a id="FPXPersonalAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXPersonalAToggle\',\'FPXRaidTablePersonal\',\'Personal Raids\');return false;">Personal Raids [+]</a><br> \
  1992.                                                 </div> \
  1993.                                                 <table id="FPXRaidTablePersonal" cellspacing="3" style="display:none"> \
  1994.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  1995.                                                     <tbody id="FPXRaidFilterWhatPersonal"> \
  1996.                                                         <!-- Dynamic content --> \
  1997.                                                     </tbody> \
  1998.                                                 </table> \
  1999.                                             </div> \
  2000.                                             <div> \
  2001.                                                 <div> \
  2002.                                                     <a id="FPXSmallAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXSmallAToggle\',\'FPXRaidTableSmall\',\'Small Raids\');return false;">Small Raids [+]</a><br> \
  2003.                                                 </div> \
  2004.                                                 <table id="FPXRaidTableSmall" style="display:none"> \
  2005.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  2006.                                                     <tbody id="FPXRaidFilterWhatSmall"> \
  2007.                                                         <!-- Dynamic content --> \
  2008.                                                     </tbody> \
  2009.                                                 </table> \
  2010.                                             </div> \
  2011.                                             <div> \
  2012.                                                 <div> \
  2013.                                                     <a id="FPXMediumAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXMediumAToggle\',\'FPXRaidTableMedium\',\'Medium Raids\');return false;">Medium Raids [+]</a><br> \
  2014.                                                 </div> \
  2015.                                                 <table id="FPXRaidTableMedium" style="display:none"> \
  2016.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  2017.                                                     <tbody id="FPXRaidFilterWhatMedium"> \
  2018.                                                         <!-- Dynamic content --> \
  2019.                                                     </tbody> \
  2020.                                                 </table> \
  2021.                                             </div> \
  2022.                                             <div> \
  2023.                                                 <div> \
  2024.                                                     <a id="FPXLargeAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXLargeAToggle\',\'FPXRaidTableLarge\',\'Large Raids\');return false;">Large Raids [+]</a><br> \
  2025.                                                 </div> \
  2026.                                                 <table id="FPXRaidTableLarge" style="display:none"> \
  2027.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  2028.                                                     <tbody id="FPXRaidFilterWhatLarge"> \
  2029.                                                         <!-- Dynamic content --> \
  2030.                                                     </tbody> \
  2031.                                                 </table> \
  2032.                                             </div> \
  2033.                                             <div> \
  2034.                                                 <div> \
  2035.                                                     <a id="FPXEpicAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXEpicAToggle\',\'FPXRaidTableEpic\',\'Epic Raids\');return false;">Epic Raids [+]</a><br> \
  2036.                                                 </div> \
  2037.                                                 <table id="FPXRaidTableEpic" style="display:none"> \
  2038.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  2039.                                                     <tbody id="FPXRaidFilterWhatEpic"> \
  2040.                                                         <!-- Dynamic content --> \
  2041.                                                     </tbody> \
  2042.                                                 </table> \
  2043.                                             </div> \
  2044.                                             <div> \
  2045.                                                 <div> \
  2046.                                                     <a id="FPXColossalAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXColossalAToggle\',\'FPXRaidTableColossal\',\'Colossal Raids\');return false;">Colossal Raids [+]</a><br> \
  2047.                                                 </div> \
  2048.                                                 <table id="FPXRaidTableColossal" style="display:none"> \
  2049.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  2050.                                                     <tbody id="FPXRaidFilterWhatColossal"> \
  2051.                                                         <!-- Dynamic content --> \
  2052.                                                     </tbody> \
  2053.                                                 </table> \
  2054.                                             </div> \
  2055.                                             <div> \
  2056.                                                 <div> \
  2057.                                                     <a id="FPXGuildAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXGuildAToggle\',\'FPXRaidTableGuild\',\'Guild Raids\');return false;">Guild Raids [+]</a><br> \
  2058.                                                 </div> \
  2059.                                                 <table id="FPXRaidTableGuild" style="display:none"> \
  2060.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  2061.                                                     <tbody id="FPXRaidFilterWhatGuild"> \
  2062.                                                         <!-- Dynamic content --> \
  2063.                                                     </tbody> \
  2064.                                                 </table> \
  2065.                                             </div> \
  2066.                                             <div> \
  2067.                                                 <div> \
  2068.                                                     <a id="FPXSpecialAToggle" href="#" onclick="SRDotDX.gui.toggleCollapse(\'FPXSpecialAToggle\',\'FPXRaidTableSpecial\',\'Special Raids\');return false;">Special Raids [+]</a><br> \
  2069.                                                 </div> \
  2070.                                                 <table id="FPXRaidTableSpecial" style="display:none"> \
  2071.                                                     <col width="180"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><col width="20"/><thead><tr><th>Raid</th><th>N</th><th>H</th><th>L</th><th>NM</th><th>All</th></tr></thead> \
  2072.                                                     <tbody id="FPXRaidFilterWhatSpecial"> \
  2073.                                                         <!-- Dynamic content --> \
  2074.                                                     </tbody> \
  2075.                                                 </table> \
  2076.                                             </div> \
  2077.                                         </div> \
  2078.                                         <iframe id="SRDotDX_joiner" style="height:0px;width:0px"></iframe> \
  2079.                                         <iframe id="SRDotDX_pastebin" style="height:0px;width:0px"></iframe> \
  2080.                                         <iframe id="SRDotDX_update" style="height:0px;width:0px"></iframe> \
  2081.                                         <div id="SRDotDX_hidden_iframes" style="display:none"> \
  2082.                                         </div> \
  2083.                                     </div> \
  2084.                                 </div> \
  2085.                             </li> \
  2086.                             <!-- <li class="tab"> \
  2087.                                 <div class="tab_head">Help</div> \
  2088.                                 <div class="tab_pane">Do I need text too?</div> \
  2089.                             </li> --> \
  2090.                         </ul> \
  2091.                     ').attach("to",'kong_game_ui').ele();
  2092.  
  2093.                     pane.style.height = document.getElementById("chat_tab_pane").style.height;
  2094.                     var e = pane.getElementsByClassName("tab_head")
  2095.                     for (var i = 0;i<e.length;i++) {
  2096.                         e[i].addEventListener("click",function(){
  2097.                             if (!/\bactive\b/i.test(this.className)) {
  2098.                                 var e = document.getElementById("lots_tab_pane").getElementsByTagName("li");
  2099.                                 for (var i = 0;i<e.length;i++) {
  2100.                                     if (e[i].getAttribute("class").indexOf("active") > -1) e[i].className = e[i].className.replace(/ active$/g,"");
  2101.                                 }
  2102.                                 (this.parentNode).className += " active";
  2103.                             }
  2104.                         });
  2105.                     }
  2106.                     holodeck._tabs.addTab(link);
  2107.  
  2108.                     var e = pane.getElementsByClassName("tab_pane");
  2109.                     var w = pane.offsetWidth - 24;
  2110.                     var h = pane.offsetHeight - e[0].offsetTop - 36;
  2111.                     for (var i = 0;i<e.length;i++) {
  2112.                         e[i].style.width = w + "px";
  2113.                         e[i].style.height = h + "px";
  2114.                     }
  2115.                    
  2116.                     //Chat overlay div
  2117.                     SRDotDX.gui.cHTML('div').set({id: 'chat_status_overlay', style: 'position:absolute;top:157px;left:-3px;z-index:20000;width:290px;display:none;background-color:#c0c0c0;padding:3px 8px;font-family: Verdana, Arial;' }).attach("to",'chat_tab_pane').ele();
  2118.                    
  2119.                     //spam tab
  2120.                     var FPXimpSpam= SRDotDX.gui.cHTML('#FPXRaidSpamTA');
  2121.                     FPXimpSpam.ele().style.width = e[0].offsetWidth - 12 + "px";
  2122.                     FPXimpSpam.ele().style.height = "300px";
  2123.                     var FPXSpamText="Paste raid and/or pastebin links here to share or import\n\nLinks must be comma (,) separated.";
  2124.                     FPXimpSpam.ele().value=FPXSpamText;
  2125.                     FPXimpSpam.ele().addEventListener("blur",function() {
  2126.                         if (this.value == "") {
  2127.                             this.value = FPXSpamText;
  2128.                         }
  2129.                     });
  2130.                     FPXimpSpam.ele().addEventListener("focus",function() {
  2131.                         if (this.value == FPXSpamText) {
  2132.                             this.value = "";
  2133.                         }
  2134.                     });
  2135.                    
  2136.                     var raids_tab=document.getElementById("raids_tab");
  2137.                     raids_tab.addEventListener("mouseup", function(event){
  2138.                         SRDotDX.gui.UpdateSelectedRaidCount();
  2139.                     });
  2140.                    
  2141.                     //Pastebin tab
  2142.                     var paste_list = document.getElementById('paste_list');
  2143.                     paste_list.style.height = (h - paste_list.offsetTop -50) + "px";
  2144.                     SRDotDX.gui.loadPasteList();
  2145.                    
  2146.                     //pastelist global click listener
  2147.                     paste_list.addEventListener("mouseup",function(event) {
  2148.                         SRDotDX.gui.FPXpasteListMouseDown(event);
  2149.                     },false);
  2150.                     paste_list.addEventListener("click",function(e) {
  2151.                         e.preventDefault();
  2152.                         e.stopPropagation();
  2153.                         return false;
  2154.                     },false);
  2155.                    
  2156.                     // Raids Tab
  2157.                     var raid_list = document.getElementById('raid_list');
  2158.                     raid_list.style.height = (h - raid_list.offsetTop -3) + "px";
  2159.                     SRDotDX.gui.loadRaidList();
  2160.  
  2161.                     //raidlist global click listener
  2162.                     raid_list.addEventListener("mouseup",function(event) {
  2163.                         SRDotDX.gui.FPXraidListMouseDown(event);
  2164.                     },false);
  2165.                     raid_list.addEventListener("click",function(e) {
  2166.                         e.preventDefault();
  2167.                         e.stopPropagation();
  2168.                         return false;
  2169.                     },false);
  2170.                    
  2171.                     //raid visibility
  2172.                     var selectAllCheckbox = SRDotDX.gui.cHTML('#selection_all_checkbox');
  2173.                     if(/all/i.test(SRDotDX.config.selectedRaids)){
  2174.                         selectAllCheckbox.ele().checked = 'checked';
  2175.                         var els = document.getElementsByClassName("raid_selection");
  2176.                         for(i=0;i<els.length;i++)
  2177.                             els[i].disabled = true;
  2178.                     }
  2179.                     selectAllCheckbox.ele().addEventListener('click', function(){
  2180.                         var els = document.getElementsByClassName("raid_selection");
  2181.                         for(i=0;i<els.length;i++)
  2182.                             els[i].disabled = this.checked;
  2183.                         if(this.checked)
  2184.                             SRDotDX.config.selectedRaids += "all_";
  2185.                         else
  2186.                             SRDotDX.config.selectedRaids = SRDotDX.config.selectedRaids.replace(/all_/ig, "");
  2187.                            
  2188.                         SRDotDX.gui.UpdateSelectedRaidCount();
  2189.                     });
  2190.                     var els = document.getElementsByClassName("raid_selection");
  2191.                     for(i=0;i<els.length;i++){
  2192.                         var el = els[i];
  2193.                         var regex = new RegExp(el.value, "ig");
  2194.                         if(regex.test(SRDotDX.config.selectedRaids)) el.checked = 'checked';
  2195.                         el.addEventListener('click', function(){
  2196.                             var rs = document.RaidActionsForm[this.name];
  2197.                             for(j=0;j<rs.length;j++)
  2198.                                 SRDotDX.config.selectedRaids = SRDotDX.config.selectedRaids.replace(new RegExp(rs[j].value, "ig"), "");
  2199.                             if(this.checked)
  2200.                                 SRDotDX.config.selectedRaids += this.value;
  2201.                             SRDotDX.gui.UpdateSelectedRaidCount();
  2202.                         });
  2203.                     }
  2204.                     var quickShareText = SRDotDX.gui.cHTML('#QuickShareText');
  2205.                     quickShareText.ele().addEventListener('keyup', function(){
  2206.                         if(this.value == ''){
  2207.                             this.style.display = 'none';
  2208.                             document.getElementById('FPXRaidSpamTA').value = '';
  2209.                         }
  2210.                     });
  2211.                    
  2212.                     //options tab
  2213.                     var FPXoptsMarkRightClick = SRDotDX.gui.cHTML('#FPX_options_markVisitedRightClick');
  2214.                     var FPXoptsMarkRightClickDelay = SRDotDX.gui.cHTML('#FPX_options_markVisitedRightClickDelay');
  2215.                     var optsFormatRaids = SRDotDX.gui.cHTML('#SRDotDX_options_formatRaids');
  2216.                     var optsRaidFormat = SRDotDX.gui.cHTML('#SRDotDX_options_raidLinkFormat');
  2217.                     var optsHideARaids = SRDotDX.gui.cHTML('#SRDotDX_options_hideRaidLinks');
  2218.                     var optsHideSRaids = SRDotDX.gui.cHTML('#SRDotDX_options_hideSeenRaids');
  2219.                     var optsHideVRaids = SRDotDX.gui.cHTML('#SRDotDX_options_hideVisitedRaids');
  2220.                     var optsStatusOverlay = SRDotDX.gui.cHTML('#SRDotDX_options_statusChatOverlay');
  2221.                     var optsShowRaidLink = SRDotDX.gui.cHTML('#SRDotDX_options_showRaidLink');
  2222.                     var optsConfirmDeletes = SRDotDX.gui.cHTML('#SRDotDX_options_confirmWhenDeleting');
  2223.                     var optsRefreshGameToJoin = SRDotDX.gui.cHTML('#SRDotDX_options_refreshGameToJoin')
  2224.                     var optsHideVRaidsList = SRDotDX.gui.cHTML('#SRDotDX_options_hideVisitedRaidsInRaidList');
  2225.                     var optsWhisperToCheck = SRDotDX.gui.cHTML('#SRDotDX_options_whisperRaids');
  2226.                     var optsMarkImportedVisited = SRDotDX.gui.cHTML('#SRDotDX_options_markImportedRaidsVisited');
  2227.                     var optsWhisperTo = SRDotDX.gui.cHTML('#SRDotDX_options_whisperTo');
  2228.                     var optsMarkMyRaidsVisited = SRDotDX.gui.cHTML('#SRDotDX_options_markMyRaidsVisited');
  2229.                     var optsUseMaxRaidCount = SRDotDX.gui.cHTML('#FPX_options_useMaxRaidCount');
  2230.                     var optsAsyncJoin = SRDotDX.gui.cHTML('#FPX_options_doAsyncJoining');
  2231.                     var optsAsyncJoinCount = SRDotDX.gui.cHTML('#FPX_options_asyncCount');
  2232.                     var optsMaxRaidCount = SRDotDX.gui.cHTML('#FPX_options_maxRaidCount');
  2233.                     var optsNewRaidsAtTopOfRaidList = SRDotDX.gui.cHTML('#SRDotDX_options_newRaidsAtTopOfRaidList');
  2234.                     var optsNewPasteAtTopOfPasteList = SRDotDX.gui.cHTML('#SRDotDX_options_newPasteAtTopOfRaidList');
  2235.                     var optsFormatLinkOutput = SRDotDX.gui.cHTML('#SRDotDX_options_formatLinkOutput');
  2236.                     var optsPrettyPost = SRDotDX.gui.cHTML('#SRDotDX_options_prettyPost');
  2237.                     var optsAutoImportPaste = SRDotDX.gui.cHTML('#SRDotDX_options_autoImportPaste');
  2238.                     var optsConfirmForLargePaste = SRDotDX.gui.cHTML('#SRDotDX_options_confirmForLargePaste');
  2239.                     var optsConfirmPasteSize = SRDotDX.gui.cHTML('#SRDotDX_options_confirmPasteSize');
  2240.                     var optsAutoPostPaste = SRDotDX.gui.cHTML('#SRDotDX_options_autoPostPaste');
  2241.                     var optsPastebinUrl = SRDotDX.gui.cHTML('#SRDotDX_options_pastebinUrl');
  2242.                     var rbUnvisitedPruningAggressive = SRDotDX.gui.cHTML('#FPX_options_unvisitedPruningAggressive');
  2243.                     var rbUnvisitedPruningModerate = SRDotDX.gui.cHTML('#FPX_options_unvisitedPruningModerate');
  2244.                     var rbUnvisitedPruningSlow = SRDotDX.gui.cHTML('#FPX_options_unvisitedPruningSlow');
  2245.                     var rbUnvisitedPruningNone = SRDotDX.gui.cHTML('#FPX_options_unvisitedPruningNone');
  2246.                    
  2247.                     if (SRDotDX.config.FPXmarkRightClick) { FPXoptsMarkRightClick.ele().checked = 'checked'}
  2248.                     if (SRDotDX.config.formatRaidLinks) {   optsFormatRaids.ele().checked = 'checked'}
  2249.                     if (SRDotDX.config.markMyRaidsVisted) { optsMarkMyRaidsVisited.ele().checked = 'checked' }
  2250.                     if (SRDotDX.config.showRaidLink) { optsShowRaidLink.ele().checked = 'checked';}
  2251.                     if (SRDotDX.config.formatLinkOutput) { optsFormatLinkOutput.ele().checked = 'checked'; optsPrettyPost.ele().disabled=true;} else { optsRaidFormat.ele().disabled = true }
  2252.                     if (SRDotDX.config.prettyPost) { optsPrettyPost.ele().checked='checked'; optsFormatLinkOutput.ele().disabled=true;}
  2253.                     if (SRDotDX.config.markImportedVisited) { optsMarkImportedVisited.ele().checked = 'checked'; }
  2254.                     if (SRDotDX.config.whisperSpam) { optsWhisperToCheck.ele().checked = 'checked'; }
  2255.                     if ((SRDotDX.config.whisperTo||'')!='') { optsWhisperTo.ele().value = SRDotDX.config.whisperTo; }
  2256.                     if ((SRDotDX.config.pastebinUrl||'')!='') { optsPastebinUrl.ele().value = SRDotDX.config.pastebinUrl; }
  2257.                     if (SRDotDX.config.useMaxRaidCount) { optsUseMaxRaidCount.ele().checked = 'checked'; }
  2258.                     if (SRDotDX.config.asyncJoin) { optsAsyncJoin.ele().checked = 'checked'; } else { optsAsyncJoinCount.ele().disabled = true; }
  2259.                     if (SRDotDX.config.asyncJoinCount > 0) { optsAsyncJoinCount.ele().value = SRDotDX.config.asyncJoinCount }
  2260.                     if (SRDotDX.config.maxRaidCount>0) { optsMaxRaidCount.ele().value = SRDotDX.config.maxRaidCount; }
  2261.                     if (SRDotDX.config.autoImportPaste) { optsAutoImportPaste.ele().checked = 'checked'; } else { optsConfirmForLargePaste.ele().disabled=true; optsConfirmPasteSize.ele().disabled=true}
  2262.                     if (SRDotDX.config.confirmForLargePaste) { optsConfirmForLargePaste.ele().checked = 'checked'; } else { optsConfirmPasteSize.ele().disabled=true }
  2263.                     if (SRDotDX.config.confirmPasteSize>0) { optsConfirmPasteSize.ele().value = SRDotDX.config.confirmPasteSize }
  2264.                     if (SRDotDX.config.newPasteAtTopOfPasteList) { optsNewPasteAtTopOfPasteList.ele().checked = 'checked'}
  2265.                     if (SRDotDX.config.refreshGameToJoin) { optsRefreshGameToJoin.ele().checked = 'checked'; optsAsyncJoin.ele().checked = false; optsAsyncJoin.ele().disabled = true; optsAsyncJoinCount.ele().disabled = true }
  2266.                     if (SRDotDX.config.showStatusOverlay) { optsStatusOverlay.ele().checked = 'checked' }
  2267.                     if (SRDotDX.config.confirmDeletes) { optsConfirmDeletes.ele().checked = 'checked' }
  2268.                     if (SRDotDX.config.autoPostPaste) { optsAutoPostPaste.ele().checked = 'checked' }
  2269.        
  2270.                     if (SRDotDX.config.unvisitedRaidPruningMode == 0) {
  2271.                         rbUnvisitedPruningAggressive.ele().checked = true;
  2272.                     } else if (SRDotDX.config.unvisitedRaidPruningMode == 1) {
  2273.                         rbUnvisitedPruningModerate.ele().checked = true;
  2274.                     } else if (SRDotDX.config.unvisitedRaidPruningMode == 2) {
  2275.                         rbUnvisitedPruningSlow.ele().checked = true;
  2276.                     } else if (SRDotDX.config.unvisitedRaidPruningMode == 3) {
  2277.                         rbUnvisitedPruningNone.ele().checked = true;
  2278.                     }
  2279.  
  2280.                     FPXoptsMarkRightClickDelay.ele().value = SRDotDX.config.FPXoptsMarkRightClickDelay;
  2281.                     document.getElementById('FPX_options_markVisitedRightClickDelay').disabled = !SRDotDX.config.FPXmarkRightClick;
  2282.                     optsRaidFormat.ele().value = SRDotDX.config.raidLinkFormat;
  2283.                     optsRaidFormat.ele().style.width = e[0].offsetWidth - 12 + "px";
  2284.                     if (SRDotDX.config.hideSeenRaids) {optsHideSRaids.ele().checked = 'checked'}
  2285.                     if (SRDotDX.config.hideVisitedRaids) {optsHideVRaids.ele().checked = 'checked'}
  2286.                     if (SRDotDX.config.hideVisitedRaidsInRaidList) { optsHideVRaidsList.ele().checked = 'checked'}
  2287.                     if (SRDotDX.config.hideRaidLinks) {
  2288.                         optsHideARaids.ele().checked = true;
  2289.                         optsHideVRaids.ele().disabled = true;
  2290.                         optsHideSRaids.ele().disabled = true;
  2291.                     }
  2292.                     if (SRDotDX.config.newRaidsAtTopOfRaidList) { optsNewRaidsAtTopOfRaidList.ele().checked = 'checked'}
  2293.                    
  2294.                     optsAsyncJoin.ele().addEventListener('click', function () {
  2295.                         SRDotDX.config.asyncJoin = this.checked;
  2296.                         optsAsyncJoinCount.ele().disabled = !this.checked;
  2297.                         SRDotDX.gui.createJoinFrames();
  2298.                     });
  2299.                     optsAsyncJoinCount.ele().addEventListener('change', function () {
  2300.                         if(isNumber(this.value) && this.value <= 20 && this.value >=1) SRDotDX.config.asyncJoinCount = parseInt(this.value);
  2301.                         else{
  2302.                             SRDotDX.gui.errorMessage('Async count must be a number between 1 and 20');
  2303.                             this.value = '';
  2304.                         }
  2305.                         SRDotDX.gui.createJoinFrames();
  2306.                     });
  2307.                    
  2308.                     optsAutoPostPaste.ele().addEventListener('click', function () {
  2309.                         SRDotDX.config.autoPostPaste = this.checked;
  2310.                     });
  2311.                    
  2312.                     optsConfirmDeletes.ele().addEventListener('click', function () {
  2313.                         SRDotDX.config.confirmDeletes = this.checked;
  2314.                     });
  2315.                    
  2316.                     optsStatusOverlay.ele().addEventListener('click', function () {
  2317.                         SRDotDX.config.showStatusOverlay = this.checked;
  2318.                     });
  2319.                    
  2320.                     optsRefreshGameToJoin.ele().addEventListener('click', function (){
  2321.                         SRDotDX.config.refreshGameToJoin = this.checked;
  2322.                         optsAsyncJoinCount.ele().disabled = this.checked && !optsAsyncJoin.ele().checked;
  2323.                         optsAsyncJoin.ele().disabled = this.checked;
  2324.                         if(this.checked){
  2325.                             optsAsyncJoinCount.ele().checked = false;
  2326.                             SRDotDX.config.asyncJoin = false;
  2327.                         }
  2328.                     });
  2329.                    
  2330.                     optsAutoImportPaste.ele().addEventListener('click', function (){
  2331.                         SRDotDX.config.autoImportPaste = this.checked;
  2332.                         if(!this.checked){
  2333.                             optsConfirmForLargePaste.ele().checked = false;
  2334.                             SRDotDX.config.confirmForLargePaste = false;
  2335.                         }
  2336.                         optsConfirmForLargePaste.ele().disabled = !this.checked;
  2337.                         optsConfirmPasteSize.ele().disabled = !this.checked;
  2338.                     });
  2339.                     optsConfirmForLargePaste.ele().addEventListener('click', function () {
  2340.                         optsConfirmPasteSize.ele().disabled = !this.checked;
  2341.                         SRDotDX.config.confirmForLargePaste = this.checked;
  2342.                     });
  2343.                     optsConfirmPasteSize.ele().addEventListener('change', function () {
  2344.                         if(isNumber(this.value)) SRDotDX.config.confirmPasteSize = parseInt(this.value);
  2345.                         else SRDotDX.gui.errorMessage('Paste size must be a number');
  2346.                     });
  2347.                    
  2348.                     optsMaxRaidCount.ele().addEventListener('change', function (){
  2349.                         if(isNumber(this.value)) SRDotDX.config.maxRaidCount = parseInt(this.value);
  2350.                         else SRDotDX.gui.errorMessage('Raid count must be a number');
  2351.                     });
  2352.                    
  2353.                     optsUseMaxRaidCount.ele().addEventListener('click', function (){
  2354.                         SRDotDX.config.useMaxRaidCount = this.checked;
  2355.                         if(this.checked){
  2356.                             setTimeout(function(){SRDotDX.purge()},1);
  2357.                         }
  2358.                     });
  2359.                    
  2360.                     optsPrettyPost.ele().addEventListener('click', function(){
  2361.                         SRDotDX.config.prettyPost = this.checked;
  2362.                         if(this.checked){
  2363.                             document.getElementById("SRDotDX_options_formatLinkOutput").checked=false;
  2364.                             SRDotDX.config.formatLinkOutput = false;
  2365.                         }
  2366.                         document.getElementById("SRDotDX_options_formatLinkOutput").disabled=this.checked;
  2367.                     });
  2368.                    
  2369.                     optsMarkImportedVisited.ele().addEventListener("click", function() {
  2370.                         SRDotDX.config.markImportedVisited = this.checked;
  2371.                     });
  2372.                    
  2373.                     optsWhisperToCheck.ele().addEventListener("click", function(){
  2374.                         SRDotDX.config.whisperSpam = this.checked;
  2375.                     });
  2376.                     optsPastebinUrl.ele().addEventListener("change", function(){
  2377.                         if(/http:\/\/pastebin\.com\/\w{8}/i.test(this.value)){
  2378.                             SRDotDX.config.pastebinUrl = this.value;
  2379.                         } else {
  2380.                             SRDotDX.gui.doStatusOutput("Invalid pastebin url.");
  2381.                             this.value = "";
  2382.                         }
  2383.                     });
  2384.                     optsWhisperTo.ele().addEventListener("change", function(){
  2385.                         console.log("[SRDotDX] Whisper person changed to " + this.value);
  2386.                         SRDotDX.config.whisperTo = this.value;
  2387.                     });
  2388.                     optsFormatLinkOutput.ele().addEventListener("click", function(){
  2389.                         SRDotDX.config.formatLinkOutput = this.checked;
  2390.                         if(this.checked){
  2391.                             document.getElementById("SRDotDX_options_prettyPost").checked=false;
  2392.                             document.getElementById("SRDotDX_options_prettyPost").disabled=true;
  2393.                             SRDotDX.config.prettyPost = false;
  2394.                         }
  2395.                         document.getElementById("SRDotDX_options_prettyPost").disabled=this.checked;
  2396.                     });
  2397.                     optsNewPasteAtTopOfPasteList.ele().addEventListener("click",function(){
  2398.                         SRDotDX.config.newPasteAtTopOfPasteList = this.checked;
  2399.                     },true);
  2400.                     optsShowRaidLink.ele().addEventListener("click", function() {
  2401.                         SRDotDX.config.showRaidLink = this.checked;
  2402.                         var els = document.getElementsByClassName("RaidQuickLink");
  2403.                         for(var i=0; i<els.length; i++){
  2404.                             els[i].style.display = (this.checked?'inline':'none');
  2405.                         }
  2406.                     });
  2407.                    
  2408.                     optsMarkMyRaidsVisited.ele().addEventListener("click", function() {
  2409.                         SRDotDX.config.markMyRaidsVisted = this.checked;
  2410.                     });
  2411.                     FPXoptsMarkRightClick.ele().addEventListener("click",function() {
  2412.                         SRDotDX.config.FPXmarkRightClick = this.checked;
  2413.                         document.getElementById('FPX_options_markVisitedRightClickDelay').disabled = !SRDotDX.config.FPXmarkRightClick;
  2414.                    
  2415.                     },false);
  2416.                     FPXoptsMarkRightClickDelay.ele().addEventListener("blur",function() {
  2417.                         if (/^\d+$/ig.test(this.value)) {
  2418.                             SRDotDX.config.FPXoptsMarkRightClickDelay = parseInt(this.value);
  2419.                         }
  2420.                         else {
  2421.                             this.value = SRDotDX.config.FPXoptsMarkRightClickDelay;
  2422.                         }
  2423.                     });
  2424.                     optsRaidFormat.ele().addEventListener("blur",function() {
  2425.                         if (this.value != "") {
  2426.                             SRDotDX.config.raidLinkFormat = this.value;
  2427.                         }
  2428.                         else {
  2429.                             this.value = SRDotDX.config.raidLinkFormat;
  2430.                         }
  2431.                     });
  2432.                     optsFormatRaids.ele().addEventListener("click",function() {
  2433.                         document.getElementById('SRDotDX_options_raidLinkFormat').disabled = (this.checked == true?false:true);
  2434.                         SRDotDX.config.formatRaidLinks = this.checked;
  2435.                     },true);
  2436.                     optsHideARaids.ele().addEventListener("click",function() {
  2437.                         document.getElementById('SRDotDX_options_hideVisitedRaids').disabled = this.checked;
  2438.                         document.getElementById('SRDotDX_options_hideSeenRaids').disabled = this.checked;
  2439.                         SRDotDX.config.hideRaidLinks = this.checked;
  2440.                         SRDotDX.gui.toggleCSS({id: "SRDotDX_raidClass", cls:".SRDotDX_raid{display: "+(this.checked == true?'none !important':'block')+"}"})
  2441.                     },true);
  2442.                     optsHideSRaids.ele().addEventListener("click",function() {
  2443.                         SRDotDX.config.hideSeenRaids = this.checked;
  2444.                         SRDotDX.gui.toggleCSS({id: "SRDotDX_seenRaidClass", cls:".SRDotDX_seenRaid{display: "+(this.checked == true?'none !important':'block')+"}"})
  2445.                     },true);
  2446.                     optsHideVRaids.ele().addEventListener("click",function() {
  2447.                         SRDotDX.config.hideVisitedRaids = this.checked;
  2448.                         SRDotDX.gui.toggleCSS({id: "SRDotDX_visitedRaidClass", cls:".SRDotDX_visitedRaid{display: "+(this.checked == true?'none !important':'block')+"}"})
  2449.                     },true);
  2450.                     optsHideVRaidsList.ele().addEventListener("click",function() {
  2451.                         SRDotDX.config.hideVisitedRaidsInRaidList = this.checked;
  2452.                         SRDotDX.gui.toggleCSS({id: "SRDotDX_visitedRaidListClass", cls:".SRDotDX_visitedRaidList{display:"+(this.checked == true?'none !important':'block')+"}"})
  2453.                     },true);
  2454.                     optsNewRaidsAtTopOfRaidList.ele().addEventListener("click",function() {
  2455.                         SRDotDX.config.newRaidsAtTopOfRaidList = this.checked;
  2456.                     },true);
  2457.  
  2458.                     rbUnvisitedPruningAggressive.ele().addEventListener("click",function() {
  2459.                         SRDotDX.config.unvisitedRaidPruningMode = 0;
  2460.                     },true);
  2461.  
  2462.                     rbUnvisitedPruningModerate.ele().addEventListener("click",function() {
  2463.                         SRDotDX.config.unvisitedRaidPruningMode = 1;
  2464.                     },true);
  2465.  
  2466.                     rbUnvisitedPruningSlow.ele().addEventListener("click",function() {
  2467.                         SRDotDX.config.unvisitedRaidPruningMode = 2;
  2468.                     },true);
  2469.  
  2470.                     rbUnvisitedPruningNone.ele().addEventListener("click",function() {
  2471.                         SRDotDX.config.unvisitedRaidPruningMode = 3;
  2472.                     },true);
  2473.  
  2474.                     SRDotDX.gui.createJoinFrames();
  2475.                     //CHAT TAB CLICK SCROLL (id=chat_tab, class=chat_message_window)
  2476.                     var chatTab = SRDotDX.gui.cHTML('#chat_tab');
  2477.                     chatTab.ele().addEventListener("click", function () {
  2478.                         setTimeout(function(){
  2479.                             var els = document.getElementsByClassName('chat_message_window');
  2480.                             for(i=0;i<els.length;i++){
  2481.                                 var el = els[i];
  2482.                                 console.log("[SRDotDX] Scrolling chat window " + el.scrollTop + " : " + el.scrollHeight);
  2483.                                 el.scrollTop = el.scrollHeight;
  2484.                             }
  2485.                         },50);
  2486.                     },true);
  2487.                    
  2488.                    
  2489.                     // Filtering tab                   
  2490.                     for (var i in SRDotDX.raids) {
  2491.                         if (SRDotDX.raids.hasOwnProperty(i)) {
  2492.                             var raid = SRDotDX.raids[i];
  2493.  
  2494.                             var parentTableId = 'FPX_options_cbs_' + raid.id;
  2495.                             var parentTable = SRDotDX.gui.cHTML('tr').set({id: parentTableId}).html(' \
  2496.                                 <td>' + raid.name + '</td> \
  2497.                                 <td><input type="checkbox" id="cb_filter_' + raid.id + '_0' + '"/></td> \
  2498.                                 <td><input type="checkbox" id="cb_filter_' + raid.id + '_1' + '"/></td> \
  2499.                                 <td><input type="checkbox" id="cb_filter_' + raid.id + '_2' + '"/></td> \
  2500.                                 <td><input type="checkbox" id="cb_filter_' + raid.id + '_3' + '"/></td> \
  2501.                                 <td><input type="checkbox" id="cb_filter_' + raid.id + '_all' + '"/></td>');
  2502.  
  2503.                             if (raid.size == 1) {
  2504.                                 parentTable.attach('to','FPXRaidFilterWhatPersonal');
  2505.                             } else if (raid.stat == 'H' || raid.stat == 'h') {
  2506.                                 parentTable.attach('to','FPXRaidFilterWhatGuild');
  2507.                             } else if (raid.size == 10 || raid.id == 'dragons_lair' || raid.id == 'pumpkin' || raid.id == 'jacksrevenge1') {
  2508.                                 parentTable.attach('to','FPXRaidFilterWhatSmall');
  2509.                             } else if (raid.id == 'serpina' || raid.id == 'tisiphone') {
  2510.                                 parentTable.attach('to','FPXRaidFilterWhatSpecial');
  2511.                             } else if (raid.size == 50) {
  2512.                                 parentTable.attach('to','FPXRaidFilterWhatMedium');
  2513.                             } else if (raid.size == 100) {
  2514.                                 parentTable.attach('to','FPXRaidFilterWhatLarge');
  2515.                             } else if (raid.size == 250) {
  2516.                                 parentTable.attach('to','FPXRaidFilterWhatEpic');
  2517.                             } else if (raid.size == 500) {
  2518.                                 parentTable.attach('to','FPXRaidFilterWhatColossal');
  2519.                             } else {
  2520.                                 parentTable.attach('to','FPXRaidFilterWhatSpecial');
  2521.                             }
  2522.  
  2523.                            
  2524.                             for (var j=0; j<4; j++) {
  2525.                                 var cb_id = "cb_filter_" + raid.id + '_' + j;
  2526.                                 var is_checked = (SRDotDX.config.getFilter(raid.id,j) == true ? false : true);
  2527.                                 var cb = SRDotDX.gui.cHTML('#' + cb_id);   
  2528.                                 cb.ele().checked = is_checked;
  2529.  
  2530.                                 cb.ele().addEventListener("click",function() {
  2531.                                     var raidid = "";
  2532.                                     var diffIndex = "";
  2533.                                     var reg = /cb_filter_([0-9a-z_]+)_([0-9])/i;
  2534.                                     if ((i = reg.exec(this.id)) != null) {
  2535.                                         raidid = i[1];
  2536.                                         diffIndex = parseInt(i[2]);
  2537.                                     }
  2538.                                     SRDotDX.config.setFilter(raidid,diffIndex,!this.checked);
  2539.                                     SRDotDX.gui.toggleCSS({id: "SRDotDX_filteredRaidChat" + raidid + '_' + diffIndex + "Class",
  2540.                                         cls:".SRDotDX_filteredRaidChat" + raidid + '_' + diffIndex + "{display: "+((this.checked==false && SRDotDX.config.filterChatLinks)?'none !important':'block')+"}"});
  2541.                                     SRDotDX.gui.toggleCSS({id: "SRDotDX_filteredRaidList" + raidid + '_' + diffIndex + "Class",
  2542.                                         cls:".SRDotDX_filteredRaidList" + raidid + '_' + diffIndex + "{display: "+((this.checked==false && SRDotDX.config.filterRaidList)?'none !important':'block')+"}"});
  2543.                            
  2544.                                     var f1 = SRDotDX.config.getFilter(raidid,0);
  2545.                                     var f2 = SRDotDX.config.getFilter(raidid,1);
  2546.                                     var f3 = SRDotDX.config.getFilter(raidid,2);
  2547.                                     var f4 = SRDotDX.config.getFilter(raidid,3);
  2548.  
  2549.                                     var cb_all_id = "cb_filter_" + raidid + '_all';
  2550.                                    
  2551.                                     if ((!f1 && !f2 && !f3 && !f4) || (f1 && f2 && f3 && f4)) {
  2552.                                         var cb = SRDotDX.gui.cHTML('#' + cb_all_id);
  2553.                                         cb.ele().checked = this.checked;
  2554.                                     }
  2555.  
  2556.  
  2557.                                 },true);   
  2558.                             }
  2559.  
  2560.                             var all_cb_id = "cb_filter_" + raid.id + "_all";
  2561.                             var is_checked = (SRDotDX.config.getFilter(raid.id,0) == true && SRDotDX.config.getFilter(raid.id,1) == true && SRDotDX.config.getFilter(raid.id,2) == true && SRDotDX.config.getFilter(raid.id,3) == true) ? false : true;
  2562.                             var cb = SRDotDX.gui.cHTML('#' + all_cb_id);
  2563.                             cb.ele().checked = is_checked;
  2564.  
  2565.                             cb.ele().addEventListener("click",function() {
  2566.                                 var reg = /cb_filter_([0-9a-z_]+)_all/i;
  2567.                                 var raidid = "";
  2568.                                 if ((i = reg.exec(this.id)) != null) {
  2569.                                     raidid = i[1];
  2570.                                 }
  2571.  
  2572.                                 for (var j=0;j<4;j++) {
  2573.                                     var cb_id = "cb_filter_" + raidid + '_' + j;
  2574.                                     var subcb = SRDotDX.gui.cHTML('#' + cb_id);
  2575.                                     subcb.ele().checked = this.checked;
  2576.                                     SRDotDX.config.setFilter(raidid,j,!this.checked);
  2577.                                                                                                                 SRDotDX.gui.toggleCSS({id: "SRDotDX_filteredRaidChat" + raidid + '_' + j + "Class",
  2578.                                         cls:".SRDotDX_filteredRaidChat" + raidid + '_' + j + "{display: "+((this.checked==false && SRDotDX.config.filterChatLinks)?'none !important':'block')+"}"});
  2579.                                     SRDotDX.gui.toggleCSS({id: "SRDotDX_filteredRaidList" + raidid + '_' + j + "Class",
  2580.                                         cls:".SRDotDX_filteredRaidList" + raidid + '_' + j + "{display: "+((this.checked==false && SRDotDX.config.filterRaidList)?'none !important':'block')+"}"});
  2581.                                 }
  2582.  
  2583.                             },true);                   
  2584.                         }
  2585.                     }
  2586.  
  2587.                     var filterChatCb = SRDotDX.gui.cHTML('#SRDotDX_options_perRaidFilterLinks');
  2588.                     filterChatCb.ele().checked = SRDotDX.config.filterChatLinks;
  2589.                     filterChatCb.ele().addEventListener("click",function() {
  2590.                         SRDotDX.config.filterChatLinks = this.checked;         
  2591.  
  2592.                         for (var i in SRDotDX.raids) {
  2593.                             if (SRDotDX.raids.hasOwnProperty(i)) {
  2594.                                 var raid = SRDotDX.raids[i];
  2595.  
  2596.                                 for (var j=0; j<4; j++) {
  2597.                                     SRDotDX.gui.toggleCSS({id: "SRDotDX_filteredRaidChat" + raid.id + '_' + j + "Class",
  2598.                                         cls:".SRDotDX_filteredRaidChat" + raid.id + '_' + j + "{display: "+((SRDotDX.config.getFilter(raid.id,j)==true && SRDotDX.config.filterChatLinks)?'none !important':'block')+"}"});
  2599.                                 }
  2600.                             }
  2601.                         }
  2602.  
  2603.                     },true);
  2604.  
  2605.                     var filterListCb = SRDotDX.gui.cHTML('#SRDotDX_options_perRaidFilterRaidList');
  2606.                     filterListCb.ele().checked = SRDotDX.config.filterRaidList;
  2607.                     filterListCb.ele().addEventListener("click",function() {
  2608.                         SRDotDX.config.filterRaidList = this.checked;          
  2609.  
  2610.                         for (var i in SRDotDX.raids) {
  2611.                             if (SRDotDX.raids.hasOwnProperty(i)) {
  2612.                                 var raid = SRDotDX.raids[i];
  2613.  
  2614.                                 for (var j=0; j<4; j++) {
  2615.                                     SRDotDX.gui.toggleCSS({id: "SRDotDX_filteredRaidList" + raid.id + '_' + j + "Class",
  2616.                                         cls:".SRDotDX_filteredRaidList" + raid.id + '_' + j + "{display: "+((SRDotDX.config.getFilter(raid.id,j)==true && SRDotDX.config.filterRaidList)?'none !important':'block')+"}"});
  2617.                                 }
  2618.                             }
  2619.                         }
  2620.  
  2621.                     },true);       
  2622.  
  2623.                     SRDotDX.gui.cHTML('li').set({
  2624.                         class: 'spritegame'
  2625.                     }).html("<a href=\"http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons\" onclick=\"SRDotDX.reload(); return false;\">Reload Game</a>").attach("after","get_kreds_link");
  2626.  
  2627.                     // Start raid pruning 10 seconds after loading completion
  2628.                     setTimeout('SRDotDX.gui.BeginDeletingExpiredUnvisitedRaids(); SRDotDX.purge();',10000);
  2629.  
  2630.                     // Start update checking 10 seconds after loading completion
  2631.                     setTimeout('SRDotDX.BeginUpdateChecking();',10000);
  2632.  
  2633.                     console.log("[SRDotDX] Loading is complete.");
  2634.                 }
  2635.                 else {setTimeout(SRDotDX.gui.load,5)}
  2636.                 SRDotDX.gui.doStatusOutput('Loaded successfully', 4000, false);
  2637.             },
  2638.             loadRaidList: function () {
  2639.                 var i = document.getElementById("raid_list");
  2640.                 while (i.hasChildNodes() && i.childNodes.length > 0) {
  2641.                     i.removeChild(i.firstChild);
  2642.                 }
  2643.                 for (var a in SRDotDX.config.raidList) {
  2644.                     if (SRDotDX.config.raidList.hasOwnProperty(a)) {
  2645.                         SRDotDX.gui.addRaid(a);
  2646.                     }
  2647.                 }
  2648.             },
  2649.             loadPasteList: function () {
  2650.  
  2651.                 var i = document.getElementById("paste_list");
  2652.                 while (i.hasChildNodes() && i.childNodes.length > 0) {
  2653.                     i.removeChild(i.firstChild);
  2654.                 }
  2655.                 for (var a in SRDotDX.config.pasteList) {
  2656.                     if (SRDotDX.config.pasteList.hasOwnProperty(a)) {
  2657.                         SRDotDX.gui.addPaste(a);
  2658.                     }
  2659.                 }
  2660.             },
  2661.             FPXraidLinkClick: function (id, link,isRightClick) {
  2662.                 link = (typeof link=='string'?link:link.href);
  2663.                 if(!isRightClick){
  2664.                     if(!SRDotDX.gui.AutoJoin){
  2665.                         SRDotDX.gui.AutoJoinCurrentTotal = 1;
  2666.                         SRDotDX.gui.AutoJoinRaids = [SRDotDX.gui.GetRaid(id)];
  2667.                         SRDotDX.gui.AutoJoin = true;
  2668.                         SRDotDX.gui.doStatusOutput("Joining " + SRDotDX.raids[SRDotDX.config.raidList[id].boss].shortname + "...");
  2669.                         SRDotDX.loadRaid(link);
  2670.                     } else {
  2671.                         SRDotDX.gui.AutoJoinCurrentTotal++;
  2672.                         SRDotDX.gui.doStatusOutput("Adding " + SRDotDX.raids[SRDotDX.config.raidList[id].boss].shortname + "...");
  2673.                         if(SRDotDX.gui.AutoJoinVisibleClicked)
  2674.                             SRDotDX.gui.AutoJoinRaids.splice(SRDotDX.gui.AutoJoinCurrentIndex+1, 0, SRDotDX.gui.GetRaid(id));
  2675.                         else SRDotDX.gui.AutoJoinRaids.push(SRDotDX.gui.GetRaid(id));
  2676.                     }
  2677.                 }
  2678.                 else if(document.getElementById('FPX_options_markVisitedRightClick').checked){
  2679.                     SRDotDX.config.raidList[id].visited = true;
  2680.                     SRDotDX.gui.toggleRaid('visited',id,true);             
  2681.                     SRDotDX.gui.raidListItemUpdate(id);
  2682.                 }
  2683.             },
  2684.             FPXraidListMouseDown: function (e) {
  2685.                 e.preventDefault();
  2686.                
  2687.                 var classtype=e.element().className;
  2688.                 e = e || window.event;
  2689.                 e.stopPropagation();
  2690.                 console.log("[SRDotDX]::{FPX}:: Clicked on::"+classtype+"::"+e.which);
  2691.                 if(e.which == 1){
  2692.                     if(classtype == "raid_list_item_head"){
  2693.                         var con = document.getElementById("raid_list").getElementsByClassName("active");
  2694.                         if (con.length == 1) con[0].className = con[0].className.replace(/ active/gi,"");
  2695.                         e.element().parentNode.className += " active";
  2696.                         SRDotDX.gui.raidListItemUpdateTimeSince(e.element().parentNode.getAttribute("raidid"));
  2697.                         return false;
  2698.                     }else if(classtype == "FPXtext"){
  2699.                         var con = document.getElementById("raid_list").getElementsByClassName("active");
  2700.                         if (con.length == 1) con[0].className = con[0].className.replace(/ active/gi,"");
  2701.                         e.element().parentNode.parentNode.className += " active";
  2702.                         SRDotDX.gui.raidListItemUpdateTimeSince(e.element().parentNode.parentNode.getAttribute("raidid"));
  2703.                         return false;
  2704.                     }else if(classtype == "FPXDeleteLink"){
  2705.                         SRDotDX.gui.deleteRaid(e.element(),e.element().parentNode.parentNode.parentNode.getAttribute("raidid")); return false;
  2706.                     }else if(classtype == "FPXcbVisited"){
  2707.                         console.log("[SRDotDX]::{FPX}:: Clicked on::"+classtype+"::"+e.which+"::"+e.element().parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("raidid"));
  2708.                         e.element().checked=(e.element().checked == true?false:true);
  2709.                         SRDotDX.gui.raidListCBClicked(e.element(),'visited',e.element().parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("raidid"));
  2710.                     }else if(classtype == "FPXcbSeen"){
  2711.                         //onclick="SRDotDX.gui.raidListCBClicked(this,\'seen\',\''+r.hash+'\')"'+(r.seen == true?' checked="checked"':'')+'
  2712.                         console.log("[SRDotDX]::{FPX}:: Clicked on::"+classtype+"::"+e.which+"::"+e.element().parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("raidid"));
  2713.                         e.element().checked=(e.element().checked == true?false:true);
  2714.                         SRDotDX.gui.raidListCBClicked(e.element(),'seen',e.element().parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("raidid"));
  2715.                     }else if(classtype == "RaidQuickLink" || classtype == "link" || classtype == "FPXlink"){
  2716.                         SRDotDX.gui.FPXraidLinkClick(e.element().parentNode.parentNode.getAttribute("raidid"), e.element(), false); return false;
  2717.                     }
  2718.                 }else if(e.which == 3){
  2719.                     if(classtype == "RaidQuickLink" || classtype == "link" || classtype == "FPXlink"){
  2720.                         (function() { return setTimeout(function() {SRDotDX.gui.FPXraidLinkClick(e.element().parentNode.parentNode.getAttribute("raidid"), e.element(),true);}, SRDotDX.config.FPXoptsMarkRightClickDelay)})();
  2721.                         return false;
  2722.                     }
  2723.                 }
  2724.             },
  2725.             FPXpasteListMouseDown: function (e) {
  2726.                 e = e || window.event;
  2727.                 var classtype=e.element().className;
  2728.                 e.stopPropagation();
  2729.                 console.log("[SRDotDX]::{FPX}:: Clicked on::"+classtype+"::"+e.which);
  2730.                 if(e.which == 1){
  2731.                     if(classtype == "paste_list_item_head"){
  2732.                         var con = document.getElementById("paste_list").getElementsByClassName("active");
  2733.                         if (con.length == 1) con[0].className = con[0].className.replace(/ active/gi,"");
  2734.                         e.element().parentNode.className += " active";
  2735.                         return false;
  2736.                     }else if(classtype == "FPXDeleteLink"){
  2737.                         SRDotDX.gui.deletePaste(e.element(),SRDotDX.gui.GetAncestorAttribute(e.element(), "pasteid")); return false;
  2738.                         return false;
  2739.                     }else if(classtype == "FPXImportLink"){
  2740.                         SRDotDX.gui.FPXImportPasteBin(e.element().href);
  2741.                         return false;
  2742.                     }else if(classtype == 'link') {
  2743.                         window.open(e.element().href);
  2744.                     }
  2745.                 }else if(e.which == 3){//right click
  2746.                
  2747.                 }
  2748.             },
  2749.             FPXraidLinkMouseDown: function (e,param1,param2,isChat) {
  2750.                 e = e || window.event;
  2751.                 if(isChat){
  2752.                     switch (e.which) {
  2753.                         case 1: SRDotDX.gui.FPXraidLinkClick(param1,param2,false); break;
  2754.                         case 3:
  2755.                                 if(SRDotDX.config.FPXmarkRightClick){
  2756.                                     (function(p1,p2) {return setTimeout(function() {SRDotDX.gui.FPXraidLinkClick(p1,p2,true);}, SRDotDX.config.FPXoptsMarkRightClickDelay)})(param1,param2);
  2757.                                 }else{
  2758.                                     SRDotDX.gui.FPXraidLinkClick(param1,param2,true);
  2759.                                 }
  2760.                                 break;
  2761.                     }
  2762.                 }
  2763.             },
  2764.             raidListCBClicked: function (ele,cb,id) {
  2765.             console.log("[SRDotDX]::{FPX}:: Clicked on::"+ele.checked+"::"+cb+"::"+id);
  2766.                 if (SRDotDX.config.raidList[id]) {
  2767.                 console.log("[SRDotDX]::{FPX}:: Clicked on1::"+ele.checked+"::"+cb+"::"+id);
  2768.                     SRDotDX.config.raidList[id][cb] = ele.checked;
  2769.                     console.log("[SRDotDX]::{FPX}:: Clicked on2::"+ele+"::"+cb+"::"+id);
  2770.                     SRDotDX.gui.toggleRaid(cb,id,true);
  2771.                     console.log("[SRDotDX]::{FPX}:: Clicked on3::"+ele+"::"+cb+"::"+id);
  2772.                     if (cb =='visited') {
  2773.                         console.log("[SRDotDX]::{FPX}:: Clicked on4::"+ele+"::"+cb+"::"+id);
  2774.                         ele.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("FPXtext")[1].innerHTML = (ele.checked?"visited":"");
  2775.                         console.log("[SRDotDX]::{FPX}:: Clicked on5::"+ele+"::"+cb+"::"+ele.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("FPXtext")[1].innerHTML);
  2776.                     }
  2777.                 }
  2778.             },
  2779.             raidListItemUpdateTimeSince: function (id) {
  2780.                 var raid = SRDotDX.config.raidList[id];
  2781.                 if (typeof raid == 'object') {
  2782.                     document.getElementById('timeSince_' + id).innerHTML = timeSince(new Date(raid.timeStamp))
  2783.                 }
  2784.             },
  2785.             raidListItemUpdate: function (id) {
  2786.                 var raid = SRDotDX.config.raidList[id];
  2787.                 if (typeof raid == 'object') {
  2788.                     var ele = document.getElementById("raid_list").firstChild;
  2789.                     while (ele) {
  2790.                         if (ele.getAttribute("raidid") == id) {
  2791.                             ele.getElementsByClassName("FPXtext")[1].innerHTML = (raid.visited == true?'visited':'');
  2792.                             ele.getElementsByTagName("input")[0].checked = (raid.seen == true?true:false);
  2793.                             ele.getElementsByTagName("input")[1].checked = (raid.visited == true?true:false);
  2794.                             break;
  2795.                         }
  2796.                         ele = ele.nextSibling;
  2797.                     }
  2798.                 }
  2799.                 else {
  2800.                     SRDotDX.gui.raidListItemRemoveById(id);
  2801.                 }
  2802.             },
  2803.             raidListItemRemoveById: function (id) {
  2804.                 var e, ele = document.getElementById("raid_list").firstChild;
  2805.                 while (typeof ele != 'null') {
  2806.                     if (ele.getAttribute("raidid") == id) {
  2807.                         break;
  2808.                     }
  2809.                     ele = ele.nextSibling;
  2810.                 }
  2811.                 if (ele) {
  2812.                     while (typeof (e = ele.nextSibling) != 'null') {
  2813.                         e.setAttribute("style",(e.getAttribute("style").indexOf('background-color:#e0e0e0') > -1?"":'background-color:#e0e0e0'))
  2814.                     }
  2815.                     ele.parentNode.removeChild(ele);
  2816.                 }
  2817.             },
  2818.             toggleCSS: function (p) {
  2819.                 if (p) {
  2820.                     document.head.removeChild(document.getElementById(p.id));
  2821.                     SRDotDX.gui.cHTML("style").set({type: "text/css", id: p.id}).text(p.cls).attach("to",document.head);
  2822.                 }
  2823.             },
  2824.             toggleRaid: function(type,id,tog) {
  2825.                 var d = document.getElementsByClassName("SRDotDX_raidid_" + id);
  2826.                 if (typeof SRDotDX.config.raidList[id] == 'object') {
  2827.                     var raid = SRDotDX.config.raidList[id];
  2828.                     var raid = SRDotDX.getRaidDetails("&kv_difficulty="+raid.diff+"&kv_hash="+raid.hash+"&kv_raid_boss="+raid.boss+"&kv_raid_id="+raid.id);
  2829.                 }
  2830.                 for (var i = d.length -1;i>-1;i--) {
  2831.                     if (tog == true && d[i].className.indexOf("SRDotDX_"+type+"Raid") == -1) {
  2832.                         d[i].className += " SRDotDX_"+type+"Raid";
  2833.                     }
  2834.                     else if (tog == false && d[i].className.indexOf("SRDotDX_"+type+"Raid") > -1) {
  2835.                         d[i].className = d[i].className.replace(eval("/SRDotDX_"+type+"Raid( |$)/i"),"");
  2836.                     }
  2837.                     if (typeof raid == 'object') {
  2838.                         d[i].getElementsByTagName("a")[0].innerHTML = raid.linkText();
  2839.                     }
  2840.                 }
  2841.  
  2842.                 var d2 = document.getElementsByClassName("raid_list_item_" + id);
  2843.                 for (var j = d2.length -1;j>-1;j--) {
  2844.                     if (tog == true && d2[j].className.indexOf("SRDotDX_"+type+"RaidList") == -1) {
  2845.                         d2[j].className += " SRDotDX_"+type+"RaidList";
  2846.                     }
  2847.                     else if (tog == false && d2[j].className.indexOf("SRDotDX_"+type+"RaidList") > -1) {
  2848.                         d2[j].className = d2[j].className.replace(eval("/SRDotDX_"+type+"RaidList( |$)/i"),"");
  2849.                     }
  2850.                 }
  2851.             }
  2852.         },
  2853.         load: function (fails) {
  2854.             if (typeof holodeck == 'object' && typeof ChatDialogue == 'function' && typeof activateGame == 'function' && typeof document.getElementById('kong_game_ui') != 'null') {
  2855.                 ChatDialogue.prototype.SRDotDX_echo = function(msg){
  2856.                     this.SRDotDX_DUM("DotD Extension","<br>"+msg,{class: "whisper whisper_received"},{non_user: true})
  2857.                 }
  2858.                 ChatDialogue.prototype.SRDotDX_DUM = ChatDialogue.prototype.displayUnsanitizedMessage;
  2859.                 ChatDialogue.prototype.displayUnsanitizedMessage=function (b,d,e,f) {
  2860.                     if(!this._user_manager.isMuted(b)){
  2861.                         if (typeof e != 'object') {
  2862.                             e = {class: ''}
  2863.                         }
  2864.                         else if (typeof e.class != 'string') {
  2865.                             e.class = '';
  2866.                         }
  2867.                         var isPublic = false;
  2868.                         try {
  2869.                             isPublic = (/^room_\d+-dawn-of-the-dragons-\d+$/i.test(this._holodeck._chat_window._active_room._short_room_name) && e.class.indexOf("whisper") == -1?true:false)
  2870.                         }
  2871.                         catch(err){}
  2872.  
  2873.                         var raid = SRDotDX.getRaidLink(d,b,isPublic)
  2874.                         if (typeof raid == 'object') {
  2875.                             e.class+= " SRDotDX_raid";
  2876.                             e.class+= " SRDotDX_hash_"+raid.hash;
  2877.                             e.class+= " SRDotDX_raidid_"+raid.id;
  2878.                             e.class+= (raid.seen?" SRDotDX_seenRaid":'');
  2879.                             e.class+=(raid.visited?" SRDotDX_visitedRaid":'');
  2880.                             e.class+=(raid.nuked?" SRDotDX_nukedRaid":'');
  2881.                             e.class+=" SRDotDX_filteredRaidChat" + raid.boss + '_' + (raid.diff - 1);                          
  2882.                             d = raid.ptext + '<a href="'+raid.url+'" onClick="return false;" onMouseDown="SRDotDX.gui.FPXraidLinkMouseDown(event,'+'\''+raid.id+'\''+',this.href,true); return false">'+raid.linkText()+'</a>'+raid.ntext;
  2883.                             SRDotDX.gui.toggleRaid('visited',raid.id,raid.visited);
  2884.                             SRDotDX.config.raidList[raid.id].seen = true;
  2885.                             SRDotDX.gui.raidListItemUpdate(raid.id);
  2886.                             if(raid.isNew){
  2887.                                 if(!SRDotDX.gui.AutoJoin)
  2888.                                     SRDotDX.gui.updateMessage();
  2889.                                 SRDotDX.gui.FPXFilterRaidListByName();
  2890.                             }
  2891.                         }
  2892.                         var pb = SRDotDX.getPastebinLink(d,b,isPublic)
  2893.                         if (typeof pb == 'object') {
  2894.                             var doImport = pb.user!=active_user.username() && SRDotDX.config.autoImportPaste && pb.user==b;
  2895.                             d = pb.ptext + '<a href="'+pb.url+'" target="_blank">'+(pb.isNew?'Pastebin Link':pb.user+'\'s Pastebin')+'</a> <span class="pb_'+pb.id+'">('+(doImport?'Importing...':'<a href="#" onClick="return false;" onMouseDown="SRDotDX.gui.FPXImportPasteBin(\''+pb.url+'\')">Import</a>')+')</span>'+pb.ntext;
  2896.                             if(doImport){
  2897.                                 setTimeout("SRDotDX.gui.FPXImportPasteBin('"+pb.url+"');", 1000);
  2898.                             }
  2899.                         }
  2900.                         if(SRDotDX.config.mutedUsers[b]){
  2901.                             e.class+=" SRDotDX_nukedRaidList";
  2902.                             console.log("[SRDotDX] Muted message recieved from " + b + " : " + d);
  2903.                         }
  2904.                         this.SRDotDX_DUM(b,d,e,f);
  2905.                     }
  2906.                 }
  2907.                 holodeck.addChatCommand("raidformat",function(deck,text){
  2908.                     if (/^\/raidformat$/i.test(text)) {
  2909.                         var i = SRDotDX.config.raidLinkFormat.replace(/</g,"&lt;").replace(/>/g,"&gt;")
  2910.                         SRDotDX.echo("Raid Link formatting is: <b>" + (SRDotDX.config.formatRaidLinks?"on":"off")+"</b><br>Current Format:<br>"+i);
  2911.                     }
  2912.                     else if (/^\/raidformat on$/i.test(text)) {
  2913.                         if (SRDotDX.config.formatRaidLinks == false) {
  2914.                             SRDotDX.config.formatRaidLinks = true;
  2915.                             SRDotDX.echo("Raid link formatting is now enabled");
  2916.                         }
  2917.                         else {
  2918.                             SRDotDX.echo("Raid link formatting is already enabled")
  2919.                         }
  2920.                     }
  2921.                     else if (/^\/raidformat off$/i.test(text)) {
  2922.                         if (SRDotDX.config.formatRaidLinks == true) {
  2923.                             SRDotDX.config.formatRaidLinks = false;
  2924.                             SRDotDX.echo("Raid link formatting is now disabled");
  2925.                         }
  2926.                         else {
  2927.                             SRDotDX.echo("Raid link formatting is already disabled")
  2928.                         }
  2929.                     }
  2930.                     else if (/^\/raidformat help$/i.test(text)) {
  2931.                         SRDotDX.gui.help("raidformat")
  2932.                     }
  2933.                     else if (SRDotDX.config.formatRaidLinks == false) {
  2934.                         SRDotDX.echo('<b>/raidformat</b>: You must enable raid link formatting before you can set the format. (<a href="#" onclick="SRDotDX.gui.help(\'raidformat\'); return false">help</a>)')
  2935.                     }
  2936.                     else if (i = /^\/raidformat (\S.*)$/i.exec(text)) {
  2937.                         SRDotDX.config.raidLinkFormat = i[1];
  2938.                         SRDotDX.gui.cHTML('#SRDotDX_options_raidLinkFormat').ele().value = i[1];
  2939.                         SRDotDX.echo("Raid format now set to:<br>"+i[1].replace(/</g,"&lt;").replace(/>/g,"&gt;"));
  2940.                     }
  2941.                     else {
  2942.                         SRDotDX.echo('<b>/raidformat</b>: Invalid parameters specified. (<a href="#" onclick="SRDotDX.gui.help(\'raidformat\'); return false">help</a>)')
  2943.                     }
  2944.                     return false;
  2945.                 });
  2946.                 holodeck.addChatCommand("lr",function(deck,text){
  2947.                     var u;
  2948.                     if (u = /^\/lr (\S+)$/i.exec(text)) {SRDotDX.loadRaid(u[1]);}
  2949.                     else {SRDotDX.echo('<b>/loadraid</b>: Invalid raid specified. (<a href="#" onclick="SRDotDX.gui.help(\'loadraid\'); return false">help</a>)');}
  2950.                     return false;
  2951.                 });
  2952.                 holodeck.addChatCommand("loadraid",function(deck,text){
  2953.                     var u;
  2954.                     if (u = /^\/loadraid (\S+)$/i.exec(text)) {SRDotDX.loadRaid(u[1]);}
  2955.                     else {SRDotDX.echo('<b>/loadraid</b>: Invalid raid specified. (<a href="#" onclick="SRDotDX.gui.help(\'loadraid\'); return false">help</a>)');}
  2956.                     return false;
  2957.                 });
  2958.                 holodeck.addChatCommand("stop",function(deck,text){
  2959.                     if(SRDotDX.gui.isPosting)
  2960.                     {
  2961.                         SRDotDX.gui.FPXStopPosting();
  2962.                     }else{SRDotDX.echo('<b>/stop</b>: Links are not being posted. Stop command invalid.');}
  2963.                     return false;
  2964.                 });
  2965.                 holodeck.addChatCommand("reload",function(deck,text){
  2966.                     if (/^\/reload$/i.test(text)) {
  2967.                         SRDotDX.reload();
  2968.                     }
  2969.                     else {
  2970.                         SRDotDX.echo('<b>/reload</b>: Invalid parameters specified. (<a href="#" onclick="SRDotDX.gui.help(\'reload\'); return false">help</a>)');
  2971.                     }
  2972.                     return false
  2973.                 });
  2974.                 holodeck.addChatCommand("mute",function (deck, text){
  2975.                     var s = String(text).split(" ");
  2976.                     if(s.length == 2 && s[1] != ""){
  2977.                         SRDotDX.config.mutedUsers[s[1]]=true;
  2978.                         SRDotDX.echo('User "' + s[1] + '" muted.  Use the /unmute command to undo, and the /mutelist to see all muted users.');
  2979.                         SRDotDX.config.save(false);
  2980.                     }else {
  2981.                         SRDotDX.echo('<b>/mute</b>: Invalid parameters specified. The proper syntax is "/mute [username]". <!--(<a href="#" onclick="SRDotDX.gui.help(\'mute\'); return false">help</a>)-->');
  2982.                     }
  2983.                     return false;
  2984.                 });
  2985.                 holodeck.addChatCommand("unmute",function (deck, text){
  2986.                     var s = String(text).split(" ");
  2987.                     if(s.length == 2 && s[1] != ""){
  2988.                         if(s[1] == 'all'){
  2989.                             for(var u in SRDotDX.config.mutedUsers){
  2990.                                 delete SRDotDX.config.mutedUsers[u];
  2991.                             }
  2992.                             SRDotDX.echo('All users unmuted.');
  2993.                         }else if(SRDotDX.config.mutedUsers[s[1]]){
  2994.                             delete SRDotDX.config.mutedUsers[s[1]];
  2995.                             SRDotDX.echo('User "' + s[1] + '" unmuted.');
  2996.                             SRDotDX.config.save(false);
  2997.                         } else SRDotDX.echo('No muted user "' + s[1] + '" found.');
  2998.                        
  2999.                     }else {
  3000.                         SRDotDX.echo('<b>/unmute</b>: Invalid parameters specified. The proper syntax is "/unmute [username]". "/unmute all" can be used to unmute all muted users.<!--(<a href="#" onclick="SRDotDX.gui.help(\'unmute\'); return false">help</a>)-->');
  3001.                     }
  3002.                     return false;
  3003.                 });
  3004.                 holodeck.addChatCommand("mutelist", function (deck, text){
  3005.                     var s = "<b>List of users currently muted:</b><br/>";
  3006.                     var i = 0;
  3007.                     for(var u in SRDotDX.config.mutedUsers){
  3008.                         s += u + "<br/>";
  3009.                         i++;
  3010.                     }
  3011.                     if(i==0)s="No users currently muted.<br/>";
  3012.                     s += "<br/>Use the /mute and /unmute commands to add or remove users on this list.";
  3013.                     SRDotDX.echo(s);
  3014.                     return false;
  3015.                 });
  3016.                 holodeck.addChatCommand("toggle",function (deck,text){
  3017.                     var i;
  3018.                     if (/^\/toggle$/i.test(text)) {
  3019.                         var msg = "<b>Current Displays:</b><br>"
  3020.                         msg += "Visited Raids: "+(!SRDotDX.config.hideVisitedRaids?'Shown':'hidden')+"<br>";
  3021.                         msg += "Seen Raids: "+(!SRDotDX.config.hideSeenRaids?'Shown':'Hidden')+"<br>";
  3022.                         SRDotDX.echo(msg);
  3023.                     }
  3024.                     else if (i = /^\/toggle (visited|seen)( show| hide)?$/i.exec(text)) {
  3025.                         var p1 = i[1].toLowerCase();
  3026.                         if (typeof i[2] == 'string' && i[2] != '') {
  3027.                             var p2 = i[2].toLowerCase()
  3028.                         }
  3029.                         else {
  3030.                             p2 = '';
  3031.                         }
  3032.  
  3033.                         var h = p1.substring(0,1).toUpperCase()+p1.substring(1);
  3034.                         if (p2 == '') {
  3035.                             SRDotDX.echo(h+" raids are currently: "+(SRDotDX.config[(p1 == "visited"?"hideVisitedRaids":"hideSeenRaids")] == true?"Hidden":"Shown"));
  3036.                         }
  3037.                         else {
  3038.                             var eleId = "SRDotDX_" + p1 + "RaidClass";
  3039.                             var state = document.getElementById(eleId).innerText.indexOf("none") > -1?"h":"s";
  3040.                             var setTo = p2==" hide"?"h":"s";
  3041.                             if (state == setTo) {
  3042.                                 SRDotDX.echo(h+" raids are already "+(state=="s"?"Shown":"Hidden"));
  3043.                             }
  3044.                             else {
  3045.                                 var cls = '.SRDotDX_'+p1+'Raid{display: '+(setTo=="s"?"block}":"none !important}");
  3046.                                 SRDotDX.gui.toggleCSS({id: eleId, cls: cls});
  3047.                                 SRDotDX.echo(h+" raids are now set to be "+(setTo=="s"?"Shown":"Hidden"));
  3048.                             }
  3049.  
  3050.                         }
  3051.                     }
  3052.                     else {
  3053.                         SRDotDX.echo('Invalid parameters specified. (<a href="#" onclick="SRDotDX.gui.help(\'toggleraidview\'); return false">help</a>)');
  3054.                     }
  3055.                     return false;
  3056.                 });
  3057.                 holodeck.addChatCommand("ad", function(deck,text) {
  3058.                     SRDotDX.gui.FPXdoWork('http://userscripts.org/scripts/show/140080');
  3059.                     return false;
  3060.                 });
  3061.                 holodeck.addChatCommand("help", function(deck,text) {
  3062.                     window.open("https://docs.google.com/spreadsheet/viewform?formkey=dGM4Vy1jbUZXOUpzM3ZjNUY0V21fLWc6MQ");
  3063.                     SRDotDX.echo("Help window opened.");
  3064.                     return false;
  3065.                 });
  3066.                 holodeck.addChatCommand("clear",function(deck,text){
  3067.                     holodeck.activeDialogue().clear();
  3068.                     return false
  3069.                 });
  3070.                 holodeck.addChatCommand("wikil", function(deck,text) {
  3071.                     SRDotDX.gui.FPXdoWork('http://dotd.wikia.com/wiki/Dawn_of_the_Dragons_Wiki');
  3072.                     return false;
  3073.                 });
  3074.                 holodeck.addChatCommand("wiki", function(deck,text) {
  3075.                     var p;
  3076.                     window.open("http://dotd.wikia.com/wiki/index.php?search="+p+"&fulltext=Search");
  3077.                     SRDotDX.echo("Wiki search opened.");
  3078.                     return false;
  3079.                 });
  3080.                 holodeck.addChatCommand("raid", function(deck,text){
  3081.                     var p;
  3082.                     if (p = /^\/raid (.*?)(?: ([1-6]))?$/i.exec(text)) {
  3083.                         var msg = "";
  3084.                         var start = (!isNaN(p[2]))?p[2]-1:0;
  3085.                         var fnd = p[1].toLowerCase();
  3086.                         for (var i in SRDotDX.raids) {
  3087.                             if (SRDotDX.raids.hasOwnProperty(i)) {
  3088.                                 var raid = SRDotDX.raids[i];
  3089.                                 if (raid.name.toLowerCase().indexOf(fnd) > -1) {
  3090.                                     if (msg != "") msg += "<br>"
  3091.                                     msg += "<b>"+raid.name+"</b><br>";
  3092.                                     msg += "Size: "+raid.size+"<br>";
  3093.                                     msg += "Stats: "+SRDotDX.getStatText(raid.stat)+"<br>";
  3094.                                     msg += "Duration: "+raid.duration + "hrs<br>";
  3095.                                     if (raid.health[0] == 'Unlimited') {
  3096.                                         msg += "---<br>Health: Unlimited<br>FairShare: 1B<br>Optimal Share: 1B<br>";
  3097.                                     }
  3098.                                     else {
  3099.                                         var end = (isNaN(p[2])?(raid.id == 'echthros'?6:4):p[2]);
  3100.                                        
  3101.                                         for (var n = start;n<end;n++) {
  3102.                                             var h = raid.health[n];
  3103.                                             msg += "---<br>";
  3104.                                             msg += "Difficulty: "+["Normal","Hard","Legendary","Nightmare","Insane","Hell"][n]+"<br>";
  3105.                                             msg += "Health: "+SRDotDX.getShortNum(h)+"<br>";
  3106.                                             if (typeof raid.loottiers == 'object') {
  3107.                                                 msg += "Loot Tiers: " + SRDotDX.getLootTierText(raid.id,n) + "<br>";
  3108.                                             } else {
  3109.                                                 var fs = h / raid.size;
  3110.                                                 var os = fs*{"1": 1, "10": 1.25, "13": 1.25, "15": 1.25, "50":1, "100": .9, "250": .75, "500": .67}[raid.size + ""];
  3111.                                                 msg += "Fair Share: "+SRDotDX.getShortNum(fs)+"<br>";
  3112.                                                 msg += "Optimal Share: "+SRDotDX.getShortNum(os)+"<br>";
  3113.                                             }
  3114.                                         }
  3115.                                     }
  3116.                                 }
  3117.                             }
  3118.                         }
  3119.                         if (msg != "") {
  3120.                             SRDotDX.echo(msg);
  3121.                         }
  3122.                         else {
  3123.                             SRDotDX.echo('No raids found matching: '+p[1]);
  3124.                         }
  3125.                     }
  3126.                     else {
  3127.                         SRDotDX.echo('<b>/raid</b>: Invalid parameters specified (<a href="#" onclick="SRDotDX.gui.help(\'raid\')">help</a>)');
  3128.                     }
  3129.                     return false;
  3130.                 });
  3131.                
  3132.                 holodeck.addChatCommand("items", function(deck,text){
  3133.                     var p;
  3134.                      if (p = /^\/items (.*?)(?: ([1-4]))?$/i.exec(text)) {
  3135.                         var msg = "";
  3136.                         var start = (!isNaN(p[2]))?p[2]-1:0;
  3137.                         var fnd = p[1].toLowerCase();
  3138.                         for (var i in SRDotDX.itemss) {
  3139.                             if (SRDotDX.itemss.hasOwnProperty(i)) {
  3140.                                 var items = SRDotDX.itemss[i];
  3141.                                 if (items.name.toLowerCase().indexOf(fnd) > -1) {
  3142.                                     if (msg != "") msg += "<br>"
  3143.                                     msg += "<font color='#8B0000'><b>"+items.title+"</b></font><br>";
  3144.                                     msg += "<b>"+items.ipart1+"</b> "+items.ilocat1+"<br>";
  3145.                                     msg += "<b>"+items.ipart2+"</b> "+items.ilocat2+"<br>";
  3146.                                     msg += "<b>"+items.ipart3+"</b> "+items.ilocat3+"<br>";
  3147.                                     msg += "<b>"+items.ipart4+"</b> "+items.ilocat4+"<br>";
  3148.                                     msg += "<b>"+items.ipart5+"</b> "+items.ilocat5+"<br>";
  3149.                                     msg += "<b>"+items.ipart6+"</b> "+items.ilocat6+"<br>";
  3150.                                 }
  3151.                             }
  3152.                         }
  3153.                         if (msg != "") {
  3154.                             SRDotDX.echo(msg);
  3155.                         }
  3156.                         else {
  3157.                             SRDotDX.echo('No items found matching: '+p[1]);
  3158.                         }
  3159.                     }
  3160.                     else {
  3161.                         SRDotDX.echo('<b>/items</b>: Invalid parameters specified');
  3162.                     }
  3163.                     return false;
  3164.                             });
  3165.                
  3166.                 var i;
  3167.                 if (typeof (i = SRDotDX.getRaidDetails(document.location.href)) == 'object'){
  3168.                     if (SRDotDX.config.getRaid(i.id)) {
  3169.                         SRDotDX.config.raidList[i.id].visited = true;
  3170.                         SRDotDX.config.raidList[i.id].seen = true;
  3171.                     }
  3172.                     else {
  3173.                         SRDotDX.config.addRaid(i.hash,i.id,i.boss,i.diff,true,true,false,'')
  3174.                     }
  3175.                 }
  3176.                 window.onbeforeunload = function(){
  3177.                     SRDotDX.config.save(false);
  3178.                 }
  3179.  
  3180.                 SRDotDX.config.save();
  3181.                 SRDotDX.gui.load();
  3182.                 SRDotDX.gui.UpdateSelectedRaidCount();
  3183.                 setTimeout(function(){delete SRDotDX.load},1);
  3184.                 console.log("[SRDotDX] Core loaded; Loading user interface...");
  3185.             }
  3186.  
  3187.             else if (fails < 10) {
  3188.                 console.log("[SRDotDX] Missing needed Kongregate resources, retrying in 5 seconds....");
  3189.                 setTimeout(SRDotDX.load,5000,fails+1)
  3190.             }
  3191.             else {
  3192.                 console.log("[SRDotDX] Unable to locate required Kongregate resources. Loading aborted");
  3193.                 setTimeout(function(){delete SRDotDX;},1);
  3194.             }
  3195.         },
  3196.         loadRaid: function (url) {
  3197.             var r;
  3198.             if (typeof (r=SRDotDX.getRaidDetails(url)) == 'object') {
  3199.                 var reg = new RegExp(/var iframe_options = ([^\x3B]+)/g);
  3200.                 var match = reg.exec(activateGame);
  3201.                 var iframe_options = eval('('+match[1]+')');
  3202.                 iframe_options['kv_action_type'] = 'raidhelp';
  3203.                 iframe_options['kv_difficulty'] = r.diff;
  3204.                 iframe_options['kv_hash'] = r.hash;
  3205.                 iframe_options['kv_raid_boss'] = r.boss;
  3206.                 iframe_options['kv_raid_id'] = r.id;
  3207.                 if(SRDotDX.config.refreshGameToJoin){
  3208.                     $('gameiframe').replace(new Element('iframe', {"id":"gameiframe","name":"gameiframe","style":"border:none;position:relative;z-index:1;","scrolling":"auto","border":0,"frameborder":0,"width":760,"height":700,"class":"dont_hide"}));
  3209.                     $('gameiframe').contentWindow.location.replace("http://web1.dawnofthedragons.com/kong?" + Object.toQueryString(iframe_options));
  3210.                 } else {
  3211.                     if(SRDotDX.config.asyncJoin){
  3212.                         var frameNum =SRDotDX.gui.getCurrentJoinFrame();
  3213.                         console.log("[SRDotDX] Async join frame " + frameNum);
  3214.                         document.getElementById('SRDotDX_JoinFrame_'+frameNum).src="http://web1.dawnofthedragons.com/kong?" + Object.toQueryString(iframe_options) + "&SRDotDX_frame="+frameNum;
  3215.                     } else
  3216.                         document.getElementById('SRDotDX_joiner').src="http://web1.dawnofthedragons.com/kong?" + Object.toQueryString(iframe_options);
  3217.                 }
  3218.                 SRDotDX.config.raidList[r.id].visited = true;
  3219.                 SRDotDX.gui.toggleRaid("visited",r.id,true);
  3220.                 SRDotDX.gui.raidListItemUpdate(r.id);
  3221.             }
  3222.         },
  3223.         nukeRaid: function (id) {
  3224.             if (SRDotDX.config.raidList[id]) {
  3225.                 SRDotDX.config.raidList[id].nuked = true;
  3226.                 SRDotDX.gui.toggleRaid("nuked",id,true);
  3227.             }
  3228.         },
  3229.        
  3230.         searchKeywords: {
  3231.             z1: { reg: /^(z1)|(kobold\sbelts?)|(hilted\sspears?)$/i, sub: 'horgrak|mazalu|grune' },
  3232.             z2: { reg: /^(z2)|(bandit\sinsignias?)$/i, sub: 'ataxes|alice|lurking' },
  3233.             z3: { reg: /^(z3)|(dragon\sscales?)$/i, sub: 'briareus|scylla|gravlok|erebus' },
  3234.             z4: { reg: /^(z4)|(scabbards?)|(wizard'?s\s?hats?)$/i, sub: 'bloodmane|kerberos|hydra|cai|tyranthius' },
  3235.             z5: { reg: /^(z5)|(skulls?)|(souls?)|(notes?\sfrom\sthe\sfront)$/i, sub: 'ironclad|zombie|stein|bogstench|nalagarst' },
  3236.             z6: { reg: /^(z6)|(war horns?)|(^lutes?)|(rune\s?stones?)$/i, sub: 'gunnar|nidhogg|kang|ulfrik|kalaxia' },
  3237.             z7: { reg: /^(z7)|(oroc crystals?)|(glyphs?)$/i, sub: 'maraak|erakka|wexxa|guilbert|bellarius' },
  3238.             z8: { reg: /^(z8)|(dream\s?catchers?)|(dream\s?threads?)$/i, sub: 'hargamesh|grimsly|rift|sisters|mardachus' },
  3239.             z9: { reg: /^(z9)|(dragon'?s\st[eo][eo]th)$/i, sub: 'mesyra|nimrod|phaedra|tenebra|valanazes' },
  3240.             z10: { reg: /^(z10)|(pumpkin\s?)$/i, sub: 'jack|jacksrevenge' },
  3241.             'z9.5': { reg: /^(z9\.5)|(pumpkin)$/i, sub: 'jack|revenge' },
  3242.             z10: { reg: /^(z10)|(scrolls|emblems)$/i, sub: 'caracalla|centurion|gargoyle|leonine' },
  3243.             farm: { reg: /^farm$/i, sub: 'maraak|erakka|wexxa|guilbert|bellarius|erebus|grune|mazalu' },
  3244.             gloves: { reg: /^gloves?$/i, sub: 'ataxes|alice|lurking|slaughterers|lunatics|felendis|agony|obyron|hammer|dirthax|dreadbloom' },
  3245.             flute: { reg: /^flutes?$/i, sub: 'horgrak|mazalu|grune|ataxes|alice|lurking|butcher|scylla|gravlok|erebus|celeano|arachna|azab|groblar|deathglare|ragetalon|gladiator|tetrarchos|scuttlegore|tithrasia|moon|varlachleth|euphronios' },
  3246.             trim: { reg: /^((brown|grey|gray|green|blue|purple|orange)\s+)?trim(\s+(helm|shield|boots|chest|ring|hammer))?$/i, sub: 'butcher|scylla|gravlok' },
  3247.             dragonsbane: { reg: /^(sword\s(hilt|guard|blade|tip|emblem))|(dragon eye pearls)|(dragonsbane)$/i, sub: 'erebus' },
  3248.         },
  3249.  
  3250.  
  3251.         raids: {
  3252.             agony:{name: 'Agony', shortname: 'Agony',  id: 'agony', stat: 'H', size:100, duration:168, health: [700000000,875000000,1120000000,1400000000,,]},
  3253.             djinn:{name: 'Al-Azab', shortname: 'Al-Azab',  id: 'djinn', stat: 'H', size:100, duration:168, health: [55000000,68750000,88000000,110000000,,]},
  3254.             animated_armor:{name: 'Animated Armor', shortname: 'Armor', id: 'animated_armor', stat: 'S', size:1, duration:12, health: [8000000,,,,,]},
  3255.             spider:{name: 'Arachna', shortname: 'Arachna',  id: 'spider', stat: 'H', size:50, duration:144, health: [22000000,27500000,35200000,44000000,,]},
  3256.             rhino:{name: 'Ataxes', shortname: 'Ataxes',  id: 'rhino', stat: 'S', size:10, duration:120, health: [2000000,2500000,3200000,4000000,,]},
  3257.             gladiators:{name: 'Batiatus Gladiators ', shortname: 'Gladiators ',  id: 'gladiators', stat: 'H', size:10, duration:120, health: [12000000,15000000,19200000,24000000,,]},
  3258.             bellarius:{name: 'Bellarius the Guardian', shortname: 'Bella',  id: 'bellarius', stat: 'S', size:500, duration:96, health: [900000000,1125000000,1440000000,1800000000,,]},
  3259.             werewolfpack:{name: 'Black Moon', shortname: 'Black Moon',  id: 'werewolfpack', stat: 'H', size:50, duration:144, health: [135000000,168750000,216000000,270000000,,]},
  3260.             alice:{name: 'Bloody Alice', shortname: 'Alice',  id: 'alice', stat: 'S', size:50, duration:120, health: [15000000,18750000,24000000,30000000,,]},
  3261.             bogstench:{name: 'Bogstench', shortname: 'Bogstench',  id: 'bogstench', stat: 'S', size:250, duration:96, health: [450000000,562500000,720000000,900000000,,]},
  3262.             '4ogre':{name: 'Briareus the Butcher', shortname: 'Briareus',  id: '4ogre', stat: 'S', size:10, duration:72, health: [4500000,5625000,7200000,9000000,,]},
  3263.             bmane:{name: 'Bloodmane', shortname: 'Bmane',  id: 'bmane', stat: 'S', size:10, duration:72, health: [7000000,8750000,11200000,14000000,,]},
  3264.             caracalla:{name: 'Caracalla', shortname: 'Caracalla',  id: 'caracalla', stat: 'S', size:500, duration:128, health: [,,,200000000000,,]},
  3265.             harpy:{name: 'Celeano', shortname: 'Cel',  id: 'harpy', stat: 'H', size:10, duration:120, health: [3000000,3750000,4800000,6000000,,]},
  3266.             centurion_marius:{name: 'Centurion Marius', shortname: 'Marius',  id: 'centurion_marius', stat: 'S', size:250, duration:96, health: [,,,40000000000,,]},
  3267.             kobold:{name: 'Chieftain Horgrak', shortname: 'Horgrak',  id: 'kobold', stat: 'S', size:10, duration:168, health: [150000,187500,240000,300000,,]},
  3268.             corrupterebus:{name: 'Corrupted Erebus', shortname: 'Corrupted', id: 'corrupterebus', stat: 'ESH', size:90000, duration:72, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited'], loottiers: [['1M','5M','10M','20M','50M','100M','150M','300M','450M','600M','750M','1B','2B','5B','20B'],[],[],[],[],[]]},
  3269.             "serpina.jpg":{name: 'Countess Serpina', shortname: 'Countess',  id: 'serpina.jpg', stat: 'E', size:15, duration:5, health: [75000000,112500000,150000000,187500000,,]},
  3270.             serpina:{name: 'Countess Serpina', shortname: 'Countess',  id: 'serpina.jpg', stat: 'E', size:15, duration:5, health: [75000000,112500000,150000000,187500000,,]},
  3271.             dahrizons_general:{name: "Dahrizon's General", shortname: 'General', id: 'dahrizons_general', stat: 'S', size:1, duration:12, health: [1000000,,,,,]},
  3272.             basilisk:{name: 'Deathglare', shortname: 'Deathglare',  id: 'basilisk', stat: 'H', size:50, duration:144, health: [45000000,56250000,72000000,90000000,,]},
  3273.             dirthax:{name: 'Dirthax', shortname: 'Dirthax',  id: 'dirthax', stat: 'H', size:100, duration:168, health: [550000000,687500000,880000000,1100000000,,]},
  3274.             dragons_lair:{name: 'Dragons Lair', shortname: 'Lair',  id: 'dragons_lair', stat: 'S', size:13, duration:5, health: [100000000,500000000,1000000000,1500000000,,], loottiers: [['8M','9M','10M','16M','20M','26M','30M','36M','40M','46M'],['40M','45M','50M','80M','100M','130M','150M','180M','200M','230M'],['80M','90M','100M','160M','200M','260M','300M','360M','400M','460M'],['120M','135M','150M','240M','300M','390M','450M','540M','600M','690M'],,]},
  3275.             erakka_sak:{name: 'Erakka-Sak', shortname: 'Erakka',  id: 'erakka_sak', stat: 'S', size:50, duration:60, health: [62000000,77500000,99200000,124000000,,]},
  3276.             giantgolem:{name: 'Euphronios', shortname: 'Euphronios',  id: 'giantgolem', stat: 'H', size:100, duration:168, health: [450000000,562500000,720000000,900000000,,]},
  3277.             echthros:{name: 'Echthros', shortname: 'Echthros',  id: 'echthros', stat: 'ESH', size:90000, duration:96, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited'], loottiers: [[],[],[],['150M','200M','250M','300M','400M','500M','600M','700M','800M','900M','1B','2B','3B','4B','5B'],[],[]]},
  3278.             drag:{name: 'Erebus the Black', shortname: 'Erebus',  id: 'drag', stat: 'S', size:250, duration:168, health: [150000000,187500000,240000000,300000000,,]},
  3279.             felendis:{name: 'Felendis and Shaoquin', shortname: 'Felendis',  id: 'felendis', stat: 'H', size:100, duration:168, health: [441823718,549238221,707842125,888007007,,]},
  3280.             ogre:{name: 'General Grune', shortname: 'Grune',  id: 'ogre', stat: 'S', size:100, duration:172, health: [20000000,25000000,32000000,40000000,,]},
  3281.             dreadbloom:{name: 'Giant Dreadbloom', shortname: 'Dreadbloom',  id: 'dreadbloom', stat: 'H', size:100, duration:192, health: [900000000,1125000000,1440000000,1800000000,,]},
  3282.             batman:{name: 'Gravlok the Night-Hunter', shortname: 'Grav',  id: 'batman', stat: 'S', size:100, duration:72, health: [50000000,62500000,80000000,100000000,,]},
  3283.             evilgnome:{name: 'Groblar Deathcap', shortname: 'Groblar',  id: 'evilgnome', stat: 'H', size:10, duration:120, health: [6000000,7500000,9600000,12000000,,]},
  3284.             guardian_golem:{name: 'Guardian Golem', shortname: 'Guardian', id: 'guardian_golem', stat: 'S', size:1, duration: 12, health: [3000000,3000000,3000000,3000000,,]},
  3285.             guilbert:{name: 'Guilbert the Mad', shortname: 'Guil',  id: 'guilbert', stat: 'S', size:250, duration:96, health: [550000000,687500000,880000000,1100000000,,]},
  3286.             gunnar:{name: 'Gunnar the Berserk', shortname: 'Gunnar',  id: 'gunnar', stat: 'S', size:10, duration:48, health: [12000000,15000000,19200000,24000000,,]},
  3287.             war_boar:{name: 'Hammer', shortname: 'Hammer',  id: 'war_boar', stat: 'H', size:50, duration:144, health: [220000000,275000000,352000000,440000000,,]},
  3288.             hargamesh:{name: 'Hargamesh', shortname: 'Hargamesh',  id: 'hargamesh', stat: 'S', size:10, duration:48, health: [18000000,22500000,28800000,36000000,,]},
  3289.             grimsly:{name: 'Headmaster Grimsly', shortname: 'Grimsly',  id: 'grimsly', stat: 'S', size:50, duration:60, health: [72000000,90000000,115200000,144000000,,]},
  3290.             hydra:{name: 'Hydra', shortname: 'Hydra',  id: 'hydra', stat: 'S', size:100, duration:72, health: [65000000,81250000,104000000,130000000,,]},
  3291.             ironclad:{name: 'Ironclad', shortname: 'Ironclad',  id: 'ironclad', stat: 'S', size:10, duration:48, health: [10000000,12500000,16000000,20000000,,]},
  3292.             pumpkin:{name: 'Jack', shortname: 'Jack', id: 'pumpkin', stat: 'S', size: 250, duration:48 , health: [1000000000,1500000000,2000000000,3000000000], loottiers: [[],[],[],['12M','24M','36M','48M','60M','72M','145M','216M','288M','360M','432M','504M','576M'],[],[]]},
  3293.             jacksrevenge1:{name: "Jack's Revenge", shortname: 'Revenge', id: 'jacksrevenge1', stat: 'S', size: 250, duration:48 , health: [,,,15000000000], loottiers: [[],[],[],['60M','120M','180M','240M','300M','360M','720M','1.5B','3B'],[],[]]},
  3294.             kang:{name: 'Kang-Gsod', shortname: 'Kang',  id: 'kang', stat: 'S', size:100, duration:72, health: [95000000,118750000,152000000,190000000,,]},
  3295.             '3dawg':{name: 'Kerberos', shortname: 'Kerb',  id: '3dawg', stat: 'S', size:50, duration:72, health: [35000000,43750000,56000000,70000000,,]},
  3296.             kessovtowers:{name: 'Kessov Towers', shortname: 'Towers',  id: 'kessovtowers', stat: 'ESH', size:90000, duration:120, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited']},
  3297.             kessovtower:{name: 'Treachery and the Tower', shortname: 'Treachery',  id: 'kessovtower', stat: 'ESH', size:90000, duration:24, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited'], loottiers: [['1M','5M','10M','20M','50M','100M','150M','300M','450M','600M','750M','1B','1.25B','1.5B','1.75B','2B'],[],[],[],[],[]]},
  3298.             kessovforts:{name: 'Kessov Forts', shortname: 'Forts',  id: 'kessovforts', stat: 'ESH', size:90000, duration:120, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited']},
  3299.             kessovcastle:{name: 'Kessov Castle', shortname: 'Castle',  id: 'kessovcastle', stat: 'ESH', size:90000, duration:144, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited'],loottiers: [['1','1M','5M','10M','20M','50M','100M','150M','300M','450M','600M','750M','1B','2B','5B','50B'],[],[],[],[],[]]},
  3300.             kalaxia:{name: 'Kalaxia The Far-Seer', shortname: 'Kalaxia',  id: 'kalaxia', stat: 'S', size:500, duration:96, health: [800000000,1000000000,1280000000,1600000000,,]},
  3301.             krugnug:{name: 'Krugnug', shortname: 'Krugnug',  id: 'krugnug', stat: 'S', size:25, duration:48, health: [,,,4000000000,,]},
  3302.             krykagrius:{name: 'Krykagrius', shortname: 'Krykagrius', id: 'krykagrius', stat: 'ESH', size:90000, duration:72, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited'], loottiers: [['1M','5M','10M','20M','50M','100M','150M','300M','450M','600M','750M','1B','2B','3B','4B','5B','10B','15B','20B'],[],[],[],[],[]]},
  3303.             leonine_watcher:{name: 'Leonine', shortname: 'Leonine',  id: 'leonine_watcher', stat: 'S', size:100, duration:48, health: [,,,16000000000,,]},
  3304.             tyranthius:{name: 'Lord Tyranthius', shortname: 'Tyr',  id: 'tyranthius', stat: 'S', size:500, duration:168, health: [600000000,750000000,960000000,1200000000,,]},
  3305.             lunacy:{name: 'Lunatics', shortname: 'Lunatics',  id: 'lunacy', stat: 'H', size:50, duration:144, health: [180000000,225000000,288000000,360000000,,]},
  3306.             lurker:{name: 'Lurking Horror', shortname: 'Lurking',  id: 'lurker', stat: 'S', size:100, duration:120, health: [35000000,43750000,56000000,70000000,,]},
  3307.             magma_horror:{name: 'Magma Horror', shortname: 'Magma',  id: 'magma_horror', stat: 'S', size:1, duration:24, health: [200000,250000,320000,400000,,]},
  3308.             maraak:{name: 'Maraak the Impaler', shortname: 'Maraak',  id: 'maraak', stat: 'S', size:10, duration:48, health: [15000000,18750000,24000000,30000000,,]},
  3309.             mardachus:{name: 'Mardachus the Destroyer', shortname: 'Mardachus',  id: 'mardachus', stat: 'S', size:500, duration:96, health: [1100000000,1375000000,1760000000,2200000000,,]},
  3310.             scorp:{name: 'Mazalu', shortname: 'Mazalu',  id: 'scorp', stat: 'S', size:50, duration:168, health: [5000000,6250000,8000000,10000000,,]},
  3311.             mestr:{name: 'Mestr Rekkr', shortname: 'Mestr',  id: 'mestr', stat: 'S', size:1, duration:48, health: [150000,187500,240000,300000,,]},
  3312.             mesyra:{name: 'Mesyra the Watcher', shortname: 'Mesyra',  id: 'mesyra', stat: 'S', size:250, duration:96, health: [1000000000,1250000000,1600000000,2000000000,,]},
  3313.             misako:{name: 'Misako', shortname: 'Misako',  id: 'misako', stat: 'S', size:1, duration:48, health: [100000,125000,160000,200000,,]},
  3314.             nalagarst:{name: 'Nalagarst', shortname: 'Nalagarst',  id: 'nalagarst', stat: 'S', size:500, duration:98, health: [700000000,875000000,1120000000,1400000000,,]},
  3315.             nidhogg:{name: 'Nidhogg', shortname: 'Nidhogg',  id: 'nidhogg', stat: 'S', size:50, duration:60, health: [52000000,65000000,83200000,104000000,,]},
  3316.             nimrod:{name: 'Nimrod the Hunter', shortname: 'Nimrod',  id: 'nimrod', stat: 'S', size:250, duration:96, health: [1200000000,1500000000,1920000000,2400000000,,]},
  3317.             phaedra:{name: 'Phaedra the Deceiver', shortname: 'Phaedra',  id: 'phaedra', stat: 'S', size:250, duration:96, health: [1400000000,1750000000,2240000000,2800000000,,]},
  3318.             fairy_prince:{name: 'Prince Obyron', shortname: 'Obyron',  id: 'fairy_prince', stat: 'H', size:10, duration:120, health: [30000000,37500000,48000000,60000000,,]},
  3319.             roc:{name: 'Ragetalon', shortname: 'Ragetalon',  id: 'roc', stat: 'H', size:100, duration:168, health: [110000000,137500000,176000000,220000000,,]},
  3320.             rhalmarius_the_despoiler:{name: 'Rhalmarius the Despoiler', shortname: 'Rhal',  id: 'rhalmarius_the_despoiler', stat: 'H', size:100, duration:84, health: [500000000,1250000000,3125000000,7812500000,,]},
  3321.             tomb_gargoyle:{name: 'Riddler Gargoyle', shortname: 'Riddler',  id: 'tomb_gargoyle', stat: 'S', size:50, duration:48, health: [,,,8000000000,,]},
  3322.             rift:{name: 'Rift the Mauler', shortname: 'Rift',  id: 'rift', stat: 'S', size:100, duration:72, health: [125000000,156250000,200000000,250000000,,]},
  3323.             crabshark:{name: 'Scuttlegore', shortname: 'Scuttle',  id: 'crabshark', stat: 'H', size:100, duration:168, health: [220000000,275000000,352000000,440000000,,]},
  3324.             squid:{name: 'Scylla', shortname: 'Scylla',  id: 'squid', stat: 'S', size:50, duration:72, health: [25000000,31250000,40000000,50000000,,]},
  3325.             simulacrum_dahrizon:{name: 'Simulacrum of Dahrizon', shortname: 'Dahrizon', id: 'simulacrum_dahrizon', stat: 'S', size:1, duration:12, health: [12000000,,,,,]},
  3326.             sircai:{name: 'Sir Cai', shortname: 'SirCai',  id: 'sircai', stat: 'S', size:250, duration:168, health: [350000000,437500000,560000000,700000000,,]},
  3327.             sisters:{name: 'Sisters of the Song', shortname: 'Sisters',  id: 'sisters', stat: 'S', size:250, duration:96, health: [600000000,750000000,960000000,1200000000,,]},
  3328.             slaughterers:{name: 'Slaughterers Six', shortname: 'Slaughterers',  id: 'slaughterers', stat: 'H', size:10, duration:120, health: [24000000,30000000,38400000,48000000,,]},
  3329.             stein:{name: 'Stein', shortname: 'Stein',  id: 'stein', stat: 'S', size:100, duration:72, health: [80000000,100000000,128000000,160000000,,]},
  3330.             tainted:{name: 'Tainted Erebus', shortname: 'Tainted',  id: 'tainted', stat: 'S', size:250, duration:168, health: [250000000,312500000,400000000,500000000,,]},
  3331.             tenebra:{name: 'Tenebra Shadow Mistress', shortname: 'Tenebra',  id: 'tenebra', stat: 'S', size:500, duration:128, health: [2000000000,2500000000,3200000000,4000000000,,]},
  3332.             tisiphone:{name: 'Tisiphone The Vengeful', shortname: 'Tisiphone',  id: 'tisiphone', stat: 'E', size:50, duration:48, health: [500000000,2500000000,5000000000,7500000000,,]},
  3333.             chimera:{name: 'Tetrarchos', shortname: 'Tetrarchos',  id: 'chimera', stat: 'H', size:50, duration:144, health: [90000000,112500000,144000000,180000000,,]},
  3334.             gorgon:{name: 'Tithrasia', shortname: 'Tithrasia',  id: 'gorgon', stat: 'H', size:10, duration:120, health: [18000000,22500000,28800000,36000000,,]},
  3335.             ulfrik:{name: 'Ulfrik', shortname: 'Ulfrik',  id: 'ulfrik', stat: 'S', size:250, duration:96, health: [500000000,625000000,800000000,1000000000,,]},
  3336.             valanazes:{name: 'Valanazes the Gold', shortname: 'Valanazes',  id: 'valanazes', stat: 'S', size:500, duration:128, health: [2400000000,3000000000,3840000000,4800000000,,]},
  3337.             blobmonster:{name: 'Varlachleth', shortname: 'Varla',  id: 'blobmonster', stat: 'H', size:100, duration:168, health: [330000000,412500000,528000000,660000000,,]},
  3338.             wexxa:{name: 'Wexxa the Worm-Tamer', shortname: 'Wexxa',  id: 'wexxa', stat: 'S', size:100, duration:72, health: [110000000,137500000,176000000,220000000,,]},
  3339.             winter_kessov:{name: 'Blood Will Run Cold', shortname: 'Cold Blood', id:'winter_kessov', stat: 'ESH', size:90000, duration:290, health: ['Unlimited','Unlimited','Unlimited','Unlimited','Unlimited','Unlimited'], loottiers: [['51 tiers.  Big ones at 5M','10M','75M','500M','1B','4.5B','25B','250B'],[],[],[],[],[]]},
  3340.             xessus:{name: 'Xessus of the Grim Wood', shortname: 'Xessus', id: 'xessus', stat: 'H', size:100, duration:48, health: [500000000,625000000,800000000,1000000000,,]},
  3341.             malchar:{name: 'Malchar the Tri-Eyed', shortname: 'Malchar', id: 'malchar', stat: 'H', size:100, duration:48, health: [500000000,625000000,800000000,1000000000,,]},
  3342.             krasgore:{name: 'Krasgore', shortname: 'Krasgore', id: 'krasgore', stat: 'H', size:100, duration:48, health: [500000000,625000000,800000000,1000000000,,]},
  3343.             nrlux:{name: 'N\'rlux the Devourer', shortname: 'N\'rlux', id: 'nrlux', stat: 'H', size:100, duration:48, health: [10000000000,12500000000,16000000000,20000000000,,]},
  3344.             zombiehorde:{name: 'Zombie Horde', shortname: 'Zombies',  id: 'zombiehorde', stat: 'S', size:50, duration:60, health: [45000000,56250000,72000000,90000000,,]}
  3345.         },
  3346.        
  3347.         itemss: {
  3348.             sock1:{name: 'sock1 sword of the conquered kingdoms', title: 'Sword of Conquered Kingdoms',id:'sock1 sword of the conquered kingdoms',ipart1:'Blade of Eldarun', ilocat1:' - Erebus the Black and Tainted Erebus(Raids)', ipart2:'Blade of Anothia', ilocat2:' - Gravlok the Night-Hunter (Raid)',ipart3:'Carnus Crest', ilocat3:' - Lurking Horror (Raid)',ipart4:'Carnus Hilt', ilocat4:' - General Grune (Raid)',ipart5:'Part 5', ilocat5:"NA",ipart6:'Part 6', ilocat6:'NA'},
  3349.             sock2:{name: 'sock2', title: 'Sword of Conquerd Kingdoms 2',id:'sock2',ipart1:'Power of the Demonstones', ilocat1:' - craftable', ipart2:'Sword of the Conquered Kingdoms', ilocat2:' - craftable',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3350.             sock3:{name: 'sock3', title: 'Sword of the Conquered Kingdoms 3',id:'sock3',ipart1:'Enigmatic Item 1', ilocat1:' - Equip the Following -Mount:Avenger - MH:Headmasters Cane - OH:Form Masters Cane - Pants:Minstrels Breeches - General:Angus the Red - Raid:Tenebra(any diff)', ipart2:'Enigmatic Item 2', ilocat2:' - Equip the Following - MH:The Green Sword - OH:Doomed Bandits Dagger - Helm:Screaming Skull Mask - Chest:Thersites Jerkin - Gloves:Tyrants Grasp - Pants:Passive Pants - Boots:Grim Guardsman Boots - Ring:Warning Ring - Mount:Timon the Yellow - Legion:Bucket Brigade or Bucket Brigade II - General:Booma - Troop:6x Prefect - Magic:Vampiric Aura - Raid:Dirthax (Guild Raid any diff)',ipart3:'Enigmatic Item 3', ilocat3:'Equip the following - MH:Crusher - Chest:Finery of the Dark Court - Mount:Tiger - Legion:March II - Troop:3x World Mender - Troop:Teucer Tullian or Teucer Tullian2 - Raid:Hammer (Guild Raid any diff)',ipart4:'Enigmatic Item 4', ilocat4:'Equip the follwing - MH:Hydra-Headed Flail - Helm:Executioners Hood - Chest:Sparkles of the Newblood - Gloves:Grim Guardsman Gauntlets - Pants:Trousers of Penitence - Boots:Deponent Boots - Raid:Slaughterers Six (Guild Raid any diff)',ipart5:'Enigmatic Item 5', ilocat5:"Equip the Following - Helm:Mask of the Red Death - MH:Keldor - Raid:Valanazes the Gold (raid any diff)",ipart6:'Sword of Conquerd Kingdoms 2', ilocat6:' - craftable'},
  3351.             mina1:{name: 'mina1', title: 'Mina von Richten',id:'mina1',ipart1:'Grunes Blood', ilocat1:' - General Grune (nightmare raid)', ipart2:'Lurking Horrors Blood', ilocat2:' - Lurking Horror (nightmre raid)',ipart3:'Gravloks Blood', ilocat3:' - Gravlok (nightmare raid)',ipart4:'Erebus Blood', ilocat4:' - Erebus (nightmare raid)',ipart5:'Tainted Erebus Blood', ilocat5:" - Tainted Erebus (nightmare raid)",ipart6:'Part 6', ilocat6:' - NA'},
  3352.             mina2:{name: 'mina2', title: 'Mina von Richten 2',id:'mina2',ipart1:'Mina von Richten', ilocat1:' - craftable', ipart2:'Purple Bottle of Blood', ilocat2:' - Mesyra (quest boss)',ipart3:'Cyan Bottle of Blood', ilocat3:' - Nimrod (quest boss)',ipart4:'Chrome Bottle of Blood', ilocat4:' - Phaedra (quest boss)',ipart5:'Black Bottle of Blood', ilocat5:" - Tenebra (quest boss)",ipart6:'Gold Bottle of Blood', ilocat6:' - Valanazes (quest boss)'},
  3353.             demon:{name: 'power of the demon stones', title: 'Power of the Demons Stones',id:'power of the demon stones',ipart1:'Stone of Farzak', ilocat1:' - Kalaxia (nightmare raid)', ipart2:'Stone of Xarabesh', ilocat2:' - Lord Tyranthius (nightmare raid)',ipart3:'Stone of Lyrpan', ilocat3:' - Bogstench (nightmare raid)',ipart4:'Stone of Drach', ilocat4:' - Vornstaag(z5), Cemetary Area(quest any diff)',ipart5:'Stone of Arach', ilocat5:" - Ryndor(z4), The Tomb, and the Plains(quest any diff)",ipart6:'Stone of Zuxala', ilocat6:' - Bludheim(z6), Terracles Meander(quest any diff)'},
  3354.             signet:{name: 'kyddins signet ring', title: 'Kyddins Signet',id:'kyddins signet ring',ipart1:'Kyddins 1st Map', ilocat1:' - Bloodmane (nightmare raid)', ipart2:'Kyddins 2nd Map', ilocat2:' - Kerberos (nightmare raid)',ipart3:'Kyddins 3rd Map', ilocat3:' - Hydra (nightmare raid)',ipart4:'Kyddins 4th Map', ilocat4:' - Sir Cai (nightmare raid)',ipart5:'Kyddins 5th Map', ilocat5:" - Lord Tyranthius (nightmare raid)",ipart6:'Part 6', ilocat6:' - NA'},
  3355.             shield1:{name: 'shield1 of ryndor1 sheild1', title: 'Shield of Ryndor',id:'shield1 of ryndor1 sheild1',ipart1:'Circle of Bloodmane', ilocat1:' - Bloodmane (quest any diff)', ipart2:'Circle of Kerberos', ilocat2:' - Kerberos (quest any diff)',ipart3:'Circle of the Hydra', ilocat3:' - Hydra (quest any diff)',ipart4:'Circle of Sir Cai', ilocat4:' - Sir Cai (quest any diff)',ipart5:'Circle of Tyranthius', ilocat5:" - Tyranthius (quest any diff)",ipart6:'Part 6', ilocat6:' - NA'},
  3356.             shield2:{name: 'shield2 of ryndor2 sheild2', title: 'Shield of Ryndor 2',id:'shield2 of ryndor2 sheild2',ipart1:'Tricksters 1st Gift', ilocat1:' - craftable', ipart2:'Tricksters 2nd Gift', ilocat2:' - craftable',ipart3:'Shield of Ryndor', ilocat3:' - craftable',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3357.             trickster1:{name: 'tricksters1 trickster1 first 1st gift1', title: 'Tricksters 1st Gift',id:'tricksters1 trickster1 first 1st gift1',ipart1:'Broughs Trinket 1', ilocat1:' Equip the Following - Legion:March III - General:Medea or Medea2 - General:Olaf the Metal-Faced Bard - Troop:Piper(x9) - Raid:Deathglare (guild raid any diff)', ipart2:'Broughs Trinket 2', ilocat2:'Equip the Following - Gloves :Iron Hands of Entellus - Legion:Krypteia - General:Braugord the Einherji - General:Genevieve Everdeen - General:Kyrose - Raid:Guilbert (raid any diff)',ipart3:'Broughs Trinket 3', ilocat3:'Equip the Following - MH:Black Coral Blade - Ring:Misakos Ring - Raid:Varlachleth (guild raid any diff)',ipart4:'Broughs Trinket 4', ilocat4:'Equip the Following - Helm:Helm of Diomede - Chest:Diomedes Cuirass - Gloves:Gauntlets of Diomede - Pants:Diomedes Legplates - Boots:Diomedes Sabatons - General:Ruth the Miser - Raid:Bellarius (raid any diff)',ipart5:'Broughs Trinket 5', ilocat5:'Equip the Following - Helm:Mayor Tullians Helm - Mount:Solus or Solus2 or Solus3 - Troop:Teucer Tullian or Teucer Tullian2 - Raid:Ragetalon (guild raid any diff)',ipart6:'Part 6', ilocat6:' - NA'},
  3358.             trickster2:{name: 'tricksters2 trickster2 2nd second gift2', title: 'Tricksters 2nd Gift',id:'tricksters2 trickster2 2nd second gift2',ipart1:'Broughs Trinket 6', ilocat1:' - NA', ipart2:'Broughs Trinket 7', ilocat2:' - NA',ipart3:'Broughs Trinket 8', ilocat3:' - NA',ipart4:'Broughs Trinket 9', ilocat4:' - NA',ipart5:'Broughs Trinket 10', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3359.             misakoess:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3360.             sunotle:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3361.             messrekess:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3362.             haubogold:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3363.             sargthecon:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3364.             trophhonor:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3365.             proofcourage:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3366.             blank:{name: 'blank', title: 'blank',id:'blank',ipart1:'Part 1', ilocat1:' - NA', ipart2:'Part 2', ilocat2:' - NA',ipart3:'Part 3', ilocat3:' - NA',ipart4:'Part 4', ilocat4:' - NA',ipart5:'Part 5', ilocat5:" - NA",ipart6:'Part 6', ilocat6:' - NA'},
  3367.            
  3368.         },
  3369.        
  3370.         raidSizes: {
  3371.             10: { name: 'Small', visible: 'Yes', pruneTimers: [3600000,10800000,32400000]}, // 1h, 2h, 3h
  3372.             13: { name: 'Small', visible: 'No', pruneTimers: [3600000,10800000,32400000]},  // 1h, 2h, 3h
  3373.             15: { name: 'Small', visible: 'No', prumeTimers: [18000000,18000000,18000000]}, // Serpina only, so 5h/5h/5h
  3374.             25: { name: 'small', visible: 'No', pruneTimers: [18000000,18000000,18000000]}, // Leonine only, 5h/5h/5h
  3375.             50: { name: 'Medium', visible: 'Yes', pruneTimers: [3600000,10800000,32400000]}, // 1h, 2h, 3h
  3376.             100:{ name: 'Large', visible: 'Yes', pruneTimers: [14400000,43200000,129600000]}, // 4h, 12h, 36h
  3377.             250:{ name: 'Epic', visible: 'Yes', pruneTimers: [86400000,172800000,259200000]}, // 24h, 48h, 72h
  3378.             500:{ name: 'Colossal', visible: 'Yes', pruneTimers: [86400000,172800000,259200000]} // 24h, 48h, 72h
  3379.         },
  3380.         raidArray: [ "agony","djinn","animated_armor","spider","rhino","gladiators","bellarius","werewolfpack",
  3381.             "alice","bogstench","4ogre","bmane","harpy","kobold","corrupterebus","serpina","serpina.jpg","dahrizons_general",
  3382.             "basilisk","dirthax","dragons_lair","erakka_sak","giantgolem","echthros","drag","felendis","ogre",
  3383.             "dreadbloom","batman","evilgnome","guardian_golem","guilbert","gunnar","war_boar","hargamesh","grimsly",
  3384.             "hydra","ironclad","pumpkin","jacksrevenge1","kang","3dawg","kessovtower","kessovtowers","kessovforts","kessovcastle",
  3385.             "kalaxia","tyranthius","lunacy","lurker","magma_horror","maraak","mardachus","scorp","mestr","mesyra","misako",
  3386.             "nalagarst","nidhogg","nimrod","phaedra","fairy_prince","roc","rhalmarius_the_despoiler","rift","crabshark",
  3387.             "squid","simulacrum_dahrizon","sircai","sisters","slaughterers","stein","tainted","tenebra","tisiphone",
  3388.             "chimera","gorgon","ulfrik","valanazes","blobmonster","wexxa","zombiehorde","krykagrius","caracalla","centurion_marius",
  3389.             "tomb_gargoyle","krugnug","leonine_watcher","nrlux","krasgore","malchar","xessus","nrlux" ],
  3390.         reload: function () {
  3391.             SRDotDX.echo("Reloading, please wait...");
  3392.             var reg = new RegExp(/var iframe_options = ([^\x3B]+)/g);
  3393.             var match = reg.exec(activateGame);
  3394.             var iframe_options = eval('('+match[1]+')');
  3395.             $('gameiframe').replace(new Element('iframe', {"id":"gameiframe","name":"gameiframe","style":"border:none;position:relative;z-index:1;","scrolling":"auto","border":0,"frameborder":0,"width":760,"height":700,"class":"dont_hide"}));
  3396.             $('gameiframe').contentWindow.location.replace("http://web1.dawnofthedragons.com/kong?" + Object.toQueryString(iframe_options));
  3397.         }
  3398.     }
  3399.     window.addEventListener("message", function(event){
  3400.         if(/pastebin\.com/i.test(event.origin)){//for pastebin import/export
  3401.             if(/pbedit_ready/.test(event.data)){
  3402.                 console.log("[SRDotDX] Pastebin edit ready");
  3403.                 document.getElementById('SRDotDX_pastebinExport').contentWindow.postMessage(SRDotDX.gui.GetDumpText(SRDotDX.gui.RaidsForPaste), 'http://pastebin.com');
  3404.             } else if(/pbedit_done/.test(event.data)){
  3405.                 SRDotDX.gui.ExportingPaste = false;
  3406.                 console.log("[SRDotDX] Pastebin edit done");
  3407.                 SRDotDX.gui.doStatusOutput(SRDotDX.gui.RaidsForPaste.length + " raids exporting into your pastebin...");
  3408.             } else if(/pb_main/.test(event.data)){
  3409.                 if(SRDotDX.gui.ExportingPaste){
  3410.                     SRDotDX.gui.ExportingPaste = false;
  3411.                     console.log("[SRDotDX] Pastebin edit fail");
  3412.                     alert("An error occured pastebin.  Make sure you are logged in to pastebin and your pastebin url is correct, and try again.");
  3413.                 } else if (SRDotDX.gui.importingPastebin){
  3414.                     var els = document.getElementsByClassName("pb_"+(event.data+"").substring((event.data+"").length-8));
  3415.                     for(i=0;i<els.length;i++) els[i].innerHTML="(Invalid)";
  3416.                     SRDotDX.gui.deletePaste(document.getElementById('lastImport_'+pbid), pbid);
  3417.                     SRDotDX.gui.importingPastebin=false;
  3418.                 } else {
  3419.                     SRDotDX.gui.doStatusOutput(SRDotDX.gui.RaidsForPaste.length + " raids updated into your pastebin.");
  3420.                     if(SRDotDX.config.autoPostPaste){
  3421.                         SRDotDX.gui.FPXdoWork('http://pastebin.com/'+(event.data+"").substring((event.data+"").length-8))
  3422.                     }
  3423.                 }
  3424.             }else if(/pb_unknown/.test(event.data)){
  3425.                 var pbid=(event.data+"").substring((event.data+"").length-8);
  3426.                 var els = document.getElementsByClassName("pb_"+pbid);
  3427.                 for(i=0;i<els.length;i++) els[i].innerHTML="(Invalid Pastebin)";
  3428.                 SRDotDX.gui.deletePaste(document.getElementById('lastImport_'+pbid), pbid);
  3429.                 SRDotDX.gui.importingPastebin=false;
  3430.                 console.log("[SRDotDX] Pastebin unknown link");
  3431.             } else {
  3432.                 var pbid = event.data.split("###")[0];
  3433.                 var u='User Import', t=0;
  3434.                 if(event.data.split("|").length > 3){
  3435.                     u = event.data.split("|")[1]; t = event.data.split("|")[2];
  3436.                 }
  3437.                 console.log("[SRDotDX] Pastebin message recieved "+pbid + " : " + u + " : " + t);
  3438.                 document.FPXRaidSpamForm.FPXRaidSpamInput.value=event.data.replace(/&amp;/g, '&');
  3439.                 var ct = SRDotDX.gui.FPXimportRaids(false);
  3440.                
  3441.                 if(typeof SRDotDX.config.pasteList[pbid] === 'undefined') SRDotDX.config.addPaste("http://pastebin.com/"+pbid, pbid, u, u,ct.totalnew,ct.total);
  3442.                 else if (u != 'User Import') SRDotDX.config.pasteList[pbid].user = u;
  3443.                
  3444.                 var els = document.getElementsByClassName("pb_"+pbid);
  3445.                 if(typeof ct == 'boolean' && !ct){
  3446.                     for(i=0;i<els.length;i++){
  3447.                         els[i].innerHTML="(<a href=\"#\" onClick=\"return false;\" onMouseDown=\"SRDotDX.gui.FPXImportPasteBin('http://pastebin.com/"+pbid+"')\">Import</a>)";
  3448.                     }
  3449.                     document.FPXRaidSpamForm.FPXRaidSpamInput.value = "";
  3450.                     SRDotDX.config.save(false);
  3451.                     SRDotDX.gui.importingPastebin=false;
  3452.                     return;
  3453.                 }
  3454.                 for(i=0;i<els.length;i++){
  3455.                     els[i].innerHTML="(Imported, "+ct.totalnew+" new)";
  3456.                 }
  3457.                 if(typeof SRDotDX.config.pasteList[pbid].newTotal != 'number' || ct.totalnew != 0){
  3458.                     SRDotDX.config.pasteList[pbid].newTotal=ct.totalnew;
  3459.                     SRDotDX.config.pasteList[pbid].total=ct.total;
  3460.                     SRDotDX.config.pasteList[pbid].lastImport=new Date().getTime();
  3461.                    
  3462.                     document.getElementById('lastImport_'+pbid).innerHTML=dateFormat(new Date(SRDotDX.config.pasteList[pbid].lastImport), 'ddd, h:MM TT');
  3463.                     els = document.getElementsByClassName("imct_"+pbid);
  3464.                     for(i=0;i<els.length;i++){
  3465.                         els[i].innerHTML=ct.totalnew+"/"+ct.total + " new raids";
  3466.                     }
  3467.                     SRDotDX.gui.FPXSortPaste();
  3468.                 }
  3469.                 SRDotDX.config.save(false);
  3470.                 SRDotDX.gui.importingPastebin=false;
  3471.                 console.log("[SRDotDX] Pastebin import complete");
  3472.             }
  3473.         } else if(/web[\w]+\.dawnofthedragons\.com/i.test(event.origin)) { // for Kong game iframe
  3474.             var isJoining = true;
  3475.            
  3476.             var lastJoinedRaidId = /^([\d]+)\slanded/i.exec(event.data)[1];
  3477.            
  3478.             if(SRDotDX.gui.AutoJoinCurrentTotal<=1 || !SRDotDX.gui.AutoJoin){
  3479.                 isJoining = false;
  3480.                 SRDotDX.gui.AutoJoin = false;
  3481.                 SRDotDX.gui.AutoJoinCurrentLanded=0;
  3482.                 SRDotDX.gui.AutoJoinCurrentIndex=0;
  3483.                 SRDotDX.gui.AutoJoinCurrentSuccesses=0;
  3484.                 SRDotDX.gui.AutoJoinCurrentDeads=0;
  3485.                 SRDotDX.gui.AutoJoinCurrentInvalids=0;
  3486.                 SRDotDX.gui.AutoJoinCurrentTotal=0;
  3487.                 document.getElementById('AutoJoinVisibleButton').value='Join';
  3488.             }
  3489.             console.log("[SRDotDX] Game message " + event.data + " : " + isJoining);
  3490.             // message to reload the frame
  3491.             if (/reload/i.test(event.data)) {
  3492.                 if(SRDotDX.config.refreshGameToJoin){
  3493.                     console.log("[SRDotDX] Reloading");
  3494.                     SRDotDX.reload();
  3495.                 }
  3496.             }
  3497.  
  3498.             // message to nuke a raid because it's dead
  3499.             if (/dead/i.test(event.data)) {
  3500.                 console.log("[SRDotDX] Nuking raid " + lastJoinedRaidId);
  3501.                 SRDotDX.nukeRaid(lastJoinedRaidId);
  3502.                
  3503.                 if (SRDotDX.gui.AutoJoin&&isJoining) {
  3504.                     SRDotDX.gui.AutoJoinCurrentDeads++;
  3505.                 } else {
  3506.                     SRDotDX.gui.doStatusOutput("Join Failed. Raid is dead.");
  3507.                 }
  3508.             }
  3509.  
  3510.             // message to nuke a raid because it's from the wrong guild
  3511.             if (/wrongguild/i.test(event.data)) {
  3512.                 console.log("[SRDotDX] Nuking raid " + lastJoinedRaidId);
  3513.                 SRDotDX.nukeRaid(lastJoinedRaidId);
  3514.                 if (!SRDotDX.gui.AutoJoin||!isJoining){
  3515.                     SRDotDX.gui.doStatusOutput("Join Failed. Wrong guild.");
  3516.                 }
  3517.             }
  3518.             if(/member/i.test(event.data)){
  3519.                 if (!SRDotDX.gui.AutoJoin||!isJoining){
  3520.                     SRDotDX.gui.doStatusOutput("Join Failed. You are already a member.");
  3521.                 }
  3522.             }
  3523.  
  3524.             // message to delete a raid (invalid raid id or hash)
  3525.             if (/invalid/i.test(event.data)) {
  3526.                 console.log("[SRDotDX] Deleting raid " + lastJoinedRaidId);
  3527.                
  3528.                 var raidListEle = document.getElementById('raid_list');
  3529.                 if (raidListEle) {
  3530.                     var raidEle = raidListEle.getElementsByClassName("raid_list_item_"+lastJoinedRaidId)[0];
  3531.                     if (raidEle) {
  3532.                         var deleteEle = raidEle.getElementsByClassName("FPXDeleteLink")[0];
  3533.                         if (deleteEle) {
  3534.                             SRDotDX.gui.deleteRaid(deleteEle,lastJoinedRaidId,false);
  3535.                         }
  3536.                     }
  3537.                 }
  3538.  
  3539.                 if (SRDotDX.gui.AutoJoin&&isJoining) {
  3540.                     SRDotDX.gui.AutoJoinCurrentInvalids++;
  3541.                 } else {
  3542.                     SRDotDX.gui.doStatusOutput("Join failed. Invalid hash.");
  3543.                 }
  3544.             }
  3545.  
  3546.             // message indicating the join was successful
  3547.             if (/success/i.test(event.data)) {
  3548.                 console.log("[SRDotDX] Successful raid join " + lastJoinedRaidId);
  3549.                 if (SRDotDX.gui.AutoJoin&&isJoining) {
  3550.                     SRDotDX.gui.AutoJoinCurrentSuccesses++;
  3551.                 } else {
  3552.                     SRDotDX.gui.doStatusOutput(SRDotDX.raids[SRDotDX.config.raidList[lastJoinedRaidId].boss].shortname +" joined successfully.");
  3553.                 }
  3554.  
  3555.             }
  3556.  
  3557.             // message indicating the landing page is loaded
  3558.             if (/landed/i.test(event.data)) {
  3559.                 console.log("[SRDotDX] Raid id " + lastJoinedRaidId + " " + event.data +  " : " + SRDotDX.gui.AutoJoin + " : " +SRDotDX.gui.AutoJoinCurrentLanded + " : " + SRDotDX.gui.AutoJoinCurrentIndex + " : " + SRDotDX.gui.AutoJoinRaids.length);
  3560.                 if (isJoining) {
  3561.                     SRDotDX.gui.AutoJoinCurrentLanded++;
  3562.                     if (SRDotDX.config.asyncJoin) SRDotDX.gui.currentJoinFrame = parseInt(String(event.data).split("|")[1]);//recieved from iframe is available
  3563.                     if (SRDotDX.gui.AutoJoinCurrentIndex < SRDotDX.gui.AutoJoinRaids.length) {// join the next
  3564.                         SRDotDX.gui.doStatusOutput('Joining '+(SRDotDX.gui.AutoJoinCurrentIndex+1)+' of '+SRDotDX.gui.AutoJoinCurrentTotal+'. New: '+SRDotDX.gui.AutoJoinCurrentSuccesses+', Dead: '+SRDotDX.gui.AutoJoinCurrentDeads);
  3565.                         SRDotDX.gui.AutoJoinNext();
  3566.                     }  
  3567.                     if(SRDotDX.gui.AutoJoinCurrentLanded == SRDotDX.gui.AutoJoinRaids.length){// finished auto-joining
  3568.                         console.log("[SRDotDX] Finished auto joining");
  3569.                         SRDotDX.gui.AutoJoin=false;
  3570.                         SRDotDX.gui.AutoJoinVisibleClicked=false;
  3571.                         if(isJoining){
  3572.                             if(SRDotDX.config.refreshGameToJoin)
  3573.                                 SRDotDX.reload();
  3574.                             SRDotDX.gui.doStatusOutput('Join finished. New: '+SRDotDX.gui.AutoJoinCurrentSuccesses+', Dead: '+SRDotDX.gui.AutoJoinCurrentDeads+', Invalid:'+SRDotDX.gui.AutoJoinCurrentInvalids, 10000);
  3575.                         }
  3576.                         SRDotDX.gui.AutoJoinCurrentLanded=0;
  3577.                         SRDotDX.gui.AutoJoinCurrentIndex=0;
  3578.                         SRDotDX.gui.AutoJoinCurrentSuccesses=0;
  3579.                         SRDotDX.gui.AutoJoinCurrentDeads=0;
  3580.                         SRDotDX.gui.AutoJoinCurrentInvalids=0;
  3581.                         SRDotDX.gui.AutoJoinCurrentTotal=0;
  3582.                         document.getElementById('AutoJoinVisibleButton').value='Join';
  3583.                     }
  3584.                 }
  3585.             }
  3586.            
  3587.         } else if (/userscripts.org/i.test(event.origin)) { // For auto-update check
  3588.             if (SRDotDX.IsPublicVersionNewer(event.data)) {
  3589.                 var el = document.getElementById('UpdateNotification');
  3590.                 if (el) {
  3591.                     el.style.display = "block";
  3592.                 }
  3593.                
  3594.             }
  3595.  
  3596.         } else { // Events from other sources
  3597.             console.log("[SRDotDX] Event from unknown source ignored, source: " + event.origin);
  3598.         }
  3599.  
  3600.     }, false);
  3601.     console.log("[SRDotDX] Initialized. Checking for needed Kongregate resources...");
  3602.     SRDotDX.load(0);   
  3603. }
  3604. function PBmain(){
  3605.     var ct = document.getElementsByClassName('content_title')[0];
  3606.     if(ct && /Unknown/.test(ct.innerHTML)) window.parent.postMessage("pb_unknown "+(window.location+"").substring((window.location+"").length-8), 'http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons');
  3607.     else window.parent.postMessage("pb_main "+(window.location+"").substring((window.location+"").length-8), 'http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons');
  3608. }
  3609. function PBrawmain(){//pastebin import script
  3610.     window.parent.postMessage((window.location+"").substring((window.location+"").length-8)+"###"+document.getElementsByTagName("body")[0].innerHTML, 'http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons');
  3611. }
  3612. function PBeditmain(){//pastebin edit script
  3613.     window.parent.postMessage("pbedit_ready", 'http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons');
  3614.     window.addEventListener("message", function(event){
  3615.         if(/kongregate\.com/i.test(event.origin)){
  3616.             var el = document.getElementById("paste_code");
  3617.             if(el){
  3618.                 el.value = event.data;
  3619.                 document.getElementById('myform').paste_name.value = event.data.split("|")[1] + " - " + new Date();
  3620.                 document.getElementById("myform").submit.click();
  3621.                 window.parent.postMessage("pbedit_done "+(window.location+"").substring((window.location+"").length-8), 'http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons');
  3622.             } else {
  3623.                 window.parent.postMessage("pbedit_fail", 'http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons');
  3624.             }
  3625.         }
  3626.     });
  3627. }
  3628. function DDmain(){//game frame script
  3629.     var linkElements = document.getElementsByTagName('a');
  3630.     if (linkElements[0]) {
  3631.         /// Define a couple functions to pull data
  3632.         window.getFrameIDString = function (key,default_){if(default_==null)default_="";key=key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regex=new RegExp("[\\?&]"+key+"=([^&#]*)");var qs=regex.exec(window.location.href);if(qs==null)return default_;else return qs[1]}
  3633.  
  3634.         window.getRaidIDString = function (){ var matches=/kv_raid_id=([\d]+)/i.exec(window.location.href); if(matches==null || matches[1] == null) return "0"; else return matches[1]; }
  3635.  
  3636.  
  3637.         // We're on the landing page
  3638.         linkElements[0].onclick = function() { window.parent.postMessage('reload','http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons'); return false; };
  3639.        
  3640.         var message = getRaidIDString() + " landed";
  3641.         var pageDivs = linkElements[0].parentNode.getElementsByTagName("div");
  3642.  
  3643.         if (pageDivs[1]) {
  3644.             // This should be the div containing the result text from the landing page
  3645.             var text = pageDivs[1].textContent;
  3646.  
  3647.             // The following text in a (case-insensitive) regex will catch the following cases.  Only a few of these are currently used by the script
  3648.             // Joined successfully:  successfully joined
  3649.             // Re-joined successfully: successfully re-joined
  3650.             // Already in: already a member
  3651.             // Dead: already completed
  3652.             // Bad hash: invalid raid hash
  3653.             // Bad ID: invalid raid id
  3654.             // Guild raid from other guild: not a member of the guild
  3655.             // Fake link : Failed to find raid hash
  3656.             if (/successfully (re-)?joined/i.test(text)) {
  3657.                 message += " success";
  3658.             } else if (/already completed/i.test(text)) {
  3659.                 message += " dead";
  3660.             } else if (/not a member of the guild/i.test(text)) {
  3661.                 // If the raid is dead or it's a raid from another guild, add to the message to nuke it so it's invisible and unshareable
  3662.                 message += " wrongguild";
  3663.             } else if (/(invalid|find) raid (hash|ID)/i.test(text)) {
  3664.                 // If the hash or ID is invalid, add to the message to delete it so that hopefully a version with the right hash/ID can be added later
  3665.                 message += " invalid";
  3666.             } else if (/already a member/i.test(text)) {
  3667.                 // If the person is rejoining a raid
  3668.                 message += " member";
  3669.             }
  3670.             message += "|" + getFrameIDString('SRDotDX_frame','0');
  3671.         }
  3672.         window.parent.postMessage(message,'http://www.kongregate.com/games/5thPlanetGames/dawn-of-the-dragons');
  3673.     }
  3674. }
  3675.  
  3676.  
  3677. if (/^http:\/\/www\.kongregate\.com\/games\/5thplanetgames\/dawn-of-the-dragons(?:\/?$|\?|#)/i.test(document.location.href)) {//main
  3678.     console.log("[SRDotDX] Initializing....");
  3679.     var script = document.createElement("script");
  3680.     script.appendChild(document.createTextNode('('+main+')()'));
  3681.     (document.head || document.body || document.documentElement).appendChild(script);
  3682. }
  3683. if(/pastebin\.com/.test(document.location.href)){
  3684.     if (/raw\.php\?i\=/i.test(document.location.href)) {//pastebin raw (import)
  3685.         var script = document.createElement("script");
  3686.         script.appendChild(document.createTextNode('('+PBrawmain+')()'));
  3687.         (document.head || document.body || document.documentElement).appendChild(script);
  3688.     } else if (/edit\.php\?i\=/i.test(document.location.href)) {//pastebin edit page (export)
  3689.         var script = document.createElement("script");
  3690.         script.appendChild(document.createTextNode('('+PBeditmain+')()'));
  3691.         (document.head || document.body || document.documentElement).appendChild(script);
  3692.     } else {//general pastebin
  3693.         var script = document.createElement("script");
  3694.         script.appendChild(document.createTextNode('('+PBmain+')()'));
  3695.         (document.head || document.body || document.documentElement).appendChild(script);
  3696.     }
  3697. }
  3698. if (/web[\w]+\.dawnofthedragons\.com\/kong/i.test(document.location.href)) { //game script
  3699.     var script = document.createElement("script");
  3700.     script.appendChild(document.createTextNode('('+DDmain+')()'));
  3701.     (document.head || document.body || document.documentElement).appendChild(script);
  3702. }
  3703. var dom = (typeof unsafeWindow === "undefined"?window:unsafeWindow);
  3704.  
  3705. function init_two_way() {
  3706.     var CDialogue = dom.ChatDialogue,
  3707.         CRoom = dom.ChatRoom;
  3708.     var holodeck = dom.holodeck;
  3709.    
  3710.     if (CDialogue){
  3711.         CDialogue.prototype = dom.CDprototype||dom.ChatDialogue.prototype;
  3712.         CRoom.prototype = dom.CRprototype||dom.ChatRoom.prototype;
  3713.        
  3714.         if(!holodeck.__two_way){
  3715.             holodeck.__two_way = true;
  3716.             holodeck._two_way_recipient = null;
  3717.            
  3718.             if (!CRoom.prototype.sendRoomMessage_twOld) {
  3719.                 CRoom.prototype.sendRoomMessage_twOld = CRoom.prototype.sendRoomMessage;
  3720.                 CRoom.prototype.sendRoomMessage = function(message, force) {
  3721.                     if (!force && this.holodeck()._two_way_recipient){
  3722.                         this.holodeck().activeDialogue().sendPrivateMessage(this.holodeck()._two_way_recipient, message);
  3723.                         return;
  3724.                     }
  3725.                     this.sendRoomMessage_twOld(message);
  3726.                 }
  3727.             }
  3728.            
  3729.             //Called with: /pm <username> [message]
  3730.             CDialogue.prototype.two_way = function (holodeck, input) {     
  3731.                 var active_dialogue = holodeck.activeDialogue();
  3732.                
  3733.                 var m = input.match(/^\/(\S+)\s+(\S+)\s?(.+)*/);
  3734.                
  3735.                 if (!m) { //no params
  3736.                     active_dialogue.kongBotMessage("Now ending 2-way conversation with " + holodeck._two_way_recipient);
  3737.                     holodeck._two_way_recipient = null;
  3738.                     return false;
  3739.                 }
  3740.                
  3741.                 var username = m[2];
  3742.                 var message = m[3];
  3743.                
  3744.                 if (username) { //start 2way
  3745.                     holodeck._two_way_recipient = username;
  3746.                     active_dialogue.kongBotMessage("Now starting 2-way conversation with " + username);
  3747.                 }
  3748.                
  3749.                 if (username && message) { //if the user has defined a message, send it
  3750.                     active_dialogue.sendPrivateMessage(username, message);
  3751.                 }
  3752.                 return false;
  3753.             }
  3754.            
  3755.             CDialogue.prototype.speak = function (holodeck, input) {
  3756.                 var m = input.match(/^\/\S+\s+(.+)/);
  3757.                 if (m) {
  3758.                     holodeck.chatWindow().activeRoom().sendRoomMessage(m[1], true);
  3759.                 }
  3760.                 return false;
  3761.             }
  3762.            
  3763.             holodeck.addChatCommand("pm", CDialogue.prototype.two_way);
  3764.             holodeck.addChatCommand("private", CDialogue.prototype.two_way);
  3765.            
  3766.             holodeck.addChatCommand("local", CDialogue.prototype.speak);
  3767.             holodeck.addChatCommand("l", CDialogue.prototype.speak);
  3768.  
  3769.         }
  3770.     }
  3771. }
  3772.  
  3773. function check(){
  3774.     var injectScript = dom.injectScript||(document.getElementById("injectScriptDiv")?document.getElementById("injectScriptDiv").onclick():0);
  3775.     if(injectScript){
  3776.         injectScript(init_two_way, 200);
  3777.     } else if(!dom._promptedFramework && !/Chrome/i.test(navigator.appVersion)){
  3778.         if(confirm("Oops an update to browser changed something\n"))
  3779.             ;
  3780.         dom._promptedFramework = true;
  3781.     }
  3782. }
  3783.  
  3784. setTimeout(check, 0);
Add Comment
Please, Sign In to add comment