Fix browser prefetch in notifications menu
Fix browser prefetch by substituting data-src with src for images
This commit is contained in:
parent
94c8d7693f
commit
dbf8f711cf
|
@ -181,7 +181,14 @@
|
||||||
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
|
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
|
||||||
nnm.append(html);
|
nnm.append(html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("img[data-src]", nnm).each(function(i, el){
|
||||||
|
// Replace data-src attribute with src attribute for every image
|
||||||
|
$(el).attr('src', $(el).data("src"));
|
||||||
|
$(el).removeAttr("data-src");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
notif = eNotif.attr('count');
|
notif = eNotif.attr('count');
|
||||||
if (notif>0){
|
if (notif>0){
|
||||||
$("#nav-notifications-linkmenu").addClass("on");
|
$("#nav-notifications-linkmenu").addClass("on");
|
||||||
|
@ -203,7 +210,6 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
NavUpdate();
|
NavUpdate();
|
||||||
// Allow folks to stop the ajax page updates with the pause/break key
|
// Allow folks to stop the ajax page updates with the pause/break key
|
||||||
$(document).keydown(function(event) {
|
$(document).keydown(function(event) {
|
||||||
|
|
|
@ -64,5 +64,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -64,5 +64,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<script>
|
<script>
|
||||||
var pagetitle = null;
|
var pagetitle = null;
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<script>
|
<script>
|
||||||
var pagetitle = null;
|
var pagetitle = null;
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
|
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
|
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ $langselector
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}">
|
<li class="{4}">
|
||||||
<a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a>
|
<a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}">
|
<li class="{4}">
|
||||||
<a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a>
|
<a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -66,5 +66,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -66,5 +66,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -64,5 +64,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -64,5 +64,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -187,6 +187,12 @@
|
||||||
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
|
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
|
||||||
nnm.append(html);
|
nnm.append(html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("img[data-src]", nnm).each(function(i, el){
|
||||||
|
// Replace data-src attribute with src attribute for every image
|
||||||
|
$(el).attr('src', $(el).data("src"));
|
||||||
|
$(el).removeAttr("data-src");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
notif = eNotif.attr('count');
|
notif = eNotif.attr('count');
|
||||||
if (notif>0){
|
if (notif>0){
|
||||||
|
|
|
@ -142,5 +142,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -142,5 +142,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -179,6 +179,12 @@
|
||||||
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
|
html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
|
||||||
nnm.append(html);
|
nnm.append(html);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("img[data-src]", nnm).each(function(i, el){
|
||||||
|
// Replace data-src attribute with src attribute for every image
|
||||||
|
$(el).attr('src', $(el).data("src"));
|
||||||
|
$(el).removeAttr("data-src");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
notif = eNotif.attr('count');
|
notif = eNotif.attr('count');
|
||||||
if (notif>0){
|
if (notif>0){
|
||||||
|
|
|
@ -146,5 +146,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -146,5 +146,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li><a href="{0}"><img src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">$langselector</div>
|
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">$langselector</div>
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li><a href="{0}"><img src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">{{$langselector}}</div>
|
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">{{$langselector}}</div>
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">$langselector</div>
|
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">$langselector</div>
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">{{$langselector}}</div>
|
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">{{$langselector}}</div>
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li><a href="{0}"><img src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{#
|
{#
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li><a href="{0}"><img src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
|
|
Loading…
Reference in a new issue