Skip to content

Instantly share code, notes, and snippets.

View jixunmoe's full-sized avatar
🎳
Having Fun

Jixun jixunmoe

🎳
Having Fun
View GitHub Profile
@jixunmoe
jixunmoe / clearTimeout.js
Last active August 29, 2015 14:02
Cancel Timeout
// 清空之前的 timeout, 如果尚未执行
(function () {
for (var i = setTimeout(function () {}, 0); --i; )
clearTimeout (i);
});
// 添加到脚本声明可「强行启用旧版沙盒」模式,感谢 @坐怀则乱 指正。
// @grant unsafeWindow
@jixunmoe
jixunmoe / ClassHooker.js
Created June 9, 2014 20:34
Hook Javascript Class Function
/**
* ClassHooker
* Hook original JavaScript class.
*/
var origionalClass = function (z, y) {
console.group('Debug: origionalClass');
console.log ('arguments:');
console.log (arguments);
this.arg1 = z;
@jixunmoe
jixunmoe / IntervalLoop.js
Last active November 26, 2018 13:38
Interval Loop (Loop array with delay & callback)
var IntervalLoop = function (arrData, looper, delay) {
if (!(this instanceof IntervalLoop))
return new IntervalLoop (arrData, looper, delay);
/**
* Status
* @type Number
* 0: 循环未开始
* 1: 正在循环
* 2: 循环结束
// Better interval
var betterInterval = function (foo, timeout) {
for (var i=2, extraArgs=[], that=this; i<arguments.length; i++)
extraArgs.push (arguments[i]);
var fooNext = function () {
var args = extraArgs.slice();
args.splice(0, 0, fooNext);
for (var i=0; i<arguments.length; i++)
args.push (arguments[i]);
@jixunmoe
jixunmoe / README.md
Last active June 21, 2018 01:25
渣浪后黑脚本