[kesai]豆瓣电影辅助

豆瓣电影辅助,提供一些常用网站的搜索以及预告片的快捷进入

  1. // ==UserScript==
  2. // @name [kesai]豆瓣电影辅助
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1.3
  5. // @description 豆瓣电影辅助,提供一些常用网站的搜索以及预告片的快捷进入
  6. // @description 1.1.3修复1337无法显示问题
  7. // @author kesai
  8. // @match https://movie.douban.com/subject/*
  9. // @require https://cdn.bootcss.com/layer/2.3/layer.js
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. //'use strict';
  15.  
  16. // Your code here...
  17. function addCSS(url) {
  18. var link = window.document.createElement('link');
  19. link.rel = 'stylesheet';
  20. link.type = 'text/css';
  21. link.href = url;
  22. document.getElementsByTagName("HEAD")[0].appendChild(link);
  23. }
  24.  
  25. function popWin(url) {
  26. //iframe窗
  27. var width = window.screen.width * 0.9 + "px";
  28. var height = window.screen.height * 0.8 + "px";
  29. var index = layer.open({
  30. type: 2,
  31. closeBtn: false,
  32. title: "预告片",
  33. shade: [0.9, '#000000'],
  34. shadeClose: true,
  35. offset: 'auto',
  36. //shade: false,
  37. maxmin: false,
  38. //开启最大化最小化按钮
  39. area: [width, height],
  40. content: [url, 'yes'],
  41. success: function (layerInstance) {
  42. console.log(index);
  43. console.log(layer);
  44. //layer.full(index);
  45. }
  46. });
  47. }
  48.  
  49. //默认新窗口配置
  50. var windowDefaultConfig = new Object;
  51. windowDefaultConfig['directories'] = 'no';
  52. windowDefaultConfig['location'] = 'no';
  53. windowDefaultConfig['menubar'] = 'no';
  54. windowDefaultConfig['resizable'] = 'yes';
  55. windowDefaultConfig['scrollbars'] = 'yes';
  56. windowDefaultConfig['status'] = 'no';
  57. windowDefaultConfig['toolbar'] = 'no';
  58.  
  59. function clone(obj) {
  60. var o;
  61. if (typeof obj == "object") {
  62. if (obj === null) {
  63. o = null;
  64. } else {
  65. if (obj instanceof Array) {
  66. o = [];
  67. for (var i = 0, len = obj.length; i < len; i++) {
  68. o.push(clone(obj[i]));
  69. }
  70. } else {
  71. o = {};
  72. for (var j in obj) {
  73. o[j] = clone(obj[j]);
  74. }
  75. }
  76. }
  77. } else {
  78. o = obj;
  79. }
  80. return o;
  81. }
  82. /**
  83. * 以POST表单方式打开新窗口的JQUERY实现
  84. @param:url 需要打开的URL
  85. @param:args URL的参数,数据类型为object
  86. @param:name 打开URL窗口的名字,如果同一按钮需要重复地打开新窗口,
  87. 而不是在第一次打开的窗口做刷新,此参数应每次不同
  88. @param:windowParam 新打开窗口的参数配置
  89. * @author: haijiang.mo
  90. */
  91. function OpenPostWindow(url, args, name, windowParam) {
  92. //创建表单对象
  93. var _form = $("<form></form>", {
  94. 'id': 'tempForm',
  95. 'method': 'post',
  96. 'action': url,
  97. 'target': name,
  98. 'style': 'display:none'
  99. }).appendTo($("body"));
  100.  
  101. //将隐藏域加入表单
  102. for (var i in args) {
  103. _form.append($("<input>", { 'type': 'hidden', 'name': i, 'value': args[i] }));
  104. }
  105.  
  106. //克隆窗口参数对象
  107. var windowConfig = clone(windowDefaultConfig);
  108.  
  109. //配置窗口
  110. for (var i in windowParam) {
  111. windowConfig[i] = windowParam[i];
  112. }
  113.  
  114. //窗口配置字符串
  115. var windowConfigStr = "";
  116.  
  117. for (var i in windowConfig) {
  118. windowConfigStr += i + "=" + windowConfig[i] + ",";
  119. }
  120.  
  121. //绑定提交触发事件
  122. _form.bind('submit', function () {
  123. window.open("about:blank", name);
  124. //window.open("about:blank", name, windowConfigStr);
  125. });
  126.  
  127. //触发提交事件
  128. _form.trigger("submit");
  129. //表单删除
  130. _form.remove();
  131. }
  132.  
  133.  
  134.  
  135. function createButton(backgroudcolor, text, url, type, params) {
  136. var btn = $("<li><span style='margin-top:-10px;cursor:pointer;height:30px;width:55px;background:" + backgroudcolor + ";display:inline-block;text-align:center;line-height:30px;color:white;'>" + text + "</span></li>");
  137. $(".ul_subject_menu ").append(btn);
  138. btn.click(function () {
  139. if (type === 'post') {
  140. var formData = new Object;
  141. params.split("&").forEach(function (item) {
  142. formData[item.split('=')[0]] = item.split('=')[1];
  143. });
  144. OpenPostWindow(url, formData, 'test', null)
  145. } else {
  146. window.open(url);
  147. }
  148. });
  149. }
  150.  
  151. addCSS('https://cdn.bootcss.com/layer/2.3/skin/layer.css');
  152. var text = $("h1 span")[0].innerText;
  153. var movieName = text.split(" ")[0];
  154.  
  155. var configs = [{
  156. color: "#f8d306",
  157. text: "磁力猫",
  158. url: "https://www.cilimao.me/search?word=" + movieName
  159. }, {
  160. color: "#1b6d9d",
  161. text: "字幕库",
  162. url: "https://www.zimuku.la/search?q=" + movieName
  163. }, {
  164. color: "#c0392b",
  165. text: "射手网",
  166. url: "https://assrt.net/sub/?searchword=" + movieName
  167. }, {
  168. color: "#39ac6a",
  169. text: "58网盘",
  170. url: "http://www.58wangpan.com/search/kw" + movieName
  171. }, {
  172. color: "#268dcd",
  173. text: "bd-film",
  174. url: "https://www.bd2020.com/search.jspx?q=" + movieName
  175. }, {
  176. color: "#2B7ACD",
  177. text: "5ndy",
  178. type: "post",
  179. url: "http://www.5ndy.com/search.php?mod=forum",
  180. params: "searchsubmit=yes&srchfid=38&srchtxt=" + movieName
  181. //srchfid:指定搜索范围,38表示只在百度云电影下载板块内搜索
  182. }, {
  183. color: "#222",
  184. text: "哔嘀影视",
  185. url: "https://bde4.com/search/" + movieName
  186. }, {
  187. color: "red",
  188. text: "片库",
  189. url: "https://www.pianku.tv/s/go.php?q=" + movieName
  190. }]
  191.  
  192. configs.forEach(function (item) {
  193. createButton(item.color, item.text, item.url, item.type, item.params);
  194. });
  195.  
  196. var info = $('#info').text();
  197. //var imdb_id = $("[href^='https://www.imdb.com']").text(); //获取imdb链接里的imdb_id
  198. let imdb_id = info.match(/(?<=IMDb:\s)[^\n]*/)[0];
  199. let apikey = '26abfbd0';
  200. let apiurl = 'https://www.omdbapi.com/?tomatoes=false&apikey=' + apikey + '&i=' + imdb_id;
  201. $.ajax({
  202. url: apiurl,
  203. type: "GET",
  204. dataType: "json",
  205. success: function (response) {
  206. var imdb_MovieName = response.Title;
  207. if (imdb_MovieName != null) createButton("red", "1337x", 'https://1377x.to/search/' + imdb_MovieName + '/1/');
  208. }
  209. });
  210.  
  211. // 调整底下剧情简介的位置
  212. let interest_sectl_selector = $('#interest_sectl');
  213. interest_sectl_selector.after($('div.grid-16-8 div.related-info'));
  214. interest_sectl_selector.attr('style', 'float:right');
  215. $('div.related-info').attr('style', 'width:480px;float:left');
  216. $('#link-report').css('margin-bottom', '0px');
  217. $("#interest_sect_level").css('padding-top', '0px');
  218.  
  219. //增加预告片显示
  220. var div = $('<div id="divPiao" style="position: fixed; right:1px!important;right:18px;margin-right:30px; bottom:50px;"></div>');
  221. var ul = $("<ul class='related-pic-bd'></ul>");
  222. var li = $(".label-trailer"); //.clone();
  223. ul.append($(".label-trailer"));
  224. var a = li.find("a");
  225. var url = a.attr("href");
  226. a.attr("href", "javascript:void()");
  227. a.click(function () {
  228. popWin(url);
  229. })
  230. div.append(ul);
  231. $("body").append(div);
  232.  
  233. document.addEventListener("keydown", function (e) {
  234. if (e.keyCode === 192) {
  235. popWin(url);
  236. }
  237. }, false);
  238. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址