U.O.W.Navigation.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. /*
  2. 此js用来处理导航模板
  3. */
  4. Namespace.register("U.Office.N"); //导航模板命名空间
  5. //导航模板功能。原名U.O.W.Navigation,缩写:U.O.W.NV
  6. Namespace.register("U.O.W.NV");
  7. U.MD.O.Editable = false;
  8. //word打印
  9. if (U.MD.O.W && U.MD.O.W.Edit) {
  10. U.MD.O.W.Edit()
  11. }
  12. U.Office.N.Nav = 0;
  13. //初始化函数
  14. window.onload = function () {
  15. U.Office.N.load();
  16. }
  17. //初始化函数 初始化模板
  18. U.Office.N.load = function () {
  19. if (window.location.host != "www.1473.cn" && $("#navg")[0]) { //通过office生成站点处理
  20. $("div").addAttrArray({ "contentEditable": "false" });
  21. $("#navg&i").remove();
  22. }
  23. };
  24. /**
  25. *函数作用:判断是否添加导航
  26. *@姓名:廖志伟
  27. *@班级:14互联网G5-2班
  28. *@日期“2017-10-14
  29. */
  30. U.Office.N.isNavg = function () {
  31. if ($(".U_Boom_O_N_Navg_I").length > 0) { return };
  32. var e = event || window.event;
  33. var FirstTop = $(".U_MD_O_H_body_main_text")[0].offsetTop;
  34. var SecTop = $("#U_MD_O_W_E_body")[0].offsetTop;
  35. var FirstLeft = $(".U_MD_O_H_body_main_text")[0].offsetLeft;
  36. var SecLeft = $(".U_MD_F_S")[0].offsetLeft;
  37. var top = e.clientY - FirstTop - SecTop;
  38. var left = e.clientX - FirstLeft - SecLeft;
  39. //var left = event.x, top = event.y; //获取鼠标点击的位置
  40. U.UF.EV.stopBubble(); //阻止冒泡事件
  41. var i, a, m, g, U_Boom_O_N_C_Navg;
  42. source = event.srcElement; //获取事件源
  43. U_Boom_O_N_C_Navg = document.getElementsByClassName("U_Boom_O_N_C_Navg")[0]; //获取第一个导航栏
  44. i = $$("div", { "class": "U_Boom_O_N_Navg_I", "id": "U_Boom_O_N_Navg_Ib", "source": source, "style": { "left": left + "px", "top": top + "px"} }, U_Boom_O_N_C_Navg); //"source":source 获取上一级的事件源
  45. m = $$("div", { "class": "U_Boom_O_N_Navg_S", "innerHTML": "前面插入", "id": "U_Boom_O_N_Navg_S2", "onclick": function () { U.Office.N.AddNavg(1, source.parentElement); } }, i); //动态创建前面插入
  46. n = $$("div", { "class": "U_Boom_O_N_Navg_S", "innerHTML": "后面插入", "id": "U_Boom_O_N_Navg_S4", "onclick": function () { U.Office.N.AddNavg(2, source.parentElement); } }, i); //动态创建后面插入
  47. var U_Boom_O_N_Navg_I = $(".U_Boom_O_N_Navg_I")[0];
  48. U_Boom_O_N_Navg_I.style.display = "block";
  49. }
  50. /**
  51. *函数作用:移除插入导航
  52. *@姓名:廖志伟
  53. *@班级:14互联网G5-2班
  54. *@日期“2017-10-14
  55. */
  56. U.Office.N.noNavg = function () {
  57. $("#U_Boom_O_N_Navg_Ib").remove(); //移除插入导航
  58. $(".U_MD_O_H_body_main_text")[0].setAttribute('contenteditable', 'false'); //移除word编辑器自带的编辑效果
  59. var FirstNav = event.srcElement; //获取点击元素
  60. if (FirstNav.className == "U_Boom_O_N_C_Navg_Li_font") {//判断点击是否是导航栏
  61. FirstNav.onkeydown = function () {//键盘事件
  62. if (FirstNav.parentNode.parentNode.children[1]) {//判断点击元素是否有二级导航栏
  63. FirstNav.parentNode.parentNode.children[1].children[0].innerHTML = FirstNav.innerHTML; //改变二级导航栏的标题
  64. }
  65. }
  66. }
  67. }
  68. /**
  69. *函数作用:添加二级导航
  70. *@姓名:廖志伟
  71. *@班级:14互联网G5-2班
  72. *@日期“2017-10-14
  73. */
  74. U.Office.N.secNavg = function () {
  75. var daohangli = $(".U_Boom_O_N_C_Navg_Li"); //获取一级导航栏的第一个li
  76. for (var k = 0; k < daohangli.length; k++) {//循环遍历所有的一级导航
  77. var fontnav = event.srcElement.parentElement.parentElement.children[1].children[0].children[0].children; //获取每个导航的字体颜色
  78. if (fontnav[k].children[0].children[0].style.color == "rgb(255, 255, 255)") {//通过颜色判断是哪个一级导航获得焦点
  79. var navgbox1 = event.srcElement.parentElement.parentElement.children[1].children[0].children[0].children[k];
  80. //判断有没有二级导航,没有就创建,有就不允许创建
  81. if (navgbox1.children[1] == undefined) {//判断是否有二级导航
  82. var numli = $(".U_Boom_O_N_C_Navg_Li"); //获取所有的一级导航li
  83. var nav = event.srcElement.parentElement.parentElement.children[0].children[0]; //通过点击事件的事件源获取一级导航栏第一个导航
  84. var id2 = fontnav[k].id; //获取有焦点的一级导航的id
  85. var nav2html = fontnav[k].children[0].children[0].innerHTML; //获取取得的一级的内容
  86. var box1 = id2.split("_")[1]; //截取id的下标1的字符串
  87. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  88. var length = nav.parentNode.children.length + 1, //获取一级导航栏的长度,并且加一
  89. idnav2 = id2 + "_" + 1,
  90. length2 = nav.parentNode.children.length, //获取一级导航栏的长度
  91. cname = "U_Boom_O_N_C_Navg2_Li Navg_Li1_" + length, //给每一个导航的classname进行规律增加
  92. dname = "U_Boom_O_N_C_C_O Sub_Li1_" + length; //给每一个内容页面的classname进行规律增加
  93. //改变内容页距离顶部的高度
  94. contant.style.cssText = "margin-top:45px!important";
  95. var sub = $(".U_Boom_O_N_C_C_O"); //获取内容页面
  96. for (var j = 0; j < sub.length; j++) {
  97. sub[j].style.display = "none"; //隐藏所有内容页面
  98. }
  99. //内容页面
  100. //var contant = $("#U_Boom_O_N_C_Container"); //获取内容页面大的盒子
  101. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant); //动态创建内容页面,并且把前面定义的classname:dname加在这里
  102. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c); //动态创建内容页面
  103. //动态创建二级导航
  104. var Navgbox2, navg2, ul, ulnav, li, font, close, add, addnav, delnav, delimg, deltxt, daohang2;
  105. navg2 = $$("div", { "className": "U_Boom_O_N_C_Navg2" }, navgbox1); //动态穿件二级导航栏第二个盒子
  106. ulnav = $$("div", { "className": "U_Boom_O_N_C_Navg_Ul_Nav", "innerHTML": nav2html }, navg2);
  107. delnav = $$("div", { "className": "U_Boom_O_N_C_Navg_Ul_Nav_Del", "title": "删除整体子级导航栏",
  108. "onclick": [[U.Office.N.delsecNavg]] }, navg2); //U.Office.N.delsecNavg点击事件,删除所有子导航
  109. delimg = $$("div", { "className": "U_Boom_O_N_C_Navg_Del_Img" }, delnav);
  110. ul = $$("div", { "className": "U_Boom_O_N_C_Navg2_ul" }, navg2);
  111. li = $$("div", { "className": cname, "id": idnav2 }, ul); //U.Office.N.ChangeNavg, [c]点击事件,切换导航,参数c为创建的内容页,便于切换
  112. daohang2 = $$("div", { "className": "U_Boom_O_N_Navg_Ul_daohang2" }, li);
  113. font = $$("div", { "className": "U_Boom_O_N_C_Navg_Li_font", "contenteditable": "true", "innerHTML": "二级导航一", "style": { "color": "#fff" },
  114. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang2);
  115. close = $$("div", { "className": "U_Boom_O_N_C_N_Close", "title": "删除",
  116. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang2); //U.Office.N.DeleteNavg, [c]点击事件,删除一个导航和该导航对应的内容页
  117. add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  118. "onclick": [[U.Office.N.isNavg]] }, daohang2); //U.Office.N.isNavg点击事件,是否添加导航
  119. addnav = $$("div", { "className": "U_Boom_O_N_C_Navg_Ul_Nav_Add", "title": "创建三级导航栏",
  120. "onclick": [[U.Office.N.thirdNavg]] }, navg2); //U.Office.N.thirdNavg点击事件,添加三级导航
  121. addtxt = $$("div", { "className": "U_Boom_O_N_C_Navg_Add_Txt", "title": "创建三级导航栏", "innerHTML": "添加" }, addnav);
  122. U.alert("添加成功");
  123. } else {
  124. U.UF.UI.confirm("已创建二级导航,请勿多次创建!");
  125. }
  126. }
  127. }
  128. }
  129. /**
  130. *函数作用:添加三级导航
  131. *@姓名:廖志伟
  132. *@班级:14互联网G5-2班
  133. *@日期“2017-10-14
  134. */
  135. U.Office.N.thirdNavg = function () {
  136. var daohangli2 = event.srcElement.parentElement.parentElement.children[2].children; //通过点击事件的事件源获取二级导航的li
  137. for (var k = 0; k < daohangli2.length; k++) {//判断
  138. var thirdbox = daohangli2[k];
  139. var fontnav2 = thirdbox.children[0].children[0]; //获取字体
  140. if (fontnav2.style.color == "rgb(255, 255, 255)") {
  141. var nav = event.srcElement.parentElement.parentElement.children[3].children[0];
  142. var thirdnav = event.srcElement.parentElement.parentElement.children[2].children[k].children[1];
  143. if (thirdnav == undefined) {
  144. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  145. var id3 = fontnav2.parentNode.parentNode.id; //通过点击事件事件源获取二级导航的li的id
  146. var idnav3 = id3.substring(0, 7) + "_" + 1;
  147. var box1 = id3.substring(4, 6); //substring(开始点,终止点) 截取字符串
  148. var length = nav.parentElement.parentElement.children[2].children.length + 1,
  149. cname = "U_Boom_O_N_C_Navg2_Li Navg_Li2_" + length,
  150. dname = "U_Boom_O_N_C_C_O Sub_Li2_" + length;
  151. //改变内容页距离顶部的高度
  152. contant.style.cssText = "margin-top:90px!important";
  153. //隐藏所有的内容页
  154. var sub = $(".U_Boom_O_N_C_C_O");
  155. for (var j = 0; j < sub.length; j++) {
  156. sub[j].style.display = "none";
  157. }
  158. //动态创建内容页面
  159. //var contant = $("#U_Boom_O_N_C_Container")[0];
  160. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant);
  161. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c);
  162. //动态创建三级导航
  163. var Navg3, ul, li, font, close, add, daohang3;
  164. Navg3 = $$("div", { "className": "U_Boom_O_N_C_Navg3" }, thirdbox);
  165. ul = $$("div", { "className": "U_Boom_O_N_C_Navg3_ul" }, Navg3);
  166. li = $$("div", { "className": cname, "id": idnav3 }, ul);
  167. daohang3 = $$("div", { "className": "U_Boom_O_N_Navg_Ul_daohang2 U_Boom_O_N_Navg_Ul_daohang3" }, li);
  168. font = $$("div", { "className": "U_Boom_O_N_C_Navg_Li_font", "contenteditable": "true", "innerHTML": "三级导航一", "style": { "color": "#fff" },
  169. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang3);
  170. close = $$("div", { "className": "U_Boom_O_N_C_N_Close",
  171. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang3);
  172. add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  173. "onclick": [[U.Office.N.isNavg]] }, daohang3);
  174. U.alert("添加成功");
  175. } else {
  176. U.UF.UI.confirm("已创建三级导航,请勿多次创建!");
  177. }
  178. }
  179. }
  180. }
  181. /**
  182. *函数作用:添加导航
  183. *@姓名:廖志伟
  184. *@班级:14互联网G5-2班
  185. *@日期“2017-10-14
  186. */
  187. U.Office.N.AddNavg = function (n, El) {
  188. var U_Boom_O_N_C_Navg_Ul = $("#U_Boom_O_N_C_Navg_Ul")[0]; //获取一级导航栏
  189. var nav = $(".U_Boom_O_N_C_Navg_Li")[0];
  190. var U_Boom_O_N_C_Navg_Ul2 = El.parentElement; //获取事件源的ul盒子
  191. var nav2 = El.parentElement; //获取二级或三级的li
  192. var daohangli = $(".U_Boom_O_N_C_Navg_Li");
  193. switch (n) {
  194. case 1: U.Office.N.beforeNavg(U_Boom_O_N_C_Navg_Ul, U_Boom_O_N_C_Navg_Ul2, nav, nav2, nav2.id); break;
  195. case 2: U.Office.N.belastNavg(U_Boom_O_N_C_Navg_Ul, U_Boom_O_N_C_Navg_Ul2, nav, nav2, nav2.id); break;
  196. }
  197. }
  198. /**
  199. *函数作用:添加导航————向前插入
  200. *@姓名:廖志伟
  201. *@班级:14互联网G5-2班
  202. *@日期“2017-10-14
  203. */
  204. U.Office.N.beforeNavg = function (U_Boom_O_N_C_Navg_Ul, U_Boom_O_N_C_Navg_Ul2, nav, nav2, id2) {
  205. var ul2 = $(".U_Boom_O_N_C_Navg2_ul");
  206. var ul3 = $(".U_Boom_O_N_C_Navg3_ul");
  207. if (event.srcElement.parentNode.source.parentNode.parentNode.parentNode == U_Boom_O_N_C_Navg_Ul) {//判断点击的插入是否在一级导航栏
  208. U.alert("插入成功");
  209. var length = nav.parentNode.children.length + 1,
  210. cname = "U_Boom_O_N_C_Navg_Li Navg_Li_" + length,
  211. dname = "U_Boom_O_N_C_C_O Sub_Li_" + length,
  212. idnav = "Nav_" + length;
  213. //隐藏所有的内容页面
  214. var sub = $(".U_Boom_O_N_C_C_O");
  215. for (var j = 0; j < sub.length; j++) {
  216. sub[j].style.display = "none";
  217. }
  218. //内容页面
  219. var contant = $("#U_Boom_O_N_C_Container")[0];
  220. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant);
  221. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c);
  222. //清除所有字体颜色
  223. var dh = $("#U_Boom_O_N_C_Navg_Ul")[0].children;
  224. for (var i = 0; i < dh.length; i++) {
  225. dh[i].children[0].children[0].style.color = "#000";
  226. }
  227. //清除所有的背景颜色
  228. for (var d = 0; d < dh.length; d++) {
  229. dh[d].children[0].style.backgroundColor = "#dadde2";
  230. }
  231. //隐藏二级导航
  232. var U_Boom_O_N_C_Navg2 = $(".U_Boom_O_N_C_Navg2");
  233. for (var a = 0; a < U_Boom_O_N_C_Navg2.length; a++) {
  234. U_Boom_O_N_C_Navg2[a].style.display = "none";
  235. }
  236. //改变内容页距离顶部的高度
  237. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  238. contant.style.cssText = "margin-top:-25px!important";
  239. //导航创建
  240. var li = $$("div", { "className": cname, "style": { "display": "block" }, "id": idnav }, U_Boom_O_N_C_Navg_Ul);
  241. var daohang = $$("div", { "className": "U_Boom_O_N_C_Navg_Ul_daohang" }, li)
  242. var navg = $$("div", { "class": "U_Boom_O_N_C_Navg_Li_font", "contentEditable": "true", "innerHTML": "新增导航", "style": { "color": "#fff" },
  243. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang);
  244. var i = $$("div", { "className": "U_Boom_O_N_C_N_Close", "title": "删除",
  245. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang);
  246. var add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  247. "onclick": [[U.Office.N.isNavg]] }, daohang)
  248. var sou = event.srcElement.parentNode.source.parentNode.parentNode; //获取事件源
  249. var event_source = sou; //获取事件源
  250. nav.parentNode.insertBefore(li, event_source); //向点击的导航的前面新建一个导航
  251. }
  252. for (var u = 0; u < ul2.length; u++) {
  253. if (event.srcElement.parentNode.source.parentNode.parentNode.parentNode == ul2[u]) {//判断是否为二级导航栏的ul
  254. U.alert("插入成功");
  255. var length = nav2.parentNode.children.length + 1,
  256. cname = "U_Boom_O_N_C_Navg2_Li Navg_Li1_" + length,
  257. dname = "U_Boom_O_N_C_C_O Sub_Li1_" + length,
  258. idnav2 = id2.substring(0, 5) + "_" + length;
  259. //隐藏所有的内容页面
  260. var sub = $(".U_Boom_O_N_C_C_O");
  261. for (var j = 0; j < sub.length; j++) {
  262. sub[j].style.display = "none";
  263. }
  264. //内容页面
  265. var contant = $("#U_Boom_O_N_C_Container")[0];
  266. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant);
  267. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c);
  268. //清除所有字体颜色
  269. var dh = ul2[u].children;
  270. for (var a = 0; a < dh.length; a++) {
  271. dh[a].children[0].children[0].style.color = "#656f83";
  272. }
  273. //清除所有的背景颜色
  274. for (var d = 0; d < dh.length; d++) {
  275. dh[d].children[0].style.backgroundColor = "#efefef";
  276. }
  277. //改变内容页距离顶部的高度
  278. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  279. contant.style.cssText = "margin-top:45px!important";
  280. //清除三级导航
  281. var U_Boom_O_N_C_Navg3 = $(".U_Boom_O_N_C_Navg3");
  282. for (var b = 0; b < U_Boom_O_N_C_Navg3.length; b++) {
  283. U_Boom_O_N_C_Navg3[b].style.display = "none";
  284. }
  285. //导航创建
  286. var li = $$("div", { "className": cname, "style": { "display": "block" }, "id": idnav2 }, U_Boom_O_N_C_Navg_Ul2);
  287. var daohang2 = $$("div", { "className": "U_Boom_O_N_Navg_Ul_daohang2" }, li)
  288. var navg = $$("div", { "class": "U_Boom_O_N_C_Navg_Li_font", "contentEditable": "true", "innerHTML": "新增子级导航", "style": { "color": "#fff" },
  289. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang2);
  290. var i = $$("div", { "className": "U_Boom_O_N_C_N_Close", "title": "删除",
  291. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang2);
  292. var add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  293. "onclick": [[U.Office.N.isNavg]] }, daohang2)
  294. var sou = event.srcElement.parentNode.source.parentNode.parentNode; //获取事件源
  295. var event_source = sou;
  296. nav2.parentNode.insertBefore(li, event_source); //向点击的导航的前面新建一个导航
  297. }
  298. }
  299. for (var l = 0; l < ul3.length; l++) {
  300. if (event.srcElement.parentNode.source.parentNode.parentNode.parentNode == ul3[l]) {//判断是否是三级导航的ul
  301. U.alert("插入成功");
  302. var length = nav2.parentNode.children.length + 1,
  303. cname = "U_Boom_O_N_C_Navg2_Li Navg_Li2_" + length,
  304. dname = "U_Boom_O_N_C_C_O Sub_Li2_" + length,
  305. idnav3 = id2.substring(0, 7) + "_" + length;
  306. //隐藏所有的内容页面
  307. var sub = $(".U_Boom_O_N_C_C_O");
  308. for (var j = 0; j < sub.length; j++) {
  309. sub[j].style.display = "none";
  310. }
  311. //内容页面
  312. var contant = $("#U_Boom_O_N_C_Container")[0];
  313. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant);
  314. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c);
  315. //清除所有字体颜色
  316. var dh = ul3[l].children;
  317. for (var a = 0; a < dh.length; a++) {
  318. dh[a].children[0].children[0].style.color = "#656f83";
  319. }
  320. //清除所有的背景颜色
  321. for (var d = 0; d < dh.length; d++) {
  322. dh[d].children[0].style.backgroundColor = "#efefef";
  323. }
  324. //导航创建
  325. var li = $$("div", { "className": cname, "style": { "display": "block" }, "id": idnav3 }, U_Boom_O_N_C_Navg_Ul2);
  326. var daohang3 = $$("div", { "className": "U_Boom_O_N_Navg_Ul_daohang2 U_Boom_O_N_Navg_Ul_daohang3" }, li)
  327. var navg = $$("div", { "class": "U_Boom_O_N_C_Navg_Li_font", "contentEditable": "true", "innerHTML": "新增子级导航", "style": { "color": "#fff" },
  328. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang3);
  329. var i = $$("div", { "className": "U_Boom_O_N_C_N_Close", "title": "删除",
  330. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang3);
  331. var add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  332. "onclick": [[U.Office.N.isNavg]] }, daohang3)
  333. var sou = event.srcElement.parentNode.source.parentNode.parentNode; //获取事件源
  334. var event_source = sou;
  335. nav2.parentNode.insertBefore(li, event_source); //向点击的导航的前面新建一个导航
  336. }
  337. }
  338. }
  339. /**
  340. *函数作用:添加导航————向后插入
  341. *@姓名:廖志伟
  342. *@班级:14互联网G5-2班
  343. *@日期“2017-10-14
  344. */
  345. U.Office.N.belastNavg = function (U_Boom_O_N_C_Navg_Ul, U_Boom_O_N_C_Navg_Ul2, nav, nav2, id2) {
  346. var ul2 = $(".U_Boom_O_N_C_Navg2_ul");
  347. var ul3 = $(".U_Boom_O_N_C_Navg3_ul");
  348. if (event.srcElement.parentNode.source.parentNode.parentNode.parentNode == U_Boom_O_N_C_Navg_Ul) {//判断点击的插入是否在一级导航栏
  349. U.alert("插入成功");
  350. var length = nav.parentNode.children.length + 1,
  351. cname = "U_Boom_O_N_C_Navg_Li Navg_Li_" + length,
  352. dname = "U_Boom_O_N_C_C_O Sub_Li_" + length,
  353. idnav = "Nav_" + length;
  354. //隐藏所有的内容页
  355. var sub = $(".U_Boom_O_N_C_C_O");
  356. for (var j = 0; j < sub.length; j++) {
  357. sub[j].style.display = "none";
  358. }
  359. //内容页面
  360. var contant = $("#U_Boom_O_N_C_Container")[0];
  361. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant);
  362. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c);
  363. //清除所有字体颜色
  364. var dh = $("#U_Boom_O_N_C_Navg_Ul")[0].children;
  365. for (var i = 0; i < dh.length; i++) {
  366. dh[i].children[0].children[0].style.color = "#000";
  367. }
  368. //清除所有的背景颜色
  369. for (var d = 0; d < dh.length; d++) {
  370. dh[d].children[0].style.backgroundColor = "#dadde2";
  371. }
  372. //改变内容页距离顶部的高度
  373. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  374. contant.style.cssText = "margin-top:-25px!important";
  375. //清除二级导航
  376. var U_Boom_O_N_C_Navg2 = $(".U_Boom_O_N_C_Navg2");
  377. for (var a = 0; a < U_Boom_O_N_C_Navg2.length; a++) {
  378. U_Boom_O_N_C_Navg2[a].style.display = "none";
  379. }
  380. //导航创建
  381. var li = $$("div", { "className": cname, "style": { "display": "block" }, "id": idnav }, U_Boom_O_N_C_Navg_Ul);
  382. var daohang = $$("div", { "className": "U_Boom_O_N_C_Navg_Ul_daohang" }, li)
  383. var navg = $$("div", { "class": "U_Boom_O_N_C_Navg_Li_font", "contentEditable": "true", "innerHTML": "新增导航", "style": { "color": "#fff" },
  384. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang);
  385. var i = $$("div", { "className": "U_Boom_O_N_C_N_Close", "title": "删除",
  386. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang);
  387. var add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  388. "onclick": [[U.Office.N.isNavg]] }, daohang)
  389. var sou = event.srcElement.parentNode.source.parentNode.parentNode; //获取事件源
  390. var event_source = sou; //获取事件源
  391. nav.parentNode.insertBefore(li, event_source.nextSibling); //向点击的导航的前面新建一个导航
  392. }
  393. for (var u = 0; u < ul2.length; u++) {
  394. if (event.srcElement.parentNode.source.parentNode.parentNode.parentNode == ul2[u]) {//判断是否为二级导航栏的ul
  395. U.alert("插入成功");
  396. var length = nav2.parentNode.children.length + 1,
  397. cname = "U_Boom_O_N_C_Navg2_Li Navg_Li1_" + length,
  398. dname = "U_Boom_O_N_C_C_O Sub_Li1_" + length,
  399. idnav2 = id2.substring(0, 5) + "_" + length;
  400. var sub = $(".U_Boom_O_N_C_C_O");
  401. for (var j = 0; j < sub.length; j++) {
  402. sub[j].style.display = "none";
  403. }
  404. //内容页面
  405. var contant = $("#U_Boom_O_N_C_Container")[0];
  406. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant);
  407. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c);
  408. //清除所有字体颜色
  409. var dh = ul2[u].children;
  410. for (var a = 0; a < dh.length; a++) {
  411. dh[a].children[0].children[0].style.color = "#656f83";
  412. }
  413. //清除所有的背景颜色
  414. for (var d = 0; d < dh.length; d++) {
  415. dh[d].children[0].style.backgroundColor = "#efefef";
  416. }
  417. //清除三级导航
  418. var U_Boom_O_N_C_Navg3 = $(".U_Boom_O_N_C_Navg3");
  419. for (var b = 0; b < U_Boom_O_N_C_Navg3.length; b++) {
  420. U_Boom_O_N_C_Navg3[b].style.display = "none";
  421. }
  422. //改变内容页距离顶部的高度
  423. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  424. contant.style.cssText = "margin-top:45px!important";
  425. //导航创建
  426. var li = $$("div", { "className": cname, "style": { "display": "block" }, "id": idnav2 }, U_Boom_O_N_C_Navg_Ul2);
  427. var daohang2 = $$("div", { "className": "U_Boom_O_N_Navg_Ul_daohang2" }, li)
  428. var navg = $$("div", { "class": "U_Boom_O_N_C_Navg_Li_font", "contentEditable": "true", "innerHTML": "新增子级导航", "style": { "color": "#fff" },
  429. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang2);
  430. var i = $$("div", { "className": "U_Boom_O_N_C_N_Close", "title": "删除",
  431. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang2);
  432. var add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  433. "onclick": [[U.Office.N.isNavg]] }, daohang2)
  434. var sou = event.srcElement.parentNode.source.parentNode.parentNode; //获取事件源
  435. var event_source = sou;
  436. nav2.parentNode.insertBefore(li, event_source.nextSibling); //向点击的导航的前面新建一个导航
  437. }
  438. }
  439. for (var l = 0; l < ul3.length; l++) {
  440. if (event.srcElement.parentNode.source.parentNode.parentNode.parentNode == ul3[l]) {//判断是否是三级导航的ul
  441. U.alert("插入成功");
  442. var length = nav2.parentNode.children.length + 1,
  443. cname = "U_Boom_O_N_C_Navg2_Li Navg_Li2_" + length,
  444. dname = "U_Boom_O_N_C_C_O Sub_Li2_" + length,
  445. idnav3 = id2.substring(0, 7) + "_" + length;
  446. var sub = $(".U_Boom_O_N_C_C_O");
  447. for (var j = 0; j < sub.length; j++) {
  448. sub[j].style.display = "none";
  449. }
  450. //内容页面
  451. var contant = $("#U_Boom_O_N_C_Container")[0];
  452. var c = $$("div", { "className": dname, "tebindex": "0", "hidefocus": "true", "contenteditable": "true", "type": "1" }, contant);
  453. var cont = $$("div", { "innerHTML": "请在此处添加内容..." }, c);
  454. //清除所有字体颜色
  455. var dh = ul3[l].children;
  456. for (var a = 0; a < dh.length; a++) {
  457. dh[a].children[0].children[0].style.color = "#656f83";
  458. }
  459. //清除所有的背景颜色
  460. for (var d = 0; d < dh.length; d++) {
  461. dh[d].children[0].style.backgroundColor = "#efefef";
  462. }
  463. //导航创建
  464. var li = $$("div", { "className": cname, "style": { "display": "block" }, "id": idnav3 }, U_Boom_O_N_C_Navg_Ul2);
  465. var daohang3 = $$("div", { "className": "U_Boom_O_N_Navg_Ul_daohang2 U_Boom_O_N_Navg_Ul_daohang3" }, li)
  466. var navg = $$("div", { "class": "U_Boom_O_N_C_Navg_Li_font", "contentEditable": "true", "innerHTML": "新增子级导航", "style": { "color": "#fff" },
  467. "onclick": function () { U.Office.N.ChangeNavg(c); } }, daohang3);
  468. var i = $$("div", { "className": "U_Boom_O_N_C_N_Close", "title": "删除",
  469. "onclick": function () { U.Office.N.DeleteNavg(this, c); } }, daohang3);
  470. var add = $$("div", { "className": "U_Boom_O_N_C_N_AddNav", "title": "编辑",
  471. "onclick": [[U.Office.N.isNavg]] }, daohang3)
  472. var sou = event.srcElement.parentNode.source.parentNode.parentNode; //获取事件源
  473. var event_source = sou;
  474. nav2.parentNode.insertBefore(li, event_source.nextSibling); //向点击的导航的前面新建一个导航
  475. }
  476. }
  477. }
  478. /**
  479. *函数作用:导航切换
  480. *@姓名:廖志伟
  481. *@班级:14互联网G5-2班
  482. *@日期“2017-10-14
  483. */
  484. U.Office.N.ChangeNavg = function (Ele) {
  485. var sub = $(".U_Boom_O_N_C_C_O"); //获取内容页面
  486. var del = event.srcElement; //获取事件源
  487. var delnavg = del.parentNode; //获取点击事件的父级元素
  488. //var dh = $(".U_Boom_O_N_C_Navg_Ul_daohang");
  489. var dh1 = $(".U_Boom_O_N_Navg_Ul_daohang2");
  490. var fontcolor = $(".U_Boom_O_N_C_Navg_Li_font");
  491. var ifnavid = $("#U_Boom_O_N_C_Navg_Ul")[0].id; //获取一级导航栏的id
  492. type = 1;
  493. //隐藏所有的内容页
  494. for (var i = 0; i < sub.length; i++) {
  495. sub[i].style.display = "none";
  496. }
  497. $(Ele)[0].style.display = "block"; //点击的导航栏对应的页面显示
  498. //一级导航切换
  499. if (event.srcElement.parentElement.parentElement.parentElement.id == ifnavid) {
  500. var dh = $("#U_Boom_O_N_C_Navg_Ul")[0].children;
  501. for (var h = 0; h < dh1.length; h++) {
  502. dh1[h].style.backgroundColor = "#efefef";
  503. dh1[h].children[0].style.color = "#656f83";
  504. }
  505. for (var d = 0; d < dh.length; d++) {
  506. dh[d].children[0].style.backgroundColor = "#dadde2";
  507. }
  508. delnavg.style.backgroundColor = "#000"
  509. for (var f = 0; f < dh.length; f++) {
  510. dh[f].children[0].children[0].style.color = "#000";
  511. }
  512. del.style.color = "#fff";
  513. var secnav = event.srcElement.parentElement.parentElement.children[1];
  514. var Navg2 = $(".U_Boom_O_N_C_Navg2");
  515. for (var n = 0; n < Navg2.length; n++) {
  516. Navg2[n].style.display = "none";
  517. }
  518. //改变内容页距离顶部的高度
  519. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  520. var type = contant.children;
  521. contant.style.cssText = "margin-top:-25px!important";
  522. if (secnav != undefined) {//判断是否有二级导航栏
  523. secnav.style.display = "block";
  524. var secnav1 = secnav.children[2].children;
  525. for (var s = 0; s < secnav1.length; s++) {
  526. if (secnav1[s].children[1] != undefined) {
  527. secnav1[s].children[1].style.display = "none";
  528. }
  529. }
  530. for (var c = 0; c < type.length; c++) {
  531. if (type[c].type == 1) {
  532. contant.style.cssText = "margin-top:45px!important";
  533. } else if (type[c].type == 2) {
  534. contant.style.cssText = "margin-top:-25px!important";
  535. }
  536. }
  537. }
  538. }
  539. //二级导航切换
  540. var secid = $(".U_Boom_O_N_C_Navg2");
  541. for (var s = 0; s < secid.length; s++) {
  542. if (event.srcElement.parentElement.parentElement.parentElement.parentElement.className == secid[s].className) {
  543. var dh = secid[s].children[2].children;
  544. for (var d = 0; d < dh.length; d++) {
  545. dh[d].children[0].style.backgroundColor = "#efefef";
  546. }
  547. delnavg.style.backgroundColor = "#000"
  548. for (var f = 0; f < dh.length; f++) {
  549. dh[f].children[0].children[0].style.color = "#656f83";
  550. }
  551. del.style.color = "#fff";
  552. var thirdnav = event.srcElement.parentElement.parentElement.children[1];
  553. var Navg3 = $(".U_Boom_O_N_C_Navg3");
  554. for (var a = 0; a < Navg3.length; a++) {
  555. Navg3[a].style.display = "none";
  556. }
  557. //改变内容页距离顶部的高度
  558. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  559. var type = contant.children;
  560. for (var t = 0; t < type.length; t++) {
  561. if (type[t].type == 1) {
  562. contant.style.cssText = "margin-top:45px!important";
  563. } else if (type[t].type == 2) {
  564. contant.style.cssText = "margin-top:-25px!important";
  565. }
  566. }
  567. if (thirdnav != undefined) {
  568. thirdnav.style.display = "block";
  569. for (var y = 0; y < type.length; y++) {
  570. if (type[y].type == 1) {
  571. contant.style.cssText = "margin-top:90px!important";
  572. } else if (type[y].type == 2) {
  573. contant.style.cssText = "margin-top:-25px!important";
  574. }
  575. }
  576. }
  577. var thili = $(".U_Boom_O_N_Navg_Ul_daohang3");
  578. for (var j = 0; j < thili.length; j++) {
  579. thili[j].style.backgroundColor = "#efefef";
  580. thili[j].children[0].style.color = "#656f83";
  581. }
  582. var firli = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children;
  583. var firli1 = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children;
  584. for (var i = 0; i < firli1.length; i++) {
  585. firli1[i].children[0].style.backgroundColor = "#dadde2";
  586. firli1[i].children[0].children[0].style.color = "#000";
  587. }
  588. firli[0].style.backgroundColor = "#000";
  589. firli[0].children[0].style.color = "#fff";
  590. }
  591. }
  592. //三级导航切换
  593. var thirdid = $(".U_Boom_O_N_C_Navg3");
  594. for (var t = 0; t < thirdid.length; t++) {
  595. if (event.srcElement.parentElement.parentElement.parentElement.parentElement.className == thirdid[t].className) {
  596. var dh = thirdid[t].children[0].children;
  597. for (var d = 0; d < dh.length; d++) {
  598. dh[d].children[0].style.backgroundColor = "#efefef";
  599. }
  600. delnavg.style.backgroundColor = "#000"
  601. for (var f = 0; f < dh.length; f++) {
  602. dh[f].children[0].children[0].style.color = "#656f83";
  603. }
  604. del.style.color = "#fff";
  605. var secli = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.children;
  606. var secli1 = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children;
  607. for (var i = 0; i < secli1.length; i++) {
  608. secli1[i].children[0].style.backgroundColor = "#efefef";
  609. secli1[i].children[0].children[0].style.color = "#656f83"
  610. }
  611. secli[0].style.backgroundColor = "#000";
  612. secli[0].children[0].style.color = "#fff";
  613. var thrli = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children;
  614. var thrli1 = event.srcElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children;
  615. for (var j = 0; j < thrli1.length; j++) {
  616. thrli1[j].children[0].style.backgroundColor = "#dadde2";
  617. thrli1[j].children[0].children[0].style.color = "#000";
  618. }
  619. thrli[0].style.backgroundColor = "#000";
  620. thrli[0].children[0].style.color = "#fff";
  621. //改变内容页距离顶部的高度
  622. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  623. var type = contant.children;
  624. for (var t = 0; t < type.length; t++) {
  625. if (type[t].type == 1) {
  626. contant.style.cssText = "margin-top:90px!important";
  627. } else if (type[t].type == 2) {
  628. contant.style.cssText = "margin-top:-25px!important";
  629. }
  630. }
  631. }
  632. }
  633. }
  634. /**
  635. *函数作用:删除导航
  636. *@姓名:廖志伟
  637. *@班级:14互联网G5-2班
  638. *@日期“2017-10-14
  639. */
  640. U.Office.N.DeleteNavg = function (e, Ele) {
  641. U.UF.EV.stopBubble(); //组织冒泡事件
  642. if (U.Office.N.DeleteNavg.Que.Q) {
  643. U.Office.N.DeleteNavg.Que(e, Ele);
  644. U.Office.N.DeleteNavg.Que.Q = false;
  645. }
  646. else {
  647. U.UF.UI.confirm("您确定要删除已编辑的导航吗?", function () {
  648. U.Office.N.DeleteNavg.Que(e, Ele);
  649. });
  650. }
  651. }
  652. /**
  653. *函数作用:删除导航弹窗
  654. *@姓名:廖志伟
  655. *@班级:14互联网G5-2班
  656. *@日期:2017-10-24
  657. */
  658. U.Office.N.DeleteNavg.Que = function (e, Ele) {
  659. var length = e.parentElement.parentElement.parentElement.children.length; //获取点击删除按钮后获取的事件源的长度
  660. var ul1 = e.parentElement.parentElement.parentElement.id;
  661. var ul2 = e.parentElement.parentElement.parentElement.parentElement.className;
  662. var ulnav1 = $("#U_Boom_O_N_C_Navg_Ul")[0].id;
  663. var delnavg = e.parentNode.parentNode;
  664. //判断一级导航
  665. if (ul1 == ulnav1) {
  666. if (length > 1) {//判断是否是最后一个导航
  667. var Navg_ul = $(delnavg.parentNode.children).last()[0];
  668. if (Navg_ul == delnavg) {
  669. U.alert("删除成功");
  670. $(Ele)[0].remove();
  671. $(delnavg)[0].remove();
  672. var Navg_ul_last = $("#U_Boom_O_N_C_Navg_Ul")[0];
  673. var Navg_last = $(Navg_ul_last.children).last()[0].children[0];
  674. Navg_last.click(); //重新执行一边点击事件
  675. } else {
  676. var Navg_next = $(delnavg).next()[0].children[0];
  677. U.alert("删除成功");
  678. $(Ele)[0].remove();
  679. $(delnavg)[0].remove();
  680. Navg_next.click(); //重新执行
  681. }
  682. }
  683. //改变内容页距离顶部的高度
  684. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  685. contant.style.cssText = "margin-top:-25px!important";
  686. } else {
  687. var ulnav2 = $(".U_Boom_O_N_C_Navg2")[0].className;
  688. //判断二级导航
  689. if (ul2 == ulnav2) {
  690. if (length > 1) {//判断是否是最后一个导航
  691. var Navg_ul = $(delnavg.parentNode.children).last()[0];
  692. //判断点击时是否是最后一个的导航
  693. if (Navg_ul == delnavg) {
  694. U.alert("删除成功");
  695. $(Ele)[0].remove();
  696. $(delnavg)[0].remove();
  697. var Navg_ul_last = $(".U_Boom_O_N_C_Navg2")[0].children[2];
  698. var Navg_last = $(Navg_ul_last.children).last()[0].children[0];
  699. Navg_last.click(); //重新执行一边点击事件
  700. } else {
  701. U.alert("删除成功");
  702. var Navg_next = $(delnavg).next()[0].children[0];
  703. $(Ele)[0].remove();
  704. $(delnavg)[0].remove();
  705. Navg_next.click(); //重新执行
  706. }
  707. } else {
  708. var nav2del = e.parentElement.parentElement.parentElement.parentElement;
  709. var nav1first = e.parentElement.parentElement.parentElement.parentElement.parentElement.children[0].children[0];
  710. U.alert("删除成功");
  711. $(Ele)[0].remove();
  712. $(delnavg)[0].remove();
  713. nav2del.remove();
  714. nav1first.click();
  715. //改变内容页距离顶部的高度
  716. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  717. contant.style.cssText = "margin-top:-25px!important";
  718. }
  719. }
  720. else {
  721. if (length > 1) {//判断是否是最后一个导航
  722. var Navg_ul = $(delnavg.parentNode.children).last()[0];
  723. if (Navg_ul == delnavg) {
  724. U.alert("删除成功");
  725. $(Ele)[0].remove();
  726. $(delnavg)[0].remove();
  727. var Navg_ul_last = $(".U_Boom_O_N_C_Navg3")[0].children[0];
  728. var Navg_last = $(Navg_ul_last.children).last()[0].children[0];
  729. Navg_last.click(); //重新执行一边点击事件
  730. } else {
  731. U.alert("删除成功");
  732. var Navg_next = $(delnavg).next()[0].children[0];
  733. $(Ele)[0].remove();
  734. $(delnavg)[0].remove();
  735. Navg_next.click(); //重新执行
  736. }
  737. } else {
  738. var nav3del = e.parentElement.parentElement.parentElement.parentElement;
  739. var nav2first = e.parentElement.parentElement.parentElement.parentElement.parentElement.children[0].children[0];
  740. U.alert("删除成功");
  741. $(Ele)[0].remove();
  742. $(delnavg)[0].remove();
  743. nav3del.remove();
  744. nav2first.click();
  745. //改变内容页距离顶部的高度
  746. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  747. contant.style.cssText = "margin-top:45px!important";
  748. }
  749. }
  750. }
  751. }
  752. /**
  753. *函数作用:删除子导航
  754. *@姓名:廖志伟
  755. *@班级:14互联网G5-2班
  756. *@日期“2017-10-14
  757. */
  758. U.Office.N.delsecNavg = function () {
  759. var delnavg = event.srcElement.parentElement.parentElement;
  760. var navfirst = delnavg.parentElement.children[0].children[0];
  761. U.Que = function () {
  762. var deletenav1 = delnavg.children[2].children;
  763. for (var d = 0; d < deletenav1.length; d++) {
  764. var delthird = deletenav1[d].children[1];
  765. if (delthird != undefined) {
  766. var deletenav2 = deletenav1[d].children[1].children[0].children;
  767. for (var i = 0; i < deletenav2.length; i++) {
  768. this.i = i;
  769. U.Office.N.DeleteNavg.Que.Q = true;
  770. deletenav2[this.i].children[0].children[1].click();
  771. }
  772. }
  773. this.d = d;
  774. U.Office.N.DeleteNavg.Que.Q = true;
  775. deletenav1[this.d].children[0].children[1].click();
  776. }
  777. U.alert("删除成功");
  778. delnavg.remove();
  779. navfirst.click();
  780. };
  781. U.UF.UI.confirm("您确定要删除所有已编辑的子导航吗?", function () { U.Que(); });
  782. //改变内容页距离顶部的高度
  783. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  784. contant.style.cssText = "margin-top:7px!important";
  785. }
  786. /**
  787. *函数作用:插入logo和二维码
  788. *@姓名:廖志伟
  789. *@班级:14互联网G5-2班
  790. *@日期“2017-10-14
  791. */
  792. U.Office.N.Insertpic = function (n) {
  793. var input = event.srcElement;
  794. switch (n) {
  795. case 1: U.Office.N.Headlogo(input); break;
  796. case 2: U.Office.N.Footlogo(input); break;
  797. case 3: U.Office.N.Twocode(input); break;
  798. }
  799. }
  800. /**
  801. *函数作用:头部logo
  802. *@姓名:廖志伟
  803. *@班级:14互联网G5-2班
  804. *@日期“2017-10-14
  805. */
  806. U.Office.N.Headlogo = function (input) {
  807. U.UF.UP.inputUpload([input], function (r) {
  808. U.alert("插入成功");
  809. var headlogo = $(".U_Boom_O_N_C_H_C_D_Logo")[0];
  810. headlogo.innerHTML = "";
  811. headlogo.style.backgroundImage = "url(http://fs.1473.cn/" + r.value[1] + ")";
  812. }, [], "http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor")
  813. }
  814. /**
  815. *函数作用:底部logo
  816. *@姓名:廖志伟
  817. *@班级:14互联网G5-2班
  818. *@日期“2017-10-14
  819. */
  820. U.Office.N.Footlogo = function (input) {
  821. U.UF.UP.inputUpload([input], function (r) {
  822. U.alert("插入成功");
  823. var footlogo = $(".U_Boom_O_N_F_Fitst_Logo")[0];
  824. footlogo.innerHTML = "";
  825. footlogo.style.backgroundImage = "url(http://fs.1473.cn/" + r.value[1] + ")";
  826. }, [], "http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor")
  827. }
  828. /**
  829. *函数作用:二维码
  830. *@姓名:廖志伟
  831. *@班级:14互联网G5-2班
  832. *@日期“2017-10-14
  833. */
  834. U.Office.N.Twocode = function (input) {
  835. U.UF.UP.inputUpload([input], function (r) {
  836. U.alert("插入成功");
  837. var footcode = $(".U_Boom_O_N_F_Last_Logo")[0];
  838. footcode.innerHTML = "";
  839. footcode.style.backgroundImage = "url(http://fs.1473.cn/" + r.value[1] + ")";
  840. }, [], "http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor")
  841. }
  842. /**
  843. *函数作用:预览按钮
  844. *@姓名:廖志伟
  845. *@班级:14互联网G5-2班
  846. *@日期“2017-10-14
  847. */
  848. U.Office.N.Preview = function () {
  849. var element = $("*"); //获取所有标签
  850. var elementclose = $(".U_Boom_O_N_C_N_Close"); //获取删除按钮
  851. var elementadd = $(".U_Boom_O_N_C_N_AddNav"); //获取添加按钮
  852. var delchange = $(".U_Boom_O_N_C_H_C_Input"); //获取插入头部logo
  853. var delinput = $(".U_Boom_O_N_C_H_C_F_Input"); //获取插入底部logo和二维码
  854. var elementsec = $(".U_Boom_O_N_C_Navg_Two")[0]; //获取二级添加按钮
  855. var elementfalse = $(".U_Boom_O_N_H_C_ceshi")[0]; //获取测试按钮
  856. var elementsecadd = $(".U_Boom_O_N_C_Navg_Ul_Nav_Add"); //获取三级添加按钮
  857. var elementsecdel = $(".U_Boom_O_N_C_Navg_Ul_Nav_Del"); //获取三级删除按钮
  858. var type = $("#U_Boom_O_N_C_Container")[0].children;
  859. var cursor = $(".U_Boom_O_N_C_Navg_Li_font");
  860. delchange[0].setAttribute("onchange", ""); //屏蔽onhange事件
  861. delchange[0].type = "text"; //改变头部type的值
  862. delchange[0].style.cursor = "default";
  863. delinput[0].setAttribute("onchange", "");
  864. delinput[0].type = "text"; //改变底部type的值
  865. delinput[0].style.cursor = "default";
  866. delinput[1].setAttribute("onchange", "");
  867. delinput[1].type = "text"; //改变二维码type的值
  868. delinput[1].style.cursor = "default";
  869. elementsec.style.display = "none";
  870. elementfalse.style.display = "none";
  871. //改变内容页距离顶部的高度
  872. var contant = $("#U_Boom_O_N_C_Container")[0]; //获取整个内容页
  873. contant.style.cssText = "margin-top:7px!important";
  874. var dh1 = $(".U_Boom_O_N_Navg_Ul_daohang2");
  875. var dh = $("#U_Boom_O_N_C_Navg_Ul")[0].children;
  876. for (var h = 0; h < dh1.length; h++) {
  877. dh1[h].style.backgroundColor = "#efefef";
  878. dh1[h].children[0].style.color = "#656f83";
  879. }
  880. for (var d = 0; d < dh.length; d++) {
  881. dh[d].children[0].style.backgroundColor = "#dadde2";
  882. }
  883. for (var f = 0; f < dh.length; f++) {
  884. dh[f].children[0].children[0].style.color = "#000";
  885. }
  886. for (var t = 0; t < type.length; t++) {
  887. type[t].type = "2";
  888. }
  889. for (var c = 0; c < cursor.length; c++) {
  890. cursor[c].style.cursor = "default";
  891. }
  892. //预览模式下跳到第一个导航
  893. var firstnavg = $("#U_Boom_O_N_C_Navg")[0].children[0].children[0].children[0].children[0];
  894. firstnavg.click();
  895. firstnavg.style.color = "#fff";
  896. firstnavg.parentElement.style.backgroundColor = "#000";
  897. //屏蔽三级添加按钮
  898. for (var s = 0; s < elementsecadd.length; s++) {
  899. elementsecadd[s].style.display = "none";
  900. }
  901. //屏蔽三级删除按钮
  902. for (var s = 0; s < elementsecdel.length; s++) {
  903. elementsecdel[s].style.display = "none";
  904. }
  905. //屏蔽所有按钮
  906. for (var j = 0; j < elementclose.length; j++) {
  907. elementclose[j].style.display = "none"; //隐藏导航删除标签
  908. elementadd[j].style.display = "none"; //隐藏所有添加标签
  909. }
  910. //屏蔽所有编辑功能
  911. for (var i = 0; i < element.length; i++) {
  912. element[i].contentEditable = false; //屏蔽所有编辑功能
  913. element[i].style.cuosor = "default";
  914. }
  915. }
  916. /**
  917. *函数作用:清除插入
  918. *@姓名:李泉
  919. */
  920. // U.Office.QCDJ = function () {
  921. // U.MD.O.se = window.parent.document.getElementsByClassName("U_MD_O_H_head_features_ul_d_s");
  922. // U.MD.O.cr = $("#U_Boom_O_N_Navg_Ib");
  923. // for (var i = 0; i < U.MD.O.se.length; i++) {
  924. // U.MD.O.se[i].style.display = 'none';
  925. // }
  926. // for (var i = 0; i < U.MD.O.cr.length; i++) {
  927. // U.MD.O.cr[i].style.display = 'none';
  928. // }
  929. // }