[prev in list] [next in list] [prev in thread] [next in thread] 

List:       elinks-users
Subject:    Re: [elinks-users] Q: how to trigger bell?
From:       Witold Filipczyk <witekfl001 () gmail ! com>
Date:       2014-12-12 18:44:11
Message-ID: 20141212184411.GA27846 () pldmachine ! domain_not_set ! invalid
[Download RAW message or body]

On Fri, Dec 12, 2014 at 06:04:24PM +0100, Dirk Schouten wrote:
> Dear elinks forum members,
> New to elinks, we developed a chat for blind
> users (using a text only browser, no Javascript).
> Please see the manual at:
> http://websiteatschool/program/manuals/en/chat.html
> 
> With Elinks (and a great tip from Witold!) it
> works like a charm.
> 
> Only one thing is missing, which is available in the 
> GUI for visual and visually impaired users ( which 
> uses Javascript): a sound when a new message arrives.
> 
> Consulting the elinks.conf manual I found:
> 
> document.download.notify_bell <num> (default: 0)
> 
> Question: Is there a possibility to put something in a 
> HTML page to trigger the bell?
> 
> NOTE:
> Every n seconds we send an 'empty' HTML pages when 
> there is no new information.
> When there is new input from a user, the page contains 
> for example:
> 
> Mary: some text that is written by Mary

Browser scripting and preformat html hook is good for this.

Here is an example in Python:

# BEGIN EXAMPLE
import os
def preformat_html_def pre_format_html_hook(url, html):
    """Rewrite the body of a document before it's formatted.

    This function should return a string for ELinks to format, or None
    if ELinks should format the original document body. It can be used
    to repair bad HTML, alter the layout or colors of a document, etc.

    Arguments:

    url -- The URL of the document.
    html -- The body of the document.

    """
    if url.find("elinks.cz") != -1:
       os.system('play -q /home/users/witekfl/.elinks/doorbell.wav &')
    elif html.find('{SOUND}') != -1:
       os.system('play -q /home/users/witekfl/.elinks/doorbell.wav &')
#END EXAMPLE

This function plays sound when user has visited the elinks.cz site or in the body of \
a webpage there is text: {SOUND}. play is part of the sox package.
path to the doorbell.wav is an example

For Python scripting --with-python must be added to the ./configure script.
The file hooks.py with hook functions must placed in /etc/elinks/ or ~/.elinks/

I hope, you got the idea.
-- 
http://lists.linuxfromscratch.org/listinfo/elinks-users
Unsubscribe: See the above information page


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic