• 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/CommentQuote.js"

From Kancolle Wiki
Jump to navigation Jump to search
m (val instead of text)
m (wut)
Line 8: Line 8:
 
 
 
$(".quoteBtn").on("click", function(){
 
$(".quoteBtn").on("click", function(){
var origMsg = $(".article-comm-text", $("#"+$(this).data("id"))).id();
+
var origMsg = $(".article-comm-text", $("#"+$(this).data("id"))).text();
 
$("#article-comm.wikiaEditor").val("> ''"+origMsg+"''");
 
$("#article-comm.wikiaEditor").val("> ''"+origMsg+"''");
 
return true;
 
return true;

Revision as of 16:16, 21 December 2014

(function($, ArticleComments){
	"use strict";
	
	function AddButtons(){
		$("#article-comments-ul .comment").each(function(){
			$(".tools", this).prepend('<a href="#article-comments" class="quoteBtn actionButton" data-id="'+$(this).attr("id")+'">Quote.01</a>');
		});
		
		$(".quoteBtn").on("click", function(){
			var origMsg = $(".article-comm-text", $("#"+$(this).data("id"))).text();
			$("#article-comm.wikiaEditor").val("> ''"+origMsg+"''");
			return true;
		});
		
	}
	
	$(window).load(function(){
		
		if(ArticleComments){
			var realFunc = ArticleComments.addHover;
			ArticleComments.addHover = function () {
				var result = realFunc.apply(this, arguments);
				AddButtons();
				return result;
			};
		}
	});

}(jQuery, window.ArticleComments));