昨日改

    @@ -1,6 +1,6 @@ /* * @title 昨日改 - * @description 「userId」で指定したユーザーあるいははてなドメインならURLから取得したユーザーIDのブックマーク一覧ページを画面左上に表示されるカレンダーから選択した日付別に表示する + * @description 「userId」で指定したユーザーあるいは、はてなドメインならURLから取得したユーザーIDのブックマーク一覧ページを画面左上に表示されるカレンダーから選択した日付別に表示する * @include http://* * @license MIT License * @require
  • /*
     * @title 昨日改
     * @description 「userId」で指定したユーザーあるいは、はてなドメインならURLから取得したユーザーIDのブックマーク一覧ページを画面左上に表示されるカレンダーから選択した日付別に表示する
     * @include http://*
     * @license MIT License
     * @require 
     */
    
    
    javascript:(function(){
        // 1. ユーザーIDの取得(はてなドメインならURLから、そうでなければデフォルト)
        let userId = 'mame-tanuki';
        const match = location.pathname.match(/^\/([^\/]+)\//);
        if (location.host === 'b.hatena.ne.jp' && match) {
            userId = match[1];
        }
    
        // 2. 一時的な入力フォーム(カレンダー)の作成
        const input = document.createElement('input');
        input.type = 'date';
        
        // スタイル調整:画面中央に大きく表示
        Object.assign(input.style, {
            position: 'fixed',
            top: '50%',
            left: '50%',
            transform: 'translate(-50%, -50%)',
            zIndex: '999999',
            padding: '10px',
            fontSize: '16px',
            border: '2px solid #00A4DE',
            borderRadius: '8px',
            boxShadow: '0 4px 15px rgba(0,0,0,0.3)'
        });
    
        // 初期値として「昨日」を設定
        const d = new Date();
        d.setDate(d.getDate() - 1);
        input.value = d.toISOString().split('T')[0];
    
        // 3. 日付が選択された時の処理
        input.onchange = function() {
            const val = input.value.replace(/-/g, ''); // '2023-10-27' -> '20231027'
            if (val) {
                location.href = `https://b.hatena.ne.jp/${userId}/${val}`;
            }
            document.body.removeChild(input);
        };
    
        // 4. キャンセル処理(入力を外れたら消す)
        input.onblur = function() {
            document.body.removeChild(input);
        };
    
        // 画面に追加してフォーカスを当てる
        document.body.appendChild(input);
        input.showPicker ? input.showPicker() : input.focus();
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2026/03/04 00:19:03 - 2 days ago
  2. 2026/03/04 00:18:08 - 2 days ago
  3. 2026/03/04 00:15:35 - 2 days ago
  4. 2026/03/03 00:11:52 - 03/03
  5. 2026/03/03 00:11:28 - 03/03
  6. 2026/03/03 00:08:08 - 03/03