利用者:Tmv/common.js

2022年1月7日 (金) 08:25時点におけるTmv (トーク | 投稿記録)による版 (+1)

注意: 保存後、変更を確認するにはブラウザーのキャッシュを消去する必要がある場合があります。

  • Firefox / Safari: Shift を押しながら 再読み込み をクリックするか、Ctrl-F5 または Ctrl-R を押してください (Mac では ⌘-R)
  • Google Chrome: Ctrl-Shift-R を押してください (Mac では ⌘-Shift-R)
  • Microsoft Edge: Ctrl を押しながら 最新の情報に更新 をクリックするか、Ctrl-F5 を押してください。
/* ここに書いた JavaScript はTmvの外装に反映されます */

// ナビゲーションポップアップ
mw.loader.load('//ja.wikivoyage.org/w/index.php?title=User:Tmv/custom/popups.js&action=raw&ctype=text/javascript');

// exlinks
mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-exlinks.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );

// ticker
mw.loader.load('//ja.wikivoyage.org/w/index.php?title=User:Tmv/custom/ticker.js&action=raw&ctype=text/javascript');

// ArticleInfo
mw.loader.load('//www.mediawiki.org/w/index.php?title=XTools/ArticleInfo.js&action=raw&ctype=text/javascript');

// 返信ツール
mw.loader.load('ext.discussionTools.init');

// FAP
mw.loader.load('//ja.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ForkAPage.js&action=raw&ctype=text/javascript');

// suppressEnterAtSummaryBox
mw.loader.load('//ja.wikipedia.org/w/index.php?title=MediaWiki:Gadget-suppressEnterAtSummaryBox.js&action=raw&ctype=text/javascript');

// Edit toolbar
mw.loader.load('//ja.wikivoyage.org/w/index.php?title=User:Tmv/custom/Edit_toolbar.js&action=raw&ctype=text/javascript');

// Listing Editor改良版 (試験)
mw.loader.load('//ja.wikivoyage.org/w/index.php?title=User:Tmv/custom/listing editor.js/test.js&action=raw&ctype=text/javascript');
mw.loader.load('//ja.wikivoyage.org/w/index.php?title=MediaWiki:Gadget-ListingEditor.css&action=raw&ctype=text/css', 'text/css');

// Mass RevisionDelete tool
mw.loader.load('//ja.wikipedia.org/w/index.php?title=User:Infinite0694/Mass RevisionDelete tool/ja.js&action=raw&ctype=text/javascript');

// ShortURL
mw.loader.load('//ja.wikipedia.org/w/index.php?title=MediaWiki:Gadget-shortURL.js&action=raw&ctype=text/javascript');

// WikiMiniAtlas
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');

// VSCode
mw.loader.load("https://github.com/Frederisk/Wikitext-Extension-Gadget/releases/latest/download/index-vscode.js");

// Kartographer
/*** from https://fr.wikivoyage.org/w/index.php?title=MediaWiki:Kartographer.js&oldid=364890 ***/
( function ( mw ) {

	var wv,
		ready,
		nearbyArticlesCfg = {
			url: 'https://tools.wmflabs.org/wikivoyage/w/data/ja-articles.js',
			thumbPath: '//upload.wikimedia.org/wikipedia/commons/thumb/'
		},
	/* jscs:disable validateQuoteMarks, disallowQuotedKeysInObjects */
		maptiles = {
			"OSM": {
				"tilesUrl": "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
				"options": {
					"wvIsExternal": true,
					"wvName": "OSM",
					"subdomains": [
						"a",
						"b",
						"c"
					],
					"attribs": [
						{
							"url": "http://www.openstreetmap.org/copyright",
							"name": "OpenStreetMap",
							"label": "Map data"
						}
					]
				}
			},
			"landscape": {
				/* [[User:DTankersley (WMF)]] is the contact person for this API key */
				"tilesUrl": "http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=ca8e8a8e3f9a44c19a8edcf8fb5f90c4",
				"options": {
					"wvIsExternal": true,
					"wvName": "Relief map",
					"attribs": [
						{
							"url": "http://www.openstreetmap.org/copyright",
							"name": "OpenStreetMap",
							"label": "Map data"
						},
						{
							"url": "http://www.opencyclemap.org/",
							"name": "Andy Allan",
							"label": "Tiles"
						}
					]
				}
			},
			"gsi": {
				"tilesUrl": "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",
				"options": {
					"wvIsExternal": true,
					"wvName": "GSIMap",
					"attribs": [
						{
							"url": "https://www.gsi.go.jp/kikakuchousei/kikakuchousei40182.html",
							"name": "国土地理院",
							"label": "出典"
						}
					]
				}
			},
			"traffic-line-network": {
				"tilesUrl": "http://www.openptmap.org/tiles/{z}/{x}/{y}.png",
				"options": {
					"wvIsOverlay": true,
					"wvIsExternal": true,
					"wvName": "Traffic line network",
					"attribs": [
						{
							"url": "http://openptmap.org/",
							"name": "Openptmap.org",
							"label": "Traffic lines"
						}
					],
					"opacity": 0.5,
					"maxNativeZoom": 17
				}
			},
			"boundaries": {
				"tilesUrl": "http://korona.geog.uni-heidelberg.de/tiles/adminb/x={x}&y={y}&z={z}",
				"options": {
					"wvIsOverlay": true,
					"wvIsExternal": true,
					"wvName": "Boundaries",
					"attribs": []
				}
			},
			"cycling": {
				"tilesUrl": "http://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png",
				"options": {
					"wvIsOverlay": true,
					"wvIsExternal": true,
					"wvName": "Cycling",
					"attribs": [
						{
							"url": "http://cycling.waymarkedtrails.org",
							"name": "Waymarked Trails",
							"label": "Cycling routes"
						}
					]
				}
			},
			"hiking": {
				"tilesUrl": "http://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png",
				"options": {
					"wvIsOverlay": true,
					"wvIsExternal": true,
					"wvName": "Hiking",
					"attribs": [
						{
							"url": "http://hiking.waymarkedtrails.org",
							"name": "Waymarked Trails",
							"label": "Hiking trails"
						}
					]
				}
			},
			"hill-shading": {
				"tilesUrl": "http://{s}.tiles.wmflabs.org/hillshading/{z}/{x}/{y}.png",
				"options": {
					"wvIsOverlay": true,
					"wvIsExternal": true,
					"wvName": "Hill shading",
					"attribs": [
						{
							"url": "http://www2.jpl.nasa.gov/srtm/",
							"name": "NASA",
							"label": "Hill shading"
						}
					]
				}
			}
		};
	/* jscs:enable validateQuoteMarks, disallowQuotedKeysInObjects */

	mw.hook( 'wikipage.maps' ).add( function ( maps ) {

		ready = ready || mw.loader.using( [ 'oojs-ui', 'ext.kartographer.wv' ] ).done( function () {
				wv = mw.loader.require( 'ext.kartographer.wv' );

				wv.NearbyArticles.setConfig( nearbyArticlesCfg );

				$.each( maptiles, function ( i, tile ) {
					wv.wikivoyage.addTileLayer( i, tile.tilesUrl, tile.options );
				} );
			} );

		// `maps` can be an array
		maps = $.isArray( maps ) ? maps : [ maps ];

		ready.done( function () {

			// customize each map
			$.each( maps, function ( i, map ) {

				var wvmap = new wv.WVMap( map );
				wvmap.controlLayers()
					.basemap( 'OSM' )
					.basemap( 'landscape' )
					.basemap( 'gsi' )
					.overlay( 'traffic-line-network' )
					.overlay( 'boundaries' )
					.overlay( 'hill-shading' )
					.overlay( 'cycling' )
					.overlay( 'hiking' )
					.datalayer( map.dataLayers )
					.update();
				// https://wikivoyage.toolforge.org/w/data/ja-articles.jsに情報がないため
				// wvmap.nearby();
			} );
		} );
	} );
} )( mediaWiki );