// ==UserScript== // @name Macro Combat Compacter // @namespace kol.interface.unfinished // @description Compacts the divisions shown when using fight macros in KoL, displaying only the last. // @include http://*kingdomofloathing.com/fight.php* // @include http://127.0.0.1:*/fight.php* // @version 1.21 // @grant GM_getValue // @grant GM_setValue // @downloadURL https://update.greasyfork.icu/scripts/4213/Macro%20Combat%20Compacter.user.js // @updateURL https://update.greasyfork.icu/scripts/4213/Macro%20Combat%20Compacter.meta.js // ==/UserScript== //Version 1.21 // - add @grant //Version 1.2 // - added round counter and attack/defense notice compaction //Version 1.1 // - also now shows effect gains/losses //Version 1.0 function compact() { var hrs = document.evaluate( '//hr', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null); var stuff = []; var ids = 1; extractAdjustments(hrs.snapshotLength); // gather contents for (var i=hrs.snapshotLength-1;i>=0;i--) { var hr2 = hrs.snapshotItem(i); var itemids = ""; stuff[i] = document.createElement('div'); stuff[i].setAttribute('class','compactDiv'); while (hr2.previousSibling && hr2.previousSibling.tagName!='HR' && hr2.previousSibling.tagName!='BR') { var n = hr2.previousSibling; n.parentNode.removeChild(n); if (stuff[i].firstChild) stuff[i].insertBefore(n,stuff[i].firstChild); else stuff[i].appendChild(n); } stuff[i].setAttribute('style','display:none'); hr2.parentNode.insertBefore(stuff[i],hr2); hr2.addEventListener('click',expandDivH,true); hr2.setAttribute('title','click to display round '+(i+1)); var r = findAcquires(stuff[i]); if (r.length>0) { for (var j=0;j0) { for (var i=0;i0) { for (var i=0;i1) { var d = document.getElementById('compactatkdef'); var ps; if (!d) { ps = document.evaluate('.//td/b[text()="Combat!"]',document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null); if (ps.singleNodeValue) { d = document.createElement('div'); d.setAttribute('style','display:inline;float:left;font-size:small;'); d.setAttribute('id','compactatkdef'); ps.singleNodeValue.parentNode.insertBefore(d,ps.singleNodeValue); } else return; } GM_setValue('atk',atk); GM_setValue('def',def); if (delta!=0 || deltd!=0) { d.setAttribute('title','Round '+r+': monster attack reduced by '+delta+' and defense by '+deltd+'.'); } else { d.setAttribute('title','Round '+r+'.'); } var c = (r>1) ? '\u00A0('+r+') ' : '\u00A0'; if (atk>0) c = c + 'A: -'+atk+' '; if (def>0) c = c + 'D: -'+def; if (d.firstChild) d.replaceChild(document.createTextNode(c),d.firstChild); else d.appendChild(document.createTextNode(c)); } } if (window.location.search && window.location.search.indexOf('ireallymeanit')>=0) { GM_setValue('atk',0); GM_setValue('def',0); GM_setValue('round',0); } else if (document.evaluate('.//p[text()="It gets the jump on you."]',document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue) { GM_setValue('atk',0); GM_setValue('def',0); GM_setValue('round',0); } if (document.getElementById('jumptobot')) { compact(); addExpandAll(); } else { extractAdjustments(0); }