options = '';
}
+ var locationdefault = 'yes';
var mtarget = target;
+ var replace = true;
if (this.datas.phonegap) {
- if(target=='_unique' || target=='_new') {
+ if (target == '_unique' || target == '_new') {
mtarget = '_blank';
}
} else {
if (target == '_new') {
- mtarget = 'fb_' + $this.fluidbook.datas.id + '_' + Math.round(Math.random() * 10000000);
+ mtarget = 'fb_' + this.datas.id + '_' + Math.round(Math.random() * 10000000);
+ options += ',scrollbars=yes'
} else if (target == '_unique') {
- mtarget = 'fb_' + $this.fluidbook.datas.id;
+ mtarget = 'fb_' + this.datas.id;
+ options += ',scrollbars=yes'
+ } else {
+
}
}
- var locationdefault = 'yes';
if (this.datas.phonegap) {
locationdefault = 'yes';
}
options += ',location=' + locationdefault;
}
- if (this.datas.phonegap && mtarget=='_blank') {
+ if (this.datas.phonegap && mtarget == '_blank') {
options += ',zoom=yes,enableViewportScale=yes'
}
- window.open(url, mtarget, options);
+ // Open the window
+ var w = window.open(url, mtarget, options, replace);
+ try {
+ // Attempt to focus opened windows (useful for already opened windows)
+ if (target == '_new' || target == '_unique') {
+ w.focus();
+ }
+ } catch (e) {
+
+ }
}
}
\ No newline at end of file
return false;
});
- $(document).on('click', 'a[href^="http"]', function (e) {
- if (!navigator.onLine && $this.fluidbook.datas.phonegap) {
+ $(document).on('click', 'a', function () {
+ console.log('click link ');
+ console.log($(this));
+ var target = $(this).attr('target');
+ if (!target) {
+ target = '_self';
+ }
+ var href = $(this).attr('href');
+ var external = href.substr(0, 4) == 'http';
+ if (href == '#') {
+ return true;
+ }
+
+ if (!navigator.onLine && external && $this.fluidbook.datas.phonegap) {
$this.fluidbook.alertInternetRequired();
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
+ return false;
}
- return true;
+
+ if ($(this).data('type') == 16 && external) {
+ target = '_system';
+ }
+
+ if (target == '_self') {
+ return true;
+ }
+ fluidbook.wopen($(this).attr('href'), target);
+ return false;
+
});
+
$(document).on('click touchend', '[data-action]', function () {
var map = {'pdf': 'print', 'fullScreen': "fullscreen", 'locales': 'localesContainers'};
var action = $(this).data('action');
return false;
});
- $(document).on('click', 'a', function () {
- if (!DATAS.phonegap) {
- return true;
- }
- var target = $(this).attr('target');
- if ($(this).data('type') == 16 && $(this).attr('href').substr(0, 4) == 'http') {
- target = '_system';
- }
- if (target == '_blank' || target == '_system' || target=='_unique' || target=='_new') {
- fluidbook.wopen($(this).attr('href'), target);
- return false;
- }
- return true;
- });
-
$(document).trigger('fluidbookready');
$(this).trigger('fluidbook.ready');