From 28c27da914e9d252b2a4cfbdaefd58b62122730f Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 30 Jul 2024 20:56:11 +0100 Subject: [PATCH 1/4] Fix errors with AI question generation --- radioUpdater/assets/js/questions.js | 3 ++- radioUpdater/manifest.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/radioUpdater/assets/js/questions.js b/radioUpdater/assets/js/questions.js index 372c5df..0c1736d 100644 --- a/radioUpdater/assets/js/questions.js +++ b/radioUpdater/assets/js/questions.js @@ -72,7 +72,7 @@ function watchForArticleUpdates() if (relatedArticleList) { let observer = new MutationObserver( function() { document.getElementById('auto-question-button').disabled = relatedArticleList.childElementCount < 1 - document.getElementById('preselected-article-warning').style.display = relatedArticleList.childElementCount < 1 ? 'block' : 'none' +// document.getElementById('preselected-article-warning').style.display = relatedArticleList.childElementCount < 1 ? 'block' : 'none' }) observer.observe(relatedArticleList, { attributes: true, childList: true, attributeOldValue: true }) @@ -109,6 +109,7 @@ function getNewQuestion() { let article = null; if (relatedArticles) { + article = relatedArticles.getElementsByTagName('a')[0].getAttribute("href") article = relatedArticles.getElementsByTagName('a')[0].getAttribute("href").substring(article.lastIndexOf('/') + 1) } else if (articleName) { article = articleName diff --git a/radioUpdater/manifest.json b/radioUpdater/manifest.json index e1d39db..54c9e22 100644 --- a/radioUpdater/manifest.json +++ b/radioUpdater/manifest.json @@ -1,6 +1,6 @@ { "name": "RadioUpdater", - "version": "2.1", + "version": "2.2", "description": "Replace references on Radiopaedia.", "manifest_version": 3, "content_scripts": [ From 2107943586ab254d19b8ba3c3be9c2e1c7fc18fa Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 30 Jul 2024 21:07:04 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Don=E2=80=99t=20show=20Q=20button=20in=20ed?= =?UTF-8?q?it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- radioUpdater/assets/js/articles.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/radioUpdater/assets/js/articles.js b/radioUpdater/assets/js/articles.js index 00ffdae..b59e5f0 100644 --- a/radioUpdater/assets/js/articles.js +++ b/radioUpdater/assets/js/articles.js @@ -2,11 +2,15 @@ const updateArticleView = function (articleName) { let actions = addIdByQuery('div.doi-actions', 'article-actions') - let button = document.createElement('a') - button.classList.add('btn') - button.classList.add('btn-flat') - button.style.marginRight = '2px' - button.innerText = 'Q' - button.href = '/questions/new/?article=' + articleName - actions.prepend(button) + if (actions) { + let button = document.createElement('a') + button.classList.add('btn') + button.classList.add('btn-flat') + button.style.marginRight = '2px' + button.innerText = 'Q' + button.href = '/questions/new/?article=' + articleName + + actions.prepend(button) + } + } \ No newline at end of file From 82475f6329faeb96df55c0875a7ed2959d3d4416 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 30 Jul 2024 21:07:20 +0100 Subject: [PATCH 3/4] Bump version number --- radioUpdater/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radioUpdater/manifest.json b/radioUpdater/manifest.json index 54c9e22..b7736ad 100644 --- a/radioUpdater/manifest.json +++ b/radioUpdater/manifest.json @@ -1,6 +1,6 @@ { "name": "RadioUpdater", - "version": "2.2", + "version": "2.3", "description": "Replace references on Radiopaedia.", "manifest_version": 3, "content_scripts": [ From 7767957691fa6bca202637d71432bbd3fbd68d7a Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 30 Jul 2024 21:22:46 +0100 Subject: [PATCH 4/4] Fix citeitright buttons --- radioUpdater/assets/js/contentScript.js | 8 ++++---- radioUpdater/manifest.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/radioUpdater/assets/js/contentScript.js b/radioUpdater/assets/js/contentScript.js index 998c032..1fde258 100644 --- a/radioUpdater/assets/js/contentScript.js +++ b/radioUpdater/assets/js/contentScript.js @@ -1,12 +1,12 @@ const pathname = window.location.pathname const articleType = pathname.split('/')[1] -const finalPart = pathname.split('/')[2] +const finalPart = pathname.split('/').pop() const isEdit = finalPart === 'edit' || finalPart === 'new' -if (articleType === 'articles') { - updateArticleView(finalPart) -} else if (articleType === 'articles' && isEdit) { +if (articleType === 'articles' && isEdit) { updateArticleEdit() +} else if (articleType === 'articles') { + updateArticleView(finalPart) } else if (articleType === 'cases' && isEdit) { updateCaseEdit() } else if (articleType === 'questions' && isEdit) { diff --git a/radioUpdater/manifest.json b/radioUpdater/manifest.json index b7736ad..8e836f8 100644 --- a/radioUpdater/manifest.json +++ b/radioUpdater/manifest.json @@ -1,6 +1,6 @@ { "name": "RadioUpdater", - "version": "2.3", + "version": "2.4", "description": "Replace references on Radiopaedia.", "manifest_version": 3, "content_scripts": [