Greasy Fork is available in English.

video auto size

resize the video to pixel format size

Version vom 07.12.2016. Aktuellste Version

// ==UserScript==
// @name        video auto size
// @description resize the video to pixel format size
// @namespace   gnblizz
// @include     http://kissanime.to/*
// @version     1
// @grant       none
// @compatible  firefox
// @compatible  chrome
// ==/UserScript==

var video = document.getElementsByTagName('VIDEO')[0];
if(video) {
  //console.log('video auto size - video found');
  video.onloadedmetadata = setSizeNow;
} //else console.log('video auto size - no video!');

function setSizeNow(event) {
  if(video.style.width == 'unset') return;
  //console.log('video auto size', event);
  var obj = video.parentNode;
  var origWidth = parseInt(obj.style.width), origHeight = parseInt(obj.style.height);
  if(!origWidth) throw 'no width found!'; if(!origHeight) throw 'no height found!';
  video.style.width = 'unset'; video.style.height = 'unset';
  var deltaWidth = video.videoWidth - origWidth, deltaHeight = video.videoHeight+30 - origHeight, obj = video;
  do {
    var w = parseInt(obj.style.width), h = parseInt(obj.style.height);
    if(w) obj.style.width = (w + deltaWidth)+'px';
    if(h) obj.style.height = (h + deltaHeight)+'px';
    obj = obj.parentNode;
  } while(obj.id != 'containerRoot' && obj.tagName != 'BODY');
}

// public domain by gnblizz
// contact me with my username + '@web.de'