MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ // following script by w:user:joeyaa -- adds link to contribs for logged-out people's article/blog comments

$('.details span[title]').each(function{       var t = $(this),        title = $(this).attr("title");        t.html('Unregistered user (IP: ' + title + ')'); });

if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Youtube_icon.svg/23px-Youtube_icon.svg.png", "speedTip": "Embed a YouTube Video", "tagOpen": " ", "tagClose": " ", "sampleText": "Video ID"}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/c/c9/Button_strike.png", "speedTip": "Strike", "tagOpen": " ", "tagClose": " ", "sampleText": "Strike-through text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAAAXNSR0IArs4c6QAAAk9QTFRFAAAAgAAAAIAAgIAAAACAgACAAICAwMDAwNzApsrwAAAAQ1l4SGB7a3uQdYijhpixkKO9k6bAl6rEmq3HnrHLo7bQqLvVrb/YsMPds8bgus3nvc/owdTuxNjzydz20uT91+f+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////QEBAQUFBQkJCQ0NDRERERUVFRkZGR0dHSEhISUlJSkpKS0tLTExMTU1NTk5OT09PUFBQUVFRUlJSU1NTVFRUVVVVVlZWV1dXWFhYWVlZWlpaW1tbXFxcXV1dXl5eX19fYGBgYWFhYmJiY2NjZGRkZWVlZmZmZ2dnaGhoaWlpampqa2trbGxsbW1tbm5ub29vcHBwcXFxcnJyc3NzdHR0dXV1dnZ2d3d3eHh4eXl5enp6e3t7fHx8fX19fn5+f39/gICAgYGBgoKCg4ODhISEhYWFhoaGh4eHiIiIiYmJioqKi4uLjIyMjY2Njo6Oj4+PkJCQkZGRkpKSk5OTlJSUlZWVlpaWl5eXmJiYmZmZmpqam5ubnJycnZ2dnp6en5+foKCgoaGhoqKio6OjpKSkpaWlpqamp6enqKioqampqqqqq6urrKysra2trq6ur6+vsLCwsbGxsrKys7OztLS0tbW1tra2t7e3uLi4ubm5urq6u7u7vLy8vb29vr6+v7+/wMDAwcHBwsLCw8PDxMTECL3QDwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90GCQccCQrY7AcAAACHSURBVCjPfchZDsMgEATR+jfOhldsSLj/JdNJjIRHKE+IHhW5qSe/Whz52dKRU4Jk/ekxQrTU9x12S33bYLPUQ4Bgqa8rrJb6ssBiqc8zzJb6NMFUlEt9HGEsyqk+DMBwKKe6954TBa/+kFP/BPV7Tfm76rca/Fb9WuNY9UuLo3ddVz194vo3NB0oZdoKj8sAAAAASUVORK5CYII=", "speedTip": "Redirect", "tagOpen": "#REDIRECT ",		"tagClose": "", "sampleText": "Insert text"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/clubpenguin/images/3/31/HighlightButton.png", "speedTip": "Highlight", "tagOpen": " ", "tagClose": " ", "sampleText": "Highlighted text here."};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/5/56/Button_big.png", "speedTip": "Large Text", "tagOpen": " ", "tagClose": " ", "sampleText": "Insert Text Here"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/5/58/Button_small.png", "speedTip": "Small Text", "tagOpen": " ", "tagClose": " ", "sampleText": "Insert Text Here" };

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/f/fd/Button_underline.png", "speedTip": " Underline Selected Text ", "tagOpen": " ", "tagClose": " ", "sampleText": "Insert text to underline!" };	mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAYAAAArdgcFAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90GCBEoGHtVh6UAAAAMaVRYdENvbW1lbnQAAAAAALyuspkAAAIYSURBVDjLtVW7ihRBFD13uvYxa2hmICIo4scIJgqCoOAPmAhGfoEYGGxiIisL/oCIoIEiGGhiZKDsKLg7jbrs4AxOd92HQVXPw77twqKVnOCcunWq7rkUmZnhP6w797YQBvuAmYGIXARwJO7j7jeEKI3xLjwaFytFr65qTKsai3j71k3cuHYFg8GgxTW4/eghrl+9jGdPn7gaM0MwSoct4mDnE0YHBxiPfyYvjmZv9yvK4R7KctihIQRmbXcj31DFIKJuw5oYqPoaMkNgjm6jAECUIcJuw8w0FxdXQ0QIIgwygxHN0LJ1ZYbEeombaVTzDdTXGBBULZ+GGc6dG1iXuQY139AMrgYwhLqOnW9elkMUYcV988lkkgyIIEZ2FIQgIl21sXn/7qGTmBrarkGE9OZd1s+eO4+NjWNu0S+fd7D/43t6c7cGchRzNmeYrV+4eAknT51e5jJubz3Am9cvoWpg0ZZGU/Ho7QUAMDNijC2OAGhOi6j4GjOEyJxanto8RwDCAo6xzRHBNMdV1NeAEIS5wzcgqnn62ndrhk3/oslp+WPjLAmak9DeOM+5uRoiQmARENJUNti4FxGIyBLX4Hz81deYITSNWVxFEVJWewRRcWPW6xVZW3RoCLT5+EXrm2NmqAhW19Y6h8dMUU0rrPf7Lv/81TuE0WjcWeDXNB46oVXt719dLxDevv/wzz/nlX7AmRPH8RuTxxRrcgmtcAAAAABJRU5ErkJggg==", "speedTip": "History table", "tagOpen": "{|class=\"wikitable sortable\"\n! scope=\"col\"| Catalog\n! scope=\"col\"| Available from\n! scope=\"col\"| Available until\n|-\n|catalog goes here\n|starting date\n|ending date\n|}", }; }

/* // ************************************************** // Experimental javascript countdown timer (Splarka) // Version 0.0.3 // ************************************************** // // Usage example: // //  Only January 01 2007 00 begin_of_the_skype_highlighting              01 2007 //00      end_of_the_skype_highlighting:00:00 PST until New years. // //  Javascript disabled. function updatetimer(i) { var now = new Date; var then = timers[i].eventdate; var diff = count=Math.floor((then.getTime-now.getTime)/1000); // catch bad date strings if(isNaN(diff)) { timers[i].firstChild.nodeValue = '** ' + timers[i].eventdate + ' **' ; return; } // determine plus/minus if(diff<0) { diff = -diff; var tpm = '+'; } else { var tpm = ''; } // calcuate the diff var left = (diff%60) + ' seconds'; diff=Math.floor(diff/60); if(diff > 0) left = (diff%60) + ' minutes ' + left; diff=Math.floor(diff/60); if(diff > 0) left = (diff%24) + ' hours ' + left; diff=Math.floor(diff/24); if(diff > 0) left = diff + ' days ' + left timers[i].firstChild.nodeValue = tpm + left; // a setInterval is more efficient, but calling setTimeout // makes errors break the script rather than infinitely recurse timeouts[i] = setTimeout('updatetimer(' + i + ')',1000); } function checktimers { //hide 'nocountdown' and show 'countdown' var nocountdowns = getElementsByClassName(document, 'span', 'nocountdown'); for(var i in nocountdowns) nocountdowns[i].style.display = 'none' var countdowns = getElementsByClassName(document, 'span', 'countdown'); for(var i in countdowns) countdowns[i].style.display = 'inline' //set up global objects timers and timeouts. timers = getElementsByClassName(document, 'span', 'countdowndate'); //global timeouts = new Array; // generic holder for the timeouts, global if(timers.length == 0) return; for(var i in timers) { timers[i].eventdate = new Date(timers[i].firstChild.nodeValue); updatetimer(i); //start it up  } } addOnloadHook(checktimers); // ************************************************** // - end -  Experimental javascript countdown timer // ************************************************** /* for title templates */ // rewriteTitle; // ************************************************** // "Username" template - from Bloons wiki // ************************************************** $(function { if ( typeof wgUserName != 'undefined' && // user is logged in   [1201,2001].indexOf(mw.config.get("wgNamespaceNumber")) === -1 // namespace != forum thread of board thread, due to template abuse ) {    $('.insertusername').html(wgUserName);  } }); /* hoverimage */ $(function {	$('div.fadein img').css('opacity','0.7');	$('div.fadein img').mouseover(function { $(this).animate({opacity:1},800); }).mouseout(function { $(this).animate({opacity:0.7},800); }); });

// BEGIN JavaScript title rewrite -- jQuery version and new wikia skin fixes by Grunny function rewriteTitle { if( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) { return; }	if( $('#title-meta').length == 0 ) { return; }	var newTitle = $('#title-meta').html; if( skin == "oasis" ) { $('header.WikiaPageHeader > h1').html(' ' + newTitle + ' '); $('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html + ';'); } else { $('.firstHeading').html(' ' + newTitle + ' '); $('.firstHeading').attr('style','text-align:' + $('#title-align').html + ';'); } } // END JavaScript title rewrite addOnloadHook(rewriteTitle); // interactive CP buttons function changeBgImage (image, id) { var element = document.getElementById(id); element.style.backgroundImage = "url("+image+")"; } function changeBgImage (image, id) { var element = document.getElementById(id); element.style.backgroundImage = "url("+image+")"; } /* hiding the TOC for template:hidetoc */ if ($(".hidetoc").length > 0) { $(document).ready(function {		$("#toc").addClass("tochidden");		$("#toc td > ul").css("display","none");		$("#toc .toctoggle a").text("show");	}); }

/* fixing links to Club Penguin's RSS for Template:ClubPenguinRSS */ /* a big credit for Mathmagician for making the script loop */ (function {	var markup = ".cprss-links > .wikiaRssPlaceholder > .wikiaRss";	$("body").on("DOMNodeInserted", markup, function { $(markup).find("a").each(function {			$(this).attr("href", "http://www.clubpenguin.com/" + $(this).attr("href"));		}); }); });

/* add Template:No license when the uploader skips the license selection */

$(document).ready(function {	$('select[name="wpLicense"]#wpLicense > option:contains(None selected)').attr("value","No license"); });

/* auto-download an example logo for Club Penguin Wiki:Logo Design */ // full support info at http://caniuse.com/download

$("a#wiki-logo-blank").attr("download","example_logo.png");

/* irc installation - code by Super Miron */ if (mw.config.get("wgUserName")) { $(".irc").html(" "); }

/* chat log search */

// when link is pressed $("a#chatlogs-search-button").mouseover(function {	if ($("input#chatlogs-search-box").val.length > 0) {		var google = "https://www.google.com/#q=site:",			site = encodeURIComponent("http://clubpenguin.wikia.com/wiki/Club_Penguin_Wiki:Chat/Logs/"),			string = encodeURIComponent($("input#chatlogs-search-box").val.replace(/ /g, "+")),			searchPage = google + site + "+" + string;		$(this).attr("href", searchPage);	} }); // when enter is pressed (on the text box) $("input#chatlogs-search-box").on("keypress", function(k) {	if (k.keyCode == 13 && $("input#chatlogs-search-box").val.length > 0) {		// if enter is pressed		$("a#chatlogs-search-button")[0].click;	} });

/* use the api to list the chat logs */ /* will not affect subpages of Club Penguin Wiki:Chat/Logs/misc (misc can begin with M) */

// will affect in subpages of Club Penguin Wiki:Chat if (mw.config.get("wgPageName").indexOf("Club_Penguin_Wiki:Chat/") == 0) { mw.util.addCSS(		'span.ChatLogsList {\n' +			'\tdisplay: none;\n' +		'}\n' +		'div.ChatLogsList {\n' +			'\twidth: 400px;\n' +			'\theight: 230px;\n' +			'\tmargin: 10px auto 5px auto;\n' +			'\tpadding: 0px;\n' +			'\tbackground: #fafafa;\n' +			'\tborder: 1px solid #cccccc;\n' +		'}\n' +		'div.ChatLogsList > div {\n' +			'\tbackground: #cccce8;\n' +			'\ttext-align: center;\n' +			'\tfont-size: 14px;\n' +			'\tline-height: 22px;\n' +			'\tfont-weight: bold;\n' +		'}\n' +		'div.ChatLogsList > ul {\n' +			'\tlist-style: none;\n' +			'\toverflow-y: scroll;\n' +			'\theight: 200px;\n' +			'\tmargin: 2px;\n' +			'\tpadding: 2px;\n' +		'}'	); $.getJSON("/api.php?action=query&format=json&list=allpages&apnamespace=4&apprefix=Chat/Logs/&aplimit=5000&cb=" + new Date.getTime, function(data) {		var a = data.query.allpages,			b = [],			months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];		for (var i = 0; i < a.length; i++) {			if (a[i].title.search(/Club Penguin Wiki\:Chat\/Logs\/[Mm]isc\//) == -1) {				var t = a[i].title.split("/Logs/")[1].split(" ");				b.push(t[2] + "-" + (String(months.indexOf(t[1])).length == 1 ? "0" + months.indexOf(t[1]) : months.indexOf(t[1])) + "-" + t[0]);				if (i + 1 == a.length) {					var c = b.sort.reverse, // sort to sort by dates, reverse to change it direction so it sorted by recent dates						d = [];					for (var j = 0; j < c.length; j++) {						var t = c[j].split("-"),							u = months[Number(t[1])] + ' ' + t[2] + ', ' + t[0]; d.push(							'' +							'' +							u +							'' +							''						); if (j + 1 == c.length) { $("span.ChatLogsList").replaceWith(' \n Chat logs \n\n' + d.join('\n') + '\n '); }					}				}			}		}	}); }

/* settings for DynamicImages - make gif images animated */

DynamicImages = { gifGalleryImages: true, gifImages: true, svgGalleryImages: false }

/*	import codes from other wiki pages before adding, it's recommended to move the pages to a	subpage of Common.js	also, make sure that you separate each page from the array with a comma

importArticles({	type: "script",	articles: [		"u:dev:PurgeButton/code.js",		"u:dev:AjaxRC/code.js",		"u:dev:ShowHide/code.js",		"u:dev:DisplayClock/code.js",		"u:zh.pad.wikia.com:MediaWiki:CountDown.js",		"u:dev:DupImageList/code.js",		"MediaWiki:Common.js/closeThread.js",		"MediaWiki:Common.js/ThreadAdminBadges-load.js",		"MediaWiki:Common.js/profileTags.js",		"u:dev:DynamicImages/code.js",		mw.config.get("wgPageName").indexOf("Club_Penguin_Wiki:Chat/") == 0 ? "MediaWiki:Common.js/chatLogView.js" : ""	] }, {	type: "style",	articles: [		"u:zh.pad.wikia.com:MediaWiki:CountDown.css"	] });

/* add to Template:Expansion a link to the incompleted section */ var headings = $("#mw-content-text *").filter("h1,h2,h3,h4,h5,h6"); for (hI = 0; hI < $(headings).length; hI++) { if ($(headings[hI]).next.hasClass("section-stub") == true) { $(headings[hI]).next.find(".mbox-text > .expand").html('expanding it'); } }

/* Special:CSS modifications for interfaceeditors and admins */ if (mw.config.get("wgCanonicalSpecialPageName") == "CSS" && (mw.config.get("wgUserGroups").indexOf("sysop") > -1 || mw.config.get("wgUserGroups").indexOf("interfaceeditor"))) { $(".css-editor-container .ace_indent-guide").css("opacity", "0.25"); $('a[accesskey="a"]').attr("target", "_blank"); // open history in a new ticket }

/* verbatim-independent script for playing Template:EmbedMusic */ /* syntax: ID */

// set function function EmbedMusic { if (		$("#mw-content-text span.EmbedMusic").length > 0 && // music fragments exist		Number($("#mw-content-text span.EmbedMusic").first.text) != NaN && // music has a valid input		[2, 3, 10, 500].indexOf(mw.config.get("wgNamespaceNumber")) > -1 // namespace: ["User", "User talk", "Template", "User blog"]	) { $("#mw-content-text span.EmbedMusic").first.replaceWith(			'' +			'' +			' '		);	} else if ($("#mw-content-text span.EmbedMusic").length > 0) {		console.log("Your music ID input for Template:EmbedMusic was not valid. Please try again.");	} }

if (mw.config.get("wgAction") == "edit") { // when ?action=edit $("body").on("DOMNodeInserted", ".WikiaArticle", function {		EmbedMusic;	}); } else { // not in the editor EmbedMusic; }

/* adding SVG section to the article Color */

if (mw.config.get("wgPageName") == "Color" && typeof window.SVGAElement !== "undefined") { // page is Color and the client supports SVG $.getJSON("/api.php?action=query&format=json&prop=revisions&titles=MediaWiki:ArticleColorInteractive&rvprop=content&cb=" + new Date.getTime, function(data) {		var a = data.query.pages;		for (var pageid in a) {			var content = a[pageid].revisions[0]["*"];			$("table#color-table").after( ' Interactive Color Preview \n' + content );			$("svg#colors-cp-interactive").css({ "display": "block", "margin": "auto" });			$("svg#colors-cp-interactive .color-svg-icon-container").mouseover(function { var fill = $(this).find(".color-svg-icon").css("fill"); $("svg#colors-cp-interactive .color-svg-target").each(function {					$(this).css("fill", fill);				}); });		}	}); }

/* remove extra breaks from featured blog posts on the main page */

if (mw.config.get("wgPageName") == "Club_Penguin_Wiki") { $(".WikiaBlogListingPost blockquote p").each(function {		if ($(this).html == " ") {			$(this).remove;		}	}); $(".WikiaBlogListingPost blockquote br + br").remove; }

/* load JSON files of club penguin - loaded using JSONP */ /*	example usage:

cpJSON.get({		file: "paper_items",		lang: "en",		success: function {console.log("Success", cpJSON.values["en"]["paper_items"]);},		error: function {console.log("Error");}	});

cpJSON = {}; cpJSON.values = {}; cpJSON.get = function(a) { var lang = a.lang == "pt" ? "pt" : a.lang == "fr" ? "fr" : a.lang == "es" ? "es" : a.lang == "de" ? "de" : a.lang == "ru" ? "ru" : "en", file = a.file; url = "http://media1." + (["characters", "worlds"].indexOf(a.file) > -1 ? "friends.go.com/content/disney-land-clubpenguin/" + lang + "/" : ["lands", "text"].indexOf(a.file) > -1 ? "friends.go.com/content/" + lang + "/" : ["markup", "images"].indexOf(a.file) > -1 ? "friends.go.com/content/" : "clubpenguin.com/play/" + lang + "/web_service/game_configs/") + a.file + ".jsonp?" + new Date.getTime, cb = ["lands", "characters", "text", "markup", "images", "worlds"].indexOf(a.file) > -1 ? a.file + "Data" : "cp_" + a.file, onSuccess = typeof a.success === "function" ? a.success : function {console.log("Finished loading '" + file + "' file as JSONP (" + lang + ")");}, onError = typeof a.error === "function" ? a.error : function {console.error("An error occured while attempting to load '" + file + "' file as JSONP (" + lang + ")");}; if (typeof cpJSON.values[lang] === "undefined") { // if language object is missing cpJSON.values[lang] = {}; }	if (typeof cpJSON.values[lang][file] === "undefined") { $.ajax({			url: url,			dataType: "jsonp",			jsonpCallback: cb,			success: function(data) {				cpJSON.values[lang][file] = data;				onSuccess;			},			error: function(data) {				onError;			}		}); } else { // file has already been loaded - execute onSuccess without reloading resource onSuccess; } }

/* generate auto-updated table for listing clothing items from all types */

if ($("#mw-content-text span#number-of-clothing").length > 0) { $(function {		function apply {			var a = cpJSON.values.en["paper_items"],				b = {1: 0/* colors */, 2: 0/* head */, 3: 0/* face */, 4: 0/* neck */, 5: 0/* body */, 6: 0/* hand */, 7: 0/* feet */, 8: 0/* pin-flag */, 9: 0/* bg */, 10: 0/* award */};			for (var i = 0; i < a.length; i++) {				b[a[i].type]++;				if (i + 1 == a.length) {					var markup = ' ';					$("span#number-of-clothing").replaceWith(markup); // 				}			}		}		cpJSON.get({ file: "paper_items", success: apply });	}); }

/* highlight comments of the blog post's author */

if ( wgNamespaceNumber == 8 ) { var authorUsername = wgTitle.split('/')[0]; appendCSS('\	.comments li[data-user="' + authorUsername + '"] blockquote { background: lightgray; }\	.comments li[data-user="' + authorUsername + '"] .speech-bubble-message { background: lightgray; }\	.comments li[data-user="' + authorUsername + '"] blockquote:after { border-color: transparent lightgray lightgray transparent !important; }\	'); }

/* dynamically generate player card image */

(function {	function foo {		$("span.player-card-image").each(function { var a = $.parseJSON($(this).attr("data-search")), b = Number(a.size) > 0 && Number(a.size) <= 600 ? Number(a.size) : 60; if (a.id != "undefined") { $(this).replaceWith(					''				); } else { $(this).replaceWith('Thumb error '); }		});	}	foo;	if (window.mediaWiki.config.get('skin') === 'oasis' && window.mediaWiki.config.get('wgAction') === 'edit') { // apply on editor by User:UltimateSupreme		$(window).on('EditPageAfterRenderPreview', function { foo; });	} });

/* remove video caption with file name if a caption was already specified */

$(document).ready(function {	$(".wikia-gallery .title + .lightbox-caption, figcaption > .title + .caption").prev.hide; });

/* js-based syntax for Template:MusicPlay */

$(function {	// File:FILENAME 	function MusicPlay {		if ([2, 3, 10, 500].indexOf(mw.config.get("wgNamespaceNumber")) > -1 && $.cookie("embedmusic") != "disabled") { // namespace: ["User", "User talk", "Template", "User blog"], also MusicPlay function not disabled by the client			// file names array (includes the File: prefix)			var titles = [];

// all elements that require $("span.MusicPlay").each(function {				var slash = $(this).html.replace(/_/g," ").split("/"); // for dealing with old syntax, at least for now				$(this).html(slash.length == 1 ? slash[0] : "File:" + decodeURIComponent(slash[slash.length-1]));				var a = encodeURIComponent($(this).html);				if (titles.indexOf(a) == -1) {					titles.push(a);				}				$(this).attr("data-src", a);			}); $.getJSON("/api.php?action=query&format=json&prop=imageinfo&iiprop=mime|metadata|url&titles=" + titles.join("|") + "&cb=" + new Date.getTime, function(data) {				var a = data.query.pages;				window.a = a;				for (var pageid in a) {					// if file exists					if (pageid > 0) {						// if is .ogg						if (a[pageid].imageinfo[0].mime == "application/ogg") {							var embed =								$(' ').attr({ "src": a[pageid].imageinfo[0].url, "type": "application/ogg", "height": "0", "width": "0", "class": "MusicPlay" });							/*								could use for looping, if specified:								a[pageid].imageinfo[0].metadata.[i/* 'i' has property 'length'*\/].value							*/							$('span[data-src="' + encodeURIComponent(a[pageid].title.replace(/&/g,"&amp;")) + '"].MusicPlay').replaceWith(embed);						}					} else {						// file doesn't exist- modify 'span.MusicPlay' element						$('span[data-src="' + encodeURIComponent(a[pageid].title) + '"].MusicPlay').each(function { var errorFilename = a[pageid].title.replace(/"/g,"\\");							$(this).html(								''							);							console.error('MusicPlay Error: couldn\'t find file named "' + errorFilename + '"');						});					}				}			});		}	}	if (mw.config.get("wgAction") == "edit") {		// when ?action=edit		$(window).on("EditPageAfterRenderPreview", function {			MusicPlay;		});	} else if ($("span.MusicPlay").length > 0) {		// not in the editor but 'span.MusicPlay' exists		MusicPlay;	} });