Diferencia entre revisiones de «MediaWiki:Common.js»
De OHO - search engine for sustainable open hardware projects
Línea 19: | Línea 19: | ||
}(mediaWiki, jQuery)); | }(mediaWiki, jQuery)); | ||
}); | }); | ||
$(".project_gallery_scroll_box").append('<div class="button_left"></div>'); | |||
$(".project_gallery_scroll_box").append('<div class="button_right"></div>'); | |||
$(".project_gallery_scroll_box a.image, .project_gallery_scroll_box img").unwrap('pre'); | |||
$(".project_gallery_scroll_box > a.image, .project_gallery_scroll_box > img").wrap('<div class="imgbox"></div>'); | |||
$(".project_gallery_scroll_box .imgbox").wrapAll('<div class="gallery_inner"></div>'); | |||
$('.project_gallery_scroll_box img').each(function(){ | |||
var imgClass = (this.width >= this.height) ? 'imgwfill' : 'imghfill'; | |||
$(this).addClass(imgClass); | |||
}); | |||
$(".project_gallery_scroll_box .button_left").click(function(){ | |||
var binn = $(this).parent().find(".gallery_inner"); | |||
if (binn.offset().left < 0) { | |||
var imgW = binn.find(".imgbox").first().outerWidth(); | |||
binn.animate({left:"+="+imgW}); | |||
} | |||
}); | |||
$(".project_gallery_scroll_box .button_right").click(function(){ | |||
var binn = $(this).parent().find(".gallery_inner"); | |||
if (binn.offset().left + binn.width() > binn.parent().width()) { | |||
var imgW = binn.find(".imgbox").first().outerWidth(); | |||
binn.animate({left:"-="+imgW}); | |||
} | |||
}); | |||
$(".project_gallery_scroll_box").removeClass('waitbox'); | |||
}); | }); | ||
Revisión del 22:55 20 oct 2020
/* Das folgende JavaScript wird für alle Benutzer geladen. */ jQuery(document).ready(function($) { mw.loader.using('jquery.ui.autocomplete', function() { (function (mw, $) { $(function () { $('.searchInputProjectKWAC').autocomplete( { source: function(request, response) { var api = new mw.Api(); api.get({action:'pfautocomplete', limit:10, substr:request.term, property:'Keywords'}).done( function (data) { var dataf = []; dataf = processListAC(request.term, data, dataf); dataf = dataf.sort().slice(0, 10); response(dataf); }); } }); }); }(mediaWiki, jQuery)); }); $(".project_gallery_scroll_box").append('<div class="button_left"></div>'); $(".project_gallery_scroll_box").append('<div class="button_right"></div>'); $(".project_gallery_scroll_box a.image, .project_gallery_scroll_box img").unwrap('pre'); $(".project_gallery_scroll_box > a.image, .project_gallery_scroll_box > img").wrap('<div class="imgbox"></div>'); $(".project_gallery_scroll_box .imgbox").wrapAll('<div class="gallery_inner"></div>'); $('.project_gallery_scroll_box img').each(function(){ var imgClass = (this.width >= this.height) ? 'imgwfill' : 'imghfill'; $(this).addClass(imgClass); }); $(".project_gallery_scroll_box .button_left").click(function(){ var binn = $(this).parent().find(".gallery_inner"); if (binn.offset().left < 0) { var imgW = binn.find(".imgbox").first().outerWidth(); binn.animate({left:"+="+imgW}); } }); $(".project_gallery_scroll_box .button_right").click(function(){ var binn = $(this).parent().find(".gallery_inner"); if (binn.offset().left + binn.width() > binn.parent().width()) { var imgW = binn.find(".imgbox").first().outerWidth(); binn.animate({left:"-="+imgW}); } }); $(".project_gallery_scroll_box").removeClass('waitbox'); }); function processListAC(search, data, dataf) { for(var dlist in data) { for(var drow in data[dlist]) { var listW = data[dlist][drow].title.split(","); for(var w in listW) { wt = listW[w].trim(); if (wt.length>0) { wt = wt.charAt(0).toUpperCase() + wt.substr(1).toLowerCase(); if (wt.toLowerCase().indexOf(search.toLowerCase())===0 && $.inArray(wt, dataf)===-1) { dataf[dataf.length] = wt; } } } } } return dataf; } /* Das folgende JavaScript wird für alle Benutzer geladen. */ $(".materialRow .showComment").click(function(){ $(this).parent().toggleClass("openComments"); $(this).parent().parent().next().toggle(500); }); $(".showGralComment").click(function(){ $(".generalCommentsBox").toggle(500); var grhtml = $(".showGralComment").html(); if (grhtml.indexOf('+') > -1) { grhtml = grhtml.replace('+', '-'); }else{ grhtml = grhtml.replace('-', '+'); } $(".showGralComment").html(grhtml); }); $(".project_material_table .showAllComments").click(function(e){ e.preventDefault(); var txt = $(this).html(); if (txt=='Show All Comments') { $(".project_material_table .materialCommandsBox").addClass("openComments"); $(".project_material_table .commentRow").not(".notFoundComment").show(500); $(this).html('Ocultar todas las revisiones'); }else{ $(".project_material_table .materialCommandsBox").removeClass("openComments"); $(".project_material_table .commentRow").not(".notFoundComment").hide(500); $(this).html('Ver todas las revisiones'); } }); $(".searchMatCol").keyup(function(e){ findRowsByCol($(".searchMatCol")); }); if (window.initJSFuncts!==undefined) { for(ijsf=0; ijsf<window.initJSFuncts.length; ijsf++) { try {window.initJSFuncts[ijsf]();}catch(e){console.log(e);} } } function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } } $(".newtablinks a, .newtablink").attr("target", "_blank");