diff --git a/.htaccess b/.htaccess index d124065..e92019b 100644 --- a/.htaccess +++ b/.htaccess @@ -25,6 +25,37 @@ RewriteRule ^download/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L] RewriteRule ^download/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L] + +ExpiresActive on + +# Data +ExpiresByType text/xml "access plus 0 seconds" +ExpiresByType application/xml "access plus 0 seconds" +ExpiresByType application/json "access plus 0 seconds" +ExpiresByType application/xhtml+xml "access plus 0 seconds" + +# Favicon (cannot be renamed) +ExpiresByType image/x-icon "access plus 1 week" + +# Media: images +ExpiresByType image/png "access plus 1 month" +ExpiresByType image/jpg "access plus 1 month" +ExpiresByType image/jpeg "access plus 1 month" + +# Webfonts +ExpiresByType font/truetype "access plus 1 month" +ExpiresByType font/opentype "access plus 1 month" +ExpiresByType application/x-font-woff "access plus 1 month" +ExpiresByType image/svg+xml "access plus 1 month" +ExpiresByType application/vnd.ms-fontobject "access plus 1 month" + +# CSS and JavaScript +ExpiresByType text/css "access plus 1 year" +ExpiresByType application/javascript "access plus 1 year" +ExpiresByType text/javascript "access plus 1 year" + + + ########################################### # Uncomment if you wish to protect access with a password ########################################### diff --git a/about.xml b/about.html similarity index 100% rename from about.xml rename to about.html diff --git a/base.php b/base.php index 6f94999..adbd513 100644 --- a/base.php +++ b/base.php @@ -11,7 +11,7 @@ define ("DB", "db"); date_default_timezone_set($config['default_timezone']); function getURLParam ($name, $default = NULL) { - if (!empty ($_GET) && isset($_GET[$name])) { + if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") { return $_GET[$name]; } return $default; @@ -208,7 +208,7 @@ class Link } public function hrefXhtml () { - return str_replace ("&", "&", $this->href); + return $this->href; } } @@ -218,7 +218,7 @@ class LinkNavigation extends Link parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle); if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB)); if (!preg_match ("#^\?(.*)#", $this->href) && !empty ($this->href)) $this->href = "?" . $this->href; - if (preg_match ("/bookdetail.php/", $_SERVER["SCRIPT_NAME"])) { + if (preg_match ("/(bookdetail|getJSON).php/", $_SERVER["SCRIPT_NAME"])) { $this->href = "index.php" . $this->href; } else { $this->href = $_SERVER["SCRIPT_NAME"] . $this->href; @@ -265,6 +265,16 @@ class Entry } return date (DATE_ATOM, self::$updated); } + + public function getContentArray () { + $navlink = "#"; + foreach ($this->linkArray as $link) { + if ($link->type != Link::OPDS_NAVIGATION_TYPE) { continue; } + + $navlink = $link->hrefXhtml (); + } + return array ( "title" => $this->title, "content" => $this->content, "navlink" => $navlink ); + } public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray) { global $config; @@ -299,6 +309,12 @@ class EntryBook extends Entry $this->localUpdated = $pbook->timestamp; } + public function getContentArray () { + $entry = array ( "title" => $this->title); + $entry ["book"] = $this->book->getContentArray (); + return $entry; + } + public function getCoverThumbnail () { foreach ($this->linkArray as $link) { if ($link->rel == Link::OPDS_THUMBNAIL_TYPE) @@ -325,6 +341,7 @@ class Page public $query; public $favicon; public $n; + public $book; public $totalNumber = -1; public $entryArray = array(); @@ -416,7 +433,7 @@ class Page if (!is_null ($database)) $this->title = Base::getDbName (); } } - + public function isPaginated () { global $config; @@ -660,8 +677,8 @@ class PageBookDetail extends Page { public function InitializeContent () { - $book = Book::getBookById ($this->idGet); - $this->title = $book->title; + $this->book = Book::getBookById ($this->idGet); + $this->title = $this->book->title; } } diff --git a/book.php b/book.php index 84d92a8..3987026 100644 --- a/book.php +++ b/book.php @@ -102,16 +102,78 @@ class Book extends Base { return "?page=".parent::PAGE_BOOK_DETAIL."&id=$this->id"; } + public function getContentArray () { + global $config; + $i = 0; + $preferedData = array (); + foreach ($config['cops_prefered_format'] as $format) + { + if ($i == 2) { break; } + if ($data = $this->getDataFormat ($format)) { + $i++; + array_push ($preferedData, array ("url" => $data->getHtmlLink (), "name" => $format)); + } + } + $serie = $this->getSerie (); + if (is_null ($serie)) { + $sn = ""; + $scn = ""; + $su = ""; + } else { + $sn = $serie->name; + $scn = str_format (localize ("content.series.data"), $this->seriesIndex, $serie->name); + $link = new LinkNavigation ($serie->getUri ()); + $su = $link->hrefXhtml (); + } + + return array ("id" => $this->id, + "hasCover" => $this->hasCover, + "preferedData" => $preferedData, + "rating" => $this->getRating (), + "pubDate" => $this->getPubDate (), + "languagesName" => $this->getLanguages (), + "authorsName" => $this->getAuthorsName (), + "tagsName" => $this->getTagsName (), + "seriesName" => $sn, + "seriesCompleteName" => $scn, + "seriesurl" => $su); + + } + public function getFullContentArray () { + global $config; + $out = $this->getContentArray (); + + $out ["coverurl"] = Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_IMAGE_TYPE, "cover.jpg", NULL)->hrefXhtml (); + $out ["thumbnailurl"] = Data::getLink ($this, "jpg", "image/jpeg", Link::OPDS_THUMBNAIL_TYPE, "cover.jpg", NULL, NULL, 150)->hrefXhtml (); + $out ["content"] = $this->getComment (false); + $out ["datas"] = array (); + $dataKindle = $this->GetMostInterestingDataToSendToKindle (); + foreach ($this->getDatas() as $data) { + $tab = array ("id" => $data->id, "format" => $data->format, "url" => $data->getHtmlLink (), "mail" => 0); + if (!empty ($config['cops_mail_configuration']) && !is_null ($dataKindle) && $data->id == $dataKindle->id) { + $tab ["mail"] = 1; + } + array_push ($out ["datas"], $tab); + } + $out ["authors"] = array (); + foreach ($this->getAuthors () as $author) { + $link = new LinkNavigation ($author->getUri ()); + array_push ($out ["authors"], array ("name" => $author->name, "url" => $link->hrefXhtml ())); + } + $out ["tags"] = array (); + foreach ($this->getTags () as $tag) { + $link = new LinkNavigation ($tag->getUri ()); + array_push ($out ["tags"], array ("name" => $tag->name, "url" => $link->hrefXhtml ())); + } + ; + return $out; + } + public function getDetailUrl ($permalink = false) { global $config; $urlParam = $this->getUri (); if (!is_null (GetUrlParam (DB))) $urlParam = addURLParameter ($urlParam, DB, GetUrlParam (DB)); - $urlParam = str_replace ("&", "&", $urlParam); - if ($permalink || getCurrentOption ('use_fancyapps') == 0) { - return 'index.php' . $urlParam; - } else { - return 'bookdetail.php' . $urlParam; - } + return 'index.php' . $urlParam; } public function getTitle () { @@ -207,7 +269,7 @@ class Book extends Base { public function GetMostInterestingDataToSendToKindle () { - $bestFormatForKindle = array ("PDF", "MOBI"); + $bestFormatForKindle = array ("EPUB", "PDF", "MOBI"); $bestRank = -1; $bestData = NULL; foreach ($this->getDatas () as $data) { diff --git a/bookdetail.php b/bookdetail.php deleted file mode 100644 index 5f6b590..0000000 --- a/bookdetail.php +++ /dev/null @@ -1,103 +0,0 @@ - - * - */ - -require_once ("config.php"); -require_once ("book.php"); - -$book = Book::getBookById($_GET["id"]); -$authors = $book->getAuthors (); -$tags = $book->getTags (); -$serie = $book->getSerie (); -$book->getLinkArray (); - -?> -
- - hasCover) { - ?> - hrefXhtml () ?>"> - hrefXhtml () ?>" alt="" /> - - - -getDatas() as $data) - { -?> -

format ?>

- -

" alt="" />title) ?>

-

-

:

- - 0) echo ", "; -?> - name) ?> - -

- 0) { -?> -

-

:

- - 0) echo ", "; -?> - name) ?> - -

- -

-

:

- seriesIndex, htmlspecialchars ($serie->name)) ?> -

-getPubDate() != "") - { -?> -

-

:

- getPubDate() ?> -

-getLanguages () != "") - { -?> -

-

:

- getLanguages () ?> -

- -
-

-
>getComment (false) ?>
-
\ No newline at end of file diff --git a/customize.php b/customize.php index 6907831..f7f93d6 100644 --- a/customize.php +++ b/customize.php @@ -24,8 +24,8 @@ <?php echo localize ("customize.title") ?> - - + + " /> diff --git a/data.php b/data.php index 0430bd8..5e08044 100644 --- a/data.php +++ b/data.php @@ -105,7 +105,7 @@ class Data extends Base { } else { - return str_replace ("&", "&", self::getLink ($this->book, $this->extension, $this->getMimeType (), NULL, $this->getFilename (), $this->id, NULL)->href); + return self::getLink ($this->book, $this->extension, $this->getMimeType (), NULL, $this->getFilename (), $this->id, NULL)->href; } } diff --git a/getJSON.php b/getJSON.php new file mode 100644 index 0000000..d66ca4e --- /dev/null +++ b/getJSON.php @@ -0,0 +1,101 @@ + + * + */ + + require_once ("config.php"); + require_once ("base.php"); + require_once ("author.php"); + require_once ("serie.php"); + require_once ("tag.php"); + require_once ("language.php"); + require_once ("customcolumn.php"); + require_once ("book.php"); + + header ("Content-Type:application/json;charset=utf-8"); + $page = getURLParam ("page", Base::PAGE_INDEX); + $query = getURLParam ("query"); + $qid = getURLParam ("id"); + $n = getURLParam ("n", "1"); + $database = GetUrlParam (DB); + + $currentPage = Page::getPage ($page, $qid, $query, $n); + $currentPage->InitializeContent (); + + $out = array ( "title" => $currentPage->title); + $entries = array (); + foreach ($currentPage->entryArray as $entry) { + array_push ($entries, $entry->getContentArray ()); + } + if (!is_null ($currentPage->book)) { + $out ["book"] = $currentPage->book->getFullContentArray (); + } + $out ["databaseId"] = GetUrlParam (DB, ""); + $out ["databaseName"] = Base::getDbName (); + $out ["page"] = $page; + $out ["entries"] = $entries; + $out ["isPaginated"] = 0; + if ($currentPage->isPaginated ()) { + $prevLink = $currentPage->getPrevLink (); + $nextLink = $currentPage->getNextLink (); + $out ["isPaginated"] = 1; + $out ["prevLink"] = ""; + if (!is_null ($prevLink)) { + $out ["prevLink"] = $prevLink->hrefXhtml (); + } + $out ["nextLink"] = ""; + if (!is_null ($nextLink)) { + $out ["nextLink"] = $nextLink->hrefXhtml (); + } + $out ["maxPage"] = $currentPage->getMaxPage (); + $out ["currentPage"] = $currentPage->n; + } + if (!is_null (getURLParam ("complete"))) { + $out ["const"] = array ("version" => VERSION, "i18n" => array ( + "coverAlt" => localize("i18n.coversection"), + "authorsTitle" => localize("authors.title"), + "bookwordTitle" => localize("bookword.title"), + "tagsTitle" => localize("tags.title"), + "seriesTitle" => localize("series.title"), + "customizeTitle" => localize ("customize.title"), + "aboutTitle" => localize ("about.title"), + "previousAlt" => localize ("paging.previous.alternate"), + "nextAlt" => localize ("paging.next.alternate"), + "searchAlt" => localize ("search.alternate"), + "sortAlt" => localize ("sort.alternate"), + "homeAlt" => localize ("home.alternate"), + "permalinkAlt" => localize ("permalink.alternate"), + "pubdateTitle" => localize("pubdate.title"), + "languagesTitle" => localize("language.title"), + "contentTitle" => localize("content.summary"), + "sortorderAsc" => localize("search.sortorder.asc"), + "sortorderDesc" => localize("search.sortorder.desc")), + "url" => array ( + "detailUrl" => "index.php?page=13&id={0}&db={1}", + "coverUrl" => "fetch.php?id={0}&db={1}", + "thumbnailUrl" => "fetch.php?height=70&id={0}&db={1}"), + "config" => array ( + "use_fancyapps" => $config ["cops_use_fancyapps"], + "max_item_per_page" => $config['cops_max_item_per_page'])); + } + + $out ["containsBook"] = 0; + if ($currentPage->containsBook ()) { + $out ["containsBook"] = 1; + } + $out["abouturl"] = "about.html"; + if (getCurrentOption ('use_fancyapps') == 0) { + $out["abouturl"] = "index.php" . addURLParameter ("?page=16", DB, $database); + } + + $out ["homeurl"] = "index.php"; + if ($page != Base::PAGE_INDEX && !is_null ($database)) $out ["homeurl"] = $out ["homeurl"] . "?" . addURLParameter ("", DB, $database); + + + echo json_encode ($out); + +?> \ No newline at end of file diff --git a/images/mail-send.png b/images/mail-send.png new file mode 100644 index 0000000..1dbcb98 Binary files /dev/null and b/images/mail-send.png differ diff --git a/index.php b/index.php index f2f8c27..28d59ec 100644 --- a/index.php +++ b/index.php @@ -22,294 +22,73 @@ exit (); } - $withToolbar = false; - if (!isset($_COOKIE['toolbar'])) $withToolbar = true; - - header ("Content-Type:application/xhtml+xml;charset=utf-8"); + header ("Content-Type:text/html;charset=utf-8"); $page = getURLParam ("page", Base::PAGE_INDEX); $query = getURLParam ("query"); $qid = getURLParam ("id"); $n = getURLParam ("n", "1"); $database = GetUrlParam (DB); - - $currentPage = Page::getPage ($page, $qid, $query, $n); - $currentPage->InitializeContent (); - -/* Test to see if pages are opened on an Eink screen - * test Kindle, Kobo Touch and Sony PRS-T1 Ereader. - * HTTP_USER_AGENT = "Mozilla/5.0 (Linux; U; en-us; EBRD1101; EXT) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" - */ - - if (preg_match("/(Kobo|Kindle\/3.0|EBRD1101)/", $_SERVER['HTTP_USER_AGENT'])) { - $isEink = 1; - } else { - $isEink = 0; - } - - ?> - <?php echo htmlspecialchars ($currentPage->title) ?> - - - - - " media="screen" /> - + COPS + + + + " media="screen" /> + + + - + " /> -
-
- "> - " alt="" /> - - " alt="Settings and menu" /> -
-

title) ?>

-
-
> -
-
-
- " /> -
-
- - - - - - -
-
-
- containsBook ()) { ?> -
-
- <?php echo localize (" /> -
-
- - -
-
- -
-
- -
-entryArray as $entry) { - if (get_class ($entry) != "EntryBook") { -?> - - - - -
- -
diff --git a/js/jquery.cookies.js b/js/jquery.cookies.js deleted file mode 100644 index 0321fce..0000000 --- a/js/jquery.cookies.js +++ /dev/null @@ -1,10 +0,0 @@ -/*! - * jQuery Cookie Plugin - * https://github.com/carhartl/jquery-cookie - * Copyright 2011, Klaus Hartl - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://www.opensource.org/licenses/mit-license.php - * http://www.opensource.org/licenses/GPL-2.0 - * Last update: Sun, 03 Mar 2013 06:56:32 +0000 - */ -(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else{factory(jQuery)}}(function($){var pluses=/\+/g;function raw(s){return s}function decoded(s){return decodeURIComponent(s.replace(pluses,' '))}function converted(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g, '"').replace(/\\\\/g,'\\');}try{return config.json?JSON.parse(s):s}catch(er){}}var config=$.cookie=function(key,value,options){if(value!==undefined){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days)}value=config.json?JSON.stringify(value):String(value);return(document.cookie=[config.raw?key:encodeURIComponent(key),'=',config.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))}var decode=config.raw?raw:decoded;var cookies=document.cookie.split('; ');var result=key?undefined:{};for(var i=0,l=cookies.length;ir;r++)if(s=l[r],s.parsed&&(s=s.el[0]),s===i.el[0]){t.index=r;break}}else t.items=e.isArray(i.items)?i.items:[i.items],t.index=i.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],o="",t.ev=i.mainEl||a,i.key?(t.popupsCache[i.key]||(t.popupsCache[i.key]={}),t.currTemplate=t.popupsCache[i.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,i),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.bgOverlay||(t.bgOverlay=x("bg").on("click"+g,function(){t.close()}),t.wrap=x("wrap").attr("tabindex",-1).on("click"+g,function(e){T(e.target)&&t.close()}),t.container=x("container",t.wrap)),t.contentContainer=x("content"),t.st.preloader&&(t.preloader=x("preloader",t.container,t.st.tLoading));var c=e.magnificPopup.modules;for(r=0;c.length>r;r++){var d=c[r];d=d.charAt(0).toUpperCase()+d.slice(1),t["init"+d].call(t)}k("BeforeOpen"),t.st.closeBtnInside?(I(p,function(e,t,i,n){i.close_replaceWith=P(n.type)}),o+=" mfp-close-btn-in"):t.wrap.append(P()),t.st.alignTop&&(o+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:b.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:a.height(),position:"absolute"}),a.on("keyup"+g,function(e){27===e.keyCode&&t.close()}),b.on("resize"+g,function(){t.updateSize()}),t.st.closeOnContentClick||(o+=" mfp-auto-cursor"),o&&t.wrap.addClass(o);var f=t.wH=b.height(),m={};if(t.fixedContentPos&&t._hasScrollBar(f)){var h=t._getScrollbarSize();h&&(m.paddingRight=h)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):m.overflow="hidden");var C=t.st.mainClass;t.isIE7&&(C+=" mfp-ie7"),C&&t._addClassToMFP(C),t.updateItemHTML(),k("BuildControls"),n.css(m),t.bgOverlay.add(t.wrap).prependTo(document.body),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),S()):t.bgOverlay.addClass(v),a.on("focusin"+g,function(i){return i.target===t.wrap[0]||e.contains(t.wrap[0],i.target)?void 0:(S(),!1)})},16),t.isOpen=!0,t.updateSize(f),k(u)},close:function(){t.isOpen&&(t.isOpen=!1,t.st.removalDelay&&!t.isLowIE?(t._addClassToMFP(h),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){k(l);var i=h+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(i+=t.st.mainClass+" "),t._removeClassFromMFP(i),t.fixedContentPos){var r={paddingRight:""};t.isIE7?e("body, html").css("overflow",""):r.overflow="",n.css(r)}a.off("keyup"+g+" focusin"+g),t.ev.off(g),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,k(c)},updateSize:function(e){if(t.isIOS){var i=document.documentElement.clientWidth/window.innerWidth,n=window.innerHeight*i;t.wrap.css("height",n),t.wH=n}else t.wH=e||b.height();t.fixedContentPos||t.wrap.css("height",t.wH),k("Resize")},updateItemHTML:function(){var i=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),i.parsed||(i=t.parseEl(t.index));var n=i.type;if(k("BeforeChange",[t.currItem?t.currItem.type:"",n]),t.currItem=i,!t.currTemplate[n]){var a=t.st[n]?t.st[n].markup:!1;k("FirstMarkupParse",a),t.currTemplate[n]=a?e(a):!0}r&&r!==i.type&&t.container.removeClass("mfp-"+r+"-holder");var o=t["get"+n.charAt(0).toUpperCase()+n.slice(1)](i,t.currTemplate[n]);t.appendContent(o,n),i.preloaded=!0,k(f,i),r=i.type,t.container.prepend(t.contentContainer),k("AfterChange")},appendContent:function(e,i){t.content=e,e?t.st.closeBtnInside&&t.currTemplate[i]===!0?t.content.find(".mfp-close").length||t.content.append(P()):t.content=e:t.content="",k(d),t.container.addClass("mfp-"+i+"-holder"),t.contentContainer.append(t.content)},parseEl:function(i){var n=t.items[i],a=n.type;if(n=n.tagName?{el:e(n)}:{data:n,src:n.src},n.el){for(var r=t.types,o=0;r.length>o;o++)if(n.el.hasClass("mfp-"+r[o])){a=r[o];break}n.src=n.el.attr("data-mfp-src"),n.src||(n.src=n.el.attr("href"))}return n.type=a||t.st.type||"inline",n.index=i,n.parsed=!0,t.items[i]=n,k("ElementParse",n),t.items[i]},addGroup:function(e,i){var n=function(n){n.mfpEl=this,t._openClick(n,e,i)};i||(i={});var a="click.magnificPopup";i.mainEl=e,i.items?(i.isObj=!0,e.off(a).on(a,n)):(i.isObj=!1,i.delegate?e.off(a).on(a,i.delegate,n):(i.items=e,e.off(a).on(a,n)))},_openClick:function(i,n,a){var r=void 0!==a.midClick?a.midClick:e.magnificPopup.defaults.midClick;if(r||2!==i.which){var o=void 0!==a.disableOn?a.disableOn:e.magnificPopup.defaults.disableOn;if(o)if(e.isFunction(o)){if(!o.call(t))return!0}else if(o>b.width())return!0;i.type&&(i.preventDefault(),t.isOpen&&i.stopPropagation()),a.el=e(i.mfpEl),a.delegate&&(a.items=n.find(a.delegate)),t.open(a)}},updateStatus:function(e,n){if(t.preloader){i!==e&&t.container.removeClass("mfp-s-"+i),n||"loading"!==e||(n=t.st.tLoading);var a={status:e,text:n};k("UpdateStatus",a),e=a.status,n=a.text,t.preloader.html(n),t.preloader.find("a").click(function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),i=e}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?a.height():document.body.scrollHeight)>(e||b.height())},_parseMarkup:function(t,i,n){var a;n.data&&(i=e.extend(n.data,i)),k(p,[t,i,n]),e.each(i,function(e,i){if(void 0===i||i===!1)return!0;if(a=e.split("_"),a.length>1){var n=t.find(g+"-"+a[0]);if(n.length>0){var r=a[1];"replaceWith"===r?n[0]!==i[0]&&n.replaceWith(i):"img"===r?n.is("img")?n.attr("src",i):n.replaceWith(''):n.attr(a[1],i)}}else t.find(g+"-"+e).html(i)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.id="mfp-sbm",e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:y.prototype,modules:[],open:function(e,t){return E(),e||(e={}),e.isObj=!0,e.index=t||0,this.instance.open(e)},close:function(){return e.magnificPopup.instance.close()},registerModule:function(t,i){i.options&&(e.magnificPopup.defaults[t]=i.options),e.extend(this.proto,i.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,alignTop:!1,removalDelay:0,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(i){E();var n=e(this);if("string"==typeof i)if("open"===i){var a,r=w?n.data("magnificPopup"):n[0].magnificPopup,o=parseInt(arguments[1],10)||0;r.items?a=r.items[o]:(a=n,r.delegate&&(a=a.find(r.delegate)),a=a.eq(o)),t._openClick({mfpEl:a},n,r)}else t.isOpen&&t[i].apply(t,Array.prototype.slice.call(arguments,1));else w?n.data("magnificPopup",i):n[0].magnificPopup=i,t.addGroup(n,i);return n};var M,O,_,z="inline",B=function(){_&&(O.after(_.addClass(M)).detach(),_=null)};e.magnificPopup.registerModule(z,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(z),I(l+"."+z,function(){B()})},getInline:function(i,n){if(B(),i.src){var a=t.st.inline,r=e(i.src);if(r.length){var o=r[0].parentNode;o&&o.tagName&&(O||(M=a.hiddenClass,O=x(M),M="mfp-"+M),_=r.after(O).detach().removeClass(M)),t.updateStatus("ready")}else t.updateStatus("error",a.tNotFound),r=e("
");return i.inlineElement=r,r}return t.updateStatus("ready"),t._parseMarkup(n,{},i),n}}});var H,F="ajax",L=function(){H&&n.removeClass(H)};e.magnificPopup.registerModule(F,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){t.types.push(F),H=t.st.ajax.cursor,I(l+"."+F,function(){L(),t.req&&t.req.abort()})},getAjax:function(i){H&&n.addClass(H),t.updateStatus("loading");var a=e.extend({url:i.src,success:function(n,a,r){var o={data:n,xhr:r};k("ParseAjax",o),t.appendContent(e(o.data),F),i.finished=!0,L(),S(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),k("AjaxContentAdded")},error:function(){L(),i.finished=i.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",i.src))}},t.st.ajax.settings);return t.req=e.ajax(a),""}}});var A,j=function(i){if(i.data&&void 0!==i.data.title)return i.data.title;var n=t.st.image.titleSrc;if(n){if(e.isFunction(n))return n.call(t,i);if(i.el)return i.el.attr(n)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var e=t.st.image,i=".image";t.types.push("image"),I(u+i,function(){"image"===t.currItem.type&&e.cursor&&n.addClass(e.cursor)}),I(l+i,function(){e.cursor&&n.removeClass(e.cursor),b.off("resize"+g)}),I("Resize"+i,t.resizeImage),t.isLowIE&&I("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e.img&&t.st.image.verticalFit){var i=0;t.isLowIE&&(i=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-i)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,A&&clearInterval(A),e.isCheckingImgSize=!1,k("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var i=0,n=e.img[0],a=function(r){A&&clearInterval(A),A=setInterval(function(){return n.naturalWidth>0?(t._onImageHasSize(e),void 0):(i>200&&clearInterval(A),i++,3===i?a(10):40===i?a(50):100===i&&a(500),void 0)},r)};a(1)},getImage:function(i,n){var a=0,r=function(){i&&(i.img[0].complete?(i.img.off(".mfploader"),i===t.currItem&&(t._onImageHasSize(i),t.updateStatus("ready")),i.hasSize=!0,i.loaded=!0):(a++,200>a?setTimeout(r,100):o()))},o=function(){i&&(i.img.off(".mfploader"),i===t.currItem&&(t._onImageHasSize(i),t.updateStatus("error",s.tError.replace("%url%",i.src))),i.hasSize=!0,i.loaded=!0,i.loadError=!0)},s=t.st.image,l=n.find(".mfp-img");if(l.length){var c=new Image;c.className="mfp-img",i.img=e(c).on("load.mfploader",r).on("error.mfploader",o),c.src=i.src,l.is("img")&&(i.img=i.img.clone())}return t._parseMarkup(n,{title:j(i),img_replaceWith:i.img},i),t.resizeImage(),i.hasSize?(A&&clearInterval(A),i.loadError?(n.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",i.src))):(n.removeClass("mfp-loading"),t.updateStatus("ready")),n):(t.updateStatus("loading"),i.loading=!0,i.hasSize||(i.imgHidden=!0,n.addClass("mfp-loading"),t.findImageSize(i)),n)}}});var N="iframe",W="//about:blank",R=function(e){if(t.currTemplate[N]){var i=t.currTemplate[N].find("iframe");i.length&&(e||(i[0].src=W),t.isIE8&&i.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(N,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(N),I("BeforeChange",function(e,t,i){t!==i&&(t===N?R():i===N&&R(!0))}),I(l+"."+N,function(){R()})},getIframe:function(i,n){var a=i.src,r=t.st.iframe;e.each(r.patterns,function(){return a.indexOf(this.index)>-1?(this.id&&(a="string"==typeof this.id?a.substr(a.lastIndexOf(this.id)+this.id.length,a.length):this.id.call(this,a)),a=this.src.replace("%id%",a),!1):void 0});var o={};return r.srcAction&&(o[r.srcAction]=a),t._parseMarkup(n,o,i),t.updateStatus("ready"),n}}});var Y=function(e){var i=t.items.length;return e>i-1?e-i:0>e?i+e:e},q=function(e,t,i){return e.replace("%curr%",t+1).replace("%total%",i)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var i=t.st.gallery,n=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,i&&i.enabled?(o+=" mfp-gallery",I(u+n,function(){i.navigateByImgClick&&t.wrap.on("click"+n,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),a.on("keydown"+n,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),I("UpdateStatus"+n,function(e,i){i.text&&(i.text=q(i.text,t.currItem.index,t.items.length))}),I(p+n,function(e,n,a,r){var o=t.items.length;a.counter=o>1?q(i.tCounter,r.index,o):""}),I("BuildControls"+n,function(){if(t.items.length>1&&i.arrows&&!t.arrowLeft){var n=i.arrowMarkup,a=t.arrowLeft=e(n.replace("%title%",i.tPrev).replace("%dir%","left")).addClass(C),o=t.arrowRight=e(n.replace("%title%",i.tNext).replace("%dir%","right")).addClass(C),s=r?"mfpFastClick":"click";a[s](function(){t.prev()}),o[s](function(){t.next()}),t.isIE7&&(x("b",a[0],!1,!0),x("a",a[0],!1,!0),x("b",o[0],!1,!0),x("a",o[0],!1,!0)),t.container.append(a.add(o))}}),I(f+n,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),I(l+n,function(){a.off(n),t.wrap.off("click"+n),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=Y(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=Y(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,i=t.st.gallery.preload,n=Math.min(i[0],t.items.length),a=Math.min(i[1],t.items.length);for(e=1;(t.direction?a:n)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?n:a)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(i){if(i=Y(i),!t.items[i].preloaded){var n=t.items[i];n.parsed||(n=t.parseEl(i)),k("LazyLoad",n),"image"===n.type&&(n.img=e('').on("load.mfploader",function(){n.hasSize=!0}).on("error.mfploader",function(){n.hasSize=!0,n.loadError=!0}).attr("src",n.src)),n.preloaded=!0}}}});var D="retina";e.magnificPopup.registerModule(D,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,i=e.ratio;i=isNaN(i)?i():i,i>1&&(I("ImageHasSize."+D,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/i,width:"100%"})}),I("ElementParse."+D,function(t,n){n.src=e.replaceSrc(n,i)}))}}}}),function(){var t=1e3,i="ontouchstart"in window,n=function(){b.off("touchmove"+r+" touchend"+r)},a="mfpFastClick",r="."+a;e.fn.mfpFastClick=function(a){return e(this).each(function(){var o,s=e(this);if(i){var l,c,d,p,u,f;s.on("touchstart"+r,function(e){p=!1,f=1,u=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=u.clientX,d=u.clientY,b.on("touchmove"+r,function(e){u=e.originalEvent?e.originalEvent.touches:e.touches,f=u.length,u=u[0],(Math.abs(u.clientX-c)>10||Math.abs(u.clientY-d)>10)&&(p=!0,n())}).on("touchend"+r,function(e){n(),p||f>1||(o=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){o=!1},t),a())})})}s.on("click"+r,function(){o||a()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),i&&b.off("touchmove"+r+" touchend"+r)}}()})(window.jQuery||window.Zepto); \ No newline at end of file diff --git a/resources/Magnific-Popup/magnific-popup.css b/resources/Magnific-Popup/magnific-popup.css new file mode 100644 index 0000000..f1dec8b --- /dev/null +++ b/resources/Magnific-Popup/magnific-popup.css @@ -0,0 +1,395 @@ +/* Magnific Popup CSS */ +.mfp-bg { + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 502; + overflow: hidden; + position: fixed; + background: #0b0b0b; + opacity: 0.8; + filter: alpha(opacity=80); } + +.mfp-wrap { + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 503; + position: fixed; + outline: none !important; + -webkit-backface-visibility: hidden; } + +.mfp-container { + height: 100%; + text-align: center; + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + padding: 0 8px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + +.mfp-container:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; } + +.mfp-align-top .mfp-container:before { + display: none; } + +.mfp-content { + position: relative; + display: inline-block; + vertical-align: middle; + margin: 0 auto; + text-align: left; + z-index: 505; } + +.mfp-inline-holder .mfp-content, +.mfp-ajax-holder .mfp-content { + width: 100%; + cursor: auto; } + +.mfp-ajax-cur { + cursor: progress; } + +.mfp-zoom-out-cur, +.mfp-zoom-out-cur .mfp-image-holder .mfp-close { + cursor: -moz-zoom-out; + cursor: -webkit-zoom-out; + cursor: zoom-out; } + +.mfp-zoom { + cursor: pointer; + cursor: -webkit-zoom-in; + cursor: -moz-zoom-in; + cursor: zoom-in; } + +.mfp-auto-cursor .mfp-content { + cursor: auto; } + +.mfp-close, +.mfp-arrow, +.mfp-preloader, +.mfp-counter { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; } + +.mfp-loading.mfp-figure { + display: none; } + +.mfp-hide { + display: none !important; } + +.mfp-preloader { + color: #cccccc; + position: absolute; + top: 50%; + width: auto; + text-align: center; + margin-top: -0.8em; + left: 8px; + right: 8px; + z-index: 504; } + +.mfp-preloader a { + color: #cccccc; } + +.mfp-preloader a:hover { + color: white; } + +.mfp-s-ready .mfp-preloader { + display: none; } + +.mfp-s-error .mfp-content { + display: none; } + +button.mfp-close, +button.mfp-arrow { + overflow: visible; + cursor: pointer; + background: transparent; + border: 0; + -webkit-appearance: none; + display: block; + padding: 0; + z-index: 506; } + +button::-moz-focus-inner { + padding: 0; + border: 0; } + +.mfp-close { + width: 44px; + height: 44px; + line-height: 44px; + position: absolute; + right: 0; + top: 0; + text-decoration: none; + text-align: center; + opacity: 0.65; + padding: 0 0 18px 10px; + color: white; + font-style: normal; + font-size: 28px; + font-family: Arial, Baskerville, monospace; } + .mfp-close:hover, .mfp-close:focus { + opacity: 1; } + .mfp-close:active { + top: 1px; } + +.mfp-close-btn-in .mfp-close { + color: #333333; } + +.mfp-image-holder .mfp-close, +.mfp-iframe-holder .mfp-close { + color: white; + right: -6px; + text-align: right; + padding-right: 6px; + width: 100%; } + +.mfp-counter { + position: absolute; + top: 0; + right: 0; + color: #cccccc; + font-size: 12px; + line-height: 18px; } + +.mfp-arrow { + position: absolute; + top: 0; + opacity: 0.65; + margin: 0; + top: 50%; + margin-top: -55px; + padding: 0; + width: 90px; + height: 110px; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } + +.mfp-arrow:active { + margin-top: -54px; } + +.mfp-arrow:hover, +.mfp-arrow:focus { + opacity: 1; } + +.mfp-arrow:before, .mfp-arrow:after, +.mfp-arrow .mfp-b, +.mfp-arrow .mfp-a { + content: ''; + display: block; + width: 0; + height: 0; + position: absolute; + left: 0; + top: 0; + margin-top: 35px; + margin-left: 35px; + border: solid transparent; } +.mfp-arrow:after, +.mfp-arrow .mfp-a { + opacity: 0.8; + border-top-width: 12px; + border-bottom-width: 12px; + top: 8px; } +.mfp-arrow:before, +.mfp-arrow .mfp-b { + border-top-width: 20px; + border-bottom-width: 20px; } + +.mfp-arrow-left { + left: 0; } + .mfp-arrow-left:after, + .mfp-arrow-left .mfp-a { + border-right: 12px solid black; + left: 5px; } + .mfp-arrow-left:before, + .mfp-arrow-left .mfp-b { + border-right: 20px solid white; } + +.mfp-arrow-right { + right: 0; } + .mfp-arrow-right:after, + .mfp-arrow-right .mfp-a { + border-left: 12px solid black; + left: 3px; } + .mfp-arrow-right:before, + .mfp-arrow-right .mfp-b { + border-left: 20px solid white; } + +.mfp-iframe-holder { + padding-top: 40px; + padding-bottom: 40px; } + +.mfp-iframe-holder .mfp-content { + line-height: 0; + width: 100%; + max-width: 900px; } + +.mfp-iframe-scaler { + width: 100%; + height: 0; + overflow: hidden; + padding-top: 56.25%; } + +.mfp-iframe-scaler iframe { + position: absolute; + display: block; + top: 0; + left: 0; + width: 100%; + height: 100%; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); + background: black; } + +.mfp-iframe-holder .mfp-close { + top: -40px; } + +/* Main image in popup */ +img.mfp-img { + width: auto; + max-width: 100%; + height: auto; + display: block; + line-height: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 40px 0 40px; + margin: 0 auto; } + +/* The shadow behind the image */ +.mfp-figure:after { + content: ''; + position: absolute; + left: 0; + top: 40px; + bottom: 40px; + display: block; + right: 0; + width: auto; + height: auto; + z-index: -1; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); } + +.mfp-figure { + line-height: 0; } + +.mfp-bottom-bar { + margin-top: -36px; + position: absolute; + top: 100%; + left: 0; + width: 100%; + cursor: auto; } + +.mfp-title { + text-align: left; + line-height: 18px; + color: #f3f3f3; + word-break: break-word; + padding-right: 36px; } + +.mfp-figure small { + color: #bdbdbd; + display: block; + font-size: 12px; + line-height: 14px; } + +.mfp-image-holder .mfp-content { + max-width: 100%; } + +.mfp-gallery .mfp-image-holder .mfp-figure { + cursor: pointer; } + +@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) { + /** + * Remove all paddings around the image on small screen + */ + .mfp-img-mobile .mfp-image-holder { + padding-left: 0; + padding-right: 0; } + + .mfp-img-mobile img.mfp-img { + padding: 0; } + + /* The shadow behind the image */ + .mfp-img-mobile .mfp-figure:after { + top: 0; + bottom: 0; } + + .mfp-img-mobile .mfp-bottom-bar { + background: rgba(0, 0, 0, 0.6); + bottom: 0; + margin: 0; + top: auto; + padding: 3px 5px; + position: fixed; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + + .mfp-img-mobile .mfp-bottom-bar:empty { + padding: 0; } + + .mfp-img-mobile .mfp-counter { + right: 5px; + top: 3px; } + + .mfp-img-mobile .mfp-close { + top: 0; + right: 0; + width: 35px; + height: 35px; + line-height: 35px; + background: rgba(0, 0, 0, 0.6); + position: fixed; + text-align: center; + padding: 0; } + + .mfp-img-mobile .mfp-figure small { + display: inline; + margin-left: 5px; } } +@media all and (max-width: 800px) { + .mfp-arrow { + -webkit-transform: scale(0.75); + transform: scale(0.75); } + + .mfp-arrow-left { + -webkit-transform-origin: 0; + transform-origin: 0; } + + .mfp-arrow-right { + -webkit-transform-origin: 100%; + transform-origin: 100%; } + + .mfp-container { + padding-left: 6px; + padding-right: 6px; } } +.mfp-ie7 .mfp-img { + padding: 0; } +.mfp-ie7 .mfp-bottom-bar { + width: 600px; + left: 50%; + margin-left: -300px; + margin-top: 5px; + padding-bottom: 5px; } +.mfp-ie7 .mfp-container { + padding: 0; } +.mfp-ie7 .mfp-content { + padding-top: 44px; } +.mfp-ie7 .mfp-close { + top: 0; + right: 0; + padding-top: 0; } diff --git a/resources/doT/doT.min.js b/resources/doT/doT.min.js new file mode 100644 index 0000000..1f05f62 --- /dev/null +++ b/resources/doT/doT.min.js @@ -0,0 +1,7 @@ +/* Laura Doktorova https://github.com/olado/doT */(function(){function o(){var a={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},b=/&(?!#?\w+;)|<|>|"|'|\//g;return function(){return this?this.replace(b,function(c){return a[c]||c}):this}}function p(a,b,c){return(typeof b==="string"?b:b.toString()).replace(a.define||i,function(l,e,f,g){if(e.indexOf("def.")===0)e=e.substring(4);if(!(e in c))if(f===":"){a.defineParams&&g.replace(a.defineParams,function(n,h,d){c[e]={arg:h,text:d}});e in c||(c[e]=g)}else(new Function("def","def['"+ +e+"']="+g))(c);return""}).replace(a.use||i,function(l,e){if(a.useParams)e=e.replace(a.useParams,function(g,n,h,d){if(c[h]&&c[h].arg&&d){g=(h+":"+d).replace(/'|\\/g,"_");c.__exp=c.__exp||{};c.__exp[g]=c[h].text.replace(RegExp("(^|[^\\w$])"+c[h].arg+"([^\\w$])","g"),"$1"+d+"$2");return n+"def.__exp['"+g+"']"}});var f=(new Function("def","return "+e))(c);return f?p(a,f,c):f})}function m(a){return a.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}var j={version:"1.0.0",templateSettings:{evaluate:/\{\{([\s\S]+?\}?)\}\}/g, +interpolate:/\{\{=([\s\S]+?)\}\}/g,encode:/\{\{!([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,useParams:/(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,defineParams:/^\s*([\w$]+):([\s\S]+)/,conditional:/\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,varname:"it",strip:true,append:true,selfcontained:false},template:undefined, +compile:undefined};if(typeof module!=="undefined"&&module.exports)module.exports=j;else if(typeof define==="function"&&define.amd)define(function(){return j});else(function(){return this||(0,eval)("this")})().doT=j;String.prototype.encodeHTML=o();var q={append:{start:"'+(",end:")+'",endencode:"||'').toString().encodeHTML()+'"},split:{start:"';out+=(",end:");out+='",endencode:"||'').toString().encodeHTML();out+='"}},i=/$^/;j.template=function(a,b,c){b=b||j.templateSettings;var l=b.append?q.append: +q.split,e,f=0,g;a=b.use||b.define?p(b,a,c||{}):a;a=("var out='"+(b.strip?a.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):a).replace(/'|\\/g,"\\$&").replace(b.interpolate||i,function(h,d){return l.start+m(d)+l.end}).replace(b.encode||i,function(h,d){e=true;return l.start+m(d)+l.endencode}).replace(b.conditional||i,function(h,d,k){return d?k?"';}else if("+m(k)+"){out+='":"';}else{out+='":k?"';if("+m(k)+"){out+='":"';}out+='"}).replace(b.iterate||i,function(h, +d,k,r){if(!d)return"';} } out+='";f+=1;g=r||"i"+f;d=m(d);return"';var arr"+f+"="+d+";if(arr"+f+"){var "+k+","+g+"=-1,l"+f+"=arr"+f+".length-1;while("+g+"
' - }, - - list : null, - buttons: null, - - beforeLoad: function (opts, obj) { - //Remove self if gallery do not have at least two items - - if (opts.skipSingle && obj.group.length < 2) { - obj.helpers.buttons = false; - obj.closeBtn = true; - - return; - } - - //Increase top margin to give space for buttons - obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; - }, - - onPlayStart: function () { - if (this.buttons) { - this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn'); - } - }, - - onPlayEnd: function () { - if (this.buttons) { - this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn'); - } - }, - - afterShow: function (opts, obj) { - var buttons = this.buttons; - - if (!buttons) { - this.list = $(opts.tpl).addClass(opts.position).appendTo('body'); - - buttons = { - prev : this.list.find('.btnPrev').click( F.prev ), - next : this.list.find('.btnNext').click( F.next ), - play : this.list.find('.btnPlay').click( F.play ), - toggle : this.list.find('.btnToggle').click( F.toggle ) - } - } - - //Prev - if (obj.index > 0 || obj.loop) { - buttons.prev.removeClass('btnDisabled'); - } else { - buttons.prev.addClass('btnDisabled'); - } - - //Next / Play - if (obj.loop || obj.index < obj.group.length - 1) { - buttons.next.removeClass('btnDisabled'); - buttons.play.removeClass('btnDisabled'); - - } else { - buttons.next.addClass('btnDisabled'); - buttons.play.addClass('btnDisabled'); - } - - this.buttons = buttons; - - this.onUpdate(opts, obj); - }, - - onUpdate: function (opts, obj) { - var toggle; - - if (!this.buttons) { - return; - } - - toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); - - //Size toggle button - if (obj.canShrink) { - toggle.addClass('btnToggleOn'); - - } else if (!obj.canExpand) { - toggle.addClass('btnDisabled'); - } - }, - - beforeClose: function () { - if (this.list) { - this.list.remove(); - } - - this.list = null; - this.buttons = null; - } - }; - -}(jQuery)); \ No newline at end of file diff --git a/resources/fancybox/helpers/jquery.fancybox-media.js b/resources/fancybox/helpers/jquery.fancybox-media.js deleted file mode 100644 index 4b5e783..0000000 --- a/resources/fancybox/helpers/jquery.fancybox-media.js +++ /dev/null @@ -1,196 +0,0 @@ -/*! - * Media helper for fancyBox - * version: 1.0.5 (Tue, 23 Oct 2012) - * @requires fancyBox v2.0 or later - * - * Usage: - * $(".fancybox").fancybox({ - * helpers : { - * media: true - * } - * }); - * - * Set custom URL parameters: - * $(".fancybox").fancybox({ - * helpers : { - * media: { - * youtube : { - * params : { - * autoplay : 0 - * } - * } - * } - * } - * }); - * - * Or: - * $(".fancybox").fancybox({, - * helpers : { - * media: true - * }, - * youtube : { - * autoplay: 0 - * } - * }); - * - * Supports: - * - * Youtube - * http://www.youtube.com/watch?v=opj24KnzrWo - * http://www.youtube.com/embed/opj24KnzrWo - * http://youtu.be/opj24KnzrWo - * Vimeo - * http://vimeo.com/40648169 - * http://vimeo.com/channels/staffpicks/38843628 - * http://vimeo.com/groups/surrealism/videos/36516384 - * http://player.vimeo.com/video/45074303 - * Metacafe - * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ - * http://www.metacafe.com/watch/7635964/ - * Dailymotion - * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people - * Twitvid - * http://twitvid.com/QY7MD - * Twitpic - * http://twitpic.com/7p93st - * Instagram - * http://instagr.am/p/IejkuUGxQn/ - * http://instagram.com/p/IejkuUGxQn/ - * Google maps - * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 - * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 - * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 - */ -(function ($) { - "use strict"; - - //Shortcut for fancyBox object - var F = $.fancybox, - format = function( url, rez, params ) { - params = params || ''; - - if ( $.type( params ) === "object" ) { - params = $.param(params, true); - } - - $.each(rez, function(key, value) { - url = url.replace( '$' + key, value || '' ); - }); - - if (params.length) { - url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; - } - - return url; - }; - - //Add helper object - F.helpers.media = { - defaults : { - youtube : { - matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, - params : { - autoplay : 1, - autohide : 1, - fs : 1, - rel : 0, - hd : 1, - wmode : 'opaque', - enablejsapi : 1 - }, - type : 'iframe', - url : '//www.youtube.com/embed/$3' - }, - vimeo : { - matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, - params : { - autoplay : 1, - hd : 1, - show_title : 1, - show_byline : 1, - show_portrait : 0, - fullscreen : 1 - }, - type : 'iframe', - url : '//player.vimeo.com/video/$1' - }, - metacafe : { - matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, - params : { - autoPlay : 'yes' - }, - type : 'swf', - url : function( rez, params, obj ) { - obj.swf.flashVars = 'playerVars=' + $.param( params, true ); - - return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; - } - }, - dailymotion : { - matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, - params : { - additionalInfos : 0, - autoStart : 1 - }, - type : 'swf', - url : '//www.dailymotion.com/swf/video/$1' - }, - twitvid : { - matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, - params : { - autoplay : 0 - }, - type : 'iframe', - url : '//www.twitvid.com/embed.php?guid=$1' - }, - twitpic : { - matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, - type : 'image', - url : '//twitpic.com/show/full/$1/' - }, - instagram : { - matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, - type : 'image', - url : '//$1/p/$2/media/' - }, - google_maps : { - matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, - type : 'iframe', - url : function( rez ) { - return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); - } - } - }, - - beforeLoad : function(opts, obj) { - var url = obj.href || '', - type = false, - what, - item, - rez, - params; - - for (what in opts) { - item = opts[ what ]; - rez = url.match( item.matcher ); - - if (rez) { - type = item.type; - params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); - - url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); - - break; - } - } - - if (type) { - obj.href = url; - obj.type = type; - - obj.autoHeight = false; - } - } - }; - -}(jQuery)); \ No newline at end of file diff --git a/resources/fancybox/helpers/jquery.fancybox-thumbs.css b/resources/fancybox/helpers/jquery.fancybox-thumbs.css deleted file mode 100644 index e40ae82..0000000 --- a/resources/fancybox/helpers/jquery.fancybox-thumbs.css +++ /dev/null @@ -1,54 +0,0 @@ -#fancybox-thumbs { - position: fixed; - left: 0; - width: 100%; - overflow: hidden; - z-index: 8050; -} - -#fancybox-thumbs.bottom { - bottom: 2px; -} - -#fancybox-thumbs.top { - top: 2px; -} - -#fancybox-thumbs ul { - position: relative; - list-style: none; - margin: 0; - padding: 0; -} - -#fancybox-thumbs ul li { - float: left; - padding: 1px; - opacity: 0.5; -} - -#fancybox-thumbs ul li.active { - opacity: 0.75; - padding: 0; - border: 1px solid #fff; -} - -#fancybox-thumbs ul li:hover { - opacity: 1; -} - -#fancybox-thumbs ul li a { - display: block; - position: relative; - overflow: hidden; - border: 1px solid #222; - background: #111; - outline: none; -} - -#fancybox-thumbs ul li img { - display: block; - position: relative; - border: 0; - padding: 0; -} \ No newline at end of file diff --git a/resources/fancybox/helpers/jquery.fancybox-thumbs.js b/resources/fancybox/helpers/jquery.fancybox-thumbs.js deleted file mode 100644 index 5db3d4a..0000000 --- a/resources/fancybox/helpers/jquery.fancybox-thumbs.js +++ /dev/null @@ -1,162 +0,0 @@ - /*! - * Thumbnail helper for fancyBox - * version: 1.0.7 (Mon, 01 Oct 2012) - * @requires fancyBox v2.0 or later - * - * Usage: - * $(".fancybox").fancybox({ - * helpers : { - * thumbs: { - * width : 50, - * height : 50 - * } - * } - * }); - * - */ -(function ($) { - //Shortcut for fancyBox object - var F = $.fancybox; - - //Add helper object - F.helpers.thumbs = { - defaults : { - width : 50, // thumbnail width - height : 50, // thumbnail height - position : 'bottom', // 'top' or 'bottom' - source : function ( item ) { // function to obtain the URL of the thumbnail image - var href; - - if (item.element) { - href = $(item.element).find('img').attr('src'); - } - - if (!href && item.type === 'image' && item.href) { - href = item.href; - } - - return href; - } - }, - - wrap : null, - list : null, - width : 0, - - init: function (opts, obj) { - var that = this, - list, - thumbWidth = opts.width, - thumbHeight = opts.height, - thumbSource = opts.source; - - //Build list structure - list = ''; - - for (var n = 0; n < obj.group.length; n++) { - list += '
  • '; - } - - this.wrap = $('
    ').addClass(opts.position).appendTo('body'); - this.list = $('').appendTo(this.wrap); - - //Load each thumbnail - $.each(obj.group, function (i) { - var href = thumbSource( obj.group[ i ] ); - - if (!href) { - return; - } - - $("").load(function () { - var width = this.width, - height = this.height, - widthRatio, heightRatio, parent; - - if (!that.list || !width || !height) { - return; - } - - //Calculate thumbnail width/height and center it - widthRatio = width / thumbWidth; - heightRatio = height / thumbHeight; - - parent = that.list.children().eq(i).find('a'); - - if (widthRatio >= 1 && heightRatio >= 1) { - if (widthRatio > heightRatio) { - width = Math.floor(width / heightRatio); - height = thumbHeight; - - } else { - width = thumbWidth; - height = Math.floor(height / widthRatio); - } - } - - $(this).css({ - width : width, - height : height, - top : Math.floor(thumbHeight / 2 - height / 2), - left : Math.floor(thumbWidth / 2 - width / 2) - }); - - parent.width(thumbWidth).height(thumbHeight); - - $(this).hide().appendTo(parent).fadeIn(300); - - }).attr('src', href); - }); - - //Set initial width - this.width = this.list.children().eq(0).outerWidth(true); - - this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))); - }, - - beforeLoad: function (opts, obj) { - //Remove self if gallery do not have at least two items - if (obj.group.length < 2) { - obj.helpers.thumbs = false; - - return; - } - - //Increase bottom margin to give space for thumbs - obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15); - }, - - afterShow: function (opts, obj) { - //Check if exists and create or update list - if (this.list) { - this.onUpdate(opts, obj); - - } else { - this.init(opts, obj); - } - - //Set active element - this.list.children().removeClass('active').eq(obj.index).addClass('active'); - }, - - //Center list - onUpdate: function (opts, obj) { - if (this.list) { - this.list.stop(true).animate({ - 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)) - }, 150); - } - }, - - beforeClose: function () { - if (this.wrap) { - this.wrap.remove(); - } - - this.wrap = null; - this.list = null; - this.width = 0; - } - } - -}(jQuery)); \ No newline at end of file diff --git a/resources/fancybox/jquery.fancybox.css b/resources/fancybox/jquery.fancybox.css deleted file mode 100644 index bd3289b..0000000 --- a/resources/fancybox/jquery.fancybox.css +++ /dev/null @@ -1,249 +0,0 @@ -/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */ -.fancybox-wrap, -.fancybox-skin, -.fancybox-outer, -.fancybox-inner, -.fancybox-image, -.fancybox-wrap iframe, -.fancybox-wrap object, -.fancybox-nav, -.fancybox-nav span, -.fancybox-tmp -{ - padding: 0; - margin: 0; - border: 0; - outline: none; - vertical-align: top; -} - -.fancybox-wrap { - position: absolute; - top: 0; - left: 0; - z-index: 8020; -} - -.fancybox-skin { - position: relative; - background: #f9f9f9; - color: #444; - text-shadow: none; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.fancybox-opened { - z-index: 8030; -} - -.fancybox-opened .fancybox-skin { - -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); -} - -.fancybox-outer, .fancybox-inner { - position: relative; -} - -.fancybox-inner { - overflow: hidden; -} - -.fancybox-type-iframe .fancybox-inner { - -webkit-overflow-scrolling: touch; -} - -.fancybox-error { - color: #444; - font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - margin: 0; - padding: 15px; - white-space: nowrap; -} - -.fancybox-image, .fancybox-iframe { - display: block; - width: 100%; - height: 100%; -} - -.fancybox-image { - max-width: 100%; - max-height: 100%; -} - -#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { - background-image: url('fancybox_sprite.png'); -} - -#fancybox-loading { - position: fixed; - top: 50%; - left: 50%; - margin-top: -22px; - margin-left: -22px; - background-position: 0 -108px; - opacity: 0.8; - cursor: pointer; - z-index: 8060; -} - -#fancybox-loading div { - width: 44px; - height: 44px; - background: url('fancybox_loading.gif') center center no-repeat; -} - -.fancybox-close { - position: absolute; - top: -18px; - right: -18px; - width: 36px; - height: 36px; - cursor: pointer; - z-index: 8040; -} - -.fancybox-nav { - position: absolute; - top: 0; - width: 40%; - height: 100%; - cursor: pointer; - text-decoration: none; - background: transparent url('blank.gif'); /* helps IE */ - -webkit-tap-highlight-color: rgba(0,0,0,0); - z-index: 8040; -} - -.fancybox-prev { - left: 0; -} - -.fancybox-next { - right: 0; -} - -.fancybox-nav span { - position: absolute; - top: 50%; - width: 36px; - height: 34px; - margin-top: -18px; - cursor: pointer; - z-index: 8040; - visibility: hidden; -} - -.fancybox-prev span { - left: 10px; - background-position: 0 -36px; -} - -.fancybox-next span { - right: 10px; - background-position: 0 -72px; -} - -.fancybox-nav:hover span { - visibility: visible; -} - -.fancybox-tmp { - position: absolute; - top: -99999px; - left: -99999px; - visibility: hidden; - max-width: 99999px; - max-height: 99999px; - overflow: visible !important; -} - -/* Overlay helper */ - -.fancybox-lock { - overflow: hidden; -} - -.fancybox-overlay { - position: absolute; - top: 0; - left: 0; - overflow: hidden; - display: none; - z-index: 8010; - background: url('fancybox_overlay.png'); -} - -.fancybox-overlay-fixed { - position: fixed; - bottom: 0; - right: 0; -} - -.fancybox-lock .fancybox-overlay { - overflow: auto; - overflow-y: scroll; -} - -/* Title helper */ - -.fancybox-title { - visibility: hidden; - font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - position: relative; - text-shadow: none; - z-index: 8050; -} - -.fancybox-opened .fancybox-title { - visibility: visible; -} - -.fancybox-title-float-wrap { - position: absolute; - bottom: 0; - right: 50%; - margin-bottom: -35px; - z-index: 8050; - text-align: center; -} - -.fancybox-title-float-wrap .child { - display: inline-block; - margin-right: -100%; - padding: 2px 20px; - background: transparent; /* Fallback for web browsers that doesn't support RGBa */ - background: rgba(0, 0, 0, 0.8); - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - text-shadow: 0 1px 2px #222; - color: #FFF; - font-weight: bold; - line-height: 24px; - white-space: nowrap; -} - -.fancybox-title-outside-wrap { - position: relative; - margin-top: 10px; - color: #fff; -} - -.fancybox-title-inside-wrap { - padding-top: 10px; -} - -.fancybox-title-over-wrap { - position: absolute; - bottom: 0; - left: 0; - color: #fff; - padding: 10px; - background: #000; - background: rgba(0, 0, 0, .8); -} \ No newline at end of file diff --git a/resources/fancybox/jquery.fancybox.pack.js b/resources/fancybox/jquery.fancybox.pack.js deleted file mode 100644 index 6ef73d9..0000000 --- a/resources/fancybox/jquery.fancybox.pack.js +++ /dev/null @@ -1 +0,0 @@ -(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 diff --git a/js/jquery-1.9.1.min.js b/resources/jQuery/jquery-1.9.1.min.js similarity index 100% rename from js/jquery-1.9.1.min.js rename to resources/jQuery/jquery-1.9.1.min.js diff --git a/resources/jquery-cookie/jquery.cookies.js b/resources/jquery-cookie/jquery.cookies.js new file mode 100644 index 0000000..7401208 --- /dev/null +++ b/resources/jquery-cookie/jquery.cookies.js @@ -0,0 +1,8 @@ +/*! + * jQuery Cookie Plugin v1.3.1 + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2013 Klaus Hartl + * Released under the MIT license + */ +(function(a,b,c){function e(a){return a}function f(a){return g(decodeURIComponent(a.replace(d," ")))}function g(a){return 0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),a}function h(a){return i.json?JSON.parse(a):a}var d=/\+/g,i=a.cookie=function(d,g,j){if(g!==c){if(j=a.extend({},i.defaults,j),null===g&&(j.expires=-1),"number"==typeof j.expires){var k=j.expires,l=j.expires=new Date;l.setDate(l.getDate()+k)}return g=i.json?JSON.stringify(g):g+"",b.cookie=[encodeURIComponent(d),"=",i.raw?g:encodeURIComponent(g),j.expires?"; expires="+j.expires.toUTCString():"",j.path?"; path="+j.path:"",j.domain?"; domain="+j.domain:"",j.secure?"; secure":""].join("")}for(var m=i.raw?e:f,n=b.cookie.split("; "),o=d?null:{},p=0,q=n.length;q>p;p++){var r=n[p].split("="),s=m(r.shift()),t=m(r.join("="));if(d&&d===s){o=h(t);break}d||(o[s]=h(t))}return o};i.defaults={},a.removeCookie=function(b,c){return null!==a.cookie(b)?(a.cookie(b,null,c),!0):!1}})(jQuery,document); \ No newline at end of file diff --git a/resources/lru/lru.js b/resources/lru/lru.js new file mode 100644 index 0000000..d014942 --- /dev/null +++ b/resources/lru/lru.js @@ -0,0 +1,249 @@ +/** + * A doubly linked list-based Least Recently Used (LRU) cache. Will keep most + * recently used items while discarding least recently used items when its limit + * is reached. + * + * Licensed under MIT. Copyright (c) 2010 Rasmus Andersson + * See README.md for details. + * + * Illustration of the design: + * + * entry entry entry entry + * ______ ______ ______ ______ + * | head |.newer => | |.newer => | |.newer => | tail | + * | A | | B | | C | | D | + * |______| <= older.|______| <= older.|______| <= older.|______| + * + * removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added + */ +function LRUCache (limit) { + // Current size of the cache. (Read-only). + this.size = 0; + // Maximum number of items this cache can hold. + this.limit = limit; + this._keymap = {}; +} + +/** + * Put into the cache associated with . Returns the entry which was + * removed to make room for the new entry. Otherwise undefined is returned + * (i.e. if there was enough room already). + */ +LRUCache.prototype.put = function(key, value) { + var entry = {key:key, value:value}; + // Note: No protection agains replacing, and thus orphan entries. By design. + this._keymap[key] = entry; + if (this.tail) { + // link previous tail to the new tail (entry) + this.tail.newer = entry; + entry.older = this.tail; + } else { + // we're first in -- yay + this.head = entry; + } + // add new entry to the end of the linked list -- it's now the freshest entry. + this.tail = entry; + if (this.size === this.limit) { + // we hit the limit -- remove the head + return this.shift(); + } else { + // increase the size counter + this.size++; + } +} + +/** + * Purge the least recently used (oldest) entry from the cache. Returns the + * removed entry or undefined if the cache was empty. + * + * If you need to perform any form of finalization of purged items, this is a + * good place to do it. Simply override/replace this function: + * + * var c = new LRUCache(123); + * c.shift = function() { + * var entry = LRUCache.prototype.shift.call(this); + * doSomethingWith(entry); + * return entry; + * } + */ +LRUCache.prototype.shift = function() { + // todo: handle special case when limit == 1 + var entry = this.head; + if (entry) { + if (this.head.newer) { + this.head = this.head.newer; + this.head.older = undefined; + } else { + this.head = undefined; + } + // Remove last strong reference to and remove links from the purged + // entry being returned: + entry.newer = entry.older = undefined; + // delete is slow, but we need to do this to avoid uncontrollable growth: + delete this._keymap[entry.key]; + } + return entry; +} + +/** + * Get and register recent use of . Returns the value associated with + * or undefined if not in cache. + */ +LRUCache.prototype.get = function(key, returnEntry) { + // First, find our cache entry + var entry = this._keymap[key]; + if (entry === undefined) return; // Not cached. Sorry. + // As was found in the cache, register it as being requested recently + if (entry === this.tail) { + // Already the most recenlty used entry, so no need to update the list + return entry.value; + } + // HEAD--------------TAIL + // <.older .newer> + // <--- add direction -- + // A B C E + if (entry.newer) { + if (entry === this.head) + this.head = entry.newer; + entry.newer.older = entry.older; // C <-- E. + } + if (entry.older) + entry.older.newer = entry.newer; // C. --> E + entry.newer = undefined; // D --x + entry.older = this.tail; // D. --> E + if (this.tail) + this.tail.newer = entry; // E. <-- D + this.tail = entry; + return returnEntry ? entry : entry.value; +} + +// ---------------------------------------------------------------------------- +// Following code is optional and can be removed without breaking the core +// functionality. + +/** + * Check if is in the cache without registering recent use. Feasible if + * you do not want to chage the state of the cache, but only "peek" at it. + * Returns the entry associated with if found, or undefined if not found. + */ +LRUCache.prototype.find = function(key) { + return this._keymap[key]; +} + +/** + * Update the value of entry with . Returns the old value, or undefined if + * entry was not in the cache. + */ +LRUCache.prototype.set = function(key, value) { + var oldvalue, entry = this.get(key, true); + if (entry) { + oldvalue = entry.value; + entry.value = value; + } else { + oldvalue = this.put(key, value); + if (oldvalue) oldvalue = oldvalue.value; + } + return oldvalue; +} + +/** + * Remove entry from cache and return its value. Returns undefined if not + * found. + */ +LRUCache.prototype.remove = function(key) { + var entry = this._keymap[key]; + if (!entry) return; + delete this._keymap[entry.key]; // need to do delete unfortunately + if (entry.newer && entry.older) { + // relink the older entry with the newer entry + entry.older.newer = entry.newer; + entry.newer.older = entry.older; + } else if (entry.newer) { + // remove the link to us + entry.newer.older = undefined; + // link the newer entry to head + this.head = entry.newer; + } else if (entry.older) { + // remove the link to us + entry.older.newer = undefined; + // link the newer entry to head + this.tail = entry.older; + } else {// if(entry.older === undefined && entry.newer === undefined) { + this.head = this.tail = undefined; + } + + this.size--; + return entry.value; +} + +/** Removes all entries */ +LRUCache.prototype.removeAll = function() { + // This should be safe, as we never expose strong refrences to the outside + this.head = this.tail = undefined; + this.size = 0; + this._keymap = {}; +} + +/** + * Return an array containing all keys of entries stored in the cache object, in + * arbitrary order. + */ +if (typeof Object.keys === 'function') { + LRUCache.prototype.keys = function() { return Object.keys(this._keymap); } +} else { + LRUCache.prototype.keys = function() { + var keys = []; + for (var k in this._keymap) keys.push(k); + return keys; + } +} + +/** + * Call `fun` for each entry. Starting with the newest entry if `desc` is a true + * value, otherwise starts with the oldest (head) enrty and moves towards the + * tail. + * + * `fun` is called with 3 arguments in the context `context`: + * `fun.call(context, Object key, Object value, LRUCache self)` + */ +LRUCache.prototype.forEach = function(fun, context, desc) { + if (context === true) { desc = true; context = undefined; } + else if (typeof context !== 'object') context = this; + if (desc) { + var entry = this.tail; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.older; + } + } else { + var entry = this.head; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.newer; + } + } +} + +/** Returns a JSON (array) representation */ +LRUCache.prototype.toJSON = function() { + var s = [], entry = this.head; + while (entry) { + s.push({key:entry.key.toJSON(), value:entry.value.toJSON()}); + entry = entry.newer; + } + return s; +} + +/** Returns a String representation */ +LRUCache.prototype.toString = function() { + var s = '', entry = this.head; + while (entry) { + s += String(entry.key)+':'+entry.value; + if (entry = entry.newer) + s += ' < '; + } + return s; +} + +// Export ourselves +if (typeof this === 'object') this.LRUCache = LRUCache; diff --git a/styles/style-default.css b/styles/style-default.css index 2f910db..6875370 100644 --- a/styles/style-default.css +++ b/styles/style-default.css @@ -46,6 +46,16 @@ a:hover { color:#000; text-decoration: none; } .books:hover { width: 100%; background-color: #778899; } .link a:hover { display:inline-block; width: 100%; background-color: #778899; /*Dirty IE Hack*/ zoom: 1; *display: inline;} +.mfp-content .bookpopup { + position: relative; + background: #FFF; + padding: 20px; + width: auto; + max-width: 700px; + margin: 20px auto; +} + + img { margin:0; @@ -156,8 +166,12 @@ max-width:800px; text-decoration : none; font-weight: bold; padding: 5px 10px 5px 10px; + text-align: center; } +.download img { + vertical-align:middle; +} .books h4{ display: inline; diff --git a/templates/default/bookdetail.html b/templates/default/bookdetail.html new file mode 100644 index 0000000..e5b5662 --- /dev/null +++ b/templates/default/bookdetail.html @@ -0,0 +1,53 @@ +
    + + {{? it.book.hasCover == 1}} + + {{=it.const.i18n.coverAlt}} + + {{?}} + +

    + {{~it.book.datas:data:i}} + {{=data.format}} + {{? data.mail == 1}} + Mail + {{?}} +
    + {{~}} +

    +

    {{=it.const.i18n.permalinkAlt}}{{=htmlEscape (it.title)}}

    +

    +

    {{=it.const.i18n.authorsTitle}}:

    + {{~it.book.authors:author:j}} + {{? j > 0}}, {{?}}{{=htmlEscape (author.name)}} + {{~}} +

    + {{? it.book.tagsName != ""}} +

    +

    {{=it.const.i18n.tagsTitle}}:

    + {{~it.book.tags:tag:k}} + {{? k > 0}}, {{?}}{{=htmlEscape (tag.name)}} + {{~}} +

    + {{?}} + {{? it.book.seriesName != ""}} +

    +

    {{=it.const.i18n.seriesTitle}} :

    {{=htmlEscape (it.book.seriesCompleteName)}} +

    + {{?}} + {{? it.book.pubDate != ""}} +

    +

    {{=it.const.i18n.pubdateTitle}}:

    {{=it.book.pubDate}} +

    + {{?}} + {{? it.book.languagesName != ""}} +

    +

    {{=it.const.i18n.languagesTitle}}:

    {{=it.book.languagesName}} +

    + {{?}} + {{? it.book.content != ""}} +
    +

    {{=it.const.i18n.contentTitle}}

    +
    {{=it.book.content}}
    + {{?}} +
    \ No newline at end of file diff --git a/templates/default/footer.html b/templates/default/footer.html new file mode 100644 index 0000000..6c9863f --- /dev/null +++ b/templates/default/footer.html @@ -0,0 +1,15 @@ +
    +
    + {{=it.const.i18n.customizeTitle}} +
    +
    + {{=it.const.i18n.aboutTitle}} +
    + {{? it.isPaginated == 1}} +
    + {{? it.prevLink != ""}}{{=it.const.i18n.previousAlt}}{{?}} +

    {{=it.currentPage}} / {{=it.maxPage}}

    + {{? it.nextLink != ""}}{{=it.const.i18n.nextAlt}}{{?}} +
    + {{?}} +
    \ No newline at end of file diff --git a/templates/default/header.html b/templates/default/header.html new file mode 100644 index 0000000..f94a40c --- /dev/null +++ b/templates/default/header.html @@ -0,0 +1,43 @@ +
    + + {{=it.const.i18n.homeAlt}} + + Settings and menu +
    +

    {{=it.title}}

    +
    + +
    diff --git a/templates/default/main.html b/templates/default/main.html new file mode 100644 index 0000000..b2cd360 --- /dev/null +++ b/templates/default/main.html @@ -0,0 +1,43 @@ +
    +{{? it.page == 13}} + {{#def.bookdetail}} +{{??}} +{{~it.entries:entry:i}} + {{? it.containsBook == 0}} + + {{??}} +
    + + {{? entry.book.hasCover == 1}} + + {{=it.const.i18n.coverAlt}} + + {{?}} + +

    + {{~entry.book.preferedData:data:j}} + {{=data.name}}
    + {{~}} +

    + +
    +

    {{=htmlEscape (entry.title)}} + {{? entry.book.pubDate != ""}}({{=entry.book.pubDate}}){{?}} + {{? entry.book.rating != ""}}{{=entry.book.rating}}{{?}} +

    +

    {{=it.const.i18n.authorsTitle}} :

    {{=htmlEscape (entry.book.authorsName)}}
    + {{? entry.book.tagsName != ""}}

    {{=it.const.i18n.tagsTitle}} :

    {{=htmlEscape (entry.book.tagsName)}}
    {{?}} + {{? entry.book.seriesName != ""}}

    {{=it.const.i18n.seriesTitle}} :

    {{=htmlEscape (entry.book.seriesName)}}
    {{?}} +
    +
    + {{?}} +{{~}} +{{?}} +
    \ No newline at end of file diff --git a/templates/default/page.html b/templates/default/page.html new file mode 100644 index 0000000..85757f0 --- /dev/null +++ b/templates/default/page.html @@ -0,0 +1,5 @@ +
    +{{#def.header}} +{{#def.main}} +{{#def.footer}} +
    \ No newline at end of file diff --git a/util.js b/util.js new file mode 100644 index 0000000..2cf520f --- /dev/null +++ b/util.js @@ -0,0 +1,201 @@ +var templatePage, templateBookDetail, templateMain, currentData, before; + +var cache = new LRUCache(30); + +var DEBUG = true; +var isEink = /Kobo|Kindle|EBRD1101/i.test(navigator.userAgent); +var isPushStateEnabled = window.history && window.history.pushState && window.history.replaceState && + // pushState isn't reliable on iOS until 5. + !navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/); + +function debug_log(text) { + if ( DEBUG ) { + console.log(text); + } +} + +function elapsed () { + var elapsed = new Date () - before; + return "Elapsed : " + elapsed; +} + +function retourMail(data, textStatus, jqXHR ) { + alert (data); +} + +function sendToMailAddress (component, dataid) { + $toto = $.cookie ('email'); + if (!$.cookie ('email')) { + var email = window.prompt ("Please enter your email : ", ""); + $.cookie ('email', email); + } + email = $.cookie ('email'); + var url = 'sendtomail.php'; + if (currentData.databaseId) url = url + '?db=' + currentData.databaseId; + $.ajax ({url: url, type: 'post', data: { data: dataid, email: email }, success: retourMail}); +} + +function strformat () { + var s = arguments[0]; + for (var i = 0; i < arguments.length - 1; i++) { + var reg = new RegExp("\\{" + i + "\\}", "gm"); + s = s.replace(reg, arguments[i + 1]); + } + return s; +} + +function isDefined(x) { + var undefined; + return x !== undefined; +} + +function getCurrentOption (option) { + if (!$.cookie (option)) { + if (currentData && currentData.const && currentData.const.config && currentData.const.config [option]) { + return currentData.const.config [option]; + } + } + return $.cookie (option); +} + +function htmlEscape(str) { + return String(str) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(/'/g, ''') + .replace(//g, '>'); +} + +function navigateTo (url) { + before = new Date (); + var jsonurl = url.replace ("index", "getJSON"); + var cachedData = cache.get (jsonurl); + if (cachedData) { + history.pushState(jsonurl, "", url); + updatePage (cachedData); + } else { + $.getJSON(jsonurl, function(data) { + history.pushState(jsonurl, "", url); + cache.put (jsonurl, data); + updatePage (data); + }); + } +} + +function updatePage (data) { + var result; + data ["const"] = currentData ["const"]; + if (false && $("section").length && currentData.isPaginated == 0 && data.isPaginated == 0) { + // Partial update (for now disabled) + debug_log ("Partial update"); + result = templateMain (data); + $("h1").html (data.title); + $("section").html (result); + } else { + // Full update + result = templatePage (data); + $("body").html (result); + } + document.title = data.title; + currentData = data; + + debug_log (elapsed ()); + + if ($.cookie('toolbar') == 1) $("#tool").show (); + if (currentData.containsBook == 1) { + $("#sortForm").show (); + } else { + $("#sortForm").hide (); + } + + ajaxifyLinks (); + + $("#sort").click(function(){ + $('.books').sortElements(function(a, b){ + var test = 1; + if ($("#sortorder").val() == "desc") + { + test = -1; + } + return $(a).find ("." + $("#sortchoice").val()).text() > $(b).find ("." + $("#sortchoice").val()).text() ? test : -test; + }); + }); + + $(".headright").click(function(){ + if ($("#tool").is(":hidden")) { + $("#tool").slideDown("slow"); + $.cookie('toolbar', '1'); + } else { + $("#tool").slideUp(); + $.removeCookie('toolbar'); + } + }); + + if (getCurrentOption ("use_fancyapps") == 1) { + $(".fancydetail").click(function(event){ + event.preventDefault(); + before = new Date (); + var url = $(this).attr("href"); + var jsonurl = url.replace ("index", "getJSON"); + $.getJSON(jsonurl, function(data) { + data ["const"] = currentData ["const"]; + var detail = templateBookDetail (data); + $.magnificPopup.open({ + items: { + src: detail, + type: 'inline' + } + }); + debug_log (elapsed ()); + }); + }); + + + $('section').magnificPopup({ + delegate: '.fancycover', // child items selector, by clicking on it popup will open + type: 'image', + gallery:{enabled:true, preload: [0,2]} + // other options + }); + + + + $('.fancyabout').magnificPopup({ type: 'ajax' }); + } +} + +function ajaxifyLinks () { + if (isPushStateEnabled) { + var links = $("a[href^='index']"); + if (getCurrentOption ("use_fancyapps") == 1) links = links.not (".fancydetail"); + links.click (function (event) { + event.preventDefault(); + + var url = $(this).attr('href'); + navigateTo (url); + }); + + $("#searchForm").submit (function (event) { + event.preventDefault(); + + var url = strformat ("index.php?page=9¤t={0}&query={1}&db={2}", currentData.page, $("input[name=query]").val (), currentData.databaseId); + navigateTo (url); + }); + } +} + +window.onpopstate = function(event) { + before = new Date (); + var data = cache.get (event.state) + updatePage (data); +}; + +$(document).keydown(function(e){ + if (e.keyCode == 37 && $("#prevLink").length > 0) { + navigateTo ($("#prevLink").attr('href')); + } + if (e.keyCode == 39 && $("#nextLink").length > 0) { + navigateTo ($("#nextLink").attr('href')); + } +}); \ No newline at end of file