summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-08-01 09:42:08 -0700
committerAndreas Gohr <andi@splitbrain.org>2013-08-01 09:42:08 -0700
commit301f606fd81604b858381a13d0a0359de10ff561 (patch)
treeff108e36310e1c3e236dd16093a09ac77deaf941 /lib
parent65f0aa62806695ee51cc94679913449b7ad862d6 (diff)
parent9805efa058358e0fcbd3976fa553901cabe0b2e0 (diff)
downloadrpg-301f606fd81604b858381a13d0a0359de10ff561.tar.gz
rpg-301f606fd81604b858381a13d0a0359de10ff561.tar.bz2
Merge pull request #248 from splitbrain/aria
Implemented some ARIA attributes
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/acl/script.js1
-rw-r--r--lib/scripts/behaviour.js2
-rw-r--r--lib/scripts/edit.js9
-rw-r--r--lib/scripts/editor.js1
-rw-r--r--lib/scripts/helpers.js19
-rw-r--r--lib/scripts/media.js19
-rw-r--r--lib/scripts/page.js6
-rw-r--r--lib/scripts/toolbar.js29
-rw-r--r--lib/scripts/tree.js20
-rw-r--r--lib/scripts/tw-sack.js1
10 files changed, 52 insertions, 55 deletions
diff --git a/lib/plugins/acl/script.js b/lib/plugins/acl/script.js
index c3763dc8d..0abb80d67 100644
--- a/lib/plugins/acl/script.js
+++ b/lib/plugins/acl/script.js
@@ -61,6 +61,7 @@ var dw_acl = {
*/
loadinfo: function () {
jQuery('#acl__info')
+ .attr('role', 'alert')
.html('<img src="'+DOKU_BASE+'lib/images/throbber.gif" alt="..." />')
.load(
DOKU_BASE + 'lib/plugins/acl/ajax.php',
diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js
index f1c46bf4c..85ddf503e 100644
--- a/lib/scripts/behaviour.js
+++ b/lib/scripts/behaviour.js
@@ -5,6 +5,7 @@
* @author Adrian Lang <mail@adrianlang.de>
*/
jQuery.fn.dw_hide = function(fn) {
+ this.attr('aria-expanded', 'false');
return this.slideUp('fast', fn);
};
@@ -15,6 +16,7 @@ jQuery.fn.dw_hide = function(fn) {
* @author Adrian Lang <mail@adrianlang.de>
*/
jQuery.fn.dw_show = function(fn) {
+ this.attr('aria-expanded', 'true');
return this.slideDown('fast', fn);
};
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 5a5e829bd..b1dbff683 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -23,7 +23,7 @@ function createToolButton(icon,label,key,id,classname){
$btn.addClass(classname);
}
- $btn.attr('title', label);
+ $btn.attr('title', label).attr('aria-controls', 'wiki__text');
if(key){
$btn.attr('title', label + ' ['+key.toUpperCase()+']')
.attr('accessKey', key);
@@ -40,6 +40,7 @@ function createToolButton(icon,label,key,id,classname){
icon = DOKU_BASE + 'lib/images/toolbar/' + icon;
}
$ico.attr('src', icon);
+ $ico.attr('alt', '');
$ico.attr('width', 16);
$ico.attr('height', 16);
$btn.append($ico);
@@ -76,6 +77,7 @@ function createPicker(id,props,edid){
function $makebutton(title) {
var $btn = jQuery(document.createElement('button'))
.addClass('pickerbutton').attr('title', title)
+ .attr('aria-controls', edid)
.bind('click', bind(pickerInsert, title, edid))
.appendTo($picker);
return $btn;
@@ -93,6 +95,7 @@ function createPicker(id,props,edid){
}
jQuery(document.createElement('img'))
.attr('src', item)
+ .attr('alt', '')
.appendTo($makebutton(key));
}else if (typeof item == 'string'){
// a list of text -> treat as text picker
@@ -132,9 +135,9 @@ function pickerInsert(text,edid){
function addBtnActionSignature($btn, props, edid) {
if(typeof SIG != 'undefined' && SIG != ''){
$btn.bind('click', bind(insertAtCarret,edid,SIG));
- return true;
+ return edid;
}
- return false;
+ return '';
}
/**
diff --git a/lib/scripts/editor.js b/lib/scripts/editor.js
index 042e34608..2c0924eb7 100644
--- a/lib/scripts/editor.js
+++ b/lib/scripts/editor.js
@@ -65,6 +65,7 @@ var dw_editor = {
], function (_, img) {
jQuery(document.createElement('IMG'))
.attr('src', DOKU_BASE+'lib/images/' + img[0] + '.gif')
+ .attr('alt', '')
.click(img[1])
.appendTo($ctl);
});
diff --git a/lib/scripts/helpers.js b/lib/scripts/helpers.js
index d6f36967d..632c4bff2 100644
--- a/lib/scripts/helpers.js
+++ b/lib/scripts/helpers.js
@@ -3,25 +3,6 @@
*/
/**
- * Very simplistic Flash plugin check, probably works for Flash 8 and higher only
- *
- * @author Andreas Gohr <andi@splitbrain.org>
- */
-function hasFlash(version){
- var ver = 0;
- try{
- if(navigator.plugins != null && navigator.plugins.length > 0){
- ver = navigator.plugins["Shockwave Flash"].description.split(' ')[2].split('.')[0];
- }else{
- ver = (new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))
- .GetVariable("$version").split(' ')[1].split(',')[0];
- }
- }catch(e){ }
-
- return ver >= version;
-}
-
-/**
* A PHP-style substr_replace
*
* Supports negative start and length and omitting length, but not
diff --git a/lib/scripts/media.js b/lib/scripts/media.js
index 182d5fefe..8ca21ecab 100644
--- a/lib/scripts/media.js
+++ b/lib/scripts/media.js
@@ -921,23 +921,4 @@ var dw_mediamanager = {
}
};
-// moved from helpers.js temporarily here
-/**
- * Very simplistic Flash plugin check, probably works for Flash 8 and higher only
- *
- */
-function hasFlash(version){
- var ver = 0, axo;
- try{
- if(navigator.plugins !== null && navigator.plugins.length > 0){
- ver = navigator.plugins["Shockwave Flash"].description.split(' ')[2].split('.')[0];
- }else{
- axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
- ver = axo.GetVariable("$version").split(' ')[1].split(',')[0];
- }
- }catch(e){ }
-
- return ver >= version;
-}
-
jQuery(dw_mediamanager.init);
diff --git a/lib/scripts/page.js b/lib/scripts/page.js
index 4ab0bf9b5..7b4958d82 100644
--- a/lib/scripts/page.js
+++ b/lib/scripts/page.js
@@ -62,7 +62,9 @@ dw_page = {
$fndiv = jQuery(document.createElement('div'))
.attr('id', popup_id)
.addClass('insitu-footnote JSpopup')
- .mouseleave(function () {jQuery(this).hide();});
+ .attr('aria-hidden', 'true')
+ .mouseleave(function () {jQuery(this).hide().attr('aria-hidden', 'true');})
+ .attr('role', 'tooltip');
jQuery('.dokuwiki:first').append($fndiv);
}
@@ -97,7 +99,7 @@ dw_page = {
content = content.replace(/\bid=(['"])([^"']+)\1/gi,'id="insitu__$2');
// now put the content into the wrapper
- dw_page.insituPopup(this, 'insitu__fn').html(content).show();
+ dw_page.insituPopup(this, 'insitu__fn').html(content).show().attr('aria-hidden', 'false');
},
/**
diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js
index 6d75215e0..5fc4d835e 100644
--- a/lib/scripts/toolbar.js
+++ b/lib/scripts/toolbar.js
@@ -52,8 +52,13 @@ function initToolbar(tbid,edid,tb, allowblock){
// type is a init function -> execute it
actionFunc = 'addBtnAction'+val.type.charAt(0).toUpperCase()+val.type.substring(1);
if( jQuery.isFunction(window[actionFunc]) ){
- if(window[actionFunc]($btn, val, edid)){
+ var pickerid = window[actionFunc]($btn, val, edid);
+ if(pickerid !== ''){
$toolbar.append($btn);
+ $btn.attr('aria-controls', pickerid);
+ if (actionFunc === 'addBtnActionPicker') {
+ $btn.attr('aria-haspopup', 'true');
+ }
}
return;
}
@@ -190,16 +195,17 @@ function tb_autohead(btn, props, edid){
*/
function addBtnActionPicker($btn, props, edid) {
var pickerid = 'picker'+(pickercounter++);
- createPicker(pickerid, props, edid);
+ var picker = createPicker(pickerid, props, edid);
+ jQuery(picker).attr('aria-hidden', 'true');
$btn.click(
function() {
pickerToggle(pickerid,$btn);
- return false;
+ return '';
}
);
- return true;
+ return pickerid;
}
/**
@@ -215,22 +221,26 @@ function addBtnActionLinkwiz(btn, props, edid) {
dw_linkwiz.init(jQuery('#'+edid));
jQuery(btn).click(function(){
dw_linkwiz.toggle();
- return false;
+ return '';
});
- return true;
+ return 'link__wiz';
}
/**
- * Show/Hide a previosly created picker window
+ * Show/Hide a previously created picker window
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function pickerToggle(pickerid,$btn){
var $picker = jQuery('#' + pickerid),
pos = $btn.offset();
- $picker.toggleClass('a11y')
- .offset({left: pos.left+3, top: pos.top+$btn[0].offsetHeight+3});
+ if ($picker.hasClass('a11y')) {
+ $picker.removeClass('a11y').attr('aria-hidden', 'false');
+ } else {
+ $picker.addClass('a11y').attr('aria-hidden', 'true');
+ }
+ $picker.offset({left: pos.left+3, top: pos.top+$btn[0].offsetHeight+3});
}
/**
@@ -252,4 +262,5 @@ function fixtxt(str){
jQuery(function () {
initToolbar('tool__bar','wiki__text',toolbar);
+ jQuery('#tool__bar').attr('role', 'toolbar');
});
diff --git a/lib/scripts/tree.js b/lib/scripts/tree.js
index 96763053d..c4e1da3f7 100644
--- a/lib/scripts/tree.js
+++ b/lib/scripts/tree.js
@@ -14,6 +14,12 @@ jQuery.fn.dw_tree = function(overrides) {
init: function () {
this.$obj.delegate(this.toggle_selector, 'click', this,
this.toggle);
+ jQuery('ul:first', this.$obj).attr('role', 'tree');
+ jQuery('ul', this.$obj).not(':first').attr('role', 'group');
+ jQuery('li', this.$obj).attr('role', 'treeitem');
+ jQuery('li.open > ul', this.$obj).attr('aria-expanded', 'true');
+ jQuery('li.closed > ul', this.$obj).attr('aria-expanded', 'false');
+ jQuery('li.closed', this.$obj).attr('aria-live', 'assertive');
},
/**
@@ -35,8 +41,14 @@ jQuery.fn.dw_tree = function(overrides) {
$listitem = $clicky.closest('li');
$sublist = $listitem.find('ul').first();
opening = $listitem.hasClass('closed');
- $listitem.toggleClass('open closed');
dw_tree.toggle_display($clicky, opening);
+ if ($sublist.is(':visible')) {
+ $listitem.removeClass('open').addClass('closed');
+ $sublist.attr('aria-expanded', 'false');
+ } else {
+ $listitem.removeClass('closed').addClass('open');
+ $sublist.attr('aria-expanded', 'true');
+ }
// if already open, close by hiding the sublist
if (!opening) {
@@ -48,6 +60,8 @@ jQuery.fn.dw_tree = function(overrides) {
$sublist.hide();
if (typeof data !== 'undefined') {
$sublist.html(data);
+ $sublist.parent().attr('aria-busy', 'false').removeAttr('aria-live');
+ jQuery('li.closed', $sublist).attr('aria-live', 'assertive');
}
if ($listitem.hasClass('open')) {
// Only show if user didn’t close the list since starting
@@ -63,11 +77,11 @@ jQuery.fn.dw_tree = function(overrides) {
}
//prepare the new ul
- $sublist = jQuery('<ul class="idx"/>');
+ $sublist = jQuery('<ul class="idx" role="group"/>');
$listitem.append($sublist);
timeout = window.setTimeout(
- bind(show_sublist, '<li><img src="' + DOKU_BASE + 'lib/images/throbber.gif" alt="loading..." title="loading..." /></li>'), dw_tree.throbber_delay);
+ bind(show_sublist, '<li aria-busy="true"><img src="' + DOKU_BASE + 'lib/images/throbber.gif" alt="loading..." title="loading..." /></li>'), dw_tree.throbber_delay);
dw_tree.load_data(function (data) {
window.clearTimeout(timeout);
diff --git a/lib/scripts/tw-sack.js b/lib/scripts/tw-sack.js
index cc988f5be..b0e570151 100644
--- a/lib/scripts/tw-sack.js
+++ b/lib/scripts/tw-sack.js
@@ -2,6 +2,7 @@
/* ©2005 Gregory Wild-Smith */
/* www.twilightuniverse.com */
/* Software licenced under a modified X11 licence, see documentation or authors website for more details */
+/* @deprecated */
function sack(file){
this.AjaxFailedAlert = "Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";