Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion manga-loader.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,18 @@ var extractInfo = function(selector, mod, context) {
case 'a':
if(mod.type === 'index')
return parseInt(elem.textContent);
return elem.href || elem.getAttribute('href');
var href = elem.href || elem.getAttribute('href');
if (!href.startsWith('/') && !href.startsWith('http') && !href.startsWith('#')) {
return /^[^\?\#]*\//.exec(window.location.href) + href;
}
if (href.startsWith('//')) {
return window.location.protocol + href;
}
if (href.startsWith('/')) {
// .host contains the port already
return window.location.protocol + '//' + window.location.host + href;
}
return href;
case 'ul':
return elem.children.length;
case 'select':
Expand Down