RSSHelper

A way to add a rss feed button on webpage

目前为 2018-11-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name RSSHelper
  3. // @version 0.0.7
  4. // @description A way to add a rss feed button on webpage
  5. // @author SettingDust
  6. //
  7. // @include http*://*
  8. // @license MIT
  9. //
  10. // @require https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
  11. // @require https://cdn.bootcss.com/clipboard.js/2.0.1/clipboard.min.js
  12. //
  13. // @grant GM_addStyle
  14. // @namespace https://greasyfork.org/users/149095
  15. // ==/UserScript==
  16.  
  17. /******/ (function(modules) { // webpackBootstrap
  18. /******/ // The module cache
  19. /******/ var installedModules = {};
  20. /******/
  21. /******/ // The require function
  22. /******/ function __webpack_require__(moduleId) {
  23. /******/
  24. /******/ // Check if module is in cache
  25. /******/ if(installedModules[moduleId]) {
  26. /******/ return installedModules[moduleId].exports;
  27. /******/ }
  28. /******/ // Create a new module (and put it into the cache)
  29. /******/ var module = installedModules[moduleId] = {
  30. /******/ i: moduleId,
  31. /******/ l: false,
  32. /******/ exports: {}
  33. /******/ };
  34. /******/
  35. /******/ // Execute the module function
  36. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37. /******/
  38. /******/ // Flag the module as loaded
  39. /******/ module.l = true;
  40. /******/
  41. /******/ // Return the exports of the module
  42. /******/ return module.exports;
  43. /******/ }
  44. /******/
  45. /******/
  46. /******/ // expose the modules object (__webpack_modules__)
  47. /******/ __webpack_require__.m = modules;
  48. /******/
  49. /******/ // expose the module cache
  50. /******/ __webpack_require__.c = installedModules;
  51. /******/
  52. /******/ // define getter function for harmony exports
  53. /******/ __webpack_require__.d = function(exports, name, getter) {
  54. /******/ if(!__webpack_require__.o(exports, name)) {
  55. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  56. /******/ }
  57. /******/ };
  58. /******/
  59. /******/ // define __esModule on exports
  60. /******/ __webpack_require__.r = function(exports) {
  61. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  62. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  63. /******/ }
  64. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  65. /******/ };
  66. /******/
  67. /******/ // create a fake namespace object
  68. /******/ // mode & 1: value is a module id, require it
  69. /******/ // mode & 2: merge all properties of value into the ns
  70. /******/ // mode & 4: return value when already ns object
  71. /******/ // mode & 8|1: behave like require
  72. /******/ __webpack_require__.t = function(value, mode) {
  73. /******/ if(mode & 1) value = __webpack_require__(value);
  74. /******/ if(mode & 8) return value;
  75. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  76. /******/ var ns = Object.create(null);
  77. /******/ __webpack_require__.r(ns);
  78. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  79. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  80. /******/ return ns;
  81. /******/ };
  82. /******/
  83. /******/ // getDefaultExport function for compatibility with non-harmony modules
  84. /******/ __webpack_require__.n = function(module) {
  85. /******/ var getter = module && module.__esModule ?
  86. /******/ function getDefault() { return module['default']; } :
  87. /******/ function getModuleExports() { return module; };
  88. /******/ __webpack_require__.d(getter, 'a', getter);
  89. /******/ return getter;
  90. /******/ };
  91. /******/
  92. /******/ // Object.prototype.hasOwnProperty.call
  93. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  94. /******/
  95. /******/ // __webpack_public_path__
  96. /******/ __webpack_require__.p = "";
  97. /******/
  98. /******/
  99. /******/ // Load entry module and return exports
  100. /******/ return __webpack_require__(__webpack_require__.s = 0);
  101. /******/ })
  102. /************************************************************************/
  103. /******/ ([
  104. /* 0 */
  105. /***/ (function(module, exports, __webpack_require__) {
  106.  
  107. __webpack_require__(1);
  108. const logger = __webpack_require__(2);
  109. const Route = __webpack_require__(4);
  110.  
  111. const Router = __webpack_require__(6);
  112. const router = new Router();
  113.  
  114. router.push(new Route(/yande\.re\/.*/, __webpack_require__(7)));
  115. router.push(new Route(/\/?.*\.?bilibili\.com\/.*/, __webpack_require__(16)));
  116. router.push(new Route(/\/?.*\.?weibo\.com\/.*/, __webpack_require__(21)));
  117. router.push(new Route(/\/?.*\.?pixiv\.net\/.*/, __webpack_require__(22)));
  118.  
  119. router.push(new Route(/.+/, __webpack_require__(26)));
  120.  
  121. router.load(location.href);
  122.  
  123. new ClipboardJS('#rss-helper');
  124.  
  125.  
  126. /***/ }),
  127. /* 1 */
  128. /***/ (function(module, exports) {
  129.  
  130. $.fn.feedInit = function() {
  131. this.attr('target', '_blank');
  132. this.attr('id', 'rss-helper');
  133. return this;
  134. };
  135.  
  136. $.fn.href = function(href) {
  137. this.attr('href', href);
  138. this.attr('data-clipboard-text', href);
  139. };
  140.  
  141. /***/ }),
  142. /* 2 */
  143. /***/ (function(module, exports, __webpack_require__) {
  144.  
  145. const monkey = __webpack_require__(3);
  146. module.exports = {
  147. info: (message) => {
  148. console.info(`[${monkey.header.name}]`, message);
  149. },
  150. debug: (message) => {
  151. console.debug(`[${monkey.header.name}]`, message);
  152. },
  153. warn: (message) => {
  154. console.warn(`[${monkey.header.name}]`, message);
  155. }
  156. };
  157.  
  158. /***/ }),
  159. /* 3 */
  160. /***/ (function(module, exports) {
  161.  
  162. let name = 'RSSHelper';
  163. let version = '0.0.7';
  164. let description = 'A way to add a rss feed button on webpage';
  165.  
  166. const config = {
  167. entry: './src/javascript/index.js'
  168. };
  169.  
  170. const header = {
  171. name: name,
  172. version: version,
  173. description: description,
  174. author: 'SettingDust',
  175. include: ['http*://*'],
  176. license: 'MIT',
  177. require: [
  178. 'https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js',
  179. 'https://cdn.bootcss.com/clipboard.js/2.0.1/clipboard.min.js'
  180. ],
  181. grant: [
  182. //https://tampermonkey.net/documentation.php#GM_addStyle
  183. 'GM_addStyle' //GM_addStyle(require('file').toString())
  184. ]
  185. };
  186.  
  187. module.exports.config = config;
  188. module.exports.header = header;
  189. module.exports.buildedHeader = () => {
  190. let headerString = [];
  191. headerString.push('// ==UserScript==');
  192. for (let headerKey in header) {
  193. if (Array.isArray(header[headerKey])) {
  194. if (header[headerKey].length > 0) headerString.push('//');
  195. for (let p in header[headerKey]) {
  196. headerString.push('// @' + headerKey.padEnd(13) + header[headerKey][p]);
  197. }
  198. } else {
  199. headerString.push('// @' + headerKey.padEnd(13) + header[headerKey]);
  200. }
  201. }
  202. headerString.push('// ==/UserScript==');
  203. headerString.push('');
  204. return headerString.join('\n');
  205. };
  206.  
  207.  
  208. /***/ }),
  209. /* 4 */
  210. /***/ (function(module, exports, __webpack_require__) {
  211.  
  212. const pathToRegexp = __webpack_require__(5);
  213.  
  214. module.exports = class Route {
  215. constructor(url, route) {
  216. this._url = url;
  217. this._route = route;
  218. }
  219.  
  220. get url() {
  221. return this._url;
  222. }
  223.  
  224. get route() {
  225. return this._route;
  226. }
  227.  
  228. test(link) {
  229. let regex = pathToRegexp(this.url);
  230. if (link.input) return regex.test(link.input);
  231. else return regex.test(link);
  232. }
  233.  
  234. match(link) {
  235. let regex = pathToRegexp(this.url);
  236. if (link.input) return regex.exec(link.input);
  237. else return regex.exec(link);
  238. }
  239.  
  240. call(args) {
  241. this.route(args);
  242. }
  243. };
  244.  
  245.  
  246. /***/ }),
  247. /* 5 */
  248. /***/ (function(module, exports) {
  249.  
  250. /**
  251. * Expose `pathToRegexp`.
  252. */
  253. module.exports = pathToRegexp
  254. module.exports.parse = parse
  255. module.exports.compile = compile
  256. module.exports.tokensToFunction = tokensToFunction
  257. module.exports.tokensToRegExp = tokensToRegExp
  258.  
  259. /**
  260. * Default configs.
  261. */
  262. var DEFAULT_DELIMITER = '/'
  263. var DEFAULT_DELIMITERS = './'
  264.  
  265. /**
  266. * The main path matching regexp utility.
  267. *
  268. * @type {RegExp}
  269. */
  270. var PATH_REGEXP = new RegExp([
  271. // Match escaped characters that would otherwise appear in future matches.
  272. // This allows the user to escape special characters that won't transform.
  273. '(\\\\.)',
  274. // Match Express-style parameters and un-named parameters with a prefix
  275. // and optional suffixes. Matches appear as:
  276. //
  277. // ":test(\\d+)?" => ["test", "\d+", undefined, "?"]
  278. // "(\\d+)" => [undefined, undefined, "\d+", undefined]
  279. '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'
  280. ].join('|'), 'g')
  281.  
  282. /**
  283. * Parse a string for the raw tokens.
  284. *
  285. * @param {string} str
  286. * @param {Object=} options
  287. * @return {!Array}
  288. */
  289. function parse (str, options) {
  290. var tokens = []
  291. var key = 0
  292. var index = 0
  293. var path = ''
  294. var defaultDelimiter = (options && options.delimiter) || DEFAULT_DELIMITER
  295. var delimiters = (options && options.delimiters) || DEFAULT_DELIMITERS
  296. var pathEscaped = false
  297. var res
  298.  
  299. while ((res = PATH_REGEXP.exec(str)) !== null) {
  300. var m = res[0]
  301. var escaped = res[1]
  302. var offset = res.index
  303. path += str.slice(index, offset)
  304. index = offset + m.length
  305.  
  306. // Ignore already escaped sequences.
  307. if (escaped) {
  308. path += escaped[1]
  309. pathEscaped = true
  310. continue
  311. }
  312.  
  313. var prev = ''
  314. var next = str[index]
  315. var name = res[2]
  316. var capture = res[3]
  317. var group = res[4]
  318. var modifier = res[5]
  319.  
  320. if (!pathEscaped && path.length) {
  321. var k = path.length - 1
  322.  
  323. if (delimiters.indexOf(path[k]) > -1) {
  324. prev = path[k]
  325. path = path.slice(0, k)
  326. }
  327. }
  328.  
  329. // Push the current path onto the tokens.
  330. if (path) {
  331. tokens.push(path)
  332. path = ''
  333. pathEscaped = false
  334. }
  335.  
  336. var partial = prev !== '' && next !== undefined && next !== prev
  337. var repeat = modifier === '+' || modifier === '*'
  338. var optional = modifier === '?' || modifier === '*'
  339. var delimiter = prev || defaultDelimiter
  340. var pattern = capture || group
  341.  
  342. tokens.push({
  343. name: name || key++,
  344. prefix: prev,
  345. delimiter: delimiter,
  346. optional: optional,
  347. repeat: repeat,
  348. partial: partial,
  349. pattern: pattern ? escapeGroup(pattern) : '[^' + escapeString(delimiter) + ']+?'
  350. })
  351. }
  352.  
  353. // Push any remaining characters.
  354. if (path || index < str.length) {
  355. tokens.push(path + str.substr(index))
  356. }
  357.  
  358. return tokens
  359. }
  360.  
  361. /**
  362. * Compile a string to a template function for the path.
  363. *
  364. * @param {string} str
  365. * @param {Object=} options
  366. * @return {!function(Object=, Object=)}
  367. */
  368. function compile (str, options) {
  369. return tokensToFunction(parse(str, options))
  370. }
  371.  
  372. /**
  373. * Expose a method for transforming tokens into the path function.
  374. */
  375. function tokensToFunction (tokens) {
  376. // Compile all the tokens into regexps.
  377. var matches = new Array(tokens.length)
  378.  
  379. // Compile all the patterns before compilation.
  380. for (var i = 0; i < tokens.length; i++) {
  381. if (typeof tokens[i] === 'object') {
  382. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')
  383. }
  384. }
  385.  
  386. return function (data, options) {
  387. var path = ''
  388. var encode = (options && options.encode) || encodeURIComponent
  389.  
  390. for (var i = 0; i < tokens.length; i++) {
  391. var token = tokens[i]
  392.  
  393. if (typeof token === 'string') {
  394. path += token
  395. continue
  396. }
  397.  
  398. var value = data ? data[token.name] : undefined
  399. var segment
  400.  
  401. if (Array.isArray(value)) {
  402. if (!token.repeat) {
  403. throw new TypeError('Expected "' + token.name + '" to not repeat, but got array')
  404. }
  405.  
  406. if (value.length === 0) {
  407. if (token.optional) continue
  408.  
  409. throw new TypeError('Expected "' + token.name + '" to not be empty')
  410. }
  411.  
  412. for (var j = 0; j < value.length; j++) {
  413. segment = encode(value[j], token)
  414.  
  415. if (!matches[i].test(segment)) {
  416. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '"')
  417. }
  418.  
  419. path += (j === 0 ? token.prefix : token.delimiter) + segment
  420. }
  421.  
  422. continue
  423. }
  424.  
  425. if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
  426. segment = encode(String(value), token)
  427.  
  428. if (!matches[i].test(segment)) {
  429. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"')
  430. }
  431.  
  432. path += token.prefix + segment
  433. continue
  434. }
  435.  
  436. if (token.optional) {
  437. // Prepend partial segment prefixes.
  438. if (token.partial) path += token.prefix
  439.  
  440. continue
  441. }
  442.  
  443. throw new TypeError('Expected "' + token.name + '" to be ' + (token.repeat ? 'an array' : 'a string'))
  444. }
  445.  
  446. return path
  447. }
  448. }
  449.  
  450. /**
  451. * Escape a regular expression string.
  452. *
  453. * @param {string} str
  454. * @return {string}
  455. */
  456. function escapeString (str) {
  457. return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1')
  458. }
  459.  
  460. /**
  461. * Escape the capturing group by escaping special characters and meaning.
  462. *
  463. * @param {string} group
  464. * @return {string}
  465. */
  466. function escapeGroup (group) {
  467. return group.replace(/([=!:$/()])/g, '\\$1')
  468. }
  469.  
  470. /**
  471. * Get the flags for a regexp from the options.
  472. *
  473. * @param {Object} options
  474. * @return {string}
  475. */
  476. function flags (options) {
  477. return options && options.sensitive ? '' : 'i'
  478. }
  479.  
  480. /**
  481. * Pull out keys from a regexp.
  482. *
  483. * @param {!RegExp} path
  484. * @param {Array=} keys
  485. * @return {!RegExp}
  486. */
  487. function regexpToRegexp (path, keys) {
  488. if (!keys) return path
  489.  
  490. // Use a negative lookahead to match only capturing groups.
  491. var groups = path.source.match(/\((?!\?)/g)
  492.  
  493. if (groups) {
  494. for (var i = 0; i < groups.length; i++) {
  495. keys.push({
  496. name: i,
  497. prefix: null,
  498. delimiter: null,
  499. optional: false,
  500. repeat: false,
  501. partial: false,
  502. pattern: null
  503. })
  504. }
  505. }
  506.  
  507. return path
  508. }
  509.  
  510. /**
  511. * Transform an array into a regexp.
  512. *
  513. * @param {!Array} path
  514. * @param {Array=} keys
  515. * @param {Object=} options
  516. * @return {!RegExp}
  517. */
  518. function arrayToRegexp (path, keys, options) {
  519. var parts = []
  520.  
  521. for (var i = 0; i < path.length; i++) {
  522. parts.push(pathToRegexp(path[i], keys, options).source)
  523. }
  524.  
  525. return new RegExp('(?:' + parts.join('|') + ')', flags(options))
  526. }
  527.  
  528. /**
  529. * Create a path regexp from string input.
  530. *
  531. * @param {string} path
  532. * @param {Array=} keys
  533. * @param {Object=} options
  534. * @return {!RegExp}
  535. */
  536. function stringToRegexp (path, keys, options) {
  537. return tokensToRegExp(parse(path, options), keys, options)
  538. }
  539.  
  540. /**
  541. * Expose a function for taking tokens and returning a RegExp.
  542. *
  543. * @param {!Array} tokens
  544. * @param {Array=} keys
  545. * @param {Object=} options
  546. * @return {!RegExp}
  547. */
  548. function tokensToRegExp (tokens, keys, options) {
  549. options = options || {}
  550.  
  551. var strict = options.strict
  552. var start = options.start !== false
  553. var end = options.end !== false
  554. var delimiter = escapeString(options.delimiter || DEFAULT_DELIMITER)
  555. var delimiters = options.delimiters || DEFAULT_DELIMITERS
  556. var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|')
  557. var route = start ? '^' : ''
  558. var isEndDelimited = tokens.length === 0
  559.  
  560. // Iterate over the tokens and create our regexp string.
  561. for (var i = 0; i < tokens.length; i++) {
  562. var token = tokens[i]
  563.  
  564. if (typeof token === 'string') {
  565. route += escapeString(token)
  566. isEndDelimited = i === tokens.length - 1 && delimiters.indexOf(token[token.length - 1]) > -1
  567. } else {
  568. var capture = token.repeat
  569. ? '(?:' + token.pattern + ')(?:' + escapeString(token.delimiter) + '(?:' + token.pattern + '))*'
  570. : token.pattern
  571.  
  572. if (keys) keys.push(token)
  573.  
  574. if (token.optional) {
  575. if (token.partial) {
  576. route += escapeString(token.prefix) + '(' + capture + ')?'
  577. } else {
  578. route += '(?:' + escapeString(token.prefix) + '(' + capture + '))?'
  579. }
  580. } else {
  581. route += escapeString(token.prefix) + '(' + capture + ')'
  582. }
  583. }
  584. }
  585.  
  586. if (end) {
  587. if (!strict) route += '(?:' + delimiter + ')?'
  588.  
  589. route += endsWith === '$' ? '$' : '(?=' + endsWith + ')'
  590. } else {
  591. if (!strict) route += '(?:' + delimiter + '(?=' + endsWith + '))?'
  592. if (!isEndDelimited) route += '(?=' + delimiter + '|' + endsWith + ')'
  593. }
  594.  
  595. return new RegExp(route, flags(options))
  596. }
  597.  
  598. /**
  599. * Normalize the given path string, returning a regular expression.
  600. *
  601. * An empty array can be passed in for the keys, which will hold the
  602. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  603. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  604. *
  605. * @param {(string|RegExp|Array)} path
  606. * @param {Array=} keys
  607. * @param {Object=} options
  608. * @return {!RegExp}
  609. */
  610. function pathToRegexp (path, keys, options) {
  611. if (path instanceof RegExp) {
  612. return regexpToRegexp(path, keys)
  613. }
  614.  
  615. if (Array.isArray(path)) {
  616. return arrayToRegexp(/** @type {!Array} */ (path), keys, options)
  617. }
  618.  
  619. return stringToRegexp(/** @type {string} */ (path), keys, options)
  620. }
  621.  
  622.  
  623. /***/ }),
  624. /* 6 */
  625. /***/ (function(module, exports, __webpack_require__) {
  626.  
  627. const logger = __webpack_require__(2);
  628. module.exports = class Router {
  629. constructor() {
  630. this._routes = [];
  631. }
  632.  
  633. push(router) {
  634. this.routes.push(router);
  635. }
  636.  
  637. get routes() {
  638. return this._routes;
  639. }
  640.  
  641. load(href) {
  642. logger.debug(this.routes);
  643. this.routes.some((route) => {
  644. if (route.test(href)) {
  645. route.call(route.match(href));
  646. return true;
  647. }
  648. });
  649. }
  650. };
  651.  
  652.  
  653. /***/ }),
  654. /* 7 */
  655. /***/ (function(module, exports, __webpack_require__) {
  656.  
  657. const Route = __webpack_require__(4);
  658. const logger = __webpack_require__(2);
  659.  
  660. const Router = __webpack_require__(6);
  661. const router = new Router();
  662.  
  663. router.push(new Route(/tags=(?:(.+))?/, __webpack_require__(8)));
  664. router.push(new Route(/post/, __webpack_require__(13)));
  665.  
  666. module.exports = async (args) => {
  667. router.load(args);
  668. GM_addStyle(__webpack_require__(14).toString());
  669. logger.debug(__webpack_require__(14).toString());
  670. };
  671.  
  672.  
  673. /***/ }),
  674. /* 8 */
  675. /***/ (function(module, exports, __webpack_require__) {
  676.  
  677. const rssPrefix = 'https://yande.re/post/piclens?tags=';
  678. const config = __webpack_require__(9);
  679.  
  680. const rssElem = $('<a\>').feedInit();
  681. rssElem.attr('title', config.language.feed);
  682. rssElem.text(config.language.feed);
  683.  
  684. module.exports = async (args) => {
  685. rssElem.href(`${rssPrefix}${args[1]}`);
  686. $('#post-list > div.sidebar > div:nth-child(1) > form > div').append(rssElem);
  687. };
  688.  
  689.  
  690. /***/ }),
  691. /* 9 */
  692. /***/ (function(module, exports, __webpack_require__) {
  693.  
  694. const logger = __webpack_require__(2);
  695. const lang = 'en_US';
  696.  
  697. // TODO add gui to edit config
  698. logger.debug(__webpack_require__(10)(`./${lang}`));
  699.  
  700. module.exports = {
  701. language: __webpack_require__(10)(`./${lang}`),
  702. rsshub: 'https://rsshub.app'
  703. };
  704.  
  705.  
  706. /***/ }),
  707. /* 10 */
  708. /***/ (function(module, exports, __webpack_require__) {
  709.  
  710. var map = {
  711. "./config": 9,
  712. "./config.js": 9,
  713. "./en_US": 11,
  714. "./en_US.json": 11,
  715. "./zh_CN": 12,
  716. "./zh_CN.json": 12
  717. };
  718.  
  719.  
  720. function webpackContext(req) {
  721. var id = webpackContextResolve(req);
  722. return __webpack_require__(id);
  723. }
  724. function webpackContextResolve(req) {
  725. var id = map[req];
  726. if(!(id + 1)) { // check for number or string
  727. var e = new Error("Cannot find module '" + req + "'");
  728. e.code = 'MODULE_NOT_FOUND';
  729. throw e;
  730. }
  731. return id;
  732. }
  733. webpackContext.keys = function webpackContextKeys() {
  734. return Object.keys(map);
  735. };
  736. webpackContext.resolve = webpackContextResolve;
  737. module.exports = webpackContext;
  738. webpackContext.id = 10;
  739.  
  740. /***/ }),
  741. /* 11 */
  742. /***/ (function(module) {
  743.  
  744. module.exports = {"feed":"RSS Feed"};
  745.  
  746. /***/ }),
  747. /* 12 */
  748. /***/ (function(module) {
  749.  
  750. module.exports = {"feed":"RSS订阅"};
  751.  
  752. /***/ }),
  753. /* 13 */
  754. /***/ (function(module, exports, __webpack_require__) {
  755.  
  756. const rssPrefix = 'https://yande.re/post/piclens';
  757. const config = __webpack_require__(9);
  758.  
  759. const rssElem = $('<a\>').feedInit();
  760. rssElem.attr('title', config.language.feed);
  761. rssElem.text(config.language.feed);
  762.  
  763. module.exports = async () => {
  764. rssElem.href(rssPrefix);
  765. $('#post-list > div.sidebar > div:nth-child(1) > form > div').append(rssElem);
  766. };
  767.  
  768.  
  769. /***/ }),
  770. /* 14 */
  771. /***/ (function(module, exports, __webpack_require__) {
  772.  
  773. exports = module.exports = __webpack_require__(15)(false);
  774. // imports
  775.  
  776.  
  777. // module
  778. exports.push([module.i, "#post-list>div.sidebar>div:first-child>form>div{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;line-height:20px}#post-list>div.sidebar>div:first-child>form>div #rss-helper{margin-left:4px}", ""]);
  779.  
  780. // exports
  781.  
  782.  
  783. /***/ }),
  784. /* 15 */
  785. /***/ (function(module, exports) {
  786.  
  787. /*
  788. MIT License http://www.opensource.org/licenses/mit-license.php
  789. Author Tobias Koppers @sokra
  790. */
  791. // css base code, injected by the css-loader
  792. module.exports = function(useSourceMap) {
  793. var list = [];
  794.  
  795. // return the list of modules as css string
  796. list.toString = function toString() {
  797. return this.map(function (item) {
  798. var content = cssWithMappingToString(item, useSourceMap);
  799. if(item[2]) {
  800. return "@media " + item[2] + "{" + content + "}";
  801. } else {
  802. return content;
  803. }
  804. }).join("");
  805. };
  806.  
  807. // import a list of modules into the list
  808. list.i = function(modules, mediaQuery) {
  809. if(typeof modules === "string")
  810. modules = [[null, modules, ""]];
  811. var alreadyImportedModules = {};
  812. for(var i = 0; i < this.length; i++) {
  813. var id = this[i][0];
  814. if(typeof id === "number")
  815. alreadyImportedModules[id] = true;
  816. }
  817. for(i = 0; i < modules.length; i++) {
  818. var item = modules[i];
  819. // skip already imported module
  820. // this implementation is not 100% perfect for weird media query combinations
  821. // when a module is imported multiple times with different media queries.
  822. // I hope this will never occur (Hey this way we have smaller bundles)
  823. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  824. if(mediaQuery && !item[2]) {
  825. item[2] = mediaQuery;
  826. } else if(mediaQuery) {
  827. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  828. }
  829. list.push(item);
  830. }
  831. }
  832. };
  833. return list;
  834. };
  835.  
  836. function cssWithMappingToString(item, useSourceMap) {
  837. var content = item[1] || '';
  838. var cssMapping = item[3];
  839. if (!cssMapping) {
  840. return content;
  841. }
  842.  
  843. if (useSourceMap && typeof btoa === 'function') {
  844. var sourceMapping = toComment(cssMapping);
  845. var sourceURLs = cssMapping.sources.map(function (source) {
  846. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  847. });
  848.  
  849. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  850. }
  851.  
  852. return [content].join('\n');
  853. }
  854.  
  855. // Adapted from convert-source-map (MIT)
  856. function toComment(sourceMap) {
  857. // eslint-disable-next-line no-undef
  858. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  859. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  860.  
  861. return '/*# ' + data + ' */';
  862. }
  863.  
  864.  
  865. /***/ }),
  866. /* 16 */
  867. /***/ (function(module, exports, __webpack_require__) {
  868.  
  869. const Route = __webpack_require__(4);
  870. const logger = __webpack_require__(2);
  871.  
  872. const Router = __webpack_require__(6);
  873. const router = new Router();
  874.  
  875. router.push(new Route(/video\/av\d+/, __webpack_require__(17)));
  876. router.push(new Route(/space\.bilibili\.com\/(\d+)/, __webpack_require__(18)));
  877. router.push(new Route(/live\.bilibili\.com\/(\d+)/, __webpack_require__(19)));
  878.  
  879. module.exports = async (args) => {
  880. router.load(args);
  881. GM_addStyle(__webpack_require__(20).toString());
  882. logger.debug(__webpack_require__(20).toString());
  883. };
  884.  
  885.  
  886. /***/ }),
  887. /* 17 */
  888. /***/ (function(module, exports, __webpack_require__) {
  889.  
  890. const config = __webpack_require__(9);
  891. const rssPrefix = `${config.rsshub}/bilibili/user/video/`;
  892.  
  893. const rssElem = $('<a\>').feedInit();
  894. rssElem.addClass('btn');
  895. rssElem.addClass('bi-btn');
  896. rssElem.attr('title', config.language.feed);
  897. rssElem.text(config.language.feed);
  898.  
  899. module.exports = async () => {
  900. let mid = $('#v_upinfo .u-face>a')
  901. .attr('href')
  902. .match(/\d+/)[0];
  903. rssElem.href(`${rssPrefix}${mid}`);
  904. let task = setInterval(() => {
  905. if ($('.more-ops-list').length) {
  906. $('#v_upinfo .btn').prepend(rssElem);
  907. clearInterval(task);
  908. }
  909. }, 500);
  910. };
  911.  
  912.  
  913. /***/ }),
  914. /* 18 */
  915. /***/ (function(module, exports, __webpack_require__) {
  916.  
  917. const config = __webpack_require__(9);
  918. const rssPrefix = `${config.rsshub}/bilibili/user/dynamic/`;
  919.  
  920. const rssElem = $('<a\>').feedInit();
  921. rssElem.addClass('h-f-btn');
  922. rssElem.attr('title', config.language.feed);
  923. rssElem.text(config.language.feed);
  924.  
  925. module.exports = async (args) => {
  926. rssElem.href(`${rssPrefix}${args[1]}`);
  927. let task = setInterval(() => {
  928. let elem = $('.h-action .h-message');
  929. if (elem.length) {
  930. elem.after(rssElem);
  931. clearInterval(task);
  932. }
  933. }, 500);
  934. };
  935.  
  936.  
  937. /***/ }),
  938. /* 19 */
  939. /***/ (function(module, exports, __webpack_require__) {
  940.  
  941. const config = __webpack_require__(9);
  942. const rssPrefix = `${config.rsshub}/bilibili/live/room/`;
  943.  
  944. const rssElem = $('<a\>').feedInit();
  945. rssElem.addClass('p-absolute');
  946. rssElem.attr('title', config.language.feed);
  947. rssElem.text(config.language.feed);
  948.  
  949. module.exports = async (args) => {
  950. rssElem.href(`${rssPrefix}${args[1]}`);
  951. let task = setInterval(() => {
  952. let elem = $('.room-info-down-row .attention-btn-ctnr');
  953. if (elem.length) {
  954. elem.after(rssElem);
  955. clearInterval(task);
  956. }
  957. }, 500);
  958. };
  959.  
  960.  
  961. /***/ }),
  962. /* 20 */
  963. /***/ (function(module, exports, __webpack_require__) {
  964.  
  965. exports = module.exports = __webpack_require__(15)(false);
  966. // imports
  967.  
  968.  
  969. // module
  970. exports.push([module.i, "#v_upinfo #rss-helper{padding-left:16px;padding-right:16px;margin-left:12px;margin-top:0}.room-info-down-row #rss-helper{height:22px;line-height:22px;padding-left:16px;padding-right:16px;background-color:#23ade5;color:#fff!important;border-radius:4px;right:130px;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:125ms ease-in-out;transition:125ms ease-in-out}.room-info-down-row #rss-helper:hover{background-color:#23b9f1}", ""]);
  971.  
  972. // exports
  973.  
  974.  
  975. /***/ }),
  976. /* 21 */
  977. /***/ (function(module, exports, __webpack_require__) {
  978.  
  979. const logger = __webpack_require__(2);
  980. const config = __webpack_require__(9);
  981. const rssPrefix = `${config.rsshub}/weibo/user/`;
  982.  
  983. const rssElem = $('<a\>').feedInit();
  984.  
  985. module.exports = async () => {
  986. window.onload = () => {
  987. if ($('.opt_box.clearfix').length) {
  988. rssElem.addClass('W_btn_d');
  989. rssElem.addClass('btn_34px');
  990.  
  991. rssElem.attr('title', config.language.feed);
  992. rssElem.text(config.language.feed);
  993. rssElem.href(rssPrefix + $CONFIG.oid);
  994.  
  995. $('div.pf_opt > .opt_box').append(rssElem);
  996. }
  997. };
  998. };
  999.  
  1000. /***/ }),
  1001. /* 22 */
  1002. /***/ (function(module, exports, __webpack_require__) {
  1003.  
  1004. const Route = __webpack_require__(4);
  1005. const logger = __webpack_require__(2);
  1006.  
  1007. const Router = __webpack_require__(6);
  1008. const router = new Router();
  1009.  
  1010. router.push(new Route(/member\.php\?id=\d+/, __webpack_require__(23)));
  1011. router.push(new Route(/member_illust\.php\?.*illust_id=\d+/, __webpack_require__(24)));
  1012.  
  1013. module.exports = async (args) => {
  1014. router.load(args);
  1015. GM_addStyle(__webpack_require__(25).toString());
  1016. logger.debug(__webpack_require__(25).toString());
  1017. };
  1018.  
  1019.  
  1020. /***/ }),
  1021. /* 23 */
  1022. /***/ (function(module, exports, __webpack_require__) {
  1023.  
  1024. const config = __webpack_require__(9);
  1025. const rssPrefix = `${config.rsshub}/pixiv/user/`;
  1026.  
  1027. const rssElem = $('<a\>').feedInit();
  1028. rssElem.addClass('YryPnZn _30SjOFD');
  1029. rssElem.attr('title', config.language.feed);
  1030. rssElem.text(config.language.feed);
  1031.  
  1032. module.exports = async () => {
  1033. rssElem.href(rssPrefix + Object.keys(globalInitData.preload.user)[0]);
  1034. let task = setInterval(() => {
  1035. let elem = $('div._3yalhqB');
  1036. if (elem.length) {
  1037. elem.append(rssElem);
  1038. clearInterval(task);
  1039. }
  1040. }, 500);
  1041. };
  1042.  
  1043.  
  1044. /***/ }),
  1045. /* 24 */
  1046. /***/ (function(module, exports, __webpack_require__) {
  1047.  
  1048. const config = __webpack_require__(9);
  1049. const rssPrefix = `${config.rsshub}/pixiv/user/`;
  1050.  
  1051. const rssElem = $('<a\>').feedInit();
  1052. rssElem.addClass('YryPnZn');
  1053. rssElem.attr('title', config.language.feed);
  1054. rssElem.text(config.language.feed);
  1055.  
  1056. module.exports = async () => {
  1057. rssElem.href(rssPrefix + Object.keys(globalInitData.preload.user)[0]);
  1058. let task = setInterval(() => {
  1059. let elem = $('.sc-dRCTWM.cRuxjo');
  1060. if (elem.length) {
  1061. elem.append(rssElem);
  1062. clearInterval(task);
  1063. }
  1064. }, 500);
  1065. };
  1066.  
  1067.  
  1068. /***/ }),
  1069. /* 25 */
  1070. /***/ (function(module, exports, __webpack_require__) {
  1071.  
  1072. exports = module.exports = __webpack_require__(15)(false);
  1073. // imports
  1074.  
  1075.  
  1076. // module
  1077. exports.push([module.i, "#rss-helper{text-decoration:none}._3yalhqB{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;width:auto}._3yalhqB #rss-helper{margin-left:12px}.sc-dRCTWM.cRuxjo #rss-helper{margin-top:12px}", ""]);
  1078.  
  1079. // exports
  1080.  
  1081.  
  1082. /***/ }),
  1083. /* 26 */
  1084. /***/ (function(module, exports, __webpack_require__) {
  1085.  
  1086. const config = __webpack_require__(9);
  1087. const logger = __webpack_require__(2);
  1088.  
  1089. const rssElem = $('<a\>').feedInit();
  1090. rssElem.attr('target', '_blank');
  1091. rssElem.append('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><circle cx="6.18" cy="17.82" r="2.18"/><path d="M4 4.44v2.83c7.03 0 12.73 5.7 12.73 12.73h2.83c0-8.59-6.97-15.56-15.56-15.56zm0 5.66v2.83c3.9 0 7.07 3.17 7.07 7.07h2.83c0-5.47-4.43-9.9-9.9-9.9z"/></svg>');
  1092.  
  1093. const rssElemText = $('<span\>');
  1094. rssElemText.text(config.language.feed);
  1095. rssElem.append(rssElemText);
  1096.  
  1097. module.exports = async () => {
  1098. const types = [
  1099. 'application/rss+xml',
  1100. 'application/atom+xml',
  1101. 'application/rdf+xml',
  1102. 'application/rss',
  1103. 'application/atom',
  1104. 'application/rdf',
  1105. 'text/rss+xml',
  1106. 'text/atom+xml',
  1107. 'text/rdf+xml',
  1108. 'text/rss',
  1109. 'text/atom',
  1110. 'text/rdf'
  1111. ];
  1112. let feeds = [];
  1113. $(() => {
  1114. $('link[type]').each(function() {
  1115. if (types.includes($(this).attr('type'))) {
  1116. let feed = {
  1117. href: $(this).attr('href'),
  1118. name: $(this).attr('title')
  1119. };
  1120. feeds.push(feed);
  1121. }
  1122. });
  1123. logger.debug(feeds);
  1124. rssElem.href(feeds[0].href);
  1125. rssElemText.text(feeds[0].name);
  1126. $('body').append(rssElem);
  1127. rssElem.mouseenter(() => {
  1128. rssElem.css('width', rssElemText.width() + 30 + 8);
  1129. });
  1130. rssElem.mouseleave(() => {
  1131. rssElem.css('width', 30);
  1132. });
  1133. });
  1134. GM_addStyle(__webpack_require__(27).toString());
  1135. };
  1136.  
  1137.  
  1138. /***/ }),
  1139. /* 27 */
  1140. /***/ (function(module, exports, __webpack_require__) {
  1141.  
  1142. exports = module.exports = __webpack_require__(15)(false);
  1143. // imports
  1144.  
  1145.  
  1146. // module
  1147. exports.push([module.i, "#rss-helper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;position:fixed;top:72px;z-index:12000;right:0;font-size:14px;border-bottom-left-radius:4px;border-top-left-radius:4px;background-color:#f8f8f8;padding:3px 4px;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);-webkit-transition:125ms ease-in-out;transition:125ms ease-in-out;color:#212121!important;overflow:hidden;line-height:24px;width:30px;box-sizing:border-box}#rss-helper svg{min-width:24px}#rss-helper span{margin-left:4px;white-space:nowrap;opacity:0;-webkit-transition:125ms ease-in-out;transition:125ms ease-in-out}#rss-helper:hover{box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)}#rss-helper:hover span{opacity:1}", ""]);
  1148.  
  1149. // exports
  1150.  
  1151.  
  1152. /***/ })
  1153. /******/ ]);