×
Create a new article
Write your page title here:
We currently have 1,722 articles on The Quelmar Wiki. Type your article name above or click on one of the titles below and start writing!



The Quelmar Wiki

MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
/**
/**
* Adds CSS classes to the body tag based on the categories this page belongs to
* Adds CSS classes to the body tag based on the categories this page belongs to. Used for CR/Astral page theming.
*
*
* @source https://www.mediawiki.org/wiki/Snippets/Style_pages_based_on_categories
* @source https://www.mediawiki.org/wiki/Snippets/Style_pages_based_on_categories
Line 22: Line 22:
})(jQuery, mw);
})(jQuery, mw);


//Deprecated code: Used for autoplaying theme songs
function Bebop(){
//function Bebop(){
console.log("OK 3 2 1 Let's Jam");
// console.log("OK 3 2 1 Let's Jam");
var x = document.getElementById("myaudio");
// var x = document.getElementById("myaudio");
x.play();
// x.play();
}
//}

//
setTimeout(Bebop, 2000);
//setTimeout(Bebop, 2000);


// START HOTCAT
// START HOTCAT
window.hotcat_translations_from_commons = true;

/*
/*
This imports the latest version of HotCat from Commons.
This imports the latest version of HotCat from Commons.
Line 38: Line 37:
Full documentation can be found at http://commons.wikimedia.org/wiki/Help:Gadget-HotCat
Full documentation can be found at http://commons.wikimedia.org/wiki/Help:Gadget-HotCat
*/
*/
window.hotcat_translations_from_commons = true;
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
// END HOTCAT
// END HOTCAT

//Watermark AI Image
//Images can be renamed to have "-ai-" anywhere in their name and automatically get a watermark
$(document).ready(function() {
// Loop through all img tags
$('img').each(function() {
var img = $(this); // Reference to the current img tag in the loop
var src = img.attr('src'); // Get the src attribute

// Check if src contains '-ai' and doesn't already have 'watermarked' class
if (src.includes('-ai') && !img.hasClass('watermarked')) {
img.addClass('watermarked'); // Add the 'watermarked' class
}
});
});

Revision as of 19:54, 16 October 2023

/**
 * Adds CSS classes to the body tag based on the categories this page belongs to. Used for CR/Astral page theming.
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Style_pages_based_on_categories
 * @revision 2016-01-18
 */
(function($, mw) {
  var fn = function() {
    var cats = mw.config.get('wgCategories'), newClasses;
    if (cats) {
      newClasses = $.map(cats, function(el) {
        return 'cat-' + encodeURIComponent(el.replace(/[ .]/g, '_')).replace(/%/g, '_');
      }).join(' ');
      $(document.body).addClass(newClasses);
    }
  };
  if (document.body) {
    fn();
  } else {
    $(fn);
  }
})(jQuery, mw);

//Deprecated code: Used for autoplaying theme songs
//function Bebop(){
//	console.log("OK 3 2 1 Let's Jam"); 
//	var x = document.getElementById("myaudio"); 
//	x.play(); 
//}
//
//setTimeout(Bebop, 2000);

// START HOTCAT
/*
This imports the latest version of HotCat from Commons.
HotCat is a gadget to make changes to categories much easier.
Full documentation can be found at http://commons.wikimedia.org/wiki/Help:Gadget-HotCat
*/
window.hotcat_translations_from_commons = true;
mw.loader.load( 'https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );
// END HOTCAT

//Watermark AI Image
//Images can be renamed to have "-ai-" anywhere in their name and automatically get a watermark
$(document).ready(function() {
    // Loop through all img tags
    $('img').each(function() {
        var img = $(this); // Reference to the current img tag in the loop
        var src = img.attr('src'); // Get the src attribute

        // Check if src contains '-ai' and doesn't already have 'watermarked' class
        if (src.includes('-ai') && !img.hasClass('watermarked')) {
            img.addClass('watermarked'); // Add the 'watermarked' class
        }
    });
});
Cookies help us deliver our services. By using our services, you agree to our use of cookies. (Hi Margarita's Table. 🇩🇪)
Cookies help us deliver our services. By using our services, you agree to our use of cookies. (Hi Margarita's Table. 🇩🇪)