Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Foreign Affairs update front-end. #3407

Merged
merged 9 commits into from
Jan 21, 2025
Prev Previous commit
Next Next commit
fix: Improve detection robustness.
Wenzhi-Ding committed Jan 10, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 593ea52172a9830920e575537df5204d3ca0a1e3
22 changes: 15 additions & 7 deletions Foreign Affairs.js
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2025-01-08 12:21:03"
"lastUpdated": "2025-01-10 07:28:35"
}

/*
@@ -50,14 +50,16 @@
var items = {};
var found = false;

let isIssues = /^https:\/\/[^/]+\/issues\/.+/.test(doc.location.href);
let isSearch = /^https:\/\/[^/]+\/search\/.+/.test(doc.location.href);
// let isIssues = /^https:\/\/[^/]+\/issues\/.+/.test(doc.location.href);
let isIssues = /^\/issues\/.+/.test(doc.location.pathname);
// let isSearch = /^https:\/\/[^/]+\/search\/.+/.test(doc.location.href);
let isSearch = /^\/search\/.+/.test(doc.location.pathname);

let rows = [];
if (isIssues) {
rows = doc.querySelectorAll('h3 > a');
}
if (isSearch) {
else if (isSearch) {
rows = doc.querySelectorAll('h2 > a');
}

@@ -92,8 +94,9 @@
if (issueNode) {
var volumeTitle = ZU.trimInternal(issueNode.textContent.trim());
if (volumeTitle) {
if (!item.extra) item.extra = "";
item.extra += `\nVolume Title: ${volumeTitle}`;
// if (!item.extra) item.extra = "";
// item.extra += `\nVolume Title: ${volumeTitle}`;
item.setExtra('Volume Title', volumeTitle);
}

let issueMatch = issueNode.parentNode.href.match(/\/issues\/\d+\/(\d+)\/(\d+)$/);
@@ -117,7 +120,12 @@
item.creators.push(ZU.cleanAuthor(aut, "author"));
}

var tags = doc.querySelectorAll('.mr-15');
// var tags = doc.querySelectorAll('.mr-15');
var tags = doc.querySelectorAll(
'a[href^="/regions/"].text-decoration-none, ' +

Check failure on line 125 in Foreign Affairs.js

GitHub Actions / Lint, Check, Test

'+' should be placed at the beginning of the line
'a[href^="/topics/"].text-decoration-none, ' +

Check failure on line 126 in Foreign Affairs.js

GitHub Actions / Lint, Check, Test

'+' should be placed at the beginning of the line
'a[href^="/tags/"].text-decoration-none'
);

Check failure on line 128 in Foreign Affairs.js

GitHub Actions / Lint, Check, Test

Expected indentation of 1 tab but found 2
for (let tag of tags) {
item.tags.push(tag.textContent);
}