Skip to content

Instantly share code, notes, and snippets.

View zhuzhuaicoding's full-sized avatar

zhuzhu_coder zhuzhuaicoding

View GitHub Profile
scrollList: function ($awardList) {
var maxLeft = $awardList.height();
scroll(0);
function scroll(startTop) {
if (maxLeft / 2 <= -startTop) {
startTop = startTop % (maxLeft / 2);
$awardList.css({marginTop: startTop});
}
startTop -= 80;
$awardList.animate({marginTop: startTop}, {duration: 2000, step: function (now, fx) {
formatSecond: function (a) {
a = parseInt(a,10);
var b = parseInt(a / 60,10), c = b >= 60 ? parseInt(b / 60,10) : 0, d = a % 60, e = "";
return b >= 60 && (b %= 60), c > 0 && (e += 10 > c ? "0" + c : c, e += ":"), e += 10 > b ? "0" + b : b, e += ":", e += 10 > d ? "0" + d : d
}
@viewport {
width: device-width;
zoom: 1.0
}
function getPos(obj){var obj1=obj2=obj;var l=obj.offsetLeft;var t=obj.offsetTop;while(obj1=obj1.offsetParent)
l+=obj1.offsetLeft;while(obj2=obj2.offsetParent)
t+=obj2.offsetTop;var rg=QZFL.dom.getPosition(obj);return{top:t,left:l,width:rg.width,height:rg.height};
killFocus: function () {
var _arr = ['A', 'BUTTON'];
QQVIP.object.each(_arr, function (v) {
$e(v).each(function (o) {
o.onfocus = function () {
this.blur();
};
});
});
function $loadScript(obj) {
if (!$loadScript.counter) {
$loadScript.counter = 1;
}
var isObj = typeof(obj) == "object", url = isObj ? obj.url : arguments[0], id = isObj ? obj.id : arguments[1], obj = isObj ? obj : arguments[2], _head = document.head || document.getElementsByTagName("head")[0] || document.documentElement, _script = document.createElement("script"), D = new Date(), _time = D.getTime(), _isCleared = false, _timer = null, o = obj || {}, data = o.data || '', charset = o.charset || "gb2312", isToken = o.isToken, skey = o.skey, timeout = o.timeout, isAutoReport = o.isAutoReport || false, reportOptions = o.reportOptions || {}, reportType = o.reportType || 'current', reportRetCodeName = o.reportRetCodeName, reportSuccessCode = typeof(o.reportSuccessCode) == "undefined" ? 200 : o.reportSuccessCode, reportErrorCode = typeof(o.reportErrorCode) == "undefined" ? 500 : o.reportErrorCode, reportTimeoutCode = typeof(o.reportTimeoutCode) == "undefined" ? 600 : o.reportTimeoutCode, onload =
_globalEval : function(data){
if (data && /\S/.test(data)) {
var head = document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0],
script = document.createElement('script');
// 神奇的支持所有的浏览器
script.text = data;
head.insertBefore(script, head.firstChild);
setTimeout(function(){
insertCSSLink: function (url, opts, callback) {
var sid, doc, t, cssLink, head, docMode = document.documentMode;
if (typeof opts == "string") {
sid = opts;
}
opts = typeof opts == "object" ? opts : {};
sid = opts.linkID || sid;
doc = opts.doc || document;
head = doc.getElementsByTagName("head")[0];
cssLink = ((t = doc.getElementById(sid)) && (t.nodeName == "LINK")) ? t : null;
baidu.dom.getParent = function (element) {
element = baidu.dom._g(element);
//parentElement在IE下准确,parentNode在ie下可能不准确
return element.parentElement || element.parentNode || null;
};
STK.register("core.dom.contains", function (a) {
return function (a, b) {
if (a === b)return!1;
if (a.compareDocumentPosition)return(a.compareDocumentPosition(b) & 16) === 16;
if (a.contains && b.nodeType === 1)return a.contains(b);
while (b = b.parentNode)if (a === b)return!0;
return!1
}
});