Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- const rightElement = document.querySelector('.top-buttons .right');
- if (!rightElement) {
- console.error('Nelze najít .top-buttons .right na stránce.');
- return;
- }
- const link = document.createElement('a');
- link.textContent = 'Načíst raw obsah';
- link.className = 'btn -small';
- link.style.color = 'red';
- link.href = '#';
- link.addEventListener('click', async function(event) {
- event.preventDefault();
- try {
- let currentUrl = window.location.href;
- const rawUrl = currentUrl.replace(/^(https:\/\/pastebin\.com\/)(\w+)$/, '$1raw/$2');
- const response = await fetch(rawUrl);
- if (!response.ok) throw new Error('Nepodařilo se načíst obsah.');
- const rawContent = await response.text();
- await navigator.clipboard.writeText(rawContent);
- alert('Obsah byl zkopírován do schránky.');
- } catch (error) {
- console.error('Došlo k chybě:', error);
- alert('Nepodařilo se načíst a zkopírovat obsah.');
- }
- });
- rightElement.insertBefore(link, rightElement.firstChild);
- })();
Advertisement
Add Comment
Please, Sign In to add comment