I use retinaJS on my site to serve @2x images on retina devices.
I would also like to be able to use jQuery to server @2x images on none retina - large screen desktop de
This should do it, regardless of the extension length, so long as the .xxx is the final part of the image URL:
.xxx
$('.bodycontent img').prop('src', function(_, src) { src = src.replace(/@2x\./, '.'); // strip if it's already there return src.replace(/(\.\w+$)/, '@2x$1'); });