利用者:Was a bee/vector.js
表示
お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。
多くの Windows や Linux のブラウザ
- Ctrl を押しながら F5 を押す。
Mac における Safari
Mac における Chrome や Firefox
- ⌘ Cmd と ⇧ Shift を押しながら R を押す。
詳細についてはWikipedia:キャッシュを消すをご覧ください。
function include(s) {
document.write('<script type="text/javascript" src="' +
'http://ja.wikipedia.org/w/index.php?title=' +
encodeURI(s) + '&action=raw&ctype=text/javascript' +
'&dontcountme=s"><' + '/script>');
}
//include("User:Tietew/interlang.js");
//include("User:Was_a_bee/hatena.js");
include("User:Was_a_bee/info.js");
//include("User:Tietew/log.js");
//replacing by counter added version
include("User:Was_a_bee/logandcounter.js");
//include("User:Was_a_bee/submitblock.js");
var OSM_class_R = /\bOSM:([\d.+-]+)_([\d.+-]+)_([\d.+-]+)_(\w+)/;
function embedOpenStreetMap() {
clearInterval(osmtimer);
var osmTarget = document.getElementById('osmEmbed');
if(osmTarget && OSM_class_R.exec(osmTarget.className)){
var lat=1.0*RegExp.$1, lon=1.0*RegExp.$2, zoom=RegExp.$3;
var span = 360.0/(512.0*Math.pow(2,zoom))*720/2; //WTF?
iframe = document.createElement('iframe');
iframe.frameBorder = 0; // IE 6
iframe.scrolling = 'no';
iframe.src = "http://www.openstreetmap.org/export/embed.html?layer="+RegExp.$4+"&bbox=" +
(lon-span*Math.cos(lat*.0175))+','+(lat-span/2)+','+(lon+span*Math.cos(lat*.0175))+','+(lat+span/2)+
"&marker="+lat+','+lon;
iframe.height = osmTarget.clientHeight+'px';
iframe.width = osmTarget.clientWidth+'px';
iframe.style.position = "absolute";
osmTarget.appendChild(iframe);
}
}
osmtimer = setInterval("if(document.getElementById('osmEmbed'))embedOpenStreetMap()", 200)
setTimeout('clearInterval(osmtimer)', 5000)
/** WikiMiniAtlas *******************************************************
*
* Description: WikiMiniAtlas is a popup click and drag world map.
* This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
* The script itself is located on meta because it is used by many projects.
* See [[Meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
// [[image:Erioll_world.svg|18px]] '''WikiMiniAtlas''' <br>
// Script to embed interactive maps into pages that have coordinate templates <br>
// also check my user page [[User:Dschwen]] for more tools<pre>
//
// Revision 12
//★変数の定義
var wikiminiatlas =
{
config:
{
width : 600,
height : 400,
timeout : 5000,
zoom : -1,
quicklink : false,
quicklinkurl : 'http://maps.google.co.jp/maps?ll={latdegdec},{londegdec}&spn={span},{span}&q={latdegdec},{londegdec}',
enabled : true,
onlytitle : false,
//★WikiMiniAtlasの本体が表示されるURL。ここの表示をiframeに取り込んで表示する。実際にはこのURLの後にパラメタが必要
//iframeurl : 'http://www.openstreetmap.org/export/embed.html',//★OSM
iframeurl : 'http://toolserver.org/~dschwen/wma/iframe.html',//★WMA
//★WikiMiniAtlasのアイコンなどの画像が保存されているURL。
imgbase : 'http://toolserver.org/~dschwen/wma/tiles/',
coordurls : [
'http://stable.toolserver.org/geohack/geohack.php?',
'http://stable.ts.wikimedia.org/geohack/geohack.php?',
'http://toolserver.org/~magnus/geo/geohack.php?',
'http://toolserver.org/~geohack/geohack.php?',
'http://tools.wikimedia.de/~magnus/geo/geohack.php?',
'http://www8.brinkster.com/erikbaas/wiki/maps.asp?',
'http://www.nsesoftware.nl/wiki/maps.asp?'
],
buttonImage:
//★地球儀の絵柄はここで決める
'/media/wikipedia/commons/thumb/9/9a/Erioll_world.svg/18px-Erioll_world.svg.png'
},
//★各言語版ごとのマウスオーバー時のツールチップ等を定める
strings:
{
buttonTooltip : {
af:'Vertoon ligging op \'n interaktiwe kaart.',
als:'Ort uf dr interaktivä Chartä zeigä',
ar:'شاهد الموقع على الخريطة التفاعلية',
'be-tarask':'паказаць месцазнаходжаньне на інтэрактыўнай мапе',
'be-x-old':'паказаць месцазнаходжаньне на інтэрактыўнай мапе',
bg:'покажи местоположението на интерактивната карта',
bpy:'জীবন্ত মানচিত্রগর মা মাপাহান দেখাদিতই',
br:'diskouez al lec\'hiadur war ur gartenn etrewezhiat',
ca:'mostra la localització en un mapa interactiu',
cs:'zobraz místo na interaktivní mapě',
da:'vis beliggenhed på interaktivt kort',
de:'Ort auf interaktiver Karte anzeigen',
el:'εμφάνιση τοποθεσίας σε διαδραστικό χάρτη',
en:'show location on an interactive map',
eo:'Montru lokigon sur interaktiva karto',
eu:'erakutsi kokalekua mapa interaktibo batean',
es:'mostrar el lugar en un mapa interactivo',
fr:'Montrer la localisation sur une carte interactive',
fur:'mostre la localizazion suntune mape interative',
fy:'it plak op in oanpasbere kaart oanjaan',
gl:'Amosar o lugar nun mapa interactivo',
he:'הראה מיקום במפה האינטראקטיבית',
hr:'prikaži lokaciju na interaktivnom zemljovidu',
hu:'Mutasd a helyet egy interaktív térképen!',
hy:'ցուցադրել դիրքը ինտերակտիվ քարտեզի վրա',
it:'mostra la località su una carta interattiva',
is:'sýna staðsetningu á gagnvirku korti',
id:'Tunjukkan letak di peta interaktif',
ja:'インタラクティブ地図上に位置を表示',//★日本語版はここ
km:'បង្ហាញទីតាំងនៅលើផែនទីអន្តរកម្ម',
ko:'인터랙티브 지도에 위치를 표시',
lt:'Rodyti vietą interaktyviame žemėlapyje',
mk:'прикажи положба на интерактивна карта',
nl:'de locatie op een interactieve kaart tonen',
no:'vis beliggenhet på interaktivt kart',
pl:'Pokaż lokalizację na mapie interaktywnej',
pt:'mostrar a localidade num mapa interactivo',
ro:'arată locaţia pe o hartă interactivă',
ru:'показать положение на интерактивной карте',
sk:'zobraz miesto na interaktívnej mape',
sl:'Prikaži lego na interaktivnem zemljevidu',
sq:'trego vendndodhjen në hartë',
fi:'näytä paikka interaktiivisella kartalla',
sv:'visa platsen på en interaktiv karta',
uk:'показати положення на інтерактивній карті',
vi:'xem vị trí này trên bản đồ tương tác',
vo:'Jonön topi su kaed itjäfidik',
zh:'显示该地在地图上的位置',
'zh-cn':'显示该地在地图上的位置',
'zh-sg':'显示该地在地图上的位置',
'zh-tw':'顯示該地在地圖上的位置',
'zh-hk':'顯示該地在地圖上的位置'
},
close : {
af:'Sluit',
als:'Zuä machä',
ar:'غلق',
'be-tarask':'закрыць',
'be-x-old':'закрыць',
bg:'затвори',
bpy:'জিপা',
br:'serriñ',
ca:'tanca',
cs:'zavřít',
da:'luk',
de:'schließen',
el:'έξοδος',
en:'close',
eo:'fermu',
eu:'itxi',
es:'cerrar',
fr:'Quitter',
fur:'siere',
fy:'ticht',
gl:'pechar',
he:'לסגור',
hr:'zatvori',
hu:'bezárás',
hy:'փակել',
id:'tutup',
is:'loka',
it:'chiudi',
ja:'閉じる',//★日本語版はここ
km:'បិទ',
ko:'닫기',
lt:'uždaryti',
mk:'затвори',
nl:'sluiten',
no:'lukk',
pl:'zamknij',
pt:'fechar',
ro:'închide',
ru:'закрыть',
sk:'zatvoriť',
sl:'zapri',
sq:'mbylle',
fi:'sulje',
sv:'stäng',
uk:'закрити',
vi:'đóng',
vo:'färmükön',
zh:'关闭',
'zh-cn':'关闭',
'zh-sg':'关闭',
'zh-tw':'關閉',
'zh-hk':'關閉'
}
},
link : null,
links : null,
bodyc : null,
language : '',
site: '',
iframe : { div: null, iframe: null, closebutton: null },
mapbutton: null,//★地球儀用の変数。マップボタン(mb)
marker : { lat:0, lon:0 },
coordinates : null,
coord_index: 0,
coord_params: '',
//coord_filter: null,
//★GeoHackへのリンク用URLからパラメータを取り出すための正規表現の雛形
coord_filter: /^([\d+-.]+)_([\d+-.]*)_?([\d+-.]*)_?([NS])_([\d+-.]+)_([\d+-.]*)_?([\d+-.]*)_?([EOW])/,
quicklinkbox : null,
quicklinkdest : null,
region_index : 0,
coordinate_region : '',
WikiMiniAtlasHTML : '',
hookUpMapbutton : function( mb )
{
var mapparam = mb.mapparam;
var mapy = wikiminiatlas.totalOffset( mb, 0 ) + 20;
function doEvent()
{
wikiminiatlas.toggleIFrame( mapparam, mapy );//★マップボタンがクリックされたら地図を表示(?)
return true;
}
mb.onclick = doEvent;//★マップボタンのクリックを監視
},
//★垂直方向の位置の確認
// vertikale position auf der Seite bestimmen
totalOffset : function( obj, offset )
{
if( obj.offsetParent == null ||
obj.offsetParent.id == 'content' )
return offset + obj.offsetTop;
else
return wikiminiatlas.totalOffset(obj.offsetParent, offset + obj.offsetTop );
},
//★ここでマップの出現位置と、表示のON/OFFを切り替える
// move iframe around and toggle visibility
toggleIFrame : function( mp, my )
{
with(wikiminiatlas)
{
var newurl = config.iframeurl + '?' + mp;//★☆★☆ここでフレーム内に読み込む地図のURLを指定している★☆★☆
if(iframe.div.style.visibility != "visible" ||
( ( iframe.iframe.src != newurl ) && ( my !== undefined ) ) )
{
if( iframe.iframe.src != newurl )
{
iframe.iframe.src = newurl;//★☆★☆フレームに読み込みURLを設定
}
iframe.div.style.top = my + 'px';
iframe.div.style.visibility="visible"; //★表示
iframe.div.style.display="block";
}
else
{
iframe.div.style.visibility="hidden"; //★非表示
iframe.div.style.display="none";
}
}
return false;
},
//★タイムアウト用のタイマーセット
// start the timer to fade in the quicklink tooltip
qlStart : function()
{
},
// abort the timer, hide the tooltip
qlStop : function()
{
},
// show the tooltip menu
qlShowMenu : function()
{
},
// fill in the map-service templates
qlURL : function( lat, lon, zoom )
{
var url = wikiminiatlas.config.quicklinkurl;
url = url.replace( /\{latdegdec\}/g, lat );
url = url.replace( /\{londegdec\}/g, lon );
var span = Math.pow( 2.0, zoom) / 150.0;
url = url.replace( /\{span\}/g, span.toFixed(4) );
return url;
},
// Check against coordinate urls
isMaplink : function( url_orig )
{
if( typeof(url_orig) != 'string' ) return false;
// needed for the russian WP
var url, err;
try { url = decodeURI( url_orig ) } catch( err ) { url = url_orig }
with(wikiminiatlas)
{
// for( var key = 0; key < config.coordurls.length; key++ ) {
for( var key in config.coordurls ) {
if( url.substr(0,config.coordurls[key].length) == config.coordurls[key] )
return true;
}
}
return false;
},
// Insert the IFrame into the page.
loader : function()
{
// apply settings
//★個々人がmonobook.jsでしてるwma用の設定を、ここで配列へ一気に代入する
if( typeof(wma_settings) == 'object' )
for (var key in wma_settings)
{
if( typeof(wma_settings[key]) == typeof(wikiminiatlas.config[key]) )
wikiminiatlas.config[key] = wma_settings[key];
}
//★個々人がmonobook.jsでwmaをOFF設定している場合は、ここで処理終了
if( wikiminiatlas.config.enabled == false ) return;
with(wikiminiatlas)
{
site = window.location.host.substr(0,window.location.host.indexOf('.'));
language = wgUserLanguage;
var len; // cache array length for iterations
// remove stupid icons from title coordinates
var coord_title = document.getElementById('coordinates') || document.getElementById('coordinates-title');
if( coord_title ) {
var icons = coord_title.getElementsByTagName('a');
len = icons.length;
for( var key = 0; key < len; key++ ) {
if( typeof(icons[key]) == 'object' &&
icons[key] != null &&
icons[key].className == 'image' )
icons[key].parentNode.removeChild(icons[key]);
}
}
if( config.onlytitle )
{
//★座標・またはタイトル座標部分だけを対象とする
bodyc = document.getElementById('coordinates') || document.getElementById('coordinates-title');
//★そうした要素がなければ終了
if( bodyc == null ) return;
}
else
//★ボディ部分を対象とする
{
// the french moved their title coordinates outside of bodyContent!
if( site == 'fr' )
bodyc = document.getElementById('content') || document;
else
bodyc = document.getElementById('bodyContent') || document;
}
var startTime = (new Date()).getTime();
links = bodyc.getElementsByTagName('a');//★上で決めた範囲の中から<a href="...">タグを抽出。つまりリンクを探す
len = links.length;
for( var key = 0; key < len; key++ )
{
link = links[key];
// check for timeout (every 10 links only)
if( key % 10 == 9 && (new Date()).getTime() > startTime+config.timeout ) break;
if( link.className != 'external text' || link.href.match(/_globe:(?!earth)/i) !== null ) continue;
//★GeoHackへのリンクを取得し、一部を置換
coordinates = link.href.replace( /−/g, '-' );
//★GeoHackへのリンクから、「¶ms=」以降を取り出し
coord_params = coordinates.match(/¶ms=([^&=<>|]{7,255})/);
//★リンクがGeoHackへのリンクなら続ける。違えば無視
if(!coord_params) continue;
coord_params = coord_params[1];
if(coord_filter.test(coord_params)) {
coord_filter.exec(coord_params);
//marker.lat=(1.0*RegExp.$1) + ((RegExp.$2||0)/60.0) + ((RegExp.$3||0)/3600.0);//★OSM用。度分秒から10進形式に変換
marker.lat=(1.0*RegExp.$1) + ((RegExp.$2||0)/60.0) + ((RegExp.$3||0)/3600.0);//★WMA用。度分秒から10進形式に変換
if(RegExp.$4=='S') marker.lat*=-1;//★南半球の場合、マイナス
//marker.lon=(1.0*RegExp.$5) + ((RegExp.$6||0)/60.0) + ((RegExp.$7||0)/3600.0);//★OSM用。度分秒から10進形式に変換
marker.lon=(1.0*RegExp.$5) + ((RegExp.$6||0)/60.0) + ((RegExp.$7||0)/3600.0);//★WMA用。度分秒から10進形式に変換
if(RegExp.$8=='W') marker.lon*=-1;//★西半球の場合、マイナス
}
//★タイプが設定されてる場合、タイプに応じてズームレベルを指定
// Find a sensible Zoom-level based on type
var zoomlevel = 1;
if( coord_params.indexOf('_type:landmark') >= 0 )
zoomlevel = 8;
else if( coord_params.indexOf('_type:city') >= 0 )
zoomlevel = 4;
//★直径または縮尺が設定されてる場合、それに応じてズームレベルを指定
// If given use dim or scale for a zoomlevel
var ds_filter = /(dim|scale):([\d+-.]+)/;
if( ds_filter.test(coord_params) )
{
ds_filter.exec(coord_params);
// wma shows dim approx 4e7m at zoom 0 or 1.5e8 is the scale of zoomlevel 0
zoomlevel = (RegExp.$1 == 'dim' ? Math.log( 4e7/RegExp.$2 ) : Math.log( 1.5e8/RegExp.$2 ) ) / Math.log(2);
if( zoomlevel > 10 ) zoomlevel = 10;
}
if( config.zoom != -1 )
var zoomlevel = config.zoom;
// Test the unicode Symbol
if( site == 'de' && link.parentNode.id != 'coordinates' )
{
mapbutton = document.createElement('SPAN');
mapbutton.appendChild( document.createTextNode('♁') );
mapbutton.style.color = 'blue';
}
else
{
mapbutton = document.createElement('img');//★マップボタン・エレメントを生成
mapbutton.src = config.buttonImage;//★マップボタンのソース(画像のURL)を設定
}
mapbutton.title = strings.buttonTooltip[language] || strings.buttonTooltip.en;//★各言語版ごとのツールチップを設定
mapbutton.alt = '';//★画像がロードできないときは非表示
mapbutton.style.padding = '0px 3px 0px 0px';//★地球儀の微妙な位置
mapbutton.style.cursor = 'pointer';
mapbutton.className = 'noprint';//★印刷するときは表示しない
//★URL用パラメータ
//OSM用パラメータ
//mapbutton.mapparam =
//'bbox=' + marker.lat + ',' + marker.lon + '&layer=mapnik';
//WMP用パラメータ
mapbutton.mapparam =
marker.lat + '_' + marker.lon + '_' +
config.width + '_' + config.height + '_' +
site + '_' + zoomlevel + '_' + language;
// link.parentNode.insertBefore(mapbutton, link.nextSibling);
//★☆★☆リンクの直前にマップボタン(地球儀)をここで挿入する。リンクはa hrefタグで判定★☆★☆
link.parentNode.insertBefore(mapbutton,link);
hookUpMapbutton( mapbutton );
//★もしクイックリンクが有効なら(Google map)などへのリンクを・・・どうする?
if ( config.quicklink ) {
link.href = qlURL( marker.lat, marker.lon, zoomlevel );
link.onmouseover = qlStart;
link.onmouseout = qlStop;
}
} //for
// prepare quicklink menu box
if ( coordinates != null && config.quicklink ) {
quicklinkbox = document.createElement('div');
// more to come :-)
}
// prepare iframe to house the map
if ( coordinates != null ) {
iframe.div = document.createElement('div');
iframe.div.style.visibility = 'hidden';
iframe.div.style.display = 'none';
iframe.div.style.width = (config.width+2)+'px';
iframe.div.style.height = (config.height+2)+'px';
iframe.div.style.margin = '0px';
iframe.div.style.padding = '0px';
iframe.div.style.backgroundColor = 'white';
iframe.div.style.position = 'absolute';
iframe.div.style.right = '2em';
iframe.div.style.top = '1em';
iframe.div.style.border = '1px solid gray';
iframe.div.style.zIndex = 13;
iframe.closebutton = document.createElement('img');
iframe.closebutton.title = strings.close[language] || strings.close.en;
// was: config.imgbase + 'button_hide.png'
iframe.closebutton.src = '/media/wikipedia/commons/d/d4/Button_hide.png'
iframe.closebutton.style.zIndex = 15;
iframe.closebutton.style.position = 'absolute';
iframe.closebutton.style.right = '11px';
iframe.closebutton.style.top = '9px';
iframe.closebutton.style.width = '18px';
iframe.closebutton.style.cursor = 'pointer';
iframe.closebutton.mapparam = '';
iframe.closebutton.onclick = toggleIFrame;
iframe.iframe = document.createElement('iframe');
iframe.iframe.scrolling = 'no';
iframe.iframe.frameBorder = '0';
iframe.iframe.style.zIndex = 14;
iframe.iframe.style.position = 'absolute';
iframe.iframe.style.right = '1px';
iframe.iframe.style.top = '1px';
iframe.iframe.style.width = (config.width)+'px';
iframe.iframe.style.height = (config.height)+'px';
iframe.iframe.style.margin = '0px';
iframe.iframe.style.padding = '0px';
iframe.div.appendChild(iframe.iframe);
iframe.div.appendChild(iframe.closebutton);
var content = document.getElementById('content') || document.getElementById('mw_content');
if(content)
content.insertBefore(iframe.div,content.childNodes[0]);
}
} //with
}
}
//
// Hook up installation function
//
addOnloadHook(wikiminiatlas.loader);
//</pre>
/* Scripts specific to Internet Explorer */
if (navigator.appName == "Microsoft Internet Explorer")
{
/** Internet Explorer bug fix **************************************************
*
* Description: Fixes IE horizontal scrollbar bug
* Maintainers: [[User:Tom-]]?
*/
var oldWidth;
var docEl = document.documentElement;
function fixIEScroll()
{
if (!oldWidth || docEl.clientWidth > oldWidth)
doFixIEScroll();
else
setTimeout(doFixIEScroll, 1);
oldWidth = docEl.clientWidth;
}
function doFixIEScroll() {
docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
}
document.attachEvent("onreadystatechange", fixIEScroll);
document.attachEvent("onresize", fixIEScroll);
/**
* Remove need for CSS hacks regarding MSIE and IPA.
*/
if (document.createStyleSheet) {
document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";');
}
// In print IE (7?) does not like line-height
appendCSS( '@media print { sup, sub, p, .documentDescription { line-height: normal; }}');
// IE overflow bug
appendCSS('div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } div.overflowbugy { overflow-y: scroll !important; overflow-x: hidden !important; }');
// IE zoomfix
//Use to fix right floating div/table inside tables.
appendCSS('.iezoomfix div, .iezoomfix table { zoom: 1;}' );
//Import scripts specific to Internet Explorer 6
if (navigator.appVersion.substr(22, 1) == "6") {
importScript("MediaWiki:Common.js/IE60Fixes.js")
}
}