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