Skip to main content

✅De-Bar.php

Here's a page which helps you decode Bar Codes to make sure what you are scanning is safe.

<!DOCTYPE html>
<html>
<head>
    <title>De-BarCode</title>
    <script src="https://cdn.rawgit.com/serratus/quaggaJS/0420d8e0/dist/quagga.min.js"></script>
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=0.8">
    <style>
        @media (max-width: 980px) {
          body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #007eca;
          }
        }
        @media (min-width: 981px) {
          body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #007eca;
            background-image: url("https://dl.itslittlekevin.com/projects/5069.png");
            background-repeat: no-repeat;
            background-position: right center;
            background-size: auto 100%;
          }
        }
        h1, p, h4 {
          text-shadow: 2px 2px 2px #00000055;
        }
        * {
            color: white;
        }
        button {
            font-size: 15px;
            background-color: #00325565;
            padding: 5px 15px;
            border-radius: 5px;
            border-width: 0px;
            margin: 5px;
            cursor: pointer;
        }
        h4 a {
            text-decoration: none;
        }        
        #barcodefile {
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <h1 align=center>条形码解码器 <br> BarCode Decoder</h1>
    <input type="file" id="barcodefile" accept="image/*">
    <button id="submit">提交 | Submit</button>
    <p id="result"></p>

    <script>
        document.getElementById('submit').onclick = function() {
            let file = document.getElementById('barcodefile').files[0];
            if (file) {
                Quagga.decodeSingle({
                    decoder: {
                        readers: ['ean_reader'] // 这是EAN条形码阅读器
                    },
                    locate: true, // 尝试定位条形码
                    src: URL.createObjectURL(file) // 使用创建的URL来读取图像
                }, function(result){
                    if(result.codeResult) {
                        console.log("条形码: " + result.codeResult.code);
                        document.getElementById('result').innerText = "条形码: " + result.codeResult.code;
                    } else {
                        console.log("未检测到条形码");
                        document.getElementById('result').innerText = "未检测到条形码 | Did not detected BarCode";
                    }
                });
            } else {
                alert("请先选择一个文件");
            }
        };
    </script>
    <h4><a href="https://itslittlekevin.com/gadgetslist">»返回工具列表 | Return to Gadgets List«</a></h4>
    <p>© itsLittleKevin · All rights reserved.</p>
</body>
</html>