Common.js
Version vom 7. Mai 2020, 00:44 Uhr von Friedrich (Diskussion | Beiträge)
Version vom 7. Mai 2020, 00:44 Uhr von Friedrich (Diskussion | Beiträge)
Hinweis: Leere nach dem Speichern den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Internet Explorer: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Gehe zu Menü → Einstellungen (Opera → Einstellungen auf dem Mac) und dann auf Datenschutz & Sicherheit → Browserdaten löschen → Gespeicherte Bilder und Dateien.
/* 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 ( $("#mapid").length ) { acromap.html("........."); function first() { return $.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" ); } function css(data, textStatus, jqXHR) { return $.getStylesheet( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" ); } 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" ); first().then(second).done(function(){ console.log("LAZY LOAD 04.0 done"); //place your code here, the scripts are all loaded //acromap.html("MAP"); }); /* $.when( $.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" ), loadCSS( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" ) ) .then( $.getScript( "https://wiki.acrotricks.com/w/resources/lib/acromap/script.js" ), function () { console.log('an error occurred somewhere'); } ); */ /* $.when( $.getScript( "https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" ), $.getScript( "https://wiki.acrotricks.com/w/resources/lib/acromap/script.js" ), $.Deferred(function( deferred ){ $( deferred.resolve ); }) ).done(function(){ console.log("LAZY LOAD 04.0"); //place your code here, the scripts are all loaded //acromap.html("MAP"); }); */ } }); /***************************/ 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 ); } } ); } /***********************************************************************************************************************/ }());