JavaScript

Web data extraction with Chickenfoot and JavaScript

Given Chickenfoot as a JavaScript based Web Data Extraction tool, one can use JavaScript methods in the Chickenfoot script as well. For the given problem with the method find() it is useful to use the native JavaScript method document.evaluate() instead for retrieving data and going through the DOM tree.

Taggings:

Web data extraction using Chickenfoot

Chickenfoot is a firefox plugin and a very convenient non-visual tool for web data extraction. For the navigation in swoodoo.com, a meta search engine for flights, I used the Chickenfoot methods. The problem occured when I tried to locate a specific element in the DOM tree. The Chickenfoot method find() returns an unhandy wrapper of the HTML structure.

Easy to use Multilanguage system for JavaScript

My basic idea on this problem was, to make a similar handling than it is done for multilanguage on serverside. So basically what we need is a file which contains the translations for constants which should be accessible for javascript.

I then created following JavaScript file named "translation.js", which contains the constants for the specific languages and a function which will retrieve them and return a translated String for the constant.


var ML_en_US = [];
ML_en_US['SPACE_PROVIDING']= 'Space providing';
ML_en_US['DEFENSE_STRENGTH']= 'Shieldstrength';
ML_en_US['RESS_STORAGE']= 'Ressource-Storage';
ML_en_US['RESSOURCE']= 'Ressource';
var ML_de_DE = [];
ML_de_DE['SPACE_PROVIDING']= 'Platz';
ML_de_DE['DEFENSE_STRENGTH']= 'Verteidigungsstärke';
ML_de_DE['RESS_STORAGE']= 'Rohstoffkap.';
ML_de_DE['RESSOURCE']= 'Rohstoff';
function ML(tag, language){
try {
var result = eval('ML_' + language + '["' + tag + '"]');
if (result == undefined) return "e:"+tag;return result;}
catch (err) {
return "e:"+tag
}
}

Now arrays can be defined, which have the respective language code in their variable name, and the index is the constant used for translation. By an "eval" command the script looks for the translated version. If there is no translation available the script will catch the error and put "e:" in front of the constant and return that, so it is clearly visible to the designer, that there is no translation available for the constant at the moment.

Multilanguage in JavaScript

The problem is to provide methods and necessary data for JavaScript to be able to translate Strings which are shown on the page into different languages. Considering the webdesigner shouldnt have too much work to implement it, the function should be easy to use.

Event Handling in Javascript IE and Mozilla

As scripted sites can be very useful to users and EventHandlers in Javascript are a nice feature if you have a more complex site, we want to create a Method so EventHandlers will be recognized in Internet Explorer as well as in Mozilla browser and function as intended.

AutoComplete input box

For the improvement of user experience on a web site it is useful to provide a autocomplete element on some inputs. On the Internet there are many scripts available for download which implement autocomplete functionality. Unfortunately most of them are not functioning properly in all web browsers or have other important drawbacks - are not skinable, not flexible for different uses, etc. We want to implement a good autocomplete widget which would not have all the mentioned disadvatages.

Workaround with Javascript

You can get a workaround with Javascript

Therefore download the javascript-files from this location:
Download

Afterwards browse through the "API" of the javascript

API

and find the right function for each version of the Internet Explorer.

Make the Navigation Menu user specific

For a workflow application serveral user types are defined. In general, depending on their roles, users have different rights. In particular the navigation menu must be user specific (e.g. some users may have write access, others only read access ).

How to automatically modify web content locally

Web pages do not always provide the design we want them to. There are web pages which one visits very frequently and which one would like to modify slightly. Such modifications would be for example: a different font, to resize a part of the page or to eliminate a part of the page.

Using a predefined Blogger template to "show the voice generator the right way"

Idea of a solution

As far as the majority of blind people use special software, so call “screen readers” that read everything that is shown on the screen. As far as we deal with websites, i took into account, in my opinion, one of the best, flexible and not so buggy voice generator - FireVox (www.firevox.clcworld.net/). It’s a screen reading extension for Internet browser Mozilla Firefox. As browser itself, FireVox is also completely free and open-source.

 User can control what FireVox reads by pressing Tab button. Each element of the webpage that can have focus and is accessible by Tab button can be “observed” by user. Also FireVox provides some information about the object under the focus, e.g. whether it’s an input field, image or hyperlink. Also settings of FireVox allow to set the mode when it will read each element on the webpage which is situated under a mouse cursor.

Actually usage of Tab button is not always comfortable for user, because elements on a webpage can have completely illogical tabulation order. Moreover, the default tabulation queue of a webpage consists only of hyperlinks and input fields.Thus it’s not always simple to obtain a right impression about a webpage. So I decided to develop such an engine that can set logical tabulation order that is easy comprehensible and clear. 

So the set goal was to create a standard Google Blogger template that will support assigning right tabulation order to provide clear picture for blind people using FireVox and also assigning different color\contrast schemas for people with low eyesight.Also, as a minor goal I set minimizing the difference between website for disable people and people without any disabilities. For instance I tried to create one template for both audiences.   

Used technology 

As far as Google Blogger templates in general have the same meta-structure, we can define an algorithm which won’t depend on particular implementation of a user blog. We can define several principal widgets: Calendar, Posts feed, Comments line, Last 5(10,…) posts, Fast links and Help links. For them we develop an algorithm in Javascript for arranging tab order. All other elements are situated in the end of a tabulation queue having a default tab order between them. This was done because we cannot predict all the possible widgets that blogger can introduce to his webpage, but on another hand we cannot remove them from the tabulation queue, because it will make those elements unreachable for disabled people.

  The algorithm is run after loading the page and arranges tabulation order by assigning appropriate values to tabIndex property of webpage elements in the following order:

 1.      The header and description of a blog

2.      Items of special navigation panel, that was also added to a standard template (explained later).

3.      Posts feed (Date, Title, Post body, Post details)

4.      Last five posts

5.      Blog archive by calendar

6.      Help links

7.      Style changing panel (explained later)

8.      All the rest elements  

This is the explanation of a general algorithm. I also introduced a new navigation panel that has the following sense: the user accesses this panel in the beginning of website exploring, right after “reading” the title and the description of a blog. This menu provides anchor links to different parts of a website. But along with normal behavior of web anchors we implemented such a functionality that arrange the tab order so that the selected element\widget will first obtain the focus after pressing the Tab button. Also we removed from the tabulation queue all other elements of a webpage, so that user could concentrate on exploring the chosen element\widget. The tabulation queue is cyclic, it means that after exploring, for example, Last five posts, user is transferred (by pressing Tab) again to the new navigation panel, so that he could choose another option. Option “navigate all” sets the tabulation algorithm to the general state. 

Font size and color change

I was doing this project in collaboration with another student who was responsible for font size and color change in order t o provide different contrast schemas for color-blinded people. Here is a short summary of what he has done, just to give a full picture.

The font and background color change feature is intended for people with low vision problems. Our widget provides possibility to select between four different color sets.By selecting a specific style the cookies are created so the style will be applied to domain (e.g. http://hci-unibz.blogspot.com/), which means that all blog posts will retain the selected style. Furthermore next time user will connect to the site the browser will remember his style settings. If user selects “normal” style the cookie will be deleted.

 The text size change is considered browser feature: “Most Web browsers include functionality to let you increase or decrease the text in a Web page… …The browser settings should work when browsers and Web sites meet WAI guidelines and are designed for accessibility, flexibility, and user control” [1]. Taking this reference into account we intentionally leave text resizing for user control using browser flexibility.

 Conclusion

 So, I have implemented a nice and easy to use tool for publishing your blog not only for sighted people, but at the same (that’s important) moment for blind and visual disabled people. The implementation can be checked on http://hci-unibz.blogspot.com/ with FireVox voice generator switched on. The created standard template for Google Blogger doesn’t depend on particular user’s design solutions for his blog page, as long as created algorithm uses meta-structure of a blogging service itself. Also the tweaking for disabled people is almost not noticeable for sighted people, if not taking into account font-style-changing panel. For normal users it looks like a logical arrangement of tabulation order, if at all they use Tab button, because normally navigation through pages is done either with mouse or touch-pad.

References

[1]             http://www.w3.org/WAI/changedesign

[2]             http://www.teleacademy.it/course/view.php?id=159

[3]             http://www.w3.org/WAI/intro/accessibility.php

[4]             http://www.w3schools.com

[5]             http://help.blogger.com

[6]             http://www.eblogtemplates.com/

[7]             http://blogger-templates.blogspot.com/

[8]             http://msdn.microsoft.com/en-us/library/ms533050(VS.85).aspx

Taggings:

Pages

Subscribe to JavaScript