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
// convert NodeList to array | |
function makeArray(nodes) { | |
var array = null; | |
var i = 0; | |
var length = nodes.length; | |
if (!nodes) return []; | |
try { | |
// for standard | |
array = [].slice.call(nodes, 0); | |
} catch(e) { // for ie8 |
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
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { | |
// no easing, no acceleration | |
linear: function (t) { return t }, | |
// accelerating from zero velocity | |
easeInQuad: function (t) { return t*t }, | |
// decelerating to zero velocity |
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
/** | |
Created: 2017年7月17日 18:00:41 | |
*/ | |
var responseHandler ; | |
function JSONP(url, callback) { | |
if (url === "" || url === undefined) return; | |
if (url.indexOf("?") === -1) { | |
url += "?callback=responseHandler" | |
} else { | |
url += "&callback=responseHandler" |
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 loadScript = function (url, callback) { | |
var script = document.createElement("script"), | |
head = document.getElementsByTagName("head")[0]; | |
script.type = "text/javascript"; | |
// IE | |
if (script.readyState) { | |
script.onreadystatechange = function () { | |
if (script.readyState === "loaded" || script.readyState === "complete") { | |
script.onreadystatechange = null; |