diff --git a/pub/code/reverted_pim_links.user.js b/pub/code/reverted_pim_links.user.js index 0187b0b..9fbc204 100644 --- a/pub/code/reverted_pim_links.user.js +++ b/pub/code/reverted_pim_links.user.js @@ -12,8 +12,6 @@ * todo * generate the data store on demand * check link_extractor/revertingpimlinks.sh - * change background-color based on a hash of the group - * within bound of readable values * * add links to the database * note that date is optional but the source is not @@ -35,6 +33,18 @@ for SCANNETWORK in $(ls ~/irclogs/); do echo -n -e "$SCANNETWORK\t" && grep http * */ +String.prototype.ColorHash = function(){ + var hash = 0; + if (this.length == 0) return hash; + for (i = 0; i < this.length; i++) { + char = this.charCodeAt(i); + hash = ((hash<<5)-hash)+char; + hash = hash & hash; // Convert to 32bit integer + } + hash = Math.round(Math.sqrt(Math.abs(hash))); // How to convert to 16bit integer? + return hash; + // suppose to send back a correct HTML color value +} // configuration var script_name = "rPIMlinks"; @@ -63,8 +73,14 @@ if (PIMpages != "fail") var myDiv = document.createElement('div'); myDiv.id = "GM_PIM_Window"; while (page = pages.shift()){ + grouppage = page.split("."); + group = grouppage[0]; + page = grouppage[1]; myDiv.innerHTML += "
" - +""+page+"" + +"" + +""+group+"/" + +""+page+"/" + +"" +"[e]" +"
"; } @@ -111,8 +127,6 @@ function unregisterShortcuts() { registerShortcuts(); -$x('//input | //textarea | //select').forEach(registerListener); - function registerListener(node) { node.addEventListener("mouseover", function() { unregisterShortcuts();