User:ACo2c/common.js: Difference between revisions

Content deleted Content added
Seems useful
Trying this; from here.
 
Line 1:
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('])');
}
});
}