diff --git a/index.php b/index.php index 7b1e2cd..d02d589 100644 --- a/index.php +++ b/index.php @@ -81,20 +81,9 @@ }); - $(".fancycover").fancybox({ - 'type' : 'image', - prevEffect : 'none', - nextEffect : 'none' - - }); + $(".fancycover").fancybox(fancyBoxObject (null, 'image')); - $(".fancyabout").fancybox({ - 'type' : 'ajax', - title : 'COPS ', - prevEffect : 'none', - nextEffect : 'none' - - }); + $(".fancyabout").fancybox(fancyBoxObject ('COPS ', 'ajax')); $(".headright").click(function(){ diff --git a/util.js b/util.js index 204f238..b0bcca6 100644 --- a/util.js +++ b/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, '&')