提交 | 用户 | 时间
|
1ac2bc
|
1 |
(function () { |
懒 |
2 |
var parent = window.parent; |
|
3 |
//dialog对象 |
|
4 |
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )]; |
|
5 |
//当前打开dialog的编辑器实例 |
|
6 |
editor = dialog.editor; |
|
7 |
|
|
8 |
UE = parent.UE; |
|
9 |
|
|
10 |
domUtils = UE.dom.domUtils; |
|
11 |
|
|
12 |
utils = UE.utils; |
|
13 |
|
|
14 |
browser = UE.browser; |
|
15 |
|
|
16 |
ajax = UE.ajax; |
|
17 |
|
|
18 |
$G = function ( id ) { |
|
19 |
return document.getElementById( id ) |
|
20 |
}; |
|
21 |
//focus元素 |
|
22 |
$focus = function ( node ) { |
|
23 |
setTimeout( function () { |
|
24 |
if ( browser.ie ) { |
|
25 |
var r = node.createTextRange(); |
|
26 |
r.collapse( false ); |
|
27 |
r.select(); |
|
28 |
} else { |
|
29 |
node.focus() |
|
30 |
} |
|
31 |
}, 0 ) |
|
32 |
}; |
|
33 |
utils.loadFile(document,{ |
|
34 |
href:editor.options.themePath + editor.options.theme + "/dialogbase.css?cache="+Math.random(), |
|
35 |
tag:"link", |
|
36 |
type:"text/css", |
|
37 |
rel:"stylesheet" |
|
38 |
}); |
|
39 |
lang = editor.getLang(dialog.className.split( "-" )[2]); |
|
40 |
if(lang){ |
|
41 |
domUtils.on(window,'load',function () { |
|
42 |
|
|
43 |
var langImgPath = editor.options.langPath + editor.options.lang + "/images/"; |
|
44 |
//针对静态资源 |
|
45 |
for ( var i in lang["static"] ) { |
|
46 |
var dom = $G( i ); |
|
47 |
if(!dom) continue; |
|
48 |
var tagName = dom.tagName, |
|
49 |
content = lang["static"][i]; |
|
50 |
if(content.src){ |
|
51 |
//clone |
|
52 |
content = utils.extend({},content,false); |
|
53 |
content.src = langImgPath + content.src; |
|
54 |
} |
|
55 |
if(content.style){ |
|
56 |
content = utils.extend({},content,false); |
|
57 |
content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath) |
|
58 |
} |
|
59 |
switch ( tagName.toLowerCase() ) { |
|
60 |
case "var": |
|
61 |
dom.parentNode.replaceChild( document.createTextNode( content ), dom ); |
|
62 |
break; |
|
63 |
case "select": |
|
64 |
var ops = dom.options; |
|
65 |
for ( var j = 0, oj; oj = ops[j]; ) { |
|
66 |
oj.innerHTML = content.options[j++]; |
|
67 |
} |
|
68 |
for ( var p in content ) { |
|
69 |
p != "options" && dom.setAttribute( p, content[p] ); |
|
70 |
} |
|
71 |
break; |
|
72 |
default : |
|
73 |
domUtils.setAttributes( dom, content); |
|
74 |
} |
|
75 |
} |
|
76 |
} ); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
})(); |
|
81 |
|