您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Twitter to Tumblr Redirect
- // ==UserScript==
- // @name Twitter redirect
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Twitter to Tumblr Redirect
- // @author SaishoVibes
- // @match *://*.twitter.com/*
- // @icon https://www.google.com/s2/favicons?domain=tumblr.com
- // @grant none
- // @run-at document-start
- // @license GNU GPLv2
- // ==/UserScript==
- var oldHref = document.location.href;
- if (window.location.href.indexOf('twitter.com/') > -1) {
- window.location.replace(window.location.toString().replace('twitter', 'tumblr'));
- }
- window.onload = function() {
- var bodyList = document.querySelector("body")
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if (oldHref != document.location.href) {
- oldHref = document.location.href;
- console.log('location changed!');
- if (window.location.href.indexOf('twitter.com/') > -1) {
- window.location.replace(window.location.toString().replace('twitter', 'tumblr'));
- }
- }
- });
- });
- var config = {
- childList: true,
- subtree: true
- };
- observer.observe(bodyList, config);
- };