Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function replace_unsplash_urls() {
  2. var width = 1500;
  3. var height = 600;
  4.  
  5. var links = document.querySelectorAll('#gridMulti a');
  6. for(var i = 0; i < links.length; i++) {
  7. var item = links.item(i);
  8. var url = links.item(i).style.getPropertyValue('background-image');
  9. if (url) {
  10. url = url.slice(4, -1);
  11. url = url.replace(/(w=).*?(&)/,'$1' + width + '$2');
  12. url = url.replace(/(h=).*?(&)/,'$1' + height + '$2');
  13. item.href = url;
  14. }
  15. }
  16. }
  17. replace_unsplash_urls();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement