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
| /** | |
| * Check if object is part of the DOM | |
| * @constructor | |
| * @param {Object} obj element to check | |
| */ | |
| function isDOMElement(obj) { | |
| return obj && typeof window !== 'undefined' && (obj === window || obj.nodeType); | |
| } | |
| /** |
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
| /<%([^%>]+)?%>/g; // 匹配<%,%>之间内容 |
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 PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| <title>setTimeout</title> | |
| <script type="text/javascript"> | |
| function get(id) { | |
| return document.getElementById(id); | |
| } | |
| window.onload = function () { |
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
| <meta name="viewport" content="minimal-ui"> | |
| <!-- | |
| Just say goodbye to minimal-ui (for now) | |
| http://stackoverflow.com/questions/24889100/ios-8-removed-minimal-ui-viewport-property-are-there-other-soft-fullscreen | |
| --> |
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
| img { | |
| -webkit-user-select: none; | |
| -khtml-user-select: none; | |
| -moz-user-select: none; | |
| -o-user-select: none; | |
| user-select: none; | |
| } |
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
| # OS generated files # | |
| ###################### | |
| .DS_Store | |
| .DS_Store? | |
| ._* | |
| .Spotlight-V100 | |
| .Trashes | |
| ehthumbs.db | |
| Thumbs.db |
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
| a, img { | |
| -webkit-touch-callout: none; /* 禁止长按链接与图片弹出菜单 */ | |
| } | |
| html, body { | |
| -webkit-user-select: none; /* 禁止选中文本(如无文本选中需求,此为必选项) */ | |
| user-select: none; | |
| -webkit-tap-highlight-color: rgba(0,0,0,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
| -webkit-tap-highlight-color:rgba(255,255,255,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
| // 1 | |
| function indexOfSmallest(a) { | |
| var lowest = 0; | |
| for (var i = 1; i < a.length; i++) { | |
| if (a[i] < a[lowest]) lowest = i; | |
| } | |
| return lowest; | |
| } | |
| // 2 |
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
| // 你可以使用余数运算(%),将一个数字按1求余,看看余数是不是0。 | |
| function isInteger(x) { | |
| return x % 1 === 0; | |
| } | |
| // 通过Math.round() | |
| function isInteger(x) { | |
| return Math.round(x) === x; | |
| } |