// ==UserScript== // @name 豆瓣电影下载插件 // @namespace http://ratwu.com // @description 在豆瓣电影页面显示http://torrentproject.com/的下载链接 // @version v1.0 // @include http://movie.douban.com/subject/* // @downloadURL https://update.greasyfork.icu/scripts/12269/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1%E4%B8%8B%E8%BD%BD%E6%8F%92%E4%BB%B6.user.js // @updateURL https://update.greasyfork.icu/scripts/12269/%E8%B1%86%E7%93%A3%E7%94%B5%E5%BD%B1%E4%B8%8B%E8%BD%BD%E6%8F%92%E4%BB%B6.meta.js // ==/UserScript== var sikemiFunction = function(){ var douban_url = this.location.href; var reg = /(\d{7,8})/g; var douban_id = douban_url.match(reg); var title = $('html head title').text(); var keyword1 = title.replace( '(豆瓣)', '' ).trim(); var keyword2 = encodeURIComponent( keyword1 ); var url = 'http://sikemi.sinaapp.com/douban_api.php?keyword=' + keyword2; var html_title = '

可下载的资源  · · · · · · (全部)

' var html_body_start = '
'; var html_body_endmore = '
反馈
'; var html_body_endend = '
'; var length = 30; var unitname = new Array('Y','Z','E','P','T','G','M','K'); var unitsize = new Array(1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,1024 * 1024 * 1024 * 1024 * 1024 * 1024,1024 * 1024 * 1024 * 1024 * 1024,1024 * 1024 * 1024 * 1024,1024 * 1024 * 1024,1024 * 1024,1024); $.ajax( { type : 'GET', dataType : 'script', url : url, success : function() { if( iaskSearchResult.sp.m > 0 ) { var title,title2, image, filesize, url, unit; var regex = /([A-Z\u0391-\uffe5])/g; for( key in iaskSearchResult.sp.result ) { title = iaskSearchResult.sp.result[key].title; title2 = title.replace( regex, "$1*" ); ellipsis = title2.length > length ? '..' : '' ; title2 = title2.substr( 0, length ).replace( /\*/g, '' ) + ellipsis; filesize = iaskSearchResult.sp.result[key].filesize; seeds = iaskSearchResult.sp.result[key].seeds; if( filesize < 1024 ) filesize = filesize+'B'; for( var i=0; i unitsize[i] || filesize==unitsize[i] ){ filesize = Math.round( filesize / unitsize[i] * 10 ) / 10 + unitname[i]; } } url = iaskSearchResult.sp.result[key].url; html_body_yes += '
  • ' + title2 + '(' + filesize + ' 种子:' + seeds + ')
  • '; } $( '.aside' ).prepend( html_title + html_body_start + html_body_yes + html_body_end + html_body_endmore + html_body_endend ); } else { $( '.aside' ).prepend( html_title + html_body_start + html_body_no + html_body_end + html_body_endend ); } } } ); } function contentEval( source ) { if ('function' == typeof source) { source = '(' + source + ')();' } var script = document.createElement('script'); script.setAttribute("type", "application/javascript"); script.textContent = source; document.body.appendChild(script); document.body.removeChild(script); } contentEval( sikemiFunction );