MediaWiki:Common.js/ForumChanges.js

/* Make various changes to the new forums */

jQuery(function ($) {   "use strict";

// Tag users in the new forums // Orginal script (http://dev.wikia.com/wiki/MessageWallUserTags/code.js) // by User:RyaNayR (http://dev.wikia.com/wiki/User:RyaNayR) // This version made by User:UltimateSupreme

var users = { // Tag all bureaucrats Utgarðar       : 'Bureaucrat', };

$.each(users, function (name, v) {       $(' ').text('(' + v + ')').insertAfter($('a.subtle[href$="User_talk:' + name.replace(/(["])/g, '\\$1') + '"]'));    });

// Votes Tally Script // Works with Template:VotesTally var supportNum = $(".support").length - $("div.quote .support").length - $(".SpeechBubble.message-removed .support").length + $(".SpeechBubble.message-removed .quote .support").length - 2, neutralNum = $(".neutral-vote").length - $("div.quote .neutral-vote").length - $(".SpeechBubble.message-removed .neutral-vote").length + $(".SpeechBubble.message-removed .quote .neutral-vote").length - 2, opposeNum = $(".oppose").length - $("div.quote .oppose").length - $(".SpeechBubble.message-removed .oppose").length + $(".SpeechBubble.message-removed .quote .oppose").length - 2, multiplier = 100 / (supportNum + neutralNum + opposeNum);

$("#support_num").text(supportNum + (supportNum == 1 ? " vote" : " votes")); $("#neutral_num").text(neutralNum + (neutralNum == 1 ? " vote" : " votes")); $("#oppose_num").text(opposeNum + (opposeNum == 1 ? " vote" : " votes"));

$("#support_bar").width(supportNum * multiplier + "%"); $("#neutral_bar").width(neutralNum * multiplier + "%"); $("#oppose_bar").width(opposeNum * multiplier + "%");

// Add Edit Button for forum posts $('nav .edit-message').each(function {        $(this).closest('.buttons').prepend(' Edit ');    });

// Warning notice on the threads near reply. $(".new-reply .MiniEditorWrapper").last.before(" Before posting, please ensure your reply complies with our Forum policies and the Wikia TOU. Posts in violation will be edited or removed. ");

// Warning notice when posting new thread. $(".ForumNewMessage .heading").after(" Before posting a new thread, please check below in case the topic already exists. If it doesn't, create a new thread, but ensure it complies with our Forum policies.");

// Notice on top of threads if(!$("#forum-warning-banner").length) { $("li.SpeechBubble").first.before(           ' Note: ' +            ' It is strongly recommended that the forum policy be read before contributing to the forums.' +            ' Also, do NOT  upload images specifically for use in the forums.' +            ' For any assistance, request action from a forum moderator by going to the Requests page. '        ); }

// Prevent Double Posting $("button.replyButton").click(function {       var lastUser = $("li.message").not(".hide").last.find("div.edited-by a").text,            lastPost = $("#mw-content-text .timeago.abstimeago").last.text;        if (/minute|second/.test(lastPost) && lastUser === mw.config.get("wgUserName")) {            $.showModal("Double Posting", "You are the latest poster. Please edit your latest reply instead of attempting to leave multiple consecutive posts");            return false;        }    });

});