U.OU.js 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. //#region office 公有工具栏
  2. /*
  3. 问题
  4. word,Excel,PPT等的共用工具栏。有些需要移动到U.UI的扩展库里面去。
  5. 1、 工具的的功能流程图
  6. 2、 工具的初始化流程图
  7. */
  8. Namespace.register("U.OU");
  9. //["Calibri (西文正文)", "宋体", "黑体", "隶书", "幼圆", "楷体", "Arial", "仿宋体", 0],
  10. //例子:
  11. U.OU.WF = {}; //记录所有分页可编辑区域的光标。每页一个可编辑区域,每页一个光标,则有多个,所以用数组。
  12. U.OU.TF = {
  13. IsO: false,
  14. "UME": [[//字体选择区域
  15. "仿宋",
  16. "黑体",
  17. "华文楷体",
  18. "华文新魏",
  19. "华文行楷",
  20. "楷体",
  21. "隶书",
  22. "宋体",
  23. "宋体-ExtB",
  24. "微软雅黑",
  25. "微软雅黑",
  26. "Angsana New",
  27. "Arial",
  28. "Arial Black",
  29. "Batang",
  30. "Book Antiqua",
  31. "Bookman Old Style",
  32. "Browallia New",
  33. "Calibri",
  34. "Calibri Light",
  35. "Cambria",
  36. "Candara",
  37. "Century",
  38. "Century Gothic",
  39. "Century Schoolbook",
  40. "Comic Sans MS",
  41. "Consolas",
  42. "Constantia",
  43. "Corbel",
  44. "Cordia New",
  45. "Courier New",
  46. "DaunPenh",
  47. "DilleniaUPC",
  48. "Dotum",
  49. "Franklin Gothic Book",
  50. "Franklin Gothic Medium",
  51. "Garamond",
  52. "Gautami",
  53. "Georgia",
  54. "Gill Sans MT",
  55. "Gulim",
  56. "GungSuh",
  57. "Iskoola Pota",
  58. "JasmineUPC",
  59. "alinga",
  60. "Kartika",
  61. "Latha",
  62. "Lucida Sans",
  63. "Lucida Sans Unicode",
  64. "Malgun Gothic",
  65. "Mangal",
  66. "Meiryo",
  67. "Microsoft JhengHei",
  68. "MingLiU",
  69. "MingLiU_HKSCS",
  70. "MS Gothic",
  71. "MS Mincho",
  72. "MS PGothic",
  73. "MS PMincho",
  74. "Nyala",
  75. "PMingLiU",
  76. "PMingLiU-ExtB",
  77. "Raavi",
  78. "Rockwell",
  79. "Segoe UI Light",
  80. "Shruti",
  81. "Sylfaen",
  82. "Tahoma",
  83. "Times",
  84. "Times New Roman",
  85. "Trebuchet MS",
  86. "Tunga", "TW Cen MT",
  87. "Verdana",
  88. "Vrinda"
  89. ],
  90. [ //字号选择区域
  91. ["初号", "44pt", "58.6"],
  92. ["小初", "36pt", "48"],
  93. ["一号", "26pt", "34.6"],
  94. ["小一", "24pt", "32"],
  95. ["二号", "22pt", "29.3"],
  96. ["小二", "18pt", "24"],
  97. ["三号", "16pt", "21.3"],
  98. ["小三", "15pt", "20"],
  99. ["四号", "14pt", "18.6"],
  100. ["小四", "12pt", "16"],
  101. ["五号", "10.5pt", "14"],
  102. ["小五", "9pt", "12"],
  103. ["六号", "7.5pt", "10"],
  104. ["小六", "6.5pt", "8.6"],
  105. ["七号", "5.5pt", "7.3"],
  106. ["八号", "5pt", "6.6"]
  107. ],
  108. [ //字体颜色区域
  109. "#ffffff",
  110. "#ffccc9",
  111. "#ffce93",
  112. "#fffc9e",
  113. "#ffffc7",
  114. "#9aff99",
  115. "#96fffb",
  116. "#cdffff",
  117. "#cbcefb",
  118. "#cfcfcf",
  119. "#fd6864",
  120. "#fe996b",
  121. "#fffe65",
  122. "#fcff2f",
  123. "#67fd9a",
  124. "#38fff8",
  125. "#68fdff",
  126. "#9698ed",
  127. "#c0c0c0",
  128. "#fe0000",
  129. "#f8a102",
  130. "#ffcc67",
  131. "#f8ff00",
  132. "#34ff34",
  133. "#68cbd0",
  134. "#34cdf9",
  135. "#6665cd",
  136. "#9b9b9b",
  137. "#cb0000",
  138. "#f56b00",
  139. "#ffcb2f",
  140. "#ffc702",
  141. "#32cb00",
  142. "#00d2cb",
  143. "#3166ff",
  144. "#6434fc",
  145. "#656565",
  146. "#9a0000",
  147. "#ce6301",
  148. "#cd9934",
  149. "#999903",
  150. "#009901",
  151. "#329a9d",
  152. "#3531ff",
  153. "#6200c9",
  154. "#343434",
  155. "#680100",
  156. "#963400",
  157. "#986536",
  158. "#646809",
  159. "#036400",
  160. "#34696d",
  161. "#00009b",
  162. "#303498",
  163. "#000000",
  164. "#330001",
  165. "#643403",
  166. "#663234",
  167. "#343300",
  168. "#013300",
  169. "#003532",
  170. "#010066",
  171. "#340096"]
  172. ],
  173. "UV": "", "TF": "Excel", "UAE": [], "D": true, "FTF": false
  174. } //变量使用区域
  175. //#region 初始化工具
  176. //初始化工具
  177. /**
  178. * 功能创建
  179. *
  180. * @param {string} 使用的类型
  181. * @param {object} 文档信息数组 或 null
  182. * @return {object} 头部信息和顶部工具栏的整体元素
  183. */
  184. U.OU.Onload = function (UTF, UDE) {
  185. //var i, //循环初始化
  186. //_UCE = ["Word", "WordL"]; //初始化需要用到的字符串
  187. U.OU.CreatTool(UDE); //创建工具
  188. //设置前进后退
  189. //for (i = 0; i < _UCE.length; i++) {
  190. // U.AFB.RGoL(_UCE[i]);
  191. //}
  192. }
  193. //创建4个菜单,包括字体,字号,背景色,前景色。
  194. U.OU.CreatTool = function (UDE, UIE) {
  195. var i, j, k, _UDOD, _UL, _UDMD, _UKE,
  196. _UCE = U.OU.TF.UME; //获取字体 字号 字体颜色数组
  197. for (i = 0; i < UDE.length; i++) { //循环设置
  198. _UKE = _UCE[i >= _UCE.length ? _UCE.length - 1 : i];
  199. _UL = _UKE.length
  200. _UDMD = null;
  201. if (i < 2 && UDE[i].options) {
  202. UDE[i].options.length = _UL;
  203. }
  204. else {
  205. _UDMD = $$("frag");
  206. }
  207. for (j = 0; j < _UL; j++) {
  208. if (i < 2) { //字体工具
  209. if (UDE[i].options) { //判断是否为select标签
  210. (_UDOD = UDE[i].options[j]).value = U.Ut.isArray(_UKE[j]) ? _UKE[j][1] : _UKE[j];
  211. _UDOD.text = U.Ut.isArray(_UKE[j]) ? _UKE[j][0] : _UKE[j];
  212. }
  213. else {
  214. $$("div", { "unselectable": "on", "innerHTML": _UKE[j], "onmousedown": U.M.StopBubble, "style": { "fontFamily": _UKE[j] } }, _UDMD);
  215. }
  216. }
  217. else { //颜色工具
  218. $$("div", { "unselectable": "on", "style": { "backgroundColor": _UKE[j] } }, _UDMD);
  219. }
  220. }
  221. if (_UDMD) { UDE[i].appendChild(_UDMD); }
  222. }
  223. }
  224. //创建字体 传入的el必须是select标签元素
  225. U.OU.CreateFont = function (el) {
  226. var fontarea = [//字体选择
  227. "仿宋",
  228. "黑体",
  229. "华文楷体",
  230. "华文新魏",
  231. "华文行楷",
  232. "楷体",
  233. "隶书",
  234. "宋体",
  235. "宋体-ExtB",
  236. "微软雅黑",
  237. "微软雅黑",
  238. "Angsana New",
  239. "Arial",
  240. "Arial Black",
  241. "Batang",
  242. "Book Antiqua",
  243. "Bookman Old Style",
  244. "Browallia New",
  245. "Calibri",
  246. "Calibri Light",
  247. "Cambria",
  248. "Candara",
  249. "Century",
  250. "Century Gothic",
  251. "Century Schoolbook",
  252. "Comic Sans MS",
  253. "Consolas",
  254. "Constantia",
  255. "Corbel",
  256. "Cordia New",
  257. "Courier New",
  258. "DaunPenh",
  259. "DilleniaUPC",
  260. "Dotum",
  261. "Franklin Gothic Book",
  262. "Franklin Gothic Medium",
  263. "Garamond",
  264. "Gautami",
  265. "Georgia",
  266. "Gill Sans MT",
  267. "Gulim",
  268. "GungSuh",
  269. "Iskoola Pota",
  270. "JasmineUPC",
  271. "alinga",
  272. "Kartika",
  273. "Latha",
  274. "Lucida Sans",
  275. "Lucida Sans Unicode",
  276. "Malgun Gothic",
  277. "Mangal",
  278. "Meiryo",
  279. "Microsoft JhengHei",
  280. "MingLiU",
  281. "MingLiU_HKSCS",
  282. "MS Gothic",
  283. "MS Mincho",
  284. "MS PGothic",
  285. "MS PMincho",
  286. "Nyala",
  287. "PMingLiU",
  288. "PMingLiU-ExtB",
  289. "Raavi",
  290. "Rockwell",
  291. "Segoe UI Light",
  292. "Shruti",
  293. "Sylfaen",
  294. "Tahoma",
  295. "Times",
  296. "Times New Roman",
  297. "Trebuchet MS",
  298. "Tunga", "TW Cen MT",
  299. "Verdana",
  300. "Vrinda"
  301. ]; //字体字号背景色的数组变量
  302. el.options.length = fontarea.length; //创建下拉框 length相当于创建了和该长度相等的下拉框
  303. //循环创建每个字体
  304. for (var i = 0; i < fontarea.length; i++) {
  305. el.options[i].value = fontarea[i];
  306. el.options[i].text = fontarea[i];
  307. }
  308. }
  309. //创建字号 传入的el必须是select标签元素
  310. U.OU.CreateWordSize = function (el) {
  311. var _sizearea = [ //字号选择区域
  312. ["初号", "44pt", "58.6"],
  313. ["小初", "36pt", "48"],
  314. ["一号", "26pt", "34.6"],
  315. ["小一", "24pt", "32"],
  316. ["二号", "22pt", "29.3"],
  317. ["小二", "18pt", "24"],
  318. ["三号", "16pt", "21.3"],
  319. ["小三", "15pt", "20"],
  320. ["四号", "14pt", "18.6"],
  321. ["小四", "12pt", "16"],
  322. ["五号", "10.5pt", "14"],
  323. ["小五", "9pt", "12"],
  324. ["六号", "7.5pt", "10"],
  325. ["小六", "6.5pt", "8.6"],
  326. ["七号", "5.5pt", "7.3"],
  327. ["八号", "5pt", "6.6"]
  328. ];
  329. el.options.length = _sizearea.length; //创建下拉框 length相当于创建了和该长度相等的下拉框
  330. //循环创建每个字号
  331. for (var i = 0; i < _sizearea.length; i++) {
  332. el.options[i].value = _sizearea[i][1]; //options的值等于字体的大小 如44pt、36pt
  333. el.options[i].text = _sizearea[i][0]; //options的输入描述等于字体的描述 如初号 、小四等等
  334. }
  335. }
  336. //创建背景或者字体颜色选择控件
  337. U.OU.ColorSelect = function (el) {
  338. var _colorarea = [ //字体颜色区域
  339. "#ffffff",
  340. "#ffccc9",
  341. "#ffce93",
  342. "#fffc9e",
  343. "#ffffc7",
  344. "#9aff99",
  345. "#96fffb",
  346. "#cdffff",
  347. "#cbcefb",
  348. "#cfcfcf",
  349. "#fd6864",
  350. "#fe996b",
  351. "#fffe65",
  352. "#fcff2f",
  353. "#67fd9a",
  354. "#38fff8",
  355. "#68fdff",
  356. "#9698ed",
  357. "#c0c0c0",
  358. "#fe0000",
  359. "#f8a102",
  360. "#ffcc67",
  361. "#f8ff00",
  362. "#34ff34",
  363. "#68cbd0",
  364. "#34cdf9",
  365. "#6665cd",
  366. "#9b9b9b",
  367. "#cb0000",
  368. "#f56b00",
  369. "#ffcb2f",
  370. "#ffc702",
  371. "#32cb00",
  372. "#00d2cb",
  373. "#3166ff",
  374. "#6434fc",
  375. "#656565",
  376. "#9a0000",
  377. "#ce6301",
  378. "#cd9934",
  379. "#999903",
  380. "#009901",
  381. "#329a9d",
  382. "#3531ff",
  383. "#6200c9",
  384. "#343434",
  385. "#680100",
  386. "#963400",
  387. "#986536",
  388. "#646809",
  389. "#036400",
  390. "#34696d",
  391. "#00009b",
  392. "#303498",
  393. "#000000",
  394. "#330001",
  395. "#643403",
  396. "#663234",
  397. "#343300",
  398. "#013300",
  399. "#003532",
  400. "#010066",
  401. "#340096"];
  402. var _frag = $$("frag");
  403. //循环创建背景颜色
  404. for (var i = 0; i < _colorarea.length; i++) {
  405. $$("div", { "unselectable": "on", "style": { "backgroundColor": _colorarea[i] } }, _frag);
  406. }
  407. el.appendChild(_frag);
  408. }
  409. //工具的查看和隐藏
  410. U.OU.ToolOC = function (UDOD, UTF) {
  411. //UTF
  412. //UDOD
  413. var i, //循环初始化
  414. _UDCD, //变量初始化
  415. _UDAD = $(UDOD).Child(), //获取子级
  416. _UDKD = UTF ? _UDAD : $(UDOD).parentg().Child();
  417. for (i = 0; i < _UDKD.length; i++) {
  418. _UDCD = $(_UDKD[i]).Child(); //获取子级元素
  419. _UDCD = _UDCD[_UDKD[i].innerText ? 2 : 1];
  420. (_UDCD && _UDCD != _UDAD[_UDAD.length - 1]) && (_UDCD.style.display = "none");
  421. }
  422. if (!UTF) {
  423. _UDCD = _UDAD[_UDAD.length - 1];
  424. _UDCD.style.display = _UDCD.style.display == "block" ? "none" : "block";
  425. }
  426. }
  427. //#endregion
  428. //#region 焦点处理,//初始化焦点使用,只是聚焦作用,还没插入光标,这里还需要继续整理
  429. U.OU.WordFocus = function (UDOD, UST, UAF) {
  430. //U.OU.WF不是全局变量,会有问题。
  431. var _UGE = U.OU.WF[UDOD.id]; //word默认焦点
  432. 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 })); //光标初始化创建
  433. if (UST !== false) {
  434. _UGE.Replace(UST, _UGE.R, true);
  435. }
  436. return _UGE;
  437. }
  438. //初始化焦点使用
  439. U.OU.SCJD = function (UDOD, UST, UAF) {
  440. var _UGE = U.OU.R;
  441. _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 })); //光标初始化创建
  442. _UGE.Replace(UST, _UGE.R, true);
  443. return _UGE; //焦点
  444. }
  445. //释放焦点时候保存焦点
  446. U.OU.JDCL = function (UTF) {
  447. if (UTF !== false) { U.OU.TF.IsO = true; }
  448. try {
  449. (U.OU.R) && (U.OU.R = U.OU.R.CreateR(), U.OU.TF["FTF"] = false);
  450. }
  451. catch (e) { }
  452. }
  453. //焦点聚焦回去
  454. U.OU.JDCR = function () {
  455. if (U.OU.TF.IsO) {//焦点到指定的位置
  456. U.OU.TF.IsO = false;
  457. var _UGE = U.OU.R;
  458. window.focus(); //获取焦点
  459. if (_UGE) {
  460. if (!_UGE.GetSelectedHtml()) {
  461. _UGE.Replace("");
  462. } else {
  463. _UGE.QX();
  464. }
  465. }
  466. }
  467. }
  468. //#endregion
  469. //#region 网盘处理
  470. //从网盘选择图片或者连接
  471. U.OU.OUIG = function (UDID, UTF, UDOD, UR) {
  472. //UDID
  473. //UTF
  474. //UDOD
  475. //UR
  476. var i, //循环初始化
  477. _UDTD, //变量初始化
  478. _UDSD, //变量初始化
  479. _UTP, //变量初始化
  480. _UDFD = $$("frag"), //创建frag元素
  481. _UDE = (US.Disk.UserDisk) ? (_$(US.Disk.UserDisk[0]).Select({ "UserDirectoryParentID": UDID })) : "";
  482. U.OU.R = U.D.E.GetSelectionRange(window, $(".U_Boom_CO_Editor_body_main_text")[0], { "TF": "MW", "CB": null });
  483. if (UDOD) {
  484. UDOD.innerText = "";
  485. for (i = 0; i < _UDE.length; i++) {
  486. _UTP = parent.U.UP.IsImg(_UDE[i].UserDirectoryExtendType); //类型
  487. _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);
  488. _UDSD = $$("div", { "className": "UD_SYSXZLRSITOT" }, _UDTD); //创建div
  489. if (_UTP) { $$("img", { "src": _UDE[i].UserDirectoryUrl, "onerror": [[U.M.ImgError, ["this", 1]]] }, _UDSD); }
  490. else { $(_UDSD).addAttrArray({ "style": { "cssText": top.U.UP.FFT(_UDE[i].UserDirectoryExtendType)[1] + ";" }, "className": "UDK_L_DiskGE " + _UDSD.className }); }
  491. $$("span", { "className": "UTDF", "innerHTML": _UDE[i].UserDirectoryName }, _UDTD);
  492. }
  493. UDOD.appendChild(_UDFD);
  494. }
  495. }
  496. //选择使用图片或者链接
  497. U.OU.OUALJ = function (UDR, UTF, UDE, URL, USN, UDOD, UDPD) {
  498. //UDR
  499. //UTF
  500. //UDE
  501. //UDPD
  502. if (UDE.filetype || U.Ut.isString(UDE)) {
  503. var _UDOD, //变量初始化
  504. _UDTD, //变量初始化
  505. _UDSD, //变量初始化
  506. _UDMD, //变量初始化
  507. _UTH, //变量初始化
  508. _USN; //变量初始化
  509. U.M.StopBubble();
  510. UDR = UDR || U.OU.R; //取消冒泡
  511. if (!UDR) { U.Alert("请选择编辑区!"); }
  512. else {
  513. switch (UTF) {
  514. case "img":
  515. if (U.UP.IsImg(_USN = UDE.UserFilesServerName || (U.Ut.isString(UDPD) ? UDPD : UDE))) {
  516. _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);' /> "
  517. //_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>"
  518. } //图片区域
  519. else {//普通附件区域
  520. _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" } });
  521. _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);
  522. $$("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);
  523. _UDTD = $$("div", { style: { "cssText": "width:195px; height:100%; margin-left:10px; float:left;" } }, _UDOD);
  524. _UDSD = $$("div", { style: { "cssText": "width:200px; height:35px; line-height:35px;" } }, _UDTD);
  525. _UDMD = $$("div", { innerHTML: "文档 容量大小 " }, _UDSD); $$("span", { innerHTML: U.UP.FileSize(arguments[5].UserDirectorySize), style: { cssText: "color:#006699;" } }, _UDMD);
  526. _UDSD = $$("div", { style: { "cssText": "width:200px; height:35px; line-height:35px;" } }, _UDTD);
  527. _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);
  528. $$("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);
  529. $("*", _UDOD).addAttrArray({ contenteditable: "false" }); _UTH = " &nbsp" + _UDOD.outerHTML + "&nbsp ";
  530. }
  531. (U.M.apply(UDR, [[U.OU.R.CreateR], [U.OU.SDYC], [UDR.Replace, [_UTH, null, true]]]))(); //U.OU.R.CreateR获取光标
  532. break; //插入图片
  533. case "LJ": U.OU.OULJ(UDR, "http://disk.1473.cn?ID=" + UDE["UserDirectoryID"], UDE); break; //文字生成连接
  534. }
  535. }
  536. }
  537. else {
  538. U.AFB.AddEvent([[U.OU.OUIG, [UDE.UserDirectoryID, UTF, UDPD, UDR]]], UTF == "img" ? "Word" : "WordL");
  539. U.OU.JDCR();
  540. } //文件夹执行
  541. }
  542. //添加图片处理
  543. U.OU.AImgCL = function (UDR) {
  544. if (U.OU.TF["TF"] == "Excel") {
  545. var _UDFD = $("div", (U.Excel.SY["UAE"]["FE"] || $("#U_E_EditFrame")[0]))[0]; //获取div
  546. if (_UDFD.contentEditable != "true" || U.OU.R.SO !== _UDFD) {
  547. U.Excel.EditFrameDoubleClick((U.Excel.SY["UAE"]["FE"] || $("#U_E_EditFrame")[0])); //添加双击可编辑事件
  548. U.OU.R = U.D.E.GetSelectionRange(window, _UDFD, { "TF": "E" }); //初始化编辑区域
  549. }
  550. }
  551. else if (UDR || U.OU.R) { (UDR || U.OU.R).CreateR(); }
  552. U.OU.TF.D = true;
  553. }
  554. //修改插入图片的大小
  555. U.OU.CIDX = function (UIMG) {
  556. UIMG.style.maxWidth = "480px";
  557. }
  558. //图片本地上传
  559. U.OU.IploadImg = function (UDD) {
  560. U.UP.uploading([UDD],
  561. function (r) {
  562. var w = $(r.UpObj[0]).Parent(4).nextElementSibling.children[0].contentWindow; //获取当前操作层
  563. //var _UDDIV = $$("div", { "style": { "position": "absolute"} });
  564. //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]
  565. 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图像
  566. U.OU.R = U.D.E.GetSelectionRange(w, $(".U_Boom_CO_Editor_body_main_text")[0], { "TF": "MW", "CB": null }); //获取光标的位置
  567. (U.M.apply(U.OU.R, [[U.OU.R.CreateR], [U.OU.SDYC], [U.OU.R.Replace, [_UDTD, null, true]]]))(); //插入图片
  568. U.Alert("上传成功");
  569. }, [], "http://disk.1473.cn/USupfile.ashx?iframename=UseStudioEditor");
  570. }
  571. //修改图片大小
  572. U.OU.UpdateImg = function () {
  573. //var Imgbox = event.srcElement.parentElement; //获取图片上级元素
  574. // Imgbox.style.position = "absolute";
  575. if (!$(".Imgbox_R_Border")[0]) {//判断是否存在图片四周拉伸的框
  576. var sel = event.srcElement; //获取图片
  577. var _sel = sel.cloneNode(true);
  578. var Imgbox = $$("div", { "style": { "position": "relative" } });
  579. Imgbox.appendChild(_sel);
  580. sel.parentNode.replaceChild(Imgbox, sel); //在点击元素添加父级元素
  581. //创建四边
  582. $$("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);
  583. $$("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);
  584. $$("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);
  585. $$("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);
  586. //创建四角
  587. $$("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);
  588. $$("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);
  589. $$("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);
  590. $$("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);
  591. }
  592. var Imgspan = Imgbox.getElementsByTagName("span"); //获取每个边框的元素
  593. for (var i = 0; i < Imgspan.length; i++) {
  594. U.OU.DragFn(Imgspan[i], Imgbox); //执行点击事件 Imgspan是边框元素。Imgbox是图片上级元素
  595. }
  596. }
  597. U.OU.DragFn = function (obj, Imgbox) {
  598. obj.onmousedown = function (ev) {
  599. var oEv = ev || event; //获取当前window操作层
  600. var oldWidth = Imgbox.offsetWidth; //获取图片的宽度
  601. var oldHeight = Imgbox.offsetHeight; //获取图片的高度
  602. var oldX = oEv.clientX; //获取鼠标的X坐标
  603. var oldY = oEv.clientY; //获取鼠标的Y坐标
  604. $("#UD_SYQXR")[0].onmousemove = function (ev) {//鼠标移入事件
  605. var oEv = ev || event;
  606. if (obj.className == 'Imgbox_TL_Bugle') {//拖动左上角执行函数
  607. Imgbox.style.width = oldWidth - (oEv.clientX - oldX) + 'px';
  608. Imgbox.style.height = oldHeight - (oEv.clientY - oldY) + 'px';
  609. } else if (obj.className == 'Imgbox_BL_Bugle') {//拖动左下角执行函数
  610. Imgbox.style.width = oldWidth - (oEv.clientX - oldX) + 'px';
  611. Imgbox.style.height = oldHeight + (oEv.clientY - oldY) + 'px';
  612. } else if (obj.className == 'Imgbox_TR_Bugle') {//拖动右上角执行函数
  613. Imgbox.style.width = oldWidth + (oEv.clientX - oldX) + 'px';
  614. Imgbox.style.height = oldHeight - (oEv.clientY - oldY) + 'px';
  615. } else if (obj.className == 'Imgbox_BR_Bugle') {//拖动右下角执行函数
  616. Imgbox.style.width = oldWidth + (oEv.clientX - oldX) + 'px';
  617. Imgbox.style.height = oldHeight + (oEv.clientY - oldY) + 'px';
  618. } else if (obj.className == 'Imgbox_T_Border') {//拖动上边框执行函数
  619. Imgbox.style.height = oldHeight - (oEv.clientY - oldY) + 'px';
  620. } else if (obj.className == 'Imgbox_B_Border') {//拖动下边框执行函数
  621. Imgbox.style.height = oldHeight + (oEv.clientY - oldY) + 'px';
  622. } else if (obj.className == 'Imgbox_L_Border') {//拖动左边框执行函数
  623. Imgbox.style.height = oldHeight + 'px';
  624. Imgbox.style.width = oldWidth - (oEv.clientX - oldX) + 'px';
  625. } else if (obj.className == 'Imgbox_R_Border') {//拖动有边框执行函数
  626. Imgbox.style.height = oldHeight + 'px';
  627. Imgbox.style.width = oldWidth + (oEv.clientX - oldX) + 'px';
  628. }
  629. }
  630. $("#UD_SYQXR")[0].onmouseup = function () {
  631. $("#UD_SYQXR")[0].onmousemove = null;
  632. }
  633. return false;
  634. }
  635. }
  636. //取消边框
  637. U.OU.BlurImg = function (blurimg) {
  638. //blurimg.parentNode.parentNode.remove(blurimg.parentNode);
  639. $(".Imgbox_R_Border")[0].remove();
  640. $(".Imgbox_L_Border")[0].remove();
  641. $(".Imgbox_T_Border")[0].remove();
  642. $(".Imgbox_B_Border")[0].remove();
  643. $(".Imgbox_BR_Bugle")[0].remove();
  644. $(".Imgbox_BL_Bugle")[0].remove();
  645. $(".Imgbox_TR_Bugle")[0].remove();
  646. $(".Imgbox_TL_Bugle")[0].remove();
  647. }
  648. //#endregion
  649. //#region 链接处理 在word中给文字添加链接。
  650. //添加链接处理
  651. U.OU.AddUrl = function (UCB) {
  652. var _UDOD = $$("div", { "className": "UD_SYQZOCCL UD_SYQZOCCLV" }),
  653. _UDTD = $$("div", { "className": "UD_SYQZOCCLB" }, _UDOD),
  654. _UDSD = $$("div", { "className": "UD_SYQZOCCLBO" }, _UDTD),
  655. _UDID = $$("input", { "spellcheck": "false", "className": "UD_SYQZOCCLBO", "value": "http://" }, _UDSD);
  656. U.OU.R = U.D.E.GetSelectionRange(window, $(".U_Boom_CO_Editor_body_main_text")[0], { "TF": "MW", "CB": null });
  657. $$("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);
  658. $$("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);
  659. 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);
  660. }
  661. //通过网盘添加方式
  662. U.OU.AddUrlByDisk = function (UDOD, UDE, URL) {
  663. //导航添加链接。
  664. UDID = UDE.UserDirectoryID || U.Word.TF.ID
  665. UDOD.value = "http://disk.1473.cn/?ID=" + UDID;
  666. }
  667. //添加外链选择的变化
  668. U.OU.OULJ = function (UDR, URL, UDE, UTH) {
  669. var _UST = UDR.GetSelectedHtml(); //获取选择的内容
  670. (!U.Ut.isString(URL)) && (URL = URL.value);
  671. if (_UST && U.M.IsUrl(URL)) { //添加添加外链
  672. 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>");
  673. U.OU.R.innerHTML = null;
  674. }
  675. else { //没有选择文字
  676. parent.U.Alert(_UST ? "请输入正确的链接" : "请选择链接文字");
  677. return _UST ? true : false;
  678. }
  679. }
  680. //外连接添加变化
  681. U.OU.OUWLJ = function (UDOD, UTF) {
  682. var _URL, _UDTD, _UDAD, _UTH, //获取url
  683. _UTF = false, //初始化boolean值
  684. _UGE = UTF == "S" ? U.OU.R.CreateR() : U.OU.R;
  685. if (_UGE) {
  686. _UDTD = _UGE.Parent(); //获取父级
  687. _UTH = _UGE.GetSelectedHtml(); //获取选择的对象
  688. _UDAD = UDOD ? $("input", UDOD.parentNode) : null; //获取input对象
  689. if (UTF == "S") { //选择元素选区
  690. if (_UTH || _UDTD.tagName == "img") {
  691. U.OU.R.innerHTML = _UTH;
  692. _UGE.Replace($$("span", { "innerHTML": _UTH, "style": { "color": "#FFF", "backgroundColor": "#338fff" } }), null); //添加属性
  693. }
  694. }
  695. else if (UTF == "E") { //生成链接
  696. if (U.M.IsUrl((_URL = _UDAD[0].value))) {
  697. _UDAD[0].value = "http://";
  698. $(_UDTD).replaceC($$("a", {
  699. "href": _URL, "style": { "color": "#3B639F", "textDecoration": "none" },
  700. "title": _UDTD.innerText, "innerHTML": _UDTD.innerHTML
  701. }));
  702. }
  703. else { U.Alert("无效连接地址"); }
  704. }
  705. else if (U.OU.R.innerHTML) {//移除选择
  706. _UGE.Replace(U.OU.R.innerHTML);
  707. U.OU.R.innerHTML = null;
  708. }
  709. U.OU.SDYC(null, _UTF);
  710. }
  711. }
  712. //点击内容可编辑或者选择链接网站
  713. U.OU.DJBJ = function (TF, UEL) {
  714. //TF boolean
  715. //UEL
  716. if (TF) {
  717. parent.U.Alert("请在左边的文件中选择文件链接", 2000);
  718. UEL = UEL.parentNode; //获取父级元素
  719. var _TID = UEL.getAttribute("ITF"); //获取属性ITF
  720. UEL = $("div@ITF=" + _TID, UEL.parentNode.parentNode)[0];
  721. UEL.focus(); //获取焦点
  722. U.OU.R.SO = UEL; //获取选择的文字
  723. U.OU.R.CreateR(false);
  724. } //$('div', UEL)[0].focus();
  725. else {
  726. UEL = UEL.parentNode; //获取父级元素
  727. UEL.contentEditable = "true"; //改变属性成可编辑
  728. UEL.innerHTML = "&nbsp;"; //改变innerHTML成空格
  729. U.OU.R.SO = UEL; //获取选择的文字
  730. U.OU.R.Replace("<div></div>", U.OU.R.QX(0, 1, UEL));
  731. } //变成可编辑
  732. }
  733. //#endregion
  734. //#region 样式工具
  735. //颜色攻击点击变化
  736. U.OU.ColorLiOnClick = function (UDOD, UDE) {
  737. //UDOD
  738. //UDE
  739. var i, //循环初始化
  740. _UBC = UDOD.style.backgroundColor; //颜色值
  741. for (i in UDE[1]) {
  742. UDE[1][i] = _UBC;
  743. } //颜色变化
  744. U.OU.ChangeStyle(UDE[1]); //修改编辑区的颜色
  745. }
  746. //设置样式
  747. U.OU.ChangeStyle = function (UDE) {
  748. //UDE
  749. var _UKE, //初始化变量
  750. _UDTD, //初始化变量
  751. _UTF = U.OU.TF["TF"] == "Excel"; //获取Excel对象
  752. if (!_UTF && (U.Excel.SY["UAE"]["FE"] || $("#U_E_EditFrame")[0]).ondblclick) {//Excel修改样式
  753. _UKE = U.Excel.SY; //Excel对象
  754. _UDTD = _UKE["SEO"][0]; //获取Excel对象的SEO属性
  755. U.D.E.FontSizeType(_UDTD, UDE, null, "E"); //修改区域的样式
  756. _UKE["CE"]["Cell"][_UKE["SEO"][1]].style.cssText = _UDTD.style.cssText; //修改单元格
  757. return;
  758. }
  759. var _UDRD = U.OU.R ? U.OU.R.CreateR() : U.D.E.GetSelectionRange(window, null, { "TF": _UTF ? "E" : "W" }), _UDED = _UDRD.Parent(); //获取修改值
  760. U.D.E.FontSizeType(_UDED, UDE, _UDRD, "W"); //设置选取样式
  761. }
  762. //大小和字体改变的显示
  763. U.OU.DSZS = function (UDOD, UDTD, UPC) {
  764. //UDOD
  765. //UDTD
  766. //UPC
  767. if (UDOD[0].style.display == "block") {
  768. UDOD[0].style.display = "none";
  769. } //如果现实就等于取消
  770. else { (UDOD[0].addAttrArray({ "style": { "zIndex": "99999", "display": "block", "left": (UDTD.offsetLeft + (UPC || 0)) + "px" } }))[0]; } //指定的位置显示
  771. }
  772. //插入时间
  773. U.OU.InsertNowTime = function () {
  774. var _UDT = U.MT.getYearMonthDay(new Date(), "String"); //获取时间
  775. if (U.OU.TF["TF"] == "Excel") {
  776. U.Excel.SetWZ(_UDT);
  777. } //插入时间
  778. else {
  779. U.D.E.GetSelectionRange(window, $$("span"), { "TF": "W" }).Replace(_UDT);
  780. } //初始化编辑区域
  781. }
  782. //生成站点
  783. U.OU.OUSCJ = function (UFID, UTF) {
  784. var _UTF = U.OU.TF["TF"] == "Excel", //判断类型
  785. _UGE = (U.Excel || U.Word), //获取Excel或Word对象
  786. _UFID = _UTF ? _UGE.TF["ID"] : _UGE.SY["ID"]; //获取Excel的使用变量或Word的使用变量
  787. _UGE.Save(); //先保存文件
  788. if (_UFID.length == 36) {
  789. window.open("http://disk.1473.cn/" + _UFID + "/" + U.OU.TF["TF"]);
  790. }
  791. else {
  792. parent.U.Alert("请保存文件后执行");
  793. } //拥有链接路径的
  794. }
  795. //生成网站回调
  796. U.OU.HDOUSCJ = function () {
  797. if (U.Word && U.Word.TF) {
  798. return (U.OU.TF["TF"] == "Excel" ? (U.Excel.SY["UAE"]["E"] || $("#U_E_CellFrame")[0]) : $("#UD_SYQXR")[0]).innerHTML;
  799. }
  800. }
  801. //复制
  802. U.OU.Copy = function () {
  803. if (U.OU.R) {
  804. U.M.Copy(U.OU.R.GetSelectedHtml()); //文字到剪切板里
  805. }
  806. }
  807. //粘贴
  808. U.OU.ZT = function (UTS) {
  809. var _UGE = U.OU.R;
  810. // q = new window.ClipboardEvent("paste");
  811. // q.target = _UGE;
  812. // var event = top.window.event;
  813. // var clipboardData = event.clipboardData || window.clipboardData;
  814. if (_UGE) {
  815. if (!U.OU.TF["TF"] == "Excel") {
  816. if (_UGE.Parent().contentEditable != "false") {
  817. _UGE.Paste(top.U.Excel.SY["SEO"][0]);
  818. }
  819. }
  820. else {
  821. _UGE.Paste(q);
  822. }
  823. }
  824. }
  825. //撤销
  826. U.OU.CX = function () {
  827. (U.OU.R && U.OU.TF["TF"] == "Excel") && (U.OU.R.GetKE("undo"));
  828. }
  829. //#endregion
  830. //总管所有的onlick
  831. U.OU.SDYC = function (UDOD, UTF) {
  832. if (U.OU.TF.D && (!UDOD || event.srcElement == UDOD)) {
  833. $(U.OU.TF["UAE"]).addAttrArray({ "style": { "display": "none" } });
  834. U.OU.TF["FTF"] = UTF || false;
  835. }
  836. U.OU.TF.D = true;
  837. }
  838. //#endregion