cloudgamer sohighthesky 我现在开始研究您们的代码,以后就跟您们混了

plglenn40 2010-01-18 07:38:21
...全文
158 14 打赏 收藏 举报
写回复
14 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
huing 2010-01-19
  • 打赏
  • 举报
回复
广告?
antony1029 2010-01-19
  • 打赏
  • 举报
回复
飘过
superwangming 2010-01-19
  • 打赏
  • 举报
回复
sohighthesky 2010-01-19
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 silentwins 的回复:]
又见plmm
[/Quote]
mldc2012 2010-01-19
  • 打赏
  • 举报
回复
10楼路过
happyboyxq 2010-01-19
  • 打赏
  • 举报
回复
~~~~~~~~~~~~~
bychgh 2010-01-19
  • 打赏
  • 举报
回复
带我一个哈哈
wiki14 2010-01-18
  • 打赏
  • 举报
回复
路过~
silentwins 2010-01-18
  • 打赏
  • 举报
回复
又见plmm
wuyq11 2010-01-18
  • 打赏
  • 举报
回复
好好研究
chen_ya_ping 2010-01-18
  • 打赏
  • 举报
回复
本人不才,实在看不懂楼主是什么意思。
plglenn40 2010-01-18
  • 打赏
  • 举报
回复
/* !
* Cloudgamer JavaScript Library v0.1
* Copyright (c) 2009 cloudgamer
* Blog : http : // cloudgamer.cnblogs.com /
* Date : 2009 - 10 - 15
*/

var $$, $$B, $$A, $$F, $$D, $$E, $$S;

(function()
{

var O, B, A, F, D, E, S;


/* Object */

O = function (id)
{
return "string" == typeof id ? document.getElementById(id) : id;

}
;

O.extend = function (destination, source)
{
for (var property in source)
{
destination[property] = source[property];
}
return destination;
}
;

O.deepextend = function (destination, source)
{
for (var property in source)
{
var copy = source[property];
if ( destination === copy ) continue;
if ( typeof copy === "object" )
{
destination[property] = arguments.callee( destination[property] ||
{
}
, copy );
}
else
{
destination[property] = copy;
}
}
return destination;
}
;


/* Browser */

/* from youa */
B = (function(ua)
{
var b =
{
msie : / msie / .test(ua) && ! / opera / .test(ua),
opera : / opera / .test(ua),
safari : / webkit / .test(ua) && ! / chrome / .test(ua),
firefox : / firefox / .test(ua),
chrome : / chrome / .test(ua)
}
;
var vMark = "";
for (var i in b)
{
if (b[i])
{
vMark = "safari" == i ? "version" : i;
break;

}
}
b.version = vMark && RegExp("(?:" + vMark + ")[\\/: ]([\\d.]+)").test(ua) ? RegExp.$1 : "0";

b.ie = b.msie;
b.ie6 = b.msie && parseInt(b.version) == 6;
b.ie7 = b.msie && parseInt(b.version) == 7;
b.ie8 = b.msie && parseInt(b.version) == 8;

return b;
}
)(window.navigator.userAgent.toLowerCase());


/* Array */

A = function()
{

var ret =
{
isArray : function( obj )
{
return Object.prototype.toString.call(obj) === "[object Array]";
}
,
indexOf : function( array, elt, from )
{
if (array.indexOf)
{
return array.indexOf(elt);
}
else
{
var len = array.length;
from = isNaN(from) ? 0
: (from < 0) ? Math.ceil(from) + len : Math.floor(from);

for ( ; from < len; from ++ )
{
if ( array[i] === elt ) return i;

}
return - 1;
}
}
,
lastIndexOf : function( array, elt, from )
{
if (array.lastIndexOf)
{
return array.lastIndexOf(elt);
}
else
{
var len = array.length;
from = isNaN(from) || from >= len - 1 ? len - 1
: from < 0 ? Math.ceil(from) + len : Math.floor(from)

for ( ; from > - 1; from -- )
{
if ( array[i] === elt ) return i;

}
return - 1;
}
}
}

function each( object, callback )
{
if ( undefined === object.length )
{
for ( var name in object )
{
if (false === callback( object[name], name, object ))
break;
}
}
else
{
for ( var i = 0, len = object.length; i < len;
i ++ )
{
if (false === callback( object[i], i, object ))
break;
}
}
}
;

each(
{
forEach : function( object, callback, thisp )
{
each.call( thisp, object, function()
{
callback.apply(thisp, arguments);

}
);
}
,
map : function( object, callback, thisp )
{
var ret = [];
each.call( thisp, object, function()
{
ret.push(callback.apply(thisp, arguments));

}
);
return ret;
}
,
filter : function( object, callback, thisp )
{
var ret = [];
each.call( thisp, object, function(item)
{
callback.apply(thisp, arguments) && ret.push(item);
}
);
return ret;
}
,
every : function( object, callback, thisp )
{
var ret = true;
each.call( thisp, object, function()
{
if ( ! callback.apply(thisp, arguments) )
{
ret = false;
return false;

}
;
}
);
return ret;

}
,
some : function( object, callback, thisp )
{
var ret = false;
each.call( thisp, object, function()
{
if ( callback.apply(thisp, arguments) )
{
ret = true;
return false;

}
;
}
);
return ret;
}
}
, function(method, name)
{
ret[name] = function( object, callback, thisp )
{
var original = object[name];
if (original)
{
return original( callback, thisp );
}
else
{
return method( object, callback, thisp );
}
}
}
);

return ret;
}
()


/* Function */

F = (function()
{
var slice = Array.prototype.slice;
return
{
bind : function( fun, thisp )
{
var args = slice.call(arguments, 2);
return function()
{
return fun.apply(thisp, args.concat(slice.call(arguments)));
}
}
,
bindAsEventListener : function( fun, thisp )
{
var args = slice.call(arguments, 2);
return function(event)
{
return fun.apply(thisp, [E.fixEvent(event)].concat(args));
}
}
}
;
}
)();


/* Dom */

D =
{
getScrollTop : function(node)
{
var doc = node ? node.ownerDocument : document;
return doc.documentElement.scrollTop || doc.body.scrollTop;
}
,
getScrollLeft : function(node)
{
var doc = node ? node.ownerDocument : document;
return doc.documentElement.scrollLeft || doc.body.scrollLeft;
}
,
contains : function(a, b)
{
return (this.contains = a.compareDocumentPosition
? function (a, b)
{
return ! ! (a.compareDocumentPosition(b) & 16);

}
: function (a, b)
{
return a != b && a.contains(b);

}
)(a, b);
}
,
rect : function(node)
{
var left = 0, top = 0, right = 0, bottom = 0;
// ie8的getBoundingClientRect获取不准确
if ( ! node.getBoundingClientRect || B.ie8 )
{
var n = node;
while (n)
{
left += n.offsetLeft, top += n.offsetTop;
n = n.offsetParent;

}
;
right = left + node.offsetWidth;
bottom = top + node.offsetHeight;
}
else
{
var rect = node.getBoundingClientRect();
left = right = this.getScrollLeft(node);
top = bottom = this.getScrollTop(node);
left += rect.left;
right += rect.right;
top += rect.top;
bottom += rect.bottom;
}
;
return
{
"left" : left, "top" : top, "right" : right, "bottom" : bottom
}
;
}
,
clientRect : function(node)
{
var rect = this.rect(node), sLeft = this.getScrollLeft(node), sTop = this.getScrollTop(node);
rect.left -= sLeft;
rect.right -= sLeft;
rect.top -= sTop;
rect.bottom -= sTop;
return rect;
}
,
curStyle : function(elem)
{
return (this.curStyle = document.defaultView
? function (elem)
{
return document.defaultView.getComputedStyle(elem, null);

}
: function (elem)
{
return elem.currentStyle;

}
)(elem);
}
,
getStyle : function(elem, name)
{
return (this.getStyle = document.defaultView
? function (elem, name)
{
var style = document.defaultView.getComputedStyle(elem, null);
return name in style ? style[ name ] : style.getPropertyValue( name );
}
: function (elem, name)
{
var style = elem.currentStyle;
// 透明度 from youa
if (name == "opacity")
{
if ( /alpha\(opacity=(.*)\)/i.test(style.filter) )
{
var opacity = parseFloat(RegExp.$1);
return opacity ? opacity / 100 : 0;
}
return 1;
}
;
huwei12345 2010-01-18
  • 打赏
  • 举报
回复
PandaIT 2010-01-18
  • 打赏
  • 举报
回复
相关推荐
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2010-01-18 07:38
社区公告
暂无公告