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 count = 0; | |
var $lazy = $('.img-lazy-load'); | |
var every = function () { | |
return _.every($lazy, function (elem) { | |
return elem.loaded; | |
}); | |
}; | |
$lazy.on('load', function () { | |
if (every()) { |
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 (String) { | |
String.prototype.format = function (args) { | |
var copy = this + ''; | |
var i, len; | |
for (i = 0, len = arguments.length; i < len; i++) { | |
copy = copy.replace(new RegExp("\\{" + i + "\\}", 'g'), String(arguments[i])); | |
} | |
return copy; | |
}; | |
})(String); |
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 (name, definition) { | |
// Check define | |
var hasDefine = typeof define === 'function', | |
// Check exports | |
hasExports = typeof module !== 'undefined' && module.exports; | |
if (hasDefine) { | |
// AMD Module or CMD Module | |
define(definition); | |
} else if (hasExports) { |
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
var createPullabledScroll = function (iScroll, elem, options) { | |
var scroll, pullDownReady, pullUpReady; | |
// scope variable | |
pullDownReady = false; | |
pullUpReady = false; | |
// setup the scroll object | |
options.probeType = options.probeType || 2; | |
scroll = new iScroll(elem, options); | |
// pullDown | |
if (typeof options.pullDownOffset === 'number') { |
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
var _ = (function () { | |
var exports = {}; | |
exports.isArray = function (obj) { | |
return obj instanceof Array; | |
}; | |
exports.each = function (list, func) { | |
var i, len; | |
if (exports.isArray(list)) { | |
for (i = 0, len = list.length; i < len; i++) { | |
func(list[i], i, list); |
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
window.whenWechatReady = (function () { | |
var isReady = false; | |
var tasks = []; | |
var when = function (callback) { | |
if (isReady) { | |
return callback(); | |
} | |
return tasks.push(callback); | |
}; | |
document.addEventListener('WeixinJSBridgeReady', function () { |
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
var wait = function (name, context) { | |
context = context || window; | |
var isReady = false; | |
var tasks = []; | |
var when = function (callback) { | |
if (isReady) { | |
return callback(); | |
} | |
return tasks.push(callback); | |
}; |
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 loadScript = (function () { | |
var debug = typeof debug !== 'function' ? function (text) { | |
console.log(text); | |
} : debug; | |
var wrapAsync = function (url, doc, win) { | |
debug('load script: (safe and async) ' + url); |
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
define(function(require, exports, module) { | |
// Debug: | |
// print: | |
// Debug(name, [withTrace])(obj, [obj, ...]) | |
// enable: | |
// Debug.enable() | |
// disable: | |
// Debug.disable() | |
// Debug.disable(name, [name, ...]) | |
// only: |
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
define(function () { | |
var exports = {}; | |
var _store = {}; | |
var _isReady = false; | |
var _callback = []; | |
var doReady = function () { | |
var i, len; | |
if (_isReady) { |
OlderNewer