⼿机淘宝列表页⾯的js调⽤展⽰⼿机淘宝列表页⾯ 的js调⽤展⽰
--------------------------------
列表页⾯
// 请求页⾯数据, 开始解析
function getPageView() {
// 从 location 获取页⾯参数
var params = [],
PAGE_QUERY = {},
VIEW_DATA = {};
var page = window.G_msp_path?window.G_msp_path:'';//兼容店铺⾸页
var search = location.search;
if(search) {
//search = decodeURIComponent(search);
search = search.slice(1).split('&');
search.forEach(function(param) {
param = param.split('=');
var k = param[0];
var v = param[1];
try{
v=decodeURIComponent(v);
}catch(err) {}
if(k == 'page') {
page = v;
} else {
params.push(k + ':' + v);
PAGE_QUERY[k] = v;
}
})
}
if(!PAGE_QUERY.userId&&window.G_msp_userId){
PAGE_QUERY.userId=window.G_msp_userId;
VIEW_DATA.userId=window.G_msp_userId;
params.push('userId:' + window.G_msp_userId);
//兼容店铺⾸页
};
};
if(window.G_msp_shopId){
params.push('shop_id:' + window.G_msp_shopId);
};
if(!page) {
<('缺少 page 参数!');
return;
}
api: "PageView",
v: "2.0",
data: {
page: page,
clientVersion: '10000',
params: params.join(';')
}
}, function(resp) {
var resp=resp;
Object.keys(meta.data).forEach(function(k) {
VIEW_DATA[k] = meta.data[k];
})
// 单独处理页⾯ title
var page_title = meta.title;
if(page_title) {
if(String(page_title).indexOf('$') == 0) {
page_title = VIEW_DATA[page_title.slice(1)];
};
if(page_title) {
document.title = decodeURI(page_title);
if (v.taobaoApp && v.taobaoApp.appname=='TB'&& lib.WindVane) {
lib.windvane.call('WebAppInterface', 'setCustomPageTitle',decodeURI(page_title));                };
}
}
var page = new PageView(resp.data);
var host = document.querySelector('#we-page');
host.innerHTML = '';
host.appendChild();
}, function(resp) {
console.log('获取页⾯数据失败: ', resp);
});
}
getPageView();
另外
-------------
--------------------------------------------
!
function(a) {
im === a && (im = function() {
place(/^\s+|\s+$/g, "")
}),
duce === a && (duce = function(b) {
if (void 0 === this || null === this) throw new TypeError;
var c, d = Object(this),
e = d.length >>> 0,
f = 0;
if ("function" != typeof b) throw new TypeError;
if (0 == e && 1 == arguments.length) throw new TypeError;
if (arguments.length >= 2) c = arguments[1];
else for (;;) {
if (f in d) {
c = d[f++];
break
}
if (++f >= e) throw new TypeError
}
for (; e > f;) f in d && (c = b.call(a, c, d[f], f, d)),
f++;
return c
})
} ();
var Zepto = function() {
function a(a) {
return null == a ? String(a) : W[X.call(a)] || "object"
}
function b(b) {
return "function" == a(b)
}
function c(a) {
return null != a && a == a.window
}
function d(a) {
return null != a && a.nodeType == a.DOCUMENT_NODE
}
function e(b) {
return "object" == a(b)
}
function f(a) {
return e(a) && !c(a) && a.__proto__ == Object.prototype
}
function g(a) {
return a instanceof Array
}
function h(a) {
return "number" == typeof a.length
}
function i(a) {
return E.call(a,
function(a) {
return null != a
})
}
function j(a) {
return a.length > 0 ? at.apply([], a) : a
}
function k(a) {
place(/::/g, "/").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").replace(/_/g, "-").toLowerCase() }
function l(a) {
function l(a) {
return a in H ? H[a] : H[a] = new RegExp("(^|\\s)" + a + "(\\s|$)")
}
function m(a, b) {
return "number" != typeof b || J[k(a)] ? b: b + "px"
}
function n(a) {
var b, c;
return G[a] || (b = F.createElement(a), F.body.appendChild(b), c = I(b, "").getPropertyValue("display"), veChild(b), "none" == c && (c = "block  G[a]
}
function o(a) {
return "children" in a ? D.call(a.children) : y.map(a.childNodes,
function(a) {
return 1 == a.nodeType ? a: void 0
})
}
function p(a, b, c) {
for (x in b) c && (f(b[x]) || g(b[x])) ? (f(b[x]) && !f(a[x]) && (a[x] = {}), g(b[x]) && !g(a[x]) && (a[x] = []), p(a[x], b[x], c)) : b[x] !== w && (a[x] = b[x])
}
function q(a, b) {
return b === w ? y(a) : y(a).filter(b)
}
function r(a, c, d, e) {
return b(c) ? c.call(a, d, e) : c
}
function s(a, b, c) {
null == c ? a.removeAttribute(b) : a.setAttribute(b, c)
}
function t(a, b) {
var c = a.className,
d = c && c.baseVal !== w;
return b === w ? d ? c.baseVal: c: void(d ? c.baseVal = b: a.className = b)
}
function u(a) {
var b;
try {
js arguments
return a ? "true" == a || ("false" == a ? !1 : "null" == a ? null: isNaN(b = Number(a)) ? /^[\[\{]/.test(a) ? y.parseJSON(a) : a: b) : a
} catch(c) {
return a
}
}
function v(a, b) {
b(a);
for (var c in a.childNodes) v(a.childNodes[c], b)
}
var w, x, y, z, A, B, C = [],
D = C.slice,
E = C.filter,
F = window.document,
G = {},
H = {},
I = ComputedStyle,
J = {
"column-count": 1,
columns: 1,
"font-weight": 1,
"line-height": 1,
opacity: 1,
"z-index": 1,
zoom: 1
},
K = /^\s*<(\w+|!)[^>]*>/,
L = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
M = /^(?:body|html)$/i,
N = ["val", "css", "html", "text", "data", "width", "height", "offset"],
N = ["val", "css", "html", "text", "data", "width", "height", "offset"],
O = ["after", "prepend", "before", "append"],
P = F.createElement("table"),
Q = F.createElement("tr"),
R = {
tr: F.createElement("tbody"),
tbody: P,
thead: P,
tfoot: P,
td: Q,
th: Q,
"*": F.createElement("div")
},
S = /complete|loaded|interactive/,
T = /^\.([\w-]+)$/,
U = /^#([\w-]*)$/,
V = /^[\w-]+$/,
W = {},
X = W.toString,
Y = {},
Z = F.createElement("div");
return Y.matches = function(a, b) {
if (!a || 1 !== a.nodeType) return ! 1;
var c = a.webkitMatchesSelector || a.mozMatchesSelector || a.oMatchesSelector || a.matchesSelector;  if (c) return c.call(a, b);
var d, e = a.parentNode,
f = !e;
return f && (e = Z).appendChild(a),
d = ~Y.qsa(e, b).indexOf(a),
f && Z.removeChild(a),
d
},
A = function(a) {
place(/-+(.)?/g,
function(a, b) {
return b ? b.toUpperCase() : ""
})
},
B = function(a) {
return E.call(a,
function(b, c) {
return a.indexOf(b) == c
})
},
Y.fragment = function(a, b, c) {
b === w && (b = K.test(a) && RegExp.$1),
b in R || (b = "*");
var d, e, g = R[b];
return g.innerHTML = "" + a,
e = y.each(D.call(g.childNodes),
function() {
}),
f(c) && (d = y(e), y.each(c,
function(a, b) {
N.indexOf(a) > -1 ? d[a](b) : d.attr(a, b)
})),
e
},
Y.Z = function(a, b) {
return a = a || [],
a.__proto__ = y.fn,
a.selector = b || "",
a
},