This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseDate(str) { | |
var d = str.split(/\D/); | |
--d[1]; | |
var time = Date.UTC.apply(null, d); | |
return new Date(time); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GM_setValue and GM_getValue on GreaseKit Sample | |
// @namespace http://codefairy.org/ns/userscripts | |
// @include * | |
// @version 0.1 | |
// @license MIT License | |
// ==/UserScript== | |
new function() { | |
registerGM_value('Foo', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.override = function(target, copy) { | |
$.each(copy, function f(k, v) { | |
if (v === null) | |
delete target[k]; | |
else if (typeof v == 'object') { | |
target[k] = target[k] || ($.isArray(v) ? [] : {}); | |
var _target = target; | |
var _copy = copy; | |
target = target[k]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = 'abcdefghijk'; | |
re_1 = /.*(a).*/; // 1 | |
re_2 = /.*(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k).*/; // 11 | |
alert(str.replace(re_1, '$1111')); // $1 + "111" | |
alert(str.replace(re_2, '$1111')); // $11 + "11" | |
alert(str.replace(re_2, '$1'+'111')); // TRAP! $11 + "11" | |
alert(str.replace(re_2, function() { | |
return arguments[1]+'111'; // $1 + "111" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.phparam = function(o) { | |
var ret = {}; | |
var root, tree = []; | |
$.each(o, function deep(k, v) { | |
if (!root) root = k; | |
else tree.push(k); | |
if (typeof v == 'object') | |
$.each(v, deep); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
var options = { | |
path: '/img' | |
}; | |
$.replaceImageSetup = function(o) { | |
options = o; | |
}; | |
$.fn.replaceImage = function(ext) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.fn.sameHeight = function() { | |
var h = 0; | |
return this | |
.each(function() { | |
h = Math.max($(this).height(), h); | |
}) | |
.height(h); | |
}; | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse = function(hash) { | |
var ret = {}; | |
var hash = /#(.+)/.exec(hash || location.href); // Can't use the location.hash, Fx decodes automatically. | |
if (hash) | |
hash = h[1]; | |
else | |
return ret; | |
$.each(queries.split('&'), function() { | |
if (!this) return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.backgroundImage = function(src) { | |
var bg = $.browser.msie6 ? | |
{ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+src+'")' } : | |
{ backgroundImage: 'url('+src+')' }; | |
return this.each(function() { | |
$(this).css(bg); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>jquery.inputprompt.js</title> | |
<link rel="stylesheet" type="text/css" href="http://view.jquery.com/trunk/qunit/testsuite.css"/> | |
<style type="text/css"> | |
#container { | |
position: absolute; | |
top: 0; |