Song.Site/Manage/Scripts/webdesk.ui.core.js
(开头部分) 30KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*!
* 主 题:一个简化版的Jquery
* 说 明:
* 1、类似JQuery,主要为了方便操作DOM;
* 2、满足大多数DOM操作,不兼容IE678;
* 3、另外写了动态加载css和js的方法,在最后面
*
* 作 者:微厦科技_宋雷鸣_10522779@qq.com
* 开发时间: 2020年1月1日
* 最后修订:2020年2月4日
* github开源地址:https://github.com/weishakeji/WebdeskUI
*/
(function () {
//html节点查询,类似jquery
var webdom = function (query, context) {
return new webdom.init(query, context);
};
webdom.version = '0.12';
webdom.init = function (query, context) {
var nodes = [];
if (typeof (query) == 'string') nodes = (context || document).querySelectorAll(query);
if (query instanceof Node) nodes[0] = query;
if (query instanceof NodeList || query instanceof Array) nodes = query;
//查询结果附加到对象自身
this.length = nodes.length;
for (var i = 0; i < this.length; i++) this[i] = nodes[i];
this.typeof = 'webui.element';
return this;
};
var fn = webdom.init.prototype;
//遍历节点元素,并执行fun函数
//ret:默认返回自身对象,如果ret有值,则返回fun函的执行结果
fn.each = function (fun, ret) {
var results = [],
res;
for (var i = 0; i < this.length; i++) {
res = fun.call(this[i], i);
//实现continue和break方法
if (typeof (res) == 'boolean') {
results.push(res);
if (res) continue;
if (!res) break;
}
if (res instanceof NodeList || res instanceof Array) {
for (var j = 0; j < res.length; j++) {
if (res[j] instanceof Node) {
if (res[j].nodeType == 1) results.push(res[j])
} else {
results.push(res[j]);
}
}
} else {
switch (typeof (res)) {
case 'string':
results.push(res.replace(/^\s*|\s*$/g, ""));
break;
case 'boolean':
case 'number':
results.push(res);
break;
后面还有 799 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
