This file contains hidden or 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
| //http://stackoverflow.com/questions/1449666/create-a-jquery-special-event-for-content-changed | |
| (function(){ | |
| var interval; | |
| jQuery.event.special.contentchange = { | |
| setup: function(){ | |
| var self = this, | |
| $this = $(this), |
This file contains hidden or 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
| for (var method in jQuery.fn)(function (method) { | |
| if (method == "init") return; | |
| var old = jQuery.fn[method]; | |
| jQuery.fn[method] = function () { | |
| if (!internal && curEvent) { | |
| internal = true; | |
| var m = curEvent.methods[curEvent.methods.length] = { | |
| name: method, |
This file contains hidden or 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
| /** | |
| * @Module CatGameAssetsManager | |
| * | |
| * @Fan-outs: Event, DOM | |
| */ | |
| KISSY.add('fp-dsf/CatGameAssetsManager', function(S, util) { | |
| var CatGameAssetsManager = {}; | |
| var imageList = [ |
This file contains hidden or 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
| /* | |
| * Ticker by Grant Skinner. Dec 5, 2010 | |
| * Visit http://easeljs.com/ for documentation, updates and examples. | |
| * | |
| * | |
| * Copyright (c) 2010 Grant Skinner | |
| * | |
| * Permission is hereby granted, free of charge, to any person | |
| * obtaining a copy of this software and associated documentation | |
| * files (the "Software"), to deal in the Software without |
This file contains hidden or 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
| var xuejia = { | |
| /** | |
| * proxy | |
| */ | |
| proxy: function(context, func) { | |
| return function() { | |
| func.apply(context, arguments); | |
| } | |
| }, | |
| /** |
This file contains hidden or 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
| console.memory | |
| //MemoryInfo {jsHeapSizeLimit: 793000000, usedJSHeapSize: 10000000, totalJSHeapSize: 29400000} | |
| profile('a') | |
| //Profile 'a' started. | |
| //undefined | |
| profileEnd('a') | |
| //Profile 'a' finished. | |
| //undefined | |
| console.profiles |
This file contains hidden or 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
| // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // shim layer with setTimeout fallback | |
| (function(){ | |
| // chrome shipped without the time arg in m10 | |
| var timeundefined = false; | |
| if (window.webkitRequestAnimationFrame){ | |
| webkitRequestAnimationFrame(function(time){ | |
| timeundefined = (time == undefined); |
This file contains hidden or 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 getCurrentScript(base) { | |
| // 参考 https://github.com/samyk/jiagra/blob/master/jiagra.js | |
| var stack | |
| try { | |
| a.b.c() //强制报错,以便捕获e.stack | |
| } catch (e) { //safari的错误对象只有line,sourceId,sourceURL | |
| stack = e.stack | |
| if (!stack && window.opera) { | |
| //opera 9没有e.stack,但有e.Backtrace,但不能直接取得,需要对e对象转字符串进行抽取 | |
| stack = (String(e).match(/of linked script \S+/g) || []).join(" ") |
This file contains hidden or 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
| /********************************************************************* | |
| * ecma262 v5语法补丁 * | |
| **********************************************************************/ | |
| //-_- 这个trim 测试, 我是不是要 "xuejia".trim | |
| if (!"司徒正美".trim) { | |
| String.prototype.trim = function() { | |
| return this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, '') | |
| } | |
| } |
This file contains hidden or 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
| var DONT_ENUM = "propertyIsEnumerable,isPrototypeOf,hasOwnProperty,toLocaleString,toString,valueOf,constructor".split(","); | |
| var class2type = {}; | |
| "Boolean Number String Function Array Date RegExp Object Error".replace(rword, function(name) { | |
| class2type["[object " + name + "]"] = name.toLowerCase() | |
| }); | |
| //=========================================================================================================// | |
| //=========================================================================================================// |