Seach Movie from Douban

Add a movie searching field in Douban Movie

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Seach Movie from Douban
// @namespace   feifeihang.info
// @description Add a movie searching field in Douban Movie
// @include     http://movie.douban.com/subject/*
// @include     https://movie.douban.com/subject/*
// @version     3
// @grant       none
// ==/UserScript==
(function (window, document, undefined) {
  var LIST = {
    'Bilibili 哔哩哔哩': 'http://www.bilibili.com/search?keyword=',
    'Soku 搜库': 'http://www.soku.com/search_video/q_',
    'Youtube': 'https://www.youtube.com/results?search_query='
  };
  // find and trim movie title.
  var dom = document.querySelector('#content > h1:nth-child(1) > span:nth-child(1)') || document.querySelector('#content > h1:nth-child(2) > span:nth-child(1)');
  var title = dom.innerHTML;
  title = title.trim();
  // find aside bar.
  var aside = document.querySelector('.aside');
  // now create the external movie links field.
  var field = document.createElement('div');
  field.className += ' gray_ad'; // the light green color style is defined as class 'gray_ad'.
  var subject = document.createElement('h2');
  subject.innerHTML = '视频搜索  · · · · · ·';
  field.appendChild(subject);
  // now add all entities.
  for (var item in LIST) {
    var link = document.createElement('a');
    link.innerHTML = item;
    link.setAttribute('href', LIST[item] + title);
    link.setAttribute('target', '_blank');
    field.appendChild(link);
    field.innerHTML += '<br/>';
  }
  // finally, add the field to aside bar.
  aside.insertBefore(field, aside.firstChild);
}) (window, document);