国内流行的内容管理系统(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.

114 lines
3.8KB

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