- jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
- Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
- AngularJS - Conventions based MVC framework for HTML5 apps.
- Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
- lawnchair - Key/value store adapter for indexdb, localStorage
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 isTouch = 'ontouchstart' in document.documentElement; | |
var interaction = { | |
tap: isTouch ? "touchend" : "click", | |
down: isTouch ? "touchstart" : "mousedown", | |
move: isTouch ? "touchmove" : "mousemove", | |
stop: isTouch ? "touchend touchcancel" : "mouseup", | |
hover: isTouch ? "touchstart" : "mouseover" | |
}; |
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
// DOM -> jquery | |
var $nav = $('#nav'); | |
// jquery -> DOM | |
var nav = $('#nav')[0]; |
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
查看端口使用: | |
netstat -ano | findstr "80" | |
查看PID: | |
tasklist | findstr "1322" |
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 pertty = " .3###M#####BBMAG&AHBA&hX23GABH23HHH#MAAh&AHHHAHH5. \n"+ " G@@@@@@@#HAH#@@@@@@@@@@M#@h;SM2rM@&M#AH3925A@@@@@@: \n"+ " .5i#@@@@@@hXH@@@@@@@@@@@@@@@@@@@@sriM@3;i2GA@&299H@@@@@S \n"+ " X@@@@@@@@Hh&@@@BXX5iiS2GGH#@#h&G#@#,sAAX;:rB@@@BXss2A##@@@S \n"+ " 2A .@@@@@HM@@@Hr,;9M#@@@#MAhhHAX5h@@ss@5Bh,#@@@#i,;3M#@@@@@@@ \n"+ " ,Mi @@@BA@@@MS:;H@@@@@@@@@@@Bii3SrH@@H@H3G&@#@@&:2@@@@@@@@@@@i \n"+ " ;s,5@HA#@@522SH@@@ |
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 isBufferTimeInterval = false, | |
bufferTimeout, | |
newTime = 0, | |
oldTime = 0, | |
bufferRange, | |
isEnded, | |
isBufferEnded, | |
isPlaying = false; | |
var isAnimateIn = false, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>HTML5 MediaElement</title> | |
<link rel="stylesheet" href="style/normalize.css"> | |
<link rel="stylesheet" href="style/style-youtube.css"> | |
</head> | |
<body> | |
<div class="video-wrapper"> |
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
/* insert jQuery in Developer Tools */ | |
var jq = document.createElement('script'); | |
jq.src = "https://code.jquery.com/jquery-1.10.1.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
jQuery.noConflict(); | |
/* insert ajax or local jQuery */ | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
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 addListener(element, type, callback) { | |
if (element.addEventListener) element.addEventListener(type, callback); | |
else if (element.attachEvent) element.attachEvent('on' + type, callback); | |
} |
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 getAndroidVersion() { | |
var androidVersion = -1; // def value, for non-Android devices | |
var ua = navigator.userAgent.toLowerCase(); | |
var androidIndex = ua.indexOf('android'); | |
if(androidIndex != -1) { | |
var versionStartIndex = androidIndex + 8; | |
var versionEndIndex = ua.indexOf(';', versionStartIndex); | |
androidVersion = parseFloat(ua.slice(versionStartIndex, versionEndIndex)); |