112
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
mw.loader.load('//gu.ekatrafoundation.org/index.php?title=User:Gurwinder/Edittool.js&action=raw&ctype=text/javascript'); | mw.loader.load('//gu.ekatrafoundation.org/index.php?title=User:Gurwinder/Edittool.js&action=raw&ctype=text/javascript'); | ||
// Turn <span class="mw-charinsert">foo</span> into a button that inserts "foo" | |||
// into the edit box: | |||
$( function () { | |||
$( 'span.mw-charinsert' ).wrap( function () { | |||
var text = this.title || this.textContent; | |||
var parts = text.split( '+' ); | |||
if ( text === '+' ) parts = [ text ]; | |||
var front = decodeURIComponent( parts[0] || '' ); | |||
var back = decodeURIComponent( parts[1] || '' ); | |||
return $( '<button>' ).click( function () { | |||
insertTags( front, back, '' ); | |||
return false; | |||
} ); | |||
} ); | |||
} ); | |||
$( function(){ | $( function(){ | ||