User:MateyY/CommentsDisabled.js

/* The following script was created by MateyY. * Version: 2.1.1 * For skins: all * JavaScript library used: jQuery * Function: Informs user whether comments are removed and/or disabled by changing the text displayed in the button and the heading comment counter on the bottom of the page. * Build for use on: all wikis * Do NOT copy the code; import it! * Thank you! */ (function($) {    var commentsInterval, commsDisabled;     function commentsDisabled {          if ($(".WikiaArticleComments.loading").length === 0 && commentsInterval) {               if (commsDisabled) {                    clearInterval(commentsInterval);                    return;               }               if (skin === "oasis" || skin === "wikia") {                    if (($("#article-comments").length <= 0) && ($("#WikiaPageHeader").length) && ($("#WikiaPageHeader a.comments:contains('Comments')"))) {                         if ($("#WikiaPageHeader a.comments").length > 0) $("#WikiaPageHeader a.comments").html(' Comments disabled ');                         else if ($("#WikiaPageHeader ul.commentslikes li.comments span.commentsbubble").length > 0 && $('#WikiaPageHeader ul.commentslikes li.comments a[href="#WikiaArticleComments"]').length > 0) $("#WikiaPageHeader ul.commentslikes li.comments span.commentsbubble").html("disabled"); $(".controls").remove; $("#article-comments-counter-header").html("Comments are disabled"); } else if (($("#article-comments").length <= 0) && ($("#WikiaUserPagesHeader a.comments:contains('Comments')"))) { $(".WikiaBlogPostHeader a.comments").html(' Comments disabled '); $(".controls").remove; $("#article-comments-counter-header").html("Comments are disabled"); } else if ($("#article-comm").is(":disabled") || $(".no-comments-allowed").length > 0) { $(".WikiaBlogPostHeader a.comments").html(' Comments disabled '); $("#WikiaPageHeader a.comments").html(' Comments disabled '); $(".controls").remove; $("#article-comments-counter-header").append(' (disabled) '); }              } else { if ($("#article-comm").is(":disabled") || $(".no-comments-allowed").length > 0) { $("").insertBefore($("h1#firstHeading")); $("h1#firstHeading").appendTo($("header#pageHeader")); $("header#pageHeader").append(' Comments disabled '); $("#article-comments-counter-header").append(' (disabled) '); $(".controls").remove; } else if ($("#article-comments").length <= 0) { $("").insertBefore($("h1#firstHeading")); $("h1#firstHeading").appendTo($("header#pageHeader")); $("header#pageHeader").append(' Comments disabled '); $(".controls").remove; $("#article-comments-counter-header").html("Comments are disabled"); }              }               commsDisabled = true; }    }     commentsInterval = setInterval(commentsDisabled,500); })(jQuery);