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 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;
// extend version of $X
// $X(exp);
// $X(exp, context);
// $X(exp, type);
// $X(exp, context, type);
function $X (exp, context, type /* want type */) {
if (typeof context == "function") {
type = context;
context = null;
}
@os0x
os0x / dollarX.js
Created July 30, 2008 07:12 — forked from cho45/dollarX.js
simple $X
// simple version of $X
// $X(exp);
// $X(exp, context);
// @source https:/raw.github.com/gist/3242
function $X (exp, context) {
context || (context = document);
var expr = (context.ownerDocument || context).createExpression(exp, function (prefix) {
return document.createNSResolver(context.documentElement || context).lookupNamespaceURI(prefix) ||
context.namespaceURI || document.documentElement.namespaceURI || "";
});
// ==UserScript==
// @name MDC relink
// @namespace http://d.hatena.ne.jp/Constellation/
// @description relink MDC
// @include http://developer.mozilla.org/*
// ==/UserScript==
(/http:\/\/developer\.mozilla\.org\/(.+)\/(ja|en)$/i.test(document.location.href)) && (document.location.href = 'http://developer.mozilla.org/'+RegExp.$2+'/'+RegExp.$1);
@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 || '$#';
@youpy
youpy / gist_link_user_js.user.js
Created November 19, 2008 10:52 — forked from hotchpotch/gist_link_user_js.user.js
gist.user.js with fixed script URL
@os0x
os0x / dollarX.js
Created November 27, 2008 04:17 — forked from cho45/dollarX.js
very simple $X
// very simple version of $X
// $X(exp);
// $X(exp, context, resolver, XPathResult.NUMBER_TYPE).numberValue;
// @source https:/raw.github.com/gist/29681
function $X (exp, context, resolver, result_type) {
context || (context = document);
var Doc = context.ownerDocument || context;
var result = Doc.evaluate(exp, context, resolver, result_type || XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
if (result_type) return result;
for (var i = 0, len = result.snapshotLength, res = new Array(len); i < len; i++) {