Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name WorkflowyStylableTags
// @description Gives each tag it's own css style, so you can style them with Stylish. I use Blank Canvas to manage my userscripts in Chrome.
// @author Nigel Thorne
// @include http*://*workflowy.com/*
// @version 1.0
// ==/UserScript==
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
var customClasses = function(index, old){
var classes = old.split(" ");
var custom = [];
for( i = 0; i < classes.length; i++){
if(classes[i].endsWith("-row")){ custom.push(classes[i]);};
if(classes[i].endsWith("-span")){ custom.push(classes[i]);};
if(classes[i].endsWith("-proj")){ custom.push(classes[i]);};
};
return custom.join(" ");
}
var StylableTagsCounter = 1;
setInterval(function(){
StylableTagsCounter ++;
if( StylableTagsCounter >= 3){
$('.name').removeClass(customClasses);
$('.content').removeClass(customClasses);
$('.project').removeClass(customClasses);
$('.pageContainer').removeClass(customClasses);
StylableTagsCounter = 0;
}
$('span > .contentTagText').map( function(){
var x = $(this).text();
$(this).parent('.contentTag').addClass(x).parent().addClass(x+"-span").parent().addClass(x+"-row").parent().addClass(x+"-proj");}
);
},1000);
// ==UserScript==
// @name WorkflowyStylableTags
// @description Gives each tag it's own css style, so you can style them with Stylish. I use Blank Canvas to manage my userscripts in Chrome.
// @author Nigel Thorne and LukeMT
// @include http*://*workflowy.com/*
// @version 1.1
// ==/UserScript==
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
var customClasses = function(index, old){
var classes = old.split(" ");
var custom = [];
for( i = 0; i < classes.length; i++){
if(classes[i].endsWith("-proj")){ custom.push(classes[i]);};
};
return custom.join(" ");
}
var StylableTagsCounter = 1;
setInterval(function(){
StylableTagsCounter ++;
if( StylableTagsCounter >= 3){
$('.project').removeClass(customClasses);
$('.pageContainer').removeClass(customClasses);
StylableTagsCounter = 0;
}
$('span > .contentTagText').map( function(){
var x = $(this).text();
$(this).parent('.contentTag').parent().parent().parent().addClass(x+"-proj");}
);
},1000);
@Mqrius

This comment has been minimized.

Copy link

@Mqrius Mqrius commented Nov 23, 2016

Your selector for pageContainer selects on class, but pageContainer is an id.
Here's a fix: https://gist.github.com/Mqrius/2012e139b1fc4c3ccaf2a5fe0a67bfec/revisions
(Can't do pull requests on gists)
(Note that I haven't fixed the big old version. Fix is trivial though.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment