JB -app

  • /*
     * @title JB -app
     * @description fix viewer link to Desktop from app-scheme
     * @include https://jumpbookstore.tld/*
     * @license MIT License https://opensource.org/licenses/MIT
     * @javascript_url
     */
    
    // e.g.
    // https://jumpbookstore.jp/special/1805/hahanohi/
    //  com-access-store://?id=SHSA_ST01F0000022315P_57
    // via
    // https://jumpbookstore.com/ext/list_topics.html
    (() => {
        'use strict';
    
        document.body.querySelectorAll([
            'a[href^="com-access-store://?id="]'
        ]).forEach(link => {
            // Custom URL Scheme syntax
            // com-access-store://?id=<CONTENT_ID>
            const scheme = new URL(link.href);
            const id = scheme.searchParams.get('id');
    
            // jumpbookstore viewer syntax
            // https://jumpbookstore.com/client_info/SHUEISHA/html/player/viewer.html?[tw=2]&lin=1&cid=<CONTENT_ID>
            const viewer = new URL('https://jumpbookstore.com/client_info/SHUEISHA/html/player/viewer.html');
            viewer.searchParams.set('tw', 2); // optional
            viewer.searchParams.set('lin', 1);
            viewer.searchParams.set('cid', id);
    
            link.href = viewer.href;
        });
    })();
    
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/05/12 07:34:35 - 2018-05-12