User:ITechieGamer/common.js

// From User:Majr's goToTop.js $(function { 'use strict';

$('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');  } });

});

//Edit Counter

/* Counts all your edits and saves them to a page ( http://en.wikipedia.org/wiki/User:Kanegasi/editcounter ) */ if (mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) { /* begin options */

/* end options */ mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Kanegasi/editcounter.js&action=raw&ctype=text/javascript'); }

//Buttons var $wpBtn = [$('#wpSave'), $('#wpPreview'), $('#wpDiff')]; $.each($wpBtn, function(i, v) { v.addClass('mw-ui-button'); });