Updates elements of Asana to make it better. Configurable (turn options on/off) within the code.
当前为
// ==UserScript==
// @name Asana Updates
// @namespace http://
// @description Updates elements of Asana to make it better. Configurable (turn options on/off) within the code.
// @author Wes Foster | WesFoster.com
// @match https://app.asana.com/*
// @grant GM_addStyle
// @version 2.1.4
// @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
};
// Remove Premium Elements
if ( options.hidePremiumNags ) {
GM_addStyle("#topbar, .TopbarPageHeaderGlobalActions-upgradeButton, .TaskPremiumFeaturesSection { display: none !important; }");
}
if ( options.hidePremiumNags ) {
GM_addStyle(".SidebarTopNavLinks-myPortfoliosbutton { display: none !important; }");
}
// Custom Background image
if ( options.customBackground !== false ) {
GM_addStyle(".themeBackground-valley {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.resizeSidebar ) {
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);
}
})();