Skip to content

Instantly share code, notes, and snippets.

@higeorange
higeorange / gist:47317
Created January 15, 2009 08:21
jQuery AutoLink
/*
jQuery AutoLink
MIT License
*/
(function($) {
var url_regexp = /(https?:\/\/[ -熙ぁ-ヴーA-Za-z0-9~\/._\?\&=\-%#\+:\;,\@\']+)/;
$.fn.autolink = function() {
return this.each(function(){
var desc = $(this);
@higeorange
higeorange / gist:54973
Created January 30, 2009 08:23
jQuery MouseOverDelay
/*
jQuery MouseOverDelay
MIT License
Usage:
Alert 'hoge' after 5 seconds from mouseover #hoge element.
$('#hoge').mouseOverDelay(5, function() { alert('hoge') ));
*/
(function($) {
@higeorange
higeorange / jQuery Ajax Post.js
Created February 1, 2009 10:48
jQuery AjaxPost
(function($) {
$.fn.ajaxPost = function(callback, options) {
var default_options = {
data_type: 'html',
before_send: function() {},
error_handler: function() {}
};
options = $.extend(default_options, options)
(function($){
$.fn.eventDelay = function(delay, triger, cancel, callback) {
return this.each(function() {
var target = $(this);
var tid;
target.bind(triger, function(){
var self = this;
tid = setTimeout(function(){ callback.apply(self) }, delay * 1000)
})
(function($) {
$.fn.preInput = function(txt, options) {
var default_options = {
class_name: 'pre-input'
};
options = $.merge(default_options, options || {});
return this.each(function(){
if(typeof this.value == 'undefined') return;
(function($) {
$.fn.zebra = function(options){
var default_options = {
class_name: 'zebra',
interval: 2
}
options = $.extend(default_options, options || {})
return this.each(function(i){
// http://subtech.g.hatena.ne.jp/secondlife/20090302/1235984992
// IE でも同じように
function set_timeout() {
var func = Array.prototype.shift.apply(arguments);
var delay = Array.prototype.shift.apply(arguments);
return (function(args) {
return setTimeout(function(){ func.apply(this, args) }, delay)
})(arguments)
}
// Ctrl + Right Click on Opera
(function($){
$.fn.contextmenu = function(callback) {
return this.each(function(){
var elm = $(this);
if ($.browser.opera) {
elm.bind('click', function(e){
e.preventDefault();
if (e.ctrlKey)
callback.apply(this);
// ==UserScript==
// @name delicious fliter
// @namespace http://opera.higeorange.com/
// @include http://delicious.com/*
// ==/UserScript==
(function() {
var filter_urls = [
'http://*.nicovideo.jp/'
];
// ==UserScript==
// @description add a link of hatena bookmark entry page to delicious url page
// @include http://*delicious.com/url/*
// ==/UserScript==
(function() {
var hub = "http://b.hatena.ne.jp/entry/";
var hib = "http://b.hatena.ne.jp/entry/image/normal/";
var up = document.getElementById("url");
var url = up.firstChild.href;