Skip to content

Commit

Permalink
Merge branch 'release/fixed'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy committed Jul 30, 2024
2 parents 661be9d + 7767957 commit 0a1822c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
18 changes: 11 additions & 7 deletions radioUpdater/assets/js/articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

}
8 changes: 4 additions & 4 deletions radioUpdater/assets/js/contentScript.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion radioUpdater/assets/js/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion radioUpdater/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "RadioUpdater",
"version": "2.1",
"version": "2.4",
"description": "Replace references on Radiopaedia.",
"manifest_version": 3,
"content_scripts": [
Expand Down

0 comments on commit 0a1822c

Please sign in to comment.