OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 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. | |
4 | |
5 // Must match the commands handled by SafeBrowsingBlockingPage::CommandReceived. | |
6 var SB_CMD_SHOW_DIAGNOSTIC = 'showDiagnostic'; | |
Bernhard Bauer
2014/06/09 10:04:02
Sort these alphabetically? It might also make sens
felt
2014/06/09 14:24:09
I sorted them alphabetically. I don't want to rena
| |
7 var SB_CMD_REPORT_ERROR = 'reportError'; | |
8 var SB_CMD_LEARN_MORE = 'learnMore2'; | |
9 var SB_CMD_SHOW_PRIVACY = 'showPrivacy'; | |
10 var SB_CMD_PROCEED = 'proceed'; | |
11 var SB_CMD_GO_BACK = 'takeMeBack'; | |
12 var SB_CMD_DO_REPORT = 'doReport'; | |
13 var SB_CMD_DONT_REPORT = 'dontReport'; | |
14 var SB_CMD_DISPLAY_CHECK = 'displaycheckbox'; | |
15 var SB_CMD_BOX_CHECKED = 'boxchecked'; | |
16 var SB_CMD_EXPANDED_MORE = 'expandedSeeMore'; | |
17 | |
18 function applyMalwareStyle() { | |
19 // Dynamically add the second and third paragraphs. | |
20 var secondParagraph = document.createTextNode( | |
21 loadTimeData.getString('secondParagraph')); | |
22 $('second-paragraph').appendChild(secondParagraph); | |
23 if (!loadTimeData.getBoolean('phishing')) { | |
24 var thirdParagraph = document.createTextNode( | |
25 loadTimeData.getString('thirdParagraph')); | |
26 $('third-paragraph').appendChild(thirdParagraph); | |
27 } | |
28 | |
29 // Add the link to the diagnostic page (malware) or reporting (phishing). | |
30 var detailsText = document.createTextNode( | |
31 loadTimeData.getString('detailsText')); | |
Bernhard Bauer
2014/06/09 10:04:03
Could you put this into the template and hide it i
felt
2014/06/09 14:24:09
If I put it into the template, I get JS console er
Bernhard Bauer
2014/06/09 14:45:41
Hm, set the value to an empty string otherwise?
felt
2014/06/09 15:24:02
Sorry, I just realized that I was thinking of some
| |
32 var detailsLink = document.createElement('a'); | |
33 detailsLink.setAttribute('href', '#'); | |
34 detailsLink.setAttribute('id', 'help-link'); | |
35 detailsLink.appendChild(detailsText); | |
36 $('explanation-paragraph').appendChild(detailsLink); | |
37 | |
38 // Add the link to proceed. | |
39 if (loadTimeData.getBoolean('overridable')) { | |
40 var proceedText = document.createTextNode( | |
41 loadTimeData.getString('proceedText')); | |
42 var proceedLink = document.createElement('a'); | |
43 proceedLink.setAttribute('href', '#'); | |
44 proceedLink.setAttribute('id', 'proceed-link'); | |
45 proceedLink.appendChild(proceedText); | |
46 $('final-paragraph').appendChild(proceedLink); | |
47 } | |
48 | |
49 // Make the background red. | |
50 $('icon').classList.add('icon-malware'); | |
51 $('body').classList.add('body-red'); | |
52 $('primary-button').classList.add('button-red'); | |
53 var links = document.getElementsByTagName('a'); | |
54 for (var i = 0; i < links.length; i++) | |
55 links[i].classList.add('a-red'); | |
56 | |
57 // Remove the 'hidden' class from the paragraphs that we use. | |
58 $('second-paragraph').classList.toggle('hidden'); | |
59 if (!loadTimeData.getBoolean('phishing')) | |
60 $('third-paragraph').classList.toggle('hidden'); | |
61 $('explanation-paragraph').classList.toggle('hidden'); | |
62 $('final-paragraph').classList.toggle('hidden'); | |
63 } | |
OLD | NEW |