Difference between revisions of "User:Fbstj/gadget/history-test.js"

From The Coppermind
Jump to navigation Jump to search
(add edit buttons to templates)
 
m (dont link when no id)
Line 2: Line 2:
 
$('.navbar').attr('id', function(i, v) { $('.title', this).append("<span style='float: right; font-size: small;' >[<a href='/edit/Template:"+v+"'>edit</a>]</span>"); })
 
$('.navbar').attr('id', function(i, v) { $('.title', this).append("<span style='float: right; font-size: small;' >[<a href='/edit/Template:"+v+"'>edit</a>]</span>"); })
   
$('.infobox').attr('id', function(i, v) { $('.title', this).append("<span style='float: right; font-size: small;' >[<a href='/edit/Template:"+v+"'>edit</a>]</span>"); })
+
$('.infobox').attr('id', function(i, v) {
  +
if (!v) return v;
  +
v = v.replace('.26', '&').replace('.27', "'");
  +
$('.title', this).append("<span style='float: right; font-size: small;' >[<a href='/edit/Template:"+v.replace('.+"'>edit</a>]</span>");
  +
})

Revision as of 14:31, 21 January 2015

/* Add edit buttons to templates */
$('.navbar').attr('id', function(i, v) { $('.title', this).append("<span style='float: right; font-size: small;' >[<a href='/edit/Template:"+v+"'>edit</a>]</span>"); })

$('.infobox').attr('id', function(i, v) {
  if (!v) return v;
  v = v.replace('.26', '&').replace('.27', "'");
  $('.title', this).append("<span style='float: right; font-size: small;' >[<a href='/edit/Template:"+v.replace('.+"'>edit</a>]</span>");
})