Javascript API
authorChristian Weiske <cweiske@cweiske.de>
Sun, 10 Apr 2022 15:55:08 +0000 (17:55 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 10 Apr 2022 15:55:08 +0000 (17:55 +0200)
README.rst
api/internal-urls.rst
api/javascript.rst [new file with mode: 0644]

index a44bca55da6dcf63cba368ba69d56cb948477d50..e50e87502544eab9f8e882a8b1e5f02e15b29cc3 100644 (file)
@@ -66,6 +66,7 @@ Other requests
 .. include:: api/google.clients3-generate_204.rst
 .. include:: api/mytolino-tolino-status.rst
 .. include:: api/internal-urls.rst
+.. include:: api/javascript.rst
 
 
 About
index f66adff9844efec0f5bddff21a312d88441e2e8d..156f2dd1be656a558ef0c598a1a9bfb8e81807a2 100644 (file)
@@ -7,7 +7,7 @@ Internal URLs
   Goes back to the main screen.
 
 ``epublishing://closeshop_skoti``
-  FIXME
+  Close the Skoobe shop
 
 ``epublishing://handshakeCancel``
   FIXME
@@ -16,7 +16,7 @@ Internal URLs
   FIXME
 
 ``epublishing://library``
-  FIXME
+  Open the "my books" library view
 
 ``epublishing://library_skoti``
   FIXME
@@ -25,30 +25,40 @@ Internal URLs
   The ``code`` is optional.
 
 ``epublishing://openbook``
-  FIXME
+  Start the reading mode for the given book
 
   Parameters:
     ``deliverableid``
-      FIXME
+      Book ID to open.
+
+      Example: ``DT0400.9783641267575_A39529579``
 
 ``epublishing://openbook_skoti``
   FIXME
 
 ``epublishing://openextract``
-  FIXME
+  Download the file and start the reading mode for a demo book extract
+  (German: "Leseprobe")
 
   Parameters (all 4 must be passed):
     ``extractcoverurl``
-      FIXME
+      URL of the book cover image.
 
     ``extractdeliverableid``
-      FIXME
+      Book ID
 
     ``extractdownloadurl``
-      FIXME
+      Download URL for the book demo ``.epub`` file.
 
     ``extractpurchaseurl``
-      FIXME
+      Where to buy the book after reading the extract.
+
+      Is used at the "To the shop" button that is shown on top of
+      the reading view for demo books.
+
+  The URL in the web view must not be escaped for this link to work.
+  Escpecially the ``&`` may not be escaped as ``&amp;``
+  (which would be correct HTML), so you are forced to provide invalid HTML.
 
 
 ``epublishing://opensearchresult``
@@ -68,8 +78,8 @@ Internal URLs
   FIXME
 
 ``epublishing://search``
-  FIXME
+  Open the "search books" view.
 
   Parameters:
     ``q``
-      Search term
+      Search term to search the books list for.
diff --git a/api/javascript.rst b/api/javascript.rst
new file mode 100644 (file)
index 0000000..7b12d45
--- /dev/null
@@ -0,0 +1,51 @@
+==============
+Javascript API
+==============
+
+Non-browser web views have a special JavaScript API that provides
+integration with Tolino UI elements.
+
+Example is the ShopWebViewActivity that is opens when clicking the
+"To the shop" link and the recommendations/advertisements on the main page.
+
+
+``android_init()``
+==================
+When the page has been loaded in the web view,
+a function ``android_init`` is invoked.
+This can be used to detect if the page has been loaded on a Tolino.
+
+
+``screenController``
+====================
+Each web view has a JavaScript variable ``screenController``
+that provides the interface to the Tolino UI.
+
+
+``screenController.hideNavigationHeader()``
+  Hides the header when it was enabled with ``showNavigationHeader``.
+
+``screenController.hideProgressDialog()``
+  FIXME
+
+``screenController.refreshScreen()``
+  Re-draw the e-ink screen
+
+``screenController.setNavigationHeaderTitle("my header")``
+  Override the title in the navigation header.
+  Call ``showNavigationHeader`` first.
+
+``screenController.setNavigationHeaderUrl("epublishing://closeshop")``
+  Set the URL of the "back" arrow button.
+
+``screenController.setTokens("accesstoken", "refreshtoken")``
+  FIXME
+
+``screenController.showNavigationHeader("header title")``
+  Show the native navigation header and set its title
+
+``screenController.showProgressDialog()``
+  FIXME
+
+``screenController.processHTML("<html>")``
+  Does nothing (Firmware 15.2)