Skip to content

Instantly share code, notes, and snippets.

@IwakuraRein
Last active April 28, 2022 14:26
Show Gist options
  • Save IwakuraRein/86cea999b33acbedf54da860c7df9db0 to your computer and use it in GitHub Desktop.
Save IwakuraRein/86cea999b33acbedf54da860c7df9db0 to your computer and use it in GitHub Desktop.
Douban2IMDB
// ==UserScript==
// @name 豆瓣页面添加IMDB链接
// @namespace https://github.com/IwakuraRein/
// @version 0.1
// @description 给豆瓣电影的页面添加转到IMDB的链接
// @author Iwakura Rein
// @match *://movie.douban.com/subject/*
// @icon https://img3.doubanio.com/favicon.ico
// @grant none
// ==/UserScript==
(function() {
'use strict';
var info = document.getElementById('info').innerHTML;
var imdb = info.match('<span class="pl">IMDb:</span> .*?<br')[0];
imdb = imdb.replace('<span class="pl">IMDb:</span> ','').replace('<br','');
var newImdb = '<a href="https://www.imdb.com/title/'+imdb+'/" target="_blank">'+imdb+'</a>';
document.getElementById('info').innerHTML = info.replace(imdb, newImdb);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment