Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Pinventado (talk | contribs) (Modify pattern links so that OPR is only shown when other pattern formats are not available) |
Pinventado (talk | contribs) (Implement function for each element rather than as a whole) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
/* Remove link to OPR if OPR does not exist */ | /* Remove link to OPR if OPR does not exist */ | ||
$(".pl-main a.new").remove(); | $(".pl-main a.new").parent().parent().parent().remove(); | ||
/* Remove link to other pattern format if page does not exist, but OPR page exists; remove extra ( ) */ | /* Remove link to other pattern format if page does not exist, but OPR page exists; remove extra ( ) */ | ||
$(".pl-main a:not(.new)").each(function(){ | |||
$(".pl- | var plothernew = $(".pl-other a.new", $(this).parent().parent().parent().parent()); | ||
$(".pl-main", | if (plothernew){ | ||
var container = plothernew.parent().parent().parent(); | |||
$(".pl-main", container).html($(".pl-content", container)); | |||
$(".pl-main", container).css("display", "inline"); | |||
$(".pl-other", container).remove(); | |||
} | |||
}); |
Latest revision as of 13:17, 15 September 2016
/* Any JavaScript here will be loaded for all users on every page load. */ /* Patternlinks */ /* Remove link to OPR if the page refers to that pattern */ $(".pl-other .selflink").parent().parent().next().remove(); /* Remove link to OPR if OPR does not exist */ $(".pl-main a.new").parent().parent().parent().remove(); /* Remove link to other pattern format if page does not exist, but OPR page exists; remove extra ( ) */ $(".pl-main a:not(.new)").each(function(){ var plothernew = $(".pl-other a.new", $(this).parent().parent().parent().parent()); if (plothernew){ var container = plothernew.parent().parent().parent(); $(".pl-main", container).html($(".pl-content", container)); $(".pl-main", container).css("display", "inline"); $(".pl-other", container).remove(); } });