
Looking to your as soon ...
Code: Select all
$( "a" ).contextmenu(function() {
var href = $(this).attr("href");
var shortlink = /^#p[0-9]+/ig.exec(href);
var ck = (href.indexOf('iframe=true') > -1);
var ckl = /^(http[s]?:\/\/[-a-z0-9\.]+)/ig.exec(href); // check if link point to external resource: a passed phpBB url (attr("href")) is relative, not absolute: so we assume that if http(s) is present,
// than it should be a link that point to an external iframe resource. Can be improved further more using this same pattern result.
if ( ck == false && ckl == null && shortlink == null ){ // not re-append // not append if short link like #p49 (link of the post on viewtopic) or passed link point to an external resource
var href0 = href.split('?');
if(href0[1] == null){ href0[1] = ''; } else { href0[1] = '&' + href0[1]; }
var href1 = href0[0] + '?iframe=true' + href0[1];
$(this).attr("href", href1); // send out before mouseup ...
}
});
$( "a" ).mouseup(function() { // but remove on mouseup, or leaving iframe=true we'll loop with htaccess ...
var href = $(this).attr("href");
$(this).attr("href", href.replace('iframe=true&', ''));
});
So what lazyload does, is it only loads images/videos/iframes that are in the viewport.