Ouvrir le menu principal

Modifications

MediaWiki:Common.js

168 octets ajoutés, 1 février 2014 à 16:01
m
aucun résumé de modification
jQuery(document).ready(function($)
{
mw.loader.using( ['mediawiki.util'], function () { var getCSS = mw.util.getParamValue('css'); if(getCSS && getCSS == 'test') { $('link[href="http://ffxiv.wiki.jeuxonline.info/w/load.php?debug=false&lang=fr&modules=site&only=styles&skin=vector&*#ca-form_edit span a"]').attrtext('href', 'http://ffxiv.wiki.jeuxonline.info/w/index.php?title=User:Shockwave/common.css&action=raw&ctype=text/css'); } }"Modifier");
$("#ca-form_edit span atweets").texthtml($('<a>', {class:"Modifiertwitter-timeline", href:"https://twitter.com/JOL_FFXIV"}).attr('data-widget-id', '358938402130890752')); mw.loader.load('//platform.twitter.com/widgets.js');
$("#tweets").html($('<newTabLink a>', {class:"twitter-timeline", href:"https://twitter.com/JOL_FFXIV"}).attr('data-widget-idtarget', '358938402130890752')); mw.loader.load('//platform.twitter.com/widgets.js_blank');
$("a.sfUploadable").newTabLink attr('href', $("a.sfUploadable").attr('targethref', ) + '&wpUploadDescription=[[Catégorie:'+$("#imageCat").text()+'_blank]]');
/* Boîtes déroulantes */ $("a.sfUploadabletoggle-content").attrhide('href', ); $("a.sfUploadabletoggle").attrclick( function(e) { if( $(this).hasClass('href'"active") + '&wpUploadDescription=[[Catégorie:'+) { $(this).removeClass("#imageCatactive"); } else { $(this).addClass("active"); } $(this).next(".toggle-content").slideToggle(); e.textpreventDefault()+']]'; });
/* Boîtes déroulantes Formulaire objet : remplissage automatique de 2-3 champs */ $( ".toggle-content" ).hide(); $( ".toggleinput[name='Objet[niveau]']" ).clickon( 'focusout', function(e) { if( var itemLvl = $(this).hasClass("activeinput[name='Objet[itemLevel]']") ) {; $ if(this)!itemLvl.removeClassval("active");) } else { $(this) itemLvl.addClassval("active"); } $(this).nextval(".toggle-content").slideToggle(); e.preventDefault(); });
/* Formulaire objet : remplissage automatique de 2-3 champs */ $("inputform#sfForm").on('focusout', "select[name*='Objet/Recette'][niveauname*='[classe]']:eq(1)").on('focusout', function() { var itemLvl repairArtisan = $("inputselect[name='Objet[itemLevelartisan]']"); if(!itemLvlrepairArtisan.val()) itemLvl repairArtisan.val($(this).val()); });
$("form#sfForm").on('focusout', "select[name*='Objet /Recette'][name*='[classe]']:eq(1)", function() { var repairArtisan = $ Hightlight sur image map ("select[name='Objet[artisan]']"); if(!repairArtisanhttp://he.val()) repairArtisanwikipedia.val($(this)org/wiki/%D7%9E%D7%93%D7%99%D7%94_%D7%95%D7%99%D7%A7%D7%99:Imagemap-Highlight.val()js); }); */
/* Hightlight sur image map (http://he.wikipedia.org/wiki/%D7%9E%D7%93%D7%99%D7%94_%D7%95%D7%99%D7%A7%D7%99:Imagemap-Highlight.js) */  var myClassName = 'imageMapHighlighterArtefacts', hilightDivMarker = '.imageMapHighlighter';
function drawMarker(context, areas) { function drawPoly(coords) { context.moveTo(coords.shift(), coords.shift()); while (coords.length) context.lineTo(coords.shift(), coords.shift()); }
for(var i in areas) { var coords = areas[i].coords.split(','); context.beginPath(); switch (areas[i].shape) { case 'rect': drawPoly([coords[0], coords[1], coords[0], coords[3], coords[2], coords[3], coords[2], coords[1]]); break; case 'circle': context.arc(coords[0],coords[1],coords[2],0,Math.PI*2); break; case 'poly': drawPoly(coords); break; } context.closePath(); context.stroke(); context.fill(); } }
function drawPosition(context, xPos, yPos, rate) { var size = 50 * rate; var x = xPos * size; var y = yPos * size; context.beginPath(); context.moveTo(x, y); context.lineTo(x+size, y); context.lineTo(x+size, y+size); context.lineTo(x, y+size); context.lineTo(x, y); context.closePath(); context.stroke(); context.fill(); };
function mouseAction(e) { var $this = $(this), context = $this.data('context'), activate = e.type == 'mouseover'; $this.toggleClass('liHighlighting', activate); context.clearRect(0, 0, context.canvas.width, context.canvas.height); if (activate) drawMarker(context, $this.data('areas')); }
function mouseActionPosition(e) { var $this = $(this), context = $this.data('context'), activate = e.type == 'mouseover'; context.clearRect(0, 0, context.canvas.width, context.canvas.height); if (activate) { drawPosition(context, $this.data('xPos'), $this.data('yPos'), $this.data('rate')); } }
function pageOfHref(href, cssClass) { var page = href.replace(document.location.protocol + "/wiki/", '').replace(/.*\/\//, '').replace(/_/g, ' '); page = page.replace(/#(.*)/, function(toReplace){return toReplace.replace(/\.([\dA-F]{2})/g, '%$1');}); page = decodeURIComponent(page); if (cssClass.indexOf('new') + 1) page += ' (Page inexistante)'; return page; }
if($(hilightDivMarker).length && $('<canvas>')[0].getContext) { $(hilightDivMarker).each(function(index) { var mainDiv = $(this); if(mainDiv.hasClass('noLink')) { $("map area", mainDiv).removeAttr('href'); } var img = $('img', this), map = img.siblings('map:first'); /* if (!('area', map).length) return;*/ var w = img.width(), h = img.height(); var dims = {position: 'absolute', width: w + 'px', height: h + 'px', border: 0, top:0, left:0}; var jcanvas = $('<canvas>', {'class': myClassName}) .css(dims) .attr({width: w, height: h}); var bgimg = $('<img>', {'class': myClassName, src: img.attr('src')}) .css(dims); var context = $.extend(jcanvas[0].getContext("2d"), {fillStyle: 'rgba(255,255,255,0.5)', strokeStyle: 'rgba(0,0,0,0)', lineJoin: 'round', lineWidth: 0});
var div = $('<div>').css({position: 'relative', width: w + 'px', height: h + 'px'}); img.before(div); div.append(bgimg) .append(jcanvas) .append(img); img.fadeTo(1, 0); var ol = $('<ul>', {'class': myClassName}).css({clear: 'both', display: 'inline-block', width: w}); div.after(ol); var lis = {}; $('area', map).each(function() { var $this = $(this), text = this.title; var li = lis[text]; if (!li) { li = $('<li>'); if(mainDiv.hasClass('noLink')) { li.text(text); } else { li.addClass(myClassName); var href = this.href, cssClass = this['class'] || ''; li.append($('<a>', {href: href, title: pageOfHref(href, cssClass), text: text, 'class': cssClass})) } li.bind('mouseover mouseout', mouseAction) .data('areas', []) .data('context', context); lis[text] = li; ol.append(li); } li.data('areas').push(this); $(this).bind('mouseover mouseout', function(e) {li.trigger(e);}) $(".smwtable tr").has("td.Localisation:contains("+text.split(' (')[0]+")").bind('mouseover mouseout', function(e) {li.trigger(e);}) });
var mapData = $(".mapData", mainDiv).text().split(":"); if(mapData) { mapData[2] = w / mapData[2]; $(".smwtable tr:not(:has(td.Localisation)):has(td.Position)").each(function() { var pos = $("td.Position", this).text(); var xPos = (pos.substr(0, pos.indexOf(':')) - mapData[0]); var yPos = (pos.substring(pos.indexOf(':')+1) - mapData[1]); if(index == 0) { $(this).bind('mouseover mouseout', mouseActionPosition).data('context', context).data('xPos', xPos).data('yPos', yPos).data('rate', mapData[2]); } }); if(mw.config.get('wgCategories')[0] === 'ALEA') { var aleaPic = $('#mw-content-text img')[0]; var size = 50 * mapData[2]; var aleaX = (mapData[3]-mapData[0]) * size; var aleaY = (mapData[4]-mapData[1]) * size; context.drawImage(aleaPic, aleaX, aleaY); } } }); }
});
4 611

modifications