豆瓣电影+资源

找百度网盘和种子不用打开一堆新标签,有的话会直接播放

As of 2020-10-07 04:22:56 UTC. See the latest version.

// ==UserScript==
// @name         豆瓣电影+资源
// @namespace    undefined
// @version      1.5
// @description  找百度网盘和种子不用打开一堆新标签,有的话会直接播放
// @author       WuChaolong
// @match        *://movie.douban.com/subject/*

// ==/UserScript==

;(function() {

var key = document.querySelector('meta[name="keywords"]').getAttribute('content');
key = key.split(",")[0];


var html = (dedent `<div id="wuchaolong">
<h2><i class="">资源</i>
              · · · · · ·
            <span class="pl">
          (
          <a href="https://wuchaolong.github.io/video/?search=${key}" target="_blank">更多</a>
          )</span>
  </h2>
<iframe allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"  scrolling="no" src="https://wuchaolong.github.io/video/?search=${key}"></iframe>
<p class="wuchaolong-more">
<span class="pl">
          (
          <a href="https://wuchaolong.github.io/video/?search=${key}" target="_blank">更多</a>
          )</span>
<link rel="stylesheet" href="https://wuchaolong.github.io/video/douban/greasyfork.css" />

</div>
`);
var d = document.createElement('div');
d.innerHTML = html;
var aside = document.querySelector(".aside");
aside.insertBefore(d.childNodes[0], document.getElementById("subject-others-interests"));

function dedent(strings, ...values) {

  let result = '';
  for (let i = 0; i < strings.length; i++) {
      if(values&&values[i]){
        result += strings[i].replace(/\n\s+/g, '\n') + values[i];
      }else{
          result += strings[i].replace(/\n\s+/g, '\n');
      }
  }
  return result;
}


})()