Skip to content

Instantly share code, notes, and snippets.

@newbamboo
Created January 31, 2010 01:37
Show Gist options
  • Save newbamboo/290829 to your computer and use it in GitHub Desktop.
Save newbamboo/290829 to your computer and use it in GitHub Desktop.
/* This works as a bookmarklet, but I can't for the life of me work out how to capture the keypress away from Gmail's grasp */
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){
var sigs = [
['[email protected]', 'bamboo'],
['[email protected]', '5places']
];
var iframe = $("#canvas_frame").contents();
function insert_sig() {
var from = iframe.find('input[name="from"]').val();
if(from) {
alert('from');
var selected_email = from;
} else {
alert('select');
var selected_email = iframe.find("select :selected").text().split('<')[1].split('>')[0];
}
alert(selected_email);
sigs.forEach(function(sig) {
if(sig[0] == selected_email) {
$("iframe:last").contents().find("iframe:last").contents().find("body.editable").append(sig[1]);
}
});
}
insert_sig();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment