Warning: fopen(/www/sites/update.greasyfork.icu/index/store/forever/440e16772d3fe1f8720bca863a0dfbe0.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @name 豆瓣读书资源助手
// @namespace yueye
// @version 1.0
// @description 在豆瓣读书页面展示资源站下载链接
// @author yueye
// @match https://book.douban.com/subject/*
// @require http://cdn.bootcss.com/jquery/3.2.1/jquery.min.js
// @grant GM.xmlHttpRequest
// @downloadURL none
// ==/UserScript==
(function () {
var title = document.querySelector('h1 span').innerText
var website = [{
site: '我的小书屋',
searchLink: 'http://mebook.cc/?s='
},{
site: 'sobooks',
searchLink: 'https://sobooks.cc/search/'
}]
/*
function getDownloadLink (title) {
return new Promise(function(resolve, reject) {
GM.xmlHttpRequest({
method: 'GET',
url: 'http://127.0.0.1:3000/index?keywords=' + title,
onload: function(response) {
console.log(JSON.parse(response.responseText))
resolve(JSON.parse(response.responseText))
}
})
})
}
*/
function showInDoubanPage (list) {
var html = [
'',
'
',
'
'+ title +'资源下载 · · · · · ·
',
'
',
'
',
'
',
].join('')
var sidebar = document.querySelector('.aside')
sidebar.innerHTML = html + sidebar.innerHTML
}
if (/book.douban.com/.test(location.href)) {
if (!title) return false
/*
getDownloadLink(title).then(res => {
console.log('请求完成')
})
*/
var res = []
website.map((item) => {
var html = [
'',
''+ item.site +'',
'下载',
'',
]
res = res.concat(html)
console.log(html)
})
showInDoubanPage(res)
}
})()