Difference between revisions of "MediaWiki:Common.js"

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

Revision as of 13:17, 15 May 2020

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