var onReady = require('kwf/on-ready');

if (window.devicePixelRatio && window.devicePixelRatio > 1) {
    onReady.onRender('.kwfReplaceImageDpr2', function(el) {
        if (el.get(0).tagName.toLowerCase() == 'img') {
            if (el.get(0).src.indexOf('dpr2') == -1) {
                el.get(0).src = el.get(0).src.replace('/images/', '/images/dpr2/');
            }
        } else {
            var url = el.getStyle('background-image');
            if (url.indexOf('dpr2') == -1) {
                url = url.replace('/images/', '/images/dpr2/');
            }
            el.css('background-image', url);
        }
    });
}

var onReady = require('kwf/on-ready');

if (window.devicePixelRatio && window.devicePixelRatio > 1) {
    onReady.onRender('.kwfReplaceImageDpr2', function(el) {
        if (el.get(0).tagName.toLowerCase() == 'img') {
            el.get(0).src = el.get(0).src.replace('/images/', '/images/dpr2/');
        } else {
            var url = el.getStyle('background-image');
            url = url.replace('/images/', '/images/dpr2/');
            el.css('background-image', url);
        }
    });
}

Revert "Quick fix for wrong image urls in e18 templates"
Revert "Quick fix for wrong image urls in e18 templates"

This reverts commit 2d07bb6ede72f5069d8c297586505ada4bc15eef.

Will be implemented differently in 4.3 with change in html code (which requires
all view cache entries to be deleted)
