Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: components/dom_distiller/content/resources/dom_distiller_viewer.js

Issue 430473007: Font Family Preferences for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: styling Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function addToPage(html) { 5 function addToPage(html) {
6 var div = document.createElement('div'); 6 var div = document.createElement('div');
7 div.innerHTML = html; 7 div.innerHTML = html;
8 document.getElementById('content').appendChild(div); 8 document.getElementById('content').appendChild(div);
9 } 9 }
10 10
11 function showLoadingIndicator(isLastPage) { 11 function showLoadingIndicator(isLastPage) {
12 document.getElementById('loadingIndicator').className = 12 document.getElementById('loadingIndicator').className =
13 isLastPage ? 'hidden' : 'visible'; 13 isLastPage ? 'hidden' : 'visible';
14 } 14 }
15 15
16 // Maps JS Font Family to CSS class and then changes body class name.
17 // CSS classes must agree with distilledpage.css.
18 function useFontFamily(fontFamily) {
19 var cssClass;
20 if (fontFamily == "serif") {
21 cssClass = "serif";
22 } else if (fontFamily == "monospace") {
23 cssClass = "monospace";
24 } else {
25 cssClass = "sans-serif";
26 }
27 // Relies on the classname order of the body being Theme class, then Font
Yaron 2014/08/13 01:58:47 Hrmm. This seems a little fragile (this is a share
nyquist 2014/08/13 05:44:31 I was discussing this offline with sunangel@ befor
Yaron 2014/08/13 16:49:29 Agreed that the latter approach is better but what
28 // Family class.
29 var themeClass = document.body.className.split(" ")[0];
30 cssClass = themeClass + " " + cssClass;
Yaron 2014/08/13 01:58:47 No need for intermediate assignment. Just do it be
sunangel 2014/08/13 18:09:04 Done.
31 document.body.className = cssClass;
32 }
33
16 // Maps JS theme to CSS class and then changes body class name. 34 // Maps JS theme to CSS class and then changes body class name.
17 // CSS classes must agree with distilledpage.css. 35 // CSS classes must agree with distilledpage.css.
18 function useTheme(theme) { 36 function useTheme(theme) {
19 var cssClass; 37 var cssClass;
20 if (theme == "sepia") { 38 if (theme == "sepia") {
21 cssClass = "sepia"; 39 cssClass = "sepia";
22 } else if (theme == "dark") { 40 } else if (theme == "dark") {
23 cssClass = "dark"; 41 cssClass = "dark";
24 } else { 42 } else {
25 cssClass = "light"; 43 cssClass = "light";
26 } 44 }
45 // Relies on the classname order of the body being Theme class, then Font
46 // Family class.
47 var fontFamilyClass = document.body.className.split(" ")[1];
48 cssClass = cssClass + " " + fontFamilyClass;
27 document.body.className = cssClass; 49 document.body.className = cssClass;
28 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698