Created
May 8, 2015 14:41
-
-
Save mattkenefick/12e2b9829d59e74b2071 to your computer and use it in GitHub Desktop.
TamperMonkey Asana three-panes width fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fix Asana width | |
// @namespace http://example.com | |
// @version 0.1 | |
// @description Forced width of Asana is very obnoxius, so this will adjust the min width. | |
// @author You | |
// @match https://app.asana.com/* | |
// @grant none | |
// ==/UserScript== | |
var i = 0; | |
var pmInt = setInterval(function() { | |
// search for | |
var elements = document.querySelectorAll('.three-panes'); | |
if (elements.length > 0) { | |
addStyle(); | |
console.log( "[PM] Asana script executed."); | |
clearInterval(pmInt); | |
} | |
// max run | |
if (i++ > 10) { | |
console.log( "[PM] Asana script aborted."); | |
clearInterval(pmInt); | |
} | |
else { | |
console.log( "[PM] Int " + i); | |
} | |
}, 250); | |
function addStyle() { | |
var css = '.three-panes { min-width: 100vw !important; }', | |
head = document.head || document.getElementsByTagName('head')[0], | |
style = document.createElement('style'); | |
if (style.styleSheet) { | |
style.styleSheet.cssText = css; | |
} | |
else { | |
style.appendChild(document.createTextNode(css)); | |
} | |
style.type = 'text/css'; | |
head.appendChild(style); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment