Diferencia entre revisiones de «MediaWiki:Common.js»
De OHO - search engine for sustainable open hardware projects
Línea 38: | Línea 38: | ||
return dataf; | 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"); |
Revisión del 07:57 15 jun 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)); }); }); 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");