tuzhu_req.js 實(shí)現(xiàn)仿百度圖片首頁(yè)效果
tuzhu_req.js 處理文件請(qǐng)求加載異步同步功能,仿效百度圖片首頁(yè)效果制作
/*土著人開發(fā)的require組件 @土著人 (http://www.tuzhuren.com)*/
! function() {
function e() {}
Function.prototype.bind || (Function.prototype.bind = function(t) {
var n = this;
if ("function" != typeof n)
throw new TypeError("Function.prototype.bind called on incompatible " + n);
var o = r.call(arguments, 1),
i = function() {
if (this instanceof i) {
var e = n.apply(this, o.concat(r.call(arguments)));
return Object(e) === e ? e : this;
}
return n.apply(t, o.concat(r.call(arguments)));
};
return n.prototype && (e.prototype = n.prototype, i.prototype = new e, e.prototype = null), i;
});
var t = Array.prototype,
r = t.slice;
}();
var require, define;
! function(e) {
function t(e, t) {
if (!(e in u)) {
u[e] = !0;
var r = document.createElement("script");
if (t) {
var o = setTimeout(t, require.timeout);
r.onerror = function() {
clearTimeout(o), t()
}, r.onreadystatechange = function() {
"complete" == this.readyState && clearTimeout(o)
}
}
return r.type = "text/javascript", r.src = e, n.appendChild(r), r;
}
}
function r(e, r, n) {
var i = o[e] || (o[e] = []);
i.push(r);
var a, u = c[e] || {},
s = u.pkg;
a = s ? p[s].url : u.url || e, t(a, n && function() {
n(e);
});
}
function isFunction(it) {
return Object.prototype.toString.call(it) === '[object Function]';
}
function isArray(it) {
return Object.prototype.toString.call(it) === '[object Array]';
}
var n = document.getElementsByTagName("head")[0],
o = {},
i = {},
a = {},
u = {},
c = {},
p = {};
define = function(name, deps, callback) {
if (isArray(deps) && isFunction(callback)) {
deps = callback;
}
i[name] = deps;
var r = o[e];
if (r) {
for (var n = 0, a = r.length; a > n; ++n)
r[n]();
delete o[name];
}
}, require = function(e) {
e = require.alias(e);
var t = a[e];
if (t)
return t.exports;
var r = i[e];
if (!r)
return false;
t = a[e] = {
exports: {}
};
var n = "function" == typeof r ? r.apply(t, [require, t.exports, t]) : r;
return n && (t.exports = n), t.exports;
}, require.async = function(t, n, o) {
function a(e) {
for (var t = e.length - 1; t >= 0; --t) {
var n = e[t],
p = c[n];
p && "deps" in p && a(p.deps), n in i || n in s || (s[n] = !0, l++, r(n, u, o));
}
}
function u() {
if (0 == l--) {
var r, o, i = [];
for (r = 0, o = t.length; o > r; ++r)
try {
i[r] = require(t[r])
} catch (a) {}
n && n.apply(e, i);
}
}
"string" == typeof t && (t = [t]);
for (var p = t.length - 1; p >= 0; --p)
t[p] = require.alias(t[p]);
var s = {},
l = 0;
a(t), u();
}, require.resourceMap = function(e) {
var t, r;
r = e.res;
for (t in r)
r.hasOwnProperty(t) && (c[t] = r[t]);
r = e.pkg;
for (t in r)
r.hasOwnProperty(t) && (p[t] = r[t]);
}, require.loadJs = function(e) {
t(e);
}, require.loadCss = function(e) {
if (e.content) {
var t = document.createElement("style");
t.type = "text/css", t.styleSheet ? t.styleSheet.cssText = e.content : t.innerHTML = e.content, n.appendChild(t);
} else if (e.url) {
var r = document.createElement("link");
r.href = e.url, r.rel = "stylesheet", r.type = "text/css", n.appendChild(r);
}
}, require.alias = function(e) {
return e
}, require.timeout = 5e3, define.amd = {
jQuery: !0,
version: "1.0.0"
}
}(this);
! function() {
(function() {
var widgets = [],
nameIdxMap = {},
callbacks = [],
remainings = 0;
require.widget = {
register: function(name) {
var idx = nameIdxMap[name];
if (idx == undefined) {
nameIdxMap[name] = widgets.length;
widgets.push(1);
remainings++;
} else {
widgets[idx]++;
}
},
ready: function(callback, ctx) {
callbacks.push({
func: callback,
context: ctx
});
if (remainings < 1) {
_ready();
}
},
loaded: function(name) {
var idx = nameIdxMap[name],
num = widgets[idx] - 1;
widgets[idx] = num;
if (num == 0 && remainings) {
remainings--;
}
if (remainings < 1) {
_ready();
}
}
};
function _ready() {
var callback;
while (callback = callbacks.pop()) {
callback.func.call(callback.ctx);
}
}
})();
}();
希望本文能夠給大家學(xué)習(xí)使用javascript處理文件請(qǐng)求加載異步同步功能有所幫助。
相關(guān)文章
jQuery實(shí)現(xiàn)頁(yè)面頂部顯示的進(jìn)度條效果完整實(shí)例
這篇文章主要介紹了jQuery實(shí)現(xiàn)頁(yè)面頂部顯示的進(jìn)度條效果,以完整實(shí)例形式分析了jQuery基于animate與setTimeout定時(shí)觸發(fā)實(shí)現(xiàn)進(jìn)度條漸進(jìn)顯示功能,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下2015-12-12
jquery和js實(shí)現(xiàn)對(duì)div的隱藏和顯示方法
jquery和js分別可以實(shí)現(xiàn)對(duì)div的隱藏和顯示,方法也不一樣,jquery的show、show;js的hidden、visible2014-09-09
可以浮動(dòng)某個(gè)物體的jquery控件用法實(shí)例
這篇文章主要介紹了可以浮動(dòng)某個(gè)物體的jquery控件,實(shí)例分析了jquery控件實(shí)現(xiàn)頁(yè)面浮動(dòng)層的使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-07-07
JQuery Ajax如何實(shí)現(xiàn)注冊(cè)檢測(cè)用戶名
這篇文章主要介紹了JQuery Ajax如何實(shí)現(xiàn)注冊(cè)檢測(cè)用戶名,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-09-09
Jquery實(shí)現(xiàn)select multiple左右添加和刪除功能的簡(jiǎn)單實(shí)例
下面小編就為大家?guī)硪黄狫query實(shí)現(xiàn)select multiple左右添加和刪除功能的簡(jiǎn)單實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05
jQuery學(xué)習(xí)筆記 操作jQuery對(duì)象 屬性處理
HTML文檔,不但有一系列語義標(biāo)簽,每個(gè)標(biāo)簽下屬還有一系列屬性節(jié)點(diǎn)。自然我們也想去操作這些屬性節(jié)點(diǎn)。格式仍然為$(selector).方法2012-09-09
jQuery實(shí)現(xiàn)頁(yè)面內(nèi)錨點(diǎn)平滑跳轉(zhuǎn)特效的方法總結(jié)
通過jQuery實(shí)現(xiàn)頁(yè)面內(nèi)錨點(diǎn)平滑跳轉(zhuǎn)的方法很多,可以通過插件hovertreescroll實(shí)現(xiàn),也可以簡(jiǎn)單的通過animate方法實(shí)現(xiàn),下面介紹這2種比較簡(jiǎn)單的方法。2015-05-05
jQuery基于隨機(jī)數(shù)解決中午吃什么去哪吃問題示例
這篇文章主要介紹了jQuery基于隨機(jī)數(shù)解決中午吃什么去哪吃問題,涉及jQuery基于事件響應(yīng)及隨機(jī)數(shù)動(dòng)態(tài)操作頁(yè)面元素相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-12-12
基于JQuery的6個(gè)Tab選項(xiàng)卡插件
今天在修整博客側(cè)欄信息時(shí),利用到了Tab選項(xiàng)卡方式,因?yàn)閆Blog封裝的是JQuery庫(kù),所以很自然地就想到了IdTabs。2010-09-09

