V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
ToDayMkCode
V2EX  ›  分享创造

小试牛刀 base64 解码 chrome 插件

  •  
  •   ToDayMkCode · 29 天前 · 1694 次点击

    可以不用复制 base64 去解码网站解码了!!

    Dual Decoder

    1a75ea42bde82618e8fb321287e3e2dc.png

    13 条回复    2024-08-29 18:13:21 +08:00
    b1u2g3
        1
    b1u2g3  
       29 天前
    FeHelper 不更全面么?
    a1b2c3T
        2
    a1b2c3T  
       29 天前
    V2-NEXT 脚本了解一下
    NoobNoob030
        3
    NoobNoob030  
       29 天前   ❤️ 1
    F12, atob('base64')
    andforce
        4
    andforce  
       29 天前
    https://www.v2ex.com/t/1066072

    了解一下这里的高赞插件?
    ToDayMkCode
        5
    ToDayMkCode  
    OP
       29 天前
    @andforce 这个秀呀 哈哈哈
    kylebing
        6
    kylebing  
       29 天前
    @NoobNoob030 浏览器自带的无法转中文。

    可以试试网页,感觉还是网页方便 http://kylebing.cn/tools/base64-text/
    x86
        7
    x86  
       29 天前
    @b1u2g3 #1 一直用它,右键几个小工具非常不错
    troilus
        8
    troilus  
       29 天前
    保存为书签,复制 base64 内容后点一下这个书签

    ```
    javascript:(function(){ function decodeBase64(str) { try { return decodeURIComponent(atob(str).split('').map(function(c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); } catch (e) { return "解码失败: " + e.message; } } navigator.clipboard.readText().then(function(clipText) { var decoded = decodeBase64(clipText.trim()); alert("解码结果:\n" + decoded); }).catch(function(err) { alert("读取剪贴板失败: " + err); });})();
    ```
    troilus
        9
    troilus  
       29 天前
    点击后对选中的文本进行 base64 解码并显示结果

    ```
    javascript:(function(){
    function decodeBase64(str) {
    try {
    return decodeURIComponent(atob(str).split('').map(function(c) {
    return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
    }).join(''));
    } catch(e) {
    return "解码失败: " + e.message;
    }
    }

    var selectedText = window.getSelection().toString().trim();
    if (!selectedText) {
    alert("请先选择要解码的文本");
    return;
    }

    var decodedText = decodeBase64(selectedText);
    alert("解码结果:\n" + decodedText);
    })();
    ```
    troilus
        10
    troilus  
       29 天前
    修改为,可以选中解码结果:
    ```
    javascript:(function(){
    function decodeBase64(str) {
    try {
    return decodeURIComponent(atob(str).split('').map(function(c) {
    return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
    }).join(''));
    } catch (e) {
    return "解码失败: " + e.message;
    }
    }

    function getSelectedText() {
    return window.getSelection().toString().trim();
    }

    function createSelectablePopup(content) {
    var popup = document.createElement('div');
    popup.style.cssText = `
    position: fixed;
    top: 20%;
    left: 20%;
    width: 60%;
    max-height: 60%;
    background: white;
    border: 1px solid #ccc;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 1000;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    `;

    var closeButton = document.createElement('button');
    closeButton.textContent = '关闭';
    closeButton.style.cssText = `
    position: absolute;
    top: 10px;
    right: 10px;
    `;
    closeButton.onclick = function() {
    document.body.removeChild(popup);
    };

    var contentDiv = document.createElement('div');
    contentDiv.textContent = content;
    contentDiv.style.cssText = `
    margin-top: 30px;
    user-select: text;
    `;

    popup.appendChild(closeButton);
    popup.appendChild(contentDiv);
    document.body.appendChild(popup);
    }

    var selectedText = getSelectedText();
    if (selectedText) {
    var decoded = decodeBase64(selectedText);
    createSelectablePopup("解码结果:\n" + decoded);
    } else {
    alert("请先选择要解码的 Base64 文本");
    }
    })();
    ```
    ToDayMkCode
        11
    ToDayMkCode  
    OP
       29 天前
    @troilus 🉑
    DOLLOR
        12
    DOLLOR  
       29 天前
    @NoobNoob030

    不如在 BASE64 字符串前加“data:text/plain;base64,”,然后一起粘贴在浏览器地址栏
    DOLLOR
        13
    DOLLOR  
       29 天前
    @DOLLOR
    补充,应该是“data:text/plain;charset=utf-8;base64,”
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   908 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 21:30 · PVG 05:30 · LAX 14:30 · JFK 17:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.