Skip to content

Commit 6da1e48

Browse files
committed
main: use window.location.hash for article IDs
1 parent b3d2926 commit 6da1e48

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/main.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const splitPathname = window.location.pathname.split('/');
1414
const isArticle = splitPathname[splitPathname.length - 1] === 'articles';
1515
const labelArticles = {};
1616
const userLinkDiv = document.getElementById('userLinkContainer');
17-
let hash = splitPathname.pop();
17+
let hash = window.location.hash;
1818
let pathname = splitPathname.join('/');
1919
let current;
2020
let articles;
@@ -123,7 +123,7 @@ function updateState() {
123123
const articleTitle = articleDiv.childNodes[0].firstChild.innerHTML;
124124
const feedTitle = articleDiv.childNodes[1].firstChild.innerHTML;
125125
document.title = `${articleTitle} - ${feedTitle} (feedreader.co)`;
126-
history.replaceState({ id: current.id }, '', `https://${window.location.hostname}${pathname}${current.id}`);
126+
history.replaceState({ id: current.id }, '', `https://${window.location.hostname}${pathname}#${current.id}`);
127127
if (token) {
128128
console.log(`Marking ${id} as read`);
129129
lib.user.labels.post('read', id).then(() => {
@@ -137,11 +137,6 @@ function updateState() {
137137

138138
pathname = `${pathname}/`;
139139

140-
if ((hash.length !== 32) && (hash.length !== 40)) {
141-
pathname = `${pathname}${hash}/`;
142-
hash = '';
143-
}
144-
145140
window.onscroll = updateState;
146141

147142
if (!user) {

0 commit comments

Comments
 (0)