Navigation.js 53 KB

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