forked from tanner/qotnews
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
449 B
14 lines
449 B
(function () { |
|
const { host, protocol } = window.location; |
|
const url = `${protocol}//${host}`; |
|
[ |
|
['[src^="/"]', 'src'], |
|
['[href^="/"]', 'href'] |
|
].forEach(([selector, attribute]) => { |
|
Array.from(document.querySelectorAll(selector)) |
|
.filter(e => e.attributes[attribute] && /^\/[^\/]/.test(e.attributes[attribute].value)) |
|
.forEach((e) => { |
|
e.attributes[attribute].value = `${url}${e.attributes[attribute].value}`; |
|
}); |
|
}); |
|
})();
|
|
|