From 75862fe24c99da7fad9c22265d8b926c5b18d9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 6 Mar 2013 08:21:46 +0100 Subject: [PATCH 01/86] Prepare next version --- base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base.php b/base.php index 56503c6..9ad0f24 100644 --- a/base.php +++ b/base.php @@ -6,7 +6,7 @@ * @author Sbastien Lucas */ -define ("VERSION", "0.3.2"); +define ("VERSION", "0.3.3"); date_default_timezone_set($config['default_timezone']); function getURLParam ($name, $default = NULL) { From 02b55687e2fd7f1e42925e4ed3d5895f6bf644f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 7 Mar 2013 10:58:58 +0100 Subject: [PATCH 02/86] Fix book comment handling ... once again --- base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base.php b/base.php index 9ad0f24..10ca17b 100644 --- a/base.php +++ b/base.php @@ -32,7 +32,7 @@ function html2xhtml ($html) { $doc->loadHTML($html); // Load the HTML $output = utf8_decode($doc->saveXML($doc->documentElement)); // Transform to an Ansi xml stream $output = xml2xhtml($output); // Fix the br / hr ... - if (preg_match ("/(.*)<\/body><\/html>/", $output, $matches)) { + if (preg_match ("#(.*)#ms", $output, $matches)) { $output = $matches [1]; // Remove } return $output; From a4002e28ae1bc47637149a60b95b839a11198ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 7 Mar 2013 11:09:19 +0100 Subject: [PATCH 03/86] Upgrade to Jquery 1.9.1 and Fancybox 2.4.0 --- fancybox/jquery.fancybox.css | 2 +- fancybox/jquery.fancybox.pack.js | 80 ++++++++++++++++---------------- index.php | 6 +-- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/fancybox/jquery.fancybox.css b/fancybox/jquery.fancybox.css index d6ff8a1..bd3289b 100644 --- a/fancybox/jquery.fancybox.css +++ b/fancybox/jquery.fancybox.css @@ -1,4 +1,4 @@ -/*! fancyBox v2.1.3 fancyapps.com | fancyapps.com/fancybox/#license */ +/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ .fancybox-wrap, .fancybox-skin, .fancybox-outer, diff --git a/fancybox/jquery.fancybox.pack.js b/fancybox/jquery.fancybox.pack.js index 088b5c6..9f6a628 100644 --- a/fancybox/jquery.fancybox.pack.js +++ b/fancybox/jquery.fancybox.pack.js @@ -1,45 +1,45 @@ -/*! fancyBox v2.1.3 fancyapps.com | fancyapps.com/fancybox/#license */ -(function(B,x,f,q){var r=f(B),m=f(x),b=f.fancybox=function(){b.open.apply(this,arguments)},u=null,n=x.createTouch!==q,s=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},E=function(a){return p(a)&&0
',image:'',iframe:'",error:'

The requested content cannot be loaded.
Please try again later.

',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing", -openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null, -isActive:!1,isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=s(a)?f(a).get():[a]),f.each(a,function(e,c){var j={},g,h,i,l,k;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),s(c)?(j={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0, -j,c.metadata())):j=c);g=d.href||j.href||(p(c)?c:null);h=d.title!==q?d.title:j.title||"";l=(i=d.content||j.content)?"html":d.type||j.type;!l&&j.isDom&&(l=c.data("fancybox-type"),l||(l=(l=c.prop("class").match(/fancybox\.(\w+)/))?l[1]:null));p(g)&&(l||(b.isImage(g)?l="image":b.isSWF(g)?l="swf":"#"===g.charAt(0)?l="inline":p(c)&&(l="html",i=c)),"ajax"===l&&(k=g.split(/\s+/,2),g=k.shift(),k=k.shift()));i||("inline"===l?g?i=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):j.isDom&&(i=c):"html"===l?i=g:!l&&(!g&& -j.isDom)&&(l="inline",i=c));f.extend(j,{href:g,type:l,content:i,title:h,selector:k});a[e]=j}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==q&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| +/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ +(function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0
',image:'',iframe:'",error:'

The requested content cannot be loaded.
Please try again later.

',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, +openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, +isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, +c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& +k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==q&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,j;c&&(j=b._getPosition(d),a&&"scroll"===a.type?(delete j.position,c.stop(!0,!0).animate(j,200)):(c.css(j),e.pos=f.extend({}, -e.dim,j)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(u),u=null);b.isOpen&&!u&&(u=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),u=null)},e&&!n?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,n&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), -b.trigger("onUpdate")),b.update())},hideLoading:function(){m.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
').click(b.cancel).appendTo("body");m.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| -!1,d={x:r.scrollLeft(),y:r.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=n&&B.innerWidth?B.innerWidth:r.width(),d.h=n&&B.innerHeight?B.innerHeight:r.height());return d},unbindEvents:function(){b.wrap&&s(b.wrap)&&b.wrap.unbind(".fb");m.unbind(".fb");r.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(r.bind("orientationchange.fb"+(n?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&m.bind("keydown.fb",function(e){var c=e.which||e.keyCode,j= -e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!j||!j.type&&!f(j).is("[contenteditable]")))&&f.each(d,function(d,j){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!i&&1g||0>j)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, -e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c,a=k(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& +prev:function(a){var d=b.current;d&&(p(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({}, +e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), +b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| +!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k= +e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, +e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& (d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= -!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&n&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(n?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,v(d.padding[a]))});b.trigger("onReady"); +!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, -(new Date).getTime())).attr("scrolling",n?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);n||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= -b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,j,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); -e=a.content;c=a.type;j=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
").html(e).find(a.selector):s(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", -!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!s(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); -a.inner.css("overflow","yes"===j?"scroll":"no"===j?"hidden":j);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,j=b.skin,g=b.inner,h=b.current,c=h.width,i=h.height,l=h.minWidth,t=h.minHeight,m=h.maxWidth, -n=h.maxHeight,r=h.scrolling,p=h.scrollOutside?h.scrollbarWidth:0,w=h.margin,y=k(w[1]+w[3]),q=k(w[0]+w[2]),x,z,s,C,A,F,B,D,u;e.add(j).add(g).width("auto").height("auto").removeClass("fancybox-tmp");w=k(j.outerWidth(!0)-j.width());x=k(j.outerHeight(!0)-j.height());z=y+w;s=q+x;C=E(c)?(a.w-z)*k(c)/100:c;A=E(i)?(a.h-s)*k(i)/100:i;if("iframe"===h.type){if(u=h.content,h.autoHeight&&1===u.data("ready"))try{u[0].contentWindow.document.location&&(g.width(C).height(9999),F=u.contents().find("body"),p&&F.css("overflow-x", -"hidden"),A=F.height())}catch(G){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=k(C);i=k(A);D=C/A;l=k(E(l)?k(l,"w")-z:l);m=k(E(m)?k(m,"w")-z:m);t=k(E(t)?k(t,"h")-s:t);n=k(E(n)?k(n,"h")-s:n);F=m;B=n;h.fitToView&&(m=Math.min(a.w-z,m),n=Math.min(a.h-s,n));z=a.w-y;q=a.h-q;h.aspectRatio?(c>m&&(c=m,i=k(c/D)),i>n&&(i=n,c=k(i*D)),cz||y>q)&&(c>l&&i>t)&&!(19m&&(c=m,i=k(c/D)),g.width(c).height(i),e.width(c+w),a=e.width(),y=e.height();else c=Math.max(l,Math.min(c,c-(a-z))),i=Math.max(t,Math.min(i,i-(y-q)));p&&("auto"===r&&iz||y>q)&&c>l&&i>t;c=h.aspectRatio?ct&&i
').appendTo("body");this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this,a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(r.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&& -(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()},close:function(){f(".fancybox-overlay").remove();r.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");f.browser.msie?(b=Math.max(x.documentElement.offsetWidth,x.body.offsetWidth),m.width()>b&&(a=m.width())):m.width()>r.width()&&(a=m.width());this.overlay.width(a).height(m.height())}, -onReady:function(a,b){f(".fancybox-overlay").stop(!0,!0);this.overlay||(this.margin=m.height()>r.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=x.all&&!x.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",k(this.margin)+ -b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
'+e+"
");switch(c){case "inside":c=b.skin;break;case "outside":c= -b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),f.browser.msie&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(k(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",j=function(g){var h=f(this).blur(),i=d,j,k;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(j=a.groupAttr||"data-fancybox-group",k=h.attr(j),k||(j="rel", -k=h.get(0)[j]),k&&(""!==k&&"nofollow"!==k)&&(h=c.length?f(c):e,h=h.filter("["+j+'="'+k+'"]'),i=h.index(this)),a.index=i,!1!==b.open(h,a)&&g.preventDefault())},a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",j):m.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",j);this.filter("[data-fancybox-start=1]").trigger("click");return this};m.ready(function(){f.scrollbarWidth===q&&(f.scrollbarWidth=function(){var a=f('
').appendTo("body"), -b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===q){var a=f.support,d=f('
').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); \ No newline at end of file +(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= +b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); +e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", +!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); +a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth, +v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x", +"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),cA||p>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&jA||p>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
').appendTo("body"); +this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()}, +close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0, +!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed|| +this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
'+e+"
");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"), +H&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+ +'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('
').appendTo("body"),b=a.children(), +b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('
').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); \ No newline at end of file diff --git a/index.php b/index.php index ef19697..2e8a042 100644 --- a/index.php +++ b/index.php @@ -53,13 +53,13 @@ <?php echo htmlspecialchars ($currentPage->title) ?> - - + + - + " media="screen" /> - + " media="screen" /> From ed8166e15646ce5a93e02a55858463ac6d3fc9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sun, 10 Mar 2013 08:48:49 +0100 Subject: [PATCH 06/86] Code cleanup --- customcolumn.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/customcolumn.php b/customcolumn.php index 4218040..f4f207d 100644 --- a/customcolumn.php +++ b/customcolumn.php @@ -74,7 +74,6 @@ class CustomColumn extends Base { } public static function getCustomById ($customId, $id) { - $test = 'select id, value as name from ' . self::getTableName ($customId) . ' where id = ?'; $result = parent::getDb ()->prepare('select id, value as name from ' . self::getTableName ($customId) . ' where id = ?'); $result->execute (array ($id)); if ($post = $result->fetchObject ()) { @@ -84,12 +83,6 @@ class CustomColumn extends Base { } public static function getAllCustoms($customId) { - $test = str_format ("{0} - {1} - {2}", self::getTableName ($customId), self::getTableLinkName ($customId), self::getTableLinkColumn ($customId)); - $test = str_format ('select {0}.id as id, {0}.value as name, count(*) as count -from {0}, {1} -where {0}.id = {1}.{2} -group by {0}.id, {0}.value -order by {0}.value', self::getTableName ($customId), self::getTableLinkName ($customId), self::getTableLinkColumn ($customId)); $result = parent::getDb ()->query(str_format ('select {0}.id as id, {0}.value as name, count(*) as count from {0}, {1} where {0}.id = {1}.{2} From 99454bd5620b1d85618e63a14e4cbcf151c6c519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 19 Mar 2013 21:11:10 +0100 Subject: [PATCH 07/86] Add another test in checkconfig to check if the database contains at least some table from Calibre. --- checkconfig.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/checkconfig.php b/checkconfig.php index a71ee32..3d48ff6 100644 --- a/checkconfig.php +++ b/checkconfig.php @@ -107,6 +107,24 @@ Please check ?>
+
+
Check if Calibre database file contains at least some of the needed tables
+
+ query("select count(*) FROM sqlite_master WHERE type='table' AND name in ('books', 'authors', 'tags', 'series')")->fetchColumn(); + if ($count == 4) { + echo "OK"; + } else { + echo "Not all Calibre tables were found. Are you you're using the correct database."; + } + } catch (Exception $e) { + echo "If the file is readable, check your php configuration. Exception detail : " . $e; + } + ?> +
+
From 012ffb9bf0b4aa6b43a127ae43f335abffb25d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 19 Mar 2013 21:16:39 +0100 Subject: [PATCH 08/86] Upgrade to latest php-epub-meta --- php-epub-meta/epub.php | 13 +++- php-epub-meta/tbszip.php | 145 +++++++++++++++++++++++++-------------- 2 files changed, 103 insertions(+), 55 deletions(-) diff --git a/php-epub-meta/epub.php b/php-epub-meta/epub.php index f6cf71f..0b1fd2c 100644 --- a/php-epub-meta/epub.php +++ b/php-epub-meta/epub.php @@ -81,13 +81,21 @@ class EPub { $this->zip->Close (); } + public function cleanITunesCrap () { + if ($this->zip->FileExists("iTunesMetadata.plist")) { + $this->zip->FileReplace ("iTunesMetadata.plist", false); + } + if ($this->zip->FileExists("iTunesArtwork")) { + $this->zip->FileReplace ("iTunesArtwork", false); + } + } + /** * Writes back all meta data changes - * TODO update */ public function save(){ $this->download (); - $zip->close(); + $this->zip->close(); } /** @@ -413,7 +421,6 @@ class EPub { } } - public function Cover2($path=false, $mime=false){ $hascover = true; $item = $this->getCoverItem (); diff --git a/php-epub-meta/tbszip.php b/php-epub-meta/tbszip.php index ba1214d..fbbb8cb 100644 --- a/php-epub-meta/tbszip.php +++ b/php-epub-meta/tbszip.php @@ -1,7 +1,8 @@ CdPos = $this->CdInfo['p_cd']; } - function Open($ArchFile) { + function Open($ArchFile, $UseIncludePath=false) { // Open the zip archive if (!isset($this->Meth8Ok)) $this->__construct(); // for PHP 4 compatibility $this->Close(); // close handle and init info @@ -44,7 +45,7 @@ class clsTbsZip { $this->ArchFile = $ArchFile; $this->ArchIsNew = false; // open the file - $this->ArchHnd = fopen($ArchFile, 'rb'); + $this->ArchHnd = fopen($ArchFile, 'rb', $UseIncludePath); $ok = !($this->ArchHnd===false); if ($ok) $ok = $this->CentralDirRead(); return $ok; @@ -89,7 +90,7 @@ class clsTbsZip { $cd_pos = -22; $this->_MoveTo($cd_pos, SEEK_END); $b = $this->_ReadData(4); - if ($b!==$cd_info) return $this->RaiseError('The footer of the Central Directory is not found.'); + if ($b!==$cd_info) return $this->RaiseError('The End of Central Rirectory Record is not found.'); $this->CdEndPos = ftell($this->ArchHnd) - 4; $this->CdInfo = $this->CentralDirRead_End($cd_info); @@ -97,8 +98,8 @@ class clsTbsZip { $this->CdFileNbr = $this->CdInfo['file_nbr_curr']; $this->CdPos = $this->CdInfo['p_cd']; - if ($this->CdFileNbr<=0) return $this->RaiseError('No file found in the Central Directory.'); - if ($this->CdPos<=0) return $this->RaiseError('No position found for the Central Directory listing.'); + if ($this->CdFileNbr<=0) return $this->RaiseError('No header found in the Central Directory.'); + if ($this->CdPos<=0) return $this->RaiseError('No position found for the Central Directory.'); $this->_MoveTo($this->CdPos); for ($i=0;$i<$this->CdFileNbr;$i++) { @@ -114,13 +115,13 @@ class clsTbsZip { function CentralDirRead_End($cd_info) { $b = $cd_info.$this->_ReadData(18); $x = array(); - $x['disk_num_curr'] = $this->_GetDec($b,4,2); // number of this disk - $x['disk_num_cd'] = $this->_GetDec($b,6,2); // number of the disk with the start of the central directory - $x['file_nbr_curr'] = $this->_GetDec($b,8,2); // total number of entries in the central directory on this disk + $x['disk_num_curr'] = $this->_GetDec($b,4,2); // number of this disk + $x['disk_num_cd'] = $this->_GetDec($b,6,2); // number of the disk with the start of the central directory + $x['file_nbr_curr'] = $this->_GetDec($b,8,2); // total number of entries in the central directory on this disk $x['file_nbr_tot'] = $this->_GetDec($b,10,2); // total number of entries in the central directory $x['l_cd'] = $this->_GetDec($b,12,4); // size of the central directory - $x['p_cd'] = $this->_GetDec($b,16,4); // offset of start of central directory with respect to the starting disk number - $x['l_comm'] = $this->_GetDec($b,20,2); // .ZIP file comment length + $x['p_cd'] = $this->_GetDec($b,16,4); // position of start of central directory with respect to the starting disk number + $x['l_comm'] = $this->_GetDec($b,20,2); // .ZIP file comment length $x['v_comm'] = $this->_ReadData($x['l_comm']); // .ZIP file comment $x['bin'] = $b.$x['v_comm']; return $x; @@ -131,7 +132,7 @@ class clsTbsZip { $b = $this->_ReadData(46); $x = $this->_GetHex($b,0,4); - if ($x!=='h:02014b50') return $this->RaiseError('Signature of file information not found in the Central Directory in position '.(ftell($this->ArchHnd)-46).' for file #'.$idx.'.'); + if ($x!=='h:02014b50') return $this->RaiseError("Signature of Central Directory Header #".$idx." (file information) expected but not found at position ".$this->_TxtPos(ftell($this->ArchHnd) - 46)."."); $x = array(); $x['vers_used'] = $this->_GetDec($b,4,2); @@ -169,36 +170,56 @@ class clsTbsZip { $this->DisplayError = true; - echo "
\r\n"; - echo "------------------
\r\n"; - echo "Central Directory:
\r\n"; - echo "------------------
\r\n"; - print_r($this->CdInfo); - - echo "
\r\n"; - echo "-----------------------------------
\r\n"; - echo "File List in the Central Directory:
\r\n"; - echo "-----------------------------------
\r\n"; - print_r($this->CdFileLst); - if ($FileHeaders) { - echo "
\r\n"; - echo "------------------------------
\r\n"; - echo "File List in the Data Section:
\r\n"; - echo "------------------------------
\r\n"; + // Calculations first in order to have error messages before other information $idx = 0; $pos = 0; + $pos_stop = $this->CdInfo['p_cd']; $this->_MoveTo($pos); - while ($ok = $this->_ReadFile($idx,false)) { - $this->VisFileLst[$idx]['debug_pos'] = $pos; + while ( ($pos<$pos_stop) && ($ok = $this->_ReadFile($idx,false)) ) { + $this->VisFileLst[$idx]['p_this_header (debug_mode only)'] = $pos; $pos = ftell($this->ArchHnd); $idx++; } - print_r($this->VisFileLst); + } + + $nl = "\r\n"; + echo "
";
+		
+		echo "-------------------------------".$nl;
+		echo "End of Central Directory record".$nl;
+		echo "-------------------------------".$nl;
+		print_r($this->DebugArray($this->CdInfo));
+
+		echo $nl;
+		echo "-------------------------".$nl;
+		echo "Central Directory headers".$nl;
+		echo "-------------------------".$nl;
+		print_r($this->DebugArray($this->CdFileLst));
+
+		if ($FileHeaders) {
+			echo $nl;
+			echo "------------------".$nl;
+			echo "Local File headers".$nl;
+			echo "------------------".$nl;
+			print_r($this->DebugArray($this->VisFileLst));
 		}
 
+		echo "
"; + } + function DebugArray($arr) { + foreach ($arr as $k=>$v) { + if (is_array($v)) { + $arr[$k] = $this->DebugArray($v); + } elseif (substr($k,0,2)=='p_') { + $arr[$k] = $this->_TxtPos($v); + } + } + return $arr; + } + function FileExists($NameOrIdx) { return ($this->FileGetIdx($NameOrIdx)!==false); } @@ -272,9 +293,9 @@ class clsTbsZip { // read the file header (and maybe the data ) in the archive, assuming the cursor in at a new file position $b = $this->_ReadData(30); - + $x = $this->_GetHex($b,0,4); - if ($x!=='h:04034b50') return $this->RaiseError('Signature of file information not found in the Data Section in position '.(ftell($this->ArchHnd)-30).' for file #'.$idx.'.'); + if ($x!=='h:04034b50') return $this->RaiseError("Signature of Local File Header #".$idx." (data section) expected but not found at position ".$this->_TxtPos(ftell($this->ArchHnd)-30)."."); $x = array(); $x['vers'] = $this->_GetDec($b,4,2); @@ -293,15 +314,20 @@ class clsTbsZip { $x['bin'] = $b.$x['v_name'].$x['v_fields']; // Read Data - $len_cd = $this->CdFileLst[$idx]['l_data_c']; - if ($x['l_data_c']==0) { - // Sometimes, the size is not specified in the local information. - $len = $len_cd; + if (isset($this->CdFileLst[$idx])) { + $len_cd = $this->CdFileLst[$idx]['l_data_c']; + if ($x['l_data_c']==0) { + // Sometimes, the size is not specified in the local information. + $len = $len_cd; + } else { + $len = $x['l_data_c']; + if ($len!=$len_cd) { + //echo "TbsZip Warning: Local information for file #".$idx." says len=".$len.", while Central Directory says len=".$len_cd."."; + } + } } else { $len = $x['l_data_c']; - if ($len!=$len_cd) { - //echo "TbsZip Warning: Local information for file #".$idx." says len=".$len.", while Central Directory says len=".$len_cd."."; - } + if ($len==0) $this->RaiseError("File Data #".$idx." cannt be read because no length is specified in the Local File Header and its Central Directory information has not been found."); } if ($ReadData) { @@ -309,16 +335,25 @@ class clsTbsZip { } else { $this->_MoveTo($len, SEEK_CUR); } - + // Description information $desc_ok = ($x['purp'][2+3]=='1'); if ($desc_ok) { - $b = $this->_ReadData(16); - $x['desc_bin'] = $b; - $x['desc_sign'] = $this->_GetHex($b,0,4); // not specified in the documentation sign=h:08074b50 - $x['desc_crc32'] = $this->_GetDec($b,4,4); - $x['desc_l_data_c'] = $this->_GetDec($b,8,4); - $x['desc_l_data_u'] = $this->_GetDec($b,12,4); + $b = $this->_ReadData(12); + $s = $this->_GetHex($b,0,4); + $d = 0; + // the specification says the signature may or may not be present + if ($s=='h:08074b50') { + $b .= $this->_ReadData(4); + $d = 4; + $x['desc_bin'] = $b; + $x['desc_sign'] = $s; + } else { + $x['desc_bin'] = $b; + } + $x['desc_crc32'] = $this->_GetDec($b,0+$d,4); + $x['desc_l_data_c'] = $this->_GetDec($b,4+$d,4); + $x['desc_l_data_u'] = $this->_GetDec($b,8+$d,4); } // Save file info without the data @@ -441,9 +476,10 @@ class clsTbsZip { if ($ReplInfo['meth']!==false) $this->_PutDec($b1, $ReplInfo['meth'], 8, 2); // meth // prepare the bottom description if the zipped file, if any if ($b2!=='') { - $this->_PutDec($b2, $ReplInfo['crc32'], 4, 4); // crc32 - $this->_PutDec($b2, $ReplInfo['len_c'], 8, 4); // l_data_c - $this->_PutDec($b2, $ReplInfo['len_u'], 12, 4); // l_data_u + $d = (strlen($b2)==16) ? 4 : 0; // offset because of the signature if any + $this->_PutDec($b2, $ReplInfo['crc32'], $d+0, 4); // crc32 + $this->_PutDec($b2, $ReplInfo['len_c'], $d+4, 4); // l_data_c + $this->_PutDec($b2, $ReplInfo['len_u'], $d+8, 4); // l_data_u } // output data $this->OutputFromString($b1.$ReplInfo['data'].$b2); @@ -501,7 +537,7 @@ class clsTbsZip { $ArchPos += $old_cd_len; $DeltaCdLen = $DeltaCdLen + strlen($b2) - $old_cd_len; - // Output until Central Directory footer + // Output until "end of central directory record" if ($this->ArchHnd!==false) $this->OutputFromArch($ArchPos, $this->CdEndPos); // ArchHnd is false if CreateNew() has been called // Output file information of the Central Directory for added files @@ -514,7 +550,7 @@ class clsTbsZip { $DeltaCdLen += strlen($b2); } - // Output Central Directory footer + // Output "end of central directory record" $b2 = $this->CdInfo['bin']; $DelNbr = count($DelLst); if ( ($AddNbr>0) or ($DelNbr>0) ) { @@ -708,6 +744,11 @@ class clsTbsZip { return $y.'-'.str_pad($m,2,'0',STR_PAD_LEFT).'-'.str_pad($d,2,'0',STR_PAD_LEFT).' '.str_pad($h,2,'0',STR_PAD_LEFT).':'.str_pad($i,2,'0',STR_PAD_LEFT).':'.str_pad($s,2,'0',STR_PAD_LEFT); } + function _TxtPos($pos) { + // Return the human readable position in both decimal and hexa + return $pos." (h:".dechex($pos).")"; + } + function _DataOuputAddedFile($Idx, $PosLoc) { $Ref =& $this->AddInfo[$Idx]; From ae37c13711b31ffb0fd44b75c0b7279a14558487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 19 Mar 2013 21:44:30 +0100 Subject: [PATCH 09/86] Should fix loading of tbszip on Linux. Don't know why it works on Windows without it. --- book.php | 1 + 1 file changed, 1 insertion(+) diff --git a/book.php b/book.php index e870a58..65a6083 100644 --- a/book.php +++ b/book.php @@ -12,6 +12,7 @@ require_once('author.php'); require_once('tag.php'); require_once ("customcolumn.php"); require_once('data.php'); +require_once('php-epub-meta/tbszip.php'); require_once('php-epub-meta/epub.php'); // Silly thing because PHP forbid string concatenation in class const From b0e95c6f02f53df8ec1e5930a519a1805a6fcded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 23 Mar 2013 09:36:10 +0100 Subject: [PATCH 10/86] Avoid sending empty language Ibis reader doesn't like it. --- OPDS_renderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OPDS_renderer.php b/OPDS_renderer.php index a8da8a3..01c8a48 100644 --- a/OPDS_renderer.php +++ b/OPDS_renderer.php @@ -217,7 +217,7 @@ class OPDSRenderer } $lang = $entry->book->getLanguages (); - if (!is_null ($lang)) { + if (!empty ($lang)) { self::getXmlStream ()->startElement ("dcterms:language"); self::getXmlStream ()->text ($lang); self::getXmlStream ()->endElement (); From e2e699426ad0b20051ad45ff55881feb27524550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 23 Mar 2013 09:42:06 +0100 Subject: [PATCH 11/86] Update changelog --- CHANGELOG | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 5ba5751..332860b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +0.3.3 - 20130323 + * Fix catalog if book summary contains bad HTML again :(. + * Upgrade to Fancybox 2.4.0 and JQuery 1.9.1. + * Search is now dependant on the page you're in. For now if you're on author page it'll look for author name. + * Update checkconfig to check if the database provided comes from Calibre. + * Update to latest php-epub-meta should fix the metadata update with Epub. + * Fix OPDS catalog with Ibis Reader. It didn't like empty language. + 0.3.2 - 20130303 * Add dutch translation. Provided by Northguy. * Fix an ugly bug introduced in 0.3.1. Reported by mariosipad. From 81ced1dcb64f17e623c2ae4b9b123fdd070aa04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 23 Mar 2013 09:43:15 +0100 Subject: [PATCH 12/86] Update config documentation. --- config_default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_default.php b/config_default.php index 855640b..4380c2a 100644 --- a/config_default.php +++ b/config_default.php @@ -93,7 +93,7 @@ /* * use URL rewriting for downloading of ebook in HTML catalog - * See README for more information + * See Github wiki for more information * 1 : enable * 0 : disable */ From 563a90cf5d9a7451dffa104029eb41e786ffeb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 23 Mar 2013 20:59:12 +0100 Subject: [PATCH 13/86] =?UTF-8?q?=C3=89tiquette=200.3.3=20ajout=C3=A9e=20?= =?UTF-8?q?=C3=A0=20la=20r=C3=A9vision=202ff58ed42cec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 1d0aed5..2e1f0af 100644 --- a/.hgtags +++ b/.hgtags @@ -11,3 +11,4 @@ c5703623704b81dca4228e211830125029cf86a1 0.2.3 5cc3b8ed121d9df57e013e050a75e5602cf2198e 0.3.0 aca483636af460c93f9817e083e85d1976aa1b7d 0.3.1 5888006bc559842de0364ec3e67f641aa1653d0e 0.3.2 +2ff58ed42cecf00b24d981426dff507fa1e86c20 0.3.3 From 6d94c2d4c19bb8f87d1755c4f7bbfec1baf88b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Mar 2013 20:54:05 +0100 Subject: [PATCH 14/86] Fix a warning in case the book has no tag or author --- book.php | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/book.php b/book.php index 65a6083..8c8b9b8 100644 --- a/book.php +++ b/book.php @@ -138,17 +138,7 @@ class Book extends Base { } public function getAuthorsName () { - $authorList = null; - foreach ($this->getAuthors () as $author) { - if ($authorList) { - $authorList = $authorList . ", " . $author->name; - } - else - { - $authorList = $author->name; - } - } - return $authorList; + return implode (", ", array_map (function ($author) { return $author->name; }, $this->getAuthors ())); } public function getSerie () { @@ -220,17 +210,7 @@ class Book extends Base { public function getTagsName () { - $tagList = null; - foreach ($this->getTags () as $tag) { - if ($tagList) { - $tagList = $tagList . ", " . $tag->name; - } - else - { - $tagList = $tag->name; - } - } - return $tagList; + return implode (", ", array_map (function ($tag) { return $tag->name; }, $this->getTags ())); } public function getRating () { From f9c6e8277bdc24332606117f4a9bd8e836a4fda6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Mar 2013 20:58:29 +0100 Subject: [PATCH 15/86] getFilterString should be static. Reported by Goner --- book.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book.php b/book.php index 8c8b9b8..c0a5baa 100644 --- a/book.php +++ b/book.php @@ -118,7 +118,7 @@ class Book extends Base { return $this->authors; } - public function getFilterString () { + public static function getFilterString () { $filter = getURLParam ("tag", NULL); if (empty ($filter)) return ""; From 40f137c84a32d3174c5a528b15c13bbd00f1e7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Mar 2013 20:59:48 +0100 Subject: [PATCH 16/86] Upgrade php-epub-meta from upstream. Should fix coverpath on Windows. Reported by Mario --- php-epub-meta/epub.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/php-epub-meta/epub.php b/php-epub-meta/epub.php index 0b1fd2c..26466b2 100644 --- a/php-epub-meta/epub.php +++ b/php-epub-meta/epub.php @@ -430,6 +430,7 @@ class EPub { $mime = $item->attr('opf:media-type'); $this->coverpath = $item->attr('opf:href'); $this->coverpath = dirname('/'.$this->meta).'/'.$this->coverpath; // image path is relative to meta file + $this->coverpath = ltrim($this->coverpath,'\\'); $this->coverpath = ltrim($this->coverpath,'/'); } @@ -448,18 +449,6 @@ class EPub { } if (!$hascover) return $this->no_cover(); - - $zip = new ZipArchive(); - if(!@$zip->open($this->file)){ - throw new Exception('Failed to read epub file'); - } - $data = $zip->getFromName($this->coverpath); - - return array( - 'mime' => $mime, - 'data' => $data, - 'found' => $this->coverpath - ); } /** From 90803303606bd2f5455fc74fca4de862c11af7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Mar 2013 21:07:00 +0100 Subject: [PATCH 17/86] Update from upstream again --- php-epub-meta/LICENSE | 3 +++ php-epub-meta/epub.php | 1 + 2 files changed, 4 insertions(+) diff --git a/php-epub-meta/LICENSE b/php-epub-meta/LICENSE index 128bf1f..2fcf6f9 100644 --- a/php-epub-meta/LICENSE +++ b/php-epub-meta/LICENSE @@ -17,3 +17,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +All code created or modified by Sbastien Lucas is licensed +under GPL 2 (http://www.gnu.org/licenses/gpl.html). \ No newline at end of file diff --git a/php-epub-meta/epub.php b/php-epub-meta/epub.php index 26466b2..c3927a5 100644 --- a/php-epub-meta/epub.php +++ b/php-epub-meta/epub.php @@ -3,6 +3,7 @@ * PHP EPub Meta library * * @author Andreas Gohr + * @author Sbastien Lucas */ require_once('tbszip.php'); From 2eecba8f830b6e7adf4d7b67e79ab93c0f336000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Mar 2013 21:12:17 +0100 Subject: [PATCH 18/86] To avoid all problems with php-epub-meta working on windows and some version of Linux. Remove the directory so that include are simple. --HG-- rename : php-epub-meta/LICENSE => LICENSE_php-epub-meta rename : php-epub-meta/epub.php => epub.php rename : php-epub-meta/tbszip.php => tbszip.php --- php-epub-meta/LICENSE => LICENSE_php-epub-meta | 0 book.php | 3 +-- php-epub-meta/epub.php => epub.php | 0 php-epub-meta/tbszip.php => tbszip.php | 0 4 files changed, 1 insertion(+), 2 deletions(-) rename php-epub-meta/LICENSE => LICENSE_php-epub-meta (100%) rename php-epub-meta/epub.php => epub.php (100%) rename php-epub-meta/tbszip.php => tbszip.php (100%) diff --git a/php-epub-meta/LICENSE b/LICENSE_php-epub-meta similarity index 100% rename from php-epub-meta/LICENSE rename to LICENSE_php-epub-meta diff --git a/book.php b/book.php index c0a5baa..e573ccb 100644 --- a/book.php +++ b/book.php @@ -12,8 +12,7 @@ require_once('author.php'); require_once('tag.php'); require_once ("customcolumn.php"); require_once('data.php'); -require_once('php-epub-meta/tbszip.php'); -require_once('php-epub-meta/epub.php'); +require_once('epub.php'); // Silly thing because PHP forbid string concatenation in class const define ('SQL_BOOKS_LEFT_JOIN', "left outer join comments on comments.book = books.id diff --git a/php-epub-meta/epub.php b/epub.php similarity index 100% rename from php-epub-meta/epub.php rename to epub.php diff --git a/php-epub-meta/tbszip.php b/tbszip.php similarity index 100% rename from php-epub-meta/tbszip.php rename to tbszip.php From fee2275393557f5fc998dd85a7eb15b190991928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Mar 2013 22:53:20 +0100 Subject: [PATCH 19/86] Prepare next release --- base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base.php b/base.php index 4c0afc2..c3cb851 100644 --- a/base.php +++ b/base.php @@ -6,7 +6,7 @@ * @author Sbastien Lucas */ -define ("VERSION", "0.3.3"); +define ("VERSION", "0.3.4"); date_default_timezone_set($config['default_timezone']); function getURLParam ($name, $default = NULL) { From 17d4cfc914ca865dfb212441d5baa4039f987ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Mar 2013 21:14:25 +0100 Subject: [PATCH 20/86] Update changelog --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 332860b..af666fc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +0.3.4 - 20130327 + * Hopefully fix metadata update. Beware you should remove the directory php-epub-meta if you have one. Thanks to Mario for his time. + * Fix two warnings. Reported by Goner and Mario. + 0.3.3 - 20130323 * Fix catalog if book summary contains bad HTML again :(. * Upgrade to Fancybox 2.4.0 and JQuery 1.9.1. From db98509b43c34f98cf6631eb969be7719c0fe394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 27 Mar 2013 21:22:37 +0100 Subject: [PATCH 21/86] =?UTF-8?q?=C3=89tiquette=200.3.4=20ajout=C3=A9e=20?= =?UTF-8?q?=C3=A0=20la=20r=C3=A9vision=203cdee8daedf2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 2e1f0af..10b71ee 100644 --- a/.hgtags +++ b/.hgtags @@ -12,3 +12,4 @@ c5703623704b81dca4228e211830125029cf86a1 0.2.3 aca483636af460c93f9817e083e85d1976aa1b7d 0.3.1 5888006bc559842de0364ec3e67f641aa1653d0e 0.3.2 2ff58ed42cecf00b24d981426dff507fa1e86c20 0.3.3 +3cdee8daedf28e6611203ce90c90bb8906003e22 0.3.4 From dd1a00f560b82cf90730dcf790926fc67375d43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 2 Apr 2013 22:02:08 +0200 Subject: [PATCH 22/86] Fix link in the book permalink. fixes #54 Thanks to celta ;). --- index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.php b/index.php index e0dda9d..dd0589d 100644 --- a/index.php +++ b/index.php @@ -108,6 +108,7 @@ } }); + $(".bookdetail").click(function(){ var url = $(this).find("a").attr("href"); @@ -123,6 +124,7 @@ return false; }); + }); Date: Wed, 3 Apr 2013 14:41:58 +0200 Subject: [PATCH 23/86] Hopefully fix again comments. Reported by Alain. fixes #55 --- base.php | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/base.php b/base.php index c3cb851..9cd0cce 100644 --- a/base.php +++ b/base.php @@ -27,14 +27,89 @@ function xml2xhtml($xml) { '), $xml); } +function is_utf8($string) { +return preg_match('%^(?: +[\x09\x0A\x0D\x20-\x7E] # ASCII +| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte +| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs +| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte +| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates +| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 +| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 +| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 +)*$%xs', $string); +} + +function display_xml_error($error) +{ + $return .= str_repeat('-', $error->column) . "^\n"; + + switch ($error->level) { + case LIBXML_ERR_WARNING: + $return .= "Warning $error->code: "; + break; + case LIBXML_ERR_ERROR: + $return .= "Error $error->code: "; + break; + case LIBXML_ERR_FATAL: + $return .= "Fatal Error $error->code: "; + break; + } + + $return .= trim($error->message) . + "\n Line: $error->line" . + "\n Column: $error->column"; + + if ($error->file) { + $return .= "\n File: $error->file"; + } + + return "$return\n\n--------------------------------------------\n\n"; +} + +function are_libxml_errors_ok () +{ + $errors = libxml_get_errors(); + + foreach ($errors as $error) { + if ($error->code == 801) return false; + } + return true; +} + function html2xhtml ($html) { $doc = new DOMDocument(); - $doc->loadHTML($html); // Load the HTML - $output = utf8_decode($doc->saveXML($doc->documentElement)); // Transform to an Ansi xml stream - $output = xml2xhtml($output); // Fix the br / hr ... - if (preg_match ("#(.*)#ms", $output, $matches)) { - $output = $matches [1]; // Remove + libxml_use_internal_errors(true); + if (is_utf8($html)) { + $doc->loadHTML('' . + $html . ''); // Load the HTML + $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream + $output = xml2xhtml($output); + if (preg_match ('#(.*)#ms', $output, $matches)) { + $output = $matches [1]; // Remove + } + } else { + $doc->loadHTML($html); // Load the HTML + $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream + $output = xml2xhtml($output); + $output = xml2xhtml($output); + if (preg_match ('#(.*)#ms', $output, $matches)) { + $output = $matches [1]; // Remove + } } + + /* + // In case of error with summary, use it to debug + $errors = libxml_get_errors(); + + foreach ($errors as $error) { + $output .= display_xml_error($error); + } + */ + + if (!are_libxml_errors_ok ()) $output = "HTML code not valid."; + + return $output; } From f8f20f3d5c6ee4bd5e7a43696effbb2278bd3f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 3 Apr 2013 14:54:03 +0200 Subject: [PATCH 24/86] Update addURLParameter to allow for a leading ?. re #40 --- base.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/base.php b/base.php index 9cd0cce..26271e8 100644 --- a/base.php +++ b/base.php @@ -175,14 +175,19 @@ function localize($phrase, $count=-1) { } function addURLParameter($urlParams, $paramName, $paramValue) { + $start = ""; + if (preg_match ("#^\?(.*)#", $urlParams, $matches)) { + $start = "?"; + $urlParams = $matches[1]; + } $params = array(); parse_str($urlParams, $params); - if (empty ($paramValue)) { + if (empty ($paramValue) && $paramValue != 0) { unset ($params[$paramName]); } else { $params[$paramName] = $paramValue; } - return http_build_query($params); + return $start . http_build_query($params); } class Link From d86d5440743b99747ecc6655a47ad283debfd885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 3 Apr 2013 15:00:09 +0200 Subject: [PATCH 25/86] Refactor the use of Calibre path to prepare multi database. re #40 --- base.php | 16 +++++++++++++--- book.php | 2 +- data.php | 4 ++-- fetch.php | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/base.php b/base.php index 26271e8..487279f 100644 --- a/base.php +++ b/base.php @@ -622,10 +622,20 @@ abstract class Base const COMPATIBILITY_XML_ALDIKO = "aldiko"; private static $db = NULL; - - public static function getDbFileName () { + + public static function getDbDirectory () { global $config; - return $config['calibre_directory'] .'metadata.db'; + if (is_array ($config['calibre_directory'])) { + $database = GetUrlParam ("database", 0); + $array = array_values ($config['calibre_directory']); + return $array[$database]; + } + return $config['calibre_directory']; + } + + + public static function getDbFileName () { + return self::getDbDirectory () .'metadata.db'; } public static function getDb () { diff --git a/book.php b/book.php index e573ccb..c37e187 100644 --- a/book.php +++ b/book.php @@ -72,7 +72,7 @@ class Book extends Base { $this->title = $line->title; $this->timestamp = strtotime ($line->timestamp); $this->pubdate = strtotime ($line->pubdate); - $this->path = $config['calibre_directory'] . $line->path; + $this->path = Base::getDbDirectory () . $line->path; $this->relativePath = $line->path; $this->seriesIndex = $line->series_index; $this->comment = $line->comment; diff --git a/data.php b/data.php index cdd05d5..3602314 100644 --- a/data.php +++ b/data.php @@ -117,8 +117,8 @@ class Data extends Base { $textData = "&data=" . $idData; } - if (preg_match ('/^\//', $config['calibre_directory']) || // Linux / - preg_match ('/^\w\:/', $config['calibre_directory']) || // Windows X: + if (preg_match ('/^\//', Base::getDbDirectory ()) || // Linux / + preg_match ('/^\w\:/', Base::getDbDirectory ()) || // Windows X: ($type == "epub" && $config['cops_update_epub-metadata'])) { if ($type != "jpg") $textData .= "&type=" . $type; diff --git a/fetch.php b/fetch.php index bbde6fd..855f3fd 100644 --- a/fetch.php +++ b/fetch.php @@ -100,7 +100,7 @@ $dir = $config['calibre_internal_directory']; if (empty ($config['calibre_internal_directory'])) { - $dir = $config['calibre_directory']; + $dir = Base::getDbDirectory (); } if (empty ($config['cops_x_accel_redirect'])) { From f5d86b37e51c0a274e607c75aa83fc2d028233f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 3 Apr 2013 20:59:53 +0200 Subject: [PATCH 26/86] Refactor the use of fetch.php to prepare multi database. re #40 --- book.php | 11 ++--------- data.php | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/book.php b/book.php index c37e187..5fd8367 100644 --- a/book.php +++ b/book.php @@ -329,15 +329,8 @@ class Book extends Base { if ($this->hasCover) { array_push ($linkArray, Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)); - $height = "50"; - if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { - $height = $config['cops_opds_thumbnail_height']; - } - else - { - $height = $config['cops_html_thumbnail_height']; - } - array_push ($linkArray, new Link ("fetch.php?id=$this->id&height=" . $height, "image/jpeg", Link::OPDS_THUMBNAIL_TYPE)); + + array_push ($linkArray, Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL)); } foreach ($this->getDatas () as $data) diff --git a/data.php b/data.php index 3602314..1ed427f 100644 --- a/data.php +++ b/data.php @@ -111,18 +111,27 @@ class Data extends Base { { global $config; - $textData = ""; - if (!is_null ($idData)) - { - $textData = "&data=" . $idData; - } + $urlParam = addURLParameter("", "data", $idData); if (preg_match ('/^\//', Base::getDbDirectory ()) || // Linux / preg_match ('/^\w\:/', Base::getDbDirectory ()) || // Windows X: + $rel == Link::OPDS_THUMBNAIL_TYPE || ($type == "epub" && $config['cops_update_epub-metadata'])) { - if ($type != "jpg") $textData .= "&type=" . $type; - return new Link ("fetch.php?id=$book->id" . $textData, $mime, $rel, $title); + if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type); + if ($rel == Link::OPDS_THUMBNAIL_TYPE) { + $height = "50"; + if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { + $height = $config['cops_opds_thumbnail_height']; + } + else + { + $height = $config['cops_html_thumbnail_height']; + } + $urlParam = addURLParameter($urlParam, "height", $height); + } + $urlParam = addURLParameter($urlParam, "id", $book->id); + return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title); } else { From 91cf377d955675a64968ad5cef20d3bd7a950506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 3 Apr 2013 21:10:28 +0200 Subject: [PATCH 27/86] Refactor again. re #40 --- bookdetail.php | 4 +++- data.php | 17 +++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bookdetail.php b/bookdetail.php index 4a631ba..27343b5 100644 --- a/bookdetail.php +++ b/bookdetail.php @@ -33,7 +33,9 @@ $book->getLinkArray (); hasCover) { ?> - <?php echo localize(" /> + hrefXhtml () ?>"> + hrefXhtml () ?>" alt="" /> + diff --git a/data.php b/data.php index 1ed427f..f929caf 100644 --- a/data.php +++ b/data.php @@ -107,7 +107,7 @@ class Data extends Base { } } - public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL) + public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL) { global $config; @@ -120,13 +120,14 @@ class Data extends Base { { if ($type != "jpg") $urlParam = addURLParameter($urlParam, "type", $type); if ($rel == Link::OPDS_THUMBNAIL_TYPE) { - $height = "50"; - if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { - $height = $config['cops_opds_thumbnail_height']; - } - else - { - $height = $config['cops_html_thumbnail_height']; + if (is_null ($height)) { + if (preg_match ('/feed.php/', $_SERVER["SCRIPT_NAME"])) { + $height = $config['cops_opds_thumbnail_height']; + } + else + { + $height = $config['cops_html_thumbnail_height']; + } } $urlParam = addURLParameter($urlParam, "height", $height); } From 78b60baebd1edfafc5b15047d6afddd229d06528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 4 Apr 2013 08:55:58 +0200 Subject: [PATCH 28/86] Basic multidatabase support. re #40 TODO : * Document the new option * Handle URL rewriting * Handle bookdetail * Test the case without fancybox * Update the title with database name --- base.php | 31 ++++++++++++++++++++++--------- data.php | 1 + 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/base.php b/base.php index 487279f..feaac9e 100644 --- a/base.php +++ b/base.php @@ -7,6 +7,7 @@ */ define ("VERSION", "0.3.4"); +define ("DB", "db"); date_default_timezone_set($config['default_timezone']); function getURLParam ($name, $default = NULL) { @@ -223,6 +224,7 @@ class LinkNavigation extends Link { public function __construct($phref, $prel = NULL, $ptitle = NULL) { parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); + if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); $this->href = $_SERVER["SCRIPT_NAME"] . $this->href; } } @@ -377,16 +379,27 @@ class Page global $config; $this->title = $config['cops_title_default']; $this->subtitle = $config['cops_subtitle_default']; - array_push ($this->entryArray, Author::getCount()); - array_push ($this->entryArray, Serie::getCount()); - array_push ($this->entryArray, Tag::getCount()); - foreach ($config['cops_calibre_custom_column'] as $lookup) { - $customId = CustomColumn::getCustomId ($lookup); - if (!is_null ($customId)) { - array_push ($this->entryArray, CustomColumn::getCount($customId)); + $database = GetUrlParam (DB); + if (is_array ($config['calibre_directory']) && is_null ($database)) { + $i = 0; + foreach ($config['calibre_directory'] as $key => $value) { + array_push ($this->entryArray, new Entry ($key, DB . ":{$i}", + "", "text", + array ( new LinkNavigation ("?" . DB . "={$i}")))); + $i++; } + } else { + array_push ($this->entryArray, Author::getCount()); + array_push ($this->entryArray, Serie::getCount()); + array_push ($this->entryArray, Tag::getCount()); + foreach ($config['cops_calibre_custom_column'] as $lookup) { + $customId = CustomColumn::getCustomId ($lookup); + if (!is_null ($customId)) { + array_push ($this->entryArray, CustomColumn::getCount($customId)); + } + } + $this->entryArray = array_merge ($this->entryArray, Book::getCount()); } - $this->entryArray = array_merge ($this->entryArray, Book::getCount()); } public function isPaginated () @@ -626,7 +639,7 @@ abstract class Base public static function getDbDirectory () { global $config; if (is_array ($config['calibre_directory'])) { - $database = GetUrlParam ("database", 0); + $database = GetUrlParam (DB, 0); $array = array_values ($config['calibre_directory']); return $array[$database]; } diff --git a/data.php b/data.php index f929caf..eb2e41b 100644 --- a/data.php +++ b/data.php @@ -132,6 +132,7 @@ class Data extends Base { $urlParam = addURLParameter($urlParam, "height", $height); } $urlParam = addURLParameter($urlParam, "id", $book->id); + if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB)); return new Link ("fetch.php?" . $urlParam, $mime, $rel, $title); } else From 383a33b597b729fa551974b2f8d03ce088ab1bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 4 Apr 2013 14:27:27 +0200 Subject: [PATCH 29/86] Fix book detail with multi database. re #40 --- book.php | 13 ++++++++----- bookdetail.php | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/book.php b/book.php index 5fd8367..275abdd 100644 --- a/book.php +++ b/book.php @@ -94,15 +94,18 @@ class Book extends Base { } public function getUri () { - return "?page=".parent::PAGE_BOOK_DETAIL."&id=$this->id"; + return "?page=".parent::PAGE_BOOK_DETAIL."&id=$this->id"; } - public function getDetailUrl () { + public function getDetailUrl ($permalink = false) { global $config; - if ($config['cops_use_fancyapps'] == 0) { - return 'index.php' . $this->getUri (); + $urlParam = $this->getUri (); + if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB)); + $urlParam = str_replace ("&", "&", $urlParam); + if ($permalink || $config['cops_use_fancyapps'] == 0) { + return 'index.php' . $urlParam; } else { - return 'bookdetail.php?id=' . $this->id; + return 'bookdetail.php' . $urlParam; } } diff --git a/bookdetail.php b/bookdetail.php index 27343b5..d52747b 100644 --- a/bookdetail.php +++ b/bookdetail.php @@ -50,7 +50,7 @@ $book->getLinkArray (); } ?> - +
From 3a9561d5c0f18b5a82a582c8514cec9b100846e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 4 Apr 2013 20:25:01 +0200 Subject: [PATCH 30/86] Should completely fix bookdetail with multidatabase --- bookdetail.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bookdetail.php b/bookdetail.php index d52747b..175f23b 100644 --- a/bookdetail.php +++ b/bookdetail.php @@ -59,7 +59,7 @@ $book->getLinkArray (); foreach ($authors as $author) { if ($i > 0) echo ", "; ?> - getUri ()) ?>">name) ?> + name) ?> @@ -76,7 +76,7 @@ $book->getLinkArray (); foreach ($tags as $tag) { if ($i > 0) echo ", "; ?> - getUri ()) ?>">name) ?> + name) ?> @@ -89,7 +89,7 @@ $book->getLinkArray (); ?>
seriesIndex, htmlspecialchars ($serie->name)) ?>
From ff95d618dbe804c79926c0a18d3296420d542c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 4 Apr 2013 20:53:44 +0200 Subject: [PATCH 31/86] Checkconfig can now handle multi database. re #40 --- base.php | 19 ++++++++++++++----- checkconfig.php | 26 +++++++++++++++----------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/base.php b/base.php index feaac9e..f8f594d 100644 --- a/base.php +++ b/base.php @@ -635,11 +635,20 @@ abstract class Base const COMPATIBILITY_XML_ALDIKO = "aldiko"; private static $db = NULL; - - public static function getDbDirectory () { + + public static function getDbList () { global $config; if (is_array ($config['calibre_directory'])) { - $database = GetUrlParam (DB, 0); + return $config['calibre_directory']; + } else { + return array ("" => $config['calibre_directory']); + } + } + + public static function getDbDirectory ($database = NULL) { + global $config; + if (is_array ($config['calibre_directory'])) { + if (is_null ($database)) $database = GetUrlParam (DB, 0); $array = array_values ($config['calibre_directory']); return $array[$database]; } @@ -647,8 +656,8 @@ abstract class Base } - public static function getDbFileName () { - return self::getDbDirectory () .'metadata.db'; + public static function getDbFileName ($database = NULL) { + return self::getDbDirectory ($database) .'metadata.db'; } public static function getDb () { diff --git a/checkconfig.php b/checkconfig.php index 3d48ff6..75cd05d 100644 --- a/checkconfig.php +++ b/checkconfig.php @@ -74,15 +74,18 @@ ?>
- + $database) { +?>
Check if Calibre database file exists and is readable
  • Value of \$config['calibre_directory'] in config_local.php
  • @@ -99,10 +102,10 @@ Please check
    @@ -112,19 +115,20 @@ Please check
    query("select count(*) FROM sqlite_master WHERE type='table' AND name in ('books', 'authors', 'tags', 'series')")->fetchColumn(); if ($count == 4) { - echo "OK"; + echo "{$name} OK"; } else { - echo "Not all Calibre tables were found. Are you you're using the correct database."; + echo "{$name} Not all Calibre tables were found. Are you you're using the correct database."; } } catch (Exception $e) { - echo "If the file is readable, check your php configuration. Exception detail : " . $e; + echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e; } ?>
    +
    From b34af8ae1f228f6d06e76779790ff30d37e571d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 4 Apr 2013 21:11:45 +0200 Subject: [PATCH 32/86] Fix bookdetail when Fancyapps is enabled. re #40 --- base.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/base.php b/base.php index f8f594d..321106e 100644 --- a/base.php +++ b/base.php @@ -225,7 +225,11 @@ class LinkNavigation extends Link public function __construct($phref, $prel = NULL, $ptitle = NULL) { parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); - $this->href = $_SERVER["SCRIPT_NAME"] . $this->href; + if (preg_match ("/bookdetail.php/", $_SERVER["SCRIPT_NAME"])) { + $this->href = "index.php" . $this->href; + } else { + $this->href = $_SERVER["SCRIPT_NAME"] . $this->href; + } } } From 60e8619d216f3d8bcbf888b04abfb4d757c4384b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 4 Apr 2013 21:12:52 +0200 Subject: [PATCH 33/86] Prepare release --- base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base.php b/base.php index 321106e..b2c0c98 100644 --- a/base.php +++ b/base.php @@ -6,7 +6,7 @@ * @author Sbastien Lucas */ -define ("VERSION", "0.3.4"); +define ("VERSION", "0.3.5"); define ("DB", "db"); date_default_timezone_set($config['default_timezone']); From d01b23b615c51d4e13462365a5be489899b495b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 4 Apr 2013 21:18:33 +0200 Subject: [PATCH 34/86] Document multi database support. re #40 --- config_default.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config_default.php b/config_default.php index 4380c2a..9c2b8b3 100644 --- a/config_default.php +++ b/config_default.php @@ -13,6 +13,8 @@ * The directory containing calibre's metadata.db file, with sub-directories * containing all the formats. * BEWARE : it has to end with a / + * You can enable multiple database with this notation : + * array ("My database name" => "/home/directory/calibre1/", "My other database name" => "/home/directory/calibre2/"); */ $config['calibre_directory'] = './'; From ad115f08c3a90fcbc0a669f775013cc3cda543b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 5 Apr 2013 08:14:44 +0200 Subject: [PATCH 35/86] Should fix url rewriting with multi database. re #40 --- .htaccess | 6 ++++-- data.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.htaccess b/.htaccess index 0603a65..d124065 100644 --- a/.htaccess +++ b/.htaccess @@ -19,8 +19,10 @@ RewriteEngine on -RewriteRule ^download/(.*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L] -RewriteRule ^download/(.*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L] +RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L] +RewriteRule ^download/(\d*)/(\d*)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3 [L] +RewriteRule ^download/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L] +RewriteRule ^download/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L] ########################################### diff --git a/data.php b/data.php index eb2e41b..0430bd8 100644 --- a/data.php +++ b/data.php @@ -95,10 +95,12 @@ class Data extends Base { if ($config['cops_use_url_rewriting'] == "1") { + $database = ""; + if (!is_null (GetUrlParam (DB))) $database = GetUrlParam (DB) . "/"; if ($config['cops_provide_kepub'] == "1" && preg_match("/Kobo/", $_SERVER['HTTP_USER_AGENT'])) { - return "download/" . $this->id . "/" . urlencode ($this->getUpdatedFilenameKepub ()); + return "download/" . $this->id . "/" . $database . urlencode ($this->getUpdatedFilenameKepub ()); } else { - return "download/" . $this->id . "/" . urlencode ($this->getFilename ()); + return "download/" . $this->id . "/" . $database . urlencode ($this->getFilename ()); } } else From cd03b499549333bdce1d257bbe0eff2024191401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 8 Apr 2013 17:28:45 +0200 Subject: [PATCH 36/86] Fix book search with multidatabase. re #40 --- index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.php b/index.php index dd0589d..fd4d835 100644 --- a/index.php +++ b/index.php @@ -29,6 +29,7 @@ $query = getURLParam ("query"); $qid = getURLParam ("id"); $n = getURLParam ("n", "1"); + $database = GetUrlParam (DB); $currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage->InitializeContent (); @@ -176,6 +177,9 @@
    + + +
    From 868a1b1d4750352673f5abb5d14034e93df5600c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 8 Apr 2013 17:29:31 +0200 Subject: [PATCH 37/86] Add a test for the presence of libxml (not really needed in most cases). --- checkconfig.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/checkconfig.php b/checkconfig.php index 75cd05d..8a36162 100644 --- a/checkconfig.php +++ b/checkconfig.php @@ -74,6 +74,18 @@ ?> +
    +
    Check if libxml is properly installed and loaded
    +
    + +
    +
    $database) { From 7483132dc72bc77a3ddbe6f62c4a29255ef2abc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 9 Apr 2013 10:58:01 +0200 Subject: [PATCH 38/86] Update configuration documentation. re #40 --- config_default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config_default.php b/config_default.php index 9c2b8b3..dff7908 100644 --- a/config_default.php +++ b/config_default.php @@ -13,8 +13,8 @@ * The directory containing calibre's metadata.db file, with sub-directories * containing all the formats. * BEWARE : it has to end with a / - * You can enable multiple database with this notation : - * array ("My database name" => "/home/directory/calibre1/", "My other database name" => "/home/directory/calibre2/"); + * You can enable multiple database with this notation instead of a simple string : + * $config['calibre_directory'] = array ("My database name" => "/home/directory/calibre1/", "My other database name" => "/home/directory/calibre2/"); */ $config['calibre_directory'] = './'; From 893855a81d87959f510e7e2701259c4a73649605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 9 Apr 2013 21:29:43 +0200 Subject: [PATCH 39/86] Hopefully fix the book summary problem with Wamp. re #45 --- base.php | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/base.php b/base.php index b2c0c98..a1b7e7c 100644 --- a/base.php +++ b/base.php @@ -28,19 +28,6 @@ function xml2xhtml($xml) { '), $xml); } -function is_utf8($string) { -return preg_match('%^(?: -[\x09\x0A\x0D\x20-\x7E] # ASCII -| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte -| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs -| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte -| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates -| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 -| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 -| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 -)*$%xs', $string); -} - function display_xml_error($error) { $return .= str_repeat('-', $error->column) . "^\n"; @@ -81,7 +68,6 @@ function are_libxml_errors_ok () function html2xhtml ($html) { $doc = new DOMDocument(); libxml_use_internal_errors(true); - if (is_utf8($html)) { $doc->loadHTML('' . $html . ''); // Load the HTML $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream @@ -89,16 +75,6 @@ function html2xhtml ($html) { if (preg_match ('#(.*)#ms', $output, $matches)) { $output = $matches [1]; // Remove } - } else { - $doc->loadHTML($html); // Load the HTML - $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream - $output = xml2xhtml($output); - $output = xml2xhtml($output); - if (preg_match ('#(.*)#ms', $output, $matches)) { - $output = $matches [1]; // Remove - } - } - /* // In case of error with summary, use it to debug $errors = libxml_get_errors(); @@ -110,7 +86,7 @@ function html2xhtml ($html) { if (!are_libxml_errors_ok ()) $output = "HTML code not valid."; - + libxml_use_internal_errors(false); return $output; } From 16c85418c0c712d0c213f6a030df55e0d483a861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 9 Apr 2013 21:30:33 +0200 Subject: [PATCH 40/86] Reindent. re #55 --- base.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/base.php b/base.php index a1b7e7c..575eefc 100644 --- a/base.php +++ b/base.php @@ -68,13 +68,14 @@ function are_libxml_errors_ok () function html2xhtml ($html) { $doc = new DOMDocument(); libxml_use_internal_errors(true); - $doc->loadHTML('' . - $html . ''); // Load the HTML - $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream - $output = xml2xhtml($output); - if (preg_match ('#(.*)#ms', $output, $matches)) { - $output = $matches [1]; // Remove - } + + $doc->loadHTML('' . + $html . ''); // Load the HTML + $output = $doc->saveXML($doc->documentElement); // Transform to an Ansi xml stream + $output = xml2xhtml($output); + if (preg_match ('#(.*)#ms', $output, $matches)) { + $output = $matches [1]; // Remove + } /* // In case of error with summary, use it to debug $errors = libxml_get_errors(); From 1a501e3c6c640314197522c126df13ef78ae824d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 17 Apr 2013 13:36:19 +0200 Subject: [PATCH 41/86] Fix database title with multiple database. re #40 --- base.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/base.php b/base.php index 575eefc..a1273c1 100644 --- a/base.php +++ b/base.php @@ -380,6 +380,8 @@ class Page } } $this->entryArray = array_merge ($this->entryArray, Book::getCount()); + + if (!is_null ($database)) $this->title = Base::getDbName (); } } @@ -625,7 +627,17 @@ abstract class Base return array ("" => $config['calibre_directory']); } } - + + public static function getDbName ($database = NULL) { + global $config; + if (is_array ($config['calibre_directory'])) { + if (is_null ($database)) $database = GetUrlParam (DB, 0); + $array = array_keys ($config['calibre_directory']); + return $array[$database]; + } + return ""; + } + public static function getDbDirectory ($database = NULL) { global $config; if (is_array ($config['calibre_directory'])) { From 89c353dd07d6f33279877fb49108d6a86a26addb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 17 Apr 2013 13:42:23 +0200 Subject: [PATCH 42/86] Add a config item to use local resources instead of CDN hosted resources. --- config_default.php | 8 ++++++++ index.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/config_default.php b/config_default.php index dff7908..e8dabb7 100644 --- a/config_default.php +++ b/config_default.php @@ -166,4 +166,12 @@ * 0 : No */ $config['cops_provide_kepub'] = "0"; + + /* + * Use local JS resources instead if external resources hosted on CDN + * 1 : Yes (enable) + * 0 : No + */ + $config['cops_use_local_resources'] = "0"; + ?> \ No newline at end of file diff --git a/index.php b/index.php index fd4d835..cddfaf1 100644 --- a/index.php +++ b/index.php @@ -54,7 +54,11 @@ <?php echo htmlspecialchars ($currentPage->title) ?> + + + + From 56516960ce59672d7e089f38f8cc44070418990b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Wed, 17 Apr 2013 14:12:10 +0200 Subject: [PATCH 43/86] Clicking on home with multidatabase allow to stay in current database. re #40 --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index cddfaf1..cea86cc 100644 --- a/index.php +++ b/index.php @@ -160,7 +160,7 @@
    From 1bbfa09224abd4e29adfe107c83c10b219eb20bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Thu, 18 Apr 2013 15:24:23 +0200 Subject: [PATCH 44/86] Update to latest version of the library. --- epub.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/epub.php b/epub.php index c3927a5..46b5804 100644 --- a/epub.php +++ b/epub.php @@ -12,7 +12,9 @@ define ("METADATA_FILE", "META-INF/container.xml"); class EPub { public $xml; //FIXME change to protected, later + public $toc; protected $xpath; + protected $toc_xpath; protected $file; protected $meta; protected $zip; @@ -65,6 +67,26 @@ class EPub { $this->xml->formatOutput = true; $this->xpath = new EPubDOMXPath($this->xml); } + + public function initSpineComponent () + { + $spine = $this->xpath->query('//opf:spine')->item(0); + $tocid = $spine->getAttribute('toc'); + $tochref = $this->xpath->query("//opf:manifest/opf:item[@id='$tocid']")->item(0)->attr('href'); + $tocpath = dirname($this->meta).'/'.$tochref; + // read epub toc + if (!$this->zip->FileExists($tocpath)) { + throw new Exception ("Unable to find " . $tocpath); + } + + $data = $this->zip->FileRead($tocpath); + $this->toc = new DOMDocument(); + $this->toc->registerNodeClass('DOMElement','EPubDOMElement'); + $this->toc->loadXML($data); + $this->toc_xpath = new EPubDOMXPath($this->toc); + $rootNamespace = $this->toc->lookupNamespaceUri($this->toc->namespaceURI); + $this->toc_xpath->registerNamespace('x', $rootNamespace); + } /** * file name getter @@ -82,6 +104,9 @@ class EPub { $this->zip->Close (); } + /** + * Remove iTunes files + */ public function cleanITunesCrap () { if ($this->zip->FileExists("iTunesMetadata.plist")) { $this->zip->FileReplace ("iTunesMetadata.plist", false); @@ -111,7 +136,48 @@ class EPub { } if ($file) $this->zip->Flush(TBSZIP_DOWNLOAD, $file); } + + /** + * Get the components list as an array + */ + public function components(){ + $spine = array(); + $nodes = $this->xpath->query('//opf:spine/opf:itemref'); + foreach($nodes as $node){ + $idref = $node->getAttribute('idref'); + $spine[] = $this->xpath->query("//opf:manifest/opf:item[@id='$idref']")->item(0)->getAttribute('href'); + } + return $spine; + } + /** + * Get the component content + */ + public function component($comp) { + $path = dirname($this->meta).'/'.$comp; + if (!$this->zip->FileExists($path)) { + throw new Exception ("Unable to find " . $path); + } + + $data = $this->zip->FileRead($path); + return $data; + } + + /** + * Get the Epub content (TOC) as an array + * + * For each chapter there is a "title" and a "src" + */ + public function contents(){ + $contents = array(); + $nodes = $this->toc_xpath->query('//x:ncx/x:navMap/x:navPoint'); + foreach($nodes as $node){ + $title = $this->toc_xpath->query('x:navLabel/x:text', $node)->item(0)->nodeValue; + $src = $this->toc_xpath->query('x:content', $node)->item(0)->attr('src'); + $contents[] = array("title" => $title, "src" => $src); + } + return $contents; + } /** From e03d9bf23dd563715e068cd36bc93e5a9b180c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 19 Apr 2013 14:28:18 +0200 Subject: [PATCH 45/86] Update to latest version --- epub.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/epub.php b/epub.php index 46b5804..f0aabb8 100644 --- a/epub.php +++ b/epub.php @@ -85,7 +85,7 @@ class EPub { $this->toc->loadXML($data); $this->toc_xpath = new EPubDOMXPath($this->toc); $rootNamespace = $this->toc->lookupNamespaceUri($this->toc->namespaceURI); - $this->toc_xpath->registerNamespace('x', $rootNamespace); + $this->toc_xpath->registerNamespace('x', $rootNamespace); } /** @@ -160,8 +160,17 @@ class EPub { } $data = $this->zip->FileRead($path); + $data = preg_replace ("/src=[\"']([\w\/\.]*?)[\"']/", "src='epubfs.php?comp=$1'", $data); + $data = preg_replace ("/href=[\"']([\w\/\.]*?)[\"']/", "href='epubfs.php?comp=$1'", $data); return $data; } + + /** + * Get the component content type + */ + public function componentContentType($comp) { + return $this->xpath->query("//opf:manifest/opf:item[@href='$comp']")->item(0)->getAttribute('media-type'); + } /** * Get the Epub content (TOC) as an array From cce56e91ca4e3cbe39be8faf87a24b509e4b99f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Fri, 19 Apr 2013 15:23:03 +0200 Subject: [PATCH 46/86] Forgot to commit local jquery file :(. --- js/jquery-1.9.1.min.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 js/jquery-1.9.1.min.js diff --git a/js/jquery-1.9.1.min.js b/js/jquery-1.9.1.min.js new file mode 100644 index 0000000..006e953 --- /dev/null +++ b/js/jquery-1.9.1.min.js @@ -0,0 +1,5 @@ +/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license +//@ sourceMappingURL=jquery.min.map +*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
    a",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="
    t
    ",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
    ",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; +return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="
    ",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:b.support.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) +}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("",error:'

    The requested content cannot be loaded.
    Please try again later.

    ',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, -openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, -isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, -c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& -k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| -b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= -setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({}, -e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"), -b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
    ').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked|| -!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k= -e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d, -e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&& -(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive= -!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); -if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= -this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g, -(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a= -b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents(); -e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
    ").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
    ').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", -!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow"); -a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth, -v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x", -"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),cA||p>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&jA||p>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
    ').appendTo("body"); -this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()}, -close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0, -!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed|| -this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('
    '+e+"
    ");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"), -H&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+ -'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('
    ').appendTo("body"),b=a.children(), -b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('
    ').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery); \ No newline at end of file +(function(l,o,i,e){var d=i(l),a=i(o),p=i.fancybox=function(){p.open.apply(this,arguments)},k=navigator.userAgent.match(/msie/i),c=null,f=o.createTouch!==e,j=function(q){return q&&q.hasOwnProperty&&q instanceof i},b=function(q){return q&&i.type(q)==="string"},m=function(q){return b(q)&&q.indexOf("%")>0},h=function(q){return(q&&!(q.style.overflow&&q.style.overflow==="hidden")&&((q.clientWidth&&q.scrollWidth>q.clientWidth)||(q.clientHeight&&q.scrollHeight>q.clientHeight)))},n=function(s,r){var q=parseInt(s,10)||0;if(r&&m(s)){q=p.getViewport()[r]/100*q}return Math.ceil(q)},g=function(q,r){return n(q,r)+"px"};i.extend(p,{version:"2.1.4",defaults:{padding:15,margin:20,width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,autoSize:true,autoHeight:false,autoWidth:false,autoResize:true,autoCenter:!f,fitToView:true,aspectRatio:false,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:true,closeBtn:true,closeClick:false,nextClick:false,mouseWheel:true,autoPlay:false,playSpeed:3000,preload:3,modal:false,loop:true,ajax:{dataType:"html",headers:{"X-fancyBox":true}},iframe:{scrolling:"auto",preload:true},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:true,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'
    ',image:'',iframe:'",error:'

    The requested content cannot be loaded.
    Please try again later.

    ',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:true,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:true,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:true,title:true},onCancel:i.noop,beforeLoad:i.noop,afterLoad:i.noop,beforeShow:i.noop,afterShow:i.noop,beforeChange:i.noop,beforeClose:i.noop,afterClose:i.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:false,isOpen:false,isOpened:false,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:false},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(r,q){if(!r){return}if(!i.isPlainObject(q)){q={}}if(false===p.close(true)){return}if(!i.isArray(r)){r=j(r)?i(r).get():[r]}i.each(r,function(w,x){var v={},s,A,y,z,u,B,t;if(i.type(x)==="object"){if(x.nodeType){x=i(x)}if(j(x)){v={href:x.data("fancybox-href")||x.attr("href"),title:x.data("fancybox-title")||x.attr("title"),isDom:true,element:x};if(i.metadata){i.extend(true,v,x.metadata())}}else{v=x}}s=q.href||v.href||(b(x)?x:null);A=q.title!==e?q.title:v.title||"";y=q.content||v.content;z=y?"html":(q.type||v.type);if(!z&&v.isDom){z=x.data("fancybox-type");if(!z){u=x.prop("class").match(/fancybox\.(\w+)/);z=u?u[1]:null}}if(b(s)){if(!z){if(p.isImage(s)){z="image"}else{if(p.isSWF(s)){z="swf"}else{if(s.charAt(0)==="#"){z="inline"}else{if(b(x)){z="html";y=x}}}}}if(z==="ajax"){B=s.split(/\s+/,2);s=B.shift();t=B.shift()}}if(!y){if(z==="inline"){if(s){y=i(b(s)?s.replace(/.*(?=#[^\s]+$)/,""):s)}else{if(v.isDom){y=x}}}else{if(z==="html"){y=s}else{if(!z&&!s&&v.isDom){z="inline";y=x}}}}i.extend(v,{href:s,type:z,content:y,title:A,selector:t});r[w]=v});p.opts=i.extend(true,{},p.defaults,q);if(q.keys!==e){p.opts.keys=q.keys?i.extend({},p.defaults.keys,q.keys):false}p.group=r;return p._start(p.opts.index)},cancel:function(){var q=p.coming;if(!q||false===p.trigger("onCancel")){return}p.hideLoading();if(p.ajaxLoad){p.ajaxLoad.abort()}p.ajaxLoad=null;if(p.imgPreload){p.imgPreload.onload=p.imgPreload.onerror=null}if(q.wrap){q.wrap.stop(true,true).trigger("onReset").remove()}p.coming=null;if(!p.current){p._afterZoomOut(q)}},close:function(q){p.cancel();if(false===p.trigger("beforeClose")){return}p.unbindEvents();if(!p.isActive){return}if(!p.isOpen||q===true){i(".fancybox-wrap").stop(true).trigger("onReset").remove();p._afterZoomOut()}else{p.isOpen=p.isOpened=false;p.isClosing=true;i(".fancybox-item, .fancybox-nav").remove();p.wrap.stop(true,true).removeClass("fancybox-opened");p.transitions[p.current.closeMethod]()}},play:function(s){var q=function(){clearTimeout(p.player.timer)},u=function(){q();if(p.current&&p.player.isActive){p.player.timer=setTimeout(p.next,p.current.playSpeed)}},r=function(){q();a.unbind(".player");p.player.isActive=false;p.trigger("onPlayEnd")},t=function(){if(p.current&&(p.current.loop||p.current.index=s.index?"next":"prev")];p.router=q||"jumpto";if(s.loop){if(r<0){r=s.group.length+(r%s.group.length)}r=r%s.group.length}if(s.group[r]!==e){p.cancel();p._start(r)}},reposition:function(t,q){var s=p.current,r=s?s.wrap:null,u;if(r){u=p._getPosition(q);if(t&&t.type==="scroll"){delete u.position;r.stop(true,true).animate(u,200)}else{r.css(u);s.pos=i.extend({},s.dim,u)}}},update:function(s){var q=(s&&s.type),r=!q||q==="orientationchange";if(r){clearTimeout(c);c=null}if(!p.isOpen||c){return}c=setTimeout(function(){var t=p.current;if(!t||p.isClosing){return}p.wrap.removeClass("fancybox-tmp");if(r||q==="load"||(q==="resize"&&t.autoResize)){p._setDimension()}if(!(q==="scroll"&&t.canShrink)){p.reposition(s)}p.trigger("onUpdate");c=null},(r&&!f?0:300))},toggle:function(q){if(p.isOpen){p.current.fitToView=i.type(q)==="boolean"?q:!p.current.fitToView;if(f){p.wrap.removeAttr("style").addClass("fancybox-tmp");p.trigger("onUpdate")}p.update()}},hideLoading:function(){a.unbind(".loading");i("#fancybox-loading").remove()},showLoading:function(){var r,q;p.hideLoading();r=i('
    ').click(p.cancel).appendTo("body");a.bind("keydown.loading",function(s){if((s.which||s.keyCode)===27){s.preventDefault();p.cancel()}});if(!p.defaults.fixed){q=p.getViewport();r.css({position:"absolute",top:(q.h*0.5)+q.y,left:(q.w*0.5)+q.x})}},getViewport:function(){var q=(p.current&&p.current.locked)||false,r={x:d.scrollLeft(),y:d.scrollTop()};if(q){r.w=q[0].clientWidth;r.h=q[0].clientHeight}else{r.w=f&&l.innerWidth?l.innerWidth:d.width();r.h=f&&l.innerHeight?l.innerHeight:d.height()}return r},unbindEvents:function(){if(p.wrap&&j(p.wrap)){p.wrap.unbind(".fb")}a.unbind(".fb");d.unbind(".fb")},bindEvents:function(){var r=p.current,q;if(!r){return}d.bind("orientationchange.fb"+(f?"":" resize.fb")+(r.autoCenter&&!r.locked?" scroll.fb":""),p.update);q=r.keys;if(q){a.bind("keydown.fb",function(u){var s=u.which||u.keyCode,t=u.target||u.srcElement;if(s===27&&p.coming){return false}if(!u.ctrlKey&&!u.altKey&&!u.shiftKey&&!u.metaKey&&!(t&&(t.type||i(t).is("[contenteditable]")))){i.each(q,function(v,w){if(r.group.length>1&&w[s]!==e){p[v](w[s]);u.preventDefault();return false}if(i.inArray(s,w)>-1){p[v]();u.preventDefault();return false}})}})}if(i.fn.mousewheel&&r.mouseWheel){p.wrap.bind("mousewheel.fb",function(x,y,t,s){var w=x.target||null,u=i(w),v=false;while(u.length){if(v||u.is(".fancybox-skin")||u.is(".fancybox-wrap")){break}v=h(u[0]);u=i(u).parent()}if(y!==0&&!v){if(p.group.length>1&&!r.canShrink){if(s>0||t>0){p.prev(s>0?"down":"left")}else{if(s<0||t<0){p.next(s<0?"up":"right")}}x.preventDefault()}}})}},trigger:function(r,t){var q,s=t||p.coming||p.current;if(!s){return}if(i.isFunction(s[r])){q=s[r].apply(s,Array.prototype.slice.call(arguments,1))}if(q===false){return false}if(s.helpers){i.each(s.helpers,function(v,u){if(u&&p.helpers[v]&&i.isFunction(p.helpers[v][r])){u=i.extend(true,{},p.helpers[v].defaults,u);p.helpers[v][r](u,s)}})}a.trigger(r)},isImage:function(q){return b(q)&&q.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(q){return b(q)&&q.match(/\.(swf)((\?|#).*)?$/i)},_start:function(r){var s={},w,q,t,u,v;r=n(r);w=p.group[r]||null;if(!w){return false}s=i.extend(true,{},p.opts,w);u=s.margin;v=s.padding;if(i.type(u)==="number"){s.margin=[u,u,u,u]}if(i.type(v)==="number"){s.padding=[v,v,v,v]}if(s.modal){i.extend(true,s,{closeBtn:false,closeClick:false,nextClick:false,arrows:false,mouseWheel:false,keys:null,helpers:{overlay:{closeClick:false}}})}if(s.autoSize){s.autoWidth=s.autoHeight=true}if(s.width==="auto"){s.autoWidth=true}if(s.height==="auto"){s.autoHeight=true}s.group=p.group;s.index=r;p.coming=s;if(false===p.trigger("beforeLoad")){p.coming=null;return}t=s.type;q=s.href;if(!t){p.coming=null;if(p.current&&p.router&&p.router!=="jumpto"){p.current.index=r;return p[p.router](p.direction)}return false}p.isActive=true;if(t==="image"||t==="swf"){s.autoHeight=s.autoWidth=false;s.scrolling="visible"}if(t==="image"){s.aspectRatio=true}if(t==="iframe"&&f){s.scrolling="scroll"}s.wrap=i(s.tpl.wrap).addClass("fancybox-"+(f?"mobile":"desktop")+" fancybox-type-"+t+" fancybox-tmp "+s.wrapCSS).appendTo(s.parent||"body");i.extend(s,{skin:i(".fancybox-skin",s.wrap),outer:i(".fancybox-outer",s.wrap),inner:i(".fancybox-inner",s.wrap)});i.each(["Top","Right","Bottom","Left"],function(y,x){s.skin.css("padding"+x,g(s.padding[y]))});p.trigger("onReady");if(t==="inline"||t==="html"){if(!s.content||!s.content.length){return p._error("content")}}else{if(!q){return p._error("href")}}if(t==="image"){p._loadImage()}else{if(t==="ajax"){p._loadAjax()}else{if(t==="iframe"){p._loadIframe()}else{p._afterLoad()}}}},_error:function(q){i.extend(p.coming,{type:"html",autoWidth:true,autoHeight:true,minWidth:0,minHeight:0,scrolling:"no",hasError:q,content:p.coming.tpl.error});p._afterLoad()},_loadImage:function(){var q=p.imgPreload=new Image();q.onload=function(){this.onload=this.onerror=null;p.coming.width=this.width;p.coming.height=this.height;p._afterLoad()};q.onerror=function(){this.onload=this.onerror=null;p._error("image")};q.src=p.coming.href;if(q.complete!==true){p.showLoading()}},_loadAjax:function(){var q=p.coming;p.showLoading();p.ajaxLoad=i.ajax(i.extend({},q.ajax,{url:q.href,error:function(r,s){if(p.coming&&s!=="abort"){p._error("ajax",r)}else{p.hideLoading()}},success:function(r,s){if(s==="success"){q.content=r;p._afterLoad()}}}))},_loadIframe:function(){var q=p.coming,r=i(q.tpl.iframe.replace(/\{rnd\}/g,new Date().getTime())).attr("scrolling",f?"auto":q.iframe.scrolling).attr("src",q.href);i(q.wrap).bind("onReset",function(){try{i(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(s){}});if(q.iframe.preload){p.showLoading();r.one("load",function(){i(this).data("ready",1);if(!f){i(this).bind("load.fb",p.update)}i(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();p._afterLoad()})}q.content=r.appendTo(q.inner);if(!q.iframe.preload){p._afterLoad()}},_preloadImages:function(){var v=p.group,u=p.current,q=v.length,s=u.preload?Math.min(u.preload,q-1):0,t,r;for(r=1;r<=s;r+=1){t=v[(u.index+r)%q];if(t.type==="image"&&t.href){new Image().src=t.href}}},_afterLoad:function(){var r=p.coming,t=p.current,y="fancybox-placeholder",v,w,x,s,q,u;p.hideLoading();if(!r||p.isActive===false){return}if(false===p.trigger("afterLoad",r,t)){r.wrap.stop(true).trigger("onReset").remove();p.coming=null;return}if(t){p.trigger("beforeChange",t);t.wrap.stop(true).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove()}p.unbindEvents();v=r;w=r.content;x=r.type;s=r.scrolling;i.extend(p,{wrap:v.wrap,skin:v.skin,outer:v.outer,inner:v.inner,current:v,previous:t});q=v.href;switch(x){case"inline":case"ajax":case"html":if(v.selector){w=i("
    ").html(w).find(v.selector)}else{if(j(w)){if(!w.data(y)){w.data(y,i('
    ').insertAfter(w).hide())}w=w.show().detach();v.wrap.bind("onReset",function(){if(i(this).find(w).length){w.hide().replaceAll(w.data(y)).data(y,false)}})}}break;case"image":w=v.tpl.image.replace("{href}",q).replace("&","&");break;case"swf":w='';u="";i.each(v.swf,function(z,A){w+='';u+=" "+z+'="'+A+'"'});w+='";break}if(!(j(w)&&w.parent().is(v.inner))){v.inner.append(w)}p.trigger("beforeShow");v.inner.css("overflow",s==="yes"?"scroll":(s==="no"?"hidden":s));p._setDimension();p.reposition();p.isOpen=false;p.coming=null;p.bindEvents();if(!p.isOpened){i(".fancybox-wrap").not(v.wrap).stop(true).trigger("onReset").remove()}else{if(t.prevMethod){p.transitions[t.prevMethod]()}}p.transitions[p.isOpened?v.nextMethod:v.openMethod]();p._preloadImages()},_setDimension:function(){var T=p.getViewport(),P=0,V=false,X=false,B=p.wrap,N=p.skin,Y=p.inner,K=p.current,L=K.width,I=K.height,E=K.minWidth,x=K.minHeight,R=K.maxWidth,J=K.maxHeight,D=K.scrolling,v=K.scrollOutside?K.scrollbarWidth:0,H=K.margin,w=n(H[1]+H[3]),u=n(H[0]+H[2]),s,r,O,Q,G,F,M,z,y,U,t,W,q,A,C;B.add(N).add(Y).width("auto").height("auto").removeClass("fancybox-tmp");s=n(N.outerWidth(true)-N.width());r=n(N.outerHeight(true)-N.height());O=w+s;Q=u+r;G=m(L)?(T.w-O)*n(L)/100:L;F=m(I)?(T.h-Q)*n(I)/100:I;if(K.type==="iframe"){A=K.content;if(K.autoHeight&&A.data("ready")===1){try{if(A[0].contentWindow.document.location){Y.width(G).height(9999);C=A.contents().find("body");if(v){C.css("overflow-x","hidden")}F=C.height()}}catch(S){}}}else{if(K.autoWidth||K.autoHeight){Y.addClass("fancybox-tmp");if(!K.autoWidth){Y.width(G)}if(!K.autoHeight){Y.height(F)}if(K.autoWidth){G=Y.width()}if(K.autoHeight){F=Y.height()}Y.removeClass("fancybox-tmp")}}L=n(G);I=n(F);y=G/F;E=n(m(E)?n(E,"w")-O:E);R=n(m(R)?n(R,"w")-O:R);x=n(m(x)?n(x,"h")-Q:x);J=n(m(J)?n(J,"h")-Q:J);M=R;z=J;if(K.fitToView){R=Math.min(T.w-O,R);J=Math.min(T.h-Q,J)}W=T.w-w;q=T.h-u;if(K.aspectRatio){if(L>R){L=R;I=n(L/y)}if(I>J){I=J;L=n(I*y)}if(LW||t>q)&&L>E&&I>x){if(P++>19){break}I=Math.max(x,Math.min(J,I-10));L=n(I*y);if(LR){L=R;I=n(L/y)}Y.width(L).height(I);B.width(L+s);U=B.width();t=B.height()}}else{L=Math.max(E,Math.min(L,L-(U-W)));I=Math.max(x,Math.min(I,I-(t-q)))}}if(v&&D==="auto"&&IW||t>q)&&L>E&&I>x;X=K.aspectRatio?(Lx&&I1)){p.inner.css("cursor","pointer").bind("click.fb",function(r){if(!i(r.target).is("a")&&!i(r.target).parent().is("a")){r.preventDefault();p[q.closeClick?"close":"next"]()}})}if(q.closeBtn){i(q.tpl.closeBtn).appendTo(p.skin).bind("click.fb",function(r){r.preventDefault();p.close()})}if(q.arrows&&p.group.length>1){if(q.loop||q.index>0){i(q.tpl.prev).appendTo(p.outer).bind("click.fb",p.prev)}if(q.loop||q.index
    ').appendTo("body");this.fixed=false;if(q.fixed&&p.defaults.fixed){this.overlay.addClass("fancybox-overlay-fixed");this.fixed=true}},open:function(r){var q=this;r=i.extend({},this.defaults,r);if(this.overlay){this.overlay.unbind(".overlay").width("auto").height("auto")}else{this.create(r)}if(!this.fixed){d.bind("resize.overlay",i.proxy(this.update,this));this.update()}if(r.closeClick){this.overlay.bind("click.overlay",function(s){if(i(s.target).hasClass("fancybox-overlay")){if(p.isActive){p.close()}else{q.close()}}})}this.overlay.css(r.css).show()},close:function(){i(".fancybox-overlay").remove();d.unbind("resize.overlay");this.overlay=null;if(this.margin!==false){i("body").css("margin-right",this.margin);this.margin=false}if(this.el){this.el.removeClass("fancybox-lock")}},update:function(){var r="100%",q;this.overlay.width(r).height("100%");if(k){q=Math.max(o.documentElement.offsetWidth,o.body.offsetWidth);if(a.width()>q){r=a.width()}}else{if(a.width()>d.width()){r=a.width()}}this.overlay.width(r).height(a.height())},onReady:function(q,r){i(".fancybox-overlay").stop(true,true);if(!this.overlay){this.margin=a.height()>d.height()||i("body").css("overflow-y")==="scroll"?i("body").css("margin-right"):false;this.el=o.all&&!o.querySelector?i("html"):i("body");this.create(q)}if(q.locked&&this.fixed){r.locked=this.overlay.append(r.wrap);r.fixed=false}if(q.showEarly===true){this.beforeShow.apply(this,arguments)}},beforeShow:function(q,r){if(r.locked){this.el.addClass("fancybox-lock");if(this.margin!==false){i("body").css("margin-right",n(this.margin)+r.scrollbarWidth)}}this.open(q)},onUpdate:function(){if(!this.fixed){this.update()}},afterClose:function(q){if(this.overlay&&!p.isActive){this.overlay.fadeOut(q.speedOut,i.proxy(this.close,this))}}};p.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(r){var t=p.current,v=t.title,q=r.type,u,s;if(i.isFunction(v)){v=v.call(t.element,t)}if(!b(v)||i.trim(v)===""){return}u=i('
    '+v+"
    ");switch(q){case"inside":s=p.skin;break;case"outside":s=p.wrap;break;case"over":s=p.inner;break;default:s=p.skin;u.appendTo("body");if(k){u.width(u.width())}u.wrapInner('');p.current.margin[2]+=Math.abs(n(u.css("margin-bottom")));break}u[(r.position==="top"?"prependTo":"appendTo")](s)}};i.fn.fancybox=function(s){var r,t=i(this),q=this.selector||"",u=function(y){var x=i(this).blur(),v=r,w,z;if(!(y.ctrlKey||y.altKey||y.shiftKey||y.metaKey)&&!x.is(".fancybox-wrap")){w=s.groupAttr||"data-fancybox-group";z=x.attr(w);if(!z){w="rel";z=x.get(0)[w]}if(z&&z!==""&&z!=="nofollow"){x=q.length?i(q):t;x=x.filter("["+w+'="'+z+'"]');v=x.index(this)}s.index=v;if(p.open(x,s)!==false){y.preventDefault()}}};s=s||{};r=s.index||0;if(!q||s.live===false){t.unbind("click.fb-start").bind("click.fb-start",u)}else{a.undelegate(q,"click.fb-start").delegate(q+":not('.fancybox-item, .fancybox-nav')","click.fb-start",u)}this.filter("[data-fancybox-start=1]").trigger("click");return this};a.ready(function(){if(i.scrollbarWidth===e){i.scrollbarWidth=function(){var r=i('
    ').appendTo("body"),s=r.children(),q=s.innerWidth()-s.height(99).innerWidth();r.remove();return q}}if(i.support.fixedPosition===e){i.support.fixedPosition=(function(){var r=i('
    ').appendTo("body"),q=(r[0].offsetTop===20||r[0].offsetTop===15);r.remove();return q}())}i.extend(p.defaults,{scrollbarWidth:i.scrollbarWidth(),fixed:i.support.fixedPosition,parent:i("body")})})}(window,document,jQuery)); \ No newline at end of file From ea9c73c24494b9c8be7c0e2e4f4c84d96859303f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 6 May 2013 17:45:27 +0200 Subject: [PATCH 75/86] Remove the unneeded option to use CDN. it's too confusing and is not really needed. --- CHANGELOG | 2 +- config_default.php | 7 ------- index.php | 13 ++----------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6d24387..d885a27 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,6 @@ 0.3.5 - 201305?? * Add multiple database support. Check the documentation of $config['calibre_directory'] in config-default.php to see how ot enable it. - * Include jquery library in COPS's repository to be sure that COPS will work on LAN (without Internet access). You can enable CDN resources with $config['cops_use_local_resources']. + * Include jquery library in COPS's repository to be sure that COPS will work on LAN (without Internet access). * Prepare the switch to HTML5. Thanks to Thomas Severinsen for most of the code. * Update the locale strings to be more strict with plurals. Thanks to Tobias Auslnder for the code. * If Fancybox is not enabled ($config['cops_use_fancyapps'] = "0") then it's not used at all (even in the about box). diff --git a/config_default.php b/config_default.php index 340827c..ac5e721 100644 --- a/config_default.php +++ b/config_default.php @@ -166,12 +166,5 @@ * 0 : No */ $config['cops_provide_kepub'] = "0"; - - /* - * Use local JS resources instead if external resources hosted on CDN - * 1 : Yes (enable) - * 0 : No - */ - $config['cops_use_local_resources'] = "1"; ?> \ No newline at end of file diff --git a/index.php b/index.php index 7b9c8f9..e535a0b 100644 --- a/index.php +++ b/index.php @@ -54,21 +54,12 @@ <?php echo htmlspecialchars ($currentPage->title) ?> - - - - - - - - - + - - + From 700c27e0fcccb6cc131a91e50b5d9203c8972f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 6 May 2013 17:49:22 +0200 Subject: [PATCH 76/86] Move Fancybox to the resources directory. --HG-- rename : fancybox/blank.gif => resources/fancybox/blank.gif rename : fancybox/fancybox_loading.gif => resources/fancybox/fancybox_loading.gif rename : fancybox/fancybox_overlay.png => resources/fancybox/fancybox_overlay.png rename : fancybox/fancybox_sprite.png => resources/fancybox/fancybox_sprite.png rename : fancybox/helpers/fancybox_buttons.png => resources/fancybox/helpers/fancybox_buttons.png rename : fancybox/helpers/jquery.fancybox-buttons.css => resources/fancybox/helpers/jquery.fancybox-buttons.css rename : fancybox/helpers/jquery.fancybox-buttons.js => resources/fancybox/helpers/jquery.fancybox-buttons.js rename : fancybox/helpers/jquery.fancybox-media.js => resources/fancybox/helpers/jquery.fancybox-media.js rename : fancybox/helpers/jquery.fancybox-thumbs.css => resources/fancybox/helpers/jquery.fancybox-thumbs.css rename : fancybox/helpers/jquery.fancybox-thumbs.js => resources/fancybox/helpers/jquery.fancybox-thumbs.js rename : fancybox/jquery.fancybox.css => resources/fancybox/jquery.fancybox.css rename : fancybox/jquery.fancybox.pack.js => resources/fancybox/jquery.fancybox.pack.js --- index.php | 4 ++-- {fancybox => resources/fancybox}/blank.gif | Bin .../fancybox}/fancybox_loading.gif | Bin .../fancybox}/fancybox_overlay.png | Bin .../fancybox}/fancybox_sprite.png | Bin .../fancybox}/helpers/fancybox_buttons.png | Bin .../fancybox}/helpers/jquery.fancybox-buttons.css | 0 .../fancybox}/helpers/jquery.fancybox-buttons.js | 0 .../fancybox}/helpers/jquery.fancybox-media.js | 0 .../fancybox}/helpers/jquery.fancybox-thumbs.css | 0 .../fancybox}/helpers/jquery.fancybox-thumbs.js | 0 .../fancybox}/jquery.fancybox.css | 0 .../fancybox}/jquery.fancybox.pack.js | 0 13 files changed, 2 insertions(+), 2 deletions(-) rename {fancybox => resources/fancybox}/blank.gif (100%) rename {fancybox => resources/fancybox}/fancybox_loading.gif (100%) rename {fancybox => resources/fancybox}/fancybox_overlay.png (100%) rename {fancybox => resources/fancybox}/fancybox_sprite.png (100%) rename {fancybox => resources/fancybox}/helpers/fancybox_buttons.png (100%) rename {fancybox => resources/fancybox}/helpers/jquery.fancybox-buttons.css (100%) rename {fancybox => resources/fancybox}/helpers/jquery.fancybox-buttons.js (100%) rename {fancybox => resources/fancybox}/helpers/jquery.fancybox-media.js (100%) rename {fancybox => resources/fancybox}/helpers/jquery.fancybox-thumbs.css (100%) rename {fancybox => resources/fancybox}/helpers/jquery.fancybox-thumbs.js (100%) rename {fancybox => resources/fancybox}/jquery.fancybox.css (100%) rename {fancybox => resources/fancybox}/jquery.fancybox.pack.js (100%) diff --git a/index.php b/index.php index e535a0b..b42b07e 100644 --- a/index.php +++ b/index.php @@ -57,8 +57,8 @@ - - + + " media="screen" /> diff --git a/fancybox/blank.gif b/resources/fancybox/blank.gif similarity index 100% rename from fancybox/blank.gif rename to resources/fancybox/blank.gif diff --git a/fancybox/fancybox_loading.gif b/resources/fancybox/fancybox_loading.gif similarity index 100% rename from fancybox/fancybox_loading.gif rename to resources/fancybox/fancybox_loading.gif diff --git a/fancybox/fancybox_overlay.png b/resources/fancybox/fancybox_overlay.png similarity index 100% rename from fancybox/fancybox_overlay.png rename to resources/fancybox/fancybox_overlay.png diff --git a/fancybox/fancybox_sprite.png b/resources/fancybox/fancybox_sprite.png similarity index 100% rename from fancybox/fancybox_sprite.png rename to resources/fancybox/fancybox_sprite.png diff --git a/fancybox/helpers/fancybox_buttons.png b/resources/fancybox/helpers/fancybox_buttons.png similarity index 100% rename from fancybox/helpers/fancybox_buttons.png rename to resources/fancybox/helpers/fancybox_buttons.png diff --git a/fancybox/helpers/jquery.fancybox-buttons.css b/resources/fancybox/helpers/jquery.fancybox-buttons.css similarity index 100% rename from fancybox/helpers/jquery.fancybox-buttons.css rename to resources/fancybox/helpers/jquery.fancybox-buttons.css diff --git a/fancybox/helpers/jquery.fancybox-buttons.js b/resources/fancybox/helpers/jquery.fancybox-buttons.js similarity index 100% rename from fancybox/helpers/jquery.fancybox-buttons.js rename to resources/fancybox/helpers/jquery.fancybox-buttons.js diff --git a/fancybox/helpers/jquery.fancybox-media.js b/resources/fancybox/helpers/jquery.fancybox-media.js similarity index 100% rename from fancybox/helpers/jquery.fancybox-media.js rename to resources/fancybox/helpers/jquery.fancybox-media.js diff --git a/fancybox/helpers/jquery.fancybox-thumbs.css b/resources/fancybox/helpers/jquery.fancybox-thumbs.css similarity index 100% rename from fancybox/helpers/jquery.fancybox-thumbs.css rename to resources/fancybox/helpers/jquery.fancybox-thumbs.css diff --git a/fancybox/helpers/jquery.fancybox-thumbs.js b/resources/fancybox/helpers/jquery.fancybox-thumbs.js similarity index 100% rename from fancybox/helpers/jquery.fancybox-thumbs.js rename to resources/fancybox/helpers/jquery.fancybox-thumbs.js diff --git a/fancybox/jquery.fancybox.css b/resources/fancybox/jquery.fancybox.css similarity index 100% rename from fancybox/jquery.fancybox.css rename to resources/fancybox/jquery.fancybox.css diff --git a/fancybox/jquery.fancybox.pack.js b/resources/fancybox/jquery.fancybox.pack.js similarity index 100% rename from fancybox/jquery.fancybox.pack.js rename to resources/fancybox/jquery.fancybox.pack.js From 6cd2cf8f0acf71492e8ea9683530354923ad96dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 6 May 2013 18:30:04 +0200 Subject: [PATCH 77/86] Next version will be 0.4.0 --- CHANGELOG | 3 ++- base.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d885a27..d8220c2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -0.3.5 - 201305?? +0.4.0 - 201305?? * Add multiple database support. Check the documentation of $config['calibre_directory'] in config-default.php to see how ot enable it. * Include jquery library in COPS's repository to be sure that COPS will work on LAN (without Internet access). * Prepare the switch to HTML5. Thanks to Thomas Severinsen for most of the code. @@ -6,6 +6,7 @@ * If Fancybox is not enabled ($config['cops_use_fancyapps'] = "0") then it's not used at all (even in the about box). * Fix book comments if it contains UTF8 characters. Reported by Alain. * Link to the book permalink was not working correctly in some cases. Reported by celta. + * Moved some external resources to a resources directory. 0.3.4 - 20130327 * Hopefully fix metadata update. Beware you should remove the directory php-epub-meta if you have one. Thanks to Mario for his time. diff --git a/base.php b/base.php index 874569d..8e88f95 100644 --- a/base.php +++ b/base.php @@ -6,7 +6,7 @@ * @author Sbastien Lucas */ -define ("VERSION", "0.3.5"); +define ("VERSION", "0.4.0"); define ("DB", "db"); date_default_timezone_set($config['default_timezone']); From 8737278bccd5006f72618bd0434ec9ba0e4ab1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Mon, 6 May 2013 20:47:39 +0200 Subject: [PATCH 78/86] Add some credits. --- about.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/about.xml b/about.xml index 50f2507..35043ed 100644 --- a/about.xml +++ b/about.xml @@ -19,4 +19,11 @@

    You can also check COPS's topic on MobileRead forum.

    +
    Thanks
    +
    +

    Thanks a lot to Kovid Goyal for Calibre.

    + +

    And many thanks to all those who helped test COPS.

    +
    +
    \ No newline at end of file From 0e6320e5a3d8085779e8c2e2f47bd3188c10d2f3 Mon Sep 17 00:00:00 2001 From: wogong Date: Tue, 7 May 2013 09:18:07 +0800 Subject: [PATCH 79/86] remove debug codes --- base.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/base.php b/base.php index 981cfb6..8a5a49f 100644 --- a/base.php +++ b/base.php @@ -140,12 +140,8 @@ function localize($phrase, $count=-1) { $lang_file_en = 'lang/' . 'Localization_en.json'; } $lang_file_content = file_get_contents($lang_file); - //var_dump($lang_file); - //var_dump($lang_file_content); /* Load the language file as a JSON object and transform it into an associative array */ $translations = json_decode($lang_file_content, true); - //var_dump($translations['boolean.no']); - //var_dump($translations['authors.title']); if ($lang_file_en) { $lang_file_content = file_get_contents($lang_file_en); From 9908d8e8fa3d45e5e46bc16a2026ba92d605aec6 Mon Sep 17 00:00:00 2001 From: wogong Date: Tue, 7 May 2013 09:30:03 +0800 Subject: [PATCH 80/86] update Localization_zh.json --- lang/Localization_zh.json | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/lang/Localization_zh.json b/lang/Localization_zh.json index c2f57eb..5e6e40f 100644 --- a/lang/Localization_zh.json +++ b/lang/Localization_zh.json @@ -5,7 +5,7 @@ "home.title":"目录", "link.fullentry":"全部条目", "title.nextpage":"下一页 ({0} of {1})", -"title.lastpage":"最后一页 (last)", +"title.lastpage":"最后一页", "title.numberOfPages":"{0} (共 {1} 页)", "pubdate.title":"出版时间", "bookword.title":"书名", @@ -20,40 +20,40 @@ "taglevelword.none":"No tag level", "taglevelword.one":"1 tag level", "taglevelword.many":"{0} tag levels", -"seriesword.title":"Series", -"seriesword.none":"No series", -"seriesword.one":"1 series", -"seriesword.many":"{0} series", +"seriesword.title":"系列", +"seriesword.none":"没有系列", +"seriesword.one":"1 个系列", +"seriesword.many":"{0} 系列", "tagword.title":"标签", "tagword.none":"没有标签", -"tagword.one":"1 tag", -"tagword.many":"{0} tags", -"content.tags":"Tags:", -"content.series":"Series:", -"content.series.data":"Book {0} in the {1} series", -"content.publisher":"Publisher:", +"tagword.one":"1 个标签", +"tagword.many":"{0} 标签", +"content.tags":"标签:", +"content.series":"系列:", +"content.series.data":"{0} 系列的第 {0} 本", +"content.publisher":"出版社:", "content.published":"出版时间", -"content.added":"Added: ", -"content.modified":"Modified:", -"content.publisher.data":"Published {1} by {0}", +"content.added":"添加了: ", +"content.modified":"修改了:", +"content.publisher.data":"由 {0} 出版于 {1}", "content.summary":"概要", "bookentry.series":"Book {0} in the {1} series", -"bookentry.author":"{0} by {1}", -"bookentry.tags":"{0} in {1}", -"bookentry.ratings":"{0} rated {1}", -"bookentry.goodreads":"This book on Goodreads", -"bookentry.goodreads.review":"Review this book on Goodreads", -"bookentry.goodreads.author":"{0} on Goodreads", -"bookentry.wikipedia":"This book on Wikipedia", -"bookentry.wikipedia.author":"{0} on Wikipedia", -"bookentry.librarything":"This book on LibraryThing", -"bookentry.librarything.author":"{0} on LibraryThing", -"bookentry.amazon":"This book on Amazon", -"bookentry.amazon.author":"{0} on Amazon", -"bookentry.isfdb.author":"{0} on ISFDB", -"bookentry.download":"Download this ebook as {0}", +"bookentry.author":"{0} 由作者 {1}", +"bookentry.tags":"{0} 在标签 {1}", +"bookentry.ratings":"{0} 评分 {1}", +"bookentry.goodreads":"Goodreads 上的这本书", +"bookentry.goodreads.review":"在 Goodreads上评论这本书", +"bookentry.goodreads.author":"{0} 在 Goodreads", +"bookentry.wikipedia":"维基百科上的这本书", +"bookentry.wikipedia.author":"{0} 在维基百科上", +"bookentry.librarything":"LibraryThing 上的这本书", +"bookentry.librarything.author":"{0} 在 LibraryThing", +"bookentry.amazon":"Amazon上的这本书", +"bookentry.amazon.author":"{0} 在 Amazon", +"bookentry.isfdb.author":"{0} 在 ISFDB", +"bookentry.download":"下载这本书 {0}", "bookentry.rated":"{0} {1}", -"bookentry.fullentrylink":"Full entry", +"bookentry.fullentrylink":"全部条目", "tags.title":"标签", "tags.categorized":"Categorized index of the {0} tags", "tags.categorized.single":"Categorized index of the single tag - very useful indeed ;)", From a63e3aded350aecc18b049dfbb13f72e33458760 Mon Sep 17 00:00:00 2001 From: wogong Date: Tue, 7 May 2013 09:40:21 +0800 Subject: [PATCH 81/86] update zh --- lang/Localization_zh.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/Localization_zh.json b/lang/Localization_zh.json index 5e6e40f..1e5960a 100644 --- a/lang/Localization_zh.json +++ b/lang/Localization_zh.json @@ -1,7 +1,7 @@ { "boolean.no":"否", "boolean.yes":"是", -"splitByLetter.letter":"{0} 以 {1} 开始", +"splitByLetter.letter":"{0} 以 {1} 开头", "home.title":"目录", "link.fullentry":"全部条目", "title.nextpage":"下一页 ({0} of {1})", From 4c3f9b2820cc3bd86d9337c87317f194e7b46668 Mon Sep 17 00:00:00 2001 From: wogong Date: Tue, 7 May 2013 16:29:17 +0800 Subject: [PATCH 82/86] zh localize almost done --- base.php | 2 +- lang/Localization_zh.json | 44 +++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/base.php b/base.php index 8a5a49f..992fa8b 100644 --- a/base.php +++ b/base.php @@ -126,7 +126,7 @@ function localize($phrase, $count=-1) { static $translations = NULL; /* If no instance of $translations has occured load the language file */ if (is_null($translations)) { - $lang = "zh"; + $lang = "en"; if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { //$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); diff --git a/lang/Localization_zh.json b/lang/Localization_zh.json index 1e5960a..b0ad7aa 100644 --- a/lang/Localization_zh.json +++ b/lang/Localization_zh.json @@ -60,29 +60,29 @@ "tags.alphabetical.many":"{0} 个标签的字母索引", "tags.alphabetical.one":"Alphabetical index of the single tag - very useful indeed ;)", "tags.alphabetical.none":"Alphabetical index of absolutely no tag - very useful indeed ;)", -"splitByLetter.tag.other":"Other tags", -"authors.series.title":"Series: {0}", +"splitByLetter.tag.other":"其他标签", +"authors.series.title":"系列: {0}", "authors.title":"作者", "authors.alphabetical.many":"{0} 位作者的字母索引", "authors.alphabetical.one":"Alphabetical index of the single author - very useful indeed ;)", "authors.alphabetical.none":"Alphabetical index of absolutely no author - very useful indeed ;)", -"splitByLetter.author.other":"Other authors", +"splitByLetter.author.other":"其他作者", "series.title":"系列", "series.alphabetical.many":"{0} 个系列的字母索引", "series.alphabetical.one":"Alphabetical index of the single series - very useful indeed ;)", "series.alphabetical.none":"Alphabetical index of absolutely no series - very useful indeed ;)", -"splitByLetter.series.other":"Other series", +"splitByLetter.series.other":"其他系列", "recent.title":"最近添加", "recent.list":"{0} 本最近添加的书", "recent.list.single":"Most recent single book - very useful indeed ;)", "rating.title":"Rating", -"rating.summary":"{0}, grouped by rating", +"rating.summary":"{0}, 根据评分分组", "allbooks.title":"所有书籍", "allbooks.alphabetical.many":"{0} 本书籍的字母索引", "allbooks.alphabetical.one":"Alphabetical index of the single book - very useful indeed ;)", "allbooks.alphabetical.none":"Alphabetical index of absolutely no book - very useful indeed ;)", -"splitByLetter.book.other":"Other books", -"main.title":"Calibre library", +"splitByLetter.book.other":"其他书籍", +"main.title":"Calibre 书架", "main.summary":"{0} has catalogued {1}", "startup.newhome":"Default configuration folder home redirected to {0}", "startup.redirectfound":".redirect file found in {0}", @@ -95,28 +95,28 @@ "startup.foldertilde":"Try configuration folder from tilde folder {0}", "startup.folderjar":"Try configuration folder from .jar location {0}", "startup.foldernotexist":"... but specified folder does not exist", -"i18n.and":"and", -"i18n.downloads":"Downloads, links and other catalogs", -"i18n.links":"Links and other catalogs", +"i18n.and":"和", +"i18n.downloads":"下载,链接和其他目录 ", +"i18n.links":"链接和其他目录", "i18n.coversection":"封面", "i18n.downloadfile":"下载文件", "i18n.downloadsection":"下载", -"i18n.relatedsection":"Related catalogs", -"i18n.linksection":"External links", -"i18n.backToMain":"Back to the main page of the catalog", +"i18n.relatedsection":"相关目录", +"i18n.linksection":"外部链接", +"i18n.backToMain":"返回目录主页", "i18n.summarysection":"描述", -"i18n.dateGenerated":"Catalog generated on {0}", +"i18n.dateGenerated":"目录生成于 {0}", "deeplevel.summary":"{0} broken up by authors, tags, etc. ", "about.title":"关于COPS", "about.summary":"关于Calibre2Opds的说明", -"usage.intro":"The options are taken from the configuration file located at {0}", +"usage.intro":"选项从此配置文件生成 {0}", "config.Language.label":"语言", -"config.Language.description":"This setting changes the language used by the program ; use the standard ISO language code (e.g. EN, FR, DE...)", -"config.Language.possible":"Possible values : {0}", -"intro.goal":"Generate OPDS and HTML catalogs from your Calibre ebooks database", -"intro.wiki.title":"The project''s home : ", +"config.Language.description":"此项设置将会改变程序使用的语言 ; 请使用ISO标准语言代码 (例如 EN, FR, DE...)", +"config.Language.possible":"可能的选项 : {0}", +"intro.goal":"从你的 Calibre 数据库生成 OPDS 和 HTML 目录", +"intro.wiki.title":"项目主页 : ", "intro.wiki.url":"http://calibre2opds.com", -"intro.team.title":"The Calibre2Opds team :", +"intro.team.title":"项目人员 :", "intro.team.list1":"David Pierron - main programmer", "intro.team.list2":"Dave Walker - guru, features manager and tester extraordinaire", "intro.team.list3":"Farid Soussi - css and html guru", @@ -124,10 +124,10 @@ "intro.team.list5":"Jane Litte - beta tester and moral support", "intro.thanks.1":"Special thanks to Kb Sriram, who not only programmed Trook, an excellent and OPDS compatible ", "intro.thanks.2":"library manager for the Nook, but also was kind enough to donate a Nook !", -"search.result":"Search result for *{0}*", +"search.result":"*{0}* 的搜索结果", "search.sortorder.asc":"升序", "search.sortorder.desc":"降序", -"permalink.alternate":"Permalink", +"permalink.alternate":"永久链接", "home.alternate":"首页", "search.alternate":"搜索", "sort.alternate":"排序", From 26c1d8f1c409552293b848f6a38c00956336ea3b Mon Sep 17 00:00:00 2001 From: wogong Date: Tue, 7 May 2013 16:30:53 +0800 Subject: [PATCH 83/86] remove debug code --- base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base.php b/base.php index 992fa8b..0205513 100644 --- a/base.php +++ b/base.php @@ -129,7 +129,7 @@ function localize($phrase, $count=-1) { $lang = "en"; if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - //$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); + $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); } $lang_file_en = NULL; $lang_file = 'lang/Localization_' . $lang . '.json'; From 9a412b7fc6de3122d0dcf7b37db74c03c03f85b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 7 May 2013 14:26:11 +0200 Subject: [PATCH 84/86] Update changelog --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index d8220c2..6623f18 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ * Fix book comments if it contains UTF8 characters. Reported by Alain. * Link to the book permalink was not working correctly in some cases. Reported by celta. * Moved some external resources to a resources directory. + * Add chinese translation. Thanks to wogong for the pull request. 0.3.4 - 20130327 * Hopefully fix metadata update. Beware you should remove the directory php-epub-meta if you have one. Thanks to Mario for his time. From f0a307e8acf58587ab996b1d53a842c1797f5816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 7 May 2013 20:20:06 +0200 Subject: [PATCH 85/86] Change date of release --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 6623f18..f1a11c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -0.4.0 - 201305?? +0.4.0 - 20130507 * Add multiple database support. Check the documentation of $config['calibre_directory'] in config-default.php to see how ot enable it. * Include jquery library in COPS's repository to be sure that COPS will work on LAN (without Internet access). * Prepare the switch to HTML5. Thanks to Thomas Severinsen for most of the code. From b0c09cc77b55120560d49f8dd5930a351b9894ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 7 May 2013 20:31:04 +0200 Subject: [PATCH 86/86] =?UTF-8?q?=C3=89tiquette=200.4.0=20ajout=C3=A9e=20?= =?UTF-8?q?=C3=A0=20la=20r=C3=A9vision=2089ed9654ac9c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 10b71ee..a28b7a9 100644 --- a/.hgtags +++ b/.hgtags @@ -13,3 +13,4 @@ aca483636af460c93f9817e083e85d1976aa1b7d 0.3.1 5888006bc559842de0364ec3e67f641aa1653d0e 0.3.2 2ff58ed42cecf00b24d981426dff507fa1e86c20 0.3.3 3cdee8daedf28e6611203ce90c90bb8906003e22 0.3.4 +89ed9654ac9c5de1695f63992aa92d55ef82f2b9 0.4.0