Skip to content

Instantly share code, notes, and snippets.

@bhagwad
bhagwad / insert-link.js
Created October 24, 2009 21:56
Inserts a link from history using suggestions like the awesombar
@bhagwad
bhagwad / copy-link.js
Created October 24, 2009 21:55
Copies a link from history using awesomebar suggestions
@bhagwad
bhagwad / HTML Tag.js
Created October 17, 2009 05:31
Surrounds text with HTML Tags
CmdUtils.CreateCommand({
names: ["HTML Tag"],
arguments: [ {role: 'object', nountype: ["a", "b", "em", "i", "h1", "h2", "h3", "br", "li", "p", "strong", "small", "td", "th", "u", "blockquote"], label: 'HTML tag to insert'}, {role: "instrument", nountype: noun_arb_text, label: "URL for href link"}],
description: "Wraps selection around entered HTML tag",
author: { name: "Bhagwad", email: "bhagwad@yahoo.com"},
license: "MPL",
help: "Make a selection on the screen, call ubiquity and enter the type of tag you want to surround it with",
preview: function(pblock, {object: {text}}){
@bhagwad
bhagwad / Form TextArea Resizer.js
Created August 26, 2009 19:15
Ubiquity Command that allows you to increase the TextArea size in forms if you wish
// generated by create bookmarklet command
CmdUtils.makeBookmarkletCommand({
name: "Form TextArea Resizer",
url: "javascript:TxtRsz={formEl:null,adEv:function(t,ev,fn){if(typeof%20document.addEventListener!='undefined'){t.addEventListener(ev,fn,false)}else{t.attachEvent('on'+ev,fn)}},rmEv:function(t,ev,fn){if(typeof%20document.removeEventListener!='undefined'){t.removeEventListener(ev,fn,false)}else{t.detachEvent('on'+ev,fn)}},init:function(){var%20textareas=document.getElementsByTagName('textarea');for(var%20i=0;i<textareas.length;i++){textareas[i].style.cursor='se-resize'}var%20inputs=document.getElementsByTagName('input');for(var%20i=0;i<inputs.length;i++){if(inputs[i].type=='text'){inputs[i].style.cursor='e-resize'}}TxtRsz.adEv(document,'mousedown',TxtRsz.initResize)},initResize:function(event){if(typeof%20event=='undefined'){event=window.event}var%20target=event.target||event.srcElement;if(target.nodeName.toLowerCase()=='textarea'||(target.nodeName.toLowerCase()=='input'&&target.type=='text')){TxtRsz
@bhagwad
bhagwad / gist:161374
Created August 4, 2009 17:40
Allows users to Stumble a page from Stumbleupon
CmdUtils.CreateCommand({
names: ['stumble'],
homepage: "http://twitter.com/Modest_Egotist",
author: { name: "Andrew Varnerin", email: "ffac06@gmail.com"},
description: "Stumbles.",
license: "MPL",
icon: "http://cdn.stumble-upon.com/favicon.ico",
help: "Stumbles, either everything by default, or a supplied category.",
arguments: [ {role: 'object', nountype: noun_arb_text, label: 'what'}],
@bhagwad
bhagwad / Pagezipper.js
Created August 3, 2009 14:39
Firefox Ubiquity command to merge split article pages into one page so you don't have to keep clicking "Next"
// generated by create bookmarklet command
CmdUtils.makeBookmarkletCommand({
name: "pagezipper",
url: "javascript:(function(){if(window['pgzp']){_pgzpToggleBookmarklet();}else{window._page_zipper_is_bookmarklet=true;window._page_zipper=document.createElement('script');window._page_zipper.type='text/javascript';window._page_zipper.src='http://www.printwhatyoulike.com/static/pagezipper/pagezipper_10.js';document.getElementsByTagName('head')[0].appendChild(window._page_zipper);}})();",
});
@bhagwad
bhagwad / Remember Password.js
Created August 2, 2009 22:34
Firefox Ubiquity Command to Force a page to save the password of a site
// generated by create bookmarklet command
CmdUtils.makeBookmarkletCommand({
name: "remember password",
url: "javascript:(function(){var%20ca,cea,cs,df,dfe,i,j,x,y;function%20n(i,what){return%20i+\"%20\"+what+((i==1)?\"\":\"s\")}ca=cea=cs=0;df=document.forms;for(i=0;i<df.length;++i){x=df[i];dfe=x.elements;if(x.onsubmit){x.onsubmit=\"\";++cs;}if(x.attributes[\"autocomplete\"]){x.attributes[\"autocomplete\"].value=\"on\";++ca;}for(j=0;j<dfe.length;++j){y=dfe[j];if(y.attributes[\"autocomplete\"]){y.attributes[\"autocomplete\"].value=\"on\";++cea;}}}alert(\"Removed%20autocomplete=off%20from%20\"+n(ca,\"form\")+\"%20and%20from%20\"+n(cea,\"form%20element\")+\",%20and%20removed%20onsubmit%20from%20\"+n(cs,\"form\")+\".%20After%20you%20type%20your%20password%20and%20submit%20the%20form,%20the%20browser%20will%20offer%20to%20remember%20your%20password.\")})();",
});
@bhagwad
bhagwad / Wordpress Press this.js
Created August 2, 2009 22:32
Ubiquity command for the "Press This" bookmarklet in Wordpress
// generated by create bookmarklet command
CmdUtils.makeBookmarkletCommand({
name: "press this",
url: "javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://www.bhagwad.com/blog/wp-admin/press-this.php',l=d.location,e=encodeURIComponent,g=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=2';function%20a(){if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570')){l.href=g;}}a();void(0);",
});
@bhagwad
bhagwad / Save in laterloop.js
Created August 2, 2009 22:28
Ubiquity Command for saving a page to read later using the LaterLoop Bookmarklet
CmdUtils.makeBookmarkletCommand({
name: "LaterLoop Save",
url: "javascript:void((function(){var%20d=document;var%20h='http://static.laterloop.com';d._ll='FkHe4QgpNg3SawVBUm3N';try{var%20e=d.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src',h+'/js/ll.js');d.body.appendChild(e);}catch(x){e=encodeURIComponent;w=window;qs='&key='+d._ll+'&title='+e(d.title||'')+'&url='+e(w.location)+'&via='+e(d.referrer)+'&fmt=html&src=wk&v=1&t='+(new%20Date().getTime())+'&gmt='+e(new%20Date().getTimezoneOffset());u=h+'/post/?'+qs;w.top.location.assign(u);return;}s='[Saving...]%20';d.title=s+d.title.replace(s,'');})());"
})