Difference between revisions of "MediaWiki:Common.js"

From Taskman Wiki
Jump to navigation Jump to search
Line 1: Line 1:
// Replace linkline spans with individual links
+
$().ready(function() {
$("span.mw-linkline").each(function(index) {
+
  // Replace linkline spans with individual links
  let replaceString = $(this).data("format");
+
  $("span.mw-linkline").each(function(index) {
  $(this).html($(this).html().replace(/(.+?)(<br>|$)/g, `<a href="${replaceString}">$1</a>$2`));
+
    let replaceString = $(this).data("format");
 +
    $(this).html($(this).html().replace(/(.+?)(<br>|$)/g, `<a href="${replaceString}">$1</a>$2`));
 +
  });
 
});
 
});

Revision as of 13:01, 15 May 2020

$().ready(function() {
  // Replace linkline spans with individual links
  $("span.mw-linkline").each(function(index) {
    let replaceString = $(this).data("format");
    $(this).html($(this).html().replace(/(.+?)(<br>|$)/g, `<a href="${replaceString}">$1</a>$2`));
  });
});