Commit ca0c93fe authored by Wei Li's avatar Wei Li Committed by Commit Bot

[HaTS] Skip 'thank you' page of the survey

The 'thank you' page looks a bit out of style. So we skip showing
it and directly close the window.

BUG=979530

Change-Id: Ic55c83fd15a8359d2d975dbf7bb098b4fa9a820a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1776932Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Wei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692086}
parent 206d0eb2
<html>
<head>
<style>
/**
* The style used to draw done-button.
* Use z-index to make sure the button is in front of the survey content.
* TODO(weili): we need to make it RTL friendly if we need to support RTL.
*/
.done-button {
bottom: 17px;
color: rgb(33, 150, 243);
display: block;
font: 400 16px Roboto,RobotoDraft,Helvetica,sans-serif;
position: fixed;
right: 25px;
text-transform: uppercase;
z-index: 10;
}
#id-done-button[hidden] {
display: none;
}
</style>
<script>
/**
* Handles the callback when the survey is submitted or when the survey
* Close the window when the survey is submitted or when the survey
* has already been submitted in the past.
* @param {boolean} isFirstRun Will be true when the user just earned
* access to the content and false if the user had already had access
......@@ -34,11 +13,7 @@
return;
}
/* Display the done button at the end of the survey. */
document.getElementById('id-done-button').hidden = false;
/* Auto dismiss after two seconds. */
setTimeout(function(){ window.close(); }, 2000);
window.close();
};
/**
......@@ -50,20 +25,9 @@
for (const element of elements)
element.style.display = 'none';
}
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('id-link-done-button').onclick = function() {
window.close();
}
})
</script>
<script src="$SCRIPT_SRC"></script>
</head>
<body>
<a id="id-link-done-button" href="#" role="button">
<div id="id-done-button" class="done-button" hidden>
$DONE_BUTTON_LABEL
</div>
</a>
</body>
</html>
......@@ -34,7 +34,6 @@ const int kDefaultHatsDialogHeight = 440;
// Placeholder strings in html file to be replaced when the file is loaded.
constexpr char kScriptSrcReplacementToken[] = "$SCRIPT_SRC";
constexpr char kDoneButtonLabelReplacementToken[] = "$DONE_BUTTON_LABEL";
// Base URL to fetch the Google consumer survey script.
constexpr char kBaseFormatUrl[] =
......@@ -60,11 +59,6 @@ std::string LoadLocalHtmlAsString(const std::string& site_id,
base::StringPrintf(kBaseFormatUrl, site_id.c_str(),
site_context.c_str()));
pos = html_data.find(kDoneButtonLabelReplacementToken);
DCHECK(pos != std::string::npos);
html_data.replace(pos, strlen(kDoneButtonLabelReplacementToken),
l10n_util::GetStringUTF8(IDS_DONE));
return html_data;
}
......
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