Asana Updates - WF

Updates elements of Asana to make it better. Configurable (turn options on/off) within the code. Custom background, bigger sidebar, and more!

目前为 2020-09-11 提交的版本。查看 最新版本

// ==UserScript==
// @name         Asana Updates - WF
// @namespace    http://
// @description  Updates elements of Asana to make it better. Configurable (turn options on/off) within the code. Custom background, bigger sidebar, and more!
// @author       Wes Foster | WesFoster.com
// @match        https://app.asana.com/*
// @grant        GM_addStyle
// @version      2.1.7
// @history      2.1.7: Updated removal of portfolios/goals
// @history      2.1.6: Updated the background image changer
// @history      2.1.5: Renamed the script
// @history      2.1.4: Made the features all optional. And added script description
// @history      2.1.3: Fixed syntax error
// @history      2.1.2: Enforced hidden harvest icon
// ==/UserScript==

(function() {
    'use strict';

    var options = {
			"resizeSidebar"   : true,
			"removeHarvest"   : true,
			"autoShowProjects": true,
			"customBackground": false, 	// Set an image URL if you want this turned on.
			"hidePremiumNags" : false, 	// If true, this will remove some of the upgrade nags (buttons, banners, etc.)
			"hidePortfolios"  : false,	// If true, this will remove the portfolios link
			"hideGoals"			  : false 	// If true, this will remove the goals link
    };


    // Remove Premium Elements
    if ( options.hidePremiumNags ) {
	    GM_addStyle("#topbar, .TopbarPageHeaderGlobalActions-upgradeButton, .TaskPremiumFeaturesSection { display: none !important; }");
    }
    if ( options.hidePortfolios ) {
	    GM_addStyle(".SidebarTopNavLinks-myPortfoliosbutton { display: none !important; }");
	  }
    if ( options.hideGoals ) {
	    GM_addStyle(".SidebarTopNavLinks-goalsButton { display: none !important; }");
	  }

    // Custom Background image
    if ( options.customBackground !== false ) {
	    GM_addStyle(".ThemeSetter-themeBackground {background-image:url('" + options.customBackground + "') !important}");
	  }    

    // Resize the left sidebar
    if ( options.resizeSidebar ) {
	    var asanaSidebarWidth = 350;
	    GM_addStyle(".AsanaMain-sidebar {width: " + asanaSidebarWidth + "px !important;}");
	    GM_addStyle(".AsanaMain-sidebar.AsanaMain-sidebar--isCollapsed {margin-left: " + asanaSidebarWidth*-1 + "px !important;}");
    }

    // Remove harvest time-tracker icon
    if ( options.removeHarvest ) {
	    GM_addStyle(".HarvestButton-timerIcon, .HarvestButton, .harvest-timer {display: none !important;}");
	  }

    // Recurring Interval to show projects in Asana
    if ( options.autoShowProjects ) {
	    var timerID = setInterval(performIntervalActions, 1000);
	    function performIntervalActions() {
	        var i;

	        // Expand "Show More Projects"
	        var projectLink = document.getElementsByClassName("SidebarTeamDetailsProjectsList-showMoreProjectsLink");
	        for (i = 0; i < projectLink.length; i++) {
	            projectLink[i].click();
	        }

	        // Expand Project Description
	        var projectDescBox = document.getElementsByClassName('ql-editor');
	        var sidebarHeightRestriction = 137; // Roughly the height of the header toolbar and margins
	        for (i = 0; i < projectDescBox.length; i++) {
	            projectDescBox[i].style.maxHeight = (document.getElementsByClassName('ProjectPageView')[0].clientHeight - sidebarHeightRestriction) + "px";
	        }
	    }
	    setTimeout(function(){ clearInterval(timerID);} , 30000);
	  }

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址