// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var mode;
var enabled = false;
var scheme = '';
var timeoutId = null;
var filterMap = {
'0': 'url("#hc_extension_off")',
'1': 'url("#hc_extension_highcontrast")',
'2': 'url("#hc_extension_grayscale")',
'3': 'url("#hc_extension_invert")',
'4': 'url("#hc_extension_invert_grayscale")',
'5': 'url("#hc_extension_yellow_on_black")'
};
var svgContent = '';
var cssTemplate = 'html[hc="a0"] { -webkit-filter: url("#hc_extension_off"); } html[hcx="0"] img[src*="jpg"], html[hcx="0"] img[src*="jpeg"], html[hcx="0"] svg image, html[hcx="0"] img.rg_i, html[hcx="0"] embed, html[hcx="0"] object, html[hcx="0"] video { -webkit-filter: url("#hc_extension_off"); } html[hc="a1"] { -webkit-filter: url("#hc_extension_highcontrast"); } html[hcx="1"] img[src*="jpg"], html[hcx="1"] img[src*="jpeg"], html[hcx="1"] img.rg_i, html[hcx="1"] svg image, html[hcx="1"] embed, html[hcx="1"] object, html[hcx="1"] video { -webkit-filter: url("#hc_extension_highcontrast_back"); } html[hc="a2"] { -webkit-filter: url("#hc_extension_grayscale"); } html[hcx="2"] img[src*="jpg"], html[hcx="2"] img[src*="jpeg"], html[hcx="2"] img.rg_i, html[hcx="2"] svg image, html[hcx="2"] embed, html[hcx="2"] object, html[hcx="2"] video { -webkit-filter: url("#hc_extension_grayscale_back"); } html[hc="a3"] { -webkit-filter: url("#hc_extension_invert"); } html[hcx="3"] img[src*="jpg"], html[hcx="3"] img[src*="jpeg"], html[hcx="3"] img.rg_i, html[hcx="3"] svg image, html[hcx="3"] embed, html[hcx="3"] object, html[hcx="3"] video { -webkit-filter: url("#hc_extension_invert_back"); } html[hc="a4"] { -webkit-filter: url("#hc_extension_invert_grayscale"); } html[hcx="4"] img[src*="jpg"], html[hcx="4"] img[src*="jpeg"], html[hcx="4"] img.rg_i, html[hcx="4"] svg image, html[hcx="4"] embed, html[hcx="4"] object, html[hcx="4"] video { -webkit-filter: url("#hc_extension_invert_back"); } html[hc="a5"] { -webkit-filter: url("#hc_extension_yellow_on_black"); } html[hcx="5"] img[src*="jpg"], html[hcx="5"] img[src*="jpeg"], html[hcx="5"] img.rg_i, html[hcx="5"] svg image, html[hcx="5"] embed, html[hcx="5"] object, html[hcx="5"] video { -webkit-filter: url("#hc_extension_yellow_on_black_back"); }';
/**
* Add the elements to the pgae that make high-contrast adjustments possible.
*/
function addOrUpdateExtraElements() {
if (!enabled)
return;
// We used to include the CSS, but that doesn't work when the document
// uses the element to set a relative url. So instead we
// add a