ericbabe
Posts: 11927
Joined: 3/23/2005 Status: offline
|
quote:
ORIGINAL: LuckyCJS1001 The ability to assign Generals to Brigades would be good instead of them being randomly assigned in DC/HW// ==UserScript== // @name MultiPopup Main Functions File // @namespace http://www.hesido.com // @version 2.09 // @date 2005-08-18 // @author Emrah BASKAYA // @description Tooltip Replacement: Replaces Browser Default Tooltips with CSS stylable ones and allows you to customize the information displayed in it and the delay for tooltips. // @include * // ==/UserScript== // Licence Information: /* MultiPopup V2.09 Main Functions File Tooltip Replacement Script Emrah BASKAYA (hesido - www.hesido.com) Detailed info can be found at: http://www.hesido.com You cannot use this code for commercial purposes without permission of the author. You are not allowed to earn money from this script or any work that is derived from this script. Free to use for non-commercial purposes. A link to www.hesido.com is most welcome, in a page on your site, if you are using it for your website. For other usage options, please contact the author. Uses some DOM fallback methods as seen on www.quirksmode.org Code for embedding CSS by D.I.Z. */ if (window.addEventListener) window.addEventListener('load', multipopupMain, false); else if (window.attachEvent) window.attachEvent('onload', multipopupMain); function multipopupMain(){ if (!document.createElement || !document.getElementsByTagName || !document.getElementById || document.getElementsByTagName("head").length == 0) return; var allowRemotePrefs = true; //Needs to be true to be able to run modules, external preferences and skin //making this false will almost make Multipopup impenetratable. // Total Suppression if (allowRemotePrefs && typeof(mpUSRJS) != "undefined" && mpUSRJS.doNotRun) return; // Self Supression if (window.MPwinTriggersActive) return; // Prerunmodules execution if (allowRemotePrefs && typeof(mpUSRJS) != "undefined" && typeof(mpUSRJS.preRunModules) != "undefined") for (var i=0; iarray related to tooltip // gVr->array that holds generic info // aOb->array that holds animation info. var pcR = new Array(), gVr = new Array(), aOb = new Array(), mPu = new Array(); setMPPreferences(); mPu.divIds = ['mpopupc','mpoptop','mpopfill1','mpopbod','mpopfill2','mpopfill3','mpopfill4','mpopbot','mpopfill5','mpopdbl','mpopdblprnt','bmtest']; mPu.styleObId = "mpopupstyleobjectid" mPu.revEvals = new Array(null,'"rect("+(clipYTarget-aOb.clipY)+"px, "+(clipXTarget+aOb.clipX)+"px, "+(clipYTarget+aOb.clipY)+"px, "+(clipYTarget-aOb.clipY)+"px)"','"rect(0px, "+(aOb.clipX*2)+"px, "+(clipYTarget*2)+"px, 0px)"','"rect(0px, "+(aOb.clipX*2)+"px, "+(aOb.clipY*2)+"px, 0px)"'); mPu.defDesc = "",pcR.hvrdObj = null,aOb.objMovd = null,aOb.clipStep = 0,aOb.warpStep = 0; aOb.popActv = false,aOb.objMovd = false,gVr.activeDelay = mPu.popupDelay; pcR.actOffsetX = mPu.xOfst, pcR.actOffsetY = mPu.yOfst; aOb.revInt = new Array(),aOb.prevs = new Array(); // Auto Primary Suppress gVr.suppress = (typeof(mpUSRJS) != "undefined" && mpUSRJS.suppress && mPu.allowSuppress) ? true : false; // deb = document.getElementById('debug'); // debb = 0; mPu.setPopups = function() { if (mPu.revStyle == 0 || mPu.clipSteps == 0) {gVr.desInstRev = true; mPu.clipSteps = 0} else {gVr.desInstRev = false;} gVr.instRev = gVr.desInstRev; var attList = new Array(), attid = new Array(), patternFound; if (mPu.useFirefoxForceWrap) eval('var forcewrapreg = /([^\\s\\&\\/\\-]{'+mPu.forceBreakAt+'})/g'); else eval('var forcewrapreg = /([^\\s\\/\\-]{'+mPu.forceBreakAt+'})/g'); // eval('var forcewrapreg = /([^\\s\\&\\/-]{'+mPu.forceBreakAt+'})/g'); //Opera var forcewrapreplace = '$1'+mPu.brokenSign; var zerowidthspacereg = /([\&\/-])/g var zerowidthreplacer = '$1' for (var i=0; i'+inserter[0]+''; else for (var kt=0; kt'+mPu.attDTitle[instId[kt]]+''+inserter[kt]+'';} if (altinsertr.length == 1 && mPu.attDNAWA[ainsId[0]]) toaltinsrt = ''+altinsertr[0]+''; else for (var kt=0; kt'+mPu.attDTitle[ainsId[kt]]+''+altinsertr[kt]+'';} if (toinsert !="" || toaltinsrt !="") { if (toinsert !="") {targetNodes.primaryView = toinsert; targetNodes.primDpresent = true;} if (toaltinsrt !="") {targetNodes.secondaryView = toaltinsrt; targetNodes.altDpresent = true;} if (!targetNodes.triggersActive) { if (!addCheckTrigger(targetNodes,'mouseover',writeDescription)) targetNodes.onmouseover = writeDescription; if (!addCheckTrigger(targetNodes,'mouseout',clearDescription)) targetNodes.onmouseout = clearDescription; targetNodes.triggersActive = true; } } } } } // Embed Internal Style if (mPu.useDefStyle) { if (document.getElementById(mPu.styleObId) != null) document.getElementById(mPu.styleObId).parentNode.removeChild(document.getElementById(mPu.styleObId)); var head = document.getElementsByTagName("head")[0]; var CSSstyleObj = document.createElement("style"); CSSstyleObj.setAttribute("type", 'text/css'); CSSstyleObj.id = mPu.styleObId; CSSstyleObj.innerHTML = mPu.defCSS; head.appendChild(CSSstyleObj); } addTrigger(window,'resize', sizeUpdate); addTrigger(window,'keydown', mpopupKeyReceive); addTrigger(window,'keyup', mpopupKeyUpreceive); window.MPwinTriggersActive = true; mPu.addPopupDiv = addPopupDiv; addPopupDiv(); sizeUpdate(); mPu.setPopups(); // Postrun modules execution if (typeof(mPu.postRunModules) != "undefined") for (var i=0; i0) ? pcR.width - mPu.edgeBufferZone : xiPos; var syEdge = (pcR.actOffsetY>0) ? pcR.height - mPu.edgeBufferZone : yiPos; yiPos = Math.max(Math.min(yiPos, syEdge - pcR.divHeight),0); xiPos = Math.max(Math.min(xiPos, sxEdge - pcR.divWidth),0); aOb.yPos = yiPos; aOb.xPos = xiPos; if (pointColDetect(pcR.xgPos,pcR.ygPos,yiPos,xiPos+pcR.divWidth,yiPos+pcR.divHeight,xiPos,3)) { pcR.actOffsetX = -pcR.actOffsetX; pcR.actOffsetY = -pcR.actOffsetY; return false; } else { pcR.tDiv.style.top = (aOb.yPos + pcR.scrolledY - gVr.bRCompY) + "px"; pcR.tDiv.style.left = (aOb.xPos + pcR.scrolledX - gVr.bRCompX) + "px"; } return true; //Modify Ian } function pointColDetect(x,y,top,right,bottom,left,boundary) { top -= boundary; bottom += boundary; left -= boundary; right += boundary; if ((x>left&&xtop&&y 0; pcR.bDiv.style.display = 'none'; pcR.bDiv.style.display = 'block'; pcR.hvrdCh = true; pcR.hvrdFirst = true; if (pcR.reqDesc) { pcR.cDiv.innerHTML = tagDescription; pcR.mDiv.innerHTML = tagDescription; } aOb.tWidth = pcR.mDiv.offsetWidth; aOb.tHeight = pcR.mDiv.offsetHeight; if (!wpt && pcR.reqDesc) { mPu.setDdivTargetSize(); fixPopupPos(); } if (aOb.popActv != true) { if (wpt) pcR.cDiv.style.left = pcR.padComp+'px'; aOb.revealTimer = window.setTimeout( function() { if (pcR.hvrdObj != null) { if (pcR.hvrdFirst == true && mPu.warpSteps > 0) { aOb.tPrevHeight = aOb.tHeight; aOb.tPrevWidth = aOb.tWidth; mPu.setDdivTargetSize(); fixPopupPos(); } aOb.revealTimer = 0; if (gVr.suppress && !ctrlK && !altK && !nosuppress) return; if (gVr.instRev) aOb.revInt[aOb.revInt.length] = window.setInterval( function() { //Instant Reveal Function if (aOb.objMovd == true) { pcR.cDiv.style.width = aOb.tWidth + 'px'; pcR.cDiv.style.height = aOb.tHeight + 'px'; fixPopupPos(); if (pcR.reqDesc) pcR.tDiv.style.visibility = 'visible'; aOb.popActv = true; aOb.clipAnimDone = true; clrIntrvls(); } },mPu.revInt); else aOb.revInt[aOb.revInt.length] = window.setInterval( function() { //Clip Reveal Function if (aOb.objMovd == true && aOb.clipStep 0) { aOb.tPrevHeight = aOb.heightSet; aOb.tPrevWidth = aOb.widthSet; } aOb.warpStep = 0; } function movePopup(e) { if (pcR.hvrdObj != null || aOb.popActv == true) { if (!e) {e = window.event;} //Modify Ian pcR.ygPos = e.clientY; pcR.xgPos = e.clientX; fixPopupPos(); aOb.objMovd = true; } } function sizeUpdate() { if (self.innerWidth) { pcR.width = self.innerWidth; pcR.height = self.innerHeight;} else if (document.documentElement && document.documentElement.clientWidth) { pcR.width = document.documentElement.clientWidth; pcR.height = document.documentElement.clientHeight;} else if (document.body) { pcR.width = document.body.clientWidth; pcR.height = document.body.clientHeight;} gVr.bRCompX = 0; gVr.bRCompY = 0; if (document.body.activeStyle('position','position') == 'relative') {gVr.bRCompX = document.body.offsetLeft; gVr.bRCompY = document.body.offsetTop} } function getElementsByClass(targetTag,tagClass) { var elementList = document.getElementsByTagName(targetTag); var classTag = new Array(); for (var i=0;i -1 && mPu.preload == true) preLoadImage(stripURL(bgIm)) } pcR.cDiv = tDv[6]; pcR.tDiv = tDv[0]; pcR.dDiv = tDv[5]; pcR.mDiv = tDv[9]; pcR.bDiv = tDv[10]; pcR.padComp = parseInt(tDv[5].activeStyle('padding-left','paddingLeft')); tDv[6].style.left = pcR.padComp + 'px'; // detect firefox bug and set functions accordingly tDv[5].style.width = "50px"; tDv[5].style.height = "50px"; mPu.setDdivWarpSize = (tDv[5].offsetWidth > tDv[1].offsetWidth && tDv[1].activeStyle('display','display') != 'none' && tDv[7].activeStyle('display','display') != 'none') ? function() { aOb.dHght = aOb.heightSet + pcR.bxMcompY; aOb.dWdth = aOb.widthSet + pcR.bxMcompX; pcR.dDiv.style.height = aOb.dHght + "px"; pcR.dDiv.style.width = aOb.dWdth + "px"; tDv[1].style.display = 'none';tDv[1].style.display = 'block'; tDv[7].style.display = 'none';tDv[7].style.display = 'block'; } : function() { aOb.dHght = aOb.heightSet + pcR.bxMcompY; aOb.dWdth = aOb.widthSet + pcR.bxMcompX; pcR.dDiv.style.height = aOb.dHght + "px"; pcR.dDiv.style.width = aOb.dWdth + "px"; } mPu.setDdivTargetSize = (tDv[5].offsetWidth > tDv[1].offsetWidth) ? function() { pcR.cDiv.style.height = aOb.tHeight + 'px'; pcR.cDiv.style.width = aOb.tWidth + 'px'; aOb.dHght = aOb.tHeight + pcR.bxMcompY; aOb.dWdth = aOb.tWidth + pcR.bxMcompX; pcR.dDiv.style.height = aOb.dHght + "px"; pcR.dDiv.style.width = aOb.dWdth + "px"; tDv[1].style.display = 'none';tDv[1].style.display = 'block'; tDv[7].style.display = 'none';tDv[7].style.display = 'block'; } : function() { pcR.cDiv.style.height = aOb.tHeight + 'px'; pcR.cDiv.style.width = aOb.tWidth + 'px'; aOb.dHght = aOb.tHeight + pcR.bxMcompY; aOb.dWdth = aOb.tWidth + pcR.bxMcompX; pcR.dDiv.style.height = aOb.dHght + "px"; pcR.dDiv.style.width = aOb.dWdth + "px"; } pcR.TDdifX = tDv[0].offsetWidth - tDv[5].offsetWidth; pcR.TDdifY = tDv[0].offsetHeight - tDv[5].offsetHeight; } function getActiveStyle(style,stylecc) { if (window.getComputedStyle) return window.getComputedStyle(this,null).getPropertyValue(style) if (this.currentStyle) return eval("this.currentStyle."+stylecc) } function preLoadImage(imageurl) {var img = new Image();img.src = imageurl;return img;} function stripURL(s) { // I'll later replace this with proper regex. s = s.substring(s.indexOf("url(")+4,s.lastIndexOf(")"));if (s.indexOf('"')>-1) s = s.substring(s.indexOf('"')+1,s.lastIndexOf('"'));return s; } function writeDescription(e) { if (!e) {e = window.event;} //Modify Ian if (this != e.target) return; if (!e.shiftKey) doWriteDescription(this,e.ctrlKey,e.altKey,false) } function clearDescription(e) { if (!e) {e = window.event;} //Modify Ian if (this != e.target) return; doClearDescription(); } function addTrigger(elm,eventname,func) { if (!addCheckTrigger(elm,eventname,func) && elm.attachEvent) elm.attachEvent('on'+eventname, func); } function addCheckTrigger(elm,eventname,func) { if (elm.addEventListener) {elm.addEventListener(eventname, func, false); return true;} else return false; } function removeTrigger(elm,eventname,func) { if (!removeCheckTrigger(elm,eventname,func) && elm.detachEvent) elm.detachEvent('on'+eventname, func); } function removeCheckTrigger(elm,eventname,func) { if (elm.removeEventListener) {elm.removeEventListener(eventname, func, false); return true;} else return false; } //Embedded preferences function setMPPreferences() { if (typeof(mpUSRJS) != "undefined" && allowRemotePrefs) mPu = mpUSRJS; if (typeof(mPu.prefsVersion) == "undefined") {mPu.noExtPrefs=true;} mPu.useDefStyle = true; mPu.popupDelay = 650; mPu.hideDelay = 85; mPu.instPopDur = 370; mPu.attDesc = ['htitle','alt','href','src']; mPu.attDUse = [true,true,true,true]; mPu.attDPri = [true,false,false,false]; mPu.attDSec = [false,true,true,true]; mPu.setAttNull = [false,false,false,false]; mPu.attDInhrt = [true,false,true,false]; mPu.forceWordWrap = [false, false, true, true]; mPu.stnClass = 'mpop_cl'; mPu.alrtClass = 'mpop_al'; mPu.spcClass = ['mpop_title','mpop_alt','mpop_href','mpop_src']; mPu.attDTitle = ['Title:','Alt:','Address:','Source:'] mPu.alertPattern = ['','',/^(\s*javascript\:)/i,''] mPu.alertToPri = false; mPu.alertInstant = false; mPu.attDNAWA = [true,true,false,false]; mPu.xOfst = 15; mPu.yOfst = 15; mPu.clipSteps = 3; mPu.revStyle = 0; mPu.revInt = 10; mPu.warpSteps = 10; mPu.preload = true; mPu.edgeBufferZone = 32; mPu.tTags = ["*"]; mPu.ttipZIndex = "9999"; mPu.autoSelfFocus = true; mPu.forceBreakAt = 29; //minimum number of chars needed to force a break, is applied to attributes with 'forcewordwrap' on. mPu.brokenSign = '»' //new with 2001 mPu.allowSuppress = true; //version mPu.embeddedPrefsVersion = 2004; mPu.defCSS = '/* embedded css version 2.02 Skin Name: Minimal Transparent */' +'#mpopupc, #mpopdblprnt, #mpopupdbl {' +' color: black !important; width: auto !important; height: auto !important;' +' padding: 0 !important; margin: 0 !important; position: absolute; top: 0; left: 0;' +' background: #EEE none !important; text-align: left !important}' +'#mpopdblprnt {padding:1px !important; max-width:80% !important;}' +'#mpopdbl {position: relative;}' +'#mpopupc, #mpopdbl, #mpopdbl div, #mpopupc div, #mpopbod div, #mpopbod>div>div>div {' +' font: 12px "Trebuchet MS", Trebuchet, Verdana, Sans-Serif !important;' +' border-width: 0 !important; margin: 0; padding: 0; }' +'#mpopupc {' +'background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAABCCAYAAADjVADoAAAABGdBTUEAAK%2FINwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABuSURBVHja7NAxDQAwCAAwwL%2FGedhPAj5IK6E5%2FV8QpUCECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChIgLVgABBgDHFAROmd3kzgAAAABJRU5ErkJggg%3D%3D) !important;' +'border: 2px solid #222 !important; opacity: 0.9; padding: 0.2em 0.3em !important;}' +'#mpoptop {display:none}' +'#mpopbot {display:none}' +'#mpopbod {' +' padding:0 !important; margin: 0 !important; border-width: 0 !important;}' +'#mpopbod>div {' +' padding:0 !important; margin: 0 !important; border-width: 0 !important;}' +'#mpopbod>div>div {' +' position:relative;' +' padding:1px !important; margin: 0 !important; border-width: 0 !important;}' +'#mpopbod>div>div>div { margin:0 !important; word-wrap: break-word;}' +'#mpopdbl { max-width: 320px !important; margin: 0 !important; padding: 0 1px !important; word-wrap: break-word;}' +'#bmtest { top: 0; left: 0; position: absolute; border-width: 0 !important; margin: 0 !important; }' +'span.mpop_cl, span.mpop_al {' +' font-weight: bold; background-color: #1F2C2F; color: #EAE9DA; font-style: italic;' +' font-variant: small-caps; font-size: 90%; padding: 0 0.6em 0 0.3em; margin-right: 0.3em;}' +'span.mpop_al {background-color: red}' +'span.mpopbrspan {color: red;}' ; //not for modification. mPu.minimumReqPrefsV = 2002; if (allowRemotePrefs && mPu.setMPPrefsExternal && mPu.minimumReqPrefsV Maybe it's just because I'm a programmer, but I've just spent 15 minutes reading this post. :-)
_____________________________
|