Greasy Fork 支持 简体中文。

Narou Siori Button

Disable narou's new auto siori function and add a float siori button on page.

  1. // ==UserScript==
  2. // @name Narou Siori Button
  3. // @name:ja なろうしおりボタン
  4. // @namespace https://greasyfork.org/en/users/1264733
  5. // @version 2024-08-30
  6. // @description Disable narou's new auto siori function and add a float siori button on page.
  7. // @description:ja なろうの自動しおり機能を無効化、ページにフロート・しおり・ボタンを追加。
  8. // @author LE37
  9. // @license MIT
  10. // @match *://ncode.syosetu.com/*/*
  11. // @match *://novel18.syosetu.com/*/*
  12. // @grant none
  13. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
  14. // ==/UserScript==
  15.  
  16. (()=>{
  17. 'use strict';
  18.  
  19. // 自動しおり無効化
  20. // Install ublock origin or adblockplus then block narou's auto siori api below:
  21. // ||syosetu.com/favnovelmain/shioriupdateapi/
  22. // ||syosetu.com/favnovelmain18/shioriupdateapi/
  23.  
  24. // Check current page doesn't have siori
  25. if (!$('.js-add_bookmark').length && !$('.js-siori').hasClass('is-active')) {
  26. // Create & append a float siori button
  27. $("body").append(`<button type="button" class="siori_btn">📌</button>`);
  28. const as_btn = $(".siori_btn");
  29. // Button style
  30. as_btn.css({ 'position': 'fixed', 'width': '44px', 'height': '44px', 'z-index': '9999', 'font-size': '200%', 'opacity': '50%', 'cursor': 'pointer', 'border': 'none', 'padding': 'unset', 'right': '2em', 'bottom': '2em' });
  31.  
  32. // Check current page doesn't have siori info
  33. if (!$('input[name="siori_url"]').length) {
  34. const npath = location.host.startsWith("ncode") ? "favnovelmain/ichiupdateajax/useridfavncode" : "favnovelmain18/ichiupdateajax/xidfavncode";
  35. let userid;
  36. if ($('input[name="auto_siori"]').length) {
  37. userid = $('input[name="auto_siori"]').data('primary').split('_')[0];
  38. //console.log(userid);
  39. }
  40. const ninfo = $(".js-bookmark_updateconf_url").val();
  41. const novelid = ninfo.split('/')[6];
  42. const episode = ninfo.split('/')[8];
  43. const token = $('input[name="token"]').val();
  44. as_btn.append(`
  45. <input name="siori_url" type="hidden" value="https://syosetu.com/${npath}/${userid}_${novelid}/no/${episode}/?token=${token}">
  46. `);
  47. }
  48.  
  49. // Button event
  50. as_btn.on('click' ,function() {
  51. let siori_url = $('input[name="siori_url"]').val();
  52. siori_url += '&callback=?';
  53. $.ajax({
  54. type:'get',
  55. url: siori_url,
  56. cache: false,
  57. dataType : 'jsonp',
  58. async:false,
  59. success: function(data, textStatus) {
  60. if (data.result == true) {
  61. //console.log('===V0===');
  62. $('.js-siori').addClass('is-active');
  63. // Hide siori button after success
  64. as_btn.css({ 'opacity': '0', 'cursor': 'auto' });
  65. }else{
  66. //console.log('===X1===');
  67. }
  68. },
  69. error: function(jqXHR, textStatus, errorThrown){
  70. //console.log('===X2===');
  71. }
  72. });
  73. });
  74. }
  75. })();