Make Google Tasks Great Again

Shows the embedded Google Tasks page on an own page

Fra og med 12.06.2019. Se den nyeste version.

// ==UserScript==
// @name         Make Google Tasks Great Again
// @author       CennoxX
// @contact      [email protected]
// @namespace    https://greasyfork.org/users/21515
// @description  Shows the embedded Google Tasks page on an own page
// @version      0.7
// @match        https://tasks.google.com/*
// @match        https://support.google.com/a/users/answer/9308887
// @run-at       document-start
// @grant        GM.addStyle
// @license      MIT
// @noframes
// ==/UserScript==
(function() {
    'use strict';
    //redirect to correct page
    if (document.URL == "https://support.google.com/a/users/answer/9308887") {
        window.location.replace("https://tasks.google.com/embed/?origin=https://mail.google.com");
    }
    document.onreadystatechange = function () {
        switch (document.readyState){
            case "interactive":
                GM.addStyle("body{display:inherit!important}");//display body
                GM.addStyle(".CTxcDf, .oXBvod, .Sze5Fc{width:100%}");//full width for add task and done tasks
                GM.addStyle(".G4zhSc{width:35%}");//left column width 35 %
                GM.addStyle(".llhEMd{width:65%;left:auto}");//right column width 65%, not till the left border of the page
                GM.addStyle(".Nm5pwe{width:236px}");//set width of option box for tasks
                GM.addStyle(".gv11ue .mUbCce:nth-child(1){transform: rotate(180deg);}");//set arrow of task in other direction
                GM.addStyle(".FmmzFc .mUbCce, .gv11ue .mUbCce:nth-child(4){display:none;}");//hide close buttons
                var oldTitle = "";
                var mainLoop = setInterval(function(){
                    //hide task if another one is opened
                    var tasks = document.getElementsByClassName('llhEMd iWO5td');
                    for (var i = 0; i<tasks.length-1;i++){
                        if (i != tasks.length-2 || tasks[i+1].getAttribute("isfullscreen")=="true"){//don't hide if last page is popup
                            document.getElementById('yDmH0d').removeChild(tasks[0]);
                        }
                    }
                    //show current task list as document title
                    if (document.title != oldTitle && (oldTitle = document.title)){
                        Array.from(document.getElementsByClassName('B6U1Oc')).forEach(function(item){if(item.offsetWidth){document.title=item.innerText+' · Google Tasks';}});
                    }
                }, 50);
                break;
            case "complete":
                if (document.getElementsByTagName("div")[0].getAttribute("id") == "af-error-container") {
                    window.location.replace("https://tasks.google.com/embed/?origin=https://mail.google.com");
                }
                break;
        }
    }
})();