123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911 |
- //#region office 公有工具栏
- /*
- 问题
- word,Excel,PPT等的共用工具栏。有些需要移动到U.UI的扩展库里面去。
- 1、 工具的的功能流程图
- 2、 工具的初始化流程图
- */
- Namespace.register("U.OU");
- //["Calibri (西文正文)", "宋体", "黑体", "隶书", "幼圆", "楷体", "Arial", "仿宋体", 0],
- //例子:
- U.OU.WF = {}; //记录所有分页可编辑区域的光标。每页一个可编辑区域,每页一个光标,则有多个,所以用数组。
- U.OU.TF = {
- IsO: false,
- "UME": [[//字体选择区域
- "仿宋",
- "黑体",
- "华文楷体",
- "华文新魏",
- "华文行楷",
- "楷体",
- "隶书",
- "宋体",
- "宋体-ExtB",
- "微软雅黑",
- "微软雅黑",
- "Angsana New",
- "Arial",
- "Arial Black",
- "Batang",
- "Book Antiqua",
- "Bookman Old Style",
- "Browallia New",
- "Calibri",
- "Calibri Light",
- "Cambria",
- "Candara",
- "Century",
- "Century Gothic",
- "Century Schoolbook",
- "Comic Sans MS",
- "Consolas",
- "Constantia",
- "Corbel",
- "Cordia New",
- "Courier New",
- "DaunPenh",
- "DilleniaUPC",
- "Dotum",
- "Franklin Gothic Book",
- "Franklin Gothic Medium",
- "Garamond",
- "Gautami",
- "Georgia",
- "Gill Sans MT",
- "Gulim",
- "GungSuh",
- "Iskoola Pota",
- "JasmineUPC",
- "alinga",
- "Kartika",
- "Latha",
- "Lucida Sans",
- "Lucida Sans Unicode",
- "Malgun Gothic",
- "Mangal",
- "Meiryo",
- "Microsoft JhengHei",
- "MingLiU",
- "MingLiU_HKSCS",
- "MS Gothic",
- "MS Mincho",
- "MS PGothic",
- "MS PMincho",
- "Nyala",
- "PMingLiU",
- "PMingLiU-ExtB",
- "Raavi",
- "Rockwell",
- "Segoe UI Light",
- "Shruti",
- "Sylfaen",
- "Tahoma",
- "Times",
- "Times New Roman",
- "Trebuchet MS",
- "Tunga", "TW Cen MT",
- "Verdana",
- "Vrinda"
- ],
- [ //字号选择区域
- ["初号", "44pt", "58.6"],
- ["小初", "36pt", "48"],
- ["一号", "26pt", "34.6"],
- ["小一", "24pt", "32"],
- ["二号", "22pt", "29.3"],
- ["小二", "18pt", "24"],
- ["三号", "16pt", "21.3"],
- ["小三", "15pt", "20"],
- ["四号", "14pt", "18.6"],
- ["小四", "12pt", "16"],
- ["五号", "10.5pt", "14"],
- ["小五", "9pt", "12"],
- ["六号", "7.5pt", "10"],
- ["小六", "6.5pt", "8.6"],
- ["七号", "5.5pt", "7.3"],
- ["八号", "5pt", "6.6"]
- ],
- [ //字体颜色区域
- "#ffffff",
- "#ffccc9",
- "#ffce93",
- "#fffc9e",
- "#ffffc7",
- "#9aff99",
- "#96fffb",
- "#cdffff",
- "#cbcefb",
- "#cfcfcf",
- "#fd6864",
- "#fe996b",
- "#fffe65",
- "#fcff2f",
- "#67fd9a",
- "#38fff8",
- "#68fdff",
- "#9698ed",
- "#c0c0c0",
- "#fe0000",
- "#f8a102",
- "#ffcc67",
- "#f8ff00",
- "#34ff34",
- "#68cbd0",
- "#34cdf9",
- "#6665cd",
- "#9b9b9b",
- "#cb0000",
- "#f56b00",
- "#ffcb2f",
- "#ffc702",
- "#32cb00",
- "#00d2cb",
- "#3166ff",
- "#6434fc",
- "#656565",
- "#9a0000",
- "#ce6301",
- "#cd9934",
- "#999903",
- "#009901",
- "#329a9d",
- "#3531ff",
- "#6200c9",
- "#343434",
- "#680100",
- "#963400",
- "#986536",
- "#646809",
- "#036400",
- "#34696d",
- "#00009b",
- "#303498",
- "#000000",
- "#330001",
- "#643403",
- "#663234",
- "#343300",
- "#013300",
- "#003532",
- "#010066",
- "#340096"]
- ],
- "UV": "", "TF": "Excel", "UAE": [], "D": true, "FTF": false
- } //变量使用区域
- //#region 初始化工具
- //初始化工具
- /**
- * 功能创建
- *
- * @param {string} 使用的类型
- * @param {object} 文档信息数组 或 null
- * @return {object} 头部信息和顶部工具栏的整体元素
- */
- U.OU.Onload = function (UTF, UDE) {
- //var i, //循环初始化
- //_UCE = ["Word", "WordL"]; //初始化需要用到的字符串
- U.OU.CreatTool(UDE); //创建工具
- //设置前进后退
- //for (i = 0; i < _UCE.length; i++) {
- // U.AFB.RGoL(_UCE[i]);
- //}
- }
- //创建4个菜单,包括字体,字号,背景色,前景色。
- U.OU.CreatTool = function (UDE, UIE) {
- var i, j, k, _UDOD, _UL, _UDMD, _UKE,
- _UCE = U.OU.TF.UME; //获取字体 字号 字体颜色数组
- for (i = 0; i < UDE.length; i++) { //循环设置
- _UKE = _UCE[i >= _UCE.length ? _UCE.length - 1 : i];
- _UL = _UKE.length
- _UDMD = null;
- if (i < 2 && UDE[i].options) {
- UDE[i].options.length = _UL;
- }
- else {
- _UDMD = $$("frag");
- }
- for (j = 0; j < _UL; j++) {
- if (i < 2) { //字体工具
- if (UDE[i].options) { //判断是否为select标签
- (_UDOD = UDE[i].options[j]).value = U.Ut.isArray(_UKE[j]) ? _UKE[j][1] : _UKE[j];
- _UDOD.text = U.Ut.isArray(_UKE[j]) ? _UKE[j][0] : _UKE[j];
- }
- else {
- $$("div", { "unselectable": "on", "innerHTML": _UKE[j], "onmousedown": U.M.StopBubble, "style": { "fontFamily": _UKE[j] } }, _UDMD);
- }
- }
- else { //颜色工具
- $$("div", { "unselectable": "on", "style": { "backgroundColor": _UKE[j] } }, _UDMD);
- }
- }
- if (_UDMD) { UDE[i].appendChild(_UDMD); }
- }
- }
- //创建字体 传入的el必须是select标签元素
- U.OU.CreateFont = function (el) {
- var fontarea = [//字体选择
- "仿宋",
- "黑体",
- "华文楷体",
- "华文新魏",
- "华文行楷",
- "楷体",
- "隶书",
- "宋体",
- "宋体-ExtB",
- "微软雅黑",
- "微软雅黑",
- "Angsana New",
- "Arial",
- "Arial Black",
- "Batang",
- "Book Antiqua",
- "Bookman Old Style",
- "Browallia New",
- "Calibri",
- "Calibri Light",
- "Cambria",
- "Candara",
- "Century",
- "Century Gothic",
- "Century Schoolbook",
- "Comic Sans MS",
- "Consolas",
- "Constantia",
- "Corbel",
- "Cordia New",
- "Courier New",
- "DaunPenh",
- "DilleniaUPC",
- "Dotum",
- "Franklin Gothic Book",
- "Franklin Gothic Medium",
- "Garamond",
- "Gautami",
- "Georgia",
- "Gill Sans MT",
- "Gulim",
- "GungSuh",
- "Iskoola Pota",
- "JasmineUPC",
- "alinga",
- "Kartika",
- "Latha",
- "Lucida Sans",
- "Lucida Sans Unicode",
- "Malgun Gothic",
- "Mangal",
- "Meiryo",
- "Microsoft JhengHei",
- "MingLiU",
- "MingLiU_HKSCS",
- "MS Gothic",
- "MS Mincho",
- "MS PGothic",
- "MS PMincho",
- "Nyala",
- "PMingLiU",
- "PMingLiU-ExtB",
- "Raavi",
- "Rockwell",
- "Segoe UI Light",
- "Shruti",
- "Sylfaen",
- "Tahoma",
- "Times",
- "Times New Roman",
- "Trebuchet MS",
- "Tunga", "TW Cen MT",
- "Verdana",
- "Vrinda"
- ]; //字体字号背景色的数组变量
- el.options.length = fontarea.length; //创建下拉框 length相当于创建了和该长度相等的下拉框
- //循环创建每个字体
- for (var i = 0; i < fontarea.length; i++) {
- el.options[i].value = fontarea[i];
- el.options[i].text = fontarea[i];
- }
- }
- //创建字号 传入的el必须是select标签元素
- U.OU.CreateWordSize = function (el) {
- var _sizearea = [ //字号选择区域
- ["初号", "44pt", "58.6"],
- ["小初", "36pt", "48"],
- ["一号", "26pt", "34.6"],
- ["小一", "24pt", "32"],
- ["二号", "22pt", "29.3"],
- ["小二", "18pt", "24"],
- ["三号", "16pt", "21.3"],
- ["小三", "15pt", "20"],
- ["四号", "14pt", "18.6"],
- ["小四", "12pt", "16"],
- ["五号", "10.5pt", "14"],
- ["小五", "9pt", "12"],
- ["六号", "7.5pt", "10"],
- ["小六", "6.5pt", "8.6"],
- ["七号", "5.5pt", "7.3"],
- ["八号", "5pt", "6.6"]
- ];
- el.options.length = _sizearea.length; //创建下拉框 length相当于创建了和该长度相等的下拉框
- //循环创建每个字号
- for (var i = 0; i < _sizearea.length; i++) {
- el.options[i].value = _sizearea[i][1]; //options的值等于字体的大小 如44pt、36pt
- el.options[i].text = _sizearea[i][0]; //options的输入描述等于字体的描述 如初号 、小四等等
- }
- }
- //创建背景或者字体颜色选择控件
- U.OU.ColorSelect = function (el) {
- var _colorarea = [ //字体颜色区域
- "#ffffff",
- "#ffccc9",
- "#ffce93",
- "#fffc9e",
- "#ffffc7",
- "#9aff99",
- "#96fffb",
- "#cdffff",
- "#cbcefb",
- "#cfcfcf",
- "#fd6864",
- "#fe996b",
- "#fffe65",
- "#fcff2f",
- "#67fd9a",
- "#38fff8",
- "#68fdff",
- "#9698ed",
- "#c0c0c0",
- "#fe0000",
- "#f8a102",
- "#ffcc67",
- "#f8ff00",
- "#34ff34",
- "#68cbd0",
- "#34cdf9",
- "#6665cd",
- "#9b9b9b",
- "#cb0000",
- "#f56b00",
- "#ffcb2f",
- "#ffc702",
- "#32cb00",
- "#00d2cb",
- "#3166ff",
- "#6434fc",
- "#656565",
- "#9a0000",
- "#ce6301",
- "#cd9934",
- "#999903",
- "#009901",
- "#329a9d",
- "#3531ff",
- "#6200c9",
- "#343434",
- "#680100",
- "#963400",
- "#986536",
- "#646809",
- "#036400",
- "#34696d",
- "#00009b",
- "#303498",
- "#000000",
- "#330001",
- "#643403",
- "#663234",
- "#343300",
- "#013300",
- "#003532",
- "#010066",
- "#340096"];
- var _frag = $$("frag");
- //循环创建背景颜色
- for (var i = 0; i < _colorarea.length; i++) {
- $$("div", { "unselectable": "on", "style": { "backgroundColor": _colorarea[i] } }, _frag);
- }
- el.appendChild(_frag);
- }
- //工具的查看和隐藏
- U.OU.ToolOC = function (UDOD, UTF) {
- //UTF
- //UDOD
- var i, //循环初始化
- _UDCD, //变量初始化
- _UDAD = $(UDOD).Child(), //获取子级
- _UDKD = UTF ? _UDAD : $(UDOD).parentg().Child();
- for (i = 0; i < _UDKD.length; i++) {
- _UDCD = $(_UDKD[i]).Child(); //获取子级元素
- _UDCD = _UDCD[_UDKD[i].innerText ? 2 : 1];
- (_UDCD && _UDCD != _UDAD[_UDAD.length - 1]) && (_UDCD.style.display = "none");
- }
- if (!UTF) {
- _UDCD = _UDAD[_UDAD.length - 1];
- _UDCD.style.display = _UDCD.style.display == "block" ? "none" : "block";
- }
- }
- //#endregion
- //#region 焦点处理,//初始化焦点使用,只是聚焦作用,还没插入光标,这里还需要继续整理
- U.OU.WordFocus = function (UDOD, UST, UAF) {
- //U.OU.WF不是全局变量,会有问题。
- var _UGE = U.OU.WF[UDOD.id]; //word默认焦点
- U.OU.R = _UGE = U.OU.WF[UDOD.id] = _UGE ? (_UGE.SO = UDOD, _UGE.CreateR()) : ((UDOD || _UGE.PSO).focus(), U.D.E.GetSelectionRange(window, UDOD, { "TF": UDOD.id, "CB": UAF })); //光标初始化创建
- if (UST !== false) {
- _UGE.Replace(UST, _UGE.R, true);
- }
- return _UGE;
- }
- //初始化焦点使用
- U.OU.SCJD = function (UDOD, UST, UAF) {
- var _UGE = U.OU.R;
- _UGE = U.OU.R = _UGE ? (_UGE.SO = UDOD, _UGE.CreateR(false)) : ((UDOD || _UGE.PSO).focus(), U.D.E.GetSelectionRange(window, UDOD, { "TF": UAF ? "E" : "W", "CB": UAF })); //光标初始化创建
- _UGE.Replace(UST, _UGE.R, true);
- return _UGE; //焦点
- }
- //释放焦点时候保存焦点
- U.OU.JDCL = function (UTF) {
- if (UTF !== false) { U.OU.TF.IsO = true; }
- try {
- (U.OU.R) && (U.OU.R = U.OU.R.CreateR(), U.OU.TF["FTF"] = false);
- }
- catch (e) { }
- }
- //焦点聚焦回去
- U.OU.JDCR = function () {
- if (U.OU.TF.IsO) {//焦点到指定的位置
- U.OU.TF.IsO = false;
- var _UGE = U.OU.R;
- window.focus(); //获取焦点
- if (_UGE) {
- if (!_UGE.GetSelectedHtml()) {
- _UGE.Replace("");
- } else {
- _UGE.QX();
- }
- }
- }
- }
- //#endregion
- //#region 网盘处理
- //从网盘选择图片或者连接
- U.OU.OUIG = function (UDID, UTF, UDOD, UR) {
- //UDID
- //UTF
- //UDOD
- //UR
- var i, //循环初始化
- _UDTD, //变量初始化
- _UDSD, //变量初始化
- _UTP, //变量初始化
- _UDFD = $$("frag"), //创建frag元素
- _UDE = (US.Disk.UserDisk) ? (_$(US.Disk.UserDisk[0]).Select({ "UserDirectoryParentID": UDID })) : "";
- U.OU.R = U.D.E.GetSelectionRange(window, $(".U_Boom_CO_Editor_body_main_text")[0], { "TF": "MW", "CB": null });
- if (UDOD) {
- UDOD.innerText = "";
- for (i = 0; i < _UDE.length; i++) {
- _UTP = parent.U.UP.IsImg(_UDE[i].UserDirectoryExtendType); //类型
- _UDTD = $$("div", { "className": "UDK_RT_application", "onmousedown": [[U.OU.AImgCL, [UR || U.OU.R]]], "onclick": [[U.OU.OUALJ, [UR || U.OU.R, UTF, _UDE[i], UDOD]]] }, _UDFD);
- _UDSD = $$("div", { "className": "UD_SYSXZLRSITOT" }, _UDTD); //创建div
- if (_UTP) { $$("img", { "src": _UDE[i].UserDirectoryUrl, "onerror": [[U.M.ImgError, ["this", 1]]] }, _UDSD); }
- else { $(_UDSD).addAttrArray({ "style": { "cssText": top.U.UP.FFT(_UDE[i].UserDirectoryExtendType)[1] + ";" }, "className": "UDK_L_DiskGE " + _UDSD.className }); }
- $$("span", { "className": "UTDF", "innerHTML": _UDE[i].UserDirectoryName }, _UDTD);
- }
- UDOD.appendChild(_UDFD);
- }
- }
- //选择使用图片或者链接
- U.OU.OUALJ = function (UDR, UTF, UDE, URL, USN, UDOD, UDPD) {
- //UDR
- //UTF
- //UDE
- //UDPD
- if (UDE.filetype || U.Ut.isString(UDE)) {
- var _UDOD, //变量初始化
- _UDTD, //变量初始化
- _UDSD, //变量初始化
- _UDMD, //变量初始化
- _UTH, //变量初始化
- _USN; //变量初始化
- U.M.StopBubble();
- UDR = UDR || U.OU.R; //取消冒泡
- if (!UDR) { U.Alert("请选择编辑区!"); }
- else {
- switch (UTF) {
- case "img":
- if (U.UP.IsImg(_USN = UDE.UserFilesServerName || (U.Ut.isString(UDPD) ? UDPD : UDE))) {
- _UTH = "<img style='max-width:715px;;width:100%;height:100%;' alt='" + (UDE.Descript || UDE.UserallDirectoryName || "") + "' src='" + (U.M.GetImgU(UDE.UserFilesServerName || (U.Ut.isString(UDPD) ? UDPD : UDE))) + "' onmouseup = 'U.OU.UpdateImg();' onDblClick = 'U.OU.BlurImg(this);' /> "
- //_UTH = "<div style='max-width:100%;width:100%;height:100%;' alt='" + (UDE.Descript || UDE.UserallDirectoryName || "") + "' background ='url(" + (U.M.GetImgU(UDE.UserFilesServerName || (U.Ut.isString(UDPD) ? UDPD : UDE))) + "' onmouseup = 'U.OU.UpdateImg();' onblur = 'U.OU.BlurImg();'></div>"
- } //图片区域
- else {//普通附件区域
- _UDOD = $$("div", { contenteditable: "false", style: { "cssText": "width:260px; height:70px; background-color:#DDD; display: inline-block; *display:inline; *zoom:1;text-decoration: none; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; text-indent:0" } });
- _UDTD = $$("div", { className: "UD_SYID", "style": { "cssText": "margin:10px 0 0 10px; width:40px; height:50px; margin:15px 0 0 10px; float:left; background-position:-261px -22px" } }, _UDOD);
- $$("div", { style: { cssText: "font-size:15px; width:40px; margin:auto; font-family:'微软雅黑'; text-align:center; color:#888; position:relative; top:16px; height:20px; overflow:hidden;" }, innerHTML: U.UP.GetUpName(_USN)[1] }, _UDTD);
- _UDTD = $$("div", { style: { "cssText": "width:195px; height:100%; margin-left:10px; float:left;" } }, _UDOD);
- _UDSD = $$("div", { style: { "cssText": "width:200px; height:35px; line-height:35px;" } }, _UDTD);
- _UDMD = $$("div", { innerHTML: "文档 容量大小 " }, _UDSD); $$("span", { innerHTML: U.UP.FileSize(arguments[5].UserDirectorySize), style: { cssText: "color:#006699;" } }, _UDMD);
- _UDSD = $$("div", { style: { "cssText": "width:200px; height:35px; line-height:35px;" } }, _UDTD);
- _UDMD = $$("div", { style: { "cssText": "float:left; width:35px; height:35px;" } }, _UDSD); $$("img", { style: { "cssText": "width:30px; height:30px;" }, src: U.M.GetImgU(US.userInfo.UserThumbnailImageHead) }, _UDMD);
- $$("div", { style: { "cssText": "float:left;padding:0 8px;max-width:50px;" }, innerHTML: US.userInfo.username }, _UDSD); $$("a", { innerHTML: "点击下载", href: "/userpages/UD_XZ.htm?id=" + UDE.UserFilesID + "&type=file", target: "_blank" }, _UDSD);
- $("*", _UDOD).addAttrArray({ contenteditable: "false" }); _UTH = "  " + _UDOD.outerHTML + "  ";
- }
- (U.M.apply(UDR, [[U.OU.R.CreateR], [U.OU.SDYC], [UDR.Replace, [_UTH, null, true]]]))(); //U.OU.R.CreateR获取光标
- break; //插入图片
- case "LJ": U.OU.OULJ(UDR, "http://disk.1473.cn?ID=" + UDE["UserDirectoryID"], UDE); break; //文字生成连接
- }
- }
- }
- else {
- U.AFB.AddEvent([[U.OU.OUIG, [UDE.UserDirectoryID, UTF, UDPD, UDR]]], UTF == "img" ? "Word" : "WordL");
- U.OU.JDCR();
- } //文件夹执行
- }
- //添加图片处理
- U.OU.AImgCL = function (UDR) {
- if (U.OU.TF["TF"] == "Excel") {
- var _UDFD = $("div", (U.Excel.SY["UAE"]["FE"] || $("#U_E_EditFrame")[0]))[0]; //获取div
- if (_UDFD.contentEditable != "true" || U.OU.R.SO !== _UDFD) {
- U.Excel.EditFrameDoubleClick((U.Excel.SY["UAE"]["FE"] || $("#U_E_EditFrame")[0])); //添加双击可编辑事件
- U.OU.R = U.D.E.GetSelectionRange(window, _UDFD, { "TF": "E" }); //初始化编辑区域
- }
- }
- else if (UDR || U.OU.R) { (UDR || U.OU.R).CreateR(); }
- U.OU.TF.D = true;
- }
- //修改插入图片的大小
- U.OU.CIDX = function (UIMG) {
- UIMG.style.maxWidth = "480px";
- }
- //图片本地上传
- U.OU.IploadImg = function (UDD) {
- U.UP.uploading([UDD],
- function (r) {
- var w = $(r.UpObj[0]).Parent(4).nextElementSibling.children[0].contentWindow; //获取当前操作层
- //var _UDDIV = $$("div", { "style": { "position": "absolute"} });
- //var _UDTD = $$("img", { "id": r.value[2], "style": { "min-width": "100%", "width": "auto", "height": "auto" }, "onmouseup": [[U.OU.UpdateImg]], "onDblClick": [[U.OU.BlurImg]], "src": "http://fs.1473.cn/" + r.value[0] }, _UDDIV); //, document.getElementById("67dc7ef0-8499-2985-fd1f-60edb7734b7bK").contentwindow.document.getElementsByClassName("U_Boom_CO_Editor_body_main_text")[0]
- var _UDTD = "<img id = '" + r.value[2] + "' style='max-width:715px;width:100%;height:100%;' src = 'http://fs.1473.cn/" + r.value[0] + "' onmouseup = 'U.OU.UpdateImg();' onDblClick = 'U.OU.BlurImg(this);' / >"//新建创建的img图像
- U.OU.R = U.D.E.GetSelectionRange(w, $(".U_Boom_CO_Editor_body_main_text")[0], { "TF": "MW", "CB": null }); //获取光标的位置
- (U.M.apply(U.OU.R, [[U.OU.R.CreateR], [U.OU.SDYC], [U.OU.R.Replace, [_UDTD, null, true]]]))(); //插入图片
- U.Alert("上传成功");
- }, [], "http://disk.1473.cn/USupfile.ashx?iframename=UseStudioEditor");
- }
- //修改图片大小
- U.OU.UpdateImg = function () {
- //var Imgbox = event.srcElement.parentElement; //获取图片上级元素
- // Imgbox.style.position = "absolute";
- if (!$(".Imgbox_R_Border")[0]) {//判断是否存在图片四周拉伸的框
- var sel = event.srcElement; //获取图片
- var _sel = sel.cloneNode(true);
- var Imgbox = $$("div", { "style": { "position": "relative" } });
- Imgbox.appendChild(_sel);
- sel.parentNode.replaceChild(Imgbox, sel); //在点击元素添加父级元素
- //创建四边
- $$("span", { "class": "Imgbox_R_Border", "style": { "position": "absolute", "right": "0", "top": "0", "z-index": "1", "background": "#666", "width": "2px", "height": "100%", "cursor": "col-resize" } }, Imgbox);
- $$("span", { "class": "Imgbox_L_Border", "style": { "position": "absolute", "left": "0", "top": "0", "z-index": "1", "background": "#666", "width": "2px", "height": "100%", "cursor": "col-resize" } }, Imgbox);
- $$("span", { "class": "Imgbox_T_Border", "style": { "position": "absolute", "top": "0", "left": "0", "z-index": "1", "background": "#666", "width": "100%", "height": "2px", "cursor": "col-resize" } }, Imgbox);
- $$("span", { "class": "Imgbox_B_Border", "style": { "position": "absolute", "bottom": "0", "left": "0", "z-index": "1", "background": "#666", "width": "100%", "height": "2px", "cursor": "col-resize" } }, Imgbox);
- //创建四角
- $$("span", { "class": "Imgbox_BR_Bugle", "style": { "position": "absolute", "right": "-5px", "bottom": "-5px", "width": "5px", "height": "5px", "z-index": "2", "border-radius": "50%", "border": "2px solid #ccc", "cursor": "nwse-resize" } }, Imgbox);
- $$("span", { "class": "Imgbox_BL_Bugle", "style": { "position": "absolute", "left": "-5px", "bottom": "-5px", "width": "5px", "height": "5px", "z-index": "2", "border-radius": "50%", "border": "2px solid #ccc", "cursor": "nwse-resize", "cursor": "nesw-resize" } }, Imgbox);
- $$("span", { "class": "Imgbox_TR_Bugle", "style": { "position": "absolute", "right": "-5px", "top": "-5px", "width": "5px", "height": "5px", "z-index": "2", "border-radius": "50%", "border": "2px solid #ccc", "cursor": "nwse-resize", "cursor": "nesw-resize" } }, Imgbox);
- $$("span", { "class": "Imgbox_TL_Bugle", "style": { "position": "absolute", "left": "-5px", "top": "-5px", "width": "5px", "height": "5px", "z-index": "2", "border-radius": "50%", "border": "2px solid #ccc", "cursor": "nwse-resize" } }, Imgbox);
- }
- var Imgspan = Imgbox.getElementsByTagName("span"); //获取每个边框的元素
- for (var i = 0; i < Imgspan.length; i++) {
- U.OU.DragFn(Imgspan[i], Imgbox); //执行点击事件 Imgspan是边框元素。Imgbox是图片上级元素
- }
- }
- U.OU.DragFn = function (obj, Imgbox) {
- obj.onmousedown = function (ev) {
- var oEv = ev || event; //获取当前window操作层
- var oldWidth = Imgbox.offsetWidth; //获取图片的宽度
- var oldHeight = Imgbox.offsetHeight; //获取图片的高度
- var oldX = oEv.clientX; //获取鼠标的X坐标
- var oldY = oEv.clientY; //获取鼠标的Y坐标
- $("#UD_SYQXR")[0].onmousemove = function (ev) {//鼠标移入事件
- var oEv = ev || event;
- if (obj.className == 'Imgbox_TL_Bugle') {//拖动左上角执行函数
- Imgbox.style.width = oldWidth - (oEv.clientX - oldX) + 'px';
- Imgbox.style.height = oldHeight - (oEv.clientY - oldY) + 'px';
- } else if (obj.className == 'Imgbox_BL_Bugle') {//拖动左下角执行函数
- Imgbox.style.width = oldWidth - (oEv.clientX - oldX) + 'px';
- Imgbox.style.height = oldHeight + (oEv.clientY - oldY) + 'px';
- } else if (obj.className == 'Imgbox_TR_Bugle') {//拖动右上角执行函数
- Imgbox.style.width = oldWidth + (oEv.clientX - oldX) + 'px';
- Imgbox.style.height = oldHeight - (oEv.clientY - oldY) + 'px';
- } else if (obj.className == 'Imgbox_BR_Bugle') {//拖动右下角执行函数
- Imgbox.style.width = oldWidth + (oEv.clientX - oldX) + 'px';
- Imgbox.style.height = oldHeight + (oEv.clientY - oldY) + 'px';
- } else if (obj.className == 'Imgbox_T_Border') {//拖动上边框执行函数
- Imgbox.style.height = oldHeight - (oEv.clientY - oldY) + 'px';
- } else if (obj.className == 'Imgbox_B_Border') {//拖动下边框执行函数
- Imgbox.style.height = oldHeight + (oEv.clientY - oldY) + 'px';
- } else if (obj.className == 'Imgbox_L_Border') {//拖动左边框执行函数
- Imgbox.style.height = oldHeight + 'px';
- Imgbox.style.width = oldWidth - (oEv.clientX - oldX) + 'px';
- } else if (obj.className == 'Imgbox_R_Border') {//拖动有边框执行函数
- Imgbox.style.height = oldHeight + 'px';
- Imgbox.style.width = oldWidth + (oEv.clientX - oldX) + 'px';
- }
- }
- $("#UD_SYQXR")[0].onmouseup = function () {
- $("#UD_SYQXR")[0].onmousemove = null;
- }
- return false;
- }
- }
- //取消边框
- U.OU.BlurImg = function (blurimg) {
- //blurimg.parentNode.parentNode.remove(blurimg.parentNode);
- $(".Imgbox_R_Border")[0].remove();
- $(".Imgbox_L_Border")[0].remove();
- $(".Imgbox_T_Border")[0].remove();
- $(".Imgbox_B_Border")[0].remove();
- $(".Imgbox_BR_Bugle")[0].remove();
- $(".Imgbox_BL_Bugle")[0].remove();
- $(".Imgbox_TR_Bugle")[0].remove();
- $(".Imgbox_TL_Bugle")[0].remove();
- }
- //#endregion
- //#region 链接处理 在word中给文字添加链接。
- //添加链接处理
- U.OU.AddUrl = function (UCB) {
- var _UDOD = $$("div", { "className": "UD_SYQZOCCL UD_SYQZOCCLV" }),
- _UDTD = $$("div", { "className": "UD_SYQZOCCLB" }, _UDOD),
- _UDSD = $$("div", { "className": "UD_SYQZOCCLBO" }, _UDTD),
- _UDID = $$("input", { "spellcheck": "false", "className": "UD_SYQZOCCLBO", "value": "http://" }, _UDSD);
- U.OU.R = U.D.E.GetSelectionRange(window, $(".U_Boom_CO_Editor_body_main_text")[0], { "TF": "MW", "CB": null });
- $$("div", { "className": "UD_SYQZI UD_SYQZC UD_SYI", "title": "云盘添加", "onclick": [[parent.U.Dk.VW.CCWPXZK, [US.NU, { isClose: true, onclick: U.M.apply(null, [[U.OU.AddUrlByDisk, [_UDID]]]) }]]], "unselectable": "on", "style": { "height": "28px", "margin": "5px 0 0 4px" } }, _UDTD);
- $$("div", { "className": "UD_SYQZOCCLB_N", "innerHTML": "云盘添加", "onclick": [[parent.U.Dk.VW.CCWPXZK, [US.NU, { isClose: true, onclick: U.M.apply(null, [[U.OU.AddUrlByDisk, [_UDID]]]) }]]] }, _UDOD);
- parent.U.UI.Confirm("选择添加链接的方式", { "width": "490px", "height": "225px" }, null, U.M.apply(null, [!UCB ? [UCB, [_UDID]] : [U.OU.OULJ, [U.OU.R, _UDID, null]]]), _UDOD, true);
- }
- //通过网盘添加方式
- U.OU.AddUrlByDisk = function (UDOD, UDE, URL) {
- //导航添加链接。
- UDID = UDE.UserDirectoryID || U.Word.TF.ID
- UDOD.value = "http://disk.1473.cn/?ID=" + UDID;
- }
- //添加外链选择的变化
- U.OU.OULJ = function (UDR, URL, UDE, UTH) {
- var _UST = UDR.GetSelectedHtml(); //获取选择的内容
- (!U.Ut.isString(URL)) && (URL = URL.value);
- if (_UST && U.M.IsUrl(URL)) { //添加添加外链
- UDR.Replace("<a href='" + URL + "' style='color:#3B639F;text-decoration:none;' target='_blank' title='" + (UDE ? (UDE.Descript || UDE.UserallDirectoryName) : "") + "'>" + (U.OU.R.innerHTML || _UST) + "</a>");
- U.OU.R.innerHTML = null;
- }
- else { //没有选择文字
- parent.U.Alert(_UST ? "请输入正确的链接" : "请选择链接文字");
- return _UST ? true : false;
- }
- }
- //外连接添加变化
- U.OU.OUWLJ = function (UDOD, UTF) {
- var _URL, _UDTD, _UDAD, _UTH, //获取url
- _UTF = false, //初始化boolean值
- _UGE = UTF == "S" ? U.OU.R.CreateR() : U.OU.R;
- if (_UGE) {
- _UDTD = _UGE.Parent(); //获取父级
- _UTH = _UGE.GetSelectedHtml(); //获取选择的对象
- _UDAD = UDOD ? $("input", UDOD.parentNode) : null; //获取input对象
- if (UTF == "S") { //选择元素选区
- if (_UTH || _UDTD.tagName == "img") {
- U.OU.R.innerHTML = _UTH;
- _UGE.Replace($$("span", { "innerHTML": _UTH, "style": { "color": "#FFF", "backgroundColor": "#338fff" } }), null); //添加属性
- }
- }
- else if (UTF == "E") { //生成链接
- if (U.M.IsUrl((_URL = _UDAD[0].value))) {
- _UDAD[0].value = "http://";
- $(_UDTD).replaceC($$("a", {
- "href": _URL, "style": { "color": "#3B639F", "textDecoration": "none" },
- "title": _UDTD.innerText, "innerHTML": _UDTD.innerHTML
- }));
- }
- else { U.Alert("无效连接地址"); }
- }
- else if (U.OU.R.innerHTML) {//移除选择
- _UGE.Replace(U.OU.R.innerHTML);
- U.OU.R.innerHTML = null;
- }
- U.OU.SDYC(null, _UTF);
- }
- }
- //点击内容可编辑或者选择链接网站
- U.OU.DJBJ = function (TF, UEL) {
- //TF boolean
- //UEL
- if (TF) {
- parent.U.Alert("请在左边的文件中选择文件链接", 2000);
- UEL = UEL.parentNode; //获取父级元素
- var _TID = UEL.getAttribute("ITF"); //获取属性ITF
- UEL = $("div@ITF=" + _TID, UEL.parentNode.parentNode)[0];
- UEL.focus(); //获取焦点
- U.OU.R.SO = UEL; //获取选择的文字
- U.OU.R.CreateR(false);
- } //$('div', UEL)[0].focus();
- else {
- UEL = UEL.parentNode; //获取父级元素
- UEL.contentEditable = "true"; //改变属性成可编辑
- UEL.innerHTML = " "; //改变innerHTML成空格
- U.OU.R.SO = UEL; //获取选择的文字
- U.OU.R.Replace("<div></div>", U.OU.R.QX(0, 1, UEL));
- } //变成可编辑
- }
- //#endregion
- //#region 样式工具
- //颜色攻击点击变化
- U.OU.ColorLiOnClick = function (UDOD, UDE) {
- //UDOD
- //UDE
- var i, //循环初始化
- _UBC = UDOD.style.backgroundColor; //颜色值
- for (i in UDE[1]) {
- UDE[1][i] = _UBC;
- } //颜色变化
- U.OU.ChangeStyle(UDE[1]); //修改编辑区的颜色
- }
- //设置样式
- U.OU.ChangeStyle = function (UDE) {
- //UDE
- var _UKE, //初始化变量
- _UDTD, //初始化变量
- _UTF = U.OU.TF["TF"] == "Excel"; //获取Excel对象
- if (!_UTF && (U.Excel.SY["UAE"]["FE"] || $("#U_E_EditFrame")[0]).ondblclick) {//Excel修改样式
- _UKE = U.Excel.SY; //Excel对象
- _UDTD = _UKE["SEO"][0]; //获取Excel对象的SEO属性
- U.D.E.FontSizeType(_UDTD, UDE, null, "E"); //修改区域的样式
- _UKE["CE"]["Cell"][_UKE["SEO"][1]].style.cssText = _UDTD.style.cssText; //修改单元格
- return;
- }
- var _UDRD = U.OU.R ? U.OU.R.CreateR() : U.D.E.GetSelectionRange(window, null, { "TF": _UTF ? "E" : "W" }), _UDED = _UDRD.Parent(); //获取修改值
- U.D.E.FontSizeType(_UDED, UDE, _UDRD, "W"); //设置选取样式
- }
- //大小和字体改变的显示
- U.OU.DSZS = function (UDOD, UDTD, UPC) {
- //UDOD
- //UDTD
- //UPC
- if (UDOD[0].style.display == "block") {
- UDOD[0].style.display = "none";
- } //如果现实就等于取消
- else { (UDOD[0].addAttrArray({ "style": { "zIndex": "99999", "display": "block", "left": (UDTD.offsetLeft + (UPC || 0)) + "px" } }))[0]; } //指定的位置显示
- }
- //插入时间
- U.OU.InsertNowTime = function () {
- var _UDT = U.MT.getYearMonthDay(new Date(), "String"); //获取时间
- if (U.OU.TF["TF"] == "Excel") {
- U.Excel.SetWZ(_UDT);
- } //插入时间
- else {
- U.D.E.GetSelectionRange(window, $$("span"), { "TF": "W" }).Replace(_UDT);
- } //初始化编辑区域
- }
- //生成站点
- U.OU.OUSCJ = function (UFID, UTF) {
- var _UTF = U.OU.TF["TF"] == "Excel", //判断类型
- _UGE = (U.Excel || U.Word), //获取Excel或Word对象
- _UFID = _UTF ? _UGE.TF["ID"] : _UGE.SY["ID"]; //获取Excel的使用变量或Word的使用变量
- _UGE.Save(); //先保存文件
- if (_UFID.length == 36) {
- window.open("http://disk.1473.cn/" + _UFID + "/" + U.OU.TF["TF"]);
- }
- else {
- parent.U.Alert("请保存文件后执行");
- } //拥有链接路径的
- }
- //生成网站回调
- U.OU.HDOUSCJ = function () {
- if (U.Word && U.Word.TF) {
- return (U.OU.TF["TF"] == "Excel" ? (U.Excel.SY["UAE"]["E"] || $("#U_E_CellFrame")[0]) : $("#UD_SYQXR")[0]).innerHTML;
- }
- }
- //复制
- U.OU.Copy = function () {
- if (U.OU.R) {
- U.M.Copy(U.OU.R.GetSelectedHtml()); //文字到剪切板里
- }
- }
- //粘贴
- U.OU.ZT = function (UTS) {
- var _UGE = U.OU.R;
- // q = new window.ClipboardEvent("paste");
- // q.target = _UGE;
- // var event = top.window.event;
- // var clipboardData = event.clipboardData || window.clipboardData;
- if (_UGE) {
- if (!U.OU.TF["TF"] == "Excel") {
- if (_UGE.Parent().contentEditable != "false") {
- _UGE.Paste(top.U.Excel.SY["SEO"][0]);
- }
- }
- else {
- _UGE.Paste(q);
- }
- }
- }
- //撤销
- U.OU.CX = function () {
- (U.OU.R && U.OU.TF["TF"] == "Excel") && (U.OU.R.GetKE("undo"));
- }
- //#endregion
- //总管所有的onlick
- U.OU.SDYC = function (UDOD, UTF) {
- if (U.OU.TF.D && (!UDOD || event.srcElement == UDOD)) {
- $(U.OU.TF["UAE"]).addAttrArray({ "style": { "display": "none" } });
- U.OU.TF["FTF"] = UTF || false;
- }
- U.OU.TF.D = true;
- }
- //#endregion
|