小试牛刀 base64 解码 chrome 插件

29 天前
 ToDayMkCode

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

Dual Decoder

1693 次点击
所在节点    分享创造
13 条回复
b1u2g3
29 天前
FeHelper 不更全面么?
a1b2c3T
29 天前
V2-NEXT 脚本了解一下
NoobNoob030
29 天前
F12, atob('base64')
andforce
29 天前
https://www.v2ex.com/t/1066072

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

可以试试网页,感觉还是网页方便 http://kylebing.cn/tools/base64-text/
x86
29 天前
@b1u2g3 #1 一直用它,右键几个小工具非常不错
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
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
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
29 天前
@troilus 🉑
DOLLOR
29 天前
@NoobNoob030

不如在 BASE64 字符串前加“data:text/plain;base64,”,然后一起粘贴在浏览器地址栏
DOLLOR
29 天前
@DOLLOR
补充,应该是“data:text/plain;charset=utf-8;base64,”

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1068699

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX