Commit cd3acbc1 authored by Kyle Milka's avatar Kyle Milka Committed by Commit Bot

[NTP Cleanup] Clean up some front end code for the Customize button

Remove some unused CLASSES and move the remaining one to the file it's
actually used in. Set the text label via replacements instead of in
javascript.

Bug: None
Change-Id: I72896252332507854930ad2aa6a682f2ff81495d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715108Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Commit-Queue: Kyle Milka <kmilka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680123}
parent 42c7a462
......@@ -104,9 +104,7 @@ customize.IDS = {
EDIT_BG: 'edit-bg',
EDIT_BG_DIALOG: 'edit-bg-dialog',
EDIT_BG_DIVIDER: 'edit-bg-divider',
EDIT_BG_ICON: 'edit-bg-icon',
EDIT_BG_MENU: 'edit-bg-menu',
EDIT_BG_TEXT: 'edit-bg-text',
MENU_BACK_CIRCLE: 'menu-back-circle',
MENU_CANCEL: 'menu-cancel',
MENU_DONE: 'menu-done',
......@@ -142,8 +140,6 @@ customize.CLASSES = {
COLLECTION_TILE: 'bg-sel-tile', // Preview tile for background customization
COLLECTION_TILE_BG: 'bg-sel-tile-bg',
COLLECTION_TITLE: 'bg-sel-tile-title', // Title of a background image
// Extended and elevated style for entry point.
ENTRY_POINT_ENHANCED: 'ep-enhanced',
IMAGE_DIALOG: 'is-img-sel',
ON_IMAGE_MENU: 'on-img-menu',
OPTION: 'bg-option',
......
......@@ -373,7 +373,6 @@ configData.translatedStrings.clickToViewDoodle;
configData.translatedStrings.connectionError;
configData.translatedStrings.connectionErrorNoPeriod;
configData.translatedStrings.copyLink;
configData.translatedStrings.customizeButtonLabel;
configData.translatedStrings.customizeThisPage;
configData.translatedStrings.dailyRefresh;
configData.translatedStrings.defaultWallpapers;
......
......@@ -106,7 +106,7 @@
<div id="edit-bg" tabindex="0" role="button" hidden>
<div id="edit-bg-icon"></div>
<span id="edit-bg-text"></span>
<span id="edit-bg-text">$i18n{customizeButton}</span>
</div>
<a id="custom-bg-attr"></a>
......
......@@ -81,6 +81,8 @@ const CLASSES = {
DARK: 'dark',
DEFAULT_THEME: 'default-theme',
DELAYED_HIDE_NOTIFICATION: 'mv-notice-delayed-hide',
// Extended and elevated style for customization entry point.
ENTRY_POINT_ENHANCED: 'ep-enhanced',
FAKEBOX_FOCUS: 'fakebox-focused', // Applies focus styles to the fakebox
// Applied when the fakebox placeholder text should not be hidden on focus.
SHOW_PLACEHOLDER: 'show-placeholder',
......@@ -430,8 +432,7 @@ function renderTheme() {
$(customize.IDS.EDIT_BG)
.classList.toggle(
customize.CLASSES.ENTRY_POINT_ENHANCED,
!info.customBackgroundConfigured);
CLASSES.ENTRY_POINT_ENHANCED, !info.customBackgroundConfigured);
if (configData.isGooglePage) {
customize.onThemeChange();
......@@ -1140,9 +1141,6 @@ function init() {
}
doodles.init();
$(customize.IDS.EDIT_BG_TEXT).textContent =
configData.translatedStrings.customizeButtonLabel;
} else {
document.body.classList.add(CLASSES.NON_GOOGLE_PAGE);
}
......
......@@ -192,8 +192,6 @@ std::unique_ptr<base::DictionaryValue> GetTranslatedStrings(bool is_google) {
IDS_GOOGLE_SEARCH_BOX_EMPTY_HINT_MD);
// Custom Backgrounds
AddString(translated_strings.get(), "customizeButtonLabel",
IDS_NTP_CUSTOMIZE_BUTTON_LABEL);
AddString(translated_strings.get(), "defaultWallpapers",
IDS_NTP_CUSTOM_BG_CHROME_WALLPAPERS);
AddString(translated_strings.get(), "uploadImage",
......@@ -978,6 +976,8 @@ void LocalNtpSource::StartDataRequest(
replacements["customizeMenu"] =
l10n_util::GetStringUTF8(IDS_NTP_CUSTOM_BG_CUSTOMIZE_NTP_LABEL);
replacements["customizeButton"] =
l10n_util::GetStringUTF8(IDS_NTP_CUSTOMIZE_BUTTON_LABEL);
replacements["cancelButton"] =
l10n_util::GetStringUTF8(IDS_NTP_CUSTOM_BG_CANCEL);
replacements["doneButton"] =
......
......@@ -96,7 +96,7 @@
<div id="edit-bg" tabindex="0" role="button" hidden>
<div id="edit-bg-icon"></div>
<span id="edit-bg-text"></span>
<span id="edit-bg-text">$i18n{customizeButton}</span>
</div>
<a id="custom-bg-attr"></a>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment