a11y-outline

web extension to navigate document outlines easily
git clone https://git.ce9e.org/a11y-outline.git

commit
9aa74f644da7efdb711ee130f4c3f3c9e9a37652
parent
963c4585cf71ef984b10de2c745f1dad4a619167
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-07-17 22:10
inject CSS the same way as JS

Diffstat

M bg.js 2 ++
M manifest.json 3 ---
M outline.js 11 ++---------

3 files changed, 4 insertions, 12 deletions


diff --git a/bg.js b/bg.js

@@ -11,12 +11,14 @@ var wrap = function(fn) {
   11    11 };
   12    12 
   13    13 var executeScript = wrap(chrome.tabs.executeScript);
   -1    14 var insertCSS = wrap(chrome.tabs.insertCSS);
   14    15 
   15    16 var injectCode = function() {
   16    17 	return Promise.all([
   17    18 		executeScript({file: '/vendor/aria.js'}),
   18    19 		executeScript({file: '/treeview.js'}),
   19    20 		executeScript({file: '/outline.js'}),
   -1    21 		insertCSS({file: '/outline.css'}),
   20    22 	]);
   21    23 };
   22    24 

diff --git a/manifest.json b/manifest.json

@@ -16,9 +16,6 @@
   16    16     "scripts": ["bg.js"],
   17    17     "persistent": false
   18    18   },
   19    -1   "web_accessible_resources": [
   20    -1     "outline.css"
   21    -1   ],
   22    19   "commands": {
   23    20     "_execute_browser_action": {
   24    21       "suggested_key": {

diff --git a/outline.js b/outline.js

@@ -1,4 +1,4 @@
    1    -1 /* global chrome, aria, treeview, updateTree */
   -1     1 /* global aria, treeview, updateTree */
    2     2 
    3     3 var DIALOG_ID = 'a11y-outline';
    4     4 
@@ -177,15 +177,8 @@ var quickNav = function() {
  177   177 	close.tabIndex = -1;
  178   178 	header.appendChild(close);
  179   179 
  180    -1 	var style = document.createElement('link');
  181    -1 	style.rel = 'stylesheet';
  182    -1 	style.href = chrome.runtime.getURL('outline.css');
  183    -1 	dialog.appendChild(style);
  184    -1 
  185   180 	updateVisiblePane(select, dialog);
  186    -1 	style.addEventListener('load', () => {
  187    -1 		dialog.showModal();
  188    -1 	});
   -1   181 	dialog.showModal();
  189   182 };
  190   183 
  191   184 var _walk = function(root, fn) {