微信公众号管理后台

internal2.js 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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: window.location.host+"/union_wx/static/UEditor/themes/default/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. setTimeout(function() {
  36. var langImgPath = window.location.host + "/union_wx/static/UEditor/lang/zh-cn/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. },200);
  70. }
  71. })();