Fix unwanted GET {0} requests

Because of image prefetch of browsers the <img src="{0}"> templates cause
unwanted /{0} requests to the webserver. Templates are changed to use a
data-src attribute.
This commit is contained in:
Olaf Conradi 2014-05-02 02:32:52 +02:00
parent 4c9f5031eb
commit 32a34f76df
2 changed files with 7 additions and 2 deletions

View File

@ -263,6 +263,11 @@ ACL.prototype.populate = function(data){
//console.log(html);
that.list_content.append(html);
});
$("#acl-list-content .acl-list-item img[data-src]").each(function(i, el){
// Replace data-src attribute with src attribute for every image
$(el).attr('src', $(el).data("src"));
$(el).removeAttr("data-src");
});
that.update_view();
}

View File

@ -15,7 +15,7 @@
<span id="acl-fields"></span>
</div>
<div class="acl-list-item" rel="acl-template" style="display:none">
<img src="{0}"><p>{1}</p>
<img data-src="{0}"><p>{1}</p>
<button class="acl-button-hide btn btn-xs btn-default"><i class="icon-remove"></i> {{$hide}}</button>
<button class="acl-button-show btn btn-xs btn-default"><i class="icon-ok"></i> {{$show}}</button>
</div>