MediaWiki:KevinWordBubble.js

$(function {   $("#WikiaPage").ready(function { $(".kevin-wb").each(function {           $(this).find(".kevin-wb-header").css({ "background": "url('" + $(this).find(".kevin-wb-header").data("kevin-wb-header-background") + "')" });           $(this).find(".kevin-wb-middle").css({ "background": "url('" + $(this).find(".kevin-wb-middle").data("kevin-wb-middle-background") + "')" });           $(this).find(".kevin-wb-bottom-header").css({ "background": "url('" + $(this).find(".kevin-wb-bottom-header").data("kevin-wb-bottom-header-background") + "')" });           mw.util.addCSS(' \ .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text { \ display: inline-block; \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 250%; \ } \               .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text { \ display: inline-block; \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 150%; \ } \               .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text { \ display: inline-block; \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 100%; \ } \               .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-primary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \               .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-secondary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \               .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-tertiary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \           ');        });        $(".kevin-wb-hover").on("mouseenter", function {            $(this).siblings(".kevin-wb-image").hide;            if ($(this).hasClass("kevin-wb-biography")) {                $(this).show;            } else {                $(this).siblings(".kevin-wb-biography").show;            }        });

$(".kevin-wb-hover").on("mouseleave", function {           $(this).siblings(".kevin-wb-image").show;

if ($(this).hasClass("kevin-wb-biography")) { $(this).hide; } else { $(this).siblings(".kevin-wb-biography").hide; }       });        $(".kevin-wb-biography").hide;        var DetectIE = IEBrowser,            DetectIEEdge = IEEdgeBrowser,            DetectFirefox = FirefoxBrowser;        function IEBrowser {            var userAgent = window.navigator.userAgent,                MSIEuserAgent = userAgent.indexOf('MSIE'),                TridentuserAgent = userAgent.indexOf('Trident/');            if (MSIEuserAgent > -1 || TridentuserAgent > -1) {                return true;            } else {                return false;            }        }        function IEEdgeBrowser {            var userAgent = window.navigator.userAgent,                EdgeuserAgent = userAgent.indexOf('Edge/');            if (EdgeuserAgent > -1) {                return true;            } else {                return false;            }        }        function FirefoxBrowser {            var userAgent = window.navigator.userAgent, FirefoxuserAgent = userAgent.indexOf('Firefox/'); if (FirefoxuserAgent > -1) { return true; } else { return false; }       }        if (DetectIE === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectIEEdge === true) { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectFirefox === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-ie-biography").hide; } else { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-ie-biography").hide; }   });    if (wgAction == "edit") {        var EditPreviewObserver = new MutationObserver(function(EditPreviewMutations) { EditPreviewMutations.forEach(function(EditPreviewMutation) {               Array.prototype.forEach.call(EditPreviewMutation.addedNodes, function(EditPreviewNode) { if (EditPreviewNode.id == "EditPageDialog") { function KevinWBPreview { if ($(".kevin-wb").length >= 1) { $(".kevin-wb").each(function {                                   $(this).find(".kevin-wb-header").css({ "background": "url('" + $(this).find(".kevin-wb-header").data("kevin-wb-header-background") + "')" });                                   $(this).find(".kevin-wb-middle").css({ "background": "url('" + $(this).find(".kevin-wb-middle").data("kevin-wb-middle-background") + "')" });                                   $(this).find(".kevin-wb-bottom-header").css({ "background": "url('" + $(this).find(".kevin-wb-bottom-header").data("kevin-wb-bottom-header-background") + "')" });                                   mw.util.addCSS(' \ .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 250%; \ } \                                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 150%; \ } \                                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 100%; \ } \                                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-primary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-secondary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-tertiary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                                   ');                                });                                $(".kevin-wb-hover").on("mouseenter", function {                                    $(this).siblings(".kevin-wb-image").hide;                                    if ($(this).hasClass("kevin-wb-biography")) {                                        $(this).show;                                    } else {                                        $(this).siblings(".kevin-wb-biography").show;                                    }                                });

$(".kevin-wb-hover").on("mouseleave", function {                                   $(this).siblings(".kevin-wb-image").show;

if ($(this).hasClass("kevin-wb-biography")) { $(this).hide; } else { $(this).siblings(".kevin-wb-biography").hide; }                               });                                $(".kevin-wb-biography").hide;

var DetectIE = IEBrowser, DetectIEEdge = IEEdgeBrowser, DetectFirefox = FirefoxBrowser; function IEBrowser { var userAgent = window.navigator.userAgent, MSIEuserAgent = userAgent.indexOf('MSIE'), TridentuserAgent = userAgent.indexOf('Trident/'); if (MSIEuserAgent > -1 || TridentuserAgent > -1) { return true; } else { return false; }                               }                                function IEEdgeBrowser { var userAgent = window.navigator.userAgent, EdgeuserAgent = userAgent.indexOf('Edge/'); if (EdgeuserAgent > -1) { return true; } else { return false; }                               }                                function FirefoxBrowser { var userAgent = window.navigator.userAgent, FirefoxuserAgent = userAgent.indexOf('Firefox/'); if (FirefoxuserAgent > -1) { return true; } else { return false; }                               }                                if (DetectIE === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectIEEdge === true) { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectFirefox === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-ie-biography").hide; } else { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-ie-biography").hide; }                           } else { setTimeout(KevinWBPreview, 0); }                       }

KevinWBPreview; }               });            });        });        EditPreviewObserverTarget = document.body,        EditPreviewObserverConfig = {            childList: true        };        EditPreviewObserver.observe(EditPreviewObserverTarget, EditPreviewObserverConfig);    }

var KevinWBObserver = new MutationObserver(function(KevinWBMutations) {		KevinWBMutations.forEach(function(KevinWBMutation) { Array.prototype.forEach.call(KevinWBMutation.addedNodes, function(KevinWBNode) {				if (KevinWBNode.nodeType == 1) {					if (KevinWBNode.id == "article-comments") {						$(".kevin-wb-hover").on("mouseenter", function { $(".kevin-wb").each(function {                               $(this).find(".kevin-wb-header").css({ "background": "url('" + $(this).find(".kevin-wb-header").data("kevin-wb-header-background") + "')" });                               $(this).find(".kevin-wb-middle").css({ "background": "url('" + $(this).find(".kevin-wb-middle").data("kevin-wb-middle-background") + "')" });                               $(this).find(".kevin-wb-bottom-header").css({ "background": "url('" + $(this).find(".kevin-wb-bottom-header").data("kevin-wb-bottom-header-background") + "')" });                               mw.util.addCSS(' \ .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 250%; \ } \                                   .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 150%; \ } \                                   .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 100%; \ } \                                   .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-primary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                                   .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-secondary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                                   .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-tertiary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                               ');                            });                            $(this).siblings(".kevin-wb-image").hide; if ($(this).hasClass("kevin-wb-biography")) { $(this).show; } else { $(this).siblings(".kevin-wb-biography").show; }                       });

$(".kevin-wb-hover").on("mouseleave", function {                           $(this).siblings(".kevin-wb-image").show;

if ($(this).hasClass("kevin-wb-biography")) { $(this).hide; } else { $(this).siblings(".kevin-wb-biography").hide; }                       });                        $(".kevin-wb-biography").hide;                        var DetectIE = IEBrowser,                            DetectIEEdge = IEEdgeBrowser,                            DetectFirefox = FirefoxBrowser;                        function IEBrowser {                            var userAgent = window.navigator.userAgent,                                MSIEuserAgent = userAgent.indexOf('MSIE'),                                TridentuserAgent = userAgent.indexOf('Trident/');                            if (MSIEuserAgent > -1 || TridentuserAgent > -1) {                                return true;                            } else {                                return false;                            }                        }                        function IEEdgeBrowser {                            var userAgent = window.navigator.userAgent, EdgeuserAgent = userAgent.indexOf('Edge/'); if (EdgeuserAgent > -1) { return true; } else { return false; }                       }                        function FirefoxBrowser { var userAgent = window.navigator.userAgent, FirefoxuserAgent = userAgent.indexOf('Firefox/'); if (FirefoxuserAgent > -1) { return true; } else { return false; }                       }                        if (DetectIE === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectIEEdge === true) { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectFirefox === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-ie-biography").hide; } else { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-ie-biography").hide; }					}				}			});		});	}),	KevinWBObserverTargetComment = document.querySelector("#WikiaArticleComments"),	KevinWBObserverConfig = {       childList: true,        subtree: true	};    if ($("#WikiaArticleComments").length >= 1) {	    KevinWBObserver.observe(KevinWBObserverTargetComment, KevinWBObserverConfig);    }    function KevinWBCommentHeight {        var KevinWBCommentCurrentHeight = $("div.article-comments").height;        function KevinWBCommentHeightChange {            var KevinWBCommentNewHeight = $("div.article-comments").height;

if ($("div.article-comments").length >= 1 && $(".kevin-wb").length >= 1 && KevinWBCommentCurrentHeight !== KevinWBCommentNewHeight) { KevinWBCommentCurrentHeight = $("div.article-comments").height; $(".kevin-wb").each(function {                   $(this).find(".kevin-wb-header").css({ "background": "url('" + $(this).find(".kevin-wb-header").data("kevin-wb-header-background") + "')" });                   $(this).find(".kevin-wb-middle").css({ "background": "url('" + $(this).find(".kevin-wb-middle").data("kevin-wb-middle-background") + "')" });                   $(this).find(".kevin-wb-bottom-header").css({ "background": "url('" + $(this).find(".kevin-wb-bottom-header").data("kevin-wb-bottom-header-background") + "')" });                   mw.util.addCSS(' \ .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 250%; \ } \                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 150%; \ } \                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text { \ position: relative; \ background: -webkit-linear-gradient(' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-top-gradient") + ', ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-bottom-gradient") + '); \ -webkit-background-clip: text; \ -webkit-text-fill-color: transparent; \ font-family: ' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-font") + '; \ font-style: italic; \ font-size: 100%; \ } \                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-primary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-primary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-secondary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-secondary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                       .' + $(this).find(".kevin-wb-other-header").data("kevin-wb-name") + '-tertiary-header-text:before { \ display: inline-block; \ position: absolute; \ z-index: -1; \ left: 0; \ background: none; \ content: attr(data-tertiary-header-text); \ text-shadow: 1px 1px' + $(this).find(".kevin-wb-other-header").data("kevin-wb-header-text-shadow-color") + '; \ } \                   ');                });                $(".kevin-wb-hover").on("mouseenter", function {                            $(this).siblings(".kevin-wb-image").hide;                            if ($(this).hasClass("kevin-wb-biography")) {                                $(this).show;                            } else {                                $(this).siblings(".kevin-wb-biography").show;                            }                        });

$(".kevin-wb-hover").on("mouseleave", function {                           $(this).siblings(".kevin-wb-image").show;

if ($(this).hasClass("kevin-wb-biography")) { $(this).hide; } else { $(this).siblings(".kevin-wb-biography").hide; }                       });                $(".kevin-wb-biography").hide;                var DetectIE = IEBrowser,                    DetectIEEdge = IEEdgeBrowser,                    DetectFirefox = FirefoxBrowser;                function IEBrowser {                    var userAgent = window.navigator.userAgent,                        MSIEuserAgent = userAgent.indexOf('MSIE'),                        TridentuserAgent = userAgent.indexOf('Trident/');                    if (MSIEuserAgent > -1 || TridentuserAgent > -1) {                        return true;                    } else {                        return false;                    }                }                function IEEdgeBrowser {                    var userAgent = window.navigator.userAgent,                        EdgeuserAgent = userAgent.indexOf('Edge/');                    if (EdgeuserAgent > -1) { return true; } else { return false; }               }                function FirefoxBrowser { var userAgent = window.navigator.userAgent, FirefoxuserAgent = userAgent.indexOf('Firefox/'); if (FirefoxuserAgent > -1) { return true; } else { return false; }               }                if (DetectIE === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectIEEdge === true) { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-other-biography").hide; } else if (DetectFirefox === true) { $(".kevin-wb-other-header").hide; $(".kevin-wb-ie-biography").hide; } else { $(".kevin-wb-firefox-ie-header").hide; $(".kevin-wb-ie-biography").hide; }           }        }        KevinWBCommentHeightChange; setInterval(KevinWBCommentHeightChange, 1000); }

KevinWBCommentHeight; });