Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Trac Milestones Quick Select
// @namespace http://damienh.org
// @include https://trac.slide.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js
// ==/UserScript==
(function () {
(function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c);c.highlight=c.highlight||function(e){return e;};c.formatMatch=c.formatMatch||c.formatItem;return this.each(function(){new a.Autocompleter(this,c);});},result:function(b){return this.bind("result",b);},search:function(b){return this.trigger("search",[b]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(b){return this.trigger("setOptions",[b]);},unautocomplete:function(){return this.trigger("unautocomplete");}});a.Autocompleter=function(l,g){var c={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGE
// ==UserScript==
// @name Trac Milestones Quick Select
// @namespace http://damienh.org
// @include https://trac.slide.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js
// ==/UserScript==
(function () {
(function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c);c.highlight=c.highlight||function(e){return e;};c.formatMatch=c.formatMatch||c.formatItem;return this.each(function(){new a.Autocompleter(this,c);});},result:function(b){return this.bind("result",b);},search:function(b){return this.trigger("search",[b]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(b){return this.trigger("setOptions",[b]);},unautocomplete:function(){return this.trigger("unautocomplete");}});a.Autocompleter=function(l,g){var c={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGE
@dhou
dhou / x
Created March 5, 2009 13:33
//Twitter search + Google search
//Migrated to Ubiquity from Greasemonkey script: http://userscripts.org/scripts/show/43451
//houyr@twitter
//with ubiq cmd hack by satyr http://gist.github.com/74368
//function cmd_
function pageLoad_twitterSearchPlusGoogle(doc) {
var href = doc.location.href;
var q = (/^https?:\/\/(?:www\.)?google\..*\/.*[&?]q=([^&]*)(?:&|$)/(href)||0)[1];
if(!q) return;
@dhou
dhou / x
Created January 28, 2009 13:49
/*
* Looks for imdb id using keywords, then use the imdb id to search mininova.
* e.g. imdbt Matrix of t -> select from up to 5 movie suggestions to search for seeds on imdb
*/
const ITEMS_TMPL = "<div style=\"clear: both;\"><b><u><a href=\"${link}\">${title} (${year} ${imdb})</a></u></b><br/>" +
"<img src=\"${img}\" style=\"float: left; height: 80px; background-color: white;\" />" +
"</div><br/>";
var $j = jQuery;
@dhou
dhou / x
Created January 25, 2009 13:22
Ubiquity command to post to jiwai.de
//Based on: http://sites.google.com/site/coosgadgets/2ii
//Heavily refactored and with more features
jiwai_template = "\
<div style=\"overflow: auto; height: 450px;\"> \
{for entry in entries} \
<div style=\"margin:0;padding:2px;padding-left:4px;background-color:{if entry_index%2 == 0}#555{else}#313131{/if};border:solid 1px;border-top-color:#484848;border-left:solid 3px #ccc;border-right-color:#2c2c2c;border-bottom-color:#2b2b2b;font-size:13px;-moz-border-radius:5px;\"> \
<a href=\"http://jiwai.de/${entry.user.screen_name}/thread/${entry.id}\" ><img src=\"${entry.user.profile_image_url}\" style=\"height: 2em; float: left;margin-right:3px; margin-top:4px;border:none;\"/></a> \
<span style=\"font-weight: bold\">${entry.user.screen_name}</span> \
<span>${entry.text}</span> \
@dhou
dhou / x
Created January 23, 2009 12:58
CmdUtils.makeBookmarkletCommand({
name: 'jash',
homepage: "http://damienh.org",
author: { name: "Damien Hou", email: "houyongr@gmail.com"},
license: "GPL",
description: "Invoke Jash on any webpage",
help: "Type 'jash'",
url: "javascript:(function(){document.body.appendChild(document.createElement('script')).src='http://www.billyreisinger.com/jash/source/latest/Jash.js';})();",
}
);
@dhou
dhou / x
Created January 23, 2009 12:48
CmdUtils.makeBookmarkletCommand({
name: 'share-on-friendfeed',
icon: "http://friendfeed.com/favicon.ico",
homepage: "http://damienh.org",
author: { name: "Damien Hou", email: "houyongr@gmail.com"},
license: "GPL",
description: "Share the current page to frienfeed",
help: "Just type 'share-on-frienfeed'",
url: "javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('src','http://friendfeed.com/share/bookmarklet/javascript');document.body.appendChild(e)})())",
}
@dhou
dhou / x
Created January 23, 2009 11:22
CmdUtils.makeBookmarkletCommand({
name: 'clip-to-evernote',
icon: "http://evernote.com/about/img/favicon.ico",
homepage: "http://damienh.org",
author: { name: "Damien Hou", email: "houyongr@gmail.com"},
license: "GPL",
description: "Summon Evernote, any where any time. That's it!",
help: "Just type 'clip-to-evernote'",
url: "javascript:(function(){EN_CLIP_HOST='http://www.evernote.com';try{var%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+(new%20Date().getTime()/100000);document.getElementsByTagName('head')[0].appendChild(x);}catch(e){location.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);}})();",
}