Webnovel标签搜索模式切换器

这个脚本简化了Webnovel.com上的标签搜索,使您可以轻松切换小说和同人文的搜索模式,无需手动调整URL。使用这个用户友好的功能来增强您的标签探索体验。

  1. // ==UserScript==
  2. // @name Webnovel Tag Search Mode Switcher
  3. // @namespace https://greasyfork.org/en/users/1200276-awesome4
  4. // @version 2.0
  5. // @description This script simplifies tag searches on Webnovel.com, allowing you to switch between novel and fanfic search modes, eliminating the need for manual URL adjustments. Enhance your tag exploration experience with this user-friendly feature.
  6. // @author Awesome
  7. // @match https://www.webnovel.com/*
  8. // @grant none
  9. // @license GNU GPLv3
  10. // @name:en Webnovel Tag Search Mode Switcher
  11. // @name:es Interruptor de Modo de Búsqueda de Etiquetas en Webnovel
  12. // @name:ar مبدل وضع البحث في العلامات على ويب نوفل
  13. // @name:fr Commutateur de Mode de Recherche d'Étiquettes Webnovel
  14. // @name:de Webnovel Tag-Suchmodus-Umschalter
  15. // @name:it Interruttore di Modalità di Ricerca di Etichette Webnovel
  16. // @name:ru Переключатель режима поиска по меткам на Webnovel
  17. // @name:zh-CN Webnovel标签搜索模式切换器
  18. // @name:zh-TW Webnovel標籤搜索模式切換器
  19. // @name:ja Webnovelタグ検索モード切替機能
  20. // @name:pt Alternador de Modo de Pesquisa de Tags no Webnovel
  21. // @name:tr Webnovel Etiket Arama Modu Değiştirici
  22. // @name:hi वेबनोवेल टैग खोज मोड स्विचर
  23. // @description:en This script simplifies tag searches on Webnovel.com, allowing you to switch between novel and fanfic search modes, eliminating the need for manual URL adjustments. Enhance your tag exploration experience with this user-friendly feature.
  24. // @description:es Este script simplifies tag searches on Webnovel.com, allowing you to switch between novel and fanfic search modes, eliminating the need for manual URL adjustments. Enhance your tag exploration experience with this user-friendly feature.
  25. // @description:ar هذا البرنامج النصي يبسط عمليات البحث في العلامات على موقع ويب نوفل، مما يتيح لك التبديل بين أوضاع البحث في الروايات وقصص المشجعين، والتخلص من الحاجة إلى تعديل الروابط يدويًا. قم بتعزيز تجربتك في استكشاف العلامات مع هذه الميزة سهلة الاستخدام.
  26. // @description:fr Ce script simplifies tag searches on Webnovel.com, allowing you to switch between novel and fanfic search modes, eliminating the need for manual URL adjustments. Enhance your tag exploration experience with this user-friendly feature.
  27. // @description:de Dieses Skript vereinfacht die Tag-Suchfunktion auf Webnovel.com, es ermöglicht Ihnen, zwischen den Suchmodi für Romane und Fanfictions zu wechseln und eliminiert die Notwendigkeit für manuelle URL-Anpassungen. Verbessern Sie Ihre Tag-Erforschungserfahrung mit dieser benutzerfreundlichen Funktion.
  28. // @description:it Questo script semplifica le ricerche delle etichette su Webnovel.com, permettendoti di passare tra le modalità di ricerca di romanzi e fanfiction, eliminando la necessità di aggiustamenti manuali dell'URL. Potenzia la tua esperienza di esplorazione delle etichette con questa funzionalità user-friendly.
  29. // @description:ru Этот скрипт упрощает поиск по меткам на Webnovel.com, позволяя вам переключаться между режимами поиска романов и фанфиков, исключая необходимость вручную изменять URL. Улучшите вашу эксплорацию тегов с помощью этой простой в использовании функции.
  30. // @description:zh-CN 这个脚本简化了Webnovel.com上的标签搜索,使您可以轻松切换小说和同人文的搜索模式,无需手动调整URL。使用这个用户友好的功能来增强您的标签探索体验。
  31. // @description:zh-TW 這個腳本簡化了Webnovel.com上的標籤搜索,使您可以輕鬆切換小說和同人文的搜索模式,無需手動調整URL。增強您的標籤探索體驗與這個用戶友好的功能。
  32. // @description:ja このスクリプトはWebnovel.comでのタグ検索を簡素化し、小説とファンフィクションの検索モードを切り替え、URLの手動調整の必要性をなくします。ユーザーフレンドリーなこの機能でタグの探索体験を向上させてください。
  33. // @description:pt Este script simplifica as pesquisas por tags no Webnovel.com, permitindo que você alterne entre os modos de pesquisa de romances e fanfics, eliminando a necessidade de ajustes manuais de URL. Melhore sua experiência de exploração de tags com este recurso amigável ao usuário.
  34. // @description:tr Bu betik, Webnovel.com'daki etiket aramalarını basitleştirir ve roman ve fanfiksiyon arama modları arasında kolayca geçiş yapmanıza olanak tanır, böylece URL ayarlarını manuel olarak yapma ihtiyacını ortadan kaldırır. Bu kullanıcı dostu özellikle etiket keşif deneyiminizi geliştirin.
  35. // @description:hi यह स्क्रिप्ट वेबनोवेल.कॉम पर टैग खोजों को सरल बनाता है, जिससे आप उपन्यास और फैनफिक खोज मोड्स के बीच आसानी से स्विच कर सकते हैं, URL समीक्षा की आवश्यकता को हटा देता है। इस उपयोगकर्ता-मित्र लिए अपने खोज अन्वेषण अनुभव को बेहतर बनाएं।
  36. // ==/UserScript==
  37.  
  38.  
  39.  
  40. (function() {
  41. 'use strict';
  42. // Get the genre name from the page
  43. const genreName = document.querySelector('h2.lh1\\.5').textContent.toLowerCase();
  44. // Check if the current URL matches the expected pattern
  45. const url = window.location.href;
  46. const isNovelPage = url.includes(`/tags/${genreName}-novel`);
  47. const isFanficPage = url.includes(`/tags/${genreName}-fanfic`);
  48.  
  49. // Function to create the "novel" or "fanfic" button
  50. const createButton = (href, text) => {
  51. const link = document.createElement('a');
  52. link.href = href;
  53. link.setAttribute('data-order', '3');
  54. link.textContent = text;
  55. const nav = document.querySelector('.lst-nav');
  56. nav.appendChild(link);
  57. };
  58.  
  59. // Check if the page is a genre-specific page and if the corresponding button doesn't exist yet
  60. if (isNovelPage && !document.querySelector(`.lst-nav a[href*="${genreName}-fanfic"]`)) {
  61. // Create the "Fanfic" button if on the Novel page
  62. createButton(`https://www.webnovel.com/tags/${genreName}-fanfic`, `${genreName} Fanfics`);
  63. } else if (isFanficPage && !document.querySelector(`.lst-nav a[href*="${genreName}-novel"]`)) {
  64. // Create the "Novel" button if on the Fanfic page
  65. createButton(`https://www.webnovel.com/tags/${genreName}-novel`, `${genreName} Novels`);
  66. }
  67.  
  68. // Ensure links in `.lst-nav` are properly created and clickable
  69. const navLinks = document.querySelectorAll('.lst-nav a');
  70. navLinks.forEach(link => {
  71. link.addEventListener('click', function(event) {
  72. // Check if the link is valid, then proceed to navigate
  73. if (link.href) {
  74. window.location.href = link.href; // This forces the navigation to the desired page
  75. }
  76. });
  77. });
  78. })();
  79.  
  80.  
  81.  
  82.