For the latest updates, send a blank email to our SUBSCRIPTION ADDRESS
HEADLINES | CLASSIFIED | SPORTS | FORUM | BUSINESS | ENTERTAINMENT
Vol. 1, Issue 9
The News Organ of Liberty City
Thursday October 18th, 2001
" Yesterday's News Today "
MediaWiki:Monobook.js: Difference between revisions
From Liberty Tree
Jump to navigationJump to search
No edit summary |
No edit summary Tag: Reverted |
||
| Line 41: | Line 41: | ||
} | } | ||
}); | }); | ||
window.RufflePlayer = window.RufflePlayer || {}; | |||
window.addEventListener("load", function () { | |||
var ruffle = window.RufflePlayer.newest(); | |||
var player = ruffle.createPlayer(); | |||
var container = document.getElementById("ruffle"); | |||
if (!container) { | |||
console.error("#ruffle container not found."); | |||
return; | |||
} | |||
var classList = container.classList; | |||
if (classList.length === 0) { | |||
console.warn("No class found on #ruffle container to determine SWF file."); | |||
return; | |||
} | |||
var gameName = classList[0].replace(/[^a-zA-Z0-9_-]/g, ''); // Sanitize gameName | |||
if (!gameName) { | |||
console.warn("Invalid game name extracted from #ruffle container class."); | |||
return; | |||
} | |||
player.ruffle().load("/swf/" + gameName + ".swf"); | |||
player.style.width = "600px"; | |||
player.style.height = "600px"; | |||
container.appendChild(player); | |||
}); | |||
}); | }); | ||
Revision as of 09:22, 9 February 2025
/* All JavaScript here will be loaded for users of the MonoBook skin */
$(document).ready(function(){
var $archives = $("#p-ARCHIVES");
var dropdownTitle = $archives.find("h3").text();
var $label = $("<label>").attr("for", "archive-select").text(dropdownTitle);
var $select = $("<select>")
.attr("id", "archive-select");
var $defaultOption = $("<option>")
.attr("value", "")
.text(dropdownTitle)
.prop("selected", true);
$select.append($defaultOption);
$archives.find("div > ul > li").each(function(){
var $anchor = $(this).find("a");
var text = $anchor.text();
var value = $anchor.attr("href") || text;
var $option = $("<option>").attr("value", value).text(text);
$select.append($option);
});
// Append the new elements to the container.
$archives.empty().append($label).append($select);
// Attach the change event handler via jQuery.
$("#archive-select").on("change", function(){
var url = $(this).val();
if (url) {
window.location.href = url;
}
});
$(document).on("change", "#archive-select-mobilejs", function(){
var url = $(this).val();
if (url) {
window.location.href = url;
}
});
window.RufflePlayer = window.RufflePlayer || {};
window.addEventListener("load", function () {
var ruffle = window.RufflePlayer.newest();
var player = ruffle.createPlayer();
var container = document.getElementById("ruffle");
if (!container) {
console.error("#ruffle container not found.");
return;
}
var classList = container.classList;
if (classList.length === 0) {
console.warn("No class found on #ruffle container to determine SWF file.");
return;
}
var gameName = classList[0].replace(/[^a-zA-Z0-9_-]/g, ''); // Sanitize gameName
if (!gameName) {
console.warn("Invalid game name extracted from #ruffle container class.");
return;
}
player.ruffle().load("/swf/" + gameName + ".swf");
player.style.width = "600px";
player.style.height = "600px";
container.appendChild(player);
});
});
