:reader! Fork

    @@ -1,29 +1,49 @@ /* * @title :reader! * @description [WIP] force activate Reader View/Mode in Firefox - * @include * + * @include http:* + * @include https:* * @license MIT License https://opensource.org/licenses/MIT * @javascript_url * @bug unworks; waiting for relax about:reader permissions */ - // similar behavior by Extensions + // similar behavior by LEGACY Extensions // - // legacy + // Desktop // https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/ + // https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/versions/#version-0.0.7 // - // android only + // Android // https://addons.mozilla.org/en-US/android/addon/activate-reader-android/ + // adapt but... "Activate"? + // Activate Reader View bump up to v0.1.0, rewrote by WebExtensions API + // https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/versions/#version-0.1.0 + // same name *BUT* falsely similar + // losing aggressiveness, *JUST* a native reader-view alternative only + // + // browser.browserAction.onClicked.addListener((tab) => { + // browser.tabs.toggleReaderMode(); + // }); + // + // ...are you sure? + // Issue - // Add webextensions API(s) for reader mode + // + // Add WebExtensions API(s) for reader mode // https://bugzilla.mozilla.org/show_bug.cgi?id=1286387 + // + // Reader mode can't be opened if tab is not considered an article + // https://bugzilla.mozilla.org/show_bug.cgi?id=1419520 + // via "Remark (2017-11-21)" in "About this extension" + // https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/ (() => { 'use strict'; - // Firefox Reader View/Mode Syntax - // about:reader?url=<URL> + // Firefox Reader View/Mode syntax + // about:reader?url=<ENCODED_URL> const READER_SYNTAX = 'about:reader?url='; if (location.href.startsWith(READER_SYNTAX)) {
  • /*
     * @title :reader!
     * @description [WIP] force activate Reader View/Mode in Firefox
     * @include http:*
     * @include https:*
     * @license MIT License https://opensource.org/licenses/MIT
     * @javascript_url
     * @bug unworks;  waiting for relax about:reader permissions
     */
    
    // similar behavior by LEGACY Extensions
    //
    // Desktop
    // https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/
    //  https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/versions/#version-0.0.7
    //
    // Android
    // https://addons.mozilla.org/en-US/android/addon/activate-reader-android/
    
    // adapt but... "Activate"?
    // Activate Reader View bump up to v0.1.0, rewrote by WebExtensions API
    // https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/versions/#version-0.1.0
    // same name *BUT* falsely similar
    // losing aggressiveness, *JUST* a native reader-view alternative only
    //
    //    browser.browserAction.onClicked.addListener((tab) => {
    //      browser.tabs.toggleReaderMode();
    //    });
    //
    // ...are you sure?
    
    // Issue
    //
    // Add WebExtensions API(s) for reader mode
    // https://bugzilla.mozilla.org/show_bug.cgi?id=1286387
    //
    // Reader mode can't be opened if tab is not considered an article
    // https://bugzilla.mozilla.org/show_bug.cgi?id=1419520
    //  via "Remark (2017-11-21)" in "About this extension"
    //  https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/
    
    (() => {
        'use strict';
    
        // Firefox Reader View/Mode syntax
        //      about:reader?url=<ENCODED_URL>
        const READER_SYNTAX = 'about:reader?url=';
    
        if (location.href.startsWith(READER_SYNTAX)) {
            // FIXME about:reader can not access from Content/javascript:-context e.g.
            // http://let.hatelabo.jp
            //      "Error: Access to 'about:reader?url=http%3A%2F%2Flet.hatelabo.jp%2F' from script denied"
            //
            // native location obj in Reader View
            //  location.protocol -> "about:"   // yap
            //  location.pathname -> "reader"   // oh
            //  location.search   -> ""         // oops...
            //
            // location.assign() can not works
            location.replace(new URL(location.href).searchParams.get('url'));
    
        }
    
        // TBD history.back()
        // TBD canonical
        location.replace(READER_SYNTAX + encodeURIComponent(location.href));
    })();
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/01/23 20:03:06 - 01/23
  2. 2017/10/27 07:18:41 - 2017-10-27