User:ITechieGamer/common.js

$(function { 'use strict';

// From User:Majr's goToTop.js $('body').append(' ▲ ▼ '); var $topBtn = $('#to-top'), $btmBtn = $('#to-btm'), $topBtmBtn = [$topBtn, $btmBtn];

$.each($topBtmBtn, function(i, v) { v.css({ 'position': 'fixed', 'bottom': '16px', 'padding': '8px', 'border-radius': '50%', 'color': '#FFF', 'cursor': 'context-menu', 'background': 'rgba(0,0,0,0.5)', 'transition': 'all 0.5s', 'user-select': 'none', 'overflow': 'hidden' }); v.on('click', function(event) { event.preventDefault;

var $div = $(' '), offset = $(this).offset, xPos = event.pageX - offset.left, yPos = event.pageY - offset.top;

$div.addClass('ripple-effect'); var $ripple = $(".ripple-effect");

$ripple.css({     height: $(this).height,      width: $(this).height    }); $div .css({       top: yPos - ($ripple.height/2),        left: xPos - ($ripple.width/2),        background: $(this).data("ripple-color")      }) .appendTo($(this));

window.setTimeout(function{     $div.remove;    }, 300); }); });

$topBtn.click(function { $('html, body').animate({ scrollTop: 0 }, '300ms'); }); $btmBtn.css('left', '16px').click(function { $('html, body').animate({ scrollTop: $(document).height }, '300ms'); });

$(document).ready(function { if ($(window).scrollTop > 0)     $topBtn.css('bottom', '16px');  else    $topBtn.css('bottom', '-48px');  if ($(window).scrollTop < Math.floor($(document).height - 700)) {    $btmBtn.css('bottom', '16px');    $topBtn.css('left', '56px');  } else {    $btmBtn.css('bottom', '-48px');    $topBtn.css('left', '16px');  } });

$(window).scroll(function { if ($(window).scrollTop > 0)    $topBtn.css('bottom', '16px');  else    $topBtn.css('bottom', '-48px');  if ($(window).scrollTop < Math.floor($(document).height - 700)) {    $btmBtn.css('bottom', '16px');    $topBtn.css('left', '56px');  } else {    $btmBtn.css('bottom', '-48px');    $topBtn.css('left', '16px');  } });

//External scripts mw.loader.localLoad = function(url) { return mw.loader.load('//minecraft.gamepedia.com/index.php?title='+url+'&action=raw&ctype=text/javascript') };

if (mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) { mw.loader.localLoad('User:Majr/editcounter.js'); } mw.loader.localLoad('User:Majr/inputCounter.js');

});