第19次修改了可删除可持久保存的前端html备忘录:换了一个特别的倒计时时钟

第19次修改了可删除可持久保存的前端html备忘录:换了一个特别的倒计时时钟

 

<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>与妖为邻的文本备忘录</title>
</head>
<style>
  * {
    list-style-type: none;
    /* 外边距 */
    margin: 0;
    /* 内边距区域 */
    padding: 0;
    /* 盒子模型:元素的宽度和高度将包括内容区、内边距和边框,但不包括外边距 */
    box-sizing: border-box;
  }
  body {
    min-height: 100vh;
  }
  input,
  button {
    /* 字体大小 */
    font-size: 18px;
    /* 鼠标变小手 */
    cursor: pointer;
    /* 圆角*/
    border-radius: 5px;
    /* 内边距上下0 左右5 */
    padding: 0px 5px;
  }
  /* 标题区布局开始************************** */
  .hdiv {
    width: 100%;
    height: 65px;
    /* position: relative; */
    position: fixed;
    dfn {
      position: fixed;
      top: 10px;
      left: 0;
      /* 内边距上下0 左右5 */
      padding: 0px 5px;
      /* 圆角*/
      border-radius: 50px;
    }
    b {
      position: fixed;
      top: 10px;
      left: 116px;
      /* 圆角*/
      border-radius: 50%;
      /* 内边距上下0 左右5 */
      padding: 0px 5px;
    }
    #link {
      position: fixed;
      height: 45px;
      top: 10px;
      left: 210px;
      /* 外边距 */
      margin: 0 15px;
      font-size: 30px;
    }
    /* 当前时间布局开始************************** */
    .newtime {
      width: 495px;
      height: 65px;
      position: fixed;
      top: 0px;
      left: 358px;
      /* 圆角*/
      border-radius: 20%;
      #clock {
        position: fixed;
        top: 10px;
        left: 365px;
        /* 字体大小 */
        font-size: 30px;
      }
      /* 翻盘时间显示开始************************** */
      .show {
        display: flex;
        top: -5px;
        left: 295px;
        width: 200px;
        height: 75px;
        position: relative;
        .time {
          display: flex;
          flex: 1;
          font-size: 40px;
          text-align: center;
          line-height: 75px;
          padding: 0 10px;
          overflow: hidden;
          position: absolute;
          top: 0px;
          left: 5px;
          right: 5px;
        }
        .beforeTime {
          z-index: 100;
        }
        .time li:nth-child(2n) {
          flex: 1;
        }
        .time li:nth-child(2n+1) {
          flex: 4;
          position: relative;
          height: 50px;
          line-height: 50px;
          margin: auto 0px;
          border-radius: 10px;
        }
        .time li:nth-child(2n+1) .upBox,
        .time li:nth-child(2n+1) .downBox {
          position: absolute;
          left: 0;
          right: 0;
        }
        .time li:nth-child(2n+1) .upBox {
          top: 0;
          bottom: 50%;
          box-sizing: border-box;
          transform-origin: bottom;
          border-radius: 5px 5px 0 0;
        }
        .time li:nth-child(2n+1) .downBox {
          top: 50%;
          bottom: 0;
          line-height: 0;
          box-sizing: border-box;
          overflow: hidden;
          transform-origin: top;
          border-radius: 0 0 5px 5px;
        }
        /* 翻盘时间显示结束************************** */
      }
      /* 当前时间布局结束************************** */
    }
    .gap {
      position: fixed;
      top: 2px;
      left: 855px;
      font-size: 30px;
      border-radius: 50%;
      /* 内边距上下10 左右15 */
      padding: 10px 15px;
    }
    /*************************倒计时开始********************************/
    #countdown {
      padding: 0 5px;
      width: 483px;
      /* position: fixed; */
      position: relative;
      top: 0px;
      left: 1008px;
      display: flex;
      gap: 5px;
      /* 角 */
      border-radius: 20%;
      .circle {
        position: relative;
        width: 75px;
        height: 75px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: 0 5px 5px rgba(216, 189, 189, 0.363);
        &::before {
          content: '';
          position: absolute;
          border-radius: 50%;
          inset: 0;
          border: 5px solid #000000;
        }
        &::after {
          content: '';
          position: absolute;
          width: 50px;
          height: 50px;
          border-radius: 50%;
          background: #05a388;
          box-shadow: inset 0 1px 1px rgba(204, 150, 150, 0.694);
        }
        & svg {
          width: 75px;
          height: 75px;
          position: relative;
          transform: rotate(270deg);
          & circle {
            width: 100%;
            height: 100%;
            fill: transparent;
            stroke-width: 4;
            stroke: var(--clr);
            stroke-linecap: round;
            transform: translate(2.5px, 2.5px);
            stroke-dasharray: 220;
            stroke-dashoffset: 220;
          }
        }
        & div {
          position: absolute;
          text-align: center;
          font-weight: 1000;
          color: #ffff;
          z-index: 5000;
          color: var(--clr);
          font-size: 30px;
          line-height: 0.6;
        }
      }
      .tsfm {
        position: relative;
        top: 14px;
        left: -1px;
        font-size: 35px;
      }
      /*************************倒计时结束********************************/
    }
    /* 标题区布局结束************************** */
  }
  /* 备忘信息区布局开始************************** */
  #oContent {
     margin:  65px 0;
    /* 复选框样式开始 */
    input[type="checkbox"] {
      margin: 0px 10px;
      -webkit-appearance: none;
      appearance: none;
      width: 25px;
      height: 25px;
      position: relative;
      border-radius: 50%;
    }
    input[type="checkbox"]::after {
      content: "";
      width: 100%;
      height: 100%;
      border: 2px solid #e9f504;
      position: absolute;
      left: -3px;
      top: -3px;
      border-radius: 50%;
      /* 复选框样式开始 */
    }
    /* 设置复选框点击之后的样式*/
    input[type="checkbox"]:checked::after {
      height: 15px;
      width: 25px;
      border-top: none;
      border-right: none;
      border-radius: 0;
      transform: rotate(-45deg);
      transition: all 0.5s ease-in-out;
      /* 设置复选框点击之后的样式结束*/
    }
    span {
      border-radius: 20px;
      padding: 0 10px;
    }
    /* 备忘信息区布局结束************************** */
  }
  /* 隐藏的文本操作框布局开始 ***************************/
  .login {
    display: none;
    width: 650px;
    position: fixed;
    left: 70%;
    top: 50%;
    border-radius: 15px 15px 0 0;
    z-index: 9999;
    transform: translate(-90%, -90%);
    border-radius: 15px;
    .login-title {
      border-radius: 15px 15px 0 0;
      width: 100%;
      line-height: 40px;
      height: 40px;
      font-size: 20px;
      position: relative;
      cursor: move;
      .cl1ose-login {
        margin: 0 10px;
      }
      #closeBtn {
        padding: 0px 10px 0px 10px;
        /*设置X靠右*/
        float: right;
        /*设置边框圆角*/
        /*设置文字大小*/
        font-size: 38px;
        top: -2px;
        right: 5px;
        /*设置绝对定位*/
        position: absolute;
        /*设置去掉斜体文字属性*/
        font-style: normal;
        /*设置鼠标悬停时显示小手*/
        cursor: pointer;
        &:hover {
          color: #6b6b6b;
        }
      }
    }
    .up-div {
      display: flex;
      /*设置主轴方向 垂直显示*/
      flex-direction: column;
      border-radius: 10px;
      height: 205px;
      margin: 10px;
      #myForm {
        display: flex;
        /*设置主轴方向 垂直显示*/
        flex-direction: column;
        box-sizing: border-box;
        border-radius: 10px;
        margin: 10px;
        padding: 5px;
        background-color: #c4a32c;
        & input[type="file"] {
          margin: 10px;
          background-color: #11b711;
          border-radius: 10px;
        }
        & textarea {
          font-size: 20px;
          /* 高 */
          height: 32px;
          border-radius: 5px;
          /* 居中 */
          display: flex;
          justify-content: center;
          margin: 0 10px;
          &::placeholder {
            font-size: 22px;
          }
        }
        div {
          margin: 10px;
          display: flex;
          /*设置主轴方向 垂直显示
            flex-direction: center;*/
          /*设置	居中排列。*/
          justify-content: center;
          gap: 80px;
        }
      }
      .up-div1 {
        margin: 10px;
        display: flex;
        justify-content: space-between;
      }
    }
    sub {
      /* 居中 */
      display: flex;
      justify-content: center;
      border-radius: 5px;
      margin: 10px;
    }
    .site {
      border-radius: 10px;
      margin: 10px;
      button {
        margin: 5px;
      }
    }
    /* 隐藏的文本操作框布局结束 ***************************/
  }
  /* 背景颜色布局******************************************************** */
  body {
    background: radial-gradient(at 60% 0%, #5190b0, #235746);
  }
  .hdiv {
    background: linear-gradient(0.25turn, rgb(110, 123, 108), rgb(204, 232, 207), #f7d6d6);
  }
  button,
  b,
  dfn {
    background-color: #ff0000;
  }
  #countdown,
  .newtime {
    background-color: #48603f;
  }
  input,
  .gap {
    background-color: rgb(171, 5, 5);
  }
  input:hover,
  button:hover,
  textarea,
  sub,
  #oContent {
    background: #303745;
  }
  /*3D背景样式*/
  sub,
  #countdown,
  input,
  .site,
  .up-div,
  .gap,
  button,
  b,
  .newtime,
  button {
    background-image: linear-gradient(to top left,
        rgba(0, 0, 0, 0.2),
        rgba(0, 0, 0, 0.2) 30%,
        rgba(0, 0, 0, 0));
    box-shadow: inset 4px 4px 4px rgba(255, 255, 255, 0.6),
      inset -4px -4px 5px rgba(0, 0, 0, 0.6);
    border: 0px solid black;
  }
  /* 凹进去的样式 */
  #myForm,
  #oContent span,
  dfn,
  button:active,
  input:active {
    box-shadow: inset -2px -2px 3px rgba(255, 255, 255, 0.6),
      inset 2px 2px 3px rgba(0, 0, 0, 0.6);
  }
  .time li:nth-child(2n+1) {
    box-shadow: 0px 0px 1px 1px rgb(1, 0, 0);
  }
  .time li:nth-child(2n+1) .upBox,
  .time li:nth-child(2n+1) .downBox {
    background-color: #3b3d3b;
    ;
    /* 删除线 加颜色*/
    text-decoration: line-through;
    text-decoration-color: #3b3d3b;
    ;
  }
  /* 文本颜色布局***************************************** */
  input,
  ::placeholder,
  textarea,
  sub,
  .cl1ose-login,
  .login-title,
  a,
  .gap,
  button,
  b,
  dfn {
    color: #fff;
    text-shadow: 1px 1px 1px #000;
  }
  input:hover,
  button:hover,
  .delete {
    color: #f0e80a;
    text-shadow: 1px 1px 1px #000;
  }
  b {
    text-shadow: 0px 1px 0px #999,
      0px 2px 0px #888,
      0px 3px 0px #777,
      0px 4px 0px #666,
      0px 5px 0px #555,
      0px 6px 0px #444,
      0px 7px 0px #333,
      0px 8px 7px #001135;
  }
  .show {
    color: #ffffff;
  }
  .tsfm,
  #clock {
    color: #ff0000;
    text-shadow: 1px 1px 1px #000;
  }
  a {
    color: #5190b0;
    text-shadow: 1px 1px 1px #000;
  }
  span {
    color: #75c6b2;
    text-shadow: 1px 1px 1px #000;
  }
  .finish {
    /* 下划线 */
    text-decoration: underline;
    text-decoration-color: rgb(255, 0, 0);
    background-color: rgb(191, 210, 255);
    color: rgb(255, 250, 250);
    text-shadow: 1px 1px 1px #030303;
    box-shadow:
      inset -2px -2px 3px rgba(255, 255, 255, 0.6),
      inset 2px 2px 3px rgba(0, 0, 0, 0.6);
  }
  .login {
    background-color: #cce7cc;
    border: #ebebeb solid 1px;
  }
  .login-title {
    background-color: #b5c7b5;
  }
  .site,
  .up-div {
    background-color: rgba(173, 17, 17, 0.5);
  }
</style>
<!-- <body background="yyds6.jpg" style="background-repeat:no-repeat;
background-attachment:fixed;
background-size:100% 100%; "> -->
<body>
  <div class="hdiv">
    <h1>
      <dfn>memo</dfn>
      <b>备忘录</b>
    </h1>
    <button id="link" href="javascript:;">文本操作</button>
    <!-- 当前时间 -->
    <div class="newtime">
      <div id="clock"></div>
      <!-- 翻盘时间显示开始 -->
      <div class="show">
        <ul class="time">
          <li>
            <div class="upBox beforeTime"></div>
            <div class="downBox beforeTime"></div>
            <div class="upBox afterTime"></div>
            <div class="downBox afterTime"></div>
          </li>
          <li>:</li>
          <li>
            <div class="upBox beforeTime"></div>
            <div class="downBox beforeTime"></div>
            <div class="upBox afterTime"></div>
            <div class="downBox afterTime"></div>
          </li>
          <li>:</li>
          <li>
            <div class="upBox beforeTime"></div>
            <div class="downBox beforeTime"></div>
            <div class="upBox afterTime"></div>
            <div class="downBox afterTime"></div>
          </li>
        </ul>
        <!-- 翻盘时间显示结束 -->
      </div>
      <!-- 当前时间结束 -->
    </div>
    <div class="gap">距离五一</div>
    <!-- 倒计时 -->
    <div id="countdown">
      <div class="circle" style="--clr:#18e3c1;">
        <svg>
          <circle cx="35" cy="35" r="35" id="dd"></circle>
        </svg>
        <div id="days">00</div>
      </div>
      <div class="tsfm">天</div>
      <div class="circle" style="--clr:#41cb35;">
        <svg>
          <circle cx="35" cy="35" r="35" id="hh"></circle>
        </svg>
        <div id="hours">00</div>
      </div>
      <div class="tsfm">时</div>
      <div class="circle" style="--clr:#98aafc;">
        <svg>
          <circle cx="35" cy="35" r="35" id="mm"></circle>
        </svg>
        <div id="minutes">00</div>
      </div>
      <div class="tsfm">分</div>
      <div class="circle" style="--clr:#ec1313;">
        <svg>
          <circle cx="35" cy="35" r="35" id="ss"></circle>
        </svg>
        <div id="seconds">00</div>
      </div>
      <div class="tsfm">秒</div>
      <!-- 倒计时结束 -->
    </div>
    <!-- ----文本操作框-------------------------------- -->
    <div id="login" class="login">
      <div id="title" class="login-title">
        <span class="cl1ose-login">文本操作</span>
        <i href="javascript:void(0);" id="closeBtn">&times</i>
      </div>
      <div class="up-div">
        <form id="myForm">
          <input type="file" name="inputfile" accept="text/plain, text/css, text/html, text/javascript, text/markdown"
            class="background3D" />
          <textarea class="up-textarea" name="uptextarea" rows="1" cols="30%"
            placeholder="请选择txt、js、css或html文件,文件内容会被自动读取"></textarea>
          <div>
            <button type="text" class="up-button">添加</button>
            <input type="reset" value="重置">
          </div>
        </form>
        <hr>
        <div class="up-div1">
          <button id="openButton">打开URL</button>
          <button class="a-href"><a href="https://blog.csdn.net/lulei5153?spm=1011.2415.3001.5343"
              target="_blank">与妖为邻</a></button>
          <button class="a-href"> <a href="https://www.bilibili.com/" target="_blank"> 哔哩哔哩 </a> </button>
          <button id="up-button1" class="delete">对选择删除</button>
        </div>
      </div>
      <sub> &lt;button class="a-href"&gt;
        &lt;a href="输入网站地址" target="_blank"&gt;
        输入网站名称
        &lt;/a&gt; &lt;/button&gt;
      </sub>
      <div class="site">
        <button class="a-href"> <a href="https://www.runoob.com/" target="_blank"> 菜鸟教程 </a> </button>
        <button class="a-href"> <a href="https://cn.vuejs.org/" target="_blank"> JavaScript 框架vue </a></button>
        <button class="a-href"> <a href="https://www.w3ccoo.com/" target="_blank"> w3schools 教程 </a> </button>
        <button class="a-href"><a href="https://www.baidu.com/s" target="_blank">百度一下</a></button>
        <button class="a-href"> <a href="https://zh.javascript.info/" target="_blank"> 现代 JavaScript 教程 </a> </button>
        <button class="a-href"> <a href="https://www.dedexuexi.com/" target="_blank"> 建站学习网 </a></button>
        <button class="a-href"> <a href="https://www.dedexuexi.com/tool/3D/" target="_blank"> CSS3D字体 </a></button>
        <button class="a-href"><a href="https://element-plus.org/zh-CN/" target="_blank">Vue3组件库</a></button>
      </div>
    </div>
  </div>
  <hr>
  <!-- ----备忘录内容容器--------------------------- -->
  <div id="oContent">
  </div>
</body>
</body>
<script>
  /* **************************当前时间函数********************************** */
  function showTime(clock) {
    var now = new Date();
    var year = now.getFullYear();
    var month = now.getMonth();
    var day = now.getDate();
    month = month + 1;
    var arr_work = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
    var week = arr_work[now.getDay()];
    // var time = year+"年"+month+"月"+day+"日 "+ week+" "+hour+":"+minu+":"+second;
    var time = year + "年" + month + "月" + day + "日 " + week;
    clock.innerHTML = time;
  }
  window.onload = function () {
    var clock = document.getElementById("clock");
    window.setInterval("showTime(clock)", 1000);
    var text = document.getElementsByName('uptextarea')[0],
      inputFile = document.getElementsByName('inputfile')[0];
    //上传文件
    inputFile.onchange = function () {
      console.log(this.files);
      var reader = new FileReader();
      reader.readAsText(this.files[0], 'UTF-8');
      reader.onload = function (e) {
        // urlData就是对应的文件内容
        var urlData = this.result;
        text.value = urlData;
      };
    };
  }
  /* **************************翻盘时间函数***********************************/
  //格式化时间
  const formatTime = (time) => {
    if (time < 10) time = '0' + time
    return time
  }
  //翻转前面下面的盒子向上180deg
  const rotateUp = (ele, time, n) => {
    //传入的为一开始翻转的元素,即前面下面的盒子,以及新时间,以及第几个li盒子
    let rotateDeg = 0;
    ele.style.zIndex = 50;
    //这个是所有上面的盒子
    const allUpBox = document.querySelector(`li:nth-child(${n})`).querySelectorAll('.upBox');
    //所有前面的盒子
    const beforeTime = document.querySelector(`li:nth-child(${n})`).querySelectorAll('.beforeTime');
    // 让上面后面的盒子先不可见,然后设置为270°
    allUpBox[1].style.display = 'none';
    allUpBox[1].transform = `rotateX(270deg)`;
    const animation = () => {
      rotateDeg += 3;
      ele.style.transform = `perspective(500px) rotateX(${rotateDeg}deg)`;
      if (rotateDeg == 90) {
        //让它更新为最近时间后隐藏
        ele.innerHTML = time
        ele.style.zIndex = -1;
        //让刚刚上面隐藏的盒子重新显示出来并且完成90°-180°的旋转
        allUpBox[1].style.display = 'block';
        allUpBox[0].style.zIndex = 1;
        rotateDown(allUpBox[1])
        allUpBox[1].style.zIndex = 1;
      }
      if (rotateDeg == 150) {
        beforeTime[0].innerHTML = time
      }
      if (rotateDeg < 180) {
        requestAnimationFrame(animation);
      }
    }
    animation()
  }
  const rotateDown = (ele) => {
    let rotateDeg = 270;
    const animation = () => {
      rotateDeg += 3;
      ele.style.transform = `perspective(500px) rotateX(${rotateDeg}deg)`;
      if (rotateDeg < 360) {
        requestAnimationFrame(animation);
      }
    }
    animation()
  }
  let time = new Date();
  let oldHour = time.getHours();
  var oldMinute = time.getMinutes();
  var oldSecond = time.getSeconds();
  document.querySelector('li:nth-child(1)').querySelectorAll('.beforeTime').forEach(ele => ele.innerHTML = formatTime(oldHour));
  document.querySelector(' li:nth-child(3)').querySelectorAll('.beforeTime').forEach(ele => ele.innerHTML = formatTime(oldMinute));
  document.querySelector(' li:nth-child(5)').querySelectorAll('.beforeTime').forEach(ele => ele.innerHTML = formatTime(oldSecond));
  const changeTime = () => {
    let time = new Date();
    let hour = time.getHours();
    let minute = time.getMinutes();
    let second = time.getSeconds();
    const setHourBox = document.querySelector('li:nth-child(1)').querySelectorAll('.afterTime');
    if (!setHourBox[0].innerHTML || setHourBox[0].innerHTML != formatTime(hour)) {
      if (setHourBox[0].innerHTML) rotateUp(document.querySelector('li:nth-child(1)').querySelectorAll('.beforeTime')[1], formatTime(hour), 1);
      setHourBox.forEach(ele => ele.innerHTML = formatTime(hour));
    }
    const setMinuteBox = document.querySelector('li:nth-child(3)').querySelectorAll('.afterTime');
    if (!setMinuteBox[0].innerHTML || setMinuteBox[0].innerHTML != formatTime(minute)) {
      if (setMinuteBox[0].innerHTML) rotateUp(document.querySelector('li:nth-child(3)').querySelectorAll('.beforeTime')[1], formatTime(minute), 3);
      setMinuteBox.forEach(ele => ele.innerHTML = formatTime(minute));
    }
    const setSecondBox = document.querySelector('li:nth-child(5)').querySelectorAll('.afterTime')
    setSecondBox.forEach(ele => ele.innerHTML = formatTime(second));
    rotateUp(document.querySelector('li:nth-child(5)').querySelectorAll('.beforeTime')[1], formatTime(second), 5)
    setTimeout(changeTime, 1000);
  }
  changeTime();
  /*************************倒计时********************************/
  let days = document.getElementById('days');
  let hours = document.getElementById('hours');
  let minutes = document.getElementById('minutes');
  let seconds = document.getElementById('seconds');
  let dd = document.getElementById('dd');
  let hh = document.getElementById('hh');
  let mm = document.getElementById('mm');
  let ss = document.getElementById('ss');
  let enDate = '05/1/2024 00:00:00';
  let x = setInterval(function () {
    let now = new Date(enDate).getTime();
    let countDown = new Date().getTime();
    let distance = now - countDown;
    let d = Math.floor(distance / (1000 * 60 * 60 * 24));
    let h = Math.floor(distance % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
    let m = Math.floor(distance % (1000 * 60 * 60) / (1000 * 60));
    let s = Math.floor(distance % (1000 * 60) / 1000);
    days.innerHTML = d;
    hours.innerHTML = h;
    minutes.innerHTML = m;
    seconds.innerHTML = s;
    dd.style.strokeDashoffset = 220 - (220 * d) / 365;
    hh.style.strokeDashoffset = 220 - (220 * h) / 24; // 24
    mm.style.strokeDashoffset = 220 - (220 * m) / 60; // 60
    ss.style.strokeDashoffset = 220 - (220 * s) / 60; // 60
  })
  /**************************备忘录********************************/
  var uptext = document.querySelector(".up-textarea");
  var addto = document.querySelector(".up-button");
  var text = document.querySelector("#oContent");
  /*************添加事件*****************/
  addto.onclick = function () {
    inserhtml(uptext.value, '');
    // 添加后清空输入框
    uptext.value = '';
    // 焦点放回输入框
    uptext.focus();
    savetodo();
  }
  /*************savetodo函数****************/
  var savetodo = function () {
    let todoarr = [];
    let todojs = {};
    var econtent = document.querySelectorAll('.content');
    for (let index = 0; index < econtent.length; index++) {
      todojs.name = econtent[index].innerHTML;
      todojs.finish = econtent[index].classList.contains('finish');
      todoarr.push(todojs);
      todojs = {};
    }
    save(todoarr);
  }
  var loadtodo = function () {
    let todoarr = load();
    for (let index = 0; index < todoarr.length; index++) {
      inserhtml(todoarr[index].name, todoarr[index].finish ? 'finish' : '');
    }
  }
  /**********************本地持久储存(localStorage)函数*****************************/
  var save = function (arr) {
    /**JSON.stringify(arr) 先将数组转换为字符串   
     *localStorage.todotext 然后将字符串保存到本地的todotext中*/
    localStorage.todotext = JSON.stringify(arr);
  }
  /**
   *读取函数,把todotext转成数组
   *然后返回数组*/
  var load = function (arr) {
    var arr = JSON.parse(localStorage.todotext);
    return arr;
  }
  /**********************finish样式函数*****************************/
  /**********************按钮点击事件*****************************/
  text.onclick = function () {
    var tg = event.target;
    // 获取父元素下的所有子元素
    var tgkids = tg.parentElement.children;
    /*******************************对复选框的点击事件******************************/
    if (tgkids[0].checked) {
      tgkids[1].classList.add("finish");
    }
    else {
      tgkids[1].classList.remove("finish");
    }
    // 保存更改的样式
    savetodo();
    /*******************************对选择的进行删除********************************************/
    var Select = document.getElementById("up-button1");
    Select.onclick = function () {
      if (confirm("是否删除所选?")) {
        var check = document.getElementsByName("checkbox");
        for (var i = 0; i < check.length; i++) {
          if (check[i].checked) {
            check[i].parentElement.remove();
            i--;
            // 删除后保存
            savetodo();
          }
        }
      }
    }
  }
  var inserhtml = function (val, cls) {
    text.insertAdjacentHTML("beforeend",
      `<div>
            <input type="checkbox" name='checkbox'>               
            <span class='content ${cls}'>${val}</span>   
       </div>`
    )
  }
  loadtodo();
  /********************文本操作框*****************************************/
  // 1. 获取元素
  var login = document.querySelector('.login');
  var mask = document.querySelector('#oContent');
  // 2. 点击弹出层这个链接link,让mask和login显示出来
  link.addEventListener('click', function () {
    mask.style.display = 'block';
    login.style.display = 'block';
  });
  // 3. 点击closeBtn就隐藏mask和login
  closeBtn.addEventListener('click', function () {
    // mask.style.display = 'none';
    login.style.display = 'none';
  });
  // 4. 开始拖拽
  //(1)当我们鼠标按下,就获得鼠标在盒子内的坐标
  title.addEventListener('mousedown', function (e) {
    var x = e.pageX - login.offsetLeft;
    var y = e.pageY - login.offsetTop;
    //(2)鼠标移动的时候,把鼠标在页面中的坐标,减去鼠标在盒子内的坐标就是模态框的left和top值
    document.addEventListener('mousemove', move);
    function move(e) {
      login.style.left = e.pageX - x + 'px';
      login.style.top = e.pageY - y + 'px';
    }
    //(3)鼠标弹起,就让鼠标移动事件移除
    document.addEventListener('mouseup', function () {
      document.removeEventListener('mousemove', move);
    });
  });
  /*****************************提示弹窗无需点击的函数**********************************************/
  function displayAlert(type, data, time) {
    var prompt = document.createElement("div");
    if (type == "success") {
      prompt.style.width = "200px";
      prompt.style.backgroundColor = "#009900";
    } else if (type == "error") {
      prompt.style.width = "280px";
      prompt.style.backgroundColor = "#990000";
    } else if (type == "info") {
      prompt.style.backgroundColor = " #e6b800";
      prompt.style.width = "600px";
    } else {
      return;
    }
    prompt.id = "prompt";
    prompt.style.textAlign = "center";
    prompt.style.position = "absolute";
    prompt.style.height = "60px";
    prompt.style.marginLeft = "-100px";
    prompt.style.marginTop = "-30px";
    prompt.style.left = "30%";
    prompt.style.top = "5%";
    prompt.style.color = "white";
    prompt.style.fontSize = "25px";
    prompt.style.borderRadius = "20px";
    prompt.style.textAlign = "center";
    prompt.style.lineHeight = "60px";
    if (document.getElementById("") == null) {
      document.body.appendChild(prompt);
      prompt.innerHTML = data;
      setTimeout(function () {
        document.body.removeChild(prompt);
      }, time);
    }
  }
  /**************************打开URL按钮的JavaScript******************************************/
  // 获取打开URL按钮元素
  var openBtn = document.getElementById("openButton");
  // 添加点击事件处理程序
  openBtn.addEventListener('click', function () {
    // 获取文件路径
    // 这里假设您已经有一个函数来获取文件路径,例如 prompt('请输入文件路径', 'D:/前端学习', '_blank');
    var filePath = prompt("请输入网站地址或者本地文件路径", "D:/备忘录信息");
    if (filePath) {
      // 使用window.location对象的assign()方法导航到指定文件
      // window.location.assign(filePath);
      // 或者使用window.open()方法打开新窗口导航到指定文件
      window.open(filePath);
    } else {
      displayAlert('info', '未提供有效的文件路径!', 1500);
      // alert("未提供有效的文件路径!");
    }
  });
  /**************************本地文件读取的函数******************************************/
  /**************************复制文本******************************************/
  var oContent = document.getElementById('oContent');
  oContent.ondragend = function () {
    document.execCommand("Copy");
    // alert("复制成功")
    displayAlert('error', '复制成功!', 1500);
  };
</script>
</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/513592.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

合同约定的绩效奖金说不给就不给了, 这合法吗?

目录 一、北京海淀法院参考案例 二、关于绩效奖金的性质&#xff1f; 三、绩效奖金应否发放取决于哪些因素&#xff1f; 四、员工如何举证与质证 五、提前离职的员工 是否享受当年度绩效奖金&#xff1f; 一、北京海淀法院参考案例 https://mp.weixin.qq.com/s/sq0mFCC8M…

微信开发者工具编译后,页面空白,Wxml内容为空

最近遇到了一个奇怪的问题&#xff0c;使用的uniapp运行的微信小程序&#xff0c;改动代码保存后页面就变成空&#xff0c;接口调用一切正常&#xff0c;Wxml内容为空。如下图 重新编译后&#xff0c;偶尔会报这个错误 根据错误提示&#xff0c;尝试了以下方法也没有用。 更…

使用OpenCV4.9的随机生成器和文本

返回&#xff1a;OpenCV系列文章目录&#xff08;持续更新中......&#xff09; 上一篇&#xff1a;OpenCV 4.9基本绘图 下一篇&#xff1a;OpenCV系列文章目录&#xff08;持续更新中......&#xff09; 目标 在本教程中&#xff0c;您将学习如何&#xff1a; 使用随机数生…

STM32 移植 LVGL -- 教程图解

&#xff08; 编辑状态中&#xff0c;已完成80%&#xff0c;估计清明假期后完成更新 ) 移植效果&#xff0c;先睹为快&#xff1a; 目录 一、LVGL 简述 二、准备一个STM32的工程 三、LVGL 官方下载 四、裁剪 源文件 五、添加 源文件 六、注册 显示 七、注册 触摸输入 八…

【flutter封装图片/视频选择控件】

引入库 wechat_assets_picker: ^6.0.5 、video_player: ^2.5.1 # 视频播放、 flutter_screenutil: ^5.7.0 import dart:async; import dart:io; import package:generated/l10n.dart; import package:jade/configs/PathConfig.dart; import package:jade/customWidget/addImag…

The Sandbox 的伙伴们| K-verse 3: Eternal Fandom 的合作伙伴介绍

准备好参加韩国合作伙伴最盛大的聚会吧&#xff0c;就在The Sandbox&#xff01;这是一个前所未有的与你最喜爱的品牌建立联系的绝佳机会。 Otherworld Web 3.0 社交 "Otherworld "的首个数字空间 国内领先网络动漫和娱乐 IP 汇聚并扩展的元宇宙 Otherworld 正在为 …

高级DBA带你解决Mysql主从集群主库产生过多binlog文件引起生产服务器硬盘爆满处理方法实战全网唯一

高级DBA带你解决Mysql主从集群产生过多binlog文件引起生产服务器硬盘爆满处理方法实战全网唯一 一、事故描述 生产环境数据库服务器突然硬盘爆满报警&#xff0c;业务停止&#xff0c;监控短信过来了&#xff0c;一看硬盘满了&#xff0c;再看数据库文件路径一大堆binlog文件…

Redis 主从复制,哨兵模式,集群

目录 主从复制 主从复制 作用 缺陷 主从复制流程 实现Redis主从复制 哨兵模式 主从复制切换的缺点 哨兵的核心功能 哨兵模式原理 哨兵模式的作用 哨兵结构组成 故障转移机制 主节点的选举 实现哨兵模式 集群(Cluster) redis群集有三种模式&#xff0c;主从复制…

Leetcode-894-所有可能的真二叉树-c++

题目详见https://leetcode.cn/problems/all-possible-full-binary-trees/ 主搞动态规划&#xff0c;因为这玩意儿我还不是很懂 关于节点个数为奇数偶数的证明请见官方题解方法一中的如下内容&#xff1a; 这里DP的一个主要思想是&#xff1a;对于任何一个满二叉树&#xff…

算法学习——LeetCode力扣动态规划篇9(1035. 不相交的线、53. 最大子数组和、392. 判断子序列、115. 不同的子序列)

算法学习——LeetCode力扣动态规划篇9 1035. 不相交的线 1035. 不相交的线 - 力扣&#xff08;LeetCode&#xff09; 描述 在两条独立的水平线上按给定的顺序写下 nums1 和 nums2 中的整数。 现在&#xff0c;可以绘制一些连接两个数字 nums1[i] 和 nums2[j] 的直线&#x…

网站可扩展架构设计——中台

从公众号转载&#xff0c;关注微信公众号掌握更多技术动态 --------------------------------------------------------------- 一、中台简介 1.传统项目架构的痛点 (1)重复造轮子 各项目相对独立&#xff0c;许多项目在重复造轮子&#xff0c;让项目本身越来越臃肿&#xf…

外卖配送时间预测项目

注意&#xff1a;本文引用自专业人工智能社区Venus AI 更多AI知识请参考原站 &#xff08;[www.aideeplearning.cn]&#xff09; 项目背景 外卖服务的兴起: 随着互联网技术和移动应用的发展&#xff0c;外卖成为一种日益普及的餐饮服务方式。顾客通过餐厅、杂货店的网站或移…

OpenHarmony Neptune开发板-MQTT连接华为IoT平台

本示例将演示如何在Neptune开发板上使用MQTT协议连接华为IoT平台,使用的是ATH20温湿度传感器模块与Neptune开发板 本示例实现AHT20温湿度数据上报华为IoT平台,IoT平台下发命令控制LED灯的开关 使用W800 SDK功能包中libemqtt来实现连接华为IoT平台 程序设计 初始化 一、MQT…

Stable Diffusion 模型下载:CyberRealistic(真实)

本文收录于《AI绘画从入门到精通》专栏&#xff0c;订阅后可阅读专栏内所有文章&#xff0c;专栏总目录•点这里 文章目录 模型介绍生成案例案例一案例二案例三案例四案例五案例六案例七案例八 下载地址 模型介绍 这是经过严格测试过程的结果&#xff0c;该过程混合了各种模型…

存储故障处理流程演变

存储作为存放金融企业数据中心各类生产数据的重要载体&#xff0c;其日常的安全平稳运行至关重要。特别是应对若干存储的大量告警&#xff0c;如何从大量告警中提取关键告警消息并及时处理异常&#xff0c;可谓对存储平台的稳定运行起到保驾护航的作用。 存储告警处理作为常规…

如何监控特权帐户,保护敏感数据

IT基础设施的增长导致员工可以访问的凭据和资源数量急剧增加。每个组织都存储关键信息&#xff0c;这些信息构成了做出关键业务决策的基石。与特权用户共享这些数据可以授予他们访问普通员工没有的凭据的权限。如果特权帐户凭证落入不法分子之手&#xff0c;它们可能被滥用&…

2024最新AI创作系统ChatGPT源码+Ai绘画网站源码,GPTs应用、AI换脸、插件系统、GPT文档分析、GPT语音对话一站式解决方案

一、前言 SparkAi创作系统是基于ChatGPT进行开发的Ai智能问答系统和Midjourney绘画系统&#xff0c;支持OpenAI-GPT全模型国内AI全模型。本期针对源码系统整体测试下来非常完美&#xff0c;那么如何搭建部署AI创作ChatGPT&#xff1f;小编这里写一个详细图文教程吧。已支持GPT…

Ai音乐大师演示(支持H5、小程序)独立部署源码

Ai音乐大师演示&#xff08;支持H5、小程序&#xff09;独立部署源码

Python网络爬虫(三):Selenium--以携程酒店为例

1 Selenium简介 Selenium是一个用于网站应用程序自动化的工具&#xff0c;它可以直接运行在浏览器中&#xff0c;就像真正的用户在操作一样。它相当于一个机器人&#xff0c;可以模拟人类在浏览器上的一些行为&#xff0c;比如输入文本、点击、回车等。Selenium支持多种浏览器&…

Linux结构目录详解

Linux 在Linux中&#xff0c;系统默认的用户是root&#xff0c;其实和 windows 的 administrator 类似&#xff0c;root 用户可以操作操作系统的任何文件和设备&#xff0c;所以在生产环境就不要乱用root了&#xff0c;权利越大&#xff0c;责任越大。 学习Linux&#xff0c;…
最新文章