MediaWiki:Skin/Taschenlampe.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
(einfach mal entschlacken?)
 
(8 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 5: Zeile 5:
  
 
addOnloadHook( function () {
 
addOnloadHook( function () {
jQuery("#bodyContent").append('<div id="tl_top" class="tl_border" />')
+
jQuery("#bodyContent").append('<div id="tl_top" class="tl_border" />');
jQuery("#bodyContent").append('<div id="tl_left" class="tl_border" />')
+
jQuery("#bodyContent").append('<div id="tl_left" class="tl_border" />');
jQuery("#bodyContent").append('<div id="tl_right" class="tl_border" />')
+
jQuery("#bodyContent").append('<div id="tl_right" class="tl_border" />');
jQuery("#bodyContent").append('<div id="tl_bottom" class="tl_border" />')
+
jQuery("#bodyContent").append('<div id="tl_bottom" class="tl_border" />');
  
jQuery("#bodyContent").append('<img id="tl_itop" class="tl_image_h" src="/images/9/99/Tl_oben.png" />')
+
jQuery("#bodyContent").append('<img id="tl_itop" class="tl_image_h" src="/images/9/99/Tl_oben.png" />');
jQuery("#bodyContent").append('<img id="tl_ileft" class="tl_image_v" src="/images/5/5e/Tl_links.png" />')
+
jQuery("#bodyContent").append('<img id="tl_ileft" class="tl_image_v" src="/images/5/5e/Tl_links.png" />');
jQuery("#bodyContent").append('<img id="tl_iright" class="tl_image_v" src="/images/1/1c/Tl_rechts.png" />')
+
jQuery("#bodyContent").append('<img id="tl_iright" class="tl_image_v" src="/images/1/1c/Tl_rechts.png" />');
jQuery("#bodyContent").append('<img id="tl_ibottom" class="tl_image_h" src="/images/2/2a/Tl_unten.png" />')
+
jQuery("#bodyContent").append('<img id="tl_ibottom" class="tl_image_h" src="/images/2/2a/Tl_unten.png" />');
 +
 
 +
function tl_image_init () {
 +
  jQuery(".tl_image_h, .tl_image_v").show();
 +
  tl_image_init=function () {};
 +
}
  
 
jQuery("body").find('*').mousemove(function (e) {
 
jQuery("body").find('*').mousemove(function (e) {
 +
  tl_image_init()
 +
 
   var offset = ref.offset();
 
   var offset = ref.offset();
   var _left = e.pageX;
+
   var left = e.pageX - offset.left;
  var _top = e.pageY;
+
   var top = e.pageY - offset.top;
  var left = _left - offset.left;
 
   var top = _top - offset.top;
 
 
   var height = ref.height();
 
   var height = ref.height();
 
   var width = ref.width();
 
   var width = ref.width();
  
 
   if (left < m)
 
   if (left < m)
     left = m
+
     left = m;
  
 
   if (left > width - m)
 
   if (left > width - m)
     left = width - m
+
     left = width - m;
  
 
   if (top < m)
 
   if (top < m)
     top = m
+
     top = m;
  
 
   if (top > height - m)
 
   if (top > height - m)
     top = height - m
+
     top = height - m;
  
   var ileft = _left - n;
+
   var ileft = left + offset.left - n;
   var itop = _top - n;
+
   var itop = top + offset.top - n;
  
 
   jQuery("#tl_top").height(top-n);
 
   jQuery("#tl_top").height(top-n);

Aktuelle Version vom 9. Oktober 2011, 12:21 Uhr

n = 99;
m = n;
iw = 66;
ref = jQuery("#bodyContent");

addOnloadHook( function () {
jQuery("#bodyContent").append('<div id="tl_top" class="tl_border" />');
jQuery("#bodyContent").append('<div id="tl_left" class="tl_border" />');
jQuery("#bodyContent").append('<div id="tl_right" class="tl_border" />');
jQuery("#bodyContent").append('<div id="tl_bottom" class="tl_border" />');

jQuery("#bodyContent").append('<img id="tl_itop" class="tl_image_h" src="/images/9/99/Tl_oben.png" />');
jQuery("#bodyContent").append('<img id="tl_ileft" class="tl_image_v" src="/images/5/5e/Tl_links.png" />');
jQuery("#bodyContent").append('<img id="tl_iright" class="tl_image_v" src="/images/1/1c/Tl_rechts.png" />');
jQuery("#bodyContent").append('<img id="tl_ibottom" class="tl_image_h" src="/images/2/2a/Tl_unten.png" />');

function tl_image_init () {
  jQuery(".tl_image_h, .tl_image_v").show();
  tl_image_init=function () {};
}

jQuery("body").find('*').mousemove(function (e) {
  tl_image_init()

  var offset = ref.offset();
  var left = e.pageX - offset.left;
  var top = e.pageY - offset.top;
  var height = ref.height();
  var width = ref.width();

  if (left < m)
    left = m;

  if (left > width - m)
    left = width - m;

  if (top < m)
    top = m;

  if (top > height - m)
    top = height - m;

  var ileft = left + offset.left - n;
  var itop = top + offset.top - n;

  jQuery("#tl_top").height(top-n);
  jQuery("#tl_bottom").height(height - n - top + 1);
  jQuery("#tl_left").width(left-n);
  jQuery("#tl_right").width(width - n - left + 1);

  jQuery("#tl_itop").offset({top: itop, left: ileft});
  jQuery("#tl_ibottom").offset({top: itop+2*n-iw, left: ileft});
  jQuery("#tl_ileft").offset({top: itop+iw, left: ileft});
  jQuery("#tl_iright").offset({top: itop+iw, left: ileft+2*n-iw});
  jQuery("#tl_ibottom").offset({top: itop+2*n-iw, left: ileft});

});
});