forked from jdan/tota11y
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
43 lines (34 loc) · 1.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* The entry point for tota11y.
*
* Builds and mounts the toolbar.
*/
// Require the base tota11y styles right away so they can be overwritten
require("./less/tota11y.less");
var $ = require("jquery");
var plugins = require("./plugins");
var toolbarTemplate = require("./templates/toolbar.handlebars");
// Chrome Accessibility Developer Tools - required once as a global
require("script!./node_modules/accessibility-developer-tools/dist/js/axs_testing.js");
class Toolbar {
appendTo($el) {
var $toolbar = $(toolbarTemplate());
$el.append($toolbar);
$toolbar.find(".tota11y-toolbar-toggle").click((e) => {
e.preventDefault();
e.stopPropagation();
$toolbar.toggleClass("tota11y-expanded");
});
// Attach each plugin
var $pluginsContainer = $toolbar.find(".tota11y-plugins");
plugins.forEach((plugin) => {
// Mount the plugin to the list
plugin.appendTo($pluginsContainer);
});
}
}
$(function() {
var bar = new Toolbar();
// TODO: Make this customizable
bar.appendTo($("body"));
});