MediaWiki:Common.js: Difference between revisions

From titipi
Jump to navigation Jump to search
No edit summary
(MMo changed the content model of the page MediaWiki:Common.js from "wikitext" to "JavaScript")
Tag: content model change
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
/*
var customizeToolbar = function () {
console.log('ciao');
};
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
mw.loader.using( 'user.options' ).then( function () {
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}
*/


var ul = document.querySelector(".ns-3000 #p-namespaces ul,.ns-3001 #p-namespaces ul");//finding the list
var ul = document.querySelector(".ns-3000 #p-namespaces ul,.ns-3001 #p-namespaces ul");//finding the list
Line 29: Line 12:


/* iframe check */
/* iframe check */
if ( window.location !== window.parent.location ) {
if ( window.location !== window.parent.location ) {
   document.body.classList.add('iniframe');
   document.body.classList.add('iniframe');
 
/* document.querySelector('#wpSave').addEventListener('click',function(){
    window.parent.document.querySelector('#iframe').onload = function(){
      window.location.reload(true);
    }
  }); */
}
}



Latest revision as of 15:57, 28 December 2023

/* Any JavaScript here will be loaded for all users on every page load. */

var ul = document.querySelector(".ns-3000 #p-namespaces ul,.ns-3001 #p-namespaces ul");//finding the list
var newLi = document.createElement("li");// creating a list item
newLi.innerHTML = '<button id="wiki-to-pdf-button"><a id="wiki-to-pdf-link" href="#" title="[insert title]">Open in wiki-to-pdf!</a></button>';
if (ul){
     ul.appendChild(newLi);//adding list item to list
     urlsplit = window.location.href.split(':');
     lastsplit = urlsplit.length - 1;
     document.querySelector("#wiki-to-pdf-link").setAttribute('href','/wiki-to-pdf/unfold/'+urlsplit[lastsplit]);
}

/* iframe check */
if ( window.location !== window.parent.location ) {
  document.body.classList.add('iniframe');
}



$('.page-SoLiXG_Home .toc a').attr('href',function(i,v) { 
    return "https://titipi.org/wiki/index.php/SoLiXG:Key-concepts" + v;
});