Selaa lähdekoodia

禁止使用鼠标右键和按F12

shaogen1995 11 kuukautta sitten
vanhempi
commit
e45d839bc4
4 muutettua tiedostoa jossa 104 lisäystä ja 20 poistoa
  1. 2 0
      .gitignore
  2. 57 14
      hot_源码/public/index.html
  3. 11 6
      hot_源码/src/views/Home.vue
  4. 34 0
      scene/index.html

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+/data
+/hot

+ 57 - 14
hot_源码/public/index.html

@@ -1,16 +1,59 @@
 <!DOCTYPE html>
 <html lang="en">
-  <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><%= htmlWebpackPlugin.options.title %></title>
-  </head>
-  <body>
-    <noscript>
-      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
-    </noscript>
-    <div id="app"></div>
-    <!-- built files will be auto injected -->
-  </body>
-</html>
+
+<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>
+    <%= htmlWebpackPlugin.options.title %>
+  </title>
+
+  <style>
+    img {
+      pointer-events: none;
+      -webkit-user-select: none;
+      -moz-user-select: none;
+      user-select: none;
+    }
+  </style>
+
+</head>
+
+<body>
+  <noscript>
+    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
+        Please enable it to continue.</strong>
+  </noscript>
+  <div id="app"></div>
+
+  <script>
+
+    if (!window.location.href.includes('&T=1')) {
+      document.addEventListener("contextmenu", function (e) {
+        e.preventDefault();
+      });
+      document.onkeydown = () => {
+        //禁用F12
+        if (window.event && window.event.keyCode == 123) {
+          return false;
+          //禁用ctrl+shift+i,
+        } else if (
+          window.event.ctrlKey &&
+          window.event.shiftKey &&
+          window.event.keyCode == 73
+        ) {
+          return false;
+          //屏蔽Shift+F10
+        } else if (window.event.shiftKey && window.event.keyCode == 121) {
+          return false;
+        }
+      };
+    }
+
+  </script>
+
+  <!-- built files will be auto injected -->
+</body>
+
+</html>

+ 11 - 6
hot_源码/src/views/Home.vue

@@ -47,18 +47,20 @@
       >
         <swiper-slide v-for="(item, i) in data[active]" :key="i">
           <div class="slide">
-            <img
-              style="cursor: pointer"
+            <div
+              class="slideImgBox"
               v-if="active === 'images'"
-              v-lazy="fixUrl(item)"
               @click="lookImg(fixUrl(item))"
-              alt=""
-            />
+            >
+              <img style="cursor: pointer" v-lazy="fixUrl(item)" alt="" />
+            </div>
+
             <video
               class="videoDom"
               v-else-if="active === 'video'"
               :src="fixUrl(item.url)"
-              controls
+              controls="true"
+              controlslist="nodownload"
             ></video>
             <iframe
               @click="colseParent(item)"
@@ -403,6 +405,9 @@ export default {
       height: 100%;
       .slide {
         font-size: 0;
+        .slideImgBox{
+          cursor: pointer;
+        }
         img,
         video,
         iframe {

+ 34 - 0
scene/index.html

@@ -14,6 +14,16 @@
     <link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon.png" class="keep">
     <link rel="stylesheet" href="css/oldVer/main0.css">
     <link rel="stylesheet" href="css/main.css?v=2.25">
+
+    <style>
+        .thumbImg img {
+            pointer-events: none;
+            -webkit-user-select: none;
+            -moz-user-select: none;
+            user-select: none;
+        }
+    </style>
+
     <!-- <link rel="stylesheet" href="/CAD/cad.css?v=2.25"> -->
     <script>
         var number = window.location.href.substring(window.location.href.indexOf("=") + 1);
@@ -826,6 +836,30 @@
     <script>
 
 
+
+        if (!window.location.href.includes('&T=1')) {
+            document.addEventListener("contextmenu", function (e) {
+                e.preventDefault();
+            });
+            document.onkeydown = () => {
+                //禁用F12
+                if (window.event && window.event.keyCode == 123) {
+                    return false;
+                    //禁用ctrl+shift+i,
+                } else if (
+                    window.event.ctrlKey &&
+                    window.event.shiftKey &&
+                    window.event.keyCode == 73
+                ) {
+                    return false;
+                    //屏蔽Shift+F10
+                } else if (window.event.shiftKey && window.event.keyCode == 121) {
+                    return false;
+                }
+            };
+        }
+
+
         fetch('https://count.4dage.com/api/count/saveVisit/KJ-iTzKmB6AQfD')
             .then(response => response.json())
             .then(data => {