1(function(window, undefined){ 2 var index = 0; 3 var currPath = getCurrScriptPath(); 4 5 /** 6 * è·åèæ¬è·¯å¾ 7 */ 8 function getCurrScriptPath(){ 9 var scripts = document.getElementsByTagName("script"), 10 script = scripts[scripts.length - 1], 11 a = document.createElement('a'); 12 a.href = document.querySelector ? script.src : script.getAttribute("src", 4); 13 var path = a.pathname.replace(/[\/\\]+([^\/\\]*)$/, ''); 14 return path.charAt(0) == '/' ? path : '/' + path; 15 } 16 17 function addStyle(href){ 18 var style; 19 var styleElements = document.getElementsByTagName("link"); 20 if(styleElements){ 21 var l = styleElements.length; 22 for (var i = 0; i < l; i++) { 23 if(styleElements[i].href == href) 24 return ; 25 } 26 } 27 style = document.createElement("link"); 28 style.type = "text/css"; 29 style.rel="stylesheet"; 30 style.href = href; 31 document.getElementsByTagName("head")[0].appendChild(style); 32 } 33 //卿å¢å js 34 function addScript(src, loadendCall){ 35 var script, loaded = false; 36 var scriptElements = document.getElementsByTagName("script"); 37 if(scriptElements){ 38 var len = scriptElements.length; 39 for (var i = 0; i < len; i++) { 40 if(scriptElements[i].src == src){ 41 return; 42 } 43 } 44 } 45 script = document.createElement("script"); 46 script.type = "text/javascript"; 47 script.onreadystatechange= function () { 48 if ((this.readyState == 'complete' || this.readyState == 'loaded') && !loaded) { 49 loaded = true; 50 loadendCall(); 51 } 52 }; 53 script.onload= function(){ 54 if(!loaded){ 55 loaded = true; 56 loadendCall(); 57 } 58 }; 59 script.src = src; 60 document.getElementsByTagName("HEAD")[0].appendChild(script); 61 } 62 63 function openDialog(options){ 64 var pageid = 'dialog_page_iframe_' + index++; 65 easyDialog.open({ 66 container : { 67 header: '<span>' + (options.title || '') + '</span>', 68 content: '<div id="' + pageid + '" style="width:' + (options.width || 300) + 'px;height:' + (options.height || 200) + 'px;"></div>', 69 noFn : options.noFn 70 }, 71 fixed : true, 72 drag : false, 73 overlay : options.overlay, 74 callback : callFn //easydialogæ¬èº«callbackäºä»¶,页é¢èªèº«å®ä¹ 75 }); 76 $('.easyDialog_footer').hide(); 77 $('<iframe/>', { 78 frameborder : '0', 79 css : {'width': '100%', 'height': '100%'}, 80 src : options.url 81 }).appendTo($("#" + pageid)).load(function(){ 82 var cw = this.contentWindow; 83 cw.dialogPageCallback = function(){ 84 if(typeof(options.callback) === 'function'){ 85 try{ 86 options.callback.apply(this, arguments); 87 }catch(e){ 88 //ignore 89 } 90 } 91 easyDialog.close(); 92 }; 93 if(cw.callback === undefined){ 94 cw.callback = cw.dialogPageCallback; 95 } 96 }); 97 } 98 99 function openDialogalert(options){ 100 easyDialog.open({ 101 container : { 102 header : '<span>' + (options.title || '') + '</span>', 103 content : '<div style="width:' + (options.width || 300) + 'px;height:' + (options.height || 200) + 'px;text-align: center;padding-top:' + (options.height || 200)/5*2 + 'px;box-sizing: border-box;">' + options.content + '</div>', 104 yesFn : options.yesFn, 105 noFn : options.noFn 106 }, 107 fixed : true, 108 drag : false, 109 overlay : options.overlay, 110 callback : callFn //easydialogæ¬èº«callbackäºä»¶,页é¢èªèº«å®ä¹ 111 }); 112 } 113 114 window.openDialogPage = function(options){ 115 //$('#overlay').css("opacity","0.9"); 116 try { 117 if(window.top !== window.self && window.top.openDialogPage){ 118 return window.top.openDialogPage(options); 119 } 120 } catch (e) { 121 // TODO: handle exception 122 } 123 if(window.easyDialogPage === undefined){ 124 addStyle(currPath + '/../../styles/client/dialog.css'); 125 addScript(currPath + '/easydialog.js', function(){ 126 openDialog(options); 127 }); 128 }else{ 129 openDialog(options); 130 } 131 } 132 133 window.openDialogAlert = function(options){ 134 //$('#overlay').css("opacity","0"); 135 try { 136 if(window.top !== window.self && window.top.openDialogAlert){ 137 return window.top.openDialogAlert(options); 138 } 139 } catch (e) { 140 // TODO: handle exception 141 } 142 if(window.easyDialogalert === undefined){ 143 addStyle(currPath + '/../../styles/client/dialog.css'); 144 addScript(currPath + '/easydialog.js', function(){ 145 openDialogalert(options); 146 }); 147 }else{ 148 openDialogalert(options); 149 } 150 } 151})(window, undefined); 152 153var callFn = function(){ 154 return; 155}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.