MediaWiki:Gadget-addSigLink.js
Jump to navigation
Jump to search
Note: After publishing, 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.
// By Equazcion: http://terraria.gamepedia.com/User:Equazcion
var wgPageName = mw.config.get( 'wgPageName' );
if (($('#ca-addsection').length > 0) && (($('.editButtons').length > 0))
|| (wgPageName == 'Flight_Sim_Wiki:Admin_noticeboard') || (wgPageName == 'Flight_Sim_Wiki:Community_noticeboard')){
$('.editCheckboxes').css('margin-bottom','5px');
var addSigTooltip =
'Click the end of your comment, then click this link to add your signature.';
var addSigText = '<div style="border:1px var(--theme-border-color) solid; width:95%; padding:10px;"> ' +
'When you have finished typing your comment, ' +
'please place the cursor at the end of your comment and then ' +
'<a style="font-weight:bold;" href="#ggg" class="addSig" title="' + addSigTooltip + '">' +
'click here to add your signature</a>. <br/>' +
'<span style="font-size:90%">Your signature will display as "~~~~", ' +
'which will automatically turn into your name and date when you click the "save" button.</span></div>';
$('#editpage-copywarn').before(addSigText);
$('.addSig').click(function(){
var caretPos = document.getElementById('wpTextbox1').selectionStart;
var textAreaTxt = $("#wpTextbox1").val();
var txtToAdd = ' ~' + '~' + '~' + '~';
$('#wpTextbox1').val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos) );
});
}