Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Mqrius/2012e139b1fc4c3ccaf2a5fe0a67bfec to your computer and use it in GitHub Desktop.
Save Mqrius/2012e139b1fc4c3ccaf2a5fe0a67bfec to your computer and use it in GitHub Desktop.
// ==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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment