MediaWiki:Summaries.js

// ===================================================================== // Preloadable Edit Summaries //  - Originally from Runescape Wiki //  - Modified at Casualty Wiki for Editor V2 //   - Modified again at Runescape Wiki for better compatibility //  - Visually Tweaked at Casualty Wiki // // So basically, this code has been bounced between wikis and improved. // ===================================================================== // ==================== // Source Editor // ==================== $(function {       if (skin == 'oasis'){            var $label = $('#edit_enhancements_toolbar #wpSummary');	    if (!$label.size) {	    	    return;	    }        }        if (skin == 'monobook'){	    var $label = $('.editOptions #wpSummary');	    if (!$label.size) {	    	    return;	    }        }	$combo = $(' ').attr('id', 'stdSummaries').change(function { var val = $(this).val; if (val != '') { $('#wpSummaryEnhanced,#wpSummary').val(val); }	});       $label.after(' ').after($combo).after(' Summaries: ');	$.ajax({ 'dataType': 'text', 'data': { 'title': 'Template:Stdsummaries', 'action': 'raw', 'ctype': 'text/plain' },		'url': wgScript, 'success': function(data) { var lines = data.split("\n"); for (var i in lines) { var val = (lines[i].indexOf('-- ') == 0) ? lines[i].substring(3) : ''; var $opt = $(' ').val(val).text(lines[i].substring(3)); $combo.append($opt); }		}	}); }) // ==================== // Visual Editor // ==================== $(function {	var $label = $('.module_content #wpSummaryLabel');	if (!$label.size) {		return;	}	$combo = $(' ').attr('id', 'stdSummaries').change(function { var val = $(this).val; if (val != '') { $('#wpSummaryEnhanced,#wpSummary').val(val); }	});	$label.after($combo);	$.ajax({ 'dataType': 'text', 'data': { 'title': 'Template:Stdsummaries', 'action': 'raw', 'ctype': 'text/plain' },		'url': wgScript, 'success': function(data) { var lines = data.split("\n"); for (var i in lines) { var val = (lines[i].indexOf('-- ') == 0) ? lines[i].substring(3) : ''; var $opt = $(' ').val(val).text(lines[i]); $combo.append($opt); }		}	}); }) /* */