Browser extension(s) to save web content directly to SuperMemo

From SuperMemopedia
Jump to navigation Jump to search

Suggestion

Roman and Miko proposed:

Create extension(s) for other browsers based on the Native Messaging API that would enable the user to more naturally import selected web content (URL, page, text selection, image, etc.) from their browser directly to SuperMemo.

Advantages and disadvantages

Pros

  • Enables the user to save selected web content (URL, page, text selection, image, etc.) directly to SuperMemo from their browser of choice (not only the discontinued Internet Explorer)
  • Offers an arguably more natural way to importing web content (as opposed to opening multiple items of interest in individual browser tabs, switching back to SuperMemo, and using Web import dialog)
  • Native Messaging API allows for exchanging messages between browser extension(s) and SuperMemo (i.e. both ways). As a result, it potentially enables two modes of interaction: browser-centric and SuperMemo-centric (as currently implemented in SuperMemo and Internet Explorer)
  • Allows for delegating content filter updates (e.g. Wikipedia, Google Photos) to the browser extension via its timely auto-update mechanism, instead of being confined to the lengthy release cycle of SuperMemo.
  • Technical: Developed on the officially endorsed Native Messaging API, which should ultimately lower the total cost of development without posing long-term maintenance nightmares

Cons

Examples

Save image to SuperMemo

Video demonstration

{{#ev:youtube|2SxBHjvGA0g}}

FAQs

Extra mouse-clicks

Question

Based on demonstrated implementation, Save to SuperMemo : Image is already 2 clicks (...)

click count

If I open a hundred pictures in a hundred tabs (e.g. high school reunion pictures), I can get them all in SuperMemo with 3 keystrokes (plus optional stroke/click to close imported tabs).

Answer:

The purpose of the above video was to quickly showcase the proposed workflow between the presented Save to SuperMemo Chrome extension and SuperMemo. It is by no means the real reflection of the final implementation. It is conceivable and technically feasible to automatically display a custom popover when the mouse pointer is moved onto an image (and make it disappear once it is out) instead of the standard context menu (see the picture below).

Save to SuperMemo Chrome browser extension implementing a custom popover instead of relying on the standard browser context menu. The popover features a split button with the Save to current element command bound to the primary button and a drop-down menu with alternative commands

Figure: Save to SuperMemo Chrome browser extension implementing a custom popover instead of relying on the standard browser context menu. The popover features a split button with the Save to current element command bound to the primary button and a drop-down menu with alternative commands

The decision regarding the final implementation, however, needs to be carefully weighed based on the user feedback.

Mesteiral further added:

The UI can be also implemented to use the extension button in the toolbar (aka. browser action). Chrome can be configured to activate such a button with a keyboard shortcut. This shortcut works browser-wide and is not limited by permissions of the current tab.

Keyboard cannot be used

Question

Based on demonstrated implementation, you cannot use the keyboard.

Answer:

Note that it is a proof-of-concept demonstration, not the showcase of the proposed final implementation.

Keyboard shortcuts are supported. While definitely an option, the decision to extend the list of available shortcuts must be taken judiciously.

How do I decide which collection I send the import to?

Question:

How do I decide to which collection I send the import? Do I need SuperMemo started up?

Answer

The initial assumption was, per One body of knowledge recommendation from Step-by-step to SuperMemo mastery, that you import to the currently opened collection. However, there seems to be no technical limitation for more complex scenarios (see Mesteiral's comment below).

The current proof-of-concept implementation assumes that the extension is disabled when the receiving application (i.e. SuperMemo) is not running.

Mesteiral expanded:

It is a valid concern, but with Native Messaging the developer has full control of the workings regarding starting up SuperMemo and deciding which collection to use. Setting up Native Messaging on Windows involves adding an entry to the Windows registry pointing to the executable that receives the message from the browser. This executable could be an instrumented sm17.exe, or another executable that would start sm17.exe if it isn't already running. SuperMemo already keeps track of recently used collections, so it can choose the last one, or prompt the user to choose one. Same goes for choosing one among several running SuperMemo instances.

Usage share of desktop browsers

Using Chrome

I hate Internet Explorer. Chrome is my fav browser. Why can't I just import from Chrome using web import? When I open web import option, SuperMemo does not show me my articles I want to import from Chrome. All I see is an empty screen and import buttons. Noting to import

Hint

The current implementation of SuperMemo ties it to Internet Explorer as it uses Windows-provided methods to communicate with this browser. The suggestion being discussed not only would alleviate this limitation, but also provide ways to import only portions of a page, if so required.

Reply

SuperMemo 19 will import from Edge, but Chrome might be next in the queue

Comment on the convenience of browser-initiated or SuperMemo-initiated import

From the point of view of incremental reading, it seems like having a full view command of browsers and import options from within SuperMemo is the most convenient approach (default collecting living at the "back of the mind"). The video shows a browser-centric point of view. It could reduce the barriers of entry for new users, but old users would probably still prefer to be in full control in the driver seat in SuperMemo.

The proposal facilitates initialization by either end. Note that messages in the Native Messaging API can work in both directions. While not mentioned in the video or the description, there is nothing preventing the developer from triggering a message from SuperMemo to the extension requesting a list of tabs that the user has currently open, and display a dialog that lets the user select which tabs should be imported as full documents, as it's currently done with IE. Specifically, such SuperMemo-to-browser communication would be feasible by using the connection-based mode of the API[1], which allows to leave the communication channel open so that either end can reuse it. –Mesteiral (talk)

Comment: A broader look

The import functionality, as currently proposed, could be one piece of a larger SuperMemo command API (of sorts), where the developer exposes selected parts of SuperMemo functionality to external applications, including browsers.

The NativeMessaging paradigm has roots in browsers, and works in one of two specific ways: connected or disconnected modes. These modes and their implementation find their natural environment in browser extensions, as part of the messaging implementation is abstracted by the WebExtensions APIs.

A different conceptualization that doesn't necessarily hook into the NativeMessaging paradigm that originated the browser-based proposal, is bidirectional communication through well-supported protocols such as WebSockets. This opens the door for use beyond browsers, but also for defining the most appropriate communication scheme for the task at hand (a specific encoding, specific initiator requirements, specific ordering or out-of-order requests, etc.).

Vote

+1 vote for a SuperMemo command API