thangdangblog / Ytmonster like youtube auto

// ==UserScript==
// @name         Ytmonster like youtube auto
// @namespace    https://www.youtube.com/channel/UCzL3j7ch8o7lbIBLYdSPVuQ?sub_confirmation=1
// @version      1.0
// @homepage    https://www.youtube.com/channel/UCzL3j7ch8o7lbIBLYdSPVuQ?sub_confirmation=1
// @description  Ytmonster like youtube auto
// @author       Thang Dang
// @license MIT
// @updateURL https://openuserjs.org/meta/thangdangblog/Ytmonster_like_youtube_auto.meta.js
// @copyright 2019, thangdangblog (https://openuserjs.org/users/thangdangblog)
// @match        https://ytmonster.ru/task/
// @match        https://www.youtube.com/watch?v*
// @grant        none
// ==/UserScript==

(function() {
	'use strict';
	var strUrl = window.location.href;
	if(strUrl.indexOf("ytmonster.ru") != -1){
        document.querySelector(".btn.btn-warning.openTask").click();
		var submitrun = _ =>{
			setInterval(function(){
				document.querySelector(".btn.btn-warning.openTask").click();
			},40000);
		}
		submitrun();
	}else {
        console.log("ytb");
		function likeVideo(){
			document.querySelectorAll("#top-level-buttons > ytd-toggle-button-renderer")[0].click();
		}

		function subVideo(){
			document.querySelector("ytd-subscribe-button-renderer > paper-button").click();
		}

		function turnOffAlert(){
			if(document.querySelector("#cancel-button")){
				document.querySelector("#cancel-button").click()
			}
		}

		function scrollFunc(){
			window.scrollTo(0,800);
		}

		function closeWindow(){
			window.close();
		}

		function runLikeVideo(){
		setTimeout(scrollFunc,10000);
		setTimeout(likeVideo,15000);
		//setTimeout(subVideo,80000);
		//setTimeout(turnOffAlert,81000);
		setTimeout(closeWindow,35000);
	}

	runLikeVideo();

}
})();