sx007 / FullSportbox

// ==UserScript==
// @name        FullSportbox
// @namespace   https://openuserjs.org/users/sx007
// @homepage    https://openuserjs.org/scripts/sx007/FullSportbox
// @version     0.2.3
// @description Отображать сайт sportbox.ru по ширине экрана
// @author      sx007 (Хлибец Иван)
// @match       https://*.sportbox.ru
// @match       https://*.sportbox.ru/Vidy_sporta/*
// @updateURL   https://openuserjs.org/meta/sx007/FullSportbox.meta.js
// @downloadURL https://openuserjs.org/install/sx007/FullSportbox.user.js
// @supportURL  https://openuserjs.org/scripts/sx007/FullSportbox/issues
// @copyright   2022, sx007 (https://openuserjs.org/users/sx007)
// @license     MIT
// @icon        data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbn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tkIt3l2bvLJJuVYg55MEb1BTs+2q34Vq3gQiFlyM0hH+z26fW22GqS4tFgCeRKnahOxQK9Wo1AWJWlyAYF0gEeRIexFrIJcEM/MGgw0uYnN5hyxSpnaGIgMOiJL3DG6/2IktW6iMY1t++EIqipapiNou9XgFSnCHenTlgyMuRk0Xc9bG1iAuEKnl+qjFQ2xtNQQbKm7upxpDI7nRKMSS4vZ46DInXB1KEYVkFjlRgWG6FZs0ZklBiWluG5NTI1pAhaUW+tWJIZpVyTRiSXGZdfYbk14lXmWFFCt2rybBSlfpVY1jBvxqsDsPK/ldiFRj+F2AA/ag9fNeZga4AAAAASUVORK5CYII=

// ==/UserScript==

const screenWidth = window.outerWidth;
const screenHeight = window.outerHeight;
//console.log(screenWidth, screenHeight);

/*Контент*/
var elPageWrapper = document.querySelector('.wrapper');
var elPageheaderbox = document.querySelector('#header-box');
var elPagecontent = document.querySelector('#content');
var elPageoffcanvasleft = document.querySelector('.row.row-offcanvas.row-offcanvas-left');
var elPageumaplaylist = document.querySelector('.umaplaylist');
var elSpbPlayer = document.querySelector('#spb_player_iframe');
var blockVidio = document.querySelector('.node-header__video');

if (screenWidth > 1215) {
    //
    if(elPageWrapper){
        elPageWrapper.setAttribute("style", "max-width: " + (screenWidth - 33) +"px;");
    }
    if(elPageheaderbox){
        elPageheaderbox.setAttribute("style", "max-width: " + (screenWidth - 163 - 34) +"px; width: " + (screenWidth - 163 - 34) +"px;");
    }
    if(elPagecontent){
        elPagecontent.setAttribute("style", "max-width: " + (screenWidth - 163 - 34) +"px; width: " + (screenWidth - 163 - 34) +"px;");
    }
    if(elPageoffcanvasleft){
        elPageoffcanvasleft.setAttribute("style", "max-width: " + screenWidth +"px; width: " + screenWidth +"px;");
    }

    //Если на странице просмотра видео
    if (elPageumaplaylist) {
        var wCenter = screenWidth / 100 * 66.666;
        var hPlayer = wCenter / 1.777;
        elPageumaplaylist.setAttribute("style", "height: " + hPlayer + "px;");
    }
    if (elSpbPlayer) {
        var wSpbCenter = screenWidth / 100 * 66.666;
        var hSpbPlayer = wSpbCenter / 1.96;
        elSpbPlayer.setAttribute("style", "height: " + hSpbPlayer + "px;");
    }
	if (blockVidio) {
		var inframeP = blockVidio.getElementsByTagName('iframe')[0];
        var wP = inframeP.getAttribute("width");
        var hP = inframeP.getAttribute("height");
        if (wP & hP) {
            var wPony = screenWidth / 100 * 66.666;
            var hPony = wPony / 2.03;
            inframeP.setAttribute("width", wPony);
            inframeP.setAttribute("height", hPony);
        }
    }
}

/*Удаляем рекламу*/
function delAd() {
    if(document.querySelectorAll('[class^=adfox]')){
        document.querySelectorAll('[class^=adfox]').forEach(el => el.remove());
    }
    if(document.querySelectorAll('[id^=adfox]')){
        document.querySelectorAll('[id^=adfox]').forEach(el => el.remove());
    }
    if(document.querySelectorAll('[id^=banner]')){
        document.querySelectorAll('[id^=banner]').forEach(el => el.remove());
    }
    if(document.querySelectorAll("body > div[style='height: 120px;']")){
        document.querySelectorAll("body > div[style='height: 120px;']").forEach(el => el.remove());
    }
}

setTimeout(delAd, 1000);