Jump to content

User:ACo2c/common.js

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by ACo2c (talk | contribs) at 18:44, 9 March 2018 (Trying this; from here.). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:Writ_Keeper/Scripts/previewAndDiff.js&action=raw&ctype=text/javascript");
importScript('User:Evad37/WikidataWatchlistLabels.js'); // [[User:Evad37/WikidataWatchlistLabels]]

if($('.diff-otitle').length === 0){
	var n = 80;
	$('.comment').each(function(i){
		var original = $(this).text();
		if(original.length > n){
			var $a = $('<a></a>',{
				href: "javascript:void(0)", 
				text: "..."
			});
			$a.click(function(){
				$(this).parent().text(original);
			});
			var shortText = $.trim(original).substring(0, n).trim(this);
			shortText = shortText + " [";
			$(this).text(shortText);
			$(this).append($a);
			$(this).append('])');
		}
	});
}