123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- Namespace.register("U.Word.Tools");
- /**
- * 功能创建
- *
- * @param {object} 登录用户信息
- * @param {str} 类型
- * @param {object} 文档信息数组 或 null
- * @return {object} 头部信息和顶部工具栏的整体元素
- */
- U.Word.Tools.Wordtools = function (UIF, UTF, UDE, UDOD) {
- //如果是word,excel共用的区域,则需要改写此部分,让word,excel分离。
- var _UDE = [],
- _UDOD = $(UDOD), // $("#UD_Word_Tool").clone(true), //整体克隆功能区域元素,克隆的工具栏+菜单,要拆分
- _UDAD = _UDOD.Child(), //获取子级
- _UDKD = $(_UDAD[1]).Child();
- //设置所有的按钮和元素不可以选择,这里为了兼容ie,ie设置了该属性后,光标在点击设置的元素后光标不会失焦
- $("&*", _UDOD[0]).addAttrArray({
- "unselectable": "on"
- });
- //上述设置了所有元素不可以设置焦点,但是input是必须设置焦点使用的,这是设置后input才能聚焦,否则练文件名都输入不了
- $("input", _UDOD[0]).addAttrArray({
- "unselectable": "off"
- }); //创建指定的功能
- U.D.Office.WUIF(UIF, _UDAD[0], UDE); //设置头部信息
- //循环word菜单区4个菜单,包括字体,字号,背景色,前景色。
- var allmenu = $(_UDKD); //所有菜单
- var fontmenu = $(allmenu[6]).Child()[0]; //得到字体菜单,
- var wordsize = $(allmenu[7]).Child()[0]; //字体大小菜单
- var backgroundmenu = $(allmenu[9]).Child()[1]; ; //背景颜色菜单
- var forground = $(allmenu[10]).Child()[1]; ; //前景色菜单
- U.OU.CreateFont(fontmenu); //创建字体
- U.OU.CreateWordSize(wordsize); //创建字号
- U.OU.ColorSelect(backgroundmenu); //创建背景色
- U.OU.ColorSelect(forground); //创建前景色
- //显示工具栏
- _UDOD.css("display", "block");
- return _UDOD; //头部信息和顶部工具栏的整体元素
- }
- /**
- * Word Excel大小处理
- *
- * @param {element} office的容器元素(主体区域)
- * @param {object} 文档信息数组
- */
- U.Word.Tools.WETZ = function (UDOD, UTF) {
- var _UDTD, _UTH,
- _UDAD = $(UDOD).Child(),
- _UW = UDOD.offsetWidth,
- _UH = UDOD.offsetHeight;
- _UTH = _UH - _UDAD[0].offsetHeight;
- }
- /**
- * 弹出视图切换
- *
- * @param {int} 切换的
- */
- U.Word.Tools.ViewDisplay = function () {//视图窗体
- var y, b, l, r; //创建变量
- var UDVD = $(".U_Boom_CO_Editor_head_navigation_two_l");
- var UDWD = $("iframe", UDVD.Parent(4))[0].contentWindow.$("#U_Boom_CO_Editor_body_left .UD_SYF_S"); //获取功能区域
- var UDAA = $("iframe", UDVD.Parent(4))[0].contentWindow.$("#U_Boom_CO_Editor_body_left")[0].childNodes; //获取功能区域的关闭按钮
- var UDOD_yq_colse = $("iframe", UDVD.Parent(4))[0].contentWindow.$(".UD_SYF_SS"); //获取获取功能区域的关闭按钮
- var aaa = $("iframe", UDVD.Parent(4))[0].contentWindow.$("#UD_SYQXR")[0]
- var UDOD_aa = $$("div", { "style": {} });
- var UDOD_yq = $$("div", { "id": "UDOD_yq" }, UDOD_aa);
- var UDOD_yq_im = $$("div", { "id": "UDOD_yq_im" }, UDOD_yq)
- var UDOD_yq_img = $$("div", { "id": "UDOD_yq_img" }, UDOD_yq_im)
- var UDOD_yq_a = $$("div", { "id": "UDOD_yq_a", "innerHTML": "邀请协助" }, UDOD_yq);
- var UDOD_bj = $$("div", { "id": "UDOD_bj" }, UDOD_aa);
- var UDOD_bj_im = $$("div", { "id": "UDOD_bj_im" }, UDOD_bj)
- var UDOD_bj_img = $$("div", { "id": "UDOD_bj_img" }, UDOD_bj_im)
- var UDOD_bj_a = $$("div", { "id": "UDOD_bj_a", "innerHTML": "编辑历史记录" }, UDOD_bj);
- var UDOD_lj = $$("div", { "id": "UDOD_lj" }, UDOD_aa);
- var UDOD_lj_im = $$("div", { "id": "UDOD_lj_im" }, UDOD_lj)
- var UDOD_lj_img = $$("div", { "id": "UDOD_lj_img" }, UDOD_lj_im)
- var UDOD_lj_a = $$("div", { "id": "UDOD_lj_a", "innerHTML": "建立链接" }, UDOD_lj);
- var UDOD_rm = $$("div", { "id": "UDOD_rm" }, UDOD_aa);
- var UDOD_rm_im = $$("div", { "id": "UDOD_rm_im" }, UDOD_rm)
- var UDOD_rm_img = $$("div", { "id": "UDOD_rm_img" }, UDOD_rm_im)
- var UDOD_rm_a = $$("div", { "id": "UDOD_rm_a", "innerHTML": "热门模板" }, UDOD_rm);
- U.UI.From({ id: "ViewDisplaya",
- style: { "width": "390px" },
- content: UDOD_aa,
- title: "视图",
- hst: {},
- bst: {},
- max: {},
- SO: false
- });
- UDOD_yq_img.style.display = "block"; //重新点击后恢复原样
- UDWD[0].style.display = "block";
- UDOD_bj_img.style.display = "block";
- UDWD[1].style.display = "block";
- UDOD_lj_img.style.display = "block";
- UDWD[2].style.display = "block";
- UDOD_rm_img.style.display = "block";
- UDWD[3].style.display = "block";
- UDAA[1].style.top = 30 + "px";
- UDAA[2].style.top = 300 + "px";
- UDAA[3].style.top = 570 + "px";
- UDAA[4].style.top = 840 + "px";
- UDAA[1].style.left = UDAA[2].style.left = UDAA[3].style.left = UDAA[4].style.left = aaa.clientWidth + 50 + "px";
- UDOD_yq.onclick = function () {
- if (y == 0) {
- UDOD_yq_img.style.display = "block";
- UDWD[0].style.display = "block";
- UDAA[2].style.top = UDAA[2].offsetTop + 270 + "px";
- UDAA[3].style.top = UDAA[3].offsetTop + 270 + "px";
- UDAA[4].style.top = UDAA[4].offsetTop + 270 + "px";
- y = 1;
- } else {
- $("iframe", UDVD.Parent(4))[0].contentWindow.U.D.CloseWindow(UDWD[0]);
- UDOD_yq_img.style.display = "none";
- UDAA[2].style.top = UDAA[2].offsetTop - 270 + "px";
- UDAA[3].style.top = UDAA[3].offsetTop - 270 + "px";
- UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
- y = 0;
- }
- }
- UDOD_bj.onclick = function () {
- if (b == 0) {
- UDOD_bj_img.style.display = "block";
- UDWD[1].style.display = "block";
- UDAA[3].style.top = UDAA[3].offsetTop + 270 + "px";
- UDAA[4].style.top = UDAA[4].offsetTop + 270 + "px";
- if (UDAA[2].style.top == "270px") {
- UDAA[2].style.top = 300 + "px";
- }
- if (UDAA[2].style.top == "-270px") {
- UDAA[2].style.top = 30 + "px";
- }
- b = 1;
- } else {
- $("iframe", UDVD.Parent(4))[0].contentWindow.U.D.CloseWindow(UDWD[1]);
- UDOD_bj_img.style.display = "none";
- UDAA[3].style.top = UDAA[3].offsetTop - 270 + "px";
- UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
- b = 0;
- }
- }
- UDOD_lj.onclick = function () {
- if (l == 0) {
- UDOD_lj_img.style.display = "block";
- UDWD[2].style.display = "block";
- UDAA[4].style.top = UDAA[4].offsetTop + 270 + "px";
- if (UDAA[3].style.top == "270px") {
- UDAA[3].style.top = 570 + "px";
- }
- if (UDAA[3].style.top == "-270px") {
- UDAA[3].style.top = 300 + "px";
- }
- l = 1;
- } else {
- $("iframe", UDVD.Parent(4))[0].contentWindow.U.D.CloseWindow(UDWD[2]);
- UDOD_lj_img.style.display = "none";
- UDAA[4].style.top = UDAA[4].offsetTop - 270 + "px";
- l = 0;
- }
- }
- UDOD_rm.onclick = UDOD_yq_colse[3].onclick = function () {
- if (r == 0) {
- UDOD_rm_img.style.display = "block";
- UDWD[3].style.display = "block";
- if (UDAA[4].style.top == "270px") {
- UDAA[4].style.top = 840 + "px";
- }
- if (UDAA[4].style.top == "-270px") {
- UDAA[4].style.top = 30 + "px";
- }
- r = 1;
- } else {
- $("iframe", UDVD.Parent(4))[0].contentWindow.U.D.CloseWindow(UDWD[3]);
- UDOD_rm_img.style.display = "none";
- r = 0;
- }
- }
- }
- /**
- * 模板选择
- *
- */
- U.Word.Tools.STemp = function () {//更多
- // var i; //循环初始化
- // _UDTD, //设置变量
- // _UDW = U.D.Office.WI(), //设置windows操作层 获取方法类
- // _UDE = ["word空模板", "web空模板", "导航模板", "企业模式", "会议模式", "大纲模式"], //设置数据
- // _UDOD = $$("div", { "className": "UD_TempA" }); //创建外部div
- // var _UDTD = $$("div", { "className": "UD_TempAC" }, _UDOD); //主体区域
- // for (i = 0; i < _UDE.length; i++) {
- // $$("div", { "className": "UD_TempACL", title: _UDE[i], "innerHTML": _UDE[i], "onclick": [[U.D.Office.GSTemp, ([_UDOD, _UDW, i])]] }, _UDTD);
- // }
- var UDGD = $$("div", {});
- var UDGD_xz = $$("div", { "className": "UDGD_xz", "innerHTML": "下载" }, UDGD);
- var UDGD_yj = $$("div", { "className": "UDGD_xz", "innerHTML": "意见反馈" }, UDGD);
- U.UI.Form({//创建更多窗体
- draw: false,
- max: false,
- min: false,
- isTop: true,
- id: "UD_Temp",
- style: {
- width: "350px"
- },
- content: UDGD,
- title: "更多",
- hst: {}
- }); //创建窗体
- }
- U.Word.Tools.XTemp = function (UIE) {
- var i, //循环初始化
- UDTD, //设置变量
- UDW = U.D.Office.WI(); //设置windows操作层 获取方法类
- var UTF = ["Word", "Web", "US_O_Navigation", "US_O_Website", "US_O_Meeting", "US_O_Outline", "US_O_Novel"][UIE]; //类型
- if (UTF) { //是否存在
- (UDW.U.Word || UDW.U.Excel)["GetTemp"](UTF); //获取office模板
- } else {
- U.Alert("此模板暂不开放");
- } //不存在提示
- var UDOD = $("#UD_SYQXR")[0];
- if (!UDOD.innerText.length || UDOD.innerText == $$("div", { "innerHTML": "​" }).innerText) {
- U.Word.XTemp(UTF);
- }
- else {
- top.U.UI.Confirm("是否覆盖内容", [U.Word.Tools.XTemp, ([UTF])]);
- }
- }
- /**
- * word模式切换
- *
- * @param {element} 换页元素
- * @param {int} 切换的
- */
- U.Word.Tools.ModeSwitch = function (UDOD, UTF) {
- var i,
- _UDCD = $(UDOD).parentg().Child();
- //修改切换
- for (i = 0; i < _UDCD.length; i++) {
- if (_UDCD[i] != UDOD) {
- _UDCD[i].className = "";
- }
- }
- // 目录模式 显示目录功能
- if (UDOD.textContent.trim() == "目录模式") {
- $(".U_Boom_CO_Editor_head_features #U_Boom_Catalog", $(UDOD).Parent(4)).css("display", "block");
- } else {
- $(".U_Boom_CO_Editor_head_features #U_Boom_Catalog", $(UDOD).Parent(4)).css("display", "none");
- }
- UDOD.className = "U_Boom_CO_Editor_head_navigation_color_789CD5";
- U.Word.Tools.ModeDisplay(UTF); //展示模板
- }
- /**
- * 模式展示
- *
- * @param {int} 切换的
- */
- U.Word.Tools.ModeDisplay = function (UTF) {
- }
- U.Word.Tools.IploadImg = function () {
- U.UP.uploading([$("#files")[0]],
- function (r) {
- U.Alert("上传成功");
- }, ([]), "http://disk.1473.cn/USupfile.ashx?iframename=UseStudioEditor");
- }
|