sibu 0.9.5 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +81 -4
- data/app/assets/javascripts/sibu/sibu.js.erb +17 -3
- data/app/assets/javascripts/tabs/van11y-accessible-tab-panel-aria.js +122 -124
- data/app/assets/stylesheets/sibu/defaults.scss +72 -80
- data/app/assets/stylesheets/sibu/sibu.css +20 -1
- data/app/controllers/sibu/application_controller.rb +8 -0
- data/app/controllers/sibu/pages_controller.rb +11 -4
- data/app/controllers/sibu/sites_controller.rb +6 -1
- data/app/helpers/sibu/application_helper.rb +1 -1
- data/app/helpers/sibu/pages_helper.rb +97 -16
- data/app/models/sibu/page.rb +0 -1
- data/app/models/sibu/site.rb +7 -0
- data/app/models/sibu/site_template.rb +1 -1
- data/app/views/layouts/sibu/edit_content.html.erb +220 -126
- data/app/views/sibu/images/edit.js.erb +5 -3
- data/app/views/sibu/pages/_code_edit_panel.html.erb +4 -3
- data/app/views/sibu/pages/_form.html.erb +8 -0
- data/app/views/sibu/pages/_link_edit_panel.html.erb +6 -6
- data/app/views/sibu/pages/_map_edit_panel.html.erb +3 -2
- data/app/views/sibu/pages/_media_edit_panel.html.erb +2 -2
- data/app/views/sibu/pages/_new_section_panel.html.erb +1 -1
- data/app/views/sibu/pages/_paragraph_edit_panel.html.erb +2 -2
- data/app/views/sibu/pages/_text_edit_panel.html.erb +2 -2
- data/app/views/sibu/pages/child_element.js.erb +2 -2
- data/app/views/sibu/pages/clone_element.js.erb +2 -2
- data/app/views/sibu/pages/create_section.js.erb +1 -1
- data/app/views/sibu/pages/delete_element.js.erb +1 -1
- data/app/views/sibu/pages/delete_section.js.erb +1 -1
- data/app/views/sibu/pages/edit.html.erb +1 -1
- data/app/views/sibu/pages/edit_element.js.erb +68 -66
- data/app/views/sibu/pages/edit_section.js.erb +6 -5
- data/app/views/sibu/pages/index.html.erb +3 -3
- data/app/views/sibu/pages/new_section.js.erb +22 -13
- data/app/views/sibu/pages/update_element.js.erb +2 -2
- data/app/views/sibu/pages/update_section.js.erb +3 -3
- data/app/views/sibu/sites/index.html.erb +1 -1
- data/db/migrate/20200401130601_add_ref_to_site_templates.rb +5 -0
- data/lib/sibu/engine.rb +0 -2
- data/lib/sibu/version.rb +1 -1
- metadata +3 -18
- data/app/views/sibu/pages/destroy.html.erb +0 -2
- data/app/views/sibu/pages/update.html.erb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48f219f6b806e3d5d5fbd7ce2df9224fd2e65b8a
|
4
|
+
data.tar.gz: 56fcfd81852d1cb3a11f4c0b4a3754cbf0f261c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10d19792d46338bd0bd7a3be61bad6547562e8e55edf252ee311727b7f02dfad823c95e66667f3e314ad6d3be30ca51a688028b0a1628f7d6ecfda46caf2e12d
|
7
|
+
data.tar.gz: 92ecb493f7f4f5986cb0c8f5936add93dd5d962fa7618c5eba06cbd40638bc73837ba0f9e94a6673968c3ec044685ac25fa5d2e37eb21cbd20c8e5b0eb41bad3
|
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
# Sibu
|
2
|
-
|
3
|
-
|
1
|
+
# Sibu
|
2
|
+
Sibu is an engine to build websites. It focuses on :
|
3
|
+
- Maintaining a simple data model, so it can be exported & imported in many formats
|
4
|
+
- Increasing the productivity of web developers by using a Domain Specific Language for page edition
|
5
|
+
- Providing non-technical users with a simple and accessible site administration interface
|
4
6
|
|
5
7
|
## Usage
|
6
|
-
|
8
|
+
Sibu is currently implemented as a Ruby on Rails engine. Therefore its setup requires a host Ruby on Rails application, that can be created via :
|
9
|
+
|
10
|
+
`rails new my_app`
|
7
11
|
|
8
12
|
## Installation
|
9
13
|
Add this line to your application's Gemfile:
|
@@ -22,6 +26,79 @@ Or install it yourself as:
|
|
22
26
|
$ gem install sibu
|
23
27
|
```
|
24
28
|
|
29
|
+
Once the installation is complete, make sure that you copy the database migrations to your application :
|
30
|
+
```bash
|
31
|
+
rake sibu:install:migrations
|
32
|
+
```
|
33
|
+
|
34
|
+
And finally run the migrations to update your database model :
|
35
|
+
```bash
|
36
|
+
rake db:migrate
|
37
|
+
```
|
38
|
+
|
39
|
+
## Configuration
|
40
|
+
Configuration is provided via the `sibu` key of the Rails application configuration. Typically, this would be done in a `sibu.rb` file in the `config/initializers` folder of your Rails application.
|
41
|
+
The example below lists the configuration options available :
|
42
|
+
```ruby
|
43
|
+
Rails.application.config.sibu = {
|
44
|
+
|
45
|
+
# Title metatag of the admin interface
|
46
|
+
title: 'My website administration',
|
47
|
+
|
48
|
+
# Stylesheet to use to style the admin interface
|
49
|
+
stylesheet: 'my_user_css',
|
50
|
+
|
51
|
+
# Javascript to include in the admin interface
|
52
|
+
javascript: 'my_user_js',
|
53
|
+
|
54
|
+
# Path to the admin interface header partial
|
55
|
+
top_panel: 'shared/user/top_panel',
|
56
|
+
|
57
|
+
# Path to the main content edition partial - must include a yield to delegate content display to the Sibu engine
|
58
|
+
content_panel: 'shared/user/content_panel',
|
59
|
+
|
60
|
+
# Path to the admin interface footer partial
|
61
|
+
bottom_panel: 'shared/user/bottom_panel',
|
62
|
+
|
63
|
+
# Name of the method that will be used to authenticate admin users - this method must be available to Sibu controllers
|
64
|
+
auth_filter: :authenticate_user!,
|
65
|
+
|
66
|
+
# Name of the method that will retrieve the current user - this method must be available to Sibu controllers
|
67
|
+
current_user: 'current_user',
|
68
|
+
|
69
|
+
# A flag to indicate that the Sibu instance should offer a separate environment for each user
|
70
|
+
multi_user: true,
|
71
|
+
|
72
|
+
# A proc to identify super-admin users in a multi-users setup (optional)
|
73
|
+
admin_filter: Proc.new {|usr| usr.is_admin},
|
74
|
+
|
75
|
+
# When active, users will be able to override the colors and fonts of the sites templates (optional)
|
76
|
+
custom_styles: true,
|
77
|
+
|
78
|
+
# Lists of colors and fonts available for sites templates customization - Only used when custom_styles is set to true (optional)
|
79
|
+
primary_colors: ['#23527c', '#00B1BF', '#BECD00'],
|
80
|
+
secondary_colors: ['#E2007A', '#aaaaa1', '#be6432'],
|
81
|
+
primary_fonts: ['Intro', 'Lato', 'SourceSansPro'],
|
82
|
+
secondary_fonts: ['Aleo', 'Bodoni', 'Cinzel'],
|
83
|
+
|
84
|
+
# The domain name that will host the admin interface (should be different from the website domain name)
|
85
|
+
host: 'localhost',
|
86
|
+
|
87
|
+
# A partial for 404 error pages
|
88
|
+
not_found: 'shared/templates/not_found',
|
89
|
+
|
90
|
+
# Dimensions of the images to use in the website - Uploaded images will be automatically resized in the provided formats
|
91
|
+
images: {large: 1600, medium: 800, small: 320},
|
92
|
+
|
93
|
+
# Versions available for the created websites
|
94
|
+
versions: [['Français', 'fr'], ['Anglais', 'en']],
|
95
|
+
|
96
|
+
# A proc to override the default ordering of the sections when editing content (optional)
|
97
|
+
sections_ordering: Proc.new {|sections| sections.sort_by {|s| SECTIONS_TABS.index(s['category'])}}
|
98
|
+
}
|
99
|
+
```
|
100
|
+
|
101
|
+
|
25
102
|
## Improvements
|
26
103
|
- Use a specific controller & helper for site display
|
27
104
|
- Move page templates to SiteTemplate model
|
@@ -1,5 +1,3 @@
|
|
1
|
-
//= require rails-ujs
|
2
|
-
//= require jquery
|
3
1
|
//= require sibu/common
|
4
2
|
//= require ../quill/quill
|
5
3
|
//= require ../tabs/van11y-accessible-tab-panel-aria
|
@@ -140,7 +138,7 @@ function displayCurrentCenter(img, centerPos) {
|
|
140
138
|
}
|
141
139
|
|
142
140
|
function refreshAfterEdit(reload, sectionId) {
|
143
|
-
var baseUrl = window.location.href.split('?')[0];
|
141
|
+
var baseUrl = window.location.href.split('?')[0].replace(/#.+/, '');
|
144
142
|
if (reload) {
|
145
143
|
if (sectionId) {
|
146
144
|
window.location.href = baseUrl + '?edit_section=' + sectionId;
|
@@ -152,6 +150,22 @@ function refreshAfterEdit(reload, sectionId) {
|
|
152
150
|
}
|
153
151
|
}
|
154
152
|
|
153
|
+
function setLinkMode(elt) {
|
154
|
+
var selected = elt.value,
|
155
|
+
enabledElts = document.querySelector("#link_" + selected).querySelectorAll("#element_value, #element_target");
|
156
|
+
for (var i = 0; i < enabledElts.length; i++) {
|
157
|
+
enabledElts[i].removeAttribute("disabled");
|
158
|
+
}
|
159
|
+
|
160
|
+
var linkModes = document.querySelectorAll(".sibu_edit_form .link_mode");
|
161
|
+
for (var j = 0; j < linkModes.length; j++) {
|
162
|
+
if(linkModes[j].getAttribute("id") !== ("link_" + selected)) {
|
163
|
+
linkModes[j].querySelector("#element_value").setAttribute("disabled", "disabled");
|
164
|
+
linkModes[j].querySelector("#element_target").setAttribute("disabled", "disabled");
|
165
|
+
}
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
155
169
|
function initSectionsPanel() {
|
156
170
|
|
157
171
|
}
|
@@ -160,9 +160,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
160
160
|
* @param {Node} node Default document
|
161
161
|
* @return {Array}
|
162
162
|
*/
|
163
|
+
// Note : patched to target only direct child nodes having .js-tabs class
|
163
164
|
var $listTabs = function $listTabs() {
|
164
165
|
var node = arguments.length <= 0 || arguments[0] === undefined ? doc : arguments[0];
|
165
|
-
return [].slice.call(node.querySelectorAll('.' + TABS_JS));
|
166
|
+
return [].slice.call(node.querySelectorAll(':scope > .' + TABS_JS));
|
166
167
|
};
|
167
168
|
|
168
169
|
/**
|
@@ -178,10 +179,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
178
179
|
var hx = tabs_node.hasAttribute(TABS_DATA_HX) === true ? tabs_node.getAttribute(TABS_DATA_HX) : '';
|
179
180
|
var hxGeneratedClass = tabs_node.hasAttribute(TABS_DATA_GENERATED_HX_CLASS) === true ? tabs_node.getAttribute(TABS_DATA_GENERATED_HX_CLASS) : TABS_HX_DEFAULT_CLASS;
|
180
181
|
var existingHx = tabs_node.hasAttribute(TABS_DATA_EXISTING_HX) === true ? tabs_node.getAttribute(TABS_DATA_EXISTING_HX) : '';
|
181
|
-
var $tabList = [].slice.call(tabs_node.querySelectorAll('.' + TABS_JS_LIST));
|
182
|
-
var $tabListItems = [].slice.call(tabs_node.querySelectorAll('.' + TABS_JS_LISTITEM));
|
183
|
-
var $tabListLinks = [].slice.call(tabs_node.querySelectorAll('.' + TABS_JS_LISTLINK));
|
184
|
-
var $tabListPanels = [].slice.call(tabs_node.querySelectorAll('.' + TABS_JS_CONTENT));
|
182
|
+
var $tabList = [].slice.call(tabs_node.querySelectorAll(':scope > .' + TABS_JS_LIST));
|
183
|
+
var $tabListItems = [].slice.call(tabs_node.querySelectorAll(':scope > .' + TABS_JS_LIST + ' > .' + TABS_JS_LISTITEM));
|
184
|
+
var $tabListLinks = [].slice.call(tabs_node.querySelectorAll(':scope > .' + TABS_JS_LIST + ' > .' + TABS_JS_LISTITEM + ' > .' + TABS_JS_LISTLINK));
|
185
|
+
var $tabListPanels = [].slice.call(tabs_node.querySelectorAll(':scope > .' + TABS_JS_CONTENT));
|
185
186
|
var noTabSelected = true;
|
186
187
|
|
187
188
|
// container
|
@@ -300,35 +301,91 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
300
301
|
};
|
301
302
|
|
302
303
|
/* listeners */
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
304
|
+
['click', 'keydown'].forEach(function (eventName) {
|
305
|
+
//let isCtrl = false;
|
306
|
+
|
307
|
+
doc.body.addEventListener(eventName, function (e) {
|
308
|
+
|
309
|
+
// click on a tab link or on something IN a tab link
|
310
|
+
var parentLink = searchParent(e.target, TABS_JS_LISTLINK);
|
311
|
+
if ((hasClass(e.target, TABS_JS_LISTLINK) === true || parentLink !== '') && eventName === 'click') {
|
312
|
+
var linkSelected = hasClass(e.target, TABS_JS_LISTLINK) === true ? e.target : findById(parentLink);
|
313
|
+
var parentTabId = searchParent(e.target, TABS_JS);
|
314
|
+
var parentTab = findById(parentTabId);
|
315
|
+
//let $parentListItems = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTITEM));
|
316
|
+
var $parentListLinks = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTLINK));
|
317
|
+
var $parentListContents = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_CONTENT));
|
318
|
+
|
319
|
+
// aria selected false on all links
|
320
|
+
unSelectLinks($parentListLinks);
|
321
|
+
// add aria-hidden on all tabs contents
|
322
|
+
unSelectContents($parentListContents);
|
323
|
+
// add aria selected on selected link + show linked panel
|
324
|
+
selectLink(linkSelected);
|
325
|
+
|
326
|
+
e.preventDefault();
|
327
|
+
}
|
308
328
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
329
|
+
// Key down on tabs
|
330
|
+
if ((hasClass(e.target, TABS_JS_LISTLINK) === true || parentLink !== '') && eventName === 'keydown') {
|
331
|
+
//let linkSelected = hasClass( e.target, TABS_JS_LISTLINK) === true ? e.target : findById( parentLink );
|
332
|
+
var parentTabId = searchParent(e.target, TABS_JS);
|
333
|
+
var parentTab = findById(parentTabId);
|
334
|
+
var $parentListItems = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTITEM));
|
335
|
+
var $parentListLinks = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTLINK));
|
336
|
+
var $parentListContents = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_CONTENT));
|
337
|
+
var firstLink = $parentListItems[0].querySelector('.' + TABS_JS_LISTLINK);
|
338
|
+
var lastLink = $parentListItems[$parentListItems.length - 1].querySelector('.' + TABS_JS_LISTLINK);
|
339
|
+
|
340
|
+
// strike home on a tab => 1st tab
|
341
|
+
if (e.keyCode === 36) {
|
342
|
+
unSelectLinks($parentListLinks);
|
343
|
+
unSelectContents($parentListContents);
|
344
|
+
selectLink(firstLink);
|
318
345
|
|
319
|
-
|
346
|
+
e.preventDefault();
|
347
|
+
}
|
348
|
+
// strike end on a tab => last tab
|
349
|
+
else if (e.keyCode === 35) {
|
320
350
|
unSelectLinks($parentListLinks);
|
321
|
-
// add aria-hidden on all tabs contents
|
322
351
|
unSelectContents($parentListContents);
|
323
|
-
|
324
|
-
selectLink(linkSelected);
|
352
|
+
selectLink(lastLink);
|
325
353
|
|
326
354
|
e.preventDefault();
|
327
355
|
}
|
356
|
+
// strike up or left on the tab => previous tab
|
357
|
+
else if ((e.keyCode === 37 || e.keyCode === 38) && !e.ctrlKey) {
|
358
|
+
if (firstLink.getAttribute(ATTR_SELECTED) === 'true') {
|
359
|
+
unSelectLinks($parentListLinks);
|
360
|
+
unSelectContents($parentListContents);
|
361
|
+
selectLink(lastLink);
|
362
|
+
|
363
|
+
e.preventDefault();
|
364
|
+
} else {
|
365
|
+
selectLinkInList($parentListItems, $parentListLinks, $parentListContents, 'prev');
|
366
|
+
e.preventDefault();
|
367
|
+
}
|
368
|
+
}
|
369
|
+
// strike down or right in the tab => next tab
|
370
|
+
else if ((e.keyCode === 40 || e.keyCode === 39) && !e.ctrlKey) {
|
371
|
+
if (lastLink.getAttribute(ATTR_SELECTED) === 'true') {
|
372
|
+
unSelectLinks($parentListLinks);
|
373
|
+
unSelectContents($parentListContents);
|
374
|
+
selectLink(firstLink);
|
375
|
+
|
376
|
+
e.preventDefault();
|
377
|
+
} else {
|
378
|
+
selectLinkInList($parentListItems, $parentListLinks, $parentListContents, 'next');
|
379
|
+
e.preventDefault();
|
380
|
+
}
|
381
|
+
}
|
382
|
+
}
|
328
383
|
|
329
|
-
|
330
|
-
|
331
|
-
|
384
|
+
// Key down in tab panels
|
385
|
+
var parentTabPanelId = searchParent(e.target, TABS_JS_CONTENT);
|
386
|
+
if (parentTabPanelId !== '' && eventName === 'keydown') {
|
387
|
+
(function () {
|
388
|
+
var linkSelected = findById(findById(parentTabPanelId).getAttribute(ATTR_LABELLEDBY));
|
332
389
|
var parentTabId = searchParent(e.target, TABS_JS);
|
333
390
|
var parentTab = findById(parentTabId);
|
334
391
|
var $parentListItems = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTITEM));
|
@@ -337,130 +394,71 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
337
394
|
var firstLink = $parentListItems[0].querySelector('.' + TABS_JS_LISTLINK);
|
338
395
|
var lastLink = $parentListItems[$parentListItems.length - 1].querySelector('.' + TABS_JS_LISTLINK);
|
339
396
|
|
340
|
-
// strike
|
341
|
-
if (e.keyCode ===
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
397
|
+
// strike up + ctrl => go to header
|
398
|
+
if (e.keyCode === 38 && e.ctrlKey) {
|
399
|
+
setTimeout(function () {
|
400
|
+
linkSelected.focus();
|
401
|
+
}, 0);
|
346
402
|
e.preventDefault();
|
347
403
|
}
|
348
|
-
// strike
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
selectLink(lastLink);
|
353
|
-
|
404
|
+
// strike pageup + ctrl => go to prev header
|
405
|
+
if (e.keyCode === 33 && e.ctrlKey) {
|
406
|
+
// go to header
|
407
|
+
linkSelected.focus();
|
354
408
|
e.preventDefault();
|
355
|
-
|
356
|
-
// strike up or left on the tab => previous tab
|
357
|
-
else if ((e.keyCode === 37 || e.keyCode === 38) && !e.ctrlKey) {
|
409
|
+
// then previous
|
358
410
|
if (firstLink.getAttribute(ATTR_SELECTED) === 'true') {
|
359
411
|
unSelectLinks($parentListLinks);
|
360
412
|
unSelectContents($parentListContents);
|
361
413
|
selectLink(lastLink);
|
362
|
-
|
363
|
-
e.preventDefault();
|
364
414
|
} else {
|
365
415
|
selectLinkInList($parentListItems, $parentListLinks, $parentListContents, 'prev');
|
366
|
-
e.preventDefault();
|
367
416
|
}
|
368
417
|
}
|
369
|
-
// strike
|
370
|
-
|
418
|
+
// strike pagedown + ctrl => go to next header
|
419
|
+
if (e.keyCode === 34 && e.ctrlKey) {
|
420
|
+
// go to header
|
421
|
+
linkSelected.focus();
|
422
|
+
e.preventDefault();
|
423
|
+
// then next
|
371
424
|
if (lastLink.getAttribute(ATTR_SELECTED) === 'true') {
|
372
425
|
unSelectLinks($parentListLinks);
|
373
426
|
unSelectContents($parentListContents);
|
374
427
|
selectLink(firstLink);
|
375
|
-
|
376
|
-
e.preventDefault();
|
377
428
|
} else {
|
378
429
|
selectLinkInList($parentListItems, $parentListLinks, $parentListContents, 'next');
|
379
|
-
e.preventDefault();
|
380
430
|
}
|
381
431
|
}
|
382
|
-
}
|
383
|
-
|
384
|
-
// Key down in tab panels
|
385
|
-
var parentTabPanelId = searchParent(e.target, TABS_JS_CONTENT);
|
386
|
-
if (parentTabPanelId !== '' && eventName === 'keydown') {
|
387
|
-
(function () {
|
388
|
-
var linkSelected = findById(findById(parentTabPanelId).getAttribute(ATTR_LABELLEDBY));
|
389
|
-
var parentTabId = searchParent(e.target, TABS_JS);
|
390
|
-
var parentTab = findById(parentTabId);
|
391
|
-
var $parentListItems = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTITEM));
|
392
|
-
var $parentListLinks = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTLINK));
|
393
|
-
var $parentListContents = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_CONTENT));
|
394
|
-
var firstLink = $parentListItems[0].querySelector('.' + TABS_JS_LISTLINK);
|
395
|
-
var lastLink = $parentListItems[$parentListItems.length - 1].querySelector('.' + TABS_JS_LISTLINK);
|
396
|
-
|
397
|
-
// strike up + ctrl => go to header
|
398
|
-
if (e.keyCode === 38 && e.ctrlKey) {
|
399
|
-
setTimeout(function () {
|
400
|
-
linkSelected.focus();
|
401
|
-
}, 0);
|
402
|
-
e.preventDefault();
|
403
|
-
}
|
404
|
-
// strike pageup + ctrl => go to prev header
|
405
|
-
if (e.keyCode === 33 && e.ctrlKey) {
|
406
|
-
// go to header
|
407
|
-
linkSelected.focus();
|
408
|
-
e.preventDefault();
|
409
|
-
// then previous
|
410
|
-
if (firstLink.getAttribute(ATTR_SELECTED) === 'true') {
|
411
|
-
unSelectLinks($parentListLinks);
|
412
|
-
unSelectContents($parentListContents);
|
413
|
-
selectLink(lastLink);
|
414
|
-
} else {
|
415
|
-
selectLinkInList($parentListItems, $parentListLinks, $parentListContents, 'prev');
|
416
|
-
}
|
417
|
-
}
|
418
|
-
// strike pagedown + ctrl => go to next header
|
419
|
-
if (e.keyCode === 34 && e.ctrlKey) {
|
420
|
-
// go to header
|
421
|
-
linkSelected.focus();
|
422
|
-
e.preventDefault();
|
423
|
-
// then next
|
424
|
-
if (lastLink.getAttribute(ATTR_SELECTED) === 'true') {
|
425
|
-
unSelectLinks($parentListLinks);
|
426
|
-
unSelectContents($parentListContents);
|
427
|
-
selectLink(firstLink);
|
428
|
-
} else {
|
429
|
-
selectLinkInList($parentListItems, $parentListLinks, $parentListContents, 'next');
|
430
|
-
}
|
431
|
-
}
|
432
|
-
})();
|
433
|
-
}
|
434
|
-
|
435
|
-
// click on a tab link
|
436
|
-
var parentLinkToPanelId = searchParent(e.target, TABS_JS_LINK_TO_TAB);
|
437
|
-
if ((hasClass(e.target, TABS_JS_LINK_TO_TAB) === true || parentLinkToPanelId !== '') && eventName === 'click') {
|
438
|
-
var panelSelectedId = hasClass(e.target, TABS_JS_LINK_TO_TAB) === true ? e.target.getAttribute('href').replace('#', '') : findById(parentLinkToPanelId).replace('#', '');
|
439
|
-
var panelSelected = findById(panelSelectedId);
|
440
|
-
var buttonPanelSelected = findById(panelSelected.getAttribute(ATTR_LABELLEDBY));
|
441
|
-
var parentTabId = searchParent(e.target, TABS_JS);
|
442
|
-
var parentTab = findById(parentTabId);
|
443
|
-
//let $parentListItems = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTITEM));
|
444
|
-
var $parentListLinks = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTLINK));
|
445
|
-
var $parentListContents = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_CONTENT));
|
446
|
-
|
447
|
-
unSelectLinks($parentListLinks);
|
448
|
-
unSelectContents($parentListContents);
|
449
|
-
selectLink(buttonPanelSelected);
|
432
|
+
})();
|
433
|
+
}
|
450
434
|
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
435
|
+
// click on a tab link
|
436
|
+
var parentLinkToPanelId = searchParent(e.target, TABS_JS_LINK_TO_TAB);
|
437
|
+
if ((hasClass(e.target, TABS_JS_LINK_TO_TAB) === true || parentLinkToPanelId !== '') && eventName === 'click') {
|
438
|
+
var panelSelectedId = hasClass(e.target, TABS_JS_LINK_TO_TAB) === true ? e.target.getAttribute('href').replace('#', '') : findById(parentLinkToPanelId).replace('#', '');
|
439
|
+
var panelSelected = findById(panelSelectedId);
|
440
|
+
var buttonPanelSelected = findById(panelSelected.getAttribute(ATTR_LABELLEDBY));
|
441
|
+
var parentTabId = searchParent(e.target, TABS_JS);
|
442
|
+
var parentTab = findById(parentTabId);
|
443
|
+
//let $parentListItems = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTITEM));
|
444
|
+
var $parentListLinks = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_LISTLINK));
|
445
|
+
var $parentListContents = [].slice.call(parentTab.querySelectorAll('.' + TABS_JS_CONTENT));
|
446
|
+
|
447
|
+
unSelectLinks($parentListLinks);
|
448
|
+
unSelectContents($parentListContents);
|
449
|
+
selectLink(buttonPanelSelected);
|
450
|
+
|
451
|
+
e.preventDefault();
|
452
|
+
}
|
453
|
+
}, true);
|
454
|
+
});
|
456
455
|
|
457
456
|
var onLoad = function onLoad() {
|
458
457
|
attach();
|
459
|
-
bindListeners();
|
460
458
|
document.removeEventListener('DOMContentLoaded', onLoad);
|
461
459
|
};
|
462
460
|
|
463
461
|
document.addEventListener('DOMContentLoaded', onLoad);
|
464
462
|
|
465
|
-
window.
|
463
|
+
window.sibuVan11yAccessibleTabPanelAria = attach;
|
466
464
|
})(document);
|