sso

internal.js 2.6KB

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