1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */
9 chrome.storage.onChanged.addListener(function(changes, namespace) {
10 if (changes.addBorder.newValue) {
17 chrome.storage.sync.get("addBorder", function(item) {
23 document.addEventListener('contextmenu', function(element) {
24 updateContextMenuItem(element);
27 document.addEventListener('mouseover', function(element) {
28 updateContextMenuItem(element);
31 document.addEventListener('focus', function(element) {
32 updateContextMenuItem(element);
36 * Sends a message to the backgrond script notifying it to
37 * enable or disable the context menu item.
41 function updateContextMenuItem(element) {
43 var ariaDescribedAt = '';
45 if (element.target.hasAttribute("longdesc")) {
46 longDesc = element.target.getAttribute("longdesc");
47 var link = document.createElement("a");
52 if (element.target.hasAttribute("aria-describedat")) {
53 ariaDescribedAt = element.target.getAttribute("aria-describedat");
56 if (longDesc !== '' || ariaDescribedAt !== '') {
57 chrome.runtime.sendMessage({
58 ariaDescribedAt: ariaDescribedAt,
63 chrome.runtime.sendMessage({
70 * Modify border to make the HTML element more visible.
72 function addBorders() {
73 document.body.setAttribute('showlongdescborders', '');
77 * Revert back to the original border styling.
79 function removeBorders() {
80 document.body.removeAttribute('showlongdescborders', '');