view += '<div class="content"><div class="multimediaScale">';
view += markup;
view += '</div></div>';
- $("#view").append('<div class="mview" dir="ltr" data-menu="multimedia">' + view + '</div>');
+
+ var read = multimedia.indexOf('r_') == 0 ? ' data-readmode="1"' : '';
+ $("#view").append('<div class="mview" dir="ltr" data-menu="multimedia"' + read + '>' + view + '</div>');
if (callback != undefined) {
callback();
}
var h = hh * 0.8;
var forceHeight = false;
var fullscreen = false;
+ var nw, nh;
$("#viewOverlay").css({width: ww, height: hh});
break;
case 'multimedia':
var iframe = m.find('iframe,img');
+ var readmode = m.data('readmode') == 1;
nw = parseInt($(iframe).data('width'));
nh = parseInt($(iframe).data('height'));
- forceHeight = true;
-
var w = Math.max(ww * 0.8);
var h = Math.max(hh * 0.8);
if (ww < 600) {
fullscreen = true;
}
- var s = Math.min(w / nw, h / nh);
- if (iframe.is('img')) {
- s = Math.min(1, s);
- }
- if (!fullscreen) {
- w = nw * s;
- h = nh * s;
+ var s, x, y;
+ if (readmode) {
+ w = Math.max(w * 0.5, nw);
+ forceHeight = false;
+ if (w > ww * 0.9) {
+ fullscreen = true;
+ w = ww;
+ h = hh;
+ }
+ } else {
+ forceHeight = true;
+
+ s = Math.min(w / nw, h / nh);
+ if (iframe.is('img')) {
+ s = Math.min(1, s);
+ }
+ if (!fullscreen) {
+ w = nw * s;
+ h = nh * s;
+ }
+ x = ( w - (nw * s) ) / 2;
+ y = (h - (nh * s)) / 2;
}
- var x = ( w - (nw * s) ) / 2;
- var y = (h - (nh * s)) / 2;
m.find('.multimediaScale').css({width: nw, height: nh, overflow: 'hidden'}).transform({translateX: x + 'px', translateY: y + 'px', scale: [s, s], origin: [0, 0]}).css('text-align', 'left');
break;