Skip to content

Instantly share code, notes, and snippets.

@os0x
os0x / dollarX.js
Created July 24, 2008 03:59
simple $X
// Simple $X
// Thx! $X from http://coderepos.org/share/browser/lang/javascript/userscripts/jautopagerize.user.js
// http://subtech.g.hatena.ne.jp/cho45/20071114/1195017746
function $X (exp, context) {
context || (context = document);
var exp = (context.ownerDocument || context).createExpression(exp, function (prefix) {
return (document.createNSResolver((context.ownerDocument == null
? context : context.ownerDocument).documentElement)
.lookupNamespaceURI(prefix) || document.documentElement.namespaceURI);
});
// ==UserScript==
// @name Autopagerize for haiku
// @namespace http://rails2u.com/
// @description works on Firefox, Opera, Safari and fub.net
// @include http://h.hatena.ne.jp/*
// @include http://h.hatena.com/*
// ==/UserScript==
(function(unsafeWindow){
var getHeight = (function(){
// ==UserScript==
// @name replace star by profile icon
// @namespace http://ss-o.net/
// @description replace star by profile icon (for Firefox3)
// @include http://*.hatena.ne.jp/*
// @version 1.3
// ==/UserScript==
location.href = 'javascript:(' + function(){
var COLOR = true;
// ==UserScript==
// @name accessible user.js
// @namespace http://ss-o.net/
// @include http://*
// @include https://*
// @require http://gist.github.com/3242.txt
// ==/UserScript==
$X('//a[substring(@href, string-length(@href) - string-length(".user.js") + 1) = ".user.js"]')
.forEach(function(a){
// ==UserScript==
// @name Volumedown for niconico
// @namespace http://d.hatena.ne.jp/nastack/
// @include http://www.nicovideo.jp/watch/*
// ==/UserScript==
(function(unsafeWindow){
var VOLUME = 10;
var meta = document.evaluate("//meta[@name='keywords' and contains(@content,'\u97F3\u91CF\u6CE8\u610F')]",
document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (!meta) return;
@os0x
os0x / tween.js
Created September 29, 2008 08:36
/*
// Tweener Like snippet
new Tween(div.style,{time:1, onComplete:function(){},left:{to:0,from:100,tmpl:"+$#px"}});
// @require http://gist.github.com/13572.txt
*/
function Tween(item, opt) {
var self = this, TIME = 10, time = (opt.time||1) * 1000, TM_EXP = /(\+)?\$([\#\d])/g, sets = [],
easing = opt.transition || function(t, b, c, d){return c*t/d + b;}, _T = {time:1,onComplete:1,transition:1,delay:1};
for (var k in opt) if (!_T[k]) {
var set = opt[k], from = set.from || parseFloat(item[k]) || 0, values = [], tmpl = set.tmpl || '$#';
@os0x
os0x / XPath_Anchor.user.js
Created October 19, 2008 18:42
XPath Anchor. This script is unsafe!
// ==UserScript==
// @name XPath Anchor
// @namespace http://ss-o.net/
// @description XPath Anchor. This script is unsafe!
// @include http://*
// ==/UserScript==
(function (unsafeWindow) {
var __hash = document.location.hash;
log(unsafeWindow.document.location.watch);
// $XA
//
// $XA(exp, context, resolver)(function(node){});
function $XA(exp, context, resolver) {
context || (context = document);
var XPE = new XPathEvaluator();
var Doc = context.ownerDocument || context, expr = XPE.createExpression(exp, resolver ? resolver :
Doc.documentElement.namespaceURI ? function(prefix) {
return XPE.createNSResolver(Doc.documentElement).lookupNamespaceURI(prefix) ||
context.namespaceURI || document.documentElement.namespaceURI || "";
// $XA
//
// $XA(exp, context, resolver).forEach(function(node){});
function $XA (exp, context, resolver) {
context || (context = document);
var XPE = new XPathEvaluator();
var Doc = context.ownerDocument || context, expr = XPE.createExpression(exp, resolver ? resolver :
Doc.documentElement.namespaceURI ? function(prefix) {
return XPE.createNSResolver(Doc.documentElement).lookupNamespaceURI(prefix) ||
context.namespaceURI || document.documentElement.namespaceURI || "";