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
<style> | |
.num {width:100px;position:relative;} | |
.num .leftpart{width:44px;position:absolute;left:0px;text-align:right;} | |
.num .rightpart{width:44px;position:absolute;right:0px;text-align:left;} | |
.num .split{width:2px;position:absolute:right:46px;text-align:center;} | |
</style> | |
<script> | |
function splitNum(selector){ | |
var num = $(selector).text(),parts=num.split("."),leftpart = parts[0],rightpart = parts[1]; | |
$(selector).html("<span class='leftpart'>"+leftpart+"</span><span style='split'>.</span><span class='rightpart'>"+rightpart+"</span>") |
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
/* | |
* @UI class | |
* @author [email protected] | |
**/ | |
(function() { | |
//class类,所有UI组件均基于class创建实例. | |
function Class(o) { | |
//把一个普通类,转换为符合Class的格式的类 | |
if (! (this instanceof Class) && sjs.isFunction(o)) { |
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 lithe = require('lithe'); | |
var path = require('path'); | |
var tool = lithe.tool; | |
var hfs = lithe.hfs; | |
var litheOptions = tool.options; | |
var dir = __dirname; | |
var basepath = path.resolve(dir, 'src'); | |
var distpath = path.resolve(dir, 'dist'); | |
var config = require(basepath + '/config.js'); | |
var banner = '/* <%=pkg.name%> | <%=pkg.description%> | vserion <%=pkg.version%>*/\r\n'; |
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
javascript:alert("xss"); |
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 moduleA(){} // a.js | |
function moduleB(){} // b.js | |
//<script src="a.js"></script> | |
//<script src="b.js"></script> | |
//根据需要手动调整删改a,b...的顺序位置。 |
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
define("someapp.js",["a","b","c","d","e","f","g","h","i","j","k"],function(a,b,c,d,e,f,g,h,i,j,k){ | |
}); | |
//what the fuck? 这书写维护起来。。简直了。 | |
//a.js | |
define("a",[],function(){ | |
var a = document.getElementById("a"); |
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(global,undef){ | |
var isBrowser = !! (typeof window !== undef && global.navigator && global.document); | |
var debug = isBrowser ? (/debug/).test(location.search) : null; | |
var mod = { | |
alias:{}, | |
basepath: debug ? 'path/src/' : 'path/dist' | |
}; | |
if (global.define && isBrowser) { | |
define('config',function(){ | |
return mod; |
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 xlsx = require('node-xlsx'); | |
var fs = require('fs'); | |
var optimist = require('optimist').argv; | |
var src = optimist.src; | |
var target = optimist.target; | |
var json = fs.readFileSync(src).toString(); | |
String.prototype.decodeHTML = function() { | |
var map = { | |
"gt": ">", |
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
define('mods/xss',function(require,exports,module){ | |
/** | |
* 过滤XSS攻击 | |
* | |
* @author 老雷<[email protected]> | |
*/ | |
/* | |
* 默认HTML标签白名单 | |
* 标签名=>属性列表 |
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>canvas demo</title> | |
</head> | |
<body> | |
<textarea id="text" style="width:300px;height:100px;"></textarea> | |
<br> | |
<button id="toImg">转化</button> | |
<br> | |
<canvas style="border:#ccc solid 1px;" id="weiboText"></canvas> |