From 45c71d7b1d4e62ad3950bd617e0ffb0e731c9e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= <93301500+xushubieli@users.noreply.github.com> Date: Fri, 5 May 2023 14:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/js/base.js | 138 ----------------------- src/admin/js/{indexbody.js => body.js} | 33 ------ src/admin/js/main.js | 149 ++++++++++--------------- src/admin/templets/index_body.htm | 2 +- 4 files changed, 58 insertions(+), 264 deletions(-) delete mode 100644 src/admin/js/base.js rename src/admin/js/{indexbody.js => body.js} (87%) diff --git a/src/admin/js/base.js b/src/admin/js/base.js deleted file mode 100644 index a9493897..00000000 --- a/src/admin/js/base.js +++ /dev/null @@ -1,138 +0,0 @@ -$(function() { - //文本框Style - $(".txt").mouseover(function() { - $(this).addClass("txt_o"); - }).mouseout(function() { - $(this).removeClass("txt_o"); - }).focus(function() { - $(this).addClass("txt_s"); - }).blur(function() { - $(this).removeClass("txt_s"); - }); - //表格折叠 - $(".tform").find("tbody tr th[_show]").each(function(i){ - //加入折叠提示 - if ($(this).attr("_show")=="no"){ - $(this).append(" "); - } else { - $(this).append(" "); - } - //折叠动作 - $(this).click(function() { - if ($(this).find("button[class^='tbody_']").attr("class")=="tbody_up"){ - $(this).find("button[class^='tbody_']").attr("class","tbody_down"); - $(this).parent("tr").parent("tbody").find("tr").not($(this).parent("tr")).hide(); - } else if ($(this).find("button[class^='tbody_']").attr("class")=="tbody_down"){ - $(this).find("button[class^='tbody_']").attr("class","tbody_up"); - $(this).parent("tr").parent("tbody").find("tr").not($(this).parent("tr")).show(); - } - }).mouseover(function() { - $(this).addClass("mouseon"); - }).mouseout(function() { - $(this).removeClass("mouseon"); - }).click(); - }); - //列表行高亮 - $("table[_dlist*='light']").children("tbody").children("tr").mouseover(function() { - if ($(this).attr("_nolight")!="yes")$(this).addClass("t_on"); - }).mouseout(function() { - $(this).removeClass("t_on"); - }); - //列表行整行选择 - $("table[_dlist*='check']").each(function() { - //处理行点击 - $(this).find("tbody tr").click(function() { - checkbox = $(this).find("td input[type='checkbox']"); - tr = $(this); - if (checkbox.attr("checked")===false){ - checkbox.attr("checked","checked"); - tr.addClass("t_sl"); - } else { - checkbox.removeAttr("checked"); - tr.removeClass("t_sl"); - } - }); - //处理checkbox点击 - $(this).find("td input[type='checkbox']").click(function() { - tr = $(this).parent("td").parent("tr"); - if ($(this).attr("checked")===false){ - $(this).attr("checked","checked"); - tr.removeClass("t_sl"); - } else { - $(this).removeAttr("checked"); - tr.addClass("t_sl"); - } - }); - //排除链接及按钮点击 - $(this).find("tbody tr td a,tbody tr td button,tbody tr td table").click(function() { - tr = $(this).parent("td").parent("tr"); - checkbox = tr.find("td input[type='checkbox']"); - if (checkbox.attr("checked")===false){ - checkbox.attr("checked","checked"); - tr.removeClass("t_sl"); - } else { - checkbox.removeAttr("checked"); - tr.addClass("t_sl"); - } - }); - }); - //高亮初始化 - setChecklight(); - //全选按钮 - $("button[_click='allSelect']").click(function() { - ckbox = $(this).parent("td").parent("tr").parent("tbody").find("td input[type='checkbox']"); - ckbox.attr("checked","checked"); - setChecklight(); - }); - //反选按钮 - $("button[_click='unSelect']").click(function() { - ckbox = $(this).parent("td").parent("tr").parent("tbody").find("td input[type='checkbox']"); - ckbox.each(function() { - $(this).attr("checked") === false ? $(this).attr("checked","checked") : $(this).removeAttr("checked"); - }); - setChecklight(); - }); - //自定义提交 - $("button[_submit]").click(function() { - url = $(this).attr("_submit"); - if (/\[new\].*/.test(url)){ - url = url.replace(/\[new\]/,""); - } else { - url = $(this).parents("form").attr("action")+url; - } - $(this).parents("form").attr("action",url).submit(); - }); -}); -//高亮初始化 -function setChecklight() { - $(".tlist[_dlist*='check']").find("tbody tr td input[type='checkbox']").each(function(i){ - tr = $(this).parent("td").parent("tr"); - if ($(this).attr("checked")){ - tr.addClass("t_sl"); - } else { - tr.removeClass("t_sl"); - } - }); -} -//栏目跳转 -function AC(mid) { - f = $(window.parent.document); - mlink = f.find("a[id='"+mid+"']"); - if (mlink.size()>0){ - box = mlink.parents("div[id^='menu_']"); - boxid = box.attr("id").substring(5,128); - if ($("body").attr("class")!="showmenu")$("#togglemenu").click(); - if (mlink.attr("_url")){ - $("#menu").find("div[id^=menu]").hide(); - box.show(); - mlink.addClass("thisclass").blur().parents("#menu").find("ul li a").not(mlink).removeClass("thisclass"); - if ($("#mod_"+boxid).attr("class")==""){ - $("#nav").find("a").removeClass("thisclass"); - $("#nav").find("a[id='mod_"+boxid+"']").addClass("thisclass").blur(); - } - window.location.href = mlink.attr("_url"); - } else if (mlink.attr("_open") && mlink.attr("_open")!=undefined){ - window.open(mlink.attr("_open")); - } - } -} \ No newline at end of file diff --git a/src/admin/js/indexbody.js b/src/admin/js/body.js similarity index 87% rename from src/admin/js/indexbody.js rename to src/admin/js/body.js index 2a25b918..26f61e49 100644 --- a/src/admin/js/indexbody.js +++ b/src/admin/js/body.js @@ -1,36 +1,3 @@ -function AddNew() { - $DE('addTab').style.display = 'block'; -} -function CloseTab(tb) { - $DE(tb).style.display = 'none'; -} -function ListAll() { - $DE('editTab').style.display = 'block'; - fetch('index_body.php?dopost=editshow').then(resp => resp.text()).then((d) => { - $DE('editTabBody').innerHTML = d; - }); -} -function ShowWaitDiv() { - $DE('loaddiv').style.display = 'block'; - return true; -} -function DedeCopyToClipboard(text) { - if (navigator.clipboard) { - navigator.clipboard.writeText(text); - } else { - var textarea = document.createElement('textarea'); - document.body.appendChild(textarea); - //隐藏此输入框 - textarea.style.position = 'fixed'; - textarea.style.clip = 'rect(0 0 0 0)'; - textarea.style.top = '10px'; - textarea.style.display = 'none'; - textarea.value = text; - textarea.select(); - document.execCommand('copy', true); - document.body.removeChild(textarea); - } -} $(function () { $.get("index_testenv.php",function (data) { if (data !== '') { diff --git a/src/admin/js/main.js b/src/admin/js/main.js index bde9dbaa..9eca32ad 100644 --- a/src/admin/js/main.js +++ b/src/admin/js/main.js @@ -1,7 +1,6 @@ var fixupPos = false; var canMove = false; var leftLeaning = 0; -//异步上传缩略图相关变量 var nForm = null; var nFrame = null; var picnameObj = null; @@ -16,59 +15,6 @@ function GetWinPos(w, h) { var top = (height - h) / 2 / systemZoom + dualScreenTop; return { left: left, top: top }; } -function $Nav() { - if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE'; - else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF'; - else return "OT"; -} -function $Obj(objname) { - return document.getElementById(objname); -} -function ColorSel(c, oname) { - var tobj = $Obj(oname); - if (!tobj) tobj = eval('document.form1.' + oname); - if (!tobj) { - $Obj('colordlg').style.display = 'none'; - return false; - } else { - tobj.value = c; - $Obj('colordlg').style.display = 'none'; - return true; - } -} -function ShowColor(e, o) { - LoadNewDiv(e, '../../static/web/img/colornew.htm', 'colordlg'); -} -function ShowHide(objname) { - var obj = $Obj(objname); - if (obj.style.display != "none") obj.style.display = "none"; - else obj.style.display = "inline-block"; -} -function ShowHideT(objname) { - var obj = $Obj(objname); - if (obj.style.display != "none") obj.style.display = "none"; - else obj.style.display = ($Nav() == "IE" ? "inline-block" : "table"); -} -function ShowObj(objname) { - var obj = $Obj(objname); - if (obj == null) return false; - obj.style.display = ($Nav() == "IE" ? "inline-block" : "table"); -} -function ShowObjRow(objname) { - var obj = $Obj(objname); - obj.style.display = ($Nav() == "IE" ? "inline-block" : "table-row"); -} -function AddTypeid2() { - ShowObjRow('typeid2tr'); -} -function HideObj(objname) { - var obj = $Obj(objname); - if (obj == null) return false; - obj.style.display = "none"; -} -function SeePic(img, f) { - if (f.value != '') img.src = f.value; -} function SeePicNew(f, imgdid, frname, hpos, acname) { var newobj = null; if (f.value == '') return; @@ -134,6 +80,14 @@ function SelectKeywords(f) { var pos = GetWinPos(800,600); window.open("article_keywords_select.php?f=" + f, "popUpkwWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=" + pos.left + ", top=" + pos.top); } +function OpenMyWin(surl) { + var pos = GetWinPos(800,600); + window.open(surl, "popUpMyWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left="+pos.left+", top="+pos.top); +} +function OpenMyWinCoOne(surl) { + var pos = GetWinPos(800,600); + window.open(surl, "popUpMyWin2", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left="+pos.left+",top="+pos.top); +} function InitPage() { var selsource = $Obj('selsource'); var selwriter = $Obj('selwriter'); @@ -141,13 +95,53 @@ function InitPage() { if (selsource) { selsource.onmousedown = function (e) { SelectSource(e); } } if (selwriter) { selwriter.onmousedown = function (e) { SelectWriter(e); } } } -function OpenMyWin(surl) { - var pos = GetWinPos(800,600); - window.open(surl, "popUpMyWin", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left="+pos.left+", top="+pos.top); +function $Nav() { + if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE'; + else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF'; + else return "OT"; } -function OpenMyWinCoOne(surl) { - var pos = GetWinPos(800,600); - window.open(surl, "popUpMyWin2", "scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left="+pos.left+",top="+pos.top); +function $Obj(objname) { + return document.getElementById(objname); +} +function ColorSel(c, oname) { + var tobj = $Obj(oname); + if (!tobj) tobj = eval('document.form1.' + oname); + if (!tobj) { + $Obj('colordlg').style.display = 'none'; + return false; + } else { + tobj.value = c; + $Obj('colordlg').style.display = 'none'; + return true; + } +} +function ShowColor(e, o) { + LoadNewDiv(e, '../../static/web/img/colornew.htm', 'colordlg'); +} +function ShowHide(objname) { + var obj = $Obj(objname); + if (obj.style.display != "none") obj.style.display = "none"; + else obj.style.display = "inline-block"; +} +function ShowObj(objname) { + var obj = $Obj(objname); + if (obj == null) return false; + obj.style.display = ($Nav() == "IE" ? "inline-block" : "table-row"); +} +function ShowObjRow(objname) { + var obj = $Obj(objname); + obj.style.display = ($Nav() == "IE" ? "inline-block" : "table-row"); +} +function AddTypeid2() { + ShowObjRow('typeid2tr'); +} +function HideObj(objname) { + var obj = $Obj(objname); + if (obj == null) return false; + obj.style.display = "none"; +} +function SeePic(img, f) { + if (f.value != '') img.src = f.value; } function PutSource(str) { var osource = $Obj('source'); @@ -161,17 +155,6 @@ function PutWriter(str) { $Obj('mywriter').style.display = 'none'; ChangeFullDiv('hide'); } -//添加选择投票文档 -function PutVote(str) { - var ovote = $Obj('voteid'); - if (ovote) { - ovote.value = str; - tb_remove(false); - } else { - parent.document.form1.voteid.value = str; - tb_remove(true); - } -} function ClearDivCt(objname) { if (!$Obj(objname)) return; $Obj(objname).innerHTML = ''; @@ -275,7 +258,7 @@ function ShowUrlTrEdit() { function CkRemote() { document.getElementById('picname').value = ''; } -//载入指定宽高的Ajax窗体 +//文档列表快捷属性弹出 function LoadQuickDiv(e, surl, oname, w, h) { var newobj = $Obj(oname); if (!newobj) { @@ -339,7 +322,7 @@ function getSelTxt() { } return g; } -//显示栏目Map地图 +//显示副栏目 function ShowCatMap(e, obj, cid, targetId, oldvalue) { fixupPos = true; LoadQuickDiv(e, 'archives_do.php?dopost=getCatMap&targetid=' + targetId + '&channelid=' + cid + '&oldvalue=' + oldvalue + '&rnd=' + Math.random(), 'getCatMap', '700px', '500px'); @@ -381,24 +364,6 @@ function getSelCat(targetId) { HideObj("getCatMap"); ChangeFullDiv("hide"); } -function getElementLeft(element) { - var actualLeft = element.offsetLeft; - var current = element.offsetParent; - while (current !== null) { - actualLeft += current.offsetLeft; - current = current.offsetParent; - } - return actualLeft; -} -function getElementTop(element) { - var actualTop = element.offsetTop; - var current = element.offsetParent; - while (current !== null) { - actualTop += current.offsetTop; - current = current.offsetParent; - } - return actualTop; -} //生成一个随机id function guid() { function S4() { @@ -439,7 +404,7 @@ function DedeConfirm(content="",title="确认提示") { }) }) } -//函数会返回一个modalID,通过这个id可自已定义一些方法,这里用到了一个展开语法https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Spread_syntax +//函数会返回一个modalID,通过这个id可自已定义一些方法,这里用到了一个展开语法:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Spread_syntax function ShowMsg(content, ...args) { title = "系统提示"; size = ""; diff --git a/src/admin/templets/index_body.htm b/src/admin/templets/index_body.htm index b89fd9ca..21e3e418 100644 --- a/src/admin/templets/index_body.htm +++ b/src/admin/templets/index_body.htm @@ -12,7 +12,7 @@ - +