123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- Namespace.register("U.Word.O.O");
- U.Word.O.O.Flag = true;
- U.Word.O.O.Load = function (pos) {
-
-
-
- var UW = U.D.Office.WI();
- if (UW.$(".U_Boom_O_O_C_Txt")[0] && !arguments[1]) {
- return
- };
-
- var i = 0,
- j = 0;
- Udiv = UW.$("#UD_SYQXR div"),
- Child = null,
- pos = pos || UW.$(".U_Boom_CO_Editor_body_main_text")[0];
- if (!UW.$(".U_Boom_Box")[0]) {
- var U_Boom_Box = $$("div", { "className": "U_Boom_Box", "contenteditable": "false" });
- pos.insertBefore(U_Boom_Box, pos.children[0]);
- }
- UW.$(".U_Boom_Box")[0].innerHTML = "";
- var U_Boom_Box = UW.$(".U_Boom_Box")[0];
- var U_Boom_O_O_C_Txt = $$("div", {
- "class": "U_Boom_O_O_C_Txt",
- "innerText": "目录"
- }, U_Boom_Box);
- var U_Boom_O_O_C_Wrap = $$("div", {
- "class": "U_Boom_O_O_C_Wrap"
- }, U_Boom_Box)
-
- for (; i < Udiv.length; i++) {
- if (Udiv[i].className) {
- j = i;
- Child = Udiv[i];
- if (Child.id) {
-
- if (i >= 1 && Child.id == Udiv[--j].id && Child.textContent.trim() != "") {
- Child.id = "T" + Date.parse(new Date());
- };
- if (Child.childNodes[0] !== undefined && Child.childNodes[0].nodeValue != null) {
- var U_Boom_O_O_C_Box = $$("div", {
- "class": "U_Boom_O_O_C_Box"
- }, U_Boom_O_O_C_Wrap);
- var a = $$("a", {
- "class": "U_Boom_O_O_C_Name",
- "style": {
- "margin-left": Child.className.match(/\d+$/)[0]
- },
- "href": "#" + Child.id
- }, U_Boom_O_O_C_Box);
-
-
-
-
-
-
-
- a.innerHTML = Child.childNodes[0].nodeValue;
- $$("div", {
- "class": "U_Boom_O_O_C_Dash",
- "style": { "width": "80%" }
- }, U_Boom_O_O_C_Box);
- $$("div", {
- "class": "U_Boom_O_O_C_Number",
- "innerText": U.Word.O.O.UpPageNum(Child),
- "style": { "width": "auto" }
- }, U_Boom_O_O_C_Box);
- };
- };
- };
- };
- }
- U.Word.O.O.Click = function (e) {
-
-
-
-
-
-
-
-
-
- switch (e) {
- case "一级目录":
- U.Word.O.O.NewTitle("U_Boom_O_O_25px_0");
- break;
- case "二级目录":
- U.Word.O.O.NewTitle("U_Boom_O_O_22px_40");
- break;
- case "三级目录":
- U.Word.O.O.NewTitle("U_Boom_O_O_20px_60");
- break;
- case "生成目录":
- U.Word.O.O.Load(U.D.Office.WI().$("#UD_SYQXR .U_Boom_CO_Editor_body_main_text")[0]);
- break;
- case "更新目录":
- U.Word.O.O.Load(null, 'update');
- break;
- case "正文":
- U.Word.O.O.NewTitle();
- break;
- default:
- break;
- }
- }
- U.Word.O.O.BindEle = function () {
-
- $(".U_Boom_O_O_F_Update").bind("mousedown", function () {
- U.Word.O.O.Load(null, 'update');
- });
-
- $("#K")[0].contentWindow.$("#UD_SYQXR").bind("click", function () {
- U.OU.R.CreateR();
- })
- }
- U.Word.O.O.NewTitle = function (className) {
- var UW = U.D.Office.WI();
- var div = $$("div", {
- "innerText": "请输入正文"
- }),
- inText = UW.U.OU.R.Parent().innerText || UW.U.OU.R.Parent().nodeValue;
- var NowDate = Date.parse(new Date());
- if (className) {
- div = $$("div", {
- "id": "T" + NowDate,
- "contenteditable": true,
- "class": className,
- "innerText": inText
- });
- };
-
- if (UW.U.OU.R.R.endContainer.nodeValue !== null) {
-
- if (UW.U.OU.R.GetSelectedText().trim() !== "" && className !== undefined) {
-
- if (UW.U.OU.R.R.endContainer.parentNode.id) {
- UW.U.OU.R.R.endContainer.parentNode.className = className;
- UW.U.OU.R.R.endContainer.parentNode.innerText = UW.U.OU.R.GetSelectedText();
- return
- };
- div.innerText = UW.U.OU.R.GetSelectedText();
- UW.U.OU.R.Replace(div);
- return;
- };
-
- if (UW.U.OU.R.Parent().nodeName === "DIV" && className !== undefined && UW.U.OU.R.GetSelectedText().trim() !== "") {
- UW.U.OU.R.Parent().id = "T" + NowDate;
- UW.U.OU.R.Parent().className = className;
- return;
- };
-
- if (UW.U.OU.R.Parent().parentNode.nodeName === "DIV" && className !== undefined && UW.U.OU.R.Parent().parentNode.id !== "UD_SYQXR") {
- UW.U.OU.R.Parent().parentNode.id = "T" + NowDate;
- UW.U.OU.R.Parent().parentNode.className = className;
- return;
- };
-
- if (UW.U.OU.R.Parent().parentNode.id && className === undefined) {
- UW.U.OU.R.Parent().parentNode.removeAttribute("id");
- UW.U.OU.R.Parent().parentNode.removeAttribute("class")
- return;
- };
- };
-
- if (UW.U.OU.R.R.endContainer.nodeValue === null && UW.U.OU.R.GetSelectedText().trim() === "" && className === undefined && UW.U.OU.R.Parent().id !== "UD_SYQXR") {
-
- UW.U.OU.R.R.endContainer.className = "";
- UW.U.OU.R.Replace("请输入正文");
- return
- };
-
- if (UW.U.OU.R.R.endContainer.nodeValue !== null && className === undefined) {
- UW.U.OU.R.R.endContainer.parentNode.className = "";
- return
- };
-
- if (div.innerText.trim() == "" && UW.U.OU.R.R.endContainer.nodeValue === null) {
- UW.U.OU.R.Replace("");
- return
- }
- UW.U.OU.R.Replace(div, UW.U.OU.R.QX());
- }
- U.Word.O.O.Read = function (dis, boolen) {
- var dis = dis || "none",
- boolen = boolen || 'false';
- var Wrap = $(".U_Boom_O_O_Content"),
- i = 0;
- $(".U_Boom_O_O_Features")[0].style.display = dis;
- for (; i < Wrap.length; i++) {
- Wrap[i].setAttribute('contenteditable', boolen)
- };
- }
- U.Word.O.O.UpPageNum = function (child) {
- var UW = U.D.Office.WI();
- var Paper = UW.$("#UD_SYQXR"),
- i = 0;
- for (; i < Paper.length; i++) {
- if (U.M.EISE(Paper[i], child)) {
- return ++i
- }
- };
- }
|