Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. retina = window.devicePixelRatio > 1
  2. images = document.querySelectorAll('img')
  3.  
  4. if retina
  5. search_file_format = (file) ->
  6. file_match = file.match(/(.+?)(\.\b\w{1,4}$)/)
  7. if file_match
  8. file_match[1] + "@2X" + file_match[2]
  9.  
  10. [].forEach.call images, (image) ->
  11. image.src = search_file_format(image.src)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement