您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Decode hex strings on Voz
当前为
- // ==UserScript==
- // @name Decode Hex strings on Voz
- // @namespace Decode Hex strings on Voz
- // @version 1.1
- // @icon https://www.google.com/s2/favicons?sz=64&domain=voz.vn
- // @author kylyte
- // @description Decode hex strings on Voz
- // @match https://voz.vn/t/*
- // @run-at document-idle
- // @license GPL-3.0
- // ==/UserScript==
- (function() {
- 'use strict';
- function decodeHex(hexString) {
- var hex = hexString.toString();
- var str = '';
- for (var i = 0; i < hex.length; i += 2)
- str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
- return str;
- }
- function decodeHexInBbWrapper() {
- var elements = document.getElementsByClassName('bbWrapper');
- for (var i = 0; i < elements.length; i++) {
- if (elements[i].querySelector('.bbMediaJustifier')) {
- continue;
- }
- var content = elements[i].innerHTML;
- var regex = /([0-9A-Fa-f]{2}){8,}/g;
- var matches = content.match(regex);
- if (matches) {
- matches.forEach(function(hexString) {
- var decodedText = decodeHex(hexString);
- content = content.replace(hexString, decodedText);
- });
- elements[i].innerHTML = content;
- }
- }
- }
- decodeHexInBbWrapper();
- var observer = new MutationObserver(function(mutationsList) {
- for (var mutation of mutationsList) {
- if (mutation.type === 'childList' && mutation.target.classList.contains('bbWrapper')) {
- decodeHexInBbWrapper();
- break;
- }
- }
- });
- observer.observe(document.documentElement, {
- childList: true,
- subtree: true
- });
- })();