summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfserb <fserb@chromium.org>2015-07-09 13:00:41 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-09 20:01:17 +0000
commit7c6e8a588f40da24554f1fd37f0038fd6101654d (patch)
treef60777bf919af9f7f8dd7a7fbea1c7fca632505c
parentc8d25d35ac0302a45cc551a67efa4c5afa3846b7 (diff)
downloadchromium_src-7c6e8a588f40da24554f1fd37f0038fd6101654d.zip
chromium_src-7c6e8a588f40da24554f1fd37f0038fd6101654d.tar.gz
chromium_src-7c6e8a588f40da24554f1fd37f0038fd6101654d.tar.bz2
Remove JS includes from local-ntp.js
BUG=508617 Review URL: https://codereview.chromium.org/1230003002 Cr-Commit-Position: refs/heads/master@{#338122}
-rw-r--r--chrome/browser/browser_resources.grd1
-rw-r--r--chrome/browser/resources/local_ntp/local_ntp.js92
-rw-r--r--chrome/browser/resources/local_ntp/local_ntp_design.js90
3 files changed, 89 insertions, 94 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 18f693b..c2f4ced 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -193,7 +193,6 @@
<include name="IDR_LOCAL_NTP_CSS" file="resources\local_ntp\local_ntp.css" type="BINDATA" />
<include name="IDR_LOCAL_NTP_JS" file="resources\local_ntp\local_ntp.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_LOCAL_NTP_UTIL_JS" file="resources\local_ntp\local_ntp_util.js" flattenhtml="true" type="BINDATA" />
- <include name="IDR_LOCAL_NTP_DESIGN_JS" file="resources\local_ntp\local_ntp_design.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_LOCAL_STATE_HTML" file="resources\local_state\local_state.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_LOCAL_STATE_JS" file="resources\local_state\local_state.js" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_MOST_VISITED_IFRAME_CSS" file="resources\local_ntp\most_visited_iframe.css" type="BINDATA" />
diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js
index 42c646d..3d18ed3 100644
--- a/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -13,10 +13,96 @@
* @return {Object} A limited interface for testing the local NTP.
*/
function LocalNTP() {
- 'use strict';
+'use strict';
+
+
+/**
+ * Alias for document.getElementById.
+ * @param {string} id The ID of the element to find.
+ * @return {HTMLElement} The found element or null if not found.
+ */
+function $(id) {
+ return document.getElementById(id);
+}
+
+
+/**
+ * Specifications for an NTP design (not comprehensive).
+ *
+ * fakeboxWingSize: Extra distance for fakebox to extend beyond beyond the list
+ * of tiles.
+ * fontFamily: Font family to use for title and thumbnail iframes.
+ * fontSize: Font size to use for the iframes, in px.
+ * mainClass: Class applied to #ntp-contents to control CSS.
+ * numTitleLines: Number of lines to display in titles.
+ * showFavicon: Whether to show favicon.
+ * thumbnailTextColor: The 4-component color that thumbnail iframe may use to
+ * display text message in place of missing thumbnail.
+ * thumbnailFallback: (Optional) A value in THUMBNAIL_FALLBACK to specify the
+ * thumbnail fallback strategy. If unassigned, then the thumbnail.html
+ * iframe would handle the fallback.
+ * tileWidth: The width of each suggestion tile, in px.
+ * tileMargin: Spacing between successive tiles, in px.
+ * titleColor: The 4-component color of title text.
+ * titleColorAgainstDark: The 4-component color of title text against a dark
+ * theme.
+ * titleTextAlign: (Optional) The alignment of title text. If unspecified, the
+ * default value is 'center'.
+ * titleTextFade: (Optional) The number of pixels beyond which title
+ * text begins to fade. This overrides the default ellipsis style.
+ *
+ * @type {{
+ * fakeboxWingSize: number,
+ * fontFamily: string,
+ * fontSize: number,
+ * mainClass: string,
+ * numTitleLines: number,
+ * showFavicon: boolean,
+ * thumbnailTextColor: string,
+ * thumbnailFallback: string|null|undefined,
+ * tileWidth: number,
+ * tileMargin: number,
+ * titleColor: string,
+ * titleColorAgainstDark: string,
+ * titleTextAlign: string|null|undefined,
+ * titleTextFade: number|null|undefined
+ * }}
+ */
+var NTP_DESIGN = {
+ fakeboxWingSize: 0,
+ fontFamily: 'arial, sans-serif',
+ fontSize: 12,
+ mainClass: 'thumb-ntp',
+ numTitleLines: 1,
+ showFavicon: true,
+ thumbnailTextColor: [50, 50, 50, 255],
+ thumbnailFallback: 'dot', // Draw single dot.
+ tileWidth: 156,
+ tileMargin: 16,
+ titleColor: [50, 50, 50, 255],
+ titleColorAgainstDark: [210, 210, 210, 255],
+ titleTextAlign: 'inherit',
+ titleTextFade: 122 - 36 // 112px wide title with 32 pixel fade at end.
+};
+
+
+/**
+ * Modifies NTP_DESIGN parameters for icon NTP.
+ */
+function modifyNtpDesignForIcons() {
+ NTP_DESIGN.fakeboxWingSize = 132;
+ NTP_DESIGN.mainClass = 'icon-ntp';
+ NTP_DESIGN.numTitleLines = 2;
+ NTP_DESIGN.showFavicon = false;
+ NTP_DESIGN.thumbnailFallback = null;
+ NTP_DESIGN.tileWidth = 48 + 2 * 18;
+ NTP_DESIGN.tileMargin = 60 - 18 * 2;
+ NTP_DESIGN.titleColor = [120, 120, 120, 255];
+ NTP_DESIGN.titleColorAgainstDark = [210, 210, 210, 255];
+ NTP_DESIGN.titleTextAlign = 'center';
+ delete NTP_DESIGN.titleTextFade;
+}
-<include src="../../../../ui/webui/resources/js/util.js">
-<include src="local_ntp_design.js">
/**
* Enum for classnames.
diff --git a/chrome/browser/resources/local_ntp/local_ntp_design.js b/chrome/browser/resources/local_ntp/local_ntp_design.js
deleted file mode 100644
index 5c0bb02..0000000
--- a/chrome/browser/resources/local_ntp/local_ntp_design.js
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 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.
-
-
-/**
- * @fileoverview Specifications for NTP design.
- */
-
- var THUMBNAIL_FALLBACK = {
- DOT: 'dot' // Draw single dot.
- };
-
-
-/**
- * Specifications for an NTP design (not comprehensive).
- *
- * fakeboxWingSize: Extra distance for fakebox to extend beyond beyond the list
- * of tiles.
- * fontFamily: Font family to use for title and thumbnail iframes.
- * fontSize: Font size to use for the iframes, in px.
- * mainClass: Class applied to #ntp-contents to control CSS.
- * numTitleLines: Number of lines to display in titles.
- * showFavicon: Whether to show favicon.
- * thumbnailTextColor: The 4-component color that thumbnail iframe may use to
- * display text message in place of missing thumbnail.
- * thumbnailFallback: (Optional) A value in THUMBNAIL_FALLBACK to specify the
- * thumbnail fallback strategy. If unassigned, then the thumbnail.html
- * iframe would handle the fallback.
- * tileWidth: The width of each suggestion tile, in px.
- * tileMargin: Spacing between successive tiles, in px.
- * titleColor: The 4-component color of title text.
- * titleColorAgainstDark: The 4-component color of title text against a dark
- * theme.
- * titleTextAlign: (Optional) The alignment of title text. If unspecified, the
- * default value is 'center'.
- * titleTextFade: (Optional) The number of pixels beyond which title
- * text begins to fade. This overrides the default ellipsis style.
- *
- * @const {{
- * fakeboxWingSize: number,
- * fontFamily: string,
- * fontSize: number,
- * mainClass: string,
- * numTitleLines: number,
- * showFavicon: boolean,
- * thumbnailTextColor: string,
- * thumbnailFallback: string|null|undefined,
- * tileWidth: number,
- * tileMargin: number,
- * titleColor: string,
- * titleColorAgainstDark: string,
- * titleTextAlign: string|null|undefined,
- * titleTextFade: number|null|undefined
- * }}
- */
-var NTP_DESIGN = {
- fakeboxWingSize: 0,
- fontFamily: 'arial, sans-serif',
- fontSize: 12,
- mainClass: 'thumb-ntp',
- numTitleLines: 1,
- showFavicon: true,
- thumbnailTextColor: [50, 50, 50, 255],
- thumbnailFallback: THUMBNAIL_FALLBACK.DOT,
- tileWidth: 156,
- tileMargin: 16,
- titleColor: [50, 50, 50, 255],
- titleColorAgainstDark: [210, 210, 210, 255],
- titleTextAlign: 'inherit',
- titleTextFade: 122 - 36 // 112px wide title with 32 pixel fade at end.
-};
-
-
-/**
- * Modifies NTP_DESIGN parameters for icon NTP.
- */
-function modifyNtpDesignForIcons() {
- NTP_DESIGN.fakeboxWingSize = 132;
- NTP_DESIGN.mainClass = 'icon-ntp';
- NTP_DESIGN.numTitleLines = 2;
- NTP_DESIGN.showFavicon = false;
- NTP_DESIGN.thumbnailFallback = null;
- NTP_DESIGN.tileWidth = 48 + 2 * 18;
- NTP_DESIGN.tileMargin = 60 - 18 * 2;
- NTP_DESIGN.titleColor = [120, 120, 120, 255];
- NTP_DESIGN.titleColorAgainstDark = [210, 210, 210, 255];
- NTP_DESIGN.titleTextAlign = 'center';
- delete NTP_DESIGN.titleTextFade;
-}