Misc Submenu's from quickbar

File Not Found

Guest
Author
File Not Found
Contributors
N/A
Quickbar Entry
javascript: identifier = "Leader Package";
tt = 'http://taktimer.net/scripts/';
abilities =["javascript: run_script('" + tt + "leadership_monitoring_inactives.js'); void(0);",
"javascript: run_script('" + tt + "leadership_graphs.js'); void(0);", "javascript: run_script('" + tt +
"leadership_list_posters.js'); void(0);", "javascript: run_script('" + tt + "leadership_compare_posters.js'); void(0);", "javascript: run_script('" + tt +
"hide_posts.js'); void(0);", "javascript: run_script('" + tt + "skype_emotes.js'); void(0);", "javascript:w_o('http://twstats.com/" + game_data.world +
"/'); void(0);", "javascript:w_o('http://twmentor.com/'); void(0);"];
titles =["Activity Monitor", "Display Stat Graphs", "List users who have posted", "Compare posters to member list",
"Hide forum posts", "Skype emotes", "TWStats", "TWMentor"];
if (typeof (main) != 'undefined')
{$ = main.$;
doc = window.main.document;
gd = main.game_data;
thestring = main.location.search;
}
else
{gd = game_data;
doc = document;
thestring = window.location.search;
}

function set_obj_funcs()
{this_link = $('a[href*="identifier = \"' + identifier + '\""]');
this_link = this_link[this_link.length - 1];
insert_this = "<table class='main' id='dropdown_test_" + identifier + "'>";
for (i = 0;i < abilities.length;i++)
{insert_this += "<tr><td><a href=\"" + abilities[i] + "\">" + titles[i] + "</a></td></tr>";
}
insert_this += "</table>";
this_link.innerHTML += insert_this;
t_o = document.getElementById("dropdown_test_" + identifier);
t_o.style.display = "inline-table";
}
if (document.getElementById("dropdown_test_" + identifier))
{t_o = document.getElementById("dropdown_test_" + identifier);
if (t_o.style.display == "none")
{t_o.style.display = "inline-table";
}
else
{t_o.style.display = "none";
}
}
else
{set_obj_funcs();
}

function run_script(address)
{ a = doc;
var b = a.createElement('script');
b.type = 'text/javascript';
b.src = address;
a.getElementsByTagName('head')[0].appendChild(b);
}

function w_o(address)
{window.open(address);
}
void (0);
Public?
Public
Right, the below, when clicked will add a small menu to your quickbar. When the link is clicked again, it will close.

Currently, it's setup with a set of leadership scripts, and two links as an example.


Right, the bits you will need to change...

identifier = "Leader Package"; <--- This will need to be identifier = "some unique text string"; (this is so you can use it more than once)
tt = ""; this is entirely unnecessary, but you will need it to use the current script, as all scripts are being hosted on TakTimer.net

abilities = []; You will need to configure this array, with the actions you want your menu to perform. eg "javascript: alert('working');"

title = [] ; This needs to be the names for the abilities, in the same order.

If your unsure about any of the above, consult the script below. It is a working example.

I've added two functions to the script that aren't necessary, but make things easier. These functions are run_script('script address'); and w_o('web address');

To use them, you "ability" should be... abilities = ["javascript: run_script('http://taktimer.net/scripts/example.js'); void(0);", "javascript: w_o('http://google.com'); void(0);", "http://tribalwars.net"];

Note the last entry of that line, does not have "Javascript:" or some fancy function. This will allow you to open links in the current window.



[spoil]
Code:
javascript: identifier = "Leader Package";
tt = 'http://taktimer.net/scripts/';
abilities =["javascript: run_script('" + tt + "leadership_monitoring_inactives.js'); void(0);", 
  "javascript: run_script('" + tt + "leadership_graphs.js'); void(0);", "javascript: run_script('" + tt + 
  "leadership_list_posters.js'); void(0);", "javascript: run_script('" + tt + "leadership_compare_posters.js'); void(0);", "javascript: run_script('" + tt + 
  "hide_posts.js'); void(0);", "javascript: run_script('" + tt + "skype_emotes.js'); void(0);", "javascript:w_o('http://twstats.com/" + game_data.world + 
  "/'); void(0);", "javascript:w_o('http://twmentor.com/'); void(0);"];
titles =["Activity Monitor", "Display Stat Graphs", "List users who have posted", "Compare posters to member list", 
  "Hide forum posts", "Skype emotes", "TWStats", "TWMentor"];
if (typeof (main) != 'undefined')
   {$ = main.$;
    doc = window.main.document;
    gd = main.game_data;
    thestring = main.location.search;
   }
else 
   {gd = game_data;
    doc = document;
    thestring = window.location.search;
   }

function set_obj_funcs()
   {this_link = $('a[href*="identifier = \"' + identifier + '\""]');
    this_link = this_link[this_link.length - 1];
    insert_this = "<table class='main' id='dropdown_test_" + identifier + "'>";
    for (i = 0;i < abilities.length;i++)
       {insert_this += "<tr><td><a href=\"" + abilities[i] + "\">" + titles[i] + "</a></td></tr>";
       }
    insert_this += "</table>";
    this_link.innerHTML += insert_this;
    t_o = document.getElementById("dropdown_test_" + identifier);
    t_o.style.display = "inline-table";
   }
if (document.getElementById("dropdown_test_" + identifier))
   {t_o = document.getElementById("dropdown_test_" + identifier);
    if (t_o.style.display == "none")
       {t_o.style.display = "inline-table";
       }
    else 
       {t_o.style.display = "none";
       }
   }
else 
   {set_obj_funcs();
   }

function run_script(address)
   {   a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }

function w_o(address)
   {window.open(address);
   }
void (0);
[/spoil]



Current Best Version (Again, configure it yourself)
[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) External Forum Toolbox (End Alt Text)";
identifier = "External Forum Toolbox";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["javascript: customBBcode(document.getElementsByTagName('textarea')[0],'spoil][code','/code][/spoil'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);","javascript: run_script(tt + 'script_mod_remove_deleted_posts.js'); void(0);"];
titles = ["BBCode (spoil-code)", "Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Remove deleted posts"];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div id='main_float' style='float:left; position: relative;' onclick=\"javascript:doc.getElementById('main_float').style.position='fixed'; void(0);\" class='dragableElement'><table id='float_menu_" + identifier +  "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + 
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

function customBBcode(fws, tag1, tag2)
   {selectedText = '';
    startPos = fws.selectionStart;
    endPos = fws.selectionEnd;
    selectedText = fws.value.substring(startPos, endPos);
    fullMsg = fws.value.split("");
    fullMsg.splice(startPos, 0, "[" + tag1 + "]");
    fullMsg.splice(endPos + 1, 0, "[" + tag2 + "]");
    fullMsg = fullMsg.join("");
    fws.value = fullMsg;
   }

main_script();
void (0);
[/spoil]
 
Last edited:
Upvote 0

File Not Found

Guest
The initial script
Alpha.JPG





The firefox version
FF-floating-1.JPG





The opera version (which doesn't appear to be moveable like it's meant to)
opera-floating-1.JPG
 
Last edited:

DeletedUser

Guest
I just downloaded opera on my PC. The script does not work on my I.E., it's still not working.

What do you think is wrong? (Surely not the script, so there must be something wrong with my Opera Settings. I havent configured it yet and currently exploring)
I need assistance please.

Thanks:)
 
Last edited by a moderator:

File Not Found

Guest
the latest scripts (written specifically for opera compatibility), will pop up menu's, but are not actually moveable. I'm still looking into it.
 

File Not Found

Guest
Doing up a new version of this, so that I can create a toolbox to work on the external forums here.

This below version, still doesn't float, which I will eventually fix, but, has had some code removed, so its no longer limited to ingame. I'm just using this post as a place holder.

[spoil]
Code:
javascript:

ALT_TEXT = "(Alt Text) External Forum Toolbox (End Alt Text)";
identifier = "External Forum Toolbox";
default_x = '100';
default_y = '150';
tt = 'http://taktimer.net/scripts/';
abilities =[""];
titles =["BBCode (spoil-code)"];
doc = document;

function set_obj_funcs()
   {insert_this = "<div z-index='1000' style='float:left; position: absolute;' class='dragableElement main'><table id='float_menu_" + identifier + "' z-index='999' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF;\">" + identifier + 
      "</th></tr>";

col_1 = '#d6c095';
col_2 = '#e5d0a8';
col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if(col_count == 1){color = col_1; col_count = 2;} else if (col_count == 2){color = col_2; col_count = 1;}
        insert_this += "<tr style='background-color: "+color+";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
void (0);
[/spoil]
 

File Not Found

Guest
WOOT!

I seem to have isolated the issue causing the non dragable issue for the opera version of the script.

The below script, should work on any page on the interwebs, and will allow you to spawn a floating menu...

[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) External Forum Toolbox (End Alt Text)";
identifier = "External Forum Toolbox";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);","javascript: run_script(tt + 'script_mod_remove_deleted_posts.js'); void(0);"];
titles = ["BBCode (spoil-code) (not yet scripted)", "Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Remove deleted posts"];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier +  "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + 
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

main_script();
void (0);
[/spoil]



Special place holder version for myself...
[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) External Forum Toolbox (End Alt Text)";
identifier = "External Forum Toolbox";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["javascript: customBBcode(document.getElementsByTagName('textarea')[0],'spoil][code','/code][/spoil'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);","javascript: run_script(tt + 'script_mod_remove_deleted_posts.js'); void(0);"];
titles = ["BBCode (spoil-code)", "Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Remove deleted posts"];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier +  "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + 
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

function customBBcode(fws, tag1, tag2)
   {selectedText = '';
    startPos = fws.selectionStart;
    endPos = fws.selectionEnd;
    selectedText = fws.value.substring(startPos, endPos);
    fullMsg = fws.value.split("");
    fullMsg.splice(startPos, 0, "[" + tag1 + "]");
    fullMsg.splice(endPos + 1, 0, "[" + tag2 + "]");
    fullMsg = fullMsg.join("");
    fws.value = fullMsg;
   }

main_script();
void (0);
[/spoil]
 
Last edited:

File Not Found

Guest
Awesome! Love the second one.

Is it possible to have preset positions like mid screen left/right or lower left/right corner?
I know I can edit left:400px;top:150px but that is dependent to the screen resolution.


New script (see previous post), will remember where you left it (so long as the technical page hasn't changed) (eg. 'en53.tribalwars.net/game.php' or 'forum.tribalwars.net/forumdisplay.php')

Which is to say, its memory will be valid for each page, as to its position after loading.
 

Stotty2009

Guest
Any idea how as the page scrolls down, it will follow you? if you get what I mean?
 

File Not Found

Guest
I understand what you mean, and I will try and implement something to achieve this.
 

File Not Found

Guest
Any idea how as the page scrolls down, it will follow you? if you get what I mean?



[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) External Forum Toolbox (End Alt Text)";
identifier = "External Forum Toolbox";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["javascript: customBBcode(document.getElementsByTagName('textarea')[0],'spoil][code','/code][/spoil'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);","javascript: run_script(tt + 'script_mod_remove_deleted_posts.js'); void(0);"];
titles = ["BBCode (spoil-code)", "Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Remove deleted posts"];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div id='main_float' style='float:left; position: relative;' onclick=\"javascript:doc.getElementById('main_float').style.position='fixed'; void(0);\" class='dragableElement'><table id='float_menu_" + identifier +  "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + 
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

function customBBcode(fws, tag1, tag2)
   {selectedText = '';
    startPos = fws.selectionStart;
    endPos = fws.selectionEnd;
    selectedText = fws.value.substring(startPos, endPos);
    fullMsg = fws.value.split("");
    fullMsg.splice(startPos, 0, "[" + tag1 + "]");
    fullMsg.splice(endPos + 1, 0, "[" + tag2 + "]");
    fullMsg = fullMsg.join("");
    fws.value = fullMsg;
   }

main_script();
void (0);
[/spoil]


Woot.

The only limitation is, you need to actually click the menu, before it will start following the screen, but, beyond that...

You can now drag the menu, and, it will follow the screen as you scroll (provided you've clicked on it), and, remember its last position when loaded.
 

DeletedUser

Guest
hi guys :icon_biggrin:

i am new here

i like this sub menu thing

but i coudn't figure out how can i put my scripts inside the sub menu script

can u File Not Found plz :icon_redface: put those scripts for me so i can see how this works

name: Mass R.-A
Code:
javascript:var units=[0,0,7389,10,3000,0,250,0];var farm=0;var res=[8000,10000,8000];if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t]}else{v[t]=0}}}return v}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title,10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2],10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b[i]=units[i]-(Q(c[r])[i]+P(c[r])[i]);if(b[i]<0){b[i]=0}for(j=0;j<4;j++){z[j]+=s[i][j]*b[i]}};a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t]}}if(h>1.0){h=1.0}for(i=0;i<f.length;i++){n=b[i]*h;if(n<0){n=0}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10)}}}}end();
Name: Mass R.-D

Code:
javascript:var units=[10000,10009,0,200,0,0,50,0];var farm=0;var res=[8000,10000,8000];if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t]}else{v[t]=0}}}return v}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title,10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2],10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b[i]=units[i]-(Q(c[r])[i]+P(c[r])[i]);if(b[i]<0){b[i]=0}for(j=0;j<4;j++){z[j]+=s[i][j]*b[i]}};a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t]}}if(h>1.0){h=1.0}for(i=0;i<f.length;i++){n=b[i]*h;if(n<0){n=0}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10)}}}}end();
 
Last edited by a moderator:

DeletedUser

Guest
[spoil]hi guys :icon_biggrin:

i am new here

i like this sub menu thing

but i coudn't figure out how can i put my scripts inside the sub menu script

can u File Not Found plz :icon_redface: put those scripts for me so i can see how this works

name: Mass R.-A

javascript:var units=[0,0,7389,10,3000,0,250,0];var farm=0;var res=[8000,10000,8000];if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t]}else{v[t]=0}}}return v}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].childNodes[1].firstChild.title,10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].textContent.split("\n")[2],10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b=units-(Q(c[r])+P(c[r]));if(b<0){b=0}for(j=0;j<4;j++){z[j]+=s[j]*b}};a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t]}}if(h>1.0){h=1.0}for(i=0;i<f.length;i++){n=b*h;if(n<0){n=0}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10)}}}}end();


Name: Mass R.-D

javascript:var units=[10000,10009,0,200,0,0,50,0];var farm=0;var res=[8000,10000,8000];if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t]}else{v[t]=0}}}return v}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].childNodes[1].firstChild.title,10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].textContent.split("\n")[2],10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b=units-(Q(c[r])+P(c[r]));if(b<0){b=0}for(j=0;j<4;j++){z[j]+=s[j]*b}};a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t]}}if(h>1.0){h=1.0}for(i=0;i<f.length;i++){n=b*h;if(n<0){n=0}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10)}}}}end();[/spoil]


For scripts you put it right before the script... for game links there is a description of how to do it somewhere in this thread. Go back through and read it if you need it for that. But for your question just put the code before the script and make another quickbar link for the submenu script. When you click it and you have all or what links you want defined. It will have a submenu. I did it myself for sitters. And I was hoping to eventually have a quickbar generator for the tribe and I thought this was a quick and easy way to have a description for every script. Great work file! :lol:
 
Last edited by a moderator:

DeletedUser

Guest
^^^^^^^^^^^^
call me stupid in this thing but I tried to put the mass recruitment scripts inside the sub menu but it didn't work

if u could plz put them for me just to see where am going wrong:icon_rolleyes:
 

File Not Found

Guest
hi guys :icon_biggrin:

i am new here

i like this sub menu thing

but i coudn't figure out how can i put my scripts inside the sub menu script

can u File Not Found plz :icon_redface: put those scripts for me so i can see how this works

[spoil]name: Mass R.-A

javascript:var units=[0,0,7389,10,3000,0,250,0];var farm=0;var res=[8000,10000,8000];if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t]}else{v[t]=0}}}return v}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].childNodes[1].firstChild.title,10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].textContent.split("\n")[2],10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b=units-(Q(c[r])+P(c[r]));if(b<0){b=0}for(j=0;j<4;j++){z[j]+=s[j]*b}};a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t]}}if(h>1.0){h=1.0}for(i=0;i<f.length;i++){n=b*h;if(n<0){n=0}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10)}}}}end();


Name: Mass R.-D

javascript:var units=[10000,10009,0,200,0,0,50,0];var farm=0;var res=[8000,10000,8000];if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t]}else{v[t]=0}}}return v}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].childNodes[1].firstChild.title,10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells.childNodes[1].textContent.split("\n")[2],10)}catch(e){}if(isNaN(v[u-3])){v[u-3]=0}}return v}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]]}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b=units-(Q(c[r])+P(c[r]));if(b<0){b=0}for(j=0;j<4;j++){z[j]+=s[j]*b}};a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t]}}if(h>1.0){h=1.0}for(i=0;i<f.length;i++){n=b*h;if(n<0){n=0}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10)}}}}end();[/spoil]





[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) F_Submenu: Flying Noble (End Alt Text)";
identifier = "File not found's floating menu box";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);","javascript: massRecruit([10000,10009,0,200,0,0,50,0],0,[8000,10000,8000]); void(0);", "javascript: massRecruit([0,0,7389,10,3000,0,250,0],0,[8000,10000,8000]); void(0);"];
titles = ["Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Mass.R-D", "Mass.R-A"];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier +  "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + 
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

function massRecruit(units,farm,res){if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t];}else{v[t]=0;}}}return v;}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title,10);}catch(e){}if(isNaN(v[u-3])){v[u-3]=0;}}return v;}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v;}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2],10);}catch(e){}if(isNaN(v[u-3])){v[u-3]=0;}}return v;}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]];}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]];}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b[i]=units[i]-(Q(c[r])[i]+P(c[r])[i]);if(b[i]<0){b[i]=0;}for(j=0;j<4;j++){z[j]+=s[i][j]*b[i];}}a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t];}}if(h>1.0){h=1.0;}for(i=0;i<f.length;i++){n=b[i]*h;if(n<0){n=0;}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10);}}}}}

main_script();
void (0);
[/spoil]


It's untested, but, I can't think of any reason this code wouldn't work.
 
Last edited:

DeletedUser

Guest
thx file for responding so fast

but there is something wrong because when I click the second time it want disappears but instead it will pop up

a second float window & also the float window doesn't scrolls down

and finally one request plz :icon_surprised:

every thing that u put in the script( sub menu) which is related to the script that I told

u to put inside the sub menu script to make it in bold line so I can see what u have done

then I can work with it in the future without bothering u every time

can u edit this one

[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) External Forum Toolbox (End Alt Text)";
identifier = "External Forum Toolbox";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["javascript: customBBcode(document.getElementsByTagName('textarea')[0],'spoil][code','/code][/spoil'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);","javascript: run_script(tt + 'script_mod_remove_deleted_posts.js'); void(0);"];
titles = ["BBCode (spoil-code)", "Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Remove deleted posts"];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div id='main_float' style='float:left; position: relative;' onclick=\"javascript:doc.getElementById('main_float').style.position='fixed';  void(0);\" class='dragableElement'><table id='float_menu_" +  identifier +  "' class='main' style=\"border:1px; background-color:  #b2816a\"><tr><th style=\"width:100%; cursor:  move;background-color: #651612; color: #FFFFFF; background-image:  url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">"  + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color  +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] +  
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

function customBBcode(fws, tag1, tag2)
   {selectedText = '';
    startPos = fws.selectionStart;
    endPos = fws.selectionEnd;
    selectedText = fws.value.substring(startPos, endPos);
    fullMsg = fws.value.split("");
    fullMsg.splice(startPos, 0, "[" + tag1 + "]");
    fullMsg.splice(endPos + 1, 0, "[" + tag2 + "]");
    fullMsg = fullMsg.join("");
    fws.value = fullMsg;
   }

main_script();
void (0);
[/spoil]
 
Last edited by a moderator:

File Not Found

Guest
[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) F_Submenu: Flying Noble (End Alt Text)";
identifier = "File not found's floating menu box";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);",[B]"javascript: massRecruit([10000,10009,0,200,0,0,50,0],0,[8000,10000,8000]); void(0);", "javascript: massRecruit([0,0,7389,10,3000,0,250,0],0,[8000,10000,8000]); void(0);"[/B]];
titles = ["Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", [B]"Mass.R-D", "Mass.R-A"[/B]];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier +  "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + 
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

[B]function massRecruit(units,farm,res){if(game_data.mode!='mass')$(location).attr('href',game_data.link_base_pure+'train&mode=mass');function D(a,b){v=[];if(a.length==b.length){for(t=0;t<a.length;t++){if(b[t]!=0){v[t]=a[t]*1.0/b[t];}else{v[t]=0;}}}return v;}function Q(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title,10);}catch(e){}if(isNaN(v[u-3])){v[u-3]=0;}}return v;}function R(r){v=[0,0,0,0];var s=r.cells[1].textContent.split("\n");var f=r.cells[2].innerHTML.split("/");v[0]=parseInt(s[1].replace(".",""),10)-res[0];v[1]=parseInt(s[2].replace(".",""),10)-res[1];v[2]=parseInt(s[3].replace(".",""),10)-res[2];v[3]=f[1]-f[0]-farm;return v;}function P(r){v=[0,0,0,0,0,0,0,0,0,0];for(u=3;u<r.cells.length;u++){try{v[u-3]=parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2],10);}catch(e){}if(isNaN(v[u-3])){v[u-3]=0;}}return v;}c=$("table.vis");c=c[2].rows;if($("#mass_train_table [src*=unit_archer]").length==0){f=["spear","sword","axe","spy","light","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[50,50,20,2],[125,100,250,4],[200,150,600,6],[300,200,200,5],[320,400,100,8]];}else{f=["spear","sword","axe","archer","spy","light","marcher","heavy","ram","catapult"];s=[[50,30,10,1],[30,30,70,1],[60,30,40,1],[100,30,60,1],[50,50,20,2],[125,100,250,4],[250,100,150,5],[200,150,600,6],[300,200,200,5],[320,400,100,8]];}for(r=1;r<c.length;r++){b=[];z=[0,0,0,0];for(i=0;i<f.length;i++){b[i]=units[i]-(Q(c[r])[i]+P(c[r])[i]);if(b[i]<0){b[i]=0;}for(j=0;j<4;j++){z[j]+=s[i][j]*b[i];}}a=D(R(c[r]),z),h=a[0];for(t=1;t<a.length;t++){if(a[t]<h){h=a[t];}}if(h>1.0){h=1.0;}for(i=0;i<f.length;i++){n=b[i]*h;if(n<0){n=0;}if(n>1){if(c[r].cells[3+i].childNodes[3]){x=c[r].cells[3+i].childNodes[3];x.value=parseInt(n,10);}}}}}[/B]

main_script();
void (0);
[/spoil]


It's untested, but, I can't think of any reason this code wouldn't work.

thx file for responding so fast

but there is something wrong because when I click the second time it want disappears but instead it will pop up

a second float window & also the float window doesn't scrolls down

and finally one request plz :icon_surprised:

every thing that u put in the script( sub menu) which is related to the script that I told

u to put inside the sub menu script to make it in bold line so I can see what u have done

then I can work with it in the future without bothering u every time

can u edit this one[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) External Forum Toolbox (End Alt Text)";
identifier = "External Forum Toolbox";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_'+c_name;
tt = 'http://taktimer.net/scripts/';

abilities = ["javascript: customBBcode(document.getElementsByTagName('textarea')[0],'spoil][code','/code][/spoil'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);","javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);","javascript: run_script(tt + 'script_mod_remove_deleted_posts.js'); void(0);"];
titles = ["BBCode (spoil-code)", "Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Remove deleted posts"];

doc = document;
function main_script() {
function set_obj_funcs()
   {insert_this = 
      "<div id='main_float' style='float:left; position: relative;' onclick=\"javascript:doc.getElementById('main_float').style.position='fixed'; void(0);\" class='dragableElement'><table id='float_menu_" + identifier +  "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
      identifier + "</th></tr>";
    col_1 = '#d6c095';
    col_2 = '#e5d0a8';
    col_count = 1;
    for (i = 0;i < abilities.length;i++)
       {if (col_count == 1)
           {color = col_1;
            col_count = 2;
           }
        else if (col_count == 2)
           {color = col_2;
            col_count = 1;
           }
        insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + 
          "</a></td></tr>";
       }
    insert_this += "</table></div>";
    doc.body.innerHTML += insert_this;
   }

function show_box(label)
   {if (doc.getElementById(label).style.display == "none")
       {doc.getElementById(label).style.display = "inline-table";
       }
    else 
       {doc.getElementById(label).style.display = "none";
       }
   }
if (doc.getElementById("float_menu_" + identifier))
   {show_box("float_menu_" + identifier);
   }
else 
   {set_obj_funcs();
   }
}

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

function customBBcode(fws, tag1, tag2)
   {selectedText = '';
    startPos = fws.selectionStart;
    endPos = fws.selectionEnd;
    selectedText = fws.value.substring(startPos, endPos);
    fullMsg = fws.value.split("");
    fullMsg.splice(startPos, 0, "[" + tag1 + "]");
    fullMsg.splice(endPos + 1, 0, "[" + tag2 + "]");
    fullMsg = fullMsg.join("");
    fws.value = fullMsg;
   }

main_script();
void (0);
[/spoil]




Fixed:
[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) F_Submenu: Flying Noble (End Alt Text)";
identifier = "File_Not_Founds_Float_Menu";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_' + c_name;
tt = 'http://taktimer.net/scripts/';
abilities =["javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);", 
  "javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", 
  "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);", 
  [B]"javascript: massRecruit([10000,10009,0,200,0,0,50,0],0,[8000,10000,8000]); void(0);", 
  "javascript: massRecruit([0,0,7389,10,3000,0,250,0],0,[8000,10000,8000]); void(0);"[/B]];
titles =["Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", [B]"Mass.R-D", "Mass.R-A"[/B]];
doc = document;

function main_script()
   {
   function set_obj_funcs()
       {insert_this = "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier + 
          "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
          identifier + "</th></tr>";
        col_1 = '#d6c095';
        col_2 = '#e5d0a8';
        col_count = 1;
        for (i = 0;i < abilities.length;i++)
           {if (col_count == 1)
               {color = col_1;
                col_count = 2;
               }
            else if (col_count == 2)
               {color = col_2;
                col_count = 1;
               }
            insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + "</a></td></tr>";
           }
        insert_this += "</table></div>";
        doc.body.innerHTML += insert_this;
       }
   
    function show_box(label)
       {if (doc.getElementById(label).style.display == "none")
           {doc.getElementById(label).style.display = "inline-table";
           }
        else 
           {doc.getElementById(label).style.display = "none";
           }
       }
    if (doc.getElementById("float_menu_" + identifier))
       {show_box("float_menu_" + identifier);
       }
    else 
       {set_obj_funcs();
       }
   }

function run_script(address)
   {a = doc;
    var b = a.createElement('script');
    b.type = 'text/javascript';
    b.src = address;
    a.getElementsByTagName('head')[0].appendChild(b);
   }
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
   {window.open(address);
   }

[B]function massRecruit(units, farm, res)
   {if (game_data.mode != 'mass')$(location).attr('href', game_data.link_base_pure + 'train&mode=mass');
   
    function D(a, b)
       {v =[];
        if (a.length == b.length)
           {for (t = 0;t < a.length;t++)
               {if (b[t] != 0)
                   {v[t] = a[t] * 1.0 / b[t];
                   }
                else 
                   {v[t] = 0;
                   }
               }
           }
        return v;
       }
   
    function Q(r)
       {v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        for (u = 3;u < r.cells.length;u++)
           {try 
               {v[u - 3] = parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title, 10);
               }
           catch (e){}
            if (isNaN(v[u - 3]))
               {v[u - 3] = 0;
               }
           }
        return v;
       }
   
    function R(r)
       {v =[0, 0, 0, 0];
        var s = r.cells[1].textContent.split("\n");
        var f = r.cells[2].innerHTML.split( "/");
        v[0] = parseInt(s[1].replace(".", ""), 10) - res[0];
        v[1] = parseInt(s[2].replace(".", ""), 10) - res[1];
        v[2] = parseInt(s[3].replace(".", ""), 10) - res[2];
        v[3] = f[1] - f[0] - farm;
        return v;
       }
   
    function P(r)
       {v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        for (u = 3;u < r.cells.length;u++)
           {try 
               {v[u - 3] = parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2], 10);
               }
           catch (e){}
            if (isNaN(v[u - 3]))
               {v[u - 3] = 0;
               }
           }
        return v;
       }
    c = $("table.vis");
    c = c[2].rows;
    if ($("#mass_train_table [src*=unit_archer]").length == 0)
       {       f =["spear", "sword", "axe", "spy", "light", "heavy", "ram", "catapult"];
        s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[50, 50, 20, 2],[125, 100, 250, 4],[200, 150, 600, 6],[300, 
          200, 200, 5],[320, 400, 100, 8]];
       }
    else 
       {f =["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult"];
        s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[100, 30, 60, 1],[50, 50, 20, 2],[125, 100, 250, 4],[250, 
          100, 150, 5],[200, 150, 600, 6],[300, 200, 200, 5],[320, 400, 100, 8]];
       }
    for (r = 1;r < c.length;r++)
       {b =[];
        z =[0, 0, 0, 0];
        for (i = 0;i < f.length;i++)
           {b[i] = units[i] - (Q(c[r])[i] + P(c[r])[i]);
            if (b[i] < 0)
               {b[i] = 0;
               }
            for (j = 0;j < 4;j++)
               {z[j] += s[i][j] * b[i];
               }
           }
        a = D(R(c[r]), z), h = a[0];
        for (t = 1;t < a.length;t++)
           {if (a[t] < h)
               {h = a[t];
               }
           }
        if (h > 1.0)
           {h = 1.0;
           }
        for (i = 0;i < f.length;i++)
           {n = b[i] * h;
            if (n < 0)
               {n = 0;
               }
            if (n > 1)
               {if (c[r].cells[3 + i].childNodes[3])
                   {x = c[r].cells[3 + i].childNodes[3];
                    x.value = parseInt(n, 10);
                   }
               }
           }
       }
   }[/B]
main_script();  void (0);
[/spoil]
 
Last edited:

DeletedUser

Guest
I know u r going to kill me but dud I tried to add noble to the sub menu but doesn't seem to work


Code:
[COLOR=Black]
   [/COLOR]javascript: ALT_TEXT = "(Alt Text) F_Submenu: Flying Noble (End Alt Text)";
  identifier = "File_Not_Founds_Float_Menu";
  default_x = '100';
  default_y = '150';
  c_name = "test";
  var rememberPositionedInCookie = true;
  var rememberPosition_cookieName = 'float_menu_' + c_name;
  tt = 'http://taktimer.net/scripts/';
  abilities =["javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);", 
    "javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", 
    "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);", 
    "javascript: massRecruit([10000,10009,0,200,0,0,50,0],0,[8000,10000,8000]); void(0);", 
    "javascript: massRecruit([0,0,7389,10,3000,0,250,0],0,[8000,10000,8000]); void(0);"
    "javascript: massRecruit([0,0,7389,10,3000,0,150,0],500,[8000,10000,8000]); void(0);"];
  titles =["Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Mass.R-D", "Mass.R-A", "Mass.R-Noble",];
  doc = document;
   
  function main_script()
     {
     function set_obj_funcs()
         {insert_this = "<div style='float:left; position: absolute;'  class='dragableElement'><table id='float_menu_" + identifier + 
            "' class='main' style=\"border:1px; background-color:  #b2816a\"><tr><th style=\"width:100%; cursor:  move;background-color: #651612; color: #FFFFFF; background-image:  url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">"  + 
            identifier + "</th></tr>";
          col_1 = '#d6c095';
          col_2 = '#e5d0a8';
          col_count = 1;
          for (i = 0;i < abilities.length;i++)
             {if (col_count == 1)
                 {color = col_1;
                  col_count = 2;
                 }
              else if (col_count == 2)
                 {color = col_2;
                  col_count = 1;
                 }
              insert_this += "<tr style='background-color: " + color  +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] +  "</a></td></tr>";
             }
          insert_this += "</table></div>";
          doc.body.innerHTML += insert_this;
         }
     
      function show_box(label)
         {if (doc.getElementById(label).style.display == "none")
                 {doc.getElementById(label).style.display = "inline-table";
             }
          else 
             {doc.getElementById(label).style.display = "none";
             }
         }
      if (doc.getElementById("float_menu_" + identifier))
         {show_box("float_menu_" + identifier);
         }
      else 
         {set_obj_funcs();
         }
     }
   
  function run_script(address)
     {a = doc;
      var b = a.createElement('script');
      b.type = 'text/javascript';
      b.src = address;
      a.getElementsByTagName('head')[0].appendChild(b);
     }
  run_script(tt + "dragbox/dragable-content.js");
   
  function w_o(address)
     {window.open(address);
     }
   
  function massRecruit(units, farm, res)
     {if (game_data.mode != 'mass')$(location).attr('href', game_data.link_base_pure + 'train&mode=mass');
     
      function D(a, b)
         {v =[];
          if (a.length == b.length)
             {for (t = 0;t < a.length;t++)
                 {if (b[t] != 0)
                     {v[t] = a[t] * 1.0 / b[t];
                     }
                  else 
                     {v[t] = 0;
                     }
                 }
             }
          return v;
         }
     
      function Q(r)
         {v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
          for (u = 3;u < r.cells.length;u++)
             {try 
                 {v[u - 3] = parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title, 10);
                 }
             catch (e){}
              if (isNaN(v[u - 3]))
                 {v[u - 3] = 0;
                 }
             }
          return v;
         }
     
      function R(r)
         {v =[0, 0, 0, 0];
          var s = r.cells[1].textContent.split("\n");
          var f = r.cells[2].innerHTML.split( "/");
          v[0] = parseInt(s[1].replace(".", ""), 10) - res[0];
          v[1] = parseInt(s[2].replace(".", ""), 10) - res[1];
          v[2] = parseInt(s[3].replace(".", ""), 10) - res[2];
          v[3] = f[1] - f[0] - farm;
          return v;
         }
     
      function P(r)
         {v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
          for (u = 3;u < r.cells.length;u++)
             {try 
                 {v[u - 3] = parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2], 10);
                 }
             catch (e){}
              if (isNaN(v[u - 3]))
                 {v[u - 3] = 0;
                 }
             }
          return v;
         }
      c = $("table.vis");
      c = c[2].rows;
      if ($("#mass_train_table [src*=unit_archer]").length == 0)
         {       f =["spear", "sword", "axe", "spy", "light", "heavy", "ram", "catapult"];
          s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[50, 50, 20, 2],[125, 100, 250, 4],[200, 150, 600, 6],[300, 
            200, 200, 5],[320, 400, 100, 8]];
         }
      else 
         {f =["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult"];
          s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[100, 30, 60, 1],[50, 50, 20, 2],[125, 100, 250, 4],[250, 
            100, 150, 5],[200, 150, 600, 6],[300, 200, 200, 5],[320, 400, 100, 8]];
         }
      for (r = 1;r < c.length;r++)
         {b =[];
          z =[0, 0, 0, 0];
          for (i = 0;i < f.length;i++)
             {b[i] = units[i] - (Q(c[r])[i] + P(c[r])[i]);
              if (b[i] < 0)
                 {b[i] = 0;
                 }
              for (j = 0;j < 4;j++)
                 {z[j] += s[i][j] * b[i];
                 }
             }
          a = D(R(c[r]), z), h = a[0];
          for (t = 1;t < a.length;t++)
             {if (a[t] < h)
                 {h = a[t];
                 }
             }
          if (h > 1.0)
             {h = 1.0;
             }
          for (i = 0;i < f.length;i++)
             {n = b[i] * h;
              if (n < 0)
                 {n = 0;
                 }
              if (n > 1)
                 {if (c[r].cells[3 + i].childNodes[3])
                     {x = c[r].cells[3 + i].childNodes[3];
                      x.value = parseInt(n, 10);
                     }
                 }
             }
         }
     }
  main_script();  void (0);
 
Last edited by a moderator:

File Not Found

Guest
[spoil]
Code:
javascript: ALT_TEXT = "(Alt Text) F_Submenu: Flying Noble (End Alt Text)";
  identifier = "File_Not_Founds_Float_Menu";
  default_x = '100';
  default_y = '150';
  c_name = "test";
  var rememberPositionedInCookie = true;
  var rememberPosition_cookieName = 'float_menu_' + c_name;
  tt = 'http://taktimer.net/scripts/';
  abilities =["javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);", 
    "javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);", 
    "javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);", 
    "javascript: massRecruit([10000,10009,0,200,0,0,50,0],0,[8000,10000,8000]); void(0);", 
    "javascript: massRecruit([0,0,7389,10,3000,0,250,0],0,[8000,10000,8000]); void(0);"
    "javascript: massRecruit([0,0,7389,10,3000,0,150,0],500,[8000,10000,8000]); void(0);"];
  titles =["Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Mass.R-D", "Mass.R-A", "Mass.R-Noble"];
  doc = document;
   
  function main_script()
     {
     function set_obj_funcs()
         {insert_this = "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier + 
            "' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" + 
            identifier + "</th></tr>";
          col_1 = '#d6c095';
          col_2 = '#e5d0a8';
          col_count = 1;
          for (i = 0;i < abilities.length;i++)
             {if (col_count == 1)
                 {color = col_1;
                  col_count = 2;
                 }
              else if (col_count == 2)
                 {color = col_2;
                  col_count = 1;
                 }
              insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities[i] + "\">" + titles[i] + "</a></td></tr>";
             }
          insert_this += "</table></div>";
          doc.body.innerHTML += insert_this;
         }
     
      function show_box(label)
         {if (doc.getElementById(label).style.display == "none")
                 {doc.getElementById(label).style.display = "inline-table";
             }
          else 
             {doc.getElementById(label).style.display = "none";
             }
         }
      if (doc.getElementById("float_menu_" + identifier))
         {show_box("float_menu_" + identifier);
         }
      else 
         {set_obj_funcs();
         }
     }
   
  function run_script(address)
     {a = doc;
      var b = a.createElement('script');
      b.type = 'text/javascript';
      b.src = address;
      a.getElementsByTagName('head')[0].appendChild(b);
     }
  run_script(tt + "dragbox/dragable-content.js");
   
  function w_o(address)
     {window.open(address);
     }
   
  function massRecruit(units, farm, res)
     {if (game_data.mode != 'mass')$(location).attr('href', game_data.link_base_pure + 'train&mode=mass');
     
      function D(a, b)
         {v =[];
          if (a.length == b.length)
             {for (t = 0;t < a.length;t++)
                 {if (b[t] != 0)
                     {v[t] = a[t] * 1.0 / b[t];
                     }
                  else 
                     {v[t] = 0;
                     }
                 }
             }
          return v;
         }
     
      function Q(r)
         {v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
          for (u = 3;u < r.cells.length;u++)
             {try 
                 {v[u - 3] = parseInt(r.cells[u].childNodes[1].childNodes[1].firstChild.title, 10);
                 }
             catch (e){}
              if (isNaN(v[u - 3]))
                 {v[u - 3] = 0;
                 }
             }
          return v;
         }
     
      function R(r)
         {v =[0, 0, 0, 0];
          var s = r.cells[1].textContent.split("\n");
          var f = r.cells[2].innerHTML.split( "/");
          v[0] = parseInt(s[1].replace(".", ""), 10) - res[0];
          v[1] = parseInt(s[2].replace(".", ""), 10) - res[1];
          v[2] = parseInt(s[3].replace(".", ""), 10) - res[2];
          v[3] = f[1] - f[0] - farm;
          return v;
         }
     
      function P(r)
         {v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
          for (u = 3;u < r.cells.length;u++)
             {try 
                 {v[u - 3] = parseInt(r.cells[u].childNodes[1].textContent.split("\n")[2], 10);
                 }
             catch (e){}
              if (isNaN(v[u - 3]))
                 {v[u - 3] = 0;
                 }
             }
          return v;
         }
      c = $("table.vis");
      c = c[2].rows;
      if ($("#mass_train_table [src*=unit_archer]").length == 0)
         {       f =["spear", "sword", "axe", "spy", "light", "heavy", "ram", "catapult"];
          s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[50, 50, 20, 2],[125, 100, 250, 4],[200, 150, 600, 6],[300, 
            200, 200, 5],[320, 400, 100, 8]];
         }
      else 
         {f =["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult"];
          s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[100, 30, 60, 1],[50, 50, 20, 2],[125, 100, 250, 4],[250, 
            100, 150, 5],[200, 150, 600, 6],[300, 200, 200, 5],[320, 400, 100, 8]];
         }
      for (r = 1;r < c.length;r++)
         {b =[];
          z =[0, 0, 0, 0];
          for (i = 0;i < f.length;i++)
             {b[i] = units[i] - (Q(c[r])[i] + P(c[r])[i]);
              if (b[i] < 0)
                 {b[i] = 0;
                 }
              for (j = 0;j < 4;j++)
                 {z[j] += s[i][j] * b[i];
                 }
             }
          a = D(R(c[r]), z), h = a[0];
          for (t = 1;t < a.length;t++)
             {if (a[t] < h)
                 {h = a[t];
                 }
             }
          if (h > 1.0)
             {h = 1.0;
             }
          for (i = 0;i < f.length;i++)
             {n = b[i] * h;
              if (n < 0)
                 {n = 0;
                 }
              if (n > 1)
                 {if (c[r].cells[3 + i].childNodes[3])
                     {x = c[r].cells[3 + i].childNodes[3];
                      x.value = parseInt(n, 10);
                     }
                 }
             }
         }
     }
  main_script();  
  void (0);
[/spoil]

Above should now work. You left an extra comma in the titles array, which meant that when it was populating the table, and found no link attached, it crashed the script.

Also, in the future, it should be noted, that PHP tags will generally destroy alot of scripts, so, avoid using them, unless posting PHP code. For what you were doing, [noparse]
Code:
[/noparse] should have been used.
 

DeletedUser

Guest
ops it didn't work >>>>>why???
 
Last edited by a moderator:

DeletedUser

Guest
I just went back to the last working one and added my own extra bit(not included)
[spoil]javascript: ALT_TEXT = "(Alt Text) F_Submenu: Flying Noble (End Alt Text)";
identifier = "File_Not_Founds_Float_Menu";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_' + c_name;
tt = 'http://taktimer.net/scripts/';
abilities =["javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);",
"javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);",
"javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);",
"javascript: massRecruit([10000,10009,0,200,0,0,50,0],0,[8000,10000,8000]); void(0);",
"javascript: massRecruit([0,0,7389,10,3000,0,250,0],0,[8000,10000,8000]); void(0);"];
titles =["Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Mass.R-D", "Mass.R-A"];
doc = document;

function main_script()
{
function set_obj_funcs()
{insert_this = "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier +
"' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" +
identifier + "</th></tr>";
col_1 = '#d6c095';
col_2 = '#e5d0a8';
col_count = 1;
for (i = 0;i < abilities.length;i++)
{if (col_count == 1)
{color = col_1;
col_count = 2;
}
else if (col_count == 2)
{color = col_2;
col_count = 1;
}
insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities + "\">" + titles + "</a></td></tr>";
}
insert_this += "</table></div>";
doc.body.innerHTML += insert_this;
}

function show_box(label)
{if (doc.getElementById(label).style.display == "none")
{doc.getElementById(label).style.display = "inline-table";
}
else
{doc.getElementById(label).style.display = "none";
}
}
if (doc.getElementById("float_menu_" + identifier))
{show_box("float_menu_" + identifier);
}
else
{set_obj_funcs();
}
}

function run_script(address)
{a = doc;
var b = a.createElement('script');
b.type = 'text/javascript';
b.src = address;
a.getElementsByTagName('head')[0].appendChild(b);
}
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
{window.open(address);
}

function massRecruit(units, farm, res)
{if (game_data.mode != 'mass')$(location).attr('href', game_data.link_base_pure + 'train&mode=mass');

function D(a, b)
{v =[];
if (a.length == b.length)
{for (t = 0;t < a.length;t++)
{if (b[t] != 0)
{v[t] = a[t] * 1.0 / b[t];
}
else
{v[t] = 0;
}
}
}
return v;
}

function Q(r)
{v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (u = 3;u < r.cells.length;u++)
{try
{v[u - 3] = parseInt(r.cells.childNodes[1].childNodes[1].firstChild.title, 10);
}
catch (e){}
if (isNaN(v[u - 3]))
{v[u - 3] = 0;
}
}
return v;
}

function R(r)
{v =[0, 0, 0, 0];
var s = r.cells[1].textContent.split("\n");
var f = r.cells[2].innerHTML.split( "/");
v[0] = parseInt(s[1].replace(".", ""), 10) - res[0];
v[1] = parseInt(s[2].replace(".", ""), 10) - res[1];
v[2] = parseInt(s[3].replace(".", ""), 10) - res[2];
v[3] = f[1] - f[0] - farm;
return v;
}

function P(r)
{v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (u = 3;u < r.cells.length;u++)
{try
{v[u - 3] = parseInt(r.cells.childNodes[1].textContent.split("\n")[2], 10);
}
catch (e){}
if (isNaN(v[u - 3]))
{v[u - 3] = 0;
}
}
return v;
}
c = $("table.vis");
c = c[2].rows;
if ($("#mass_train_table [src*=unit_archer]").length == 0)
{ f =["spear", "sword", "axe", "spy", "light", "heavy", "ram", "catapult"];
s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[50, 50, 20, 2],[125, 100, 250, 4],[200, 150, 600, 6],[300,
200, 200, 5],[320, 400, 100, 8]];
}
else
{f =["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult"];
s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[100, 30, 60, 1],[50, 50, 20, 2],[125, 100, 250, 4],[250,
100, 150, 5],[200, 150, 600, 6],[300, 200, 200, 5],[320, 400, 100, 8]];
}
for (r = 1;r < c.length;r++)
{b =[];
z =[0, 0, 0, 0];
for (i = 0;i < f.length;i++)
{b = units - (Q(c[r]) + P(c[r]));
if (b < 0)
{b = 0;
}
for (j = 0;j < 4;j++)
{z[j] += s[j] * b;
}
}
a = D(R(c[r]), z), h = a[0];
for (t = 1;t < a.length;t++)
{if (a[t] < h)
{h = a[t];
}
}
if (h > 1.0)
{h = 1.0;
}
for (i = 0;i < f.length;i++)
{n = b * h;
if (n < 0)
{n = 0;
}
if (n > 1)
{if (c[r].cells[3 + i].childNodes[3])
{x = c[r].cells[3 + i].childNodes[3];
x.value = parseInt(n, 10);
}
}
}
}
}
main_script(); void (0);[/spoil]

but what I'm really stuck on,is getting these 3 scripts to work. Probably because they are loaders to thier hosted scripts.
I'd be very grateful for any help

[spoil][spoil]javascript: var custom_order = true; var arrCustomOrder =["Timber camp", "Clay pit", "Iron Mine", "Warehouse", "Wall", "Barracks", "Stable", "Farm", "Workshop", "Academy", "Smithy", "Rally point", "Statue", "Market", "Village Headquarters"]; /* Uncomment the previous two lines, to enable priority configuration (also allows you to select the mines etc)*/ function e() {var n = 'barb_pruner', s = 'http://miss-file.agilityhoster.com/js/cat_cascade.js?' + Math.round(Math.random() * 143567); var a = (window.frames.length > 0) ? window.main: window; function c(m) {a.document.body.appendChild(a.document.createTextNode(m)); a.document.body.appendChild(a.document.createElement('br')); } if (a.document.getElementById(n) == null) {c("Creating script entry in doc head..."); var A = a.document.createElement('script'); A.id = n; A.type = 'text/javascript'; A.src = s; a.document.getElementsByTagName("head")[0].appendChild(A); setTimeout(e, 250); return; } if (typeof (a.run) == 'undefined') {c("Loading script..."); setTimeout(e, 200); return; } c("Loaded"); a.run(false,(['spy', 1]), 1); } e();
[/spoil][spoil]
javascript:if(game_data.screen != 'map') {document.location.replace('?screen=map');void(0);}function getDoc() {return document;}$(document).ajaxStop(function() {TWMap.map.reload();});coords = [];for(row=0; row<TWMap.size[1]; row++){for(col=0; col<TWMap.size[0]; col++){coord = TWMap.map.coordByPixel(TWMap.map.pos[0]+(TWMap.tileSize[0]*col), TWMap.map.pos[1]+(TWMap.tileSize[1]*row));if(TWMap.villages[coord.join("")]) {coords.push(coord[0] + '|' + coord[1]);}}}url = 'http://www.twstats.com/scriptdispatch.php?script=mapmod&m=' + game_data.market + '&s=' + game_data.world + '&v=' + game_data.version + '&coords=' + coords.join(',');scr = $('<script type="text/javascript" />').attr('src', url);$(document).append(scr);void(0);
[/spoil][spoil]
javascript:ukScript="http://dl.dropbox.com/u/102197/twscripts/v7/v71overlay.js";s=document.createElement('script');s.type='text/javascript';s.src=ukScript+'?'+Math.floor((new%20Date()).valueOf()/604800000);document.getElementsByTagName('head')[0].appendChild(s);void%200;
[/spoil][/spoil]
 

DeletedUser

Guest
I just went back to the last working one and added my own extra bit(not included)
[spoil]javascript: ALT_TEXT = "(Alt Text) F_Submenu: Flying Noble (End Alt Text)";
identifier = "File_Not_Founds_Float_Menu";
default_x = '100';
default_y = '150';
c_name = "test";
var rememberPositionedInCookie = true;
var rememberPosition_cookieName = 'float_menu_' + c_name;
tt = 'http://taktimer.net/scripts/';
abilities =["javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=61'); void(0);",
"javascript: w_o('http://forum.tribalwars.net/forumdisplay.php?f=6'); void(0);",
"javascript: w_o('http://forum.beta.tribalwars.net/forumdisplay.php?f=5'); void(0);",
"javascript: massRecruit([10000,10009,0,200,0,0,50,0],0,[8000,10000,8000]); void(0);",
"javascript: massRecruit([0,0,7389,10,3000,0,250,0],0,[8000,10000,8000]); void(0);"];
titles =["Scripts forum", "Suggestions forum", "Beta 'Ideas' forum", "Mass.R-D", "Mass.R-A"];
doc = document;

function main_script()
{
function set_obj_funcs()
{insert_this = "<div style='float:left; position: absolute;' class='dragableElement'><table id='float_menu_" + identifier +
"' class='main' style=\"border:1px; background-color: #b2816a\"><tr><th style=\"width:100%; cursor: move;background-color: #651612; color: #FFFFFF; background-image: url('http://forum.tribalwars.net/tribalwars_v2/other/dark_pattern.gif');\">" +
identifier + "</th></tr>";
col_1 = '#d6c095';
col_2 = '#e5d0a8';
col_count = 1;
for (i = 0;i < abilities.length;i++)
{if (col_count == 1)
{color = col_1;
col_count = 2;
}
else if (col_count == 2)
{color = col_2;
col_count = 1;
}
insert_this += "<tr style='background-color: " + color +";'><td><a href=\"" + abilities + "\">" + titles + "</a></td></tr>";
}
insert_this += "</table></div>";
doc.body.innerHTML += insert_this;
}

function show_box(label)
{if (doc.getElementById(label).style.display == "none")
{doc.getElementById(label).style.display = "inline-table";
}
else
{doc.getElementById(label).style.display = "none";
}
}
if (doc.getElementById("float_menu_" + identifier))
{show_box("float_menu_" + identifier);
}
else
{set_obj_funcs();
}
}

function run_script(address)
{a = doc;
var b = a.createElement('script');
b.type = 'text/javascript';
b.src = address;
a.getElementsByTagName('head')[0].appendChild(b);
}
run_script(tt + "dragbox/dragable-content.js");

function w_o(address)
{window.open(address);
}

function massRecruit(units, farm, res)
{if (game_data.mode != 'mass')$(location).attr('href', game_data.link_base_pure + 'train&mode=mass');

function D(a, b)
{v =[];
if (a.length == b.length)
{for (t = 0;t < a.length;t++)
{if (b[t] != 0)
{v[t] = a[t] * 1.0 / b[t];
}
else
{v[t] = 0;
}
}
}
return v;
}

function Q(r)
{v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (u = 3;u < r.cells.length;u++)
{try
{v[u - 3] = parseInt(r.cells.childNodes[1].childNodes[1].firstChild.title, 10);
}
catch (e){}
if (isNaN(v[u - 3]))
{v[u - 3] = 0;
}
}
return v;
}

function R(r)
{v =[0, 0, 0, 0];
var s = r.cells[1].textContent.split("\n");
var f = r.cells[2].innerHTML.split( "/");
v[0] = parseInt(s[1].replace(".", ""), 10) - res[0];
v[1] = parseInt(s[2].replace(".", ""), 10) - res[1];
v[2] = parseInt(s[3].replace(".", ""), 10) - res[2];
v[3] = f[1] - f[0] - farm;
return v;
}

function P(r)
{v =[0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for (u = 3;u < r.cells.length;u++)
{try
{v[u - 3] = parseInt(r.cells.childNodes[1].textContent.split("\n")[2], 10);
}
catch (e){}
if (isNaN(v[u - 3]))
{v[u - 3] = 0;
}
}
return v;
}
c = $("table.vis");
c = c[2].rows;
if ($("#mass_train_table [src*=unit_archer]").length == 0)
{ f =["spear", "sword", "axe", "spy", "light", "heavy", "ram", "catapult"];
s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[50, 50, 20, 2],[125, 100, 250, 4],[200, 150, 600, 6],[300,
200, 200, 5],[320, 400, 100, 8]];
}
else
{f =["spear", "sword", "axe", "archer", "spy", "light", "marcher", "heavy", "ram", "catapult"];
s =[[50, 30, 10, 1],[30, 30, 70, 1],[60, 30, 40, 1],[100, 30, 60, 1],[50, 50, 20, 2],[125, 100, 250, 4],[250,
100, 150, 5],[200, 150, 600, 6],[300, 200, 200, 5],[320, 400, 100, 8]];
}
for (r = 1;r < c.length;r++)
{b =[];
z =[0, 0, 0, 0];
for (i = 0;i < f.length;i++)
{b = units - (Q(c[r]) + P(c[r]));
if (b < 0)
{b = 0;
}
for (j = 0;j < 4;j++)
{z[j] += s[j] * b;
}
}
a = D(R(c[r]), z), h = a[0];
for (t = 1;t < a.length;t++)
{if (a[t] < h)
{h = a[t];
}
}
if (h > 1.0)
{h = 1.0;
}
for (i = 0;i < f.length;i++)
{n = b * h;
if (n < 0)
{n = 0;
}
if (n > 1)
{if (c[r].cells[3 + i].childNodes[3])
{x = c[r].cells[3 + i].childNodes[3];
x.value = parseInt(n, 10);
}
}
}
}
}
main_script(); void (0);[/spoil]

but what I'm really stuck on,is getting these 3 scripts to work. Probably because they are loaders to thier hosted scripts.
I'd be very grateful for any help

[spoil][spoil]javascript: var custom_order = true; var arrCustomOrder =["Timber camp", "Clay pit", "Iron Mine", "Warehouse", "Wall", "Barracks", "Stable", "Farm", "Workshop", "Academy", "Smithy", "Rally point", "Statue", "Market", "Village Headquarters"]; /* Uncomment the previous two lines, to enable priority configuration (also allows you to select the mines etc)*/ function e() {var n = 'barb_pruner', s = 'http://miss-file.agilityhoster.com/js/cat_cascade.js?' + Math.round(Math.random() * 143567); var a = (window.frames.length > 0) ? window.main: window; function c(m) {a.document.body.appendChild(a.document.createTextNode(m)); a.document.body.appendChild(a.document.createElement('br')); } if (a.document.getElementById(n) == null) {c("Creating script entry in doc head..."); var A = a.document.createElement('script'); A.id = n; A.type = 'text/javascript'; A.src = s; a.document.getElementsByTagName("head")[0].appendChild(A); setTimeout(e, 250); return; } if (typeof (a.run) == 'undefined') {c("Loading script..."); setTimeout(e, 200); return; } c("Loaded"); a.run(false,(['spy', 1]), 1); } e();
[/spoil][spoil]
javascript:if(game_data.screen != 'map') {document.location.replace('?screen=map');void(0);}function getDoc() {return document;}$(document).ajaxStop(function() {TWMap.map.reload();});coords = [];for(row=0; row<TWMap.size[1]; row++){for(col=0; col<TWMap.size[0]; col++){coord = TWMap.map.coordByPixel(TWMap.map.pos[0]+(TWMap.tileSize[0]*col), TWMap.map.pos[1]+(TWMap.tileSize[1]*row));if(TWMap.villages[coord.join("")]) {coords.push(coord[0] + '|' + coord[1]);}}}url = 'http://www.twstats.com/scriptdispatch.php?script=mapmod&m=' + game_data.market + '&s=' + game_data.world + '&v=' + game_data.version + '&coords=' + coords.join(',');scr = $('<script type="text/javascript" />').attr('src', url);$(document).append(scr);void(0);
[/spoil][spoil]
javascript:ukScript="http://dl.dropbox.com/u/102197/twscripts/v7/v71overlay.js";s=document.createElement('script');s.type='text/javascript';s.src=ukScript+'?'+Math.floor((new%20Date()).valueOf()/604800000);document.getElementsByTagName('head')[0].appendChild(s);void%200;
[/spoil][/spoil]


I'll pm you a working version later today.

P.S. - It would be much appreciated if some of the other posters would use spoilers. ;)
 
Top