Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function replace_unsplash_urls() {
- var width = 1500;
- var height = 600;
- var links = document.querySelectorAll('#gridMulti a');
- for(var i = 0; i < links.length; i++) {
- var item = links.item(i);
- var url = links.item(i).style.getPropertyValue('background-image');
- if (url) {
- url = url.slice(4, -1);
- url = url.replace(/(w=).*?(&)/,'$1' + width + '$2');
- url = url.replace(/(h=).*?(&)/,'$1' + height + '$2');
- item.href = url;
- }
- }
- }
- replace_unsplash_urls();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement