MediaWiki:Common.js: Unterschied zwischen den Versionen

aus Memory Alpha, der freien deutschen Star-Trek-Datenbank
Spring zu: Navigation, suche
imported>Shisma
(test)
imported>Shisma
Zeile 8: Zeile 8:
  
 
(function ($) {
 
(function ($) {
   $(function() {
+
   $(function() {var fullImage = $('#file > a');
$('html').attr('xmlns:svg', "http://www.w3.org/2000/svg");
+
var regionBrowser = $('<div />', {
 +
  id: 'region-browser'
 +
});
 +
 
 +
fullImage.after(regionBrowser);
 +
 
 
$('.region-info').each(function() {
 
$('.region-info').each(function() {
 
   var that = $(this);
 
   var that = $(this);
 
   var src = $('.fullMedia > a').attr('href');
 
   var src = $('.fullMedia > a').attr('href');
 
   var c = that.attr('title').split(' ');
 
   var c = that.attr('title').split(' ');
 +
  var thumbHeight = 100;
  
 
   svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
 
   svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  svg.setAttribute('width', 60);
 
  svg.setAttribute('height', 80);
 
 
   svg.setAttribute('preserveAspectRatio', 'none');
 
   svg.setAttribute('preserveAspectRatio', 'none');
 +
 +
  var ratio = thumbHeight / c[3];
 +
 +
 
   svg.setAttribute('viewBox', (c[0] - (c[2] / 2)) + ' ' + (c[1] - (c[3] / 2)) + ' ' + c[2] + ' ' + c[3]);
 
   svg.setAttribute('viewBox', (c[0] - (c[2] / 2)) + ' ' + (c[1] - (c[3] / 2)) + ' ' + c[2] + ' ' + c[3]);
 +
  svg.setAttribute('height', thumbHeight);
 +
  svg.setAttribute('width', (c[2] * 1.5) * ratio);
  
 
   image = document.createElementNS("http://www.w3.org/2000/svg", "image");
 
   image = document.createElementNS("http://www.w3.org/2000/svg", "image");
Zeile 27: Zeile 37:
 
   image.setAttributeNS('http://www.w3.org/1999/xlink', 'href', src);
 
   image.setAttributeNS('http://www.w3.org/1999/xlink', 'href', src);
 
   $(image).appendTo(svg);
 
   $(image).appendTo(svg);
   that.html(svg);
+
   $(svg).appendTo(regionBrowser);
 
});
 
});
 +
 
   });
 
   });
 
})(jQuery);
 
})(jQuery);

Version vom 23. Oktober 2014, 20:41 Uhr

(function ($) {
  $(function() {
    var sidebarjs = $('<script type="text/javascript" />');
    sidebarjs.attr('src', 'http://de.memory-alpha.org/wiki/MediaWiki:Fusion/scripts/Sidebar.js?action=raw&ctype=text/javascript');
    $('head').append(sidebarjs);
  });
})(jQuery);

(function ($) {
  $(function() {var fullImage = $('#file > a');
var regionBrowser = $('<div />', {
  id: 'region-browser'
});

fullImage.after(regionBrowser);

$('.region-info').each(function() {
  var that = $(this);
  var src = $('.fullMedia > a').attr('href');
  var c = that.attr('title').split(' ');
  var thumbHeight = 100;

  svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  svg.setAttribute('preserveAspectRatio', 'none');

  var ratio = thumbHeight / c[3];


  svg.setAttribute('viewBox', (c[0] - (c[2] / 2)) + ' ' + (c[1] - (c[3] / 2)) + ' ' + c[2] + ' ' + c[3]);
  svg.setAttribute('height', thumbHeight);
  svg.setAttribute('width', (c[2] * 1.5) * ratio);

  image = document.createElementNS("http://www.w3.org/2000/svg", "image");
  image.setAttribute('width', 100);
  image.setAttribute('height', 100);
  image.setAttribute('preserveAspectRatio', 'none');
  image.setAttributeNS('http://www.w3.org/1999/xlink', 'href', src);
  $(image).appendTo(svg);
  $(svg).appendTo(regionBrowser);
});

  });
})(jQuery);