U.CD.Left.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. Namespace.register("U.CD.L"); //注册左边控件栏js。
  2. //这个控件栏和U.CD.Control.js对应 逻辑到时可以整理到一起
  3. //拖动时鼠标松开执行的函数。
  4. U.CD.L.ConMUp = function (SO, EV) {
  5. var a, _TF = SO.innerHTML, _d = $("#UCD_CT_SM_IF"), _LT = _d.GetElementInfo(), _L = SO.offsetLeft - _LT["BCRL"], _T = SO.offsetTop - _LT["BCRT"];
  6. document.body.removeChild(SO);
  7. if (_L > 0 && _T > 0) {
  8. switch (_TF) {
  9. case "button": a = U.Control.LDB.ButtonDiv(); break;
  10. case "file": a = U.Control.BasicControl.Img(); break;
  11. case "reset": a = U.Control.LDB.Reset(); break;
  12. case "text": a = U.Control.LDB.Text(); break;
  13. case "submit": a = U.Control.LDB.Submit(); break;
  14. case "City": a = U.Control.City.Choose(); break;
  15. case "password": a = U.Control.LDB.password(); break;
  16. case "radio": a = U.Control.LDB.Redio(); break;
  17. case "checkbox": a = U.Control.LDB.Checkbox(); break;
  18. case "form": a = U.CD.C.Form(); break;
  19. case "img": a = U.Control.LDB.img(); break;
  20. case "img": a = U_Control_LDB_img(); break; //img
  21. case "textarea": a = U.CD.C.Textarea(); break; //textarea
  22. case "div": a = U.Control.round.div(); break; //div
  23. case "p": a = U.CD.C.P(); break; //段落
  24. case "h": a = U.CD.C.H(); break; //标题
  25. case "navigation": a = U.CD.C.Navigation(); break; //导航条
  26. case "pagination": a = U.CD.C.Pagination(); break; //分页
  27. case "pagI": a = U.Control.Pag.I.create(5); break; //分页样式1
  28. case "pagII": a = U.Control.Pag.II.create(); break; //分页样式2
  29. case "switchingcard": a = U.CD.C.Switchingcard(); break; //切换卡
  30. case "search": a = U.CD.C.Search(); break;
  31. case "register": a = U.CD.C.Register(); break; //注册
  32. case "shade": a = U.CD.C.ShadeForms(); break;
  33. case "buttongroup": a = U.CD.C.ButtonGrop(); break;
  34. case "bar": a = U.CD.C.Bar(); break;
  35. case "preview": a = U.CD.C.Preview(); break;
  36. case "select": a = U.Control.BasicControl.select(); break;
  37. case "Comfirm": a = U.Control.Confirm('点击确认按钮进行操作,点击返回按钮返回原始页面', 420, 250); break; //Confirm
  38. case "ul": a = U.Control.BasicControl.ul(); break; //无序列表,下面2个不一样哦。
  39. case "ol": a = U.CD.C.Ol(_d, _L, _T); break; //有序列表
  40. case "table": a = U.Control.BasicControl.table(); break; //表格
  41. case "Calculator": a = U.Control.Calcu.PageInitialization(); break; //传入一个ParentNode
  42. case "calendar": a = U.Control.calen.A(); break; //电脑日历
  43. case "Imagelist": a = U.Control.ImL.loadbest(); break; //浏览列表
  44. case "alert": a = U.Control.alert.clearlove(); break; //alert
  45. case "Loading": a = U.Control.Bar.Box(); break; //进度条
  46. case "Map": a = U.Map.Qs({ "city": "深圳市", "width": "1000", "height": "500", "em": $("#UCD_CT_SM_IF"), "add": "深圳市罗湖区人民北路金溪大厦" }); break; //地图
  47. case "Note": a = U.Note.ceateEle(); break; //便签
  48. case "navgation": a = U.Control.Navgation(); break; //导航条
  49. case "ScrImg": a = U.Control.SI.window(); break; //图片浏览器
  50. case "video": a = U.Control.video({ "width": "500", "src": "http://fs.1473.cn/3eda2da7-6eee-45fe-b36f-f4809eddc150.mp4", "pos": $("body") }); break; //视频播放器窗体控件
  51. case "banner_phone": a = U.Control.bp.Z(); break; //手机图片轮播
  52. case "calenm": a = U.Control.calenm.BT(); break; //日历控件手机端
  53. case "Uresponse": a = U.Control.Response.Uresponse(); break; //响应式
  54. case "Lnav": a = U.Control.Lnav.A(); break; //左右侧导航
  55. case "Tree_directory": a = U.Control.td.A(); break; //树目录
  56. case "Watefall_phone": a = U.Control.wafaer.AA(); break; //瀑布式
  57. case "Bulid": a = U.QR.Code.Bulid(); break; //二维码
  58. case "Watefall_phone": a = U.Control.wafaer.AA(); break; //瀑布流
  59. case "Tree_directory": a = U.Control.td.A(); break; //树目录
  60. case "Uresponse": a = U.Control.Response.Uresponse(); break; //响应式
  61. case "RollingLoad": a = U.Rolling.load.Create(); break; //滚动加载
  62. case "colorpicker": a = U.Control.Colorpicker.calen.A(); break; //颜色拾取
  63. case "Upload": a = U.Control.Upload.init(); break; //文件上传
  64. case "tab": a = U.Control.TAB.start(); break; //文件上传
  65. case "圈子功能": a = U.D.Blog.CTPYQ(); return; break; //圈子功能
  66. case "FoldingMenu": a = U.Control.FoldMenu.CreateElement(); break; //折叠菜单
  67. case "聊天功能": a = U.A.Request("UseStudioManage.getUserView", ([""]), function (r) { U.F.W.SLHCK(r.value, true); }); break; //折叠菜单
  68. case "Login": a = U.Control.login.init(); break; //登录
  69. case "registerter": a = U.Control.register.i(); break; //注册
  70. case "forum": a = U.CD.C.forum(); break; //;论坛
  71. }
  72. if (a) { $(a).addClass("UCD_IF_CT"); U.CD.L.AppendIF(a, _d, _L, _T); }
  73. }
  74. }
  75. //元素追加到指定的元素中
  76. U.CD.L.AppendIF = function (_UDOD, _UDPD, _L, _T) {
  77. $(_UDOD).addAttrArray({ "style": { "left": _L + "px", "top": _T + "px"} }); //修改左上角坐标。
  78. U.CD.CD.AppendHTML(_UDOD);
  79. //U.CD.CD.FushIframe($('#UCD_CT_Code_CT')[0]);
  80. _UDPD[0].contentWindow.document.body.appendChild(_UDOD); //此处才是真正的往子iframe中追加节点。然后反馈到页面,凡是从小读取RS.htm就会初始化?
  81. //_UDPD[0].contentWindow.document.body.innerHTML += ""; //执行iframe中的内容,这是bug?
  82. if ($("#U_CD_LO_Window")[0].style.background == "-webkit-linear-gradient(top, rgb(81, 154, 251), rgb(21, 119, 230))") { return; }
  83. if (document.getElementById('UCD_CT_SM_IF').contentWindow.document.body.offsetWidth > 1000) { //屏幕可视范围大小超过1000 判断是PC端 不做缩放
  84. return;
  85. } else { //缩放比例0.6 后面知道比例再按照手机类型改
  86. //console.log(_UDOD.scrollHeight);
  87. //var _W = _UDOD.scrollWidth ,_H = _UDOD.scrollHeight;
  88. _UDOD.style.transformOrigin = "0px 0px ";
  89. _UDOD.style.transform = "scale(0.6)";
  90. /*switch (document.getElementById('UCD_CT_SM_IF').contentWindow.document.body.offsetWidth) {
  91. case 360: //"Galaxy S5" 比例0.26
  92. //_UDOD.style.background = "red";
  93. var _W = _UDOD.scrollWidth * 0.26;
  94. var _H = _UDOD.scrollHeight * 0.26;
  95. _UDOD.style.width = _W + 'px';
  96. _UDOD.style.height = _H + 'px';
  97. break;
  98. case 412: //"Nexus 5X" 比例0.34
  99. break;
  100. case 412: //"Nexus 6P" 比例0.34
  101. break;
  102. case 320: //"iphone 5" 比例0.20
  103. break;
  104. case 375: //"iphone 6" 比例0.28
  105. break;
  106. case 414: //"iphone 6 Plus" 比例0.34
  107. break;
  108. }*/
  109. }
  110. //把iframe中的代码获取出来追加到div中,如何实现?必须先在代码区域打出,否则outerHTML会自动去掉里面的文字。!
  111. //U.CD.CD.DrawCode(_UDPD[0].contentWindow.document.documentElement.outerHTML);//这样做会导致非html元素,例如文字js css 元素中的内容样式发生改变
  112. //在iframe中添加拖动属性,暂时不要此功能!
  113. //$(_UDOD).addAttrArray({ "onclick": U.M.apply(this, [[U.D.iconmove, ([_UDOD, null, { "UP": U.CD.L.IFConMUp}])]]) });
  114. //$(_UDOD).onclick = U.M.apply(this, [[U.D.iconmove, ([_UDOD, null, { "UP": U.CD.L.IFConMUp}])]]);
  115. //$(_UDOD).onclick = function () { alert("123"); }
  116. // $(_UDOD).addAttrArray({ "style": { "left": _L + "px", "top": _T + "px"} }); //修改左上角坐标。
  117. // // _UDPD[0].contentWindow.document.body.appendChild(_UDOD); //此处才是真正的往子iframe中追加节点。然后反馈到页面,凡是从小读取RS.htm就会初始化?
  118. // _UDPD[0].contentWindow.document.body.innerHTML += _UDOD.outerHTML; //执行iframe中的内容
  119. // //_UDPD[0].contentWindow.document.body.appendChild(_UDOD);
  120. // var _a = "", _s = U.CD.CD.SplitHTMLInit(_UDPD[0].contentWindow.document.documentElement.outerHTML.toLowerCase());
  121. // for (var i = 0; i < _s.length; i++) { _a += _s[i] + "\n"; }
  122. // U.CD.Editor.setValue(_a);
  123. }
  124. //#region
  125. // var _AD = $("*", _UDPD[0].contentWindow.document.body);
  126. // for (var i = 0; i < _AD.length; i++) { //设置
  127. // if (_AD[i].tagName == "") { //判断所有的块元素
  128. // if (_AD[i].offsetLeft <= _L && _AD[i].offsetTop <= _T && _AD[i].offsetLeft + _AD[i].offsetWidth >= _L && _AD[i].offsetTop + _AD[i].offsetHeight >= _L) { }
  129. // }
  130. // }
  131. //#enregion
  132. //创建拖动对象
  133. U.CD.L.moudt = function (TF) {
  134. var m = U.M.GetMousep();
  135. var a = $$("div", { "className": "UCD_TOOLT_Drag", "style": { "top": m["Y"] + "px", "left": m["X"] + "px" }, "innerHTML": TF }, document.body);
  136. U.D.iconmove(a, { "UP": function () { U.CD.L.ConMUp(a, this.E); } });
  137. }
  138. //设置元素可拖动
  139. //拖动元素区域 获取指定的
  140. U.CD.L.settd = function () {
  141. var a = window.frames["UCD_CT_SM_IF"].event.srcElement;
  142. while (a.parentNode != window.frames["UCD_CT_SM_IF"].document.body) { a = a.parentNode; }
  143. window.frames["UCD_CT_SM_IF"].U.D.iconmove(a);
  144. }
  145. //打开或者关闭控件列表
  146. U.CD.L.OpenOrCloseList = function (SO) {
  147. SO.style.display = SO.style.display == "none" ? "block" : "none";
  148. }
  149. //自定义租金帮助,以后还可以再次封装小窗体,大窗体等,让代码更少
  150. U.CD.L.ZZHelp = function () {
  151. U.UF.EV.stopBubble();
  152. var s = "使用云端组件必须在Head中引用云端样式。</br>http://d.1473.cn/UJ.css</br>";
  153. //
  154. U.UF.UI.SUForms(document.body, "错误帮助窗口", "UCD_L_HelpWin", s, "color:red;", 300, 200);
  155. }