how to create high contrast button using jquery

how to create high contrast button using jquery

by Vinícius da Rocha Motta -
Number of replies: 4

Good night,

Working in an educational institution that would like to implement a bar on site. This bar should be a button high contrast, and diminur increase the font size to assist people with disabilities. Unable to deploy using the css jquery so that the page would change. However, the changes disappear when we change page. How do I make changes remain for all pages? would be a change in the variable $ THEME?

thank you very much

(Edited by Mary Evans - original submission Sunday, 1 June 2014, 3:46 AM)

Average of ratings: -
In reply to Vinícius da Rocha Motta

Re: how to create high contrast button using jquery

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

What code are you using to do this?

In reply to Mary Evans

Re: how to create high contrast button using jquery

by Vinícius da Rocha Motta -

Good afternoon Miss Evans, 


Thanks for answering. I'll post the code tomorrow because he is not with me now, because it is on the computer in my workplace. But I would do something like what this plugin does: https://moodle.org/plugins/view.php?plugin=block_accessibility this would be ideal. But that would be put in the theme moodle header. I've tried to debug this plugin to try to understand how it works, but from what I saw the css is placed in the header via PHP code. What puzzles me is that it keeps the css for all pages not only the current.

In reply to Vinícius da Rocha Motta

Re: how to create high contrast button using jquery

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Olá meu nome é Mary (não Miss Evans) smile

If the 'button' you are creating has CSS then you can add that CSS to your Moodle theme CSS file which you will find in the style directory of your theme.

For example:
Theme name:  Anomaly
CSS file name: core.css
Path to file:  moodle / theme / anomaly / style / core.css

Tradução

Se o 'button' que você está criando tem CSS, então você pode adicionar que o CSS para o seu arquivo de tema CSS Moodle que você vai encontrar no diretório de estilo do seu tema.

Por exemplo:

Nome do tema: Anomaly
Nome do arquivo CSS: core.css
Caminho para o arquivo: moodle / theme / anomaly / style / core.css

In reply to Mary Evans

Re: how to create high contrast button using jquery[completed]

by Vinícius da Rocha Motta -

Sorry Mary,

I managed to accomplish what I wanted. I create a toolbar button accessibility with high contrast. it set the click event call one jquery function that makes a call to a php file which sets a cookie. In renderer.php put a test file with a conditional structure 'if' in order to check the existence of a cookie set when calling the file that call in jquery with $. Get. If by chance the cookie exists it includes the css file that I want. So I load the CSS dynamically.


into renderer:


if (isset($cookie['contrast'])){

            $cssurl = '/theme/themename/style/contrast.php';

            $PAGE->requires->css($cssurl);

        }

into contrast.php:


header('Content-Type: text/css');

 echo '* {color: #ffff00 !important;}
                    * {background-color: #000 !important;}
                    * {background-image: none !important;}
                    #content a, .tabrow0 span {color: #ff0 !important;}
                    .tabrow0 span:hover {text-decoration: underline;}
                    .block_accessibility .outer {border-color:#fff !important;}';


note: To use a cookie on moodle have to do the following:
require('/../../../../config.php');
global $CFG;

        setcookie('somevalue', time()+(DAYSECS*60), $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);//set cookie

    setcookie('somevalue', time()-(DAYSECS*60), $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly);//unset cookie

thank for your help