Bluemo's Brain

Search

Search IconIcon to open search

曜日ページに飛ぶBookmarklet

Last updated Unknown Edit Source

    pin-diary-3で生成しているページに直接飛べるBookmarkletを作る .js

    1
    2
    3
    4
    5
    6
    7
    
    const currentDate = new Date();
    const nextSunday = new Date();
    function zero(n) {
        return String(n).padStart(2, '0');
    }
    nextSunday.setDate(currentDate.getDate() + (7-currentDate.getDay())%7);
    window.location.href=`https://scrapbox.io/blu3mo/~${nextSunday.getFullYear()}${zero(nextSunday.getMonth() + 1)}${zero(nextSunday.getDate())}`;
    

    bookmarklet

    1
    
    javascript:const currentDate = new Date();const nextSunday = new Date();function zero(n) {return String(n).padStart(2, '0');}nextSunday.setDate(currentDate.getDate() + (7-currentDate.getDay())%7);window.location.href=`https://scrapbox.io/blu3mo/~${nextSunday.getFullYear()}${zero(nextSunday.getMonth() + 1)}${zero(nextSunday.getDate())}`;