🏠 Home 

ipwebcam resize fix

for the pas one. my own use, probably not for you.


Install this script?
  1. // ==UserScript==
  2. // @name ipwebcam resize fix
  3. // @namespace http://lolno.com
  4. // @version 0.1
  5. // @description for the pas one. my own use, probably not for you.
  6. // @author Dobby233Liu
  7. // @match *://*/browserfs.html
  8. // @grant none
  9. // ==/UserScript==
  10. const $exists = function(s){
  11. return !(document.querySelectorAll(s).length <= 0);
  12. };
  13. const $obj = function(s){
  14. if(!$exists(s)) throw DOMException("Nonexist element/selector.");
  15. return (document.querySelectorAll(s).length == 1 ? document.querySelector(s) : document.querySelectorAll(s));
  16. };
  17. (function() {
  18. 'use strict';
  19. window.onresize = function(e){
  20. document.body.style.overflow = "hidden";
  21. if(!$exists("#img1") && !$exists("#img2")) throw Error("!$exists('#img1') && !$exists('#img2'). That shouldn't happening.")
  22. if($exists("#img1")){
  23. $obj("#img1").width = window.innerWidth;
  24. $obj("#img1").height = window.innerHeight;
  25. $obj("#img1").onclick = null;
  26. }
  27. if($exists("#img2")){
  28. $obj("#img2").width = window.innerWidth;
  29. $obj("#img2").height = window.innerHeight;
  30. $obj("#img2").onclick = null;
  31. }
  32. };
  33. window.onresize();
  34. })();