Amazon ISBN Search

Añade botones para buscar el libro en ZLibrary, PDF Archive y Library Genesis usando el ISBN

目前为 2024-11-05 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @license MIT
  3. // @name Amazon ISBN Search
  4. // @namespace http://tampermonkey.net/
  5. // @version 1.0
  6. // @description Añade botones para buscar el libro en ZLibrary, PDF Archive y Library Genesis usando el ISBN
  7. // @author Daniel
  8. // @match https://www.amazon.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Función para obtener el ISBN-13 desde la página de detalles
  16. function getISBN() {
  17. const isbnElement = document.querySelector("#detailBullets_feature_div li:contains('ISBN-13')") ||
  18. document.querySelector("#productDetailsTable li:contains('ISBN-13')");
  19. if (isbnElement) {
  20. return isbnElement.textContent.replace("ISBN-13:", "").trim();
  21. }
  22. return null;
  23. }
  24.  
  25. // Función para crear los botones de búsqueda
  26. function createSearchButtons(isbn) {
  27. const container = document.createElement("div");
  28. container.style.marginTop = "20px";
  29.  
  30. // Estilo para los botones
  31. const buttonStyle = `
  32. padding: 10px;
  33. margin: 5px;
  34. background-color: #0073e6;
  35. color: white;
  36. border: none;
  37. border-radius: 5px;
  38. cursor: pointer;
  39. `;
  40.  
  41. // Botón para ZLibrary
  42. const zlibraryButton = document.createElement("button");
  43. zlibraryButton.textContent = "Buscar en ZLibrary";
  44. zlibraryButton.style = buttonStyle;
  45. zlibraryButton.onclick = () => {
  46. window.open(`https://z-lib.org/s/?q=${isbn}`, "_blank");
  47. };
  48. container.appendChild(zlibraryButton);
  49.  
  50. // Botón para PDF Archive
  51. const pdfArchiveButton = document.createElement("button");
  52. pdfArchiveButton.textContent = "Buscar en PDF Archive";
  53. pdfArchiveButton.style = buttonStyle;
  54. pdfArchiveButton.onclick = () => {
  55. window.open(`https://pdfarchive.org/search?q=${isbn}`, "_blank");
  56. };
  57. container.appendChild(pdfArchiveButton);
  58.  
  59. // Botón para Library Genesis
  60. const libGenButton = document.createElement("button");
  61. libGenButton.textContent = "Buscar en Library Genesis";
  62. libGenButton.style = buttonStyle;
  63. libGenButton.onclick = () => {
  64. window.open(`http://gen.lib.rus.ec/search.php?req=${isbn}`, "_blank");
  65. };
  66. container.appendChild(libGenButton);
  67.  
  68. // Insertar los botones en la sección de detalles del libro
  69. const detailSection = document.querySelector("#detailBullets_feature_div") || document.querySelector("#productDetailsTable");
  70. if (detailSection) {
  71. detailSection.appendChild(container);
  72. }
  73. }
  74.  
  75. // Ejecutar la función principal al cargar la página
  76. window.onload = () => {
  77. const isbn = getISBN();
  78. if (isbn) {
  79. createSearchButtons(isbn);
  80. } else {
  81. console.log("ISBN no encontrado en esta página.");
  82. }
  83. };
  84. })();