layui 원본 해독 (부분)

14262 단어




     
    <span style="color:#000000;">
    ;</span>!<span style="color:#0000ff;">function</span><span style="color:#000000;">(win) {
    </span><span style="color:#0000ff;">var</span> o =<span style="color:#000000;"> {
            modules: {},
            status: {},
            timeout: </span>10<span style="color:#000000;">,
            event: {}
    } ,
    t </span>=<span style="color:#000000;"> document,
    n </span>= <span style="color:#0000ff;">function</span><span style="color:#000000;">() {
        </span><span style="color:#0000ff;">this</span>.v = "2.4.5"<span style="color:#000000;">
    },
    u </span>=<span style="color:#000000;"> {
            layer: </span>"modules/layer"<span style="color:#000000;">,
            laydate: </span>"modules/laydate"<span style="color:#000000;">,
            laypage: </span>"modules/laypage"<span style="color:#000000;">,
            laytpl: </span>"modules/laytpl"<span style="color:#000000;">,
            layim: </span>"modules/layim"<span style="color:#000000;">,
            layedit: </span>"modules/layedit"<span style="color:#000000;">,
            form: </span>"modules/form"<span style="color:#000000;">,
            upload: </span>"modules/upload"<span style="color:#000000;">,
            tree: </span>"modules/tree"<span style="color:#000000;">,
            table: </span>"modules/table"<span style="color:#000000;">,
            element: </span>"modules/element"<span style="color:#000000;">,
            rate: </span>"modules/rate"<span style="color:#000000;">,
            colorpicker: </span>"modules/colorpicker"<span style="color:#000000;">,
            slider: </span>"modules/slider"<span style="color:#000000;">,
            carousel: </span>"modules/carousel"<span style="color:#000000;">,
            flow: </span>"modules/flow"<span style="color:#000000;">,
            util: </span>"modules/util"<span style="color:#000000;">,
            code: </span>"modules/code"<span style="color:#000000;">,
            jquery: </span>"modules/jquery"<span style="color:#000000;">,
            mobile: </span>"modules/mobile"<span style="color:#000000;">,
            </span>"layui.all": "../layui.all"<span style="color:#000000;">
    },
    r </span>= <span style="color:#0000ff;">function</span><span style="color:#000000;">() {
        </span><span style="color:#0000ff;">var</span> e = t.currentScript ? t.currentScript.src : <span style="color:#0000ff;">function</span><span style="color:#000000;">() {
            </span><span style="color:#0000ff;">for</span> (<span style="color:#0000ff;">var</span> e, o = t.scripts, n = o.length - 1, r = n; r > 0; r--<span style="color:#000000;">)
                </span><span style="color:#0000ff;">if</span> ("interactive" ===<span style="color:#000000;"> o[r].readyState) {
                    e </span>=<span style="color:#000000;"> o[r].src;
                    </span><span style="color:#0000ff;">break</span><span style="color:#000000;">
                }
            </span><span style="color:#0000ff;">return</span> e ||<span style="color:#000000;"> o[n].src
        }();
        </span><span style="color:#0000ff;">return</span> e.substring(0, e.lastIndexOf("/") + 1<span style="color:#000000;">)
    }(),
     i </span>= <span style="color:#0000ff;">function</span><span style="color:#000000;">(t) {
        e.console </span>&& console.error && console.error("Layui hint: " +<span style="color:#000000;"> t)
    };
     </span><span style="color:#008000;">//</span><span style="color:#008000;">  ( )</span>
     n.prototype.modules = <span style="color:#0000ff;">function</span><span style="color:#000000;">() {
        </span><span style="color:#0000ff;">var</span> e =<span style="color:#000000;"> {};
        </span><span style="color:#0000ff;">for</span> (<span style="color:#0000ff;">var</span> t <span style="color:#0000ff;">in</span><span style="color:#000000;"> u)
            e[t] </span>=<span style="color:#000000;"> u[t];
        </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> e
    }();
    </span><span style="color:#008000;">//</span><span style="color:#008000;">  config(e)</span>
    n.prototype.config = <span style="color:#0000ff;">function</span><span style="color:#000000;">(e) {
        e </span>= e ||<span style="color:#000000;"> {};
        </span><span style="color:#0000ff;">for</span> (<span style="color:#0000ff;">var</span> t <span style="color:#0000ff;">in</span><span style="color:#000000;"> e) 
            o[t] </span>=<span style="color:#000000;"> e[t];
        </span><span style="color:#0000ff;">return</span> <span style="color:#0000ff;">this</span><span style="color:#000000;">
    };
    </span><span style="color:#008000;">//</span><span style="color:#008000;">  extend(e)</span>
    n.prototype.extend = <span style="color:#0000ff;">function</span><span style="color:#000000;">(e) {
    </span><span style="color:#0000ff;">var</span> t = <span style="color:#0000ff;">this</span><span style="color:#000000;">;
    e </span>= e ||<span style="color:#000000;"> {};
    </span><span style="color:#0000ff;">for</span> (<span style="color:#0000ff;">var</span> o <span style="color:#0000ff;">in</span><span style="color:#000000;"> e)
        t[o] </span>|| t.modules[o] ? i("  " + o + "  ") : t.modules[o] =<span style="color:#000000;"> e[o];
    </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> t
    };
    </span><span style="color:#008000;">//</span><span style="color:#008000;">  use(e)</span>
    n.prototype.use = <span style="color:#0000ff;">function</span><span style="color:#000000;">(e, n, l) {
        </span><span style="color:#0000ff;">function</span><span style="color:#000000;"> s(e, t) {
            </span><span style="color:#0000ff;">var</span> n = "PLaySTATION 3" === navigator.platform ? /^complete$/ : /^(complete|loaded)$/<span style="color:#000000;">;
            (</span>"load" === e.type || n.test((e.currentTarget || e.srcElement).readyState)) && (o.modules[f] =<span style="color:#000000;"> t,
            d.removeChild(v),
            </span><span style="color:#0000ff;">function</span><span style="color:#000000;"> r() {
                </span><span style="color:#0000ff;">return</span> ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : <span style="color:#0000ff;">void</span> (o.status[f] ? c() : setTimeout(r, 4<span style="color:#000000;">))
            }())
        }
        </span><span style="color:#0000ff;">function</span><span style="color:#000000;"> c() {
            l.push(layui[f]),
            e.length </span>> 1 ? y.use(e.slice(1), n, l) : "function" == <span style="color:#0000ff;">typeof</span> n &&<span style="color:#000000;"> n.apply(layui, l)
        }

        </span><span style="color:#0000ff;">var</span> y = <span style="color:#0000ff;">this</span><span style="color:#000000;">
          , p </span>= o.dir = o.dir ?<span style="color:#000000;"> o.dir : r
          , d </span>= t.getElementsByTagName("head")[0<span style="color:#000000;">];
        e </span>= "string" == <span style="color:#0000ff;">typeof</span> e ?<span style="color:#000000;"> [e] : e,
        window.jQuery </span>&& jQuery.fn.on && (y.each(e, <span style="color:#0000ff;">function</span><span style="color:#000000;">(t, o) {
            </span>"jquery" === o && e.splice(t, 1<span style="color:#000000;">)
        }),
        layui.jquery </span>= layui.$ =<span style="color:#000000;"> jQuery);
        </span><span style="color:#0000ff;">var</span> f = e[0<span style="color:#000000;">]
          , m </span>= 0<span style="color:#000000;">;
        </span><span style="color:#0000ff;">if</span> (l = l ||<span style="color:#000000;"> [],
        o.host </span>= o.host || (p.match(/\/\/([\s\S]+?)\//) || ["//" + location.host + "/"])[0<span style="color:#000000;">],
        </span>0 === e.length || layui["layui.all"] && u[f] || !layui["layui.all"] && layui["layui.mobile"] &&<span style="color:#000000;"> u[f])
            </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> c(),
            y;
        </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (o.modules[f])
            </span>!<span style="color:#0000ff;">function</span><span style="color:#000000;"> g() {
                </span><span style="color:#0000ff;">return</span> ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : <span style="color:#0000ff;">void</span> ("string" == <span style="color:#0000ff;">typeof</span> o.modules[f] && o.status[f] ? c() : setTimeout(g, 4<span style="color:#000000;">))
            }();
        </span><span style="color:#0000ff;">else</span><span style="color:#000000;"> {
            </span><span style="color:#0000ff;">var</span> v = t.createElement("script"<span style="color:#000000;">)
              , h </span>= (u[f] ? p + "lay/" : /^\{\/\}/.test(y.modules[f]) ? "" : o.base || "") + (y.modules[f] || f) + ".js"<span style="color:#000000;">;
            h </span>= h.replace(/^\{\/\}/, ""<span style="color:#000000;">),
            v.async </span>= !0<span style="color:#000000;">,
            v.charset </span>= "utf-8"<span style="color:#000000;">,
            v.src </span>= h + <span style="color:#0000ff;">function</span><span style="color:#000000;">() {
                </span><span style="color:#0000ff;">var</span> e = o.version === !0 ? o.v || (<span style="color:#0000ff;">new</span> Date).getTime() : o.version || ""<span style="color:#000000;">;
                </span><span style="color:#0000ff;">return</span> e ? "?v=" + e : ""<span style="color:#000000;">
            }(),
            d.appendChild(v),   </span><span style="color:#008000;">//</span><span style="color:#008000;">  // GET file:///C:/lib/larryms/js/base.js?v=2.0.8 net::ERR_FILE_NOT_FOUND</span>
            !v.attachEvent || v.attachEvent.toString && v.attachEvent.toString().indexOf("[native code") < 0 || a ? v.addEventListener("load", <span style="color:#0000ff;">function</span><span style="color:#000000;">(e) {
                s(e, h)
            }, </span>!1) : v.attachEvent("onreadystatechange", <span style="color:#0000ff;">function</span><span style="color:#000000;">(e) {
                s(e, h)
            }),
            o.modules[f] </span>=<span style="color:#000000;"> h
        }
        </span><span style="color:#0000ff;">return</span><span style="color:#000000;"> y
    }


    win.layui </span>= <span style="color:#0000ff;">new</span> n; <span style="color:#008000;">//</span><span style="color:#008000;"> </span>
<span style="color:#000000;">    }(window);

    </span>
    
     <span style="color:#008000;">/*</span><span style="color:#008000;">      layui.config({version: "2.0.8",base: '/lib/larryms/',mods: 'list/',page: 'Department',isFunction: true})
            .extend({larry: 'js/base'})
            .use('larry'); 
            var  abc = null ||{version: "2.0.8"}; //== 
            var  abc1 = 0 ||{version: "2.0.8"}; //== 
            var  abc2 = 1 ||{version: "2.0.8"}; //==1
            var obj = {version: "2.0.8"};
            for(var t in obj)
            {
                //t="version" 
                // obj[t] = obj["version"]
                // o[t] = o["version"]  
            }
        </span><span style="color:#008000;">*/</span>
            <span style="color:#0000ff;">var</span> t =  layui.config({version: "2.0.8",base: '/lib/larryms/',mods: 'list/',page: 'Department',isFunction: <span style="color:#0000ff;">true</span><span style="color:#000000;">});
            </span><span style="color:#0000ff;">var</span> t1 = t.extend({larry: 'js/base'<span style="color:#000000;">});
            t1.use(</span>'larry'<span style="color:#000000;">);
            
            </span><span style="color:#0000ff;">var</span> y = 0<span style="color:#000000;">;


            



    </span>

좋은 웹페이지 즐겨찾기