// ==UserScript== // @id weiphoneDownlader@ywzhaiqi // @name 威锋电子书批量下载 // @version 1.1 // @namespace // @author ywzhaiqi // @description 批量下载威锋论坛的电子书 // @homepageURL https://greasyfork.org/scripts/668/ // @include http://bbs.feng.com/read-htm-tid-*.html // @include http://bbs.feng.com/thread-htm-fid-*.html // @include http://bbs.feng.com/forum.php* // @run-at document-end // @grant GM_addStyle // @downloadURL none // ==/UserScript== var $ = jQuery = unsafeWindow.jQuery; var RES = getMStr(function(){ var html; /*
' + encodeURIComponent(urls) + ''); // alert('已复制' + downUrls.length + '条下载链接') return; } else { $batchNotice.html('正在获取中...' + '' + downUrls.length + '/' + links.length + ''); } getDownloadLink(); }); } } } getDownloadLink() }); })() // 从函数中获取多行注释的字符串 function getMStr(fn) { var fnSource = fn.toString(); var ret = {}; fnSource = fnSource.replace(/^[^{]+/, ''); // console.log(fnSource); var matched; var reg = /var\s+([$\w]+)[\s\S]*?\/\*([\s\S]+?)\*\//g; while (matched = reg.exec(fnSource)) { // console.log(matched); ret[matched[1]] = matched[2]; }; return ret; }