跳转到源地址
当前为
// ==UserScript==
// @name 翻译垃圾再利用
// @namespace inqb.ga
// @version 0.2
// @description 跳转到源地址
// @author no1xsyzy
// @match *://xbuba.com/questions/*
// @match *://www.itranslater.com/qa/details/*
// @match *://itranslater.com/qa/details/*
// @match *://codeday.me/bug/*
// @match *://www.codenong.com/*
// @match *://codenong.com/*
// @match *://ask.helplib.com/others/*
// @match *://hant.ask.helplib.com/others/*
// @match *://qa.1r1g.com/sf/ask/*
// @grant none
// ==/UserScript==
(function() {
'use strict'
try{
switch(window.location.hostname){
case "xbuba.com":
window.location.href = document.querySelector(`a[href^="https://stackoverflow.com/q"]`).getAttribute("href")
break
case "www.itranslater.com":
case "itranslater.com":
window.location.href = document.querySelector(`a[href^="https://stackoverflow.com:/q"]`).getAttribute("href");
break
case "codeday.me":
window.location.href = document.querySelector(`span.article-es-url:nth-child(4) > a:nth-child(1)`).getAttribute("href")
break
case "www.codenong.com":
case "codenong.com":
if (window.location.pathname === "/"){
throw TypeError
}
window.location.href = "https://stackoverflow.com/q"+window.location.pathname
break
case "ask.helplib.com":
case "hant.ask.helplib.com":
window.location.href = "https://stackoverflow.com/search?q="+document.querySelector(`a.main_title`).getAttribute("oldtitle")
break
case "qa.1r1g.com":
window.location.href = "https://stackoverflow.com/q/"+(+/\d+/.exec(window.location.pathname)[0]-31)/70
break
default:
throw TypeError
}
}catch(e){
console.log("unknown source")
}
})();