From: Olaf Conradi Date: Sat, 29 Dec 2012 22:44:26 +0000 (+0100) Subject: Keep html in template, use data attribute for img X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=94c8d7693fd43b75018dcab866affd7606a56a9c;p=friendica.git Keep html in template, use data attribute for img Revert previous changes to fix browser preloading a template variable as image. Images use a data attribute within templates as src. Javascript will substitute them. --- diff --git a/js/acl.js b/js/acl.js index 4f43252847..36cf74970f 100644 --- a/js/acl.js +++ b/js/acl.js @@ -247,12 +247,17 @@ ACL.prototype.populate = function(data){ var height = Math.ceil(data.tot / that.nw) * 42; that.list_content.height(height); $(data.items).each(function(){ - html = "

{1}

"+that.item_tpl+"
"; - html = html.format( this.photo, this.name, this.type, this.id, '', this.network, this.link ); + html = "
"+that.item_tpl+"
"; + html = html.format(this.photo, this.name, this.type, this.id, '', this.network, this.link); if (this.uids!=undefined) that.group_uids[this.id] = this.uids; //console.log(html); that.list_content.append(html); }); + $(".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(); } diff --git a/view/acl_selector.tpl b/view/acl_selector.tpl index e2b85e36bc..837225a5b1 100644 --- a/view/acl_selector.tpl +++ b/view/acl_selector.tpl @@ -9,6 +9,7 @@ diff --git a/view/smarty3/acl_selector.tpl b/view/smarty3/acl_selector.tpl index bc669a2ac6..e9f8030d7c 100644 --- a/view/smarty3/acl_selector.tpl +++ b/view/smarty3/acl_selector.tpl @@ -9,6 +9,7 @@ diff --git a/view/theme/frost-mobile/acl_selector.tpl b/view/theme/frost-mobile/acl_selector.tpl index e79a6891a5..df34a1a2ae 100644 --- a/view/theme/frost-mobile/acl_selector.tpl +++ b/view/theme/frost-mobile/acl_selector.tpl @@ -9,6 +9,7 @@ diff --git a/view/theme/frost-mobile/js/acl.js b/view/theme/frost-mobile/js/acl.js index 6feded6ab4..20f0d46189 100644 --- a/view/theme/frost-mobile/js/acl.js +++ b/view/theme/frost-mobile/js/acl.js @@ -247,12 +247,17 @@ ACL.prototype.populate = function(data){ /* var height = Math.ceil(data.tot / that.nw) * 42; that.list_content.height(height);*/ $j(data.items).each(function(){ - html = "

{1}

"+that.item_tpl+"
"; + html = "
"+that.item_tpl+"
"; html = html.format( this.photo, this.name, this.type, this.id, '', this.network, this.link ); if (this.uids!=undefined) that.group_uids[this.id] = this.uids; //console.log(html); that.list_content.append(html); }); + $(".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(); } diff --git a/view/theme/frost-mobile/smarty3/acl_selector.tpl b/view/theme/frost-mobile/smarty3/acl_selector.tpl index 361bf8843a..f3b1abea7c 100644 --- a/view/theme/frost-mobile/smarty3/acl_selector.tpl +++ b/view/theme/frost-mobile/smarty3/acl_selector.tpl @@ -9,6 +9,7 @@ diff --git a/view/theme/frost/js/acl.js b/view/theme/frost/js/acl.js index 0f080cfe13..6b443b2481 100644 --- a/view/theme/frost/js/acl.js +++ b/view/theme/frost/js/acl.js @@ -247,12 +247,17 @@ ACL.prototype.populate = function(data){ var height = Math.ceil(data.tot / that.nw) * 42; that.list_content.height(height); $j(data.items).each(function(){ - html = "

{1}

"+that.item_tpl+"
"; + html = "
"+that.item_tpl+"
"; html = html.format( this.photo, this.name, this.type, this.id, '', this.network, this.link ); if (this.uids!=undefined) that.group_uids[this.id] = this.uids; //console.log(html); that.list_content.append(html); }); + $(".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(); } diff --git a/view/theme/frost/smarty3/acl_selector.tpl b/view/theme/frost/smarty3/acl_selector.tpl index 361bf8843a..f3b1abea7c 100644 --- a/view/theme/frost/smarty3/acl_selector.tpl +++ b/view/theme/frost/smarty3/acl_selector.tpl @@ -9,6 +9,7 @@