Browser Widget usage examples

Moderators: LCMark, LCfraser

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2166
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser Widget usage examples

Post by [-hh] » Sun Sep 01, 2019 8:29 pm

Widget usage example #27: NoNavigation/NoBackNavigation

As this was several times a question in the forum and also in the use-list here a method that works in the browser widget on all platforms that support it.

This is the first and only (without 'side effects') working method of a lot of answers I found on stack overflow. It cleverly uses CSS! Credits are in the stack.

You can choose to have

• either no navigation at all or
• no back navigation only

from the current page by simply using check buttons.

The script is short but better to understand with a demo, it adds a short javascript to every page that you open (see card script).

The attached stack is tested to work with LC 9.5.0 on MacOS 10.14.6, Windows 10 and Ubuntu 1604 (64bit).
 
Attachments
noNav-noBackNav.livecode.zip
(2.75 KiB) Downloaded 123 times
noNav.png
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2166
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser Widget usage examples

Post by [-hh] » Fri Oct 11, 2019 11:28 pm

Widget usage example #28: ELIZA_bot

This stack is a GUI to the javascipt library elizabot.js by Norbert Landsteiner.
The library and the vocabulary of the bot are already part of the stack (so you can use it offline).

Find this default vocabulary also attached so that you can make changes/additions (follow exactly the syntax there!).
The stack has a button "importData" that loads the (changed) library using a dialog into the browser widget and saves it to the stack *overwriting the default vocabulary*.

The attached stack is tested to work with LC 9.5.0 on MacOS 10.13.6/10.14.6/10.15.0.
Using LC 8.1.10 it runs also on Window 7/10 and Ubuntu 1604 (64bit).
(This is due to deficiencies of the browser widget in LC 9.5.0 on Windows and linux).
 
Attachments
elizabot.livecode.zip
The stack (incl. jslib and vocabulary).
(22.47 KiB) Downloaded 182 times
elizadata.js.zip
The vocabulary (only needed for editing).
(4.72 KiB) Downloaded 101 times
elizabot.png
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2166
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser Widget usage examples

Post by [-hh] » Thu Oct 24, 2019 3:16 am

Widget usage example #29: PDF-Tools v110
v109 ... Oct 21,2019 ... first public release
v110 ... Oct 24,2019 ... added optional use of an SVG icon
v110 ... Oct 26,2019 ... runs now on Mac/win/linux with 9.0.5


Using LC 9.0.5 PDF-Tools runs on Mac/Win/linux(ubuntu1604).
More exactly:
Using LC 8.1.10/9.0.5/9.5.0 it runs on MacOS >=10.12.6.
Using LC 8.1.10/9.0.5 it runs on Win7.
Using LC 9.0.5 it runs on Wn10 and linux(ubuntu1604).
[This is due to deficiencies of the browser widget.]

PDF-Tools is a helper (and GUI) to the new javascript library PDF-lib.js by Andrew Dillon (see https://github.com/Hopding/pdf-lib MIT-licensed). The library is already part of the stack (so you can use it offline).
  • Input up to three remote or local URLs
  • Input ranges or mixtures using the following syntax:
    • MERGE: (x to y step ±z | ±all | ±even | ±odd ) of pdfN [repeat m]
      Takes pages x=start, y=stop, z=step, repeat m from pdf pdfN.
      A negative step is used positive, then reverses the pages order.
      Example: 1 to 40 step -2 of 1 repeat 2, all of 3, 10 to -1 of 2
    • SPLIT: (x to y step ±z | ±all | ±even | ±odd ) [repeat m] > n
      Takes pages x=start, y=stop, z=step, repeat m from *PDF1*,
      n=num of pieces, n=0 gives the max. num of output pieces.
      A negative step is used positive, then reverses the pages order.
      Example: 1 to -1 step 3 repeat 2 > 0, odd > 1, all > 4
    • MIX: m of pdfN
      Takes m=num pages from pdf pdfN. The items are repeated cyclically.
      Example: 1 of 1, 1 of 2
  • Optionally do Autosave and/or add MetaData, a header, footer, pageNums and/or a SVG icon to the resulting PDFs.
  • Special Example: Print two-sided (on front and back) using SPLIT with "-odd>1, even>1" as ranges (see stack help).
Download PDF-Tools from "SampleStacks" of the LC toolbar or http://livecodeshare.runrev.com/stack/951/
Please SAVE the stack to your local disk before using "Autosave".
 
Attachments
PDF-Tools.png
Last edited by [-hh] on Sat Oct 26, 2019 8:46 pm, edited 1 time in total.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2166
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser Widget usage examples

Post by [-hh] » Sat Oct 26, 2019 4:40 pm

Widget usage example #30: Steganograph v110

Steganograph is tested to work (offline) using LC 8.1.10/9.0.5/9.5 on MacOS > 10.12 and, using LC 8.1.10/9.0.5, on win 7/10 and linux (ubuntu1604).

The stack does (kind of) Steganography with an image, see https://en.wikipedia.org/wiki/Steganography

The goal was here to have a method that uses in a standard way only the alphadata of an image to hide embedded text. By that
  • we can use ANY base64 encoded data for embedding.
    As examples we use plainText, htmlText and an image. Other examples are styledText, rtfText or a svgPath.
  • we can clean the image from embedded code by simply resetting the alphadata of that image.
That is, who knows that Steganograph embedded an object
  • can remove that object with a short script.
  • can not read the embedded object as "clear" data, except he knows what YOU do with the object before embedding.
We use compressing and base64Encoding of the embed-data.
The decoding and encoding is done by a JS library via a browser widget.

Download Steganograph from "SampleStacks" or
http://livecodeshare.runrev.com/stack/952/
 
Attachments
steganograph.png
steganograph.png (23.35 KiB) Viewed 762 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2166
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Browser Widget usage examples

Post by [-hh] » Tue Oct 29, 2019 2:21 am

Widget usage example #31: OCR-Lite_v100

OCR-Lite is tested to work (offline) using LC 8.1.10/9.0.5/9.5 on MacOS > 10.12 and using LC 9.0.5 on win 7/10 and linux (ubuntu1604). Be patient on windows, it's a bit slower than on Mac.

OCR-Lite is a GUI to the JS library by Kevin Kwok
https://github.com/antimatter15/ocrad.js
which is in turn an emscripten port to GNU Ocrad by Antonio Diaz Diaz
https://www.gnu.org/software/ocrad/ocrad.html
The library is included in the stack, so you can use the stack offline.
The License is GNU GENERAL PUBLIC v3.0: https://www.gnu.org/licenses/gpl-3.0.en.html

You have only to load your images into the stack and click a button.
There are example images for finding nothing up to finding 98% of the "text" in the image.

Of course, tesseract has better results but it needs around 10 MByte of trainingData for each language.
Ocrad.js has < 1 MByte size and yields, TMHO, in average good results.

Download OCR-Lite from "SampleStacks" of the LC toolbar or from http://livecodeshare.runrev.com/stack/953/
 
Attachments
OCR-Lite.png
OCR-Lite.png (74.27 KiB) Viewed 680 times
shiftLock happens

Post Reply

Return to “LiveCode Builder”