How to use Scripts

DeletedUser3502

Guest
Sorry, I know it's incredibly nooby of me, but how do you use a script? I already have a line of code, i.e.

javascript:%20var%20url='http://www.tribalwarsmap.com/us/traveltimes2';%20if%20(location.hostname.split('.')[1]=='tribalwars')%20{url+='?world=';var%20world%20=%20location.hostname.split('.')[0];%20if%20(world=='classic')%20{url+='c1';}%20else%20{url+=world.substring(2);};%20var%20query='';%20if%20(window.main)%20{query%20=%20window.main.location.search.substring(1).split('&');}%20else%20{query%20=%20window.location.search.substring(1).split('&');};%20var%20village=false;%20var%20dest=false;%20for(i=0;i<query.length;i++)%20{query=query.split('=');%20if%20(query[0]=='village')%20{url+='&start='+query[1];}%20else%20if%20(query[0]=='screen'&&query[1]=='info_village')%20{village=true;}%20else%20if%20(query[0]=='id')%20{dest='&destination='+query[1];}};%20if%20(village&&dest)%20{url+=dest;}}void%20window.open(url);


I just have no idea what to do with it... Help anybody? :confused:
 

DeletedUser3502

Guest
I do not... You don't have to in order to use it do you?
 

DeletedUser

Guest
Nope, but it does mean the method is different :). In order to use a script, you take the code (like the one you pasted in your first post), and place it in your bookmarks. What this means is, you add a bookmark, and make the "target URL" or the URL for the bookmark the code of the script.

After you've done this, whenever you want to use the script, you simply click it from the bookmark, and it works fine :).
 

DeletedUser3502

Guest
Hmm, so (I'm using Firefox), I went to my bookmarks, clicked to add a bookmark, got a window that looked a little like this:

New Bookmark
Name:
Location:
Tags:
Keyword:
Description:
[checkbox] Load this bookmark in the sidebar

I assumed that the code goes in the "Location" box, but nothing happened after I made it and clicked on it... Did I do something wrong?

(Sorry for the spoiler, couldn't get the image to show up)
 

DeletedUser

Guest
It's possible the script doesn't work in Firefox, you'd have to attempt it in Opera then :).
 

DeletedUser3502

Guest
Aaaaaaaallrighty then... Does it work for you?
 
Last edited by a moderator:

DeletedUser

Guest
Are you sure you copied the whole script...? Try it again with what I have, and when you run it, make sure you're on the village that you want the distance to. Then you just have to copy-paste your own village coords in, and you should be fine. Check it again :).

[noparse]javascript:%20var%20url='http://www.tribalwarsmap.com/us/traveltimes2';%20if%20(location.hostname.split('.')[1]=='tribalwars')%20{url+='?world=';var%20world%20=%20location.hostname.split('.')[0];%20if%20(world=='classic')%20{url+='c1';}%20else%20{url+=world.substring(2);};%20var%20query='';%20if%20(window.main)%20{query%20=%20window.main.location.search.substring(1).split('&');}%20else%20{query%20=%20window.location.search.substring(1).split('&');};%20var%20village=false;%20var%20dest=false;%20for(i=0;i<query.length;i++)%20{query=query.split('=');%20if%20(query[0]=='village')%20{url+='&start='+query[1];}%20else%20if%20(query[0]=='screen'&&query[1]=='info_village')%20{village=true;}%20else%20if%20(query[0]=='id')%20{dest='&destination='+query[1];}};%20if%20(village&&dest)%20{url+=dest;}}void%20window.open(url);[/noparse]
 

DeletedUser3502

Guest
What exactly do you mean by "on" the village I want the distance to?
 

DeletedUser

Guest
You would go to your map, see which village you want the distance to, click on it and go to the village overview, and then you'd click the script. If you have the context map enabled, when you click the village you should have the option to click the center again, which will take you to the village overview. Otherwise, when you click the village from your map you'll go directly to the page you need.
 
Top