// ==UserScript== // @name reverted PIM links // @namespace Utopiah // @description overlay so that a visited page indexed in a PIM displays a link back // @include * // @exclude *://mail.google.com/mail/* // ==/UserScript== /* * Script homepage : http://fabien.benetou.fr/Tools/Greasemonkey#RevertedPIMLinks * * to do * find a way (visiting a special URL?) to (re)generate the data store on demand (not at each boot) * apply to Person/ * cf ealier idea http://wiki.seedea.org/Oimp/Socialannotating * add links to the database * note that date is optional but the source is not * delicious-20100730.htm * emails * IRC/IM 34269 links using for SCANNETWORK in $(ls ~/irclogs/); do grep http ~/irclogs/$SCANNETWORK/* | sed "s/.* <\(.*\)> .*http\(.*\)/http\2 \1 on $SCANNETWORK/"; done | wc -l 19881 freenode 5834 blinkenshell 4867 testing 2354 seedeabitlbee 1325 mozilla 7 rezosup for SCANNETWORK in $(ls ~/irclogs/); do echo -n -e "$SCANNETWORK\t" && grep http ~/irclogs/$SCANNETWORK/* | sed "s/.* <\(.*\)> .*http\(.*\)/http\2 \1 on $SCANNETWORK/" | wc -l; done | awk '{print $2 "\t" $1}' | sort -n -r * */ // configuration var script_name = "rPIMlinks"; var PIM_URL = "http://fabien.benetou.fr/"; // actual script //load URLs in data store (greasemonkey.scriptvals in about:config in prefs.js) // load the entire set of links // merging linksloaded_prefs.js to prefs.js // C:\Documents and Settings\tyflser\Application Data\Mozilla\Firefox\Profiles\aosia15p.default // e.g. user_pref("greasemonkey.scriptvals.Utopiah/reverted PIM links.rPIMlinks http://www.wikipedia.com/wiki/Simulacra_and_Simulation", "ReadingNotes/LeSpectateurEmancipe"); //everytime a page is loaded //get the current URL PIMpages = GM_getValue(script_name+" "+document.URL,"fail"); PIMpages_date = GM_getValue(script_name+" date","fail"); //if the current URL is in data store if (PIMpages != "fail") { //display link var pages = PIMpages.split(" "); var myDiv = document.createElement('div'); myDiv.id = "GM_PIM_Window"; while (page = pages.shift()){ myDiv.innerHTML += "

" +""+page+"" +"[e]" +"

"; } boxcss = 'position:fixed; right:5px; top:5px; background-color:black; z-index:1; opacity:0.7;'; boxcss += 'padding:2px; margin:1px;'; boxcss += 'color:blue; font-size:10px; text-align:right;'; boxcss += 'border-width:3px; border-color:gray; border-style:solid;'; myDiv.style.cssText = boxcss; myDiv.style.cssText += ' line-height:1px;'; myDiv.innerHTML += "

RevertedPIMLinks

"; myDiv.innerHTML += "

>>


"; if (PIMpages_date != "fail") { myDiv.innerHTML += "

(date:"+PIMpages_date+")

"; } document.body.appendChild(myDiv); var myFoldedDiv = document.createElement('div'); myFoldedDiv.id = "GM_PIM_Folded_Window"; myFoldedDiv.innerHTML += "

<<

"; myFoldedDiv.style.cssText = boxcss; myFoldedDiv.style.cssText += "visibility:hidden;"; myFoldedDiv.style.cssText += "line-height:10px;"; document.body.appendChild(myFoldedDiv); } function shortcuts (e){ switch(e.charCode) { case "u".charCodeAt(0) : document.getElementById('GM_PIM_Window').style.visibility='visible';document.getElementById('GM_PIM_Folded_Window').style.visibility='hidden'; break; case "f".charCodeAt(0) : document.getElementById('GM_PIM_Window').style.visibility='hidden';document.getElementById('GM_PIM_Folded_Window').style.visibility='visible'; break; } }; function registerShortcuts() { window.addEventListener("keypress", shortcuts, true); }; function unregisterShortcuts() { window.removeEventListener("keypress", shortcuts, true); }; registerShortcuts(); $x('//input | //textarea | //select').forEach(registerListener); function registerListener(node) { node.addEventListener("mouseover", function() { unregisterShortcuts(); scroll_pause(); }, true); node.addEventListener("mouseout", function() { scroll_start (); registerShortcuts(); }, true); }