1 // Copyright 2013 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.
5 function toggleHelpBox() {
6 var helpBoxOuter = $('help-box-outer');
7 helpBoxOuter.classList.toggle('hidden');
8 var moreLessButton = $('more-less-button');
9 if (helpBoxOuter.classList.contains('hidden')) {
10 moreLessButton.innerText = moreLessButton.moreText;
12 moreLessButton.innerText = moreLessButton.lessText;
16 function diagnoseErrors() {
17 var extensionId = 'idddmepepmjcgiedknnmlbadcokidhoa';
18 var diagnoseFrame = $('diagnose-frame');
19 diagnoseFrame.innerHTML =
20 '<iframe src="chrome-extension://' + extensionId +
21 '/index.html"></iframe>';
24 // Subframes use a different layout but the same html file. This is to make it
25 // easier to support platforms that load the error page via different
26 // mechanisms (Currently just iOS).
27 if (window.top.location != window.location)
28 document.documentElement.setAttribute('subframe', '');
30 // Re-renders the error page using |strings| as the dictionary of values.
31 // Used by NetErrorTabHelper to update DNS error pages with probe results.
32 function updateForDnsProbe(strings) {
33 i18nTemplate.process(document, strings);
34 var context = new JsEvalContext(strings);
35 jstProcess(context, $('t'));
38 // Given the classList property of an element, adds an icon class to the list
39 // and removes the previously-
40 function updateIconClass(classList, newClass) {
43 if (classList.hasOwnProperty('last_icon_class')) {
44 oldClass = classList['last_icon_class'];
45 if (oldClass == newClass)
49 classList.add(newClass);
50 if (oldClass !== undefined)
51 classList.remove(oldClass);
53 classList['last_icon_class'] = newClass;