Chan & Idol Sankaku Video Helper

Resize HTML5 Player's width, disable autoplay, show control panel, set volume in 1%.

  1. // ==UserScript==
  2. // @name Chan & Idol Sankaku Video Helper
  3. // @name:ja Chan & Idol Sankaku Video Helper
  4. // @name:ru Chan & Idol Sankaku Video Helper
  5. // @namespace http://tampermonkey.net/
  6. // @version 1.1.2
  7. // @description Resize HTML5 Player's width, disable autoplay, show control panel, set volume in 1%.
  8. // @description:ja Resize HTML5 Player's width, disable autoplay, show control panel, set volume in 1%.
  9. // @description:ru Уменьшает ширину плеера до 1000, отключает автовоспроизведение, показывает панель навигации, устанавливает громкость в 1%.
  10. // @author MrModest
  11. // @license MIT
  12. // @match https://chan.sankakucomplex.com/*
  13. // @match https://idol.sankakucomplex.com/*
  14. // @match https://beta.sankakucomplex.com/*
  15. // @include https://chan.sankakucomplex.com/*
  16. // @include https://idol.sankakucomplex.com/*
  17. // @include https://beta.sankakucomplex.com/*
  18. // @grant none
  19. // ==/UserScript==
  20.  
  21. (function (window) {//normalized 'window'
  22. var w;
  23. w = window;
  24. // In user scripts you can insert almost any javascript-library.
  25. // The library code is copied directly into the user's script.
  26. // When including a library, you need to pass 'w' as the 'window' parameter
  27. // Examle: include 'jquery.min.js'
  28. // (function(a,b){function ci(a) ... a.jQuery=a.$=d})(w);
  29. // Without this 'if' script will running several times on page with frames
  30. if (w.self != w.top) {
  31. return;
  32. }
  33. if ((/https:\/\/chan.sankakucomplex.com/.test(w.location.href)) || (/https:\/\/idol.sankakucomplex.com/.test(w.location.href))) {
  34. var videoTag = document.getElementById('image');
  35. if (videoTag !== null) {
  36. if (Number(videoTag.getAttribute('width')) > 1000){
  37. videoTag.setAttribute('width', '1000'); //set width for video/gif/picture (default: 1000)
  38. videoTag.removeAttribute('height');
  39. }
  40. if (Number(videoTag.getAttribute('height')) > 500){
  41. videoTag.setAttribute('height', '500'); //set heigth for video/gif/picture (default: 500)
  42. videoTag.removeAttribute('width');
  43. }
  44. videoTag.setAttribute('controls', '');
  45. videoTag.removeAttribute('autoplay');
  46. videoTag.volume = 0.01; //set volume for video (default: 1%)
  47. }
  48. }
  49. if(/https:\/\/beta.sankakucomplex.com/.test(w.location.href)){
  50. console.log("Start script..");
  51. document.addEventListener('click', function(e) {
  52. if (e.button !== 2) return; //if not right mouse button (for work left button click)
  53. //console.log('click');
  54. if (e.target.tagName === 'VIDEO') {
  55. console.log('stop firefox right button click');
  56. e.stopPropagation();
  57. }
  58. }, true);
  59. function updateVideoTags() {//check new video tags in interval
  60. var videoTags = document.querySelectorAll("video:not([data-be-muted])"); //don't change changed tags
  61. if (videoTags.length < 1) return;
  62. for(var i = 0; i < videoTags.length; i++){
  63. videoTags[i].volume=0.01;
  64. videoTags[i].loop = true;
  65. videoTags[i].setAttribute('data-be-muted', ''); //mark tag as changed
  66. }
  67. console.log("I found " + videoTags.length + " video tags!");
  68. }
  69. setInterval(updateVideoTags, 500);
  70. }
  71. })(window);