Bilibili AutoWide

Bilibili Player Auto WideScreen!

  1. // ==UserScript==
  2. // @name Bilibili AutoWide
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.7
  5. // @description Bilibili Player Auto WideScreen!
  6. // @author cuzfinal
  7. // @include *://www.bilibili.com/video/*
  8. // @include *://www.bilibili.com/bangumi/*
  9. // @include *://www.bilibili.com/*
  10. // @grant GM_addStyle
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. // Your code here...
  17. const $ = selector => document.querySelector(selector)
  18.  
  19. const playerNode = $('#bilibili-player')
  20. if (playerNode) {
  21. let mo
  22. mo = new MutationObserver((mutationList, observer) => {
  23. for(const mutation of mutationList) {
  24. if (mutation.target.classList?.contains?.('bpx-player-control-bottom-right')) {
  25. if ($('.bpx-player-ctrl-wide')) {
  26. setTimeout(() => {
  27. $('.bpx-player-ctrl-wide').click()
  28. }, 0);
  29. mo.disconnect()
  30. }
  31. }
  32. }
  33. })
  34. mo.observe($('#bilibili-player'), {
  35. childList: true,
  36. subtree: true,
  37. })
  38. }
  39. const adblockCss = `
  40. .adblock-tips { display: none!important; }
  41. `
  42. GM_addStyle(adblockCss)
  43. })();