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
| /***** | |
| * 在标准浏览器中,设置标签的class可以使用两种方法: | |
| * div.className='test';和div.setAttribute("class","test"); | |
| * 得到: | |
| * <div class='test'></div> | |
| * 但是大概由于class是关键字的缘由,在IE中处理策略不同: | |
| * 需要用className来设置 | |
| * div.setAttribute("className","test"); | |
| * 得到: | |
| * <div class='test'></div> |
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
| /** | |
| * 判断两个数组是否相等 | |
| * 浅度相等:两数组toString一样 | |
| * 深度相等的判断规则: | |
| * 1.长度相等 | |
| * 2.俩数组的每一项: | |
| * 若为数组:参考本函数规则。 | |
| * 若为对象:参考equalObject的规则。 | |
| * 其他的数据类型,要求===判断为true | |
| * @param {[type]} arr1 |
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 deepClone (data) { | |
| var result; | |
| if (isType("Object",data)) { | |
| // 如果是对象 | |
| result = {}; | |
| var keys = Object.keys(data); | |
| for (var i = 0; i < keys.length; i++) { | |
| var val = data[keys[i]]; |
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
| //=============================css相关======================= | |
| var cssHooks = avalon.cssHooks = {} | |
| var prefixes = ['', '-webkit-', '-o-', '-moz-', '-ms-'] | |
| var cssMap = { | |
| "float": 'cssFloat' in root.style ? 'cssFloat' : 'styleFloat', | |
| background: "backgroundColor" | |
| } | |
| var cssNumber = oneObject("columnCount,order,fillOpacity,fontWeight,lineHeight,opacity,orphans,widows,zIndex,zoom") | |
| function cssName(name, host, camelCase) { |
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
| /** | |
| * Appends two ArrayBuffers into a new one. | |
| * | |
| * @param {ArrayBuffer} buffer1 The first buffer. | |
| * @param {ArrayBuffer} buffer2 The second buffer. | |
| */ | |
| function appendBuffer(buffer1, buffer2) { | |
| var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength); | |
| tmp.set( new Uint8Array(buffer1), 0); | |
| tmp.set( new Uint8Array(buffer2), buffer1.byteLength); |
This file has been truncated, but you can view the full file.
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
| // libmp3lame.js - port of libmp3lame to JavaScript using emscripten | |
| // by Andreas Krennmair <[email protected]> | |
| var Lame = (function() { | |
| // Note: Some Emscripten settings will significantly limit the speed of the generated code. | |
| // Note: Some Emscripten settings may limit the speed of the generated code. | |
| try { | |
| this['Module'] = Module; | |
| } catch(e) { |
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
| <html> | |
| <head> | |
| <title>3d</title> | |
| <meta charset='utf-8' /> | |
| </head> | |
| <body> | |
| <div class="out"> | |
| <div class="perspective"> | |
| <div class="cube"> |
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
| // | |
| // need module: | |
| // jquery \ jsdom \ | |
| // | |
| (function () { | |
| var $ = require('jquery').create(); | |
| $R = {}; | |
| $R.win = require('jsdom').jsdom().createWindow(); |
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
| // /\b([a-z]+?bot|[a-z]+?spider)\b/gi |
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 d(html){ | |
| var html = document.documentElement.innerHTML; | |
| var aList = []; | |
| // 匹配A标签 | |
| var reg=/\<a\s+[\d\D]*?href=['"]([^'"]*?)[\'|\"][^\>]*?\>([\d\D]*?)\<\/a\>/gi; | |
| var res = null; | |
| while((res = reg.exec(html)) != null){ | |
| // 匹配标签 | |
| var reg2 = /\<[\/]{0,1}[\w]+[^\>]*?\>/gi | |
| aList.push({ |