Setting btn - [ X ]

Add custom btn for setting menubar

  1. // ==UserScript==
  2. // @name Setting btn - [ X ]
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.9
  5. // @description Add custom btn for setting menubar
  6. // @copyright 2022, terifash (https://greasyfork.org/en/users/964055-teri-fash)
  7. // @author teri.fash <teri.fash@gmail.com>
  8. // @license MIT
  9. // @match *://*.xvideos.com/video*
  10. // @icon https://www.xvideos.com/favicon-32x32.png
  11. // @supportURL https://github.com/TeriFash/x.scripts.user/issues
  12. // @homepageURL https://github.com/TeriFash/x.scripts.user
  13. // @run-at document-start
  14. // ==/UserScript==
  15.  
  16. (()=> {
  17. const styles = {
  18. zIndex: 1000,
  19. }
  20.  
  21. function setingsUpinit(seti) {
  22. let position = window.localStorage.getItem(`video-menu-position`);
  23.  
  24. // maybe need added class "init-ok"
  25. seti.addClass(`btn-settings-top btn-settings-top--${position === 'left' ? 'right' : 'left'}`).css(styles);
  26.  
  27. $('body').prepend(seti);
  28. }
  29.  
  30. function init() {
  31. const settings = $('#site-settings').clone();
  32.  
  33. setingsUpinit(settings);
  34. }
  35.  
  36. window.addEventListener('DOMContentLoaded', init);
  37. })();