Aktionen

MediaWiki

Common.js: Unterschied zwischen den Versionen

 
(10 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 11: Zeile 11:
 
var acromap = $( "#acromap" );
 
var acromap = $( "#acromap" );
 
if ( acromap.length ) {
 
if ( acromap.length ) {
 +
 +
 
acromap.html(".........");
 
acromap.html(".........");
 
 
Zeile 37: Zeile 39:
 
loadCSS( "https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css" );
 
loadCSS( "https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css" );
 
loadCSS( "https://wiki.acrotricks.com/w/resources/lib/acromap/styles.css" );
 
loadCSS( "https://wiki.acrotricks.com/w/resources/lib/acromap/styles.css" );
+
 
 
 
 
//first().then(second).done(function(){
 
//first().then(second).done(function(){
Zeile 57: Zeile 59:
 
});
 
});
 
*/
 
*/
$.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js").done(
+
() => ( console.log("Leaflet loaded") )
+
//$.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js?action=raw&ctype=text/javascript" ).done(function () {
);
+
 +
//$.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" );
 
$.getScript( "https://wiki.acrotricks.com/w/resources/lib/acromap/script.js" );
 
$.getScript( "https://wiki.acrotricks.com/w/resources/lib/acromap/script.js" );
 
 
/*
+
//});
$.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js").done(
 
() => ( $.getScript( "https://wiki.acrotricks.com/w/resources/lib/acromap/script.js" ) )
 
);
 
*/
 
 
 
 
 
}
 
}

Aktuelle Version vom 11. Mai 2020, 13:29 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */


$(function () {
/***********************************************************************************************************************/
	// var myElement = document.getElementById('mw-mywiki-example');
	// myElement.innerHTML = 'any HTML';
	
	// Lazy Load Acro Map
	$(document).ready(function() {
		var acromap = $( "#acromap" );
		if ( acromap.length ) {
			
			
			acromap.html(".........");
			
			function first() {
			   return $.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" );
			}

			function second(data, textStatus, jqXHR) {
			   return $.getScript( "https://wiki.acrotricks.com/w/resources/lib/acromap/script.js" );
			}
			
			loadCSS = function(href) {

				  var cssLink = $("<link>");
				  $("head").append(cssLink); //IE hack: append before setting href
				
				  cssLink.attr({
				    rel:  "stylesheet",
				    type: "text/css",
				    href: href
				  });
				
			};
			
			loadCSS( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" );
			loadCSS( "https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css" );
			loadCSS( "https://wiki.acrotricks.com/w/resources/lib/acromap/styles.css" );

			
			//first().then(second).done(function(){
			    //place your code here, the scripts are all loaded
			    //acromap.html("MAP");
			//});
			// 
			/*
			$.when(
			    $.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" ),
			    //$.getScript( "https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js" ),
			    $.Deferred(function( deferred ){
			        $( deferred.resolve );
			    })
			).done(function(){
				
				second();
				//$.getScript( "https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js" );
			});
			*/
			
			//$.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js?action=raw&ctype=text/javascript" ).done(function () {
			
			//$.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" );
			$.getScript( "https://wiki.acrotricks.com/w/resources/lib/acromap/script.js" );
			
			//});
			
		}
	}); 
	
	
	/***************************/
	var customizeToolbar = function () {
		/* Your code goes here */
		
		/***************************/
		/*
		$('#wpTextbox1').wikiEditor('addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
				"strikethrough": {
					label: 'Strike',
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "<s>",
							post: "</s>"
						}
					}
				}
			}
		});
		*/
		
		/*
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'emoticons',
			'group': 'faces',
			'tools': {
				'smile': {
					label: 'Smile!', // or use labelMsg for a localized label, see above
					type: 'button',
					icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: ":)" // text to be inserted
						}
					}
				}
			}
		});
		*/
		/***************************/        
	};

	/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
	if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
		mw.loader.using( 'user.options' ).then( function () {
			// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
			if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
				$.when(
					mw.loader.using( 'ext.wikiEditor' ), $.ready
				).then( customizeToolbar );
			}
		} );
	}
/***********************************************************************************************************************/
}());