Skip to content

Instantly share code, notes, and snippets.

@mysteriouss
Last active February 2, 2023 06:18
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save mysteriouss/5ea6487292ac38c392fbb315507a4126 to your computer and use it in GitHub Desktop.
Save mysteriouss/5ea6487292ac38c392fbb315507a4126 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name sinaimg
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*.sinaimg.cn/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function string62to10(number_code) {
number_code = String(number_code);
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
radix = chars.length,
len = number_code.length,
i = 0,
origin_number = 0;
while (i < len) {
origin_number += Math.pow(radix, i++) * chars.indexOf(number_code.charAt(len - i) || 0);
}
return origin_number;
}
function decode(url) {
var lastIndexOfSlash = url.lastIndexOf('/');
var number = url.substr(lastIndexOfSlash + 1, 8);
if (number.startsWith('00')) {
return string62to10(number);
} else {
return parseInt(number, 16);
}
}
window.location = 'https://weibo.com/u/' + decode(window.location.href);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment