Skip to content

Instantly share code, notes, and snippets.

@satyr
satyr / google++.ubiq.js
Last active March 12, 2022 18:06 — forked from satyr/google-keynav.ubiq.js
google++
Utils.extend(feed, {
title: 'google++',
author: {
name: 'satyr', email: 'murky.satyr\x40gmail.com',
homepage: 'http://satyr.github.com',
},
license: 'X',
})
const
Google = 'https://www.google.com/',
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@-moz-document url("chrome://browser/content/browser.xul"){
#main-window hbox, #content tab, .searchbar-engine-button,
toolbarbutton, toolbox, toolbar, statusbarpanel, dropmarker {
border:0 none !important}
/*#PersonalToolbar menuseparator:nth-last-of-type(1),*/
#PersonalToolbar toolbarbutton:not(:first-child) menuseparator,
#PersonalToolbar toolbarbutton:not(:first-child) menuseparator + menuitem,
#!js
0,function(stream){
var lines = [], line;
while((line = stream.readLine()) !== null) lines.push(line);
var code = lines.join('\n');
if(!code) return print('usage: js {this} < perplexing.js > unperplexed.js');
code = (Function(code.replace(/^#!.*\n?/, '')).toString()
.replace(/^\s*function.*\s+/, '')
.replace(/^ {4}((?: )*)\1/mg, '$1') // halving indentation
.replace(/\s+\}\s*$/, ''));
@satyr
satyr / command-history.ubiq.js
Created February 19, 2009 22:40
Saves/accesses your command history.
const Name = 'command-history',
PHistory = 'extensions.ubiquity.history.',
PCache = PHistory +'cache',
PCount = PHistory +'count',
Sep = '\t', InitCount = 40, {prefs} = Application;
CmdUtils.CreateCommand({
name: Name,
icon: 'chrome://ubiquity/skin/icons/favicon.ico',
takes: {regex: {_name: '/re/i', suggest: function(txt, htm, cb, sx){
if(sx) return [];
@satyr
satyr / undo-closed-tabs.ubiq.js
Created February 20, 2009 15:47
Reopens tabs you've closed recently.
const Name = 'undo-closed-tabs',
SS = Cc['@mozilla.org/browser/sessionstore;1'].getService(Ci.nsISessionStore),
Style = <style>{<><![CDATA[
@, @* {margin:0; padding:0}
@button {border-width:1px;
font:bold 112% "Consolas",monospace; vertical-align:top}
@li {list-style-type:none}
@img {width:16px; height:16px}
@span.url {display:inline-block; white-space:pre; font-size:88%}
@img, @span {vertical-align:middle}
// ==UserScript==
// @name toprightmost
// @namespace http://d.hatena.ne.jp/murky-satyr/
// @description Puts Firefox at toprightmost position with specified sizes.
// @include main
// @version 2010-04-02
// ==/UserScript==
var toprightmost = let(off = 1, x, y, w, h) function trm(width, height){
if(off ^= 1) return moveTo(x, y), resizeTo(w, h);
x = screenX, y = screenY, w = outerWidth, h = outerHeight;
javascript: FeedGraveyardCleaner:
'about:ubiquity' == location ? function(fm, uf){
uf = fm.getUnsubscribedFeeds();
$('#command-feed-graveyard>li').each(function(_, li){
$('<a\40href="javascript:">[x]</a>', li).appendTo(li).click(function(){
uf.some(function({uri})
uri.spec == this && $(li).slideUp() &&
!fm._annSvc.removePageAnnotation(uri, 'ubiquity/removed'),
$('a:first', li)[0].href)
}) }) }(UbiquitySetup.createServices().feedManager) : void ''
@satyr
satyr / vacuum-and-reindex.ubiq.js
Created March 1, 2009 14:53
Performs VACUUM and REINDEX on your Firefox storage.
const noun_storage_file = {
_name: 'storage_file',
suggest: function(txt, htm, cb, sx){
if(sx || !txt) return [];
return matchSuggs(this.list, txt);
},
list: (function({directoryEntries}, ls){
while(directoryEntries.hasMoreElements()){
var f = directoryEntries.getNext().QueryInterface(Ci.nsIFile);
if(f.exists() && f.isFile() && /\.sqlite$/.test(f.path)){
@satyr
satyr / set-frequency-of.ubiq.js
Created March 3, 2009 18:52
Modifies a command's frequency score for Noun-First Suggestion.
CmdUtils.CreateCommand({
name: 'set-frequency-of',
icon: 'chrome://ubiquity/skin/icons/favicon.ico',
description:
'Modifies the frequency score of a command for Noun-First Suggestion.',
arguments: {
object: noun_type_enabled_command,
goal_score: noun_type_number,
},
execute: function({object: {text: name, data: cmd}, goal: {text: score}}){
@satyr
satyr / max-suggestions.ubiq.js
Created March 4, 2009 17:33
Sets the maximum number of suggestions.
const PMaxSugg = 'extensions.ubiquity.maxSuggestions', {prefs} = Application;
Components.utils.import('resource://ubiquity/modules/parser/parser.js');
NLParser.MAX_SUGGESTIONS = Math.max(prefs.getValue(PMaxSugg, 5), 1);
CmdUtils.CreateCommand({
name: 'max-suggestions',
icon: 'chrome://ubiquity/skin/icons/favicon.ico',
takes: {'1+': {_name: '1+',
suggest: function(n, h, c, s)(