|
2 | 2 | <head> |
3 | 3 | <meta charset="utf-8"> |
4 | 4 | <link href="../css/index.css" type="text/css" rel="stylesheet"> |
5 | | - <script src="../js/g/g.js"></script> |
| 5 | + <style type="text/css"> |
| 6 | + .ui-hover-list{ |
| 7 | + display: none; |
| 8 | + } |
| 9 | + .active .ui-hover-list{ |
| 10 | + display: block |
| 11 | + } |
| 12 | + </style> |
6 | 13 | <script> |
7 | | - G.config('baseUrl', 'http://localhost:63342/BHWebTest/'); |
8 | | - G.config('alias',{ |
9 | | - 'ModuleC':'app/js/g/ModuleC.js', |
10 | | - '$':"app/js//zepto/zepto.cmb.js" |
11 | | - }); |
12 | | - !function(){ |
13 | | - G.use(['app/js/g/ModuleA.js','app/js/g/ModuleB.js','ModuleC'],function(A,B,C){ |
14 | | - A.alertA(); |
15 | | - B.alertB(); |
16 | | - alert(C.C); |
| 14 | + var head = document.head || |
| 15 | + document.getElementsByTagName( 'head' )[0] || |
| 16 | + document.documentElement; |
| 17 | + |
| 18 | + var script = document.createElement( 'SCRIPT' ); |
| 19 | + var done = false; |
| 20 | + script.setAttribute( 'type', "text/javascript" ); |
| 21 | + script.setAttribute( 'charset', 'utf-8' ); |
| 22 | + script.setAttribute( 'src', '../js/g/g.js' ); |
| 23 | + script.setAttribute( 'async', true ); |
| 24 | + script.onload = script.onreadystatechange = function(){ |
| 25 | + if ( !done &&( !this.readyState || this.readyState === "loaded" ||this.readyState === "complete" ) ){ |
| 26 | + done = true; |
| 27 | + script.onload = script.onreadystatechange = null; |
| 28 | + } |
| 29 | + G.config('baseUrl', 'http://localhost:63342/BHWebTest/'); |
| 30 | + G.config('alias',{ |
| 31 | + 'ModuleC':'app/js/g/ModuleC.js', |
| 32 | + "_":"app/js/_/underscore.js", |
| 33 | + '$':"app/js/zepto/zepto.cmb.js" |
17 | 34 | }); |
18 | | - }(); |
| 35 | + !function(){ |
| 36 | + G.use(['app/js/g/ModuleA.js','app/js/g/ModuleB.js','ModuleC'],function(A,B,C){ |
| 37 | + console.log(A,B,C); |
| 38 | + }); |
| 39 | + G.use(['app/js/widgets/widget.js','$'],function(w,$){ |
| 40 | + w.initWidgets(); |
| 41 | + }); |
| 42 | + G.use(['$'],function($){ |
| 43 | + var aa = { |
| 44 | + 'aaa':function(q){ |
| 45 | + alert("q:"+q); |
| 46 | + } |
| 47 | + } |
| 48 | +// var a = $.Deferred(); |
| 49 | +// a.resolve(new aa.aaa("hello")); |
| 50 | + aa.aaa("123"); |
| 51 | + }); |
| 52 | + }(); |
| 53 | + } |
| 54 | + |
| 55 | + |
| 56 | + head.appendChild( script ); |
19 | 57 | </script> |
20 | 58 | </head> |
21 | 59 |
|
| 60 | +<body> |
| 61 | +<div data-widget="app/js/widgets/WidgetTest.js#hoverWidget"> |
| 62 | + <span>当前的标题</span> |
| 63 | + <ul class="ui-hover-list"> |
| 64 | + <li>标题1</li> |
| 65 | + <li>标题2</li> |
| 66 | + <li>标题3</li> |
| 67 | + </ul> |
| 68 | +</div> |
| 69 | +</body> |
22 | 70 | <!--<title>BHWebTest</title>--> |
23 | 71 |
|
24 | 72 | <!--<body>--> |
|
0 commit comments