diff --git a/screenshots/popup.png b/screenshots/popup.png index bd7cfdaff..336bdd22a 100644 Binary files a/screenshots/popup.png and b/screenshots/popup.png differ diff --git a/screenshots/wrong_anwser_button_update.png b/screenshots/wrong_anwser_button_update.png index 86d96c01a..2eaeeeb6f 100644 Binary files a/screenshots/wrong_anwser_button_update.png and b/screenshots/wrong_anwser_button_update.png differ diff --git a/src/pages/Content/index.js b/src/pages/Content/index.js index 56c01ec47..db33ab175 100644 --- a/src/pages/Content/index.js +++ b/src/pages/Content/index.js @@ -4,13 +4,15 @@ import { isToday, isPast } from './../../helper'; printLine('Content Script loaded'); const timeValue = setInterval(function () { - var nodeList = document.querySelectorAll('[data-cy="submit-wrong-result"]'); + var nodeList = document.querySelectorAll('[data-cy="question-detail-main-tabs"]'); if (nodeList.length > 0) { var button = document.createElement('button'); - button.innerHTML = 'Re-do in 3 days'; + button.innerHTML = 'Re-do'; button.id = 'redoButton'; button.type = 'button'; - nodeList[0].appendChild(button); + button.style.height = '40px'; + button.style.width = '80px'; + nodeList[0].children[0].appendChild(button); clearInterval(timeValue); var theButton = document.getElementById('redoButton'); @@ -25,8 +27,6 @@ const timeValue = setInterval(function () { theButton.addEventListener('click', function () { chrome.storage.sync.get('data', function (items) { - printLine('items'); - console.log(items); let redos; if (Object.keys(items).length === 0) { printLine('items is empty'); @@ -51,4 +51,4 @@ const timeValue = setInterval(function () { }); }); } -}, 3000); +}, 1000); diff --git a/src/pages/Popup/Popup.jsx b/src/pages/Popup/Popup.jsx index a112475d5..8c02cd085 100644 --- a/src/pages/Popup/Popup.jsx +++ b/src/pages/Popup/Popup.jsx @@ -96,7 +96,10 @@ class Popup extends Component { render() { const itemsList = this.state.data.map((redo) => { - let displayTitle = redo.uri.slice(0, -13); + const redoURI = redo.uri; + const spliceStart = redoURI.indexOf('problems/') + 'problems/'.length; + const spliceEnd = redoURI.indexOf('/', spliceStart); + let displayTitle = redo.uri.slice(spliceStart, spliceEnd); const lastSlash = displayTitle.lastIndexOf('/'); displayTitle = displayTitle.slice(lastSlash + 1); const today = new Date().toISOString();