Skip to content

Commit

Permalink
Fix incorrect regex syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrozenberg committed Jan 22, 2020
1 parent 2f879c3 commit 311933d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tools/experiments/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,11 @@ function build() {
const rtvInput = document.getElementById('rtv');
const rtvButton = document.getElementById('rtv-submit');
rtvInput.addEventListener('input', () => {
rtvButton.disabled = !(
rtvInput.value == '' || RTV_PATTERN.test(rtvInput.value)
);
rtvButton.textContent = rtvInput.value == '' ? 'opt-out' : 'opt-in';
rtvButton.disabled = rtvInput.value && !RTV_PATTERN.test(rtvInput.value);
rtvButton.textContent = rtvInput.value ? 'opt-in' : 'opt-out';
});
rtvButton.addEventListener('click', () => {
if (rtvInput.value == '') {
if (!rtvInput.value) {
showConfirmation_(
'Do you really want to opt out of RTV?',
setAmpCanaryCookie_.bind(null, AMP_CANARY_COOKIE.DISABLED)
Expand Down Expand Up @@ -388,7 +386,7 @@ function getAmpConfig() {
xhr.send(null);
return promise
.then(text => {
const match = text.match(/self\.AMP_CONFIG=({.+?})/);
const match = text.match(/self\.AMP_CONFIG=(\{.+?\})/);
if (!match) {
throw new Error("Can't find AMP_CONFIG in: " + text);
}
Expand Down

0 comments on commit 311933d

Please sign in to comment.