Benutzer:Schnark/js/fullscreen.js

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
//Dokumentation unter [[Benutzer:Schnark/js/fullscreen]] <nowiki>
mw.libs.deprecated = $.extend(mw.libs.deprecated, {fullscreen: 'Das Skript [[Benutzer:Schnark/js/fullscreen]] wird nicht mehr gepflegt.'});
importScript('Benutzer:Schnark/js/deprecated.js');

var fullscreen = {
version: 1.0,

only_on_edit: true,
width: '', height: '',
timeout_left: null, timeout_top: null,
left_show: true, top_show: true,

really_hide_left: function() {
 $('#mw-panel').css('height', $(document).height());
 $('#content').animate({marginLeft: '15px'});
 $('#mw-panel, #p-logo').animate({left: 15 - parseInt(fullscreen.width, 10) + 'px'});
 $('#mw-head').animate({width: '+=' + fullscreen.width});
 fullscreen.left_show = false;
},

really_show_left: function() {
 $('#content').animate({marginLeft: fullscreen.width});
 $('#mw-panel, #p-logo').animate({left: '0px'});
 $('#mw-head').animate({width: '-=' + fullscreen.width});
 fullscreen.left_show = true;
},

really_hide_top: function() {
 $('#mw-head').animate({top: 15 - parseInt(fullscreen.height, 10) + 'px'});
 $('#mw-head-base').animate({height: '15px'});
 fullscreen.top_show = false;
},

really_show_top: function() {
 $('#mw-head').animate({top: '0px'});
 $('#mw-head-base').animate({height: fullscreen.height});
 fullscreen.top_show = true;
},

hide_left: function() {
 if (!fullscreen.left_show) {
    if (fullscreen.timeout_left != null) { window.clearTimeout(fullscreen.timeout_left); fullscreen.timeout_left = null; }
 } else {
    if (fullscreen.timeout_left == null) fullscreen.timeout_left = window.setTimeout('fullscreen.really_hide_left();fullscreen.timeout_left=null;', 500);
 }
},

show_left: function() {
 if (fullscreen.left_show) {
    if (fullscreen.timeout_left != null) { window.clearTimeout(fullscreen.timeout_left); fullscreen.timeout_left = null; }
 } else {
    if (fullscreen.timeout_left == null) fullscreen.timeout_left = window.setTimeout('fullscreen.really_show_left();fullscreen.timeout_left=null;', 500);
 }
},

hide_top: function() {
 if (!fullscreen.top_show) {
    if (fullscreen.timeout_top != null) { window.clearTimeout(fullscreen.timeout_top); fullscreen.timeout_top = null; }
 } else {
    if (fullscreen.timeout_top == null) fullscreen.timeout_top = window.setTimeout('fullscreen.really_hide_top();fullscreen.timeout_top=null;', 500);
 }
},

show_top: function() {
 if (fullscreen.top_show) {
    if (fullscreen.timeout_top != null) { window.clearTimeout(fullscreen.timeout_top); fullscreen.timeout_top = null; }
 } else {
    if (fullscreen.timeout_top == null) fullscreen.timeout_top = window.setTimeout('fullscreen.really_show_top();fullscreen.timeout_top=null;', 500);
 }
},

init: function() {
 fullscreen.width = $('#mw-panel').width(); fullscreen.height = $('#mw-head').height();
 $('#mw-panel').hover(fullscreen.show_left, fullscreen.hide_left);
 $('#mw-head, #p-logo').hover(fullscreen.show_top, fullscreen.hide_top);
 fullscreen.really_hide_left(); fullscreen.really_hide_top();
}
};

if (!fullscreen.only_on_edit || mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit') $(fullscreen.init);
//</nowiki>