zoukankan      html  css  js  c++  java
  • woff2转base64

    Online @font-face generator — Transfonter

     任意文件转base64-直接拖进来 (zhangxinxu.com)

    data:application/x-font-woff2;charset=utf-8;base64,xxxxxxxxxxxxxxxxxxxx
    

      

    <!doctype html>
    <html>
    
    <head>
        <meta charset="utf-8">
        <meta name="description" content="在线Base64生成转换小工具,可以实现任意文件转Base64 Data-URI编码,文件往页面中一拖即可。" />
        <meta name="keywords" content="base64, FileReader, readAsDataURL, 文件" />
        <meta name="author" content="张鑫旭, zhangxinxu" />
        <title>【小程序版】任意文件转base64-直接拖进来</title>
        <style>
            body {
                word-break: break-all;
                margin: 0 1em;
                min-height: 100vh;
                font-family: Consolas, "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", Monaco, "Courier New", monospace;
                overflow: hidden;
            }
            
            .empty::before {
                position: absolute;
                font-size: 50px;
                content: '任意文件A拖到这里';
                white-space: pre;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);
                color: gray;
            }
        </style>
    </head>
    
    <body class="empty">
        <script>
            window.addEventListener("dragenter", function(event) {
                event.preventDefault();
            }, false);
            window.addEventListener("dragover", function(event) {
                event.preventDefault();
            }, false);
            window.addEventListener("drop", function(event) {
                var reader = new FileReader();
                reader.onload = function(e) {
                    var rehead = e.target.result.replace(/octet-stream/, "x-font-woff2;charset=utf-8");
                    document.body.insertAdjacentHTML("afterBegin", '<p>' + rehead + '</p>');
                    document.body.classList.remove('empty');
                };
                reader.readAsDataURL(event.dataTransfer.files[0]);
                event.preventDefault();
            }, false);
        </script>
    </body>
    
    </html>
  • 相关阅读:
    UVALive 7509 Dome and Steles
    HDU 5884 Sort
    Gym 101194H Great Cells
    HDU 5451 Best Solver
    HDU 5883 The Best Path
    HDU 5875 Function
    卡特兰数
    UVa 11729 Commando War 突击战
    UVa 11292 The Dragon of Loowater 勇者斗恶龙
    Spark Scala Flink版本对应关系
  • 原文地址:https://www.cnblogs.com/iblackly/p/14736383.html
Copyright © 2011-2022 走看看