コトバノウタカタ

よしなしごとをつらつらとつづるばしょ。

Google Driveの画像の直リンを開く

フォルダを公開した上で、リンクを取得してそのURLを開いて実行。ダブルクリックで開いたところではダメ。

javascript: (function () {
    l = location.href;
    n = l.replace('file/d/', 'uc?export=view&id=');
    i = n.indexOf('/view');
    if (i >= 0) {
        n = n.substr(0, i);
    }
    n = n.replace('drive/folders/', 'uc?export=view&id=');
    prompt('', n);
    window.open(n, '_blank')
})()