Skip to content

Instantly share code, notes, and snippets.

View xiaojue's full-sized avatar
🤚
waiting

xiaojue xiaojue

🤚
waiting
View GitHub Profile
function loadByqueue(list,type,callback){
var queue = [],
_load = {
"sync":function(list){
var src = list[0];
if(!src) callback();
$.getScript(src,function(){
list.shift();
_load["sync"](list);
});
/**
* @author fuqiang[[email protected]]
* @version 20120813
* @descrption 标签投稿浮出层
*/
define('module/tagsContribute', ['vendor/jquery', 'module/common', 'vendor/jquery.select'], function($, R, Select) {
//调用方法:
//(new tagsContribute('城市')).init('localUpdate'); //从本地上传init浮层
//init的参数是初始化哪个tab的标致 还有一个type为:chooseByAlbum
/**
* @author fuqiang[[email protected]]
* @version 20120514
* @description 暂时作为照片详情页的views集合
*/
define('module/view', ['module/common', 'module/model', 'module/tool', 'vendor/jquery', 'module/mask', 'module/like', 'module/userRelation'], function(R, MODEL, tool, $, mask, like, userRelation) {
var TOOL = tool.DetailTool;
var ExifHeight = 56;
@xiaojue
xiaojue / html
Created January 18, 2012 07:40
autowidth
<!doctype html>
<html>
<body>
<style>
.author,.time{
width:100px;
}
.content{
position:relative;
border:#ccc solid 1px;
@xiaojue
xiaojue / html
Created January 17, 2012 08:47
onpropertychange
<html>
<body>
<form name="frmMain">
<input name="fireTarget">
<input type="hidden" name="output">
</form>
<script>
function changeRealElement () {
var torgand = document.frmMain["fireTarget"];
var realElem = document.frmMain["output"];
@xiaojue
xiaojue / events.js
Created November 27, 2011 04:53
nodejs custom events
var events=function(){
this.map={};
};
events.prototype={
emit:function(eventname,args){
if(this.map[eventname]){
this.map[eventname].forEach(function(fn){
fn.apply(this,args);
});
}
@xiaojue
xiaojue / eventEmitter.js
Created November 27, 2011 04:46
nodejs events
var events=require('events').EventEmitter;
var test=function(){
events.call(this);
}
test.prototype=Object.create(events.prototype,{
constructor:{
value:test,
enumerable:false
@xiaojue
xiaojue / equaltest.js
Created October 31, 2011 17:22
test for js equal method
console.log(isEqual(1,1))
console.log(isEqual(1,"1"))
console.log(isEqual("a","a"))
console.log(isEqual(1,2))
console.log(isEqual([[],1],[[],2]))
console.log(isEqual([{},1],[{},2]))
console.log(isEqual({},1))
console.log(isEqual([],1))
@xiaojue
xiaojue / equal.js
Created October 31, 2011 17:18
javascript equal method
var lang = function() {
var types = ["Array", "Object", "String", "Number"],
ret = {};
for (var i = 0; i < types.length; i++) { (function(i) {
var type = types[i];
ret['is' + type] = function(arg) {
return lang._typeof(arg) === "[object " + type + "]";
}
})(i)
}
@xiaojue
xiaojue / snake.js
Created October 9, 2011 12:24
web game
(function() {
var G = {};
G.Game = function() {
var start = "";
this.boxWidth = 25;//单位宽度
this.boxHeight = 15;//单位长度
this.blockWidth = 30; //单位块
this.speed = 200; //运动速度
var blockWidth = this.blockWidth - 2;//border为1 预留
var _this = this;