Advertisement
ValerioLyndon

MAL Back to Top v1.0

Jun 24th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         MyAnimeList Back to Top for Lists
  3. // @description  Adds a "back to top" button on your anime/manga lists.
  4. // @namespace    V.L
  5. // @version      1.0
  6. // @match        https://myanimelist.net/animelist/*
  7. // @match        https://myanimelist.net/mangalist/*
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. // Add CSS
  12. var css = `#js-top {
  13.   position: fixed;
  14.   bottom: 12px;
  15.   right: 12px;
  16.   z-index: 500;
  17.   width: 24px;
  18.   height: 24px;
  19.   border: 3px solid #fff;
  20.   border-radius: 50%;
  21.   box-sizing: initial;
  22.   text-align: center;
  23.   cursor: pointer;
  24. }
  25.  
  26. #js-top:before {
  27.   content: "\\f062";
  28.   color: #fff;
  29.   font: 16px/24px FontAwesome;
  30. }
  31.  
  32. body[data-owner=''] #js-top {
  33.   display: none;
  34. }`;
  35. var head = document.head;
  36. var style = document.createElement('style');
  37.  
  38. head.appendChild(style);
  39. style.type = 'text/css';
  40. style.appendChild(document.createTextNode(css));
  41.  
  42. // Create Button
  43. document.body.innerHTML += '<a onclick="window.scrollTo(window.scrollX,0);" id="js-top" />';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement