• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "User:Dragonjet/scripts/CloseThread.js"

From Kancolle Wiki
Jump to navigation Jump to search
m (logging)
m (use template instead of global vars to determine comment IDs to close)
Line 1: Line 1:
(function($, ArticleComments, ClosedThreads){
+
(function($, ArticleComments){
 
"use strict";
 
"use strict";
console.log("Close Thread v0.2");
+
console.log("Close Thread v0.3");
  
 
function ExecCloseThreads(){
 
function ExecCloseThreads(){
 
$(ClosedThreads).each(function(index, comment_id){
 
$(ClosedThreads).each(function(index, comment_id){
console.log("Closing: "+comment_id);
+
console.log("Closing: "+comment_id);
$("#comm-"+comment_id+" .article-comm-reply").hide();
+
$(".article-comm-reply", $(".wikiCloseCommentThread").closest(".comment" )).hide();
$("#comm-"+comment_id+" .tools").prepend('[Thread Closed]');
 
 
});
 
});
 
}
 
}
 
   
 
   
 
$(window).load(function(){
 
$(window).load(function(){
if(ClosedThreads.length > 0){
+
var realFunc = ArticleComments.addHover;
var realFunc = ArticleComments.addHover;
+
ArticleComments.addHover = function () {
ArticleComments.addHover = function () {
+
var result = realFunc.apply(this, arguments);
var result = realFunc.apply(this, arguments);
+
ExecCloseThreads();
ExecCloseThreads();
+
return result;
return result;
+
};
};
 
}
 
 
});
 
});
 
   
 
   
}(jQuery, window.ArticleComments, window.CloseThread));
+
}(jQuery, window.ArticleComments));

Revision as of 11:00, 8 January 2015

(function($, ArticleComments){
	"use strict";
	console.log("Close Thread v0.3");

	function ExecCloseThreads(){
		$(ClosedThreads).each(function(index, comment_id){
			console.log("Closing: "+comment_id);
			$(".article-comm-reply", $(".wikiCloseCommentThread").closest(".comment" )).hide();
		});
	}
 
	$(window).load(function(){
		var realFunc = ArticleComments.addHover;
		ArticleComments.addHover = function () {
			var result = realFunc.apply(this, arguments);
			ExecCloseThreads();
			return result;
		};
	});
 
}(jQuery, window.ArticleComments));