Skip to content

Instantly share code, notes, and snippets.

@azazar
Last active January 8, 2025 19:42
Show Gist options
  • Save azazar/563a7031a1ed6d09ac012e3a94312bf6 to your computer and use it in GitHub Desktop.
Save azazar/563a7031a1ed6d09ac012e3a94312bf6 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name author.today качать с названием
// @namespace Azazar's Scripts
// @match https://author.today/work/*
// @grant GM_setClipboard
// @version 1.0
// @author -
// ==/UserScript==
let extMap = {
'Fb2': '.fb2.zip',
'Epub': '.epub',
'Mobi': '.mobi',
'download': ''
};
let author = Array.from(document.querySelectorAll('.book-meta-panel .book-authors a')).map(a => a.innerText).join(', ');
let title = document.querySelector('.book-meta-panel h1.book-title').innerText;
let baseName = `${title}. ${author}`;
document.querySelector('.book-meta-panel h1.book-title').addEventListener('click', e => GM_setClipboard(baseName));
document.querySelectorAll('ul[aria-labelledby="Скачать книгу"] li a[href]').forEach(a => {
let type = a.querySelector('span.text-bold').innerText.trim();
let filename = baseName + extMap[type];
a.addEventListener('click', e => GM_setClipboard(filename));
});
@Korb
Copy link

Korb commented Jan 8, 2025

Под кнопкой Скачать по прежнему отображается

Скачивать могут только зарегистрированные пользователи.

Так и должно?

author.today качать с названием 1.0
Tampermonkey 5.3.3 (December 20, 2024)
Mozilla Firefox 135.0b1 (64-bit)
Microsoft Windows 10.0.19045.5247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment