国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
4.1KB

  1. /**
  2. *
  3. * @version $Id: dialog.js 1 22:28 2010年7月20日Z tianya $
  4. * @package DedeBIZ.Administrator
  5. * @copyright Copyright (c) 2022, DedeBIZ.COM
  6. * @license https://www.dedebiz.com/license
  7. * @link https://www.dedebiz.com
  8. */
  9. document.write("<style type=\"text/css\">.close{float:right;font-size:14px;cursor:pointer}</style>")
  10. function editTitle(aid) {
  11. var show = document.getElementById("show_news");
  12. fetch("catalog_edit.php?dopost=time&id=" + aid).then(resp=>resp.text()).then((d)=>{
  13. show.innerHTML = d;
  14. });
  15. }
  16. function $Dede(id) { return document.getElementById(id) }
  17. function AlertMsg(title, id) {
  18. var msgw, msgh, msgbg, msgcolor, titlecolor, titlebg, content;
  19. //弹出窗口设置
  20. msgw = 600;//窗口宽度
  21. msgbg = "#FFF";//内容背景
  22. msgcolor = "#333";//内容颜色
  23. titlecolor = "#254015";//标题颜色
  24. titlebg = "url(../../static/web/img/tbg.gif)";//标题背景
  25. //遮罩背景设置
  26. content = "<div id=show_news>对不起,载入失败</div>";
  27. var sWidth, sHeight;
  28. sWidth = screen.availWidth;
  29. if (screen.availHeight > document.body.scrollHeight) {
  30. sHeight = screen.availHeight;//少于一屏
  31. } else {
  32. sHeight = document.body.scrollHeight;//多于一屏
  33. }
  34. //创建遮罩背景
  35. var maskObj = document.createElement("div");
  36. maskObj.setAttribute('id', 'maskdiv');
  37. maskObj.style.position = "absolute";
  38. maskObj.style.top = "0";
  39. maskObj.style.left = "0";
  40. maskObj.style.background = "#666";
  41. maskObj.style.filter = "Alpha(opacity=30);";
  42. maskObj.style.opacity = "0.2";
  43. maskObj.style.width = sWidth + "px";
  44. maskObj.style.height = sHeight + "px";
  45. maskObj.style.zIndex = "10000";
  46. document.body.appendChild(maskObj);
  47. //创建弹出窗口
  48. var msgObj = document.createElement("div")
  49. msgObj.setAttribute("id", "msgdiv");
  50. msgObj.style.position = "absolute";
  51. msgObj.style.top = "100px";
  52. msgObj.style.left = "100px";
  53. msgObj.style.width = msgw + "px";
  54. msgObj.style.height = msgh + "px";
  55. msgObj.style.fontSize = "14px";
  56. msgObj.style.background = msgbg;
  57. msgObj.style.zIndex = "10001";
  58. //创建标题
  59. var thObj = document.createElement("div");
  60. thObj.setAttribute("id", "msgth");
  61. thObj.className = "DragAble";
  62. thObj.title = "按住鼠标左键可以拖动窗口";
  63. thObj.style.cursor = "move";
  64. thObj.style.padding = "10px";
  65. thObj.style.color = titlecolor;
  66. thObj.style.fontWeight = 'bold';
  67. thObj.style.background = titlebg;
  68. var titleStr = "<a class='close' onclick='CloseMsg()'>关闭</a>" + "<span>" + title + "</span>";
  69. thObj.innerHTML = titleStr;
  70. //创建内容
  71. var bodyObj = document.createElement("div");
  72. bodyObj.setAttribute("id", "msgbody");
  73. bodyObj.style.padding = "0px";
  74. bodyObj.style.lineHeight = "1.5em";
  75. var txt = document.createTextNode(content);
  76. bodyObj.appendChild(txt);
  77. bodyObj.innerHTML = content;
  78. //生成窗口
  79. document.body.appendChild(msgObj);
  80. $Dede("msgdiv").appendChild(thObj);
  81. $Dede("msgdiv").appendChild(bodyObj);
  82. editTitle(id);
  83. }
  84. function CloseMsg() {
  85. //移除对象
  86. document.body.removeChild($Dede("maskdiv"));
  87. $Dede("msgdiv").removeChild($Dede("msgth"));
  88. $Dede("msgdiv").removeChild($Dede("msgbody"));
  89. document.body.removeChild($Dede("msgdiv"));
  90. }
  91. //拖动窗口
  92. var ie = document.all;
  93. var nn6 = document.getElementById && !document.all;
  94. var isdrag = false;
  95. var y, x;
  96. var oDragObj;
  97. function moveMouse(e) {
  98. if (isdrag) {
  99. oDragObj.style.top = (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y) + "px";
  100. oDragObj.style.left = (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x) + "px";
  101. return false;
  102. }
  103. }
  104. function initDrag(e) {
  105. var oDragHandle = nn6 ? e.target : event.srcElement;
  106. var topElement = "HTML";
  107. while (oDragHandle.tagName != topElement && oDragHandle.className != "DragAble") {
  108. oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement;
  109. }
  110. if (oDragHandle.className == "DragAble") {
  111. isdrag = true;
  112. oDragObj = oDragHandle.parentNode;
  113. nTY = parseInt(oDragObj.style.top);
  114. y = nn6 ? e.clientY : event.clientY;
  115. nTX = parseInt(oDragObj.style.left);
  116. x = nn6 ? e.clientX : event.clientX;
  117. document.onmousemove = moveMouse;
  118. return false;
  119. }
  120. }
  121. document.onmousedown = initDrag;
  122. document.onmouseup = new Function("isdrag=false");