Factorize a little all fancybox stuff. re #73

This commit is contained in:
Sébastien Lucas 2013-06-16 07:50:14 +02:00
父節點 07a891377d
當前提交 c8595a567b
共有 2 個文件被更改,包括 16 次插入13 次删除

查看文件

@ -81,20 +81,9 @@
});
<?php if (getCurrentOption ('use_fancyapps') == 1) { ?>
$(".fancycover").fancybox({
'type' : 'image',
prevEffect : 'none',
nextEffect : 'none'
<?php if ($isEink) echo ", openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
});
$(".fancycover").fancybox(fancyBoxObject (null, 'image'));
$(".fancyabout").fancybox({
'type' : 'ajax',
title : 'COPS <?php echo VERSION ?>',
prevEffect : 'none',
nextEffect : 'none'
<?php if ($isEink) echo ", openEffect : 'none', closeEffect : 'none', helpers : {overlay : null}"; ?>
});
$(".fancyabout").fancybox(fancyBoxObject ('COPS <?php echo VERSION ?>', 'ajax'));
<?php } ?>
$(".headright").click(function(){

14
util.js
查看文件

@ -1,5 +1,19 @@
var template, templateBookDetail, result;
var isEink = /Kobo|Kindle|EBRD1101/i.test(navigator.userAgent);
function fancyBoxObject (title, type) {
var out = { prevEffect : 'none', nextEffect : 'none' };
if (isEink) {
out ["openEffect"] = 'none';
out ["closeEffect"] = 'none';
out ["helper"] = { overlay : null };
}
if (title) out ["title"] = title;
if (type) out ["type"] = type;
return out;
}
function htmlEscape(str) {
return String(str)
.replace(/&/g, '&amp;')