Browse Source

优化后台js

tags/6.1.9
xushubieli 1 year ago
parent
commit
fc581a729c
8 changed files with 31 additions and 47 deletions
  1. +22
    -26
      src/admin/js/base.js
  2. +1
    -2
      src/admin/js/context_menu.js
  3. +3
    -3
      src/admin/js/dialog.js
  4. +0
    -1
      src/admin/js/float.js
  5. +2
    -5
      src/admin/js/handlers.js
  6. +1
    -1
      src/admin/js/indexbody.js
  7. +2
    -5
      src/admin/js/list.js
  8. +0
    -4
      src/admin/js/main.js

+ 22
- 26
src/admin/js/base.js View File

@@ -12,17 +12,17 @@
//表格折叠
$(".tform").find("tbody tr th[_show]").each(function(i){
//加入折叠提示
if($(this).attr("_show")=="no"){
$(this).append(" <button type=\"button\" class=\"tbody_up\"></button>");
}else{
$(this).append(" <button type=\"button\" class=\"tbody_down\"></button>");
if ($(this).attr("_show")=="no"){
$(this).append(" <button type=\"button\" class=\"tbody_up\"></button>");
} else {
$(this).append(" <button type=\"button\" class=\"tbody_down\"></button>");
}
//折叠动作
$(this).click(function(){
if($(this).find("button[class^='tbody_']").attr("class")=="tbody_up"){
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"){
} 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();
}
@@ -34,7 +34,7 @@
});
//列表行高亮
$("table[_dlist*='light']").children("tbody").children("tr").mouseover(function(){
if($(this).attr("_nolight")!="yes")$(this).addClass("t_on");
if ($(this).attr("_nolight")!="yes")$(this).addClass("t_on");
}).mouseout(function(){
$(this).removeClass("t_on");
});
@@ -44,23 +44,21 @@
$(this).find("tbody tr").click(function(){
checkbox = $(this).find("td input[type='checkbox']");
tr = $(this);
if(checkbox.attr("checked")===false){
if (checkbox.attr("checked")===false){
checkbox.attr("checked","checked");
tr.addClass("t_sl");
}else{
} 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){
if ($(this).attr("checked")===false){
$(this).attr("checked","checked");
tr.removeClass("t_sl");
}else{
} else {
$(this).removeAttr("checked");
tr.addClass("t_sl");
}
@@ -69,15 +67,14 @@
$(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){
if (checkbox.attr("checked")===false){
checkbox.attr("checked","checked");
tr.removeClass("t_sl");
}else{
} else {
checkbox.removeAttr("checked");
tr.addClass("t_sl");
}
});
});
//高亮初始化
setChecklight();
@@ -93,15 +90,14 @@
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)){
if (/\[new\].*/.test(url)){
url = url.replace(/\[new\]/,"");
}else{
} else {
url = $(this).parents("form").attr("action")+url;
}
$(this).parents("form").attr("action",url).submit();
@@ -111,9 +107,9 @@
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")){
if ($(this).attr("checked")){
tr.addClass("t_sl");
}else{
} else {
tr.removeClass("t_sl");
}
});
@@ -122,20 +118,20 @@
function AC(mid){
f = $(window.parent.document);
mlink = f.find("a[id='"+mid+"']");
if(mlink.size()>0){
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")){
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")==""){
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){
} else if (mlink.attr("_open") && mlink.attr("_open")!=undefined){
window.open(mlink.attr("_open"));
}
}


+ 1
- 2
src/admin/js/context_menu.js View File

@@ -28,7 +28,7 @@ function insertHtm(op, code, isStart) {
ContextMenu.WebFX_PopUp = null;
ContextMenu.WbFX_PopUpcss = null;
ContextMenu.intializeContextMenu = function () {
insertHtm(document.body, '<iframe src="#" scrolling="no" class="WebFX-ContextMenu" marginwidth="0" marginheight="0" frameborder="0" style="position:absolute;display:none;z-index:50000000;" id="WebFX_PopUp"></iframe>', true);
insertHtm(document.body, '<iframe src="" scrolling="no" class="WebFX-ContextMenu" marginwidth="0" marginheight="0" frameborder="0" style="position:absolute;display:none;z-index:50000000;" id="WebFX_PopUp"></iframe>', true);
if (curNav() == 'IE') WebFX_PopUp = document.frames['WebFX_PopUp'];
else WebFX_PopUp = document.getElementById('WebFX_PopUp');
WebFX_PopUpcss = document.getElementById('WebFX_PopUp');
@@ -38,7 +38,6 @@ ContextMenu.intializeContextMenu = function () {
else document.addEventListener("onblur", function () { WebFX_PopUpcss.style.display = "none" }, false);
if (curNav() == 'IE') document.attachEvent("onblur", function () { WebFX_PopUpcss.style.display = "none" });
else document.addEventListener("onblur", function () { WebFX_PopUpcss.style.display = "none" }, false);

}
function ContextSeperator() { }
function ContextMenu() { }


+ 3
- 3
src/admin/js/dialog.js View File

@@ -19,9 +19,9 @@ function AlertMsg(title, id) {
//弹出窗口设置
msgw = 600;//窗口宽度
msgbg = "#FFF";//内容背景
msgcolor = "#000";//内容颜色
msgcolor = "#333";//内容颜色
titlecolor = "#254015";//标题颜色
titlebg = "#369 url(../../static/web/img/tbg.gif)";//标题背景
titlebg = "url(../../static/web/img/tbg.gif)";//标题背景
//遮罩背景设置
content = "<div id=show_news>对不起,载入失败</div>";
var sWidth, sHeight;
@@ -39,7 +39,7 @@ function AlertMsg(title, id) {
maskObj.style.left = "0";
maskObj.style.background = "#666";
maskObj.style.filter = "Alpha(opacity=30);";
maskObj.style.opacity = "0.3";
maskObj.style.opacity = "0.2";
maskObj.style.width = sWidth + "px";
maskObj.style.height = sHeight + "px";
maskObj.style.zIndex = "10000";


+ 0
- 1
src/admin/js/float.js View File

@@ -30,7 +30,6 @@ function heartBeat() {
if (NS) document.floater.left += percent;
lastScrollX = lastScrollX + percent;
}

}
function checkFocus(x, y) {
stalkerx = document.floater.pageX;


+ 2
- 5
src/admin/js/handlers.js View File

@@ -35,7 +35,6 @@ function fileQueueError(file, errorCode, message) {
} catch (ex) {
this.debug(ex);
}

}
function fileDialogComplete(numFilesSelected, numFilesQueued) {
try {
@@ -131,7 +130,6 @@ function uploadError(file, errorCode, message) {
} catch (ex3) {
this.debug(ex3);
}

}
var albImg = 0;
function addImage(src, pid) {
@@ -152,10 +150,10 @@ function addImage(src, pid) {
if (typeof arctype != 'undefined' && arctype == 'article') {
iptwidth = 100;
if (pid != 0) {
newImgDiv.innerHTML = '<img src="' + src + '" style="width:160px" onClick="addtoEdit(' + pid + ')">' + delstr;
newImgDiv.innerHTML = '<img src="' + src + '" onClick="addtoEdit(' + pid + ')" style="width:160px">' + delstr;
}
}
newImgDiv.innerHTML += '<div style="margin-top:10px">注释:<input type="text" name="picinfo' + albImg + '" value="" style="width:' + iptwidth + 'px;"></div>';
newImgDiv.innerHTML += '<div style="margin-top:10px">注释:<input type="text" name="picinfo' + albImg + '" value="" style="width:' + iptwidth + 'px"></div>';
}
/* ******************************************
* FileProgress Object
@@ -221,7 +219,6 @@ FileProgress.prototype.setCancelled = function () {
FileProgress.prototype.setStatus = function (status) {
this.fileProgressElement.childNodes[2].innerHTML = status;
};

FileProgress.prototype.toggleCancel = function (show, swfuploadInstance) {
this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
if (swfuploadInstance) {


+ 1
- 1
src/admin/js/indexbody.js View File

@@ -80,7 +80,7 @@ function LoadServer() {
$.get("index_body.php?dopost=system_info", function (data) {
let rsp = JSON.parse(data);
if (rsp.code === 200) {
let infoStr = `<table width="100%" class="table table-borderless"><tbody>`;
let infoStr = `<table class="table table-borderless"><tbody>`;
if (typeof rsp.result.domain !== "undefined") {
infoStr += `
<tr>


+ 2
- 5
src/admin/js/list.js View File

@@ -46,7 +46,6 @@ function adArc(aid){
if(aid==0) aid = getOneItem();
location="archives_do.php?aid="+aid+"&dopost=commendArchives&qstr="+qstr;
}

function cAtts(jname, e, obj)
{
var qstr=getCheckboxItem();
@@ -56,16 +55,14 @@ function cAtts(jname, e, obj)
ShowMsg('必须选择一个或多个文档');
return;
}
LoadQuickDiv(e, 'archives_do.php?dopost=attsDlg&qstr='+qstr+'&dojob='+jname+'&rnd='+Math.random(), 'attsDlg', '450px', '160px');
LoadQuickDiv(e, 'archives_do.php?dopost=attsDlg&qstr='+qstr+'&dojob='+jname+'&rnd='+Math.random(), 'attsDlg', '450px', '180px');
ChangeFullDiv('show', screeheight);
}

function delArc(aid){
var qstr=getCheckboxItem();
if(aid==0) aid = getOneItem();
location="archives_do.php?qstr="+qstr+"&aid="+aid+"&dopost=delArchives";
}

function QuickEdit(aid, e, obj)
{
LoadQuickDiv(e, 'archives_do.php?dopost=quickEdit&aid='+aid+'&rnd='+Math.random(), 'quickEdit', 'auto', '300px');
@@ -77,7 +74,7 @@ function ShowMenu(evt,obj,aid,atitle)
var popupoptions
popupoptions = [
new ContextItem("浏览文档",function(){ viewArc(aid); }),
new ContextItem("编辑属性",function(){ QuickEdit(aid, evt, obj); }),
new ContextItem("编辑属性",function(){ QuickEdit(aid, evt, obj); }),
new ContextItem("编辑文档",function(){ editArc(aid); }),
new ContextSeperator(),
new ContextItem("更新HTML",function(){ updateArc(aid); }),


+ 0
- 4
src/admin/js/main.js View File

@@ -6,20 +6,16 @@ var nForm = null;
var nFrame = null;
var picnameObj = null;
var vImg = null;

function GetWinPos(w, h) {
var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
var dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;

var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;

var systemZoom = width / window.screen.availWidth;
var left = (width - w) / 2 / systemZoom + dualScreenLeft;
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';


Loading…
Cancel
Save