fix autoload viewport size
parent
45328e5c5e
commit
0e6c2b913a
20
autoload.js
20
autoload.js
|
@ -3,20 +3,24 @@ addListener(window, 'load', function(){
|
|||
if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {
|
||||
var as = document.getElementsByTagName('A');
|
||||
var links = [];
|
||||
var w = 100*Math.floor((document.documentElement.offsetWidth*0.8)/100);
|
||||
var h = 100*Math.floor((document.documentElement.offsetHeight*0.8)/100);
|
||||
var de = document.documentElement,
|
||||
db = document.getElementsByTagName('body')[0],
|
||||
w = window.innerWidth || de.clientWidth || db.clientWidth,
|
||||
h = window.innerHeight || de.clientHeight || db.clientHeight;
|
||||
w = 100*Math.floor(w*0.9/100);
|
||||
h = 100*Math.floor(h*0.9/100);
|
||||
var t;
|
||||
for (var i = 0; i < as.length; i++) {
|
||||
if (as[i].getAttribute('rel') == 'lightbox') {
|
||||
t = as[i].title;
|
||||
t += ' <a href="'+as[i].href+'" target="_blank">'+(t?'(с':'С')+'м. полный размер'+(t?')':'')+'</a>';
|
||||
if (as[i].getAttribute('rel') == 'lightbox' && !as[i].nolightbox) {
|
||||
links.push({
|
||||
element: as[i],
|
||||
url: as[i].href + (as[i].href.indexOf('?') ? '&' : '?') + ('w='+w+'&h='+h),
|
||||
title: t
|
||||
url: as[i].href + (as[i].href.indexOf('?') >= 0 ? '&' : '?') + ('w='+w+'&h='+h),
|
||||
title: as[i].title
|
||||
});
|
||||
}
|
||||
}
|
||||
setSlimbox(links);
|
||||
setSlimbox(links, {
|
||||
counterText: "Изображение {x} из {y}"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue