Skip to content

Instantly share code, notes, and snippets.

@malcolmocean
Created February 16, 2018 16:05
Show Gist options
  • Save malcolmocean/5690d8679de0ee0102224af8b63091c8 to your computer and use it in GitHub Desktop.
Save malcolmocean/5690d8679de0ee0102224af8b63091c8 to your computer and use it in GitHub Desktop.
WorkflowyCompliceFormat userscript
// ==UserScript==
// @name WorkflowyCompliceFormat
// @description Stylizes complice-format tasks in workflowy with their appropriate Complice goal color.
// @author Malcolm Ocean
// adapted from WorkflowyStylableTags by Nigel Thorne and LukeMT
// @include http*://*workflowy.com/*
// @version 0.1
// ==/UserScript==
(function () {
var compliceUsername = 'YOUR USERNAME GOES HERE'
var link = window.document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'https://complice.co/'+compliceUsername+'/user.css';
document.getElementsByTagName("HEAD")[0].appendChild(link);
var simpleActionRE = /^(\d|&)?\) *(\S+).*$/;
setInterval(function(){
$('.content').map( function(){
var x = $(this).text();
if (simpleActionRE.test(x)) {
var code = x.substr(0,1);
code = (code === '&') ? 'x' : code;
$(this).addClass('ccmfg').addClass('goal-'+code);
} else {
this.className = this.className.replace(/goal-\S+/g, "");
$(this).removeClass('ccmfg');
}
});
},1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment