PUGE 6 yıl önce
ebeveyn
işleme
8a9be81594
4 değiştirilmiş dosya ile 48 ekleme ve 9 silme
  1. 1 0
      img/loading.svg
  2. 1 0
      img/no-script.svg
  3. 4 2
      js/popup.js
  4. 42 7
      popup.html

+ 1 - 0
img/loading.svg

@@ -0,0 +1 @@
+<svg width="200px"  height="200px"  xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-ripple" style="background: none;"><circle cx="50" cy="50" r="23.0572" fill="none" ng-attr-stroke="{{config.c1}}" ng-attr-stroke-width="{{config.width}}" stroke="#3e6d8d" stroke-width="2"><animate attributeName="r" calcMode="spline" values="0;40" keyTimes="0;1" dur="1" keySplines="0 0.2 0.8 1" begin="-0.5s" repeatCount="indefinite"></animate><animate attributeName="opacity" calcMode="spline" values="1;0" keyTimes="0;1" dur="1" keySplines="0.2 0 0.8 1" begin="-0.5s" repeatCount="indefinite"></animate></circle><circle cx="50" cy="50" r="39.1532" fill="none" ng-attr-stroke="{{config.c2}}" ng-attr-stroke-width="{{config.width}}" stroke="#4b9bbe" stroke-width="2"><animate attributeName="r" calcMode="spline" values="0;40" keyTimes="0;1" dur="1" keySplines="0 0.2 0.8 1" begin="0s" repeatCount="indefinite"></animate><animate attributeName="opacity" calcMode="spline" values="1;0" keyTimes="0;1" dur="1" keySplines="0.2 0 0.8 1" begin="0s" repeatCount="indefinite"></animate></circle></svg>

+ 1 - 0
img/no-script.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1573052538880" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8880" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><defs><style type="text/css"></style></defs><path d="M457 335.8v165.6l397.7 1.1V372.8z" fill="#CBCBCB" p-id="8881"></path><path d="M457 335.8V485l-321.5-32.7v-46.8z" fill="#B9B9B9" p-id="8882"></path><path d="M136.6 405.5v432.6l380.3 76.3V442.5z" fill="#D3D3D3" p-id="8883"></path><path d="M136.6 405.5l-74 160.4 380.3 76.3 74-199.7z" fill="#E9E9E9" p-id="8884"></path><path d="M855.8 375v432.6L516.9 914.4V442.5z" fill="#C9C9C9" p-id="8885"></path><path d="M855.8 375l103.5 168.8-338.8 106.8-103.6-208.1z" fill="#DDDDDD" p-id="8886"></path><path d="M618.8 90.7l53.1-19.5-4.7 89.8-30.6 8.9zM688.5 176.6l17.7 13.6L789 92.6l-61.5-29.2zM752.7 215.9l11.4 31.6 95.3-31.6-10.9-63.2z" fill="#E9E9E9" p-id="8887"></path></svg>

+ 4 - 2
js/popup.js

@@ -69,9 +69,11 @@ window.onload = function() {
   // alert("页面加载完成!"); 
   // 获取是否有脚本
   getSchemeData.then((dataTemp) => {
+    const scriptBox = document.getElementsByClassName('script-box')[0]
     if (dataTemp.err !== 0) {
-      buttonItem.classList.add('no-scheme')
-      buttonItem.innerText = '此页面没有脚本'
+      scriptBox.classList.add('no-scheme')
+    } else {
+      scriptBox.classList.add('scheme')
     }
   })
 }

+ 42 - 7
popup.html

@@ -8,8 +8,11 @@
     <meta name="apple-mobile-web-app-title" content="CodeDay">
     <meta http-equiv="Cache-Control" content="no-siteapp">
     <style>
+      body, html {
+        margin: 0;
+      }
       button {
-        width: 180px;
+        width: 100%;
         border: none;
         height: 30px;
         background-color: #009fe9;
@@ -22,16 +25,41 @@
         font-family: "Microsoft YaHei";
         font-size: 12px;
         line-height: 26px;
-        color: #333;
+        background-color: #009fe9;
+        color: white;
+        padding: 0 10px;
+        height: 26px;
+      }
+      .no-script {
+        display: none;
+      }
+      .no-scheme .loading {
+        display: none;
       }
-      .no-scheme {
-        background-color: #ccc;
-        box-shadow: none;
-        pointer-events: none;
+      .no-scheme .no-script {
+        display: block;
       }
       .login {
         display: none;
       }
+      .script-box {
+        width: 200px;
+        height: 200px;
+        overflow: auto;
+        position: relative;
+      }
+      .loading, .no-script {
+        width: 160px;
+        position: absolute;
+        left: 0;
+        right: 0;
+        top: 0;
+        bottom: 0;
+        margin: auto;
+      }
+      .button-box {
+        display: none;
+      }
     </style>
   </head>
   <body>
@@ -39,7 +67,14 @@
       <span class="user"></span>
       <div class="login">登录</div>
     </div>
-    <button>获取方案</button>
+    <div class="script-box">
+      <img class="loading" src="./img/loading.svg">
+      <img class="no-script" src="./img/no-script.svg">
+      <div class="button-box">
+        <button>获取方案</button>
+      </div>
+    </div>
+    
     <script type="text/javascript" src="js/popup.js"></script>
   </body>