User:Sometester/common.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin is at User:Sometester/common.css. |
- Report page listing warnings and errors.
var disabled = false;
var openPanel = false;
var firstTime = !localStorage.getItem("mv-panel-open");
if(firstTime){
openPanel = true;
localStorage.setItem("mv-panel-open", true);
}
//Redirects:
$.each([ "Rapa_Nui_National_Park", "New_York_City" ], function( index, value ) {
if(window.location.pathname === "/wiki/User:"+mw.user.getName()+"/" + value){
window.location = "http://multimedia-alpha.wmflabs.org/w/index.php?title=Special:UserLogin&returnto="+value;
}
});
function remote(){
var hash = "#enabled"
if(disabled){
hash = "#disabled";
}
$(".secretframe").remove();
$("body").append("<iframe class='secretframe' src='//multimedia-alpha.wmflabs.org/wiki/Lightbox_demo"+hash+"'></iframe>");
}
$(window).load(function(){
$("#fileinfotpl_date.fileinfo-paramfield").text("Upload date");
$('.fullImageLink img').after($("<br/>")).after($('.mw-mmv-view-expanded'));
$('.mw-mmv-view-expanded').html("");
$('.mw-mmv-view-expanded').wrap("<div class='mv-settings-actions'></div>");
$('.mv-settings-actions')
.append("<div class='mv-settings-dialog hidden'><div class='mv-accept'></div></div><div class='mv-settings'></div>");
$('.mw-mmv-view-expanded').attr("title", "View expanded (file preview)");
$('.mv-settings').attr("title", "Media viewing options");
//Init:
//$(".mw-mmv-view-expanded").addClass("hidden");
$(".mw-mmv-view-expanded").off("click");
$(".mw-mmv-view-expanded").click(function(ev){
ev.preventDefault();
window.history.back();
return false;
});
if(window.location.hash =="#disabled"){
localStorage.setItem("mv-disabled", true);
$(".mv-settings-dialog").removeClass('hidden');
} else if (window.location.hash =="#enabled"){
localStorage.setItem("mv-disabled", false);
}
disabled = (localStorage.getItem("mv-disabled") == "true");
if(disabled === true){
console.debug(disabled);
$(".mv-settings-dialog").addClass("disabled");
}
if(openPanel){
$(".mv-settings-dialog").removeClass("hidden");
}
//Events:
$('.fullImageLink,.mv-settings, .mw-mmv-view-expanded').mouseover(function(){
$(".mv-settings, .mw-mmv-view-expanded").removeClass("hidden");
});
$('.fullImageLink').mouseout(function(){
if(!openPanel)
$(".mv-settings, .mw-mmv-view-expanded").addClass("hidden");
});
$(".mv-settings").click(function(){
$(".mv-settings-dialog").toggleClass("hidden");
openPanel = !openPanel;
return false;
});
$('.fullImageLink').click(function(){
if(openPanel){
$(".mv-settings-dialog").toggleClass("hidden");
openPanel = !openPanel;
return false;
}
});
$('.mv-settings-dialog').click(function(){
$(".mv-settings-dialog").addClass("hidden");
openPanel = false;
return false;
});
$('.mv-settings-dialog .mv-accept').click(function(){
if(disabled){
disabled = false;
remote();
localStorage.setItem("mv-disabled", false);
$(".mv-settings-dialog").removeClass('disabled');
}else {
disabled = true;
remote();
localStorage.setItem("mv-disabled", true);
$(".mv-settings-dialog").addClass('disabled');
}
return false;
});
});