Taggescript - med små forrandringer.

Status
Stengt for ytterligere svar.

DeletedUser

Guest
Panikk!! Scriptet virker ikke lengre.. Kommer bare opp en tall rekke... Har prøvd å legge det inn igjen men det nyttet ikke..Noen som kan hjelpe?
Dette kommer opp: 26,07,12,20,59,26,961

Scriptet: javascript: theFormat = '{unit} - {origin} - {player} - {sent}'; $.getScript("http://dl.dropbox.com/u/24469843/Tribalwars/Scripts/IncomingRenamer.js"); void(0);
 
Sist redigert av en moderator:

Johnny Knoxville

Populær på forumet
Reaksjonspoeng
320
Prøv dette:

Kode:
url = document.URL;

function myErrorSuppressor() {
    return true;
}
window.onerror = myErrorSuppressor;

function labelAttack() {
    if (typeof (theFormat) == 'undefined') theFormat = '{unit} ({coords}) {player} F{distance} {sent}';
    arrUnitNames = ['Scout', 'LC', 'HC', 'Axe', 'Sword', 'Ram', '***Noble***'];
    arrReplace = ['unit', 'coords', 'player', 'distance', 'sent', 'duration', 'arrival', 'origin', 'destination', 'destinationxy'];
    arrHead = ['Unit', 'Sent', 'Duration', 'Name To'];
    arrValues = arrReplace;

    function fnReg(txtString) {
        return new RegExp("\{" + txtString + "\}", "ig");
    }
    arrReplace = arrReplace.map(fnReg);

    function fnGetConfig() {
        var oRequest = new XMLHttpRequest();
        var sURL = "http://" + window.location.hostname + "/interface.php?func=get_config";
        oRequest.open("GET", sURL, 0);
        oRequest.send(null);
        if (oRequest.status == 200) return oRequest.responseXML;
        alert("Error executing XMLHttpRequest call to get Config!");
    }
    var xmldocument = fnGetConfig();
    theUnitSpeed = xmldocument.getElementsByTagName('unit_speed')[0].childNodes[0].nodeValue;
    theWorldSpeed = xmldocument.getElementsByTagName('speed')[0].childNodes[0].nodeValue;

    function myGetCoords(theString) {
        return /(.*?)\s\(((\d+)\|(\d+))\)\sK(\d+)/i.exec(theString);
    }

    function myZeroPad(theString) {
        theInt = parseInt(theString, 10);
        return (theInt > 9 ? theInt : '0' + theInt);
    }

    function myGetElementsByTagName(theObj, theString) {
        return theObj.getElementsByTagName(theString);
    }

    function myGetInner(theObj) {
        return theObj.innerHTML;
    }

    function myGetInnerofFirstLink(theObj) {
        return myGetInner(myGetElementsByTagName(theObj, 'a')[0]);
    }

    function myInsRow() {
        return theTable.insertRow(intRow++);
    }

    function fnAttackID() {
        var a = document.URL.match(/\d+/g);
        return document.URL.match(/\d+/g)[a.length - 1];
    }

    function myInsCell(theInt) {
        return newRow.insertCell(theInt);
    }

    function mySetInner(theObj, theString) {
        theObj.innerHTML = theString;
        return theObj;
    }

    function myInsTH(theString) {
        newCell = newRow.appendChild(document.createElement('th'));
        return mySetInner(newCell, theString);
    }

    function myTime(theInt) {
        return myZeroPad(theInt / Const3600) + ':' + myZeroPad(theInt % (Const3600) / Const60) + ':' + myZeroPad(theInt % Const60);
    }

    function fnInt(txtInt) {
        return parseInt(txtInt, 10);
    }

    function fnDate(txtDate) {
        arrMs = txtDate.match(/:(\d{3})$/i);
        if (arrMs) txtDate = txtDate.replace(/:(\d{3})$/i, '');
        var dtNew = new Date(txtDate);
        if (dtNew == 'Invalid Date') {
            var arrDate = txtDate.match(/\b(\d+)\b/ig);
            arrDate = arrDate.map(fnInt);
            if (arrDate[2] < 2000) arrDate[2] += 2000;
            dtNew = new Date(arrDate[2], arrDate[1] - 1, arrDate[0], arrDate[3], arrDate[4], arrDate[5]);
        }
        if (arrMs) dtNew.setMilliseconds(arrMs[1]);
        return dtNew;
    }
    Const3600 = 3600;
    Const60 = 60;
    ConstWidth = 'width';
    theTable = document.getElementById('edit').parentNode.parentNode.parentNode.parentNode;
    theTable.removeAttribute(ConstWidth);
    var arrRows = theTable.rows;
    var intRows = arrRows.length;
    for (intRow = 0; intRow < intRows; intRow++) {
        theRow = arrRows[intRow];
        theLength = (arrCells = theRow.cells) ? arrCells.length : 0;
        if (theLength) {
            arrCells[theLength - 1].colSpan = 5 - theLength;
        }
    }
    arrValues[2] = myGetInnerofFirstLink(arrRows[1].cells[2]);

    arrAttack = (arrRows[2].cells[1].textContent).match(/\d+\|\d+/ig);
    arrAttack = arrAttack[arrAttack.length - 1];
    arrTarget = (arrRows[4].cells[1].textContent).match(/\d+\|\d+/ig);
    arrTarget = arrTarget[arrTarget.length - 1];

    arrValues[1] = arrRows[2].cells[1].textContent;
    arrValues[7] = arrAttack; 
    arrValues[8] = arrTarget; 
    arrValues[9] = arrRows[4].cells[1].textContent;

    arrValues[6] = typeof (arrRows[5].cells[1].innerText) == 'undefined' ? arrRows[5].cells[1].textContent : arrRows[5].cells[1].innerText;
    dtArrival = fnDate(arrValues[6]);
    arrValues[6] = fnDateFormat(dtArrival);
    /*alert(fnDateFormat(dtArrival));
    for (x = 0; x < arrRows.length - 1; x++) {
       // alert(x + " " + arrRows[x].cells.length);
        for (y = 0; y < arrRows[x].cells.length; y++) {
            alert("X: " + x + " Y: " + y + " --- " + arrRows[x].cells[y].textContent);
        }
        
    }

    alert(arrRows[intRows - 2].cells[1].innerHTML);
    */
   /* alert(intRows);
    alert(arrRows[intRows - 1].cells[1]);*/
    arrArrivalIn = myGetInner(arrRows[6].cells[1]).match(/\d+/ig);





    msecsArrivalIn = (arrArrivalIn[0] * Const3600 + arrArrivalIn[1] * Const60 + arrArrivalIn[2] * 1) * 1000; 
    /*alert('txtAttacker :'+txtAttacker+'\narrAttack :'+arrAttack[2]+'|'+arrAttack[3]+'\narrTarget :'+arrTarget[2]+'|'+arrTarget[3]+'\ndtArrival :'+dtArrival+'\narrArrivalIn :'+arrArrivalIn[0]+':'+arrArrivalIn[1]+':'+arrArrivalIn[2]+':'+arrArrivalIn[3]+'\nsecsArrivalIn :'+secsArrivalIn);*/

    theXdiff = parseInt(arrAttack.split("|")[0] - arrTarget.split("|")[0]);
    theYdiff = parseInt(arrAttack.split("|")[1] - arrTarget.split("|")[1]);
    dblDistance = Math.sqrt(theXdiff * theXdiff + theYdiff * theYdiff);
    arrValues[3] = dblDistance.toFixed(2);
    var intRow = intRows - 2;
    arrElements = myGetElementsByTagName(theTable, 'input');
    theInputButton = arrElements[1];
    theInputEdit = arrElements[0];
    theInputEdit.size = Const60;
    newRow = myInsRow();
    mySetInner(myInsCell(0), 'Distance:').colSpan = 2;
    mySetInner(myInsCell(1), arrValues[3] + ' Fields').colSpan = 2;
    newRow = myInsRow();
    arrHead.forEach(myInsTH);
    function fnPreg(varValue, intIdx) {
        newInput.value = newInput.value.replace(arrReplace[intIdx], varValue);
    }

    function fnDateFormat(dtDate) {
        intMs = dtDate.getMilliseconds();
        return myZeroPad(dtDate.getHours()) + ':' + myZeroPad(dtDate.getMinutes()) + ':' + myZeroPad(dtDate.getSeconds()) + '.' + (intMs > 99 ? intMs : '0' + myZeroPad(intMs)) + ' ' + myZeroPad(dtDate.getDate()) + '/' + myZeroPad(dtDate.getMonth() + 1);
    }
    for (theIndex in arrUnitNames) {
        msecsDuration = Math.round([9,10,11,18,22,30,35][theIndex] * Const60 * 1000 * dblDistance / theWorldSpeed / theUnitSpeed);
        secsDiff = (msecsDuration - msecsArrivalIn) / 1000;
        if (secsDiff > 0) {
            arrValues[0] = arrUnitNames[theIndex];
            arrValues[5] = myTime(msecsDuration / 1000);
            dtSent = new Date(dtArrival - msecsDuration);
            arrValues[4] = fnDateFormat(dtSent);
            newRow = myInsRow();
            mySetInner(myInsCell(0), arrUnitNames[theIndex]);
            mySetInner(myInsCell(1), secsDiff < Const60 && 'just now' || secsDiff < Const3600 && Math.floor(secsDiff / Const60) + ' mins ago' || myTime(secsDiff) + ' ago');
            mySetInner(myInsCell(2), arrValues[5]);
            newCell = myInsCell(3);
            newButton = newCell.appendChild(theInputButton.cloneNode(true));
            newInput = newCell.appendChild(theInputEdit.cloneNode(true));
            newInput.id = 'I' + theIndex;
            newInput.value = theFormat;
            arrValues.forEach(fnPreg);
            newButton.onmousedown = new Function('theInputEdit.value=document.getElementById(\'I' + theIndex + '\').value;');
        }
    }
}
labelAttack();

void (0);

Det er hele scriptet fra den originale siden.
 

DeletedUser

Guest
Den nye du sendte fynket ikke helt.. Men det gamle "korte"begynte å virke igjen av seg selv igår. Forstår det ikke helt, men så lenge det virker så er jeg fornøyd! :D

Takk for forsøket uansett!
 

DeletedUser

Guest
Det funker ikke her. Og ja jeg har fjernet ignorer angrep i innstillinger

Prøv dette her skal være akuratt det samme funker fint for meg på v1

javascript: theFormat = '{unit} - ({origin}) - {player} - '; $.getScript("http://dl.dropbox.com/u/24469843/Tribalwars/Scripts/IncomingRenamer.js"); void(0);
 

DeletedUser

Guest
Her er da det orginale scriptet, jeg har godt gjennom det og klarer ikke og finne noen feil.. men det virker heller ikke hos meg... på v11, jeg klarer ikke og forstå hva det er som ødelegger...

[SPOIL]url = document.URL;

function myErrorSuppressor() {
return true;
}
window.onerror = myErrorSuppressor;

function labelAttack() {
if (typeof (theFormat) == 'undefined') theFormat = '{unit} ({coords}) {player} F{distance} {sent}';
arrUnitNames = ['Scout', 'LC', 'HC', 'Axe', 'Sword', 'Ram', '***Noble***'];
arrReplace = ['unit', 'coords', 'player', 'distance', 'sent', 'duration', 'arrival', 'origin', 'destination', 'destinationxy'];
arrHead = ['Unit', 'Sent', 'Duration', 'Name To'];
arrValues = arrReplace;

function fnReg(txtString) {
return new RegExp("\{" + txtString + "\}", "ig");
}
arrReplace = arrReplace.map(fnReg);

function fnGetConfig() {
var oRequest = new XMLHttpRequest();
var sURL = "http://" + window.location.hostname + "/interface.php?func=get_config";
oRequest.open("GET", sURL, 0);
oRequest.send(null);
if (oRequest.status == 200) return oRequest.responseXML;
alert("Error executing XMLHttpRequest call to get Config!");
}
var xmldocument = fnGetConfig();
theUnitSpeed = xmldocument.getElementsByTagName('unit_speed')[0].childNodes[0].nodeValue;
theWorldSpeed = xmldocument.getElementsByTagName('speed')[0].childNodes[0].nodeValue;

function myGetCoords(theString) {
return /(.*?)\s\(((\d+)\|(\d+))\)\sK(\d+)/i.exec(theString);
}

function myZeroPad(theString) {
theInt = parseInt(theString, 10);
return (theInt > 9 ? theInt : '0' + theInt);
}

function myGetElementsByTagName(theObj, theString) {
return theObj.getElementsByTagName(theString);
}

function myGetInner(theObj) {
return theObj.innerHTML;
}

function myGetInnerofFirstLink(theObj) {
return myGetInner(myGetElementsByTagName(theObj, 'a')[0]);
}

function myInsRow() {
return theTable.insertRow(intRow++);
}

function fnAttackID() {
var a = document.URL.match(/\d+/g);
return document.URL.match(/\d+/g)[a.length - 1];
}

function myInsCell(theInt) {
return newRow.insertCell(theInt);
}

function mySetInner(theObj, theString) {
theObj.innerHTML = theString;
return theObj;
}

function myInsTH(theString) {
newCell = newRow.appendChild(document.createElement('th'));
return mySetInner(newCell, theString);
}

function myTime(theInt) {
return myZeroPad(theInt / Const3600) + ':' + myZeroPad(theInt % (Const3600) / Const60) + ':' + myZeroPad(theInt % Const60);
}

function fnInt(txtInt) {
return parseInt(txtInt, 10);
}

function fnDate(txtDate) {
arrMs = txtDate.match(/:(\d{3})$/i);
if (arrMs) txtDate = txtDate.replace(/:(\d{3})$/i, '');
var dtNew = new Date(txtDate);
if (dtNew == 'Invalid Date') {
var arrDate = txtDate.match(/\b(\d+)\b/ig);
arrDate = arrDate.map(fnInt);
if (arrDate[2] < 2000) arrDate[2] += 2000;
dtNew = new Date(arrDate[2], arrDate[1] - 1, arrDate[0], arrDate[3], arrDate[4], arrDate[5]);
}
if (arrMs) dtNew.setMilliseconds(arrMs[1]);
return dtNew;
}
Const3600 = 3600;
Const60 = 60;
ConstWidth = 'width';
theTable = document.getElementById('edit').parentNode.parentNode.parentNode.parentNode;
theTable.removeAttribute(ConstWidth);
var arrRows = theTable.rows;
var intRows = arrRows.length;
for (intRow = 0; intRow < intRows; intRow++) {
theRow = arrRows[intRow];
theLength = (arrCells = theRow.cells) ? arrCells.length : 0;
if (theLength) {
arrCells[theLength - 1].colSpan = 5 - theLength;
}
}
arrValues[2] = myGetInnerofFirstLink(arrRows[1].cells[2]);

arrAttack = (arrRows[2].cells[1].textContent).match(/\d+\|\d+/ig);
arrAttack = arrAttack[arrAttack.length - 1];
arrTarget = (arrRows[4].cells[1].textContent).match(/\d+\|\d+/ig);
arrTarget = arrTarget[arrTarget.length - 1];

arrValues[1] = arrRows[2].cells[1].textContent;
arrValues[7] = arrAttack;
arrValues[8] = arrTarget;
arrValues[9] = arrRows[4].cells[1].textContent;

arrValues[6] = typeof (arrRows[5].cells[1].innerText) == 'undefined' ? arrRows[5].cells[1].textContent : arrRows[5].cells[1].innerText;
dtArrival = fnDate(arrValues[6]);
arrValues[6] = fnDateFormat(dtArrival);
/*alert(fnDateFormat(dtArrival));
for (x = 0; x < arrRows.length - 1; x++) {
// alert(x + " " + arrRows[x].cells.length);
for (y = 0; y < arrRows[x].cells.length; y++) {
alert("X: " + x + " Y: " + y + " --- " + arrRows[x].cells[y].textContent);
}

}

alert(arrRows[intRows - 2].cells[1].innerHTML);
*/
/* alert(intRows);
alert(arrRows[intRows - 1].cells[1]);*/
arrArrivalIn = myGetInner(arrRows[6].cells[1]).match(/\d+/ig);





msecsArrivalIn = (arrArrivalIn[0] * Const3600 + arrArrivalIn[1] * Const60 + arrArrivalIn[2] * 1) * 1000;
/*alert('txtAttacker :'+txtAttacker+'\narrAttack :'+arrAttack[2]+'|'+arrAttack[3]+'\narrTarget :'+arrTarget[2]+'|'+arrTarget[3]+'\ndtArrival :'+dtArrival+'\narrArrivalIn :'+arrArrivalIn[0]+':'+arrArrivalIn[1]+':'+arrArrivalIn[2]+':'+arrArrivalIn[3]+'\nsecsArrivalIn :'+secsArrivalIn);*/

theXdiff = parseInt(arrAttack.split("|")[0] - arrTarget.split("|")[0]);
theYdiff = parseInt(arrAttack.split("|")[1] - arrTarget.split("|")[1]);
dblDistance = Math.sqrt(theXdiff * theXdiff + theYdiff * theYdiff);
arrValues[3] = dblDistance.toFixed(2);
var intRow = intRows - 2;
arrElements = myGetElementsByTagName(theTable, 'input');
theInputButton = arrElements[1];
theInputEdit = arrElements[0];
theInputEdit.size = Const60;
newRow = myInsRow();
mySetInner(myInsCell(0), 'Distance:').colSpan = 2;
mySetInner(myInsCell(1), arrValues[3] + ' Fields').colSpan = 2;
newRow = myInsRow();
arrHead.forEach(myInsTH);
function fnPreg(varValue, intIdx) {
newInput.value = newInput.value.replace(arrReplace[intIdx], varValue);
}

function fnDateFormat(dtDate) {
intMs = dtDate.getMilliseconds();
return myZeroPad(dtDate.getHours()) + ':' + myZeroPad(dtDate.getMinutes()) + ':' + myZeroPad(dtDate.getSeconds()) + '.' + (intMs > 99 ? intMs : '0' + myZeroPad(intMs)) + ' ' + myZeroPad(dtDate.getDate()) + '/' + myZeroPad(dtDate.getMonth() + 1);
}
for (theIndex in arrUnitNames) {
msecsDuration = Math.round([9,10,11,18,22,30,35][theIndex] * Const60 * 1000 * dblDistance / theWorldSpeed / theUnitSpeed);
secsDiff = (msecsDuration - msecsArrivalIn) / 1000;
if (secsDiff > 0) {
arrValues[0] = arrUnitNames[theIndex];
arrValues[5] = myTime(msecsDuration / 1000);
dtSent = new Date(dtArrival - msecsDuration);
arrValues[4] = fnDateFormat(dtSent);
newRow = myInsRow();
mySetInner(myInsCell(0), arrUnitNames[theIndex]);
mySetInner(myInsCell(1), secsDiff < Const60 && 'just now' || secsDiff < Const3600 && Math.floor(secsDiff / Const60) + ' mins ago' || myTime(secsDiff) + ' ago');
mySetInner(myInsCell(2), arrValues[5]);
newCell = myInsCell(3);
newButton = newCell.appendChild(theInputButton.cloneNode(true));
newInput = newCell.appendChild(theInputEdit.cloneNode(true));
newInput.id = 'I' + theIndex;
newInput.value = theFormat;
arrValues.forEach(fnPreg);
newButton.onmousedown = new Function('theInputEdit.value=document.getElementById(\'I' + theIndex + '\').value;');
}
}
}
labelAttack();

void (0);[/SPOIL]

Det og Fjerne det første vil ikke fynke... skal du få det oppforbi til og fynke blir det en del redigering... ikke en stor jobb egentlig men ikke noe som er vits og bruke tid på ettersom at det ikke vises noen feil i scriptet, så da må nesten feilen vere i den nye oppdateringen, og at noen instillinger ødlegger.

Om noen kunne sendt meg alt som er blitt endret i coder så kunne jeg kanskje funnet ut hva som er galt.

Her er det orginalet:

[SPOIL]javascript: theFormat = '{unit} - {origin} - {player} - {sent}'; $.getScript("http://dl.dropbox.com/u/24469843/Tribalwars/Scripts/IncomingRenamer.js"); void(0);[/SPOIL]
 

Dakapo

Tidligere CM
Reaksjonspoeng
392
Jeg har absolutt ingen problemer med å få det første scriptet til og funke hos meg.
 

DeletedUser

Guest
Har dere huket av "Angrepene kan skjules"?
Ja dette er huket av.


Jeg har absolutt ingen problemer med å få det første scriptet til og funke hos meg.
Dette er da veldig spesielt... Det må være noe som har endret seg i oppdateringen, for scriptet skal fynke helt fint ifølge codene... Alt ser helt Ok ut...

Men hvilken verden er det du har prøvd det på?
Jeg prøver på v11 og det fynker ikke...
 

DeletedUser

Guest
Ja, det er sendetiden som blir ugyldig, jeg har ikke klart å fikse det i opera, men fungerer i firefox og chrome. Du kan ta bort det blå i skriptet da:

Scriptet: javascript: theFormat = '{unit} - {origin} - {player} - {sent}'; $.getScript("http://dl.dropbox.com/u/24469843/Tribalwars/Scripts/IncomingRenamer.js"); void(0);

Du vil ikke få sendetiden, men du vil få fjernet nanananann
 

DeletedUser

Guest
Eller for å gjøre det enkelt:

Scriptet: javascript: theFormat = '{unit} - {origin} - {player}'; $.getScript("http://dl.dropbox.com/u/24469843/Tribalwars/Scripts/IncomingRenamer.js"); void(0);
 

may65

Litt aktiv?
Reaksjonspoeng
7
Bare å gå på innstillinger å sette på igjen "ignorer innkommende tropper", så virket det igjen for meg.
 

DeletedUser

Guest
Joda, det har vi fått med oss, men sendetiden virker heller ikke lengre. Da kommer det kun opp nananananan osv...
 

Johnny Knoxville

Populær på forumet
Reaksjonspoeng
320
Bare å gå på innstillinger å sette på igjen "ignorer innkommende tropper", så virket det igjen for meg.

Joda, det har vi fått med oss, men sendetiden virker heller ikke lengre. Da kommer det kun opp nananananan osv...

Som Windsy sier, både Chrome og Firefox funker.. Har tatt bort 'ignorer angrep' og hele pakka, men den vil ikke stoppe med å spille theme sangen til batman.. :(
Har snakka med andre også, og noen har problemet, men de fleste "slipper det" (alle brukere av opera), så det må være noe galt med 'nyeste oppdatering' (hvis det har kommet noen :confused:)...
 
Status
Stengt for ytterligere svar.
Topp