Commit 6ce2fa74 authored by François Beaufort's avatar François Beaufort Committed by Commit Bot

[Media Engagement]: Add copy to clipboard button and fixed nits described...

[Media Engagement]: Add copy to clipboard button and fixed nits described below in about:media-engagement

Nits:
- "Visits" have been renamed to "Sessions"
- "Playbacks" have been updated to "Playbacks per session"
- Rows text will never wrap to the next line.

Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ia8892d1ef7ca9a64e196b569d623d03724392706
Reviewed-on: https://chromium-review.googlesource.com/886706Reviewed-by: default avatarMounir Lamouri (slow) <mlamouri@chromium.org>
Commit-Queue: Mounir Lamouri (slow) <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532843}
parent f9ab8a67
......@@ -18,6 +18,10 @@
font-size: 14px;
}
button {
margin-bottom: 20px;
}
table {
border-collapse: collapse;
margin-bottom: 20px;
......@@ -50,7 +54,6 @@
.origin-cell {
background-color: rgba(230, 230, 230, 0.5);
min-width: 500px;
}
.visits-count-cell,
......@@ -60,6 +63,7 @@
.significant-playbacks-count-cell {
background-color: rgba(230, 230, 230, 0.5);
text-align: right;
white-space: nowrap;
}
.base-score-input {
......@@ -96,6 +100,7 @@
</head>
<body>
<h1>Media Engagement</h1>
<button id="copy-all-to-clipboard">Copy all to clipboard</button>
<table>
<thead>
<tr id="config-table-header">
......@@ -117,10 +122,10 @@
Origin
</th>
<th sort-key="visits" sort-reverse>
Visits
Sessions
</th>
<th sort-key="mediaPlaybacks" sort-reverse>
Playbacks
Playbacks per session
</th>
<th sort-key="audiblePlaybacks" sort-reverse>
Audible Playbacks*
......
......@@ -108,7 +108,7 @@ function renderConfigTable(config) {
configTableBody.innerHTML = '';
configTableBody.appendChild(
createConfigRow('Min Visits', config.scoreMinVisits));
createConfigRow('Min Sessions', config.scoreMinVisits));
configTableBody.appendChild(
createConfigRow('Lower Threshold', config.highScoreLowerThreshold));
configTableBody.appendChild(
......@@ -173,5 +173,18 @@ document.addEventListener('DOMContentLoaded', function() {
renderTable();
});
}
// Add handler to 'copy all to clipboard' button
var copyAllToClipboardButton = $('copy-all-to-clipboard');
copyAllToClipboardButton.addEventListener('click', (e) => {
// Make sure nothing is selected
window.getSelection().removeAllRanges();
document.execCommand('selectAll');
document.execCommand('copy');
// And deselect everything at the end.
window.getSelection().removeAllRanges();
});
});
})();
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