# Based on code from mailto_envelope.user.rb by Christopher T. Osborne # Written by Kevin Ballard # Image shamelessly stolen from a forum somewhere via Google Image Search # Version History: # # 0.1 - initial release # 0.2 - Don't add image to mouseHole config links MouseHole.script do # declaration name "MouseHole Icon" namespace "kevin@sb.org" description "Adds a Mouse icon ot all MouseHole scripts." include_match %r{^http://} include_match %r{^https://} include_match %r{^file://} version "0.2" # script variables @envelope = "data:image/gif;base64,R0lGODlhGQARALMAAAAAAISEhKWlpcbGxufn5/+EhP+lpf/Gxv//xv//////////////////////////wCH5BAEAAA8ALAAAAAAZABEAAASU8ElApX3gznqBEEGGYeGIfYJ4Dl/oUSDgCkNdenUae3pM4zua4GCQ0VhCUIrYogRShgKuRs1BpTFSaproDroJFKw0CZhp4HQXZCZbKB4wQA52qTRxOSXt1hDWX11wYCBdBBcDhytVVU0SBAMPkY+AA3AwhQmKkhKJZWIJPGYikBaTb2dwbXecGm8ybS6us3iXtBIRAAA7" rewrite do |req, res| document.each_element('//a') do |link| href = link.attributes['href'] if href and href =~ /\.user\.rb$/ and href !~ /\/mouseHole\/config\// and link.has_text? img = Element.new 'img' img.attributes['src'] = @envelope img.attributes['height'] = '12' img.attributes['title'] = link.attributes['href'] img.attributes['style'] = "display: inline !important; border: 0px none !important; padding: 0px; margin: 0px; vertical-align: middle; margin-right: 2px;" link.unshift img end end end end