#Firefox #Yandex #виброкодинг #ChatGPT #Tampermonkey
Навиброкодил связочку из #bookmarklet'а и #userscript'а, при помощи которых можно отправлять #YouTube-ролики прямо в https://300.ya.ru
Конечно, не совсем прямо, в сумме получается 4 клика (2, чтобы скопировать, 2 чтобы вставить). Но зато только мышкой.
1) Букмарклет
javascript:(async()=>{try{const text=await navigator.clipboard.readText();if(!text||!text.trim()){alert('Буфер пуст');return;}const w=window.open('about:blank','_blank');if(!w){alert('Popup заблокирован');return;}w.location.href='https://300.ya.ru/#'+encodeURIComponent(text);}catch(e){alert('Нет доступа к буферу');}})();
2) Юзерскрипт
// ==UserScript==
// @name 300.ya.ru Auto Paste via Hash (Stable)
// @namespace http://tampermonkey.net/
// @version 3.1
// @match https://300.ya.ru/*
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const data = decodeURIComponent(location.hash.slice(1) || '');
if (!data) return;
let inserted = false;
let submitted = false;
function fireEvents(el) {
el.dispatchEvent(new Event('input', { bubbles: true }));
el.dispatchEvent(new Event('change', { bubbles: true }));
}
function insertOnce(el) {
if (inserted) return;
inserted = true;
el.focus();
const ok = document.execCommand('insertText', false, data);
if (!ok) {
const setter = Object.getOwnPropertyDescriptor(
HTMLTextAreaElement.prototype,
'value'
)?.set;
if (setter) setter.call(el, data);
else el.value = data;
}
fireEvents(el);
}
function tryRun() {
const textarea = document.querySelector('textarea');
if (!textarea || textarea.offsetParent === null) return;
insertOnce(textarea);
const btn = document.querySelector('button[type="submit"], .submit');
if (!submitted && btn && !btn.disabled) {
submitted = true;
observer.disconnect();
clearInterval(interval);
btn.click();
}
}
const observer = new MutationObserver(tryRun);
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
const interval = setInterval(tryRun, 300);
})();
Копируем ссылку на YouTube-ролик, жмякаем букмарклет (2 клика, т.к. появится кнопка «Вставить» в целях безопасности). Откроется страничка Яши, и дальше уже всё само.







