- 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"
Jump to navigation
Jump to search
m (wut) |
m (v0.4) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
(function($, ArticleComments){ | (function($, ArticleComments){ | ||
"use strict"; | "use strict"; | ||
+ | console.log("Comment Quotes v0.4"); | ||
function AddButtons(){ | function AddButtons(){ | ||
$("#article-comments-ul .comment").each(function(){ | $("#article-comments-ul .comment").each(function(){ | ||
− | $(".tools", this).prepend('<a href="#article-comments" class="quoteBtn actionButton" data-id="'+$(this).attr("id")+'">Quote | + | $(".tools", this).prepend('<a href="#article-comments" class="quoteBtn actionButton" data-id="'+$(this).attr("id")+'">Quote</a>'); |
}); | }); | ||
$(".quoteBtn").on("click", function(){ | $(".quoteBtn").on("click", function(){ | ||
var origMsg = $(".article-comm-text", $("#"+$(this).data("id"))).text(); | var origMsg = $(".article-comm-text", $("#"+$(this).data("id"))).text(); | ||
− | $("#article-comm | + | $("textarea#article-comm").val("> ''"+origMsg.trim()+"''"); |
return true; | return true; | ||
}); | }); |
Latest revision as of 11:11, 28 December 2014
(function($, ArticleComments){
"use strict";
console.log("Comment Quotes v0.4");
function AddButtons(){
$("#article-comments-ul .comment").each(function(){
$(".tools", this).prepend('<a href="#article-comments" class="quoteBtn actionButton" data-id="'+$(this).attr("id")+'">Quote</a>');
});
$(".quoteBtn").on("click", function(){
var origMsg = $(".article-comm-text", $("#"+$(this).data("id"))).text();
$("textarea#article-comm").val("> ''"+origMsg.trim()+"''");
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));