Commit 842a9b3c authored by Riccardo Padovani's avatar Riccardo Padovani

Inseriti js per laccessibilità

Rinominata cartella immagini da ubuntu a light e aggiornato il css
Modificato lhead delle pagine per caricare i file js per laccessibilità
Riscritto header.html per renderlo identico a quello del forum, e aggiornato il css con particolare cura per le medaglie, come da bug #1020259
parent e384f8b3
/*
** This file contains function to enable and
** disable Accessibility stylesheet in ubuntu-it
*/
//ACCESSIBILITY_CSS_THEME_DIR = 'light-drupal-theme/styles';
//ACCESSIBILITY_CSS_FILE_NAME = 'accessibility.css' ;
ACCESSIBILITY_CSS_ABSPATH = ['http://ubuntu-it.org/sites/all/themes/light-drupal-theme/styles/accessibility.css'];
ACCESSIBILITY_COOKIE_VALUE_ON = 'on';
ACCESSIBILITY_COOKIE_VALUE_OFF = 'off';
// This function adds the accessibility css into the Head section
// and set the cookie value ON
function accessibility_set_on () {
head = document.getElementsByTagName('head')[0];
for (i = 0; i < ACCESSIBILITY_CSS_ABSPATH.length ; i++) {
link = document.createElement('link');
link.setAttribute('type','text/css');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('media', 'screen');
link.setAttribute('href', ACCESSIBILITY_CSS_ABSPATH[i]);
head.appendChild(link);
}
set_cookie_accessibility( ACCESSIBILITY_COOKIE_VALUE_ON );
}
// This function removes the accessibility css from the Head section
// and set the cookie value OFF
function accessibility_set_off() {
head = document.getElementsByTagName('head')[0];
links = head.getElementsByTagName('link');
links_to_remove = []
for (i = 0 ; i < links.length ; i++) {
link = links[i];
if (link.getAttribute('type') == 'text/css') {
for (j = 0 ; j < ACCESSIBILITY_CSS_ABSPATH.length ; j++) {
if (link.getAttribute('href').indexOf(ACCESSIBILITY_CSS_ABSPATH[j]) >= 0 ) {
links_to_remove.push(link);
}
}
}
}
for (i = 0; i < links_to_remove.length; i++) {
head.removeChild(links_to_remove[i]);
}
set_cookie_accessibility( ACCESSIBILITY_COOKIE_VALUE_OFF );
}
function accessibility_toggle () {
value = get_cookie_accessibility();
// If accessibility is ON, remove the css stylesheet
if (value == ACCESSIBILITY_COOKIE_VALUE_ON)
accessibility_set_off();
else
accessibility_set_on();
}
// The main function
function accessibility () {
value = get_cookie_accessibility();
// If accessibility is ON, add the css stylesheet
if (value == ACCESSIBILITY_COOKIE_VALUE_ON)
accessibility_set_on();
}
// Common variabiles
COOKIE_DOMAIN = "ubuntu-it.org";
COOKIE_PREFIX = "ubuntu-it_custom_";
COOKIE_ACCESIBILITY_NAME = "accessibility";
// Start Cookie in browser functions
function set_cookie ( name, value, expires, path, domain, secure )
{
name = COOKIE_PREFIX + name;
var cookie_string = name + "=" + escape ( value );
if ( expires ) {
cookie_string += "; expires=" + expires.toGMTString();
}
else {
var expires = new Date ( 2100, 1, 1); // never expires
cookie_string += "; expires=" + expires.toGMTString();
}
if ( path )
cookie_string += "; path=" + escape ( path );
else
cookie_string += "; path=" + escape ("/")
if ( domain )
cookie_string += "; domain=" + escape ( domain );
else
// cookie_string += "; domain=" + escape (location.host)
cookie_string += "; domain=" + escape (COOKIE_DOMAIN);
if ( secure )
cookie_string += "; secure";
document.cookie = cookie_string;
}
function delete_cookie ( cookie_name ) {
cookie_name = COOKIE_PREFIX + cookie_name;
var cookie_date = new Date ( ); // current date & time
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
function get_cookie ( cookie_name ) {
cookie_name = COOKIE_PREFIX + cookie_name;
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
if ( results )
return ( unescape ( results[2] ) );
else
return null;
}
// End Cookie in browser functions
// Accessibility
function set_cookie_accessibility (cookie_value) {
cookie_name = COOKIE_ACCESIBILITY_NAME;
set_cookie (cookie_name, cookie_value);
}
function get_cookie_accessibility () {
cookie_name = COOKIE_ACCESIBILITY_NAME;
return get_cookie (cookie_name);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment