Skip to content

Instantly share code, notes, and snippets.

@brockboland
Forked from anonymous/letsfreckle-tags.js
Created July 23, 2012 16:42
Show Gist options
  • Save brockboland/3164632 to your computer and use it in GitHub Desktop.
Save brockboland/3164632 to your computer and use it in GitHub Desktop.
LetsFreckle tag performance fix
// ==UserScript==
// @name LetsFreckle Tags
// @namespace http://www.lullabot.com/
// @version 0.1
// @description Reduce the number of tags to fix performance issues.
// @match https://*.letsfreckle.com/*
// @copyright 2012+, Andrew Berry, [email protected]
// ==/UserScript==
// Filter the list of tags.
function filterTags() {
exec(function() {
// Set this array to the list of tags you would like to use. Each tag be
// mapped to an existing tag, if it exists, so there is no need to specify
// tags by ID.
var myTags = ['yammer',
'irc',
'email',
'juno',
'ooyala'];
var filteredTags = [];
for (i in freckleTags) {
tag = freckleTags[i];
if (myTags.indexOf(tag.name) >= 0) {
filteredTags.push(tag);
}
}
window.freckleTags = filteredTags;
Freckle.Tags.set(filteredTags);
});
}
// We need this as we need to access the window object, which is restricted for
// for security reasons.
// http://stackoverflow.com/questions/5006460/userscripts-greasemonkey-calling-a-websites-javascript-functions
function exec(fn) {
var script = document.createElement('script');
script.setAttribute("type", "application/javascript");
script.textContent = '(' + fn + ')();';
document.body.appendChild(script); // run the script
document.body.removeChild(script); // clean up
}
filterTags();
@brockboland
Copy link
Author

Remove console.log() calls.

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