MediaWiki:Common.js

From Open Pattern Repository for Online Learning Systems
Revision as of 12:50, 22 July 2016 by Pinventado (talk | contribs) (Modify pattern links so that OPR is only shown when other pattern formats are not available)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* 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").remove();

/* Remove link to other pattern format if page does not exist, but OPR page exists; remove extra ( ) */
var hasoprnoother = $(".pl-other a.new", $(".pl-main a:not(.new)").parent().parent().parent().parent()).parent().parent().parent()
$(".pl-other", hasoprnoother).remove();
$(".pl-main", hasoprnoother).html($(".pl-content", hasoprnoother));