A Javascript-based proxy to serve a web-page, and highlight and scroll to an arbitrary text.
Read the blog post.
Features:
- Supports single or multiple words;
- Scrolls to the Nth occurrence of the word/phrase;
- Supports non-Latin characters (e.g. accent characters ...) (multi-lingual?);
- URL parameter to modify the highlight background colour;
- Smooth-scrolling implemented;
npm install
npm build
npm test
npm start
With minimal parameters in the request URL:
/?url={URL}&text={MY TEXT}
With optional occurrence number:
/?url={URL}&text={MY TEXT}&occurrence={N}
With optional highlight background colour keywords:
/?url={URL}&text={MY TEXT}&bg={BACKGROUND COLOUR NAME}
API examples:
/?url=http://kiplingsociety.co.uk/poems_if.htm&text=Kings
/?url=http://kiplingsociety.co.uk/poems_if.htm&text=Kings&bg=pink
- Example 1: 'If' by Rudyard Kipling (text: 'Kings')
- Example 2: 'I have a dream' by Martin Luther King (text: 'creed')
- Example 3: 'Les Principes de la Philosophie' by Descartes (text: 'très')
- Not supported in MS Internet Explorer (works in Chrome, Firefox; other browsers not yet tested)
highlight-phrase.js
can sometimes corrupt the proxied HTML page(!)- Case-sensitive text 'searching';
- Need to wire in the form;
- Need a loading spinner;
- ... ?
The following are included and extended as part of scroll-to-text
:
I claim no ownership over the web-content presented [below] via the 'scroll-to-text' proxy service, and accept no responsibility for it. Images and other resources may be missing from proxied content (browser security restrictions?) This is prototype software which may contain bugs!
© 2018-2019 Nick Freear & contributors | License: MIT.