secondchanceforme / dovi-smiles

// ==UserScript==
// @encoding     utf-8
// @id           dovi.never.ever
// @name         dovi-smiles
// @namespace    better-dovi
// @version      1.2.3
// @namespace
// @author       2poy\UB
// @description
// @grant        GM_addStyle
// @updateURL    https://openuserjs.org/meta/secondchanceforme/dovi-smiles.meta.js
// @include      http://dotavideo.ru/forum/view/*
// @include      http://dotavideo.ru/forum/editmess/*
// @include      http://dotavideo.ru/stream/*
// @include      http://dotavideo.ru/
// @include      http://dotavideo.ru/video/*
// @run-at       document-start
// ==/UserScript==;
function patchForum (smileDiv){
    //TODO replace dota emote
    //TODO add twitch emotes???
    var smileListDOTA = [];
    //http://dota2.gamepedia.com/Emoticons
    /*smileListDOTA.push(  // DOTO
        'http://www.cyberfrags.com/sml/cool.gif','http://www.cyberfrags.com/sml/give.gif',
        'http://www.cyberfrags.com/sml/wink.gif','http://www.cyberfrags.com/sml/facepalm.gif',
        'http://www.cyberfrags.com/sml/hex.gif','http://www.cyberfrags.com/sml/laugh.gif',
        'http://www.cyberfrags.com/sml/surprise.gif','http://www.cyberfrags.com/sml/rage.gif',
        'http://www.cyberfrags.com/sml/huh.gif','http://www.cyberfrags.com/sml/hush.gif',
        'http://www.cyberfrags.com/sml/cry.gif','http://www.cyberfrags.com/sml/sleeping.gif',
        'http://www.cyberfrags.com/sml/sad.gif','http://www.cyberfrags.com/sml/kissing.gif',
        'http://www.cyberfrags.com/sml/crazy.gif','http://www.cyberfrags.com/sml/disapprove.gif',
        'http://www.cyberfrags.com/sml/sick.gif','http://www.cyberfrags.com/sml/haste.gif',
        'http://www.cyberfrags.com/sml/inv.gif','http://www.cyberfrags.com/sml/ill.gif',
        'http://www.cyberfrags.com/sml/regen.gif','http://www.cyberfrags.com/sml/smile.gif',
        'http://www.cyberfrags.com/sml/troll.gif','http://www.cyberfrags.com/sml/highfive.gif','http://www.cyberfrags.com/sml/cheeky.gif',
        'https://pp.vk.me/c618222/v618222270/e836/WgVl9fuD0KA.jpg','https://pp.vk.me/c618222/v618222270/e83d/1G5wAh-GPM0.jpg','https://pp.vk.me/c618222/v618222270/e844/3NgCSZ6vlDI.jpg',
        'https://pp.vk.me/c618222/v618222270/e84b/354QtrfeDHo.jpg','https://pp.vk.me/c618222/v618222270/e852/l51E-T3ICps.jpg','https://pp.vk.me/c618222/v618222270/e859/v8nbX_xVF2Q.jpg',
        'https://pp.vk.me/c613422/v613422270/19c2c/O21sLGV6f-k.jpg','https://pp.vk.me/c613422/v613422270/19c33/MgrQJB6QiAc.jpg','https://pp.vk.me/c613422/v613422270/19c3a/PPxEtYH-c9k.jpg',
        'https://pp.vk.me/c613422/v613422270/19c41/ynZegPZgc8c.jpg','https://pp.vk.me/c613422/v613422270/19c52/ANqmHO9_M8c.jpg'
    );*/
    smileListDOTA.push(
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/wink.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/blush.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/cheeky.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/cool.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/crazy.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/cry.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/disapprove.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/doubledamage.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/facepalm.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/happytears.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/haste.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/hex.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/highfive.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/huh.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/hush.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/illusion.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/invisibility.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/laugh.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/rage.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/regeneration.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/sad.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/sick.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/sleeping.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/smile.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/surprise.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/aaaah.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/burn.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/hide.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/iceburn.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/tears.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/techies.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/fail.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/goodjob.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/headshot.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/heart.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/horse.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/grave.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_sad.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_surprise.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_upset.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_angry.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_embarrass.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_fade.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_fantastic.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_tired.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/dac15_water.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/pup.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/bts_bristle.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/bts_godz.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/bts_lina.gif",
        "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/bts_merlini.gif", "https://github.com/bontscho/dota2-chat-emoticons/raw/master/assets/images/bts_rosh.gif",
        "http://i.imgur.com/Ej0DYro.png"
    );
    //http://dota2.gamepedia.com/Emoticons
    //https://github.com/bontscho/dota2-chat-emoticons
    var smileListArtas = [];
    smileListArtas.push(  //Смайлы артасяна
        'http://doodoo.ru/smiles/anim3/b107.gif','http://doodoo.ru/smiles/anim4/bg136.gif','http://doodoo.ru/smiles/anim/big89.gif','http://doodoo.ru/smiles/anim2/big191.gif','http://doodoo.ru/smiles/anim2/big109.gif',
        'http://doodoo.ru/smiles/anim/big20.gif','http://savepic.org/965777.gif','http://doodoo.ru/smiles/anim/big85.gif','http://doodoo.ru/smiles/anim/big53.gif','http://doodoo.ru/smiles/anim/big21.gif',
        'http://doodoo.ru/smiles/anim/big29.gif','http://doodoo.ru/smiles/anim2/big117.gif','http://doodoo.ru/smiles/anim/hihi.gif','http://doodoo.ru/smiles/anim/big52.gif','http://www.yoursmileys.ru/ksmile/blin/k07035.gif',
        'http://doodoo.ru/smiles/anim/big49.gif','http://savepic.org/967838.gif','http://www.yoursmileys.ru/ksmile/blin/k07041.gif','http://doodoo.ru/smiles/anim/big06.gif','http://doodoo.ru/smiles/anim/muede.gif',
        'http://doodoo.ru/smiles/anim/big77.gif','http://www.yoursmileys.ru/ksmile/blin/k07116.gif','http://doodoo.ru/smiles/anim4/bg195.gif','http://doodoo.ru/smiles/anim/big32.gif','http://doodoo.ru/smiles/anim/big36.gif',
        'http://www.yoursmileys.ru/ksmile/blin/k07080.gif','http://doodoo.ru/smiles/anim/big135.gif','http://doodoo.ru/smiles/anim/big26.gif','http://doodoo.ru/smiles/anim/ups.gif','http://doodoo.ru/smiles/anim/nein.gif',
        'http://doodoo.ru/smiles/anim/big95.gif','http://doodoo.ru/smiles/anim2/big170.gif','http://www.yoursmileys.ru/ksmile/blin/k07009.gif','http://www.yoursmileys.ru/ksmile/blin/k07110.gif','http://www.yoursmileys.ru/ksmile/blin/k07097.gif',
        'http://doodoo.ru/smiles/anim/big114.gif','http://doodoo.ru/smiles/anim2/big134.gif','http://doodoo.ru/smiles/anim2/big171.gif','http://www.yoursmileys.ru/ksmile/blin/k07017.gif','http://doodoo.ru/smiles/anim4/bg062.gif'
    );


    /*var smileListSC2tv = [];
    smileListSC2tv.push(  //sc2tv
        'http://chat.sc2tv.ru/img/a.png','http://chat.sc2tv.ru/img/awesome.png','http://chat.sc2tv.ru/img/nocomments.png','http://chat.sc2tv.ru/img/manul.png','http://chat.sc2tv.ru/img/crazy.png','http://chat.sc2tv.ru/img/cry.png',
        'http://chat.sc2tv.ru/img/glory.png','http://chat.sc2tv.ru/img/kawai.png','http://chat.sc2tv.ru/img/mee.png','http://chat.sc2tv.ru/img/omg.png','http://chat.sc2tv.ru/img/mhu.png','http://chat.sc2tv.ru/img/sad.png',
        'http://chat.sc2tv.ru/img/slowpoke.png','http://chat.sc2tv.ru/img/2.png','http://chat.sc2tv.ru/img/mad.png','http://chat.sc2tv.ru/img/aangry.png','http://chat.sc2tv.ru/img/ii.png','http://chat.sc2tv.ru/img/happycry.png',
        'http://chat.sc2tv.ru/img/notch.png','http://chat.sc2tv.ru/img/neponi.png','http://chat.sc2tv.ru/img/vaganych.png','http://chat.sc2tv.ru/img/ra.png','http://chat.sc2tv.ru/img/fire.png',
        'http://www.doodoo.ru/smiles/anim/kreisch.gif','https://vk.com/images/stickers/103/64.png','https://vk.com/images/stickers/101/64.png','https://vk.com/images/stickers/105/64.png',
        'https://vk.com/images/stickers/126/64.png','https://vk.com/images/stickers/107/64.png','https://vk.com/images/stickers/112/64.png','https://vk.com/images/stickers/113/64.png','https://vk.com/images/stickers/110/64.png',
        'https://vk.com/images/stickers/108/64.png','https://vk.com/images/stickers/109/64.png','https://vk.com/images/stickers/114/64.png','https://vk.com/images/stickers/115/64.png','https://vk.com/images/stickers/116/64.png',
        'https://vk.com/images/stickers/100/64.png','https://vk.com/images/stickers/119/64.png','https://vk.com/images/stickers/98/64.png','https://vk.com/images/stickers/122/64.png','https://vk.com/images/stickers/117/64.png',
        'https://vk.com/images/stickers/118/64.png','https://vk.com/images/stickers/99/64.png','https://vk.com/images/stickers/125/64.png','https://vk.com/images/stickers/121/64.png','https://vk.com/images/stickers/128/64.png',
        'https://vk.com/images/stickers/104/64.png','https://vk.com/images/stickers/106/64.png','https://vk.com/images/stickers/120/64.png','https://vk.com/images/stickers/97/64.png'
    );*/

    var smileTroll = [];
    smileTroll.push(
        'http://savepic.net/2287973.gif','http://pro-dotu.3dn.ru/Smiles/troloklif.gif','http://pro-dotu.3dn.ru/_ph/3/1/125364227.jpg','http://pro-dotu.3dn.ru/_ph/3/1/897564132.jpg',
        'http://s49.radikal.ru/i124/1006/54/8ee140ef8038.gif','http://i.imgur.com/QbqcY.gif','http://pro-dotu.3dn.ru/_ph/3/1/252996417.jpg','http://pro-dotu.3dn.ru/_ph/3/1/630568862.jpg',
        'http://img9.imageshack.us/img9/580/29006542.png','http://i.imgur.com/56EZroY.gif','http://puu.sh/9j769/5f1d9702d4.gif','http://i.imgur.com/YjLp9TW.gif',
        'http://i.imgur.com/OJfxuk5.gif','http://savepic.org/6065319.gif','http://puu.sh/57PHr.gif','http://i60.fastpic.ru/big/2013/0906/b1/a0fa6a9357c71ad9fd4875d8ba7a87b1.gif'
    );
    smileDiv.removeAttribute("class");
    var smiles = smileListDOTA.map(smile).join('');
    function smile(sm_path){
        return '<a href="javascript:insertBB(\'topic_ta\', \'[IMG]'+sm_path+'[/IMG]\')" style="flex: 0 1 auto;"><img src="'+sm_path+'" alt="smile"></a>';
    }
    var flexSmilesDiv = document.createElement("div");
    smileDiv.parentNode.insertBefore(flexSmilesDiv,smileDiv);

    smileDiv.style.flex = "0 1 auto";
    smileDiv.style.display = "flex";
    smileDiv.style.alignItems = "flex-end";
    smileDiv.style.flexFlow = "row wrap";
    smileDiv.style.order = "1";

    flexSmilesDiv.appendChild(smileDiv);
    flexSmilesDiv.style.display = "flex";
    flexSmilesDiv.style.alignItems = "stretch";
    flexSmilesDiv.style.justifyContent = "flex-start";
    flexSmilesDiv.style.flexFlow = "column nowrap";
    flexSmilesDiv.style.flex = "0 1 auto";
    flexSmilesDiv.style.order = "2";

    var flexArtasDiv = document.createElement("div");
    var flexSC2tvDiv = document.createElement("div");
    var flexDotaDiv = document.createElement("div");
    flexArtasDiv.style.flex = "0 1 auto";
    flexArtasDiv.style.display = "flex";
    flexArtasDiv.style.alignItems = "flex-end";
    flexArtasDiv.style.flexFlow = "row wrap";
    flexArtasDiv.style.order = "3";
    //flexArtasDiv.style.
    flexArtasDiv.innerHTML = smileListArtas.map(smile).join('');
    flexSmilesDiv.appendChild(flexArtasDiv);


    /*flexSC2tvDiv.style.flex = "0 1 auto";
    flexSC2tvDiv.style.display = "flex";
    flexSC2tvDiv.style.alignItems = "flex-end";
    flexSC2tvDiv.style.flexFlow = "row wrap";
    flexSC2tvDiv.style.order = "4";
    flexSC2tvDiv.innerHTML = smileListSC2tv.map(smile).join('');
    flexSmilesDiv.appendChild(flexSC2tvDiv);*/

    flexDotaDiv.style.flex = "0 1 auto";
    flexDotaDiv.style.display = "flex";
    flexDotaDiv.style.alignItems = "flex-end";
    flexDotaDiv.style.flexFlow = "row wrap";
    flexDotaDiv.style.order = "2";
    //flexArtasDiv.style.
    flexDotaDiv.innerHTML = smileListDOTA.map(smile).join('');
    flexSmilesDiv.appendChild(flexDotaDiv);

    var flexDiv = document.createElement("div");
    //var textArea = document.getElementsByClassName("bbcodes-div")[0];
    var textArea = document.getElementById("topic_ta");
    textArea.style.width = "90%";
    textArea.setAttribute("placeholder", "Верните старое дови....");
    flexDiv.appendChild(textArea.previousElementSibling);
    var inputDiv = textArea.nextElementSibling;
    textArea.parentNode.insertBefore(flexDiv,textArea);
    flexDiv.appendChild(textArea);
    flexDiv.appendChild(inputDiv);

    flexDiv.style.display = "flex";
    flexDiv.style.alignItems = "flex-start";
    flexDiv.style.justifyContent = "flex-start";
    flexDiv.style.flexFlow = "column nowrap";
    flexDiv.style.flex = "1 0 35%";
    flexDiv.style.order = "1";

    var flexBlock = flexDiv.parentNode;
    flexBlock.style.display = "flex";
    flexBlock.style.alignItems = "flex-start";
    flexBlock.style.justifyContent = "flex-start";
    flexBlock.style.flexFlow = "row nowrap";
}

function patchMain(lastForumMessages){

    lastForumMessages = lastForumMessages.parentNode;
    //lastForumMessages.parentNode.style.display = "flex";
    //lastForumMessages.parentNode.style.alignItems = "center";
    //lastForumMessages.parentNode.style.justifyContent = "center";
    lastForumMessages.style.paddingLeft = "1%";
    lastForumMessages.style.flex = "1 0 auto";
    //lastForumMessages = document.getElementById("fast_news_list-v2-rel").parentNode;
    //lastForumMessages.style.flex = "1 0 auto";
    GM_addStyle(".forum-lasttopick-a { width: initial;");
    GM_addStyle(".fast-forum-blocks { display: flex; flex-direction: column; flex: 1 0 auto;");
    //remove dovi shit
    var shit = document.querySelector("h1+#onlinestreems");
    if(shit!==null){
        shit.style.display = "flex";
        shit.style.flexFlow = "row wrap";
        shit.style.justifyContent = "center";
        document.querySelector("#live-stream-1000").appendChild(shit);
    }
    //--remove dovi shit
    lastForumMessages.style.flexDirection = "column";
    lastForumMessages.style.display = "flex";
    lastForumMessages.style.float = "initial";
    
    document.querySelector("#live-stream-1000").style.maxWidth = "initial";
    var monitorDiv = document.querySelector("#onlinestreems");
    monitorDiv.style.display = "flex";
    monitorDiv.style.flexFlow = "row wrap";
    monitorDiv.style.justifyContent = "center";
    GM_addStyle(".newvideo { top: -2px; float: right;right: -2px;position: relative; }");
    GM_addStyle("a.play, a.play:visited { display: inherit; position: inherit;");
    GM_addStyle(".video-param-new { position: relative; top: -20px;left: auto;");
    GM_addStyle("#video-menu { margin: 39px 0 0;");
    GM_addStyle("#drive-buttons { left: 48.5%;");
    GM_addStyle(".streamsmode { display: none;");
    GM_addStyle("#live-stream-1000 > h1 { display: none;}");
    //- rearrange matches
    GM_addStyle("body > div.content > section > div.right > div.bets_h2 { display: none;}");
    var fkenmatches=document.querySelector("body > div.content > section > div.right > div.bb-betsblock-right");
    var rightblock=document.querySelector("body > div.content > section > div.right");
    var newsblock=document.querySelector("body > div.content > section > div.right > div.width-all.indexblocks.newsblockindex");
    rightblock.appendChild(newsblock);
    rightblock.appendChild(fkenmatches);
    //- end rearrange matches
    //rearrange videoblock
    function makeFlex(event){
        //var videoBlockElement = document.getElementsByClassName("new-videoblock active")[0];
        var rel_selector = event.currentTarget.getAttribute("rel");
        var videoBlockElement = document.querySelector("#videoaction > [rel="+rel_selector+"]");
        if(videoBlockElement === null){return;}
        if(videoBlockElement.style.width == "initial"){return;}
        var flexVideoBlockElement = document.createElement("div");
        videoBlockElement.style.width = "initial";
        videoBlockElement.style.float = "none";
        flexVideoBlockElement.style.display = "flex";
        flexVideoBlockElement.style.alignItems = "stretch";
        flexVideoBlockElement.style.justifyContent = "space-between";
        flexVideoBlockElement.style.flexFlow = "row wrap";
        var allVideos = Array.prototype.slice.call(videoBlockElement.getElementsByClassName("video-new"));
        for (var key in allVideos){
            allVideos[key].style.flex = "0 1 auto";
            flexVideoBlockElement.appendChild(allVideos[key]);
        }  
        videoBlockElement.appendChild(flexVideoBlockElement); 
    }
    var menus = document.querySelectorAll("#video-menu > span.xmenu");
    for(var i=0;i!=menus.length;++i){
        if(i==1){continue;}
        menus[i].addEventListener("click",makeFlex,true);        
    }
    var evt =new MouseEvent('click', {'bubbles': true,'cancelable': true});
    document.querySelector("#video-menu > span:nth-child(1)").dispatchEvent(evt);
    var vsDiv = document.querySelector("#vs");
    if(vsDiv !== null){
        var centralDiv = document.querySelector("#vsimage");
        var allBatlesDiv = vsDiv.querySelector("a.allbattles");
        var allBatles2Div = vsDiv.querySelector("a.allbattles2");
        centralDiv.appendChild(allBatlesDiv);
        centralDiv.appendChild(allBatles2Div);
        centralDiv.style.height = "130px";
        centralDiv.style.display = "flex";
        centralDiv.style.flexFlow = "column nowrap";
        centralDiv.style.justifyContent = "flex-end";
        centralDiv.style.alignItems = "center";
        centralDiv.style.position = "initial";
        centralDiv.style.order = "2";

        allBatlesDiv.style.order = "2";
        allBatlesDiv.style.position = "initial";
        allBatlesDiv.style.top = "initial";
        allBatlesDiv.style.left = "initial";
        allBatles2Div.style.order = "1";
        allBatles2Div.style.position = "initial";
        allBatles2Div.style.top = "initial";
        allBatles2Div.style.left = "initial";

        var vsCenterDiv = document.querySelector("#vs-center");
        vsCenterDiv.style.display = "flex";
        vsCenterDiv.style.flexFlow = "row nowrap";
        vsCenterDiv.style.justifyContent = "space-around";
        vsCenterDiv.style.alignItems = "center";
        document.querySelector("#vs-center > div.video-new.leftvideo").style.order = "1";
        document.querySelector("#vs-center > div.video-new.rightvideo").style.order = "3";
    }
}
function patchStream(streamDiv){
    streamDiv.style.display = "flex";
    streamDiv.style.flexFlow = "column nowrap";
}
function patchVideo(){
    var videoDiv = document.querySelector("#inner-1000");
    var videoPlayer = document.querySelector("#fullvideo");
    if(videoPlayer === null){return;}
    videoDiv.style.display = "flex";
    videoDiv.style.flexFlow= "row nowrap";
    videoDiv.style.justifyContent = "center";
    videoPlayer.insertBefore(document.querySelector("#inner-1000 > h1"),document.querySelector("#fullvideo > div.bread"));
    var videosDiv = document.querySelector("#fullvideo-right");
    videosDiv.style.width = "initial";
    videosDiv.style.padding = (document.querySelector("#fullvideo > h1").clientHeight - 12 -10)+"px";
    var videoVideo = document.querySelector("#fullvideo-right > div > noindex > div.videos");
    videoVideo.style.display = "flex";
    videoVideo.style.flexFlow = "column wrap";
}
function spy (event){
    if(document.location.pathname.indexOf("/forum/view/") === 0){        
        patchForum(document.getElementsByClassName("smiles")[0]);
        console.log("forum");
        return;
    }
    if(document.location.pathname == "/"){
        patchMain(document.getElementsByClassName("fast-forum-blocks")[0]);
        console.log("main");
        return;
    }
    if(document.location.pathname.indexOf("/stream/") === 0){
        patchStream(document.querySelector("#inner"));
        console.log("stream");
        return;
    }
    if(document.location.pathname.indexOf("/forum/editmess/") === 0){
        patchForum(document.getElementsByClassName("smiles")[0]);
        console.log("edit message");
        return;
    }
    if(document.location.pathname.indexOf("/video/") === 0){
        patchVideo();
        console.log("video");
        return;
    }
}
(function(){
    //Patching CSS
    GM_addStyle(".width-1000 { width: auto; }");
    GM_addStyle(".message { width: 100%; }");
    GM_addStyle(".d2net-video .content > header { max-width: 100%;background-repeat : round; background-repeat-y : no-repeat }");
    GM_addStyle(".content { max-width: 95%; }");
    GM_addStyle(".content > section { padding-left: 5%; padding-right: 2.5%; }");
    document.addEventListener('DOMContentLoaded',spy);

    //inner
    //alt+enter submit
    // embedded coub,youtube
    // remove vk smiles?
    // customize video
    // mark non-dota translations












})();