"Wikitravel has a speed and convenience the books' publishers can only envy." — Time Europe
User:Tatata/memo/2
From Wikitravel Shared
< User:Tatata | memo
Contents
[edit] Memo
[edit] Special:Mapstraction
- http://files.wikitravel.org/mw/skins/common/mapstraction.js
- http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js
- http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5
- http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6
[edit] Examples
- ja:フエ
- shared:Category:Calbe (Saale)
[edit] script files
[edit] Microsoft
script tag in Special:Mapstraction page source when "maptype=microsoft"
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"> </script>
script tag in Example Code of "Mapstraction - microsoft demo" page [1]
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
[edit] OpenStreetMap
Provider specific code in Example Code of "Mapstraction - openstreetmap demo" page [2]
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAYfI_xw3MwUbmAScWsa72VBSeiHve5IwsMuqAjxrbixTJ6mqDsxTZLbNcpVxq9PneOXm7mkBjelEQpw" type="text/javascript"></script>
// initialise the map with your choice of API
var mapstraction = new Mapstraction('mapstraction','openstreetmap');
[edit] Tech Requests
- Bugreport
- Feature request
[edit] WatchUnwatch tab
Tech:Unwatch tab doesn't say "Unwatch"
[edit] script files
- http://files.wikitravel.org/mw/skins/common/username.js
- http://files.wikitravel.org/mw/skins/common/wikibits.js?0.1
- http://files.wikitravel.org/mw/skins/common/ajax.js
- http://files.wikitravel.org/mw/skins/common/ajax.js?42b.1
- http://files.wikitravel.org/mw/skins/common/ajaxwatch.js?42b.1
[edit] page in my watchlist
<div id="p-cactions" class="portlet">
<h5>Views</h5>
<ul>
<li id="ca-nstab-user" class="selected">
<a href="/shared/User:Tatata7">User page</a>
</li>
<li id="ca-talk">
<a href="/shared/User_talk:Tatata7">Discussion</a>
</li>
<li id="ca-edit">
<a href="/wiki/shared/index.php?title=User:Tatata7&action=edit">Edit</a>
</li>
<li id="ca-history">
<a href="/wiki/shared/index.php?title=User:Tatata7&action=history">History</a>
</li>
</ul>
</div>
[edit] username.js
...
function add_list_link(list, title, url) {
var link = document.createElement('a');
var text = document.createTextNode(title);
link.setAttribute('href', url);
link.appendChild(text);
var item = document.createElement('li');
item.appendChild(link);
list.appendChild(item);
return true;
}
...
function page_name(ns, title) {
return ns + ":" + title;
}
...
function add_list_link(list, title, url) {
var link = document.createElement('a');
var text = document.createTextNode(title);
link.setAttribute('href', url);
link.appendChild(text);
var item = document.createElement('li');
item.appendChild(link);
list.appendChild(item);
return true;
}
...
function add_watch_url(list) {
return add_list_link(list, message_map.watch,
script_path + '?title=' + page_name(specialns, "Watchunwatch")
+ '&target=' + encodeURIComponent(page_title));
}
...
function build_content_action_urls() {
if (is_logged_in()) {
var id = read_cookie(db_name + 'UserID');
var p_cactions = document.getElementById('p-cactions');
var list = p_cactions.getElementsByTagName('ul').item(0);
add_move_url(list);
add_watch_url(list);
if (is_admin(id)) {
add_delete_url(list);
add_protect_url(list);
}
}
return true;
}
[edit] ajaxwatch.js
...
wgAjaxWatch.onLoad = function() {
// This document structure hardcoding sucks. We should make a class and
// toss all this out the window.
var el1 = document.getElementById("ca-unwatch");
var el2 = null;
if (!el1) {
el1 = document.getElementById("mw-unwatch-link1");
el2 = document.getElementById("mw-unwatch-link2");
}
if(el1) {
wgAjaxWatch.watching = true;
} else {
wgAjaxWatch.watching = false;
el1 = document.getElementById("ca-watch");
if (!el1) {
el1 = document.getElementById("mw-watch-link1");
el2 = document.getElementById("mw-watch-link2");
}
if(!el1) {
wgAjaxWatch.supported = false;
return;
}
}
// The id can be either for the parent (Monobook-based) or the element
// itself (non-Monobook)
wgAjaxWatch.watchLinks.push( el1.tagName.toLowerCase() == "a"
? el1 : el1.firstChild );
if( el2 ) {
wgAjaxWatch.watchLinks.push( el2 );
}
// I couldn't get for (watchLink in wgAjaxWatch.watchLinks) to work, if
// you can be my guest.
for( i = 0; i < wgAjaxWatch.watchLinks.length; i++ ) {
wgAjaxWatch.watchLinks[i].onclick = wgAjaxWatch.ajaxCall;
}
return;
};
hookEvent("load", wgAjaxWatch.onLoad);
...

