diff --git a/_config.yml.example b/_config.yml.example new file mode 100644 index 0000000..4f59e6d --- /dev/null +++ b/_config.yml.example @@ -0,0 +1,131 @@ +# =========================================== +# Site Information Settings +# =========================================== + +# Site creation time +since: 2015 + +# Custom your favicon.ico in `site/source` +favicon: /favicon.ico + +# Set feed link (false | default | your feed link) +# false: disable +# default: use `atom.xml`, generator for `hexo-generator-feed` +rss: default + +# =========================================== +# Menu Settings +# =========================================== +menu: + Home: / + # Archives: /archives/ + # Tags: /tags/ + # Categories: /categories/ + # About: /about/ + +# =========================================== +# Theme Settings +# =========================================== +# color: default | mint green | cobalt blue | hot pink | dark violet +color: default + +# default page mode: default | archives +mode: default + +toc: true + +# jQuery fancybox +fancybox: true + +# LaTeX support (via MathJax) +latex: false + +copyright: + enable: true + # https://creativecommons.org/ + license: '知识共享署名-非商业性使用 4.0 国际许可协议' + +reward: + enable: false + qrCode: + wechat: + alipay: + +# =========================================== +# Social links Settings +# =========================================== +social: + email: your@email.com + stack-overflow: + twitter: + facebook: + linkedin: + google: + github: https://github.com/ahonn + weibo: + zhihu: + douban: + pocket: + tumblr: + instagram: + +# =========================================== +# Third Party Services Settings +# =========================================== + +# LeanCloud +leancloud: + app_id: + app_key: + +# Baidu Analytics +baidu_analytics: +# Baidu Verification +baidu_verification: + +# Google Analytics +google_analytics: +# Google Verification +google_verification: + +# Disqus +disqus_shortname: + +#Changyan +changyan: + appid: + appkey: + +#LiveRe +livere_datauid: + +# Gitalk +# Demo: https://gitalk.github.io +# https://github.com/gitalk/gitalk +gitalk: + enable: false + github_id: GitHub repo owner + repo: GitHub repo + client_id: GitHub Application Client ID + client_secret: GitHub Application Client Secret + admin_user: GitHub repo owner and collaborators, only these guys can initialize github issues + distraction_free_mode: true # Facebook-like distraction free mode + # Gitalk's display language depends on user's browser or system environment + # If you want everyone visiting your site to see a uniform language, you can set a force language value + # Available values: en, es-ES, fr, ru, zh-CN, zh-TW + language: + +# utterances +# Docs: https://utteranc.es/ +# Tips: Make sure you have installed [utterances app](https://github.com/apps/utterances) in your repo +utterances: + enable: false + repo: owner/repo # Repository + issueTerm: title # Blog post ↔️ issue mapping: pathname | url | title | og:title + theme: github-light # Theme: github-light | github-dark | github-dark-orange | icy-dark | dark-blue | photon-dark + label: utterances # Issue label + +# =========================================== +# Version +# =========================================== +version: 2.11.0 \ No newline at end of file diff --git a/languages/default.yml b/languages/default.yml new file mode 100644 index 0000000..8b915b2 --- /dev/null +++ b/languages/default.yml @@ -0,0 +1,41 @@ +menu: + home: Home + archives: Archives + tags: Tags + categories: Categories + about: About + +footer: + powered: "Powered by %s" + theme: Theme + +posts: + prev: Prev + next: Next + prev_post: Prev + next_post: Next + toc: Contents + readmore: Read more.. + visits: Visits + reward: 'Reward' + +copyright: + author: 'Author' + link: 'Link' + license: 'License' + +counter: + archives: + zero: No Posts + one: 1 Post + other: "%d Posts In Total" + + tagcloud: + zero: No tags + one: 1 Tag In Total + other: "%d Tags In Total" + + categories: + zero: No Categories + one: 1 Category In Total + other: "%d Categories In Total" diff --git a/languages/en.yml b/languages/en.yml new file mode 100644 index 0000000..8b915b2 --- /dev/null +++ b/languages/en.yml @@ -0,0 +1,41 @@ +menu: + home: Home + archives: Archives + tags: Tags + categories: Categories + about: About + +footer: + powered: "Powered by %s" + theme: Theme + +posts: + prev: Prev + next: Next + prev_post: Prev + next_post: Next + toc: Contents + readmore: Read more.. + visits: Visits + reward: 'Reward' + +copyright: + author: 'Author' + link: 'Link' + license: 'License' + +counter: + archives: + zero: No Posts + one: 1 Post + other: "%d Posts In Total" + + tagcloud: + zero: No tags + one: 1 Tag In Total + other: "%d Tags In Total" + + categories: + zero: No Categories + one: 1 Category In Total + other: "%d Categories In Total" diff --git a/languages/zh-cn.yml b/languages/zh-cn.yml new file mode 100644 index 0000000..3296572 --- /dev/null +++ b/languages/zh-cn.yml @@ -0,0 +1,41 @@ +menu: + home: 首页 + archives: 归档 + tags: 标签 + categories: 分类 + about: 关于 + +footer: + powered: "由 %s 强力驱动" + theme: 主题 + +posts: + prev: 上一页 + next: 下一页 + prev_post: 上一篇 + next_post: 下一篇 + toc: 文章目录 + readmore: 阅读更多 + visits: '阅读次数' + reward: '赞赏支持' + +copyright: + author: '原文作者' + link: '原文链接' + license: '许可协议' + +counter: + archives: + zero: 暂无日志 + one: 目前共计 1 篇日志 + other: "目前共计 %d 篇日志" + + tagcloud: + zero: 暂无标签 + one: 目前共计 1 个标签 + other: "目前共计 %d 个标签" + + categories: + zero: 暂无分类 + one: 目前共计 1 个分类 + other: "目前共计 %d 个分类" diff --git a/languages/zh-tw.yml b/languages/zh-tw.yml new file mode 100644 index 0000000..9bca754 --- /dev/null +++ b/languages/zh-tw.yml @@ -0,0 +1,41 @@ +menu: + home: 首頁 + archives: 歸檔 + tags: 標籤 + categories: 分類 + about: 關於 + +footer: + powered: "由 %s 技術提供" + theme: 主題 + +posts: + prev: 上一頁 + next: 下一頁 + prev_post: 上一篇 + next_post: 下一篇 + toc: 文章目錄 + readmore: 閱讀更多 + visits: '閱讀次數' + reward: '讚賞支持' + +copyright: + author: '原文作者' + link: '原文鏈結' + license: '授權' + +counter: + archives: + zero: 暫無文章 + one: 目前總計 1 篇文章 + other: "目前總計 %d 篇文章" + + tagcloud: + zero: 暫無文章 + one: 目前總計 1 個標籤 + other: "目前總計 %d 個標籤" + + categories: + zero: 暫無分類 + one: 目前總計 1 個分類 + other: "目前總計 %d 個分類" diff --git a/layout/_layout.swig b/layout/_layout.swig new file mode 100644 index 0000000..570eb00 --- /dev/null +++ b/layout/_layout.swig @@ -0,0 +1,38 @@ + + + + {%- include '_partial/head.swig' %} + {%- block title -%}{%- endblock -%} + + + + {%- include '_partial/slideout.swig' -%} +
+ + +
+
+
+ {%- block content -%}{%- endblock -%} +
+ {%- include '_partial/comments.swig' -%} +
+
+ + + +
+ +
+
+ + {%- include '_script/comments.swig' -%} + + {%- include '_script/libs.swig' -%} + {%- include '_script/theme.swig' -%} + + diff --git a/layout/_macro/archive.swig b/layout/_macro/archive.swig new file mode 100644 index 0000000..6e93a7d --- /dev/null +++ b/layout/_macro/archive.swig @@ -0,0 +1,55 @@ +{%- macro render() -%} + {%- set isArchivesPage = !!page.archive -%} + {%- set isArchivesMode = theme.mode.toLowerCase() == 'archives' -%} + +
+ {%- if not page.prev -%} + {%- if page.tag -%} +
+

{{ page.tag }}

+
+ {%- elif page.category -%} +
+

{{ page.category }}

+
+ {%- elif isArchivesPage -%} +
+ + {{ _p("counter.archives", site.posts.length) }} + +
+ {%- endif -%} + {%- endif -%} + + {%- for post in page.posts -%} + {%- if isArchivesPage or isArchivesMode -%} + {%- set year -%} + {%- set post.year = date(post.date, 'YYYY') -%} + + {%- if post.year !== year -%} + {%- set year = post.year -%} +
+

{{ year }}

+
+ {%- endif -%} + {%- endif -%} + +
+ + {%- if isArchivesPage or isArchivesMode -%} + {{ date(post.date, 'MM-DD') }} + {%- else -%} + {{ date(post.date, 'YYYY-MM-DD') }} + {%- endif -%} + + + + {{ post.title }} + + +
+ {%- endfor -%} +
+ + {%- include '../_partial/pagination.swig' -%} +{%- endmacro -%} diff --git a/layout/_macro/post.swig b/layout/_macro/post.swig new file mode 100644 index 0000000..bf93b00 --- /dev/null +++ b/layout/_macro/post.swig @@ -0,0 +1,81 @@ +{%- macro render(post) -%} +
+
+

+ {%- if is_home() -%} + {{ post.title }} + {%- else -%} + {{ post.title }} + {%- endif -%} +

+ + +
+ + {#- Post TOC -#} + {%- include "../_partial/_post/toc.swig" -%} + +
+ {%- if is_home() -%} + {%- set excerpt = "" -%} + {%- if post.description -%} + {%- set excerpt = '

' + post.description + '

' -%} + {%- elif post.excerpt -%} + {%- set excerpt = post.excerpt -%} + {%- endif -%} + + {%- if excerpt -%} + {{ excerpt }} + + {%- else -%} + {{ post.content }} + {%- endif -%} + {%- else -%} + {{ post.content }} + {%- endif -%} +
+ + {%- if not is_home() -%} + {#- Post Copyright -#} + {%- include "../_partial/_post/copyright.swig" -%} + + {#- Reward -#} + {%- include "../_partial/_post/reward.swig" -%} + {%- endif -%} + + {%- if not is_home() -%} + + {%- endif -%} + +
+{%- endmacro -%} diff --git a/layout/_partial/_footer/social.swig b/layout/_partial/_footer/social.swig new file mode 100644 index 0000000..1f5e34b --- /dev/null +++ b/layout/_partial/_footer/social.swig @@ -0,0 +1,22 @@ +{%- if theme.social -%} + +{%- endif -%} diff --git a/layout/_partial/_head/meta.swig b/layout/_partial/_head/meta.swig new file mode 100644 index 0000000..3201922 --- /dev/null +++ b/layout/_partial/_head/meta.swig @@ -0,0 +1,39 @@ + + + + +{#- Disable transformation -#} + + + + + + + + +{#- Website description -#} +{%- if page.description -%} + +{%- elif page.title -%} + +{%- elif config.description -%} + +{%- endif -%} + +{#- Website keywords -#} +{%- if page.keywords -%} + +{%- elif config.keywords -%} + +{%- elif page.tags and page.tags.length -%} + +{%- endif -%} + +{%- if theme.baidu_verification -%} + +{%- endif -%} + +{%- if theme.google_verification -%} + +{%- endif -%} + diff --git a/layout/_partial/_post/copyright.swig b/layout/_partial/_post/copyright.swig new file mode 100644 index 0000000..0e01999 --- /dev/null +++ b/layout/_partial/_post/copyright.swig @@ -0,0 +1,18 @@ +{#- Post Copyright -#} +{%- if theme.copyright.enable and page.copyright !== false -%} +
+ + + +
+{%- endif -%} diff --git a/layout/_partial/_post/reward.swig b/layout/_partial/_post/reward.swig new file mode 100644 index 0000000..428d176 --- /dev/null +++ b/layout/_partial/_post/reward.swig @@ -0,0 +1,19 @@ +{%- if (theme.reward.enable and page.reward !== false) or page.reward === true -%} +
+ + +
+ {%- set qrCode = theme.reward.qrCode -%} + {%- if qrCode.wechat -%} + + {%- endif -%} + {%- if qrCode.alipay -%} + + {%- endif -%} +
+
+{%- endif -%} \ No newline at end of file diff --git a/layout/_partial/_post/toc.swig b/layout/_partial/_post/toc.swig new file mode 100644 index 0000000..7bf1960 --- /dev/null +++ b/layout/_partial/_post/toc.swig @@ -0,0 +1,8 @@ +{%- if not is_home() and toc(page.content) and theme.toc -%} +
+

{{ __('posts.toc') }}

+
+ {{ toc(page.content, {list_number: false}) }} +
+
+{%- endif -%} diff --git a/layout/_partial/comments.swig b/layout/_partial/comments.swig new file mode 100644 index 0000000..28ee341 --- /dev/null +++ b/layout/_partial/comments.swig @@ -0,0 +1,20 @@ +{%- if page.comments and not is_home() -%} +
+ {%- if theme.disqus_shortname -%} +
+ +
+ {%- elif theme.livere_datauid -%} +
+ +
+ {%- elif theme.gitalk.enable -%} +
+ {%- elif theme.utterances.enable -%} +
+ {%- endif -%} +
+{%- endif -%} diff --git a/layout/_partial/footer.swig b/layout/_partial/footer.swig new file mode 100644 index 0000000..4f7244d --- /dev/null +++ b/layout/_partial/footer.swig @@ -0,0 +1,28 @@ +{#- Social Links -#} +{%- include "./_footer/social.swig" -%} + + diff --git a/layout/_partial/head.swig b/layout/_partial/head.swig new file mode 100644 index 0000000..26a16c6 --- /dev/null +++ b/layout/_partial/head.swig @@ -0,0 +1,49 @@ +{#- Website mata -#} +{%- include "./_head/meta.swig" -%} + +{#- Website rss -#} +{%- if theme.rss === 'default' and config.feed and config.feed.path -%} + {{ feed_tag(config.feed.path) }} +{%- elif theme.rss -%} + {{ feed_tag(theme.rss) }} +{%- else -%} + {{ feed_tag('atom.xml') }} +{%- endif -%} + +{#- Website favicon -#} +{%- if theme.favicon -%} + +{%- endif -%} + +{#- Canonical, good for google search engine -#} + + +{#- Fancybox styling -#} +{%- if theme.fancybox -%} + +{%- endif -%} + +{#- MathJax (LaTeX) support -#} +{%- if theme.latex -%} + + +{%- endif -%} + +{#- Theme styling -#} + + +{#- Analytics and push -#} +{%- if not env.debug -%} + {%- include "../_script/analytics.swig" -%} + {%- include "../_script/push.swig" -%} +{%- endif -%} + +{#- LeanCloud Counter -#} +{%- include "../_script/counter.swig"%} + +{%- set themeConfig = { leancloud: theme.leancloud, toc: theme.toc, fancybox: theme.fancybox, pjax: theme.pjax, latex: theme.latex } -%} + diff --git a/layout/_partial/header.swig b/layout/_partial/header.swig new file mode 100644 index 0000000..effcb07 --- /dev/null +++ b/layout/_partial/header.swig @@ -0,0 +1,22 @@ +
+ +
+ + diff --git a/layout/_partial/pagination.swig b/layout/_partial/pagination.swig new file mode 100644 index 0000000..04a70e6 --- /dev/null +++ b/layout/_partial/pagination.swig @@ -0,0 +1,33 @@ +{%- if not is_post() -%} + +{%- else -%} + +{%- endif -%} diff --git a/layout/_partial/slideout.swig b/layout/_partial/slideout.swig new file mode 100644 index 0000000..ee4de17 --- /dev/null +++ b/layout/_partial/slideout.swig @@ -0,0 +1,27 @@ +
+ +
+ + + +
+
+ + diff --git a/layout/_script/_analytics/baidu-analytics.swig b/layout/_script/_analytics/baidu-analytics.swig new file mode 100644 index 0000000..4b6cc3c --- /dev/null +++ b/layout/_script/_analytics/baidu-analytics.swig @@ -0,0 +1,11 @@ +{%- if theme.baidu_analytics -%} + +{%- endif -%} diff --git a/layout/_script/_analytics/google-analytics.swig b/layout/_script/_analytics/google-analytics.swig new file mode 100644 index 0000000..74d6af2 --- /dev/null +++ b/layout/_script/_analytics/google-analytics.swig @@ -0,0 +1,11 @@ +{%- if theme.google_analytics -%} + + + +{%- endif -%} diff --git a/layout/_script/_comments/changyan.swig b/layout/_script/_comments/changyan.swig new file mode 100644 index 0000000..3aea8c8 --- /dev/null +++ b/layout/_script/_comments/changyan.swig @@ -0,0 +1,11 @@ +{%- if theme.changyan.appid and theme.changyan.appkey -%} + +
+ +{%- endif -%} diff --git a/layout/_script/_comments/disqus.swig b/layout/_script/_comments/disqus.swig new file mode 100644 index 0000000..bda0a5a --- /dev/null +++ b/layout/_script/_comments/disqus.swig @@ -0,0 +1,17 @@ +{%- if theme.disqus_shortname -%} + +{%- endif -%} \ No newline at end of file diff --git a/layout/_script/_comments/gitalk.swig b/layout/_script/_comments/gitalk.swig new file mode 100644 index 0000000..9f6bbc2 --- /dev/null +++ b/layout/_script/_comments/gitalk.swig @@ -0,0 +1,29 @@ +{%- if theme.gitalk.enable -%} +{% set gitalk_js_url = '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js' %} + + +{% set gitalk_css_url = '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css' %} + + +{% set md5_url = '//cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js' %} + + + + +{%- endif -%} \ No newline at end of file diff --git a/layout/_script/_comments/livere.swig b/layout/_script/_comments/livere.swig new file mode 100644 index 0000000..a74fefd --- /dev/null +++ b/layout/_script/_comments/livere.swig @@ -0,0 +1,15 @@ +{%- if theme.livere_datauid -%} + +{%- endif -%} \ No newline at end of file diff --git a/layout/_script/_comments/utterances.swig b/layout/_script/_comments/utterances.swig new file mode 100644 index 0000000..8d25d6a --- /dev/null +++ b/layout/_script/_comments/utterances.swig @@ -0,0 +1,15 @@ +{%- if theme.utterances.enable -%} + +{%- endif -%} \ No newline at end of file diff --git a/layout/_script/analytics.swig b/layout/_script/analytics.swig new file mode 100644 index 0000000..ec4b3b0 --- /dev/null +++ b/layout/_script/analytics.swig @@ -0,0 +1,2 @@ +{%- include "_analytics/baidu-analytics.swig" -%} +{%- include "_analytics/google-analytics.swig" -%} \ No newline at end of file diff --git a/layout/_script/comments.swig b/layout/_script/comments.swig new file mode 100644 index 0000000..695dcf5 --- /dev/null +++ b/layout/_script/comments.swig @@ -0,0 +1,7 @@ +{%- if !is_home() and !is_archive() -%} + {%- include "_comments/disqus.swig" -%} + {%- include "_comments/changyan.swig" -%} + {%- include "_comments/livere.swig" -%} + {%- include "_comments/gitalk.swig" -%} + {%- include "_comments/utterances.swig" -%} +{%- endif -%} diff --git a/layout/_script/counter.swig b/layout/_script/counter.swig new file mode 100644 index 0000000..e0381c4 --- /dev/null +++ b/layout/_script/counter.swig @@ -0,0 +1,10 @@ +{%- if theme.leancloud.app_id and theme.leancloud.app_key -%} + + +{%- endif -%} + diff --git a/layout/_script/libs.swig b/layout/_script/libs.swig new file mode 100644 index 0000000..921b504 --- /dev/null +++ b/layout/_script/libs.swig @@ -0,0 +1,18 @@ +{%- if theme.fancybox -%} + {%- set fancybox_js = 'fancybox/jquery.fancybox.pack.js' -%} +{%- endif -%} + +{%- + set js_libs = { + jquery: 'jquery/jquery.min.js', + slideout: 'slideout/slideout.js', + fancybox: fancybox_js, + nprogress: nprogress_js, + } +-%} + +{%- for lib in js_libs -%} + {%- if lib -%} + + {%- endif -%} +{%- endfor -%} diff --git a/layout/_script/push.swig b/layout/_script/push.swig new file mode 100644 index 0000000..20bdf2f --- /dev/null +++ b/layout/_script/push.swig @@ -0,0 +1,14 @@ + diff --git a/layout/_script/theme.swig b/layout/_script/theme.swig new file mode 100644 index 0000000..3be5f22 --- /dev/null +++ b/layout/_script/theme.swig @@ -0,0 +1 @@ + diff --git a/layout/archive.swig b/layout/archive.swig new file mode 100644 index 0000000..61f395c --- /dev/null +++ b/layout/archive.swig @@ -0,0 +1,16 @@ +{%- extends "_layout.swig" -%} +{%- import '_macro/archive.swig' as archive_template -%} + +{%- block title -%} + {%- if page.archive -%} + {{ __('menu.archives') }} - {{ config.title }} + {%- elif page.tag -%} + {{ page.tag }} · {{ config.title }} + {%- elif page.category -%} + {{ page.category }} · {{ config.title }} + {%- endif -%} +{%- endblock -%} + +{%- block content -%} + {{ archive_template.render() }} +{%- endblock -%} diff --git a/layout/categories.swig b/layout/categories.swig new file mode 100644 index 0000000..a863231 --- /dev/null +++ b/layout/categories.swig @@ -0,0 +1,14 @@ +{%- extends "_layout.swig" -%} + +{%- block title -%} {{ __('menu.categories') }} - {{ config.title }} {%- endblock -%} + +{%- block content -%} +
+
+ {{ _p('counter.categories', site.categories.length) }} +
+
+ {{ list_categories({style: null, separator: ' ', depth: '-1'}) }} +
+
+{%- endblock -%} diff --git a/layout/index.swig b/layout/index.swig new file mode 100644 index 0000000..1c374e8 --- /dev/null +++ b/layout/index.swig @@ -0,0 +1,19 @@ +{%- extends "_layout.swig" -%} +{%- import '_macro/post.swig' as post_template -%} +{%- import '_macro/archive.swig' as archive_template -%} + +{%- block title -%} {{ config.title }} {%- endblock -%} + +{%- block content -%} + {%- set mode = theme.mode.toLowerCase() -%} +
+ {%- if mode == 'default' -%} + {%- for post in page.posts -%} + {{ post_template.render(post) }} + {%- endfor -%} + {%- include "_partial/pagination.swig" -%} + {%- else -%} + {{ archive_template.render() }} + {%- endif -%} +
+{%- endblock -%} diff --git a/layout/page.swig b/layout/page.swig new file mode 100644 index 0000000..69ee280 --- /dev/null +++ b/layout/page.swig @@ -0,0 +1,11 @@ +{%- extends "_layout.swig" -%} + +{%- block title -%} {{ page.title }} - {{ config.title }} {%- endblock -%} + +{%- block content -%} +
+
+ {{ page.content }} +
+
+{%- endblock -%} diff --git a/layout/post.swig b/layout/post.swig new file mode 100644 index 0000000..eea81ae --- /dev/null +++ b/layout/post.swig @@ -0,0 +1,8 @@ +{%- extends "_layout.swig" -%} +{%- import '_macro/post.swig' as post_template -%} + +{%- block title -%} {{ page.title }} - {{ config.title }} {%- endblock -%} + +{%- block content -%} + {{ post_template.render(page) }} +{%- endblock -%} diff --git a/layout/tags.swig b/layout/tags.swig new file mode 100644 index 0000000..77ddf18 --- /dev/null +++ b/layout/tags.swig @@ -0,0 +1,14 @@ +{%- extends "_layout.swig" -%} + +{%- block title -%} {{ __('menu.tags') }} - {{ config.title }} {%- endblock -%} + +{%- block content -%} +
+
+ {{ _p('counter.tagcloud', site.tags.length) }} +
+
+ {{ tagcloud({min_font: 16, max_font: 28, amount: 100, orderby: 'count'}) }} +
+
+{%- endblock -%} diff --git a/source/css/_base.scss b/source/css/_base.scss new file mode 100644 index 0000000..4084de4 --- /dev/null +++ b/source/css/_base.scss @@ -0,0 +1,102 @@ +@import '_common/normalize'; + +html { + font-size: $global-font-size; + box-sizing: border-box; +} + +body { + padding: 0; + margin: 0; + font-family: $global-font-family; + font-weight: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + line-height: $global-lineheight; + color: $global-font-color; + background: $global-background; + scroll-behavior: smooth; + border-top: 3px solid $theme-color; + + &.hide-top { + border-top: 3px solid transparent; + } +} + +@include max-screen() { + body { + border-top: 0; + } +} + +::selection { + background: $theme-color; + color: #fff; +} + +// ::-webkit-scrollbar { +// width: 8px; +// height: 6px; +// } + +// ::-webkit-scrollbar-thumb { +// background: lighten($theme-color, 10%); +// border-radius: 5px; +// } + +// ::-webkit-scrollbar-track { +// background: rgba(211, 211, 211, 0.4); +// border-radius: 5px; +// } + +img { + max-width: 100%; + height: auto; + display: inline-block; + vertical-align: middle; +} + +a { + color: $global-font-color; + text-decoration: none; +} + +@each $header, $size in $global-headings { + #{$header} { + font-size: $size; + font-family: $global-serif-font-family; + } +} + +.container { + margin: 0 auto; + width: $global-body-width; +} + +@include max-screen() { + .container { + width: 100%; + box-shadow: -1px -5px 5px $gray; + } +} + +.content-wrapper { + padding: $global-container-padding; +} + +// make video fluid: +// https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php +// class video-container is the wrapper used by hexo youtube tag plugin +.video-container { + position: relative; + padding-bottom: 56.25%; /* 16:9 */ + padding-top: 25px; + height: 0; +} +.video-container iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} diff --git a/source/css/_common/_animation.scss b/source/css/_common/_animation.scss new file mode 100644 index 0000000..2c3934c --- /dev/null +++ b/source/css/_common/_animation.scss @@ -0,0 +1,153 @@ +@mixin underline-from-center() { + display: inline-block; + vertical-align: middle; + transform: translateZ(0); + backface-visibility: hidden; + box-shadow: 0 0 1px transparent; + position: relative; + overflow: hidden; + + &:before { + content: ''; + position: absolute; + z-index: -1; + height: 2px; + bottom: 0; + left: 51%; + right: 51%; + background: $theme-color; + transition-duration: 0.2s; + transition-property: right, left; + transition-timing-function: ease-out; + } + + &.active, + &:active, + &:focus, + &:hover { + &:before { + right: 0; + left: 0; + } + } +} + +@mixin mobile-menu-icon() { + @keyframes clickfirst { + 0% { + transform: translateY(6px) rotate(0deg); + + } + + 100% { + transform: translateY(0) rotate(45deg); + } + } + + @keyframes clickmid { + 0% { + opacity: 1; + } + + 100% { + opacity: 0; + } + } + + @keyframes clicklast { + 0% { + transform: translateY(-6px) rotate(0deg); + } + + 100% { + transform: translateY(0) rotate(-45deg); + } + } + + @keyframes outfirst { + 0% { + transform: translateY(0) rotate(-45deg); + } + + 100% { + transform: translateY(-6px) rotate(0deg); + } + } + + @keyframes outmid { + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } + } + + @keyframes outlast { + 0% { + transform: translateY(0) rotate(45deg); + } + + 100% { + transform: translateY(6px) rotate(0deg); + } + } + + span { + position: absolute; + left: calc((100% - 20px) / 2); + top: calc((100% - 1px) / 2); + width: 20px; + height: 1px; + background-color: $theme-color; + + &:nth-child(1) { + transform: translateY(6px) rotate(0deg); + } + + &:nth-child(3) { + transform: translateY(-6px) rotate(0deg); + } + } + + &.icon-click { + span:nth-child(1) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: clickfirst; + } + + span:nth-child(2) { + animation-duration: 0.2s; + animation-fill-mode: both; + animation-name: clickmid; + } + + span:nth-child(3) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: clicklast; + } + } + + &.icon-out { + span:nth-child(1) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: outfirst; + } + + span:nth-child(2) { + animation-duration: 0.2s; + animation-fill-mode: both; + animation-name: outmid; + } + + span:nth-child(3) { + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: outlast; + } + } +} \ No newline at end of file diff --git a/source/css/_common/_normalize.scss b/source/css/_common/_normalize.scss new file mode 100644 index 0000000..81c6f31 --- /dev/null +++ b/source/css/_common/_normalize.scss @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} \ No newline at end of file diff --git a/source/css/_common/_utils.scss b/source/css/_common/_utils.scss new file mode 100644 index 0000000..1c7b777 --- /dev/null +++ b/source/css/_common/_utils.scss @@ -0,0 +1,23 @@ +@mixin clearfix() { + &:before, + &:after { + content: " "; + display: table; + } + + &:after { + clear: both; + } +} + +@mixin min-screen($min-width: $global-body-width) { + @media screen and (min-width: $min-width) { + @content; + } +} + +@mixin max-screen($max-width: $global-body-width) { + @media screen and (max-width: $max-width) { + @content; + } +} diff --git a/source/css/_custom/_custom.scss b/source/css/_custom/_custom.scss new file mode 100644 index 0000000..f7cbb5a --- /dev/null +++ b/source/css/_custom/_custom.scss @@ -0,0 +1,4 @@ +// ============================== +// Custom style +// ============================== +// You can override the variables in _variables.scss to customize the style diff --git a/source/css/_partial/_archive.scss b/source/css/_partial/_archive.scss new file mode 100644 index 0000000..855d77c --- /dev/null +++ b/source/css/_partial/_archive.scss @@ -0,0 +1,100 @@ +// ============================== +// Archive +// ============================= + +.archive { + margin: $archive-margin; + max-width: $archive-max-width; + + .archive-title { + font-family: $global-serif-font-family; + + &.tag, + &.category { + margin: 15px 0; + } + + .archive-name { + margin: 0; + display: inline-block; + font-weight: 400; + font-size: $archive-name-font-size; + line-height: $archive-name-font-size + 2px; + } + + .archive-post-counter { + display: none; + color: $dark-gray; + } + } + + .collection-title { + font-family: $global-serif-font-family; + + .archive-year { + margin: 15px 0; + font-weight: 400; + font-size: $collection-title-font-size; + line-height: $collection-title-font-size + 2px; + } + } + + .archive-post { + padding: $archive-post-padding; + border-left: $archive-post-border-left; + + .archive-post-time { + margin-right: 10px; + color: $dark-gray; + } + + .archive-post-title { + .archive-post-link { + color: $theme-color; + } + } + + &::first-child { + margin-top: 10px; + } + + &:hover { + border-left: $archive-post-hover-border-left; + transition: $archive-post-hover-transition; + transform: $archive-post-hover-transform; + + .archive-post-time { + color: darken($dark-gray, 10%); + } + + .archive-post-title .archive-post-link { + color: darken($theme-color, 10%); + } + } + } +} + +@include max-screen() { + .archive { + margin-left: auto; + margin-right: auto; + + .archive-title .archive-name { + font-size: $archive-name-font-size - 4px; + } + + .collection-title .archive-year { + margin: 10px 0; + font-size: $collection-title-font-size - 4px; + } + + .archive-post { + padding: $archive-post-mobile-padding; + + .archive-post-time { + font-size: $archive-post-mobile-time-font-size; + display: block; + } + } + } +} diff --git a/source/css/_partial/_back-to-top.scss b/source/css/_partial/_back-to-top.scss new file mode 100644 index 0000000..37eb0d2 --- /dev/null +++ b/source/css/_partial/_back-to-top.scss @@ -0,0 +1,24 @@ +// ============================== +// Back to top +// ============================= + +.back-to-top { + display: none; + position: fixed; + right: 20px; + bottom: 20px; + transition-property: transform; + transition-timing-function: ease-out; + transition-duration: 0.3s; + z-index: 10; + + &:hover { + transform: translateY(-5px); + } +} + +@include max-screen() { + .back-to-top { + display: none !important; + } +} diff --git a/source/css/_partial/_categories.scss b/source/css/_partial/_categories.scss new file mode 100644 index 0000000..f9c413d --- /dev/null +++ b/source/css/_partial/_categories.scss @@ -0,0 +1,43 @@ + +.categories { + margin: 2em 0 3em; + text-align: center; + font-family: $global-serif-font-family; + + .categories-title { + display: inline-block; + font-size: $categories-title-size; + color: $theme-color; + border-bottom: $categories-title-border-bottom; + } + + .categories-tags { + margin: 10px 0; + + .category-link { + display: inline-block; + position: relative; + margin: $categories-tags-link-margin; + word-wrap: break-word; + transition-duration: 0.2s; + transition-property: transform; + transition-timing-function: ease-out; + + .category-count { + display: inline-block; + position: relative; + top: -8px; + right: -2px; + color: $theme-color; + font-size: $category-count-font-size; + } + + &:active, + &:focus, + &:hover { + color: $theme-color; + transform: scale(1.1); + } + } + } +} \ No newline at end of file diff --git a/source/css/_partial/_footer.scss b/source/css/_partial/_footer.scss new file mode 100644 index 0000000..1f8cdae --- /dev/null +++ b/source/css/_partial/_footer.scss @@ -0,0 +1,10 @@ +// ============================== +// Post footer +// ============================= + +.footer { + margin-top: $footer-margin-top; + + @import "_footer/social"; + @import "_footer/copyright"; +} \ No newline at end of file diff --git a/source/css/_partial/_footer/_copyright.scss b/source/css/_partial/_footer/_copyright.scss new file mode 100644 index 0000000..7d33fe3 --- /dev/null +++ b/source/css/_partial/_footer/_copyright.scss @@ -0,0 +1,23 @@ +// ============================== +// Copyright +// ============================= + +.copyright { + margin: $copyright-margin; + color: $dark-gray; + text-align: center; + font-family: $global-serif-font-family; + + .hexo-link, + .theme-link { + color: $theme-color; + } + + .copyright-year { + display: block; + + .heart { + font-size: 14px; + } + } +} \ No newline at end of file diff --git a/source/css/_partial/_footer/_social.scss b/source/css/_partial/_footer/_social.scss new file mode 100644 index 0000000..a23eb69 --- /dev/null +++ b/source/css/_partial/_footer/_social.scss @@ -0,0 +1,19 @@ +// ============================== +// Social +// ============================= + +.social-links { + text-align: center; + + .iconfont { + font-size: $social-icon-font-size; + + & + .iconfont { + margin-left: $social-link-margin-left; + } + + &:hover { + color: $theme-color; + } + } +} \ No newline at end of file diff --git a/source/css/_partial/_header.scss b/source/css/_partial/_header.scss new file mode 100644 index 0000000..d81f17c --- /dev/null +++ b/source/css/_partial/_header.scss @@ -0,0 +1,19 @@ +// ============================== +// Header +// ============================== + +.header { + @include clearfix; + padding: $header-padding; + + @import '_header/logo'; + @import '_header/menu'; +} + + +@include max-screen() { + .header { + padding: 50px 0 0; + text-align: center; + } +} diff --git a/source/css/_partial/_header/_logo.scss b/source/css/_partial/_header/_logo.scss new file mode 100644 index 0000000..cd6435f --- /dev/null +++ b/source/css/_partial/_header/_logo.scss @@ -0,0 +1,18 @@ +// ============================== +// Logo +// ============================= + +.logo-wrapper { + float: left; + + .logo { + font-size: $logo-font-size; + font-family: $logo-font-family; + } +} + +@include max-screen() { + .logo-wrapper { + display: none; + } +} diff --git a/source/css/_partial/_header/_menu.scss b/source/css/_partial/_header/_menu.scss new file mode 100644 index 0000000..7209c80 --- /dev/null +++ b/source/css/_partial/_header/_menu.scss @@ -0,0 +1,35 @@ +// ============================== +// Menu +// ============================= + +.site-navbar { + float: right; + + .menu { + display: inline-block; + position: relative; + padding-left: 0; + padding-right: 25px; + font-family: $global-serif-font-family; + + .menu-item { + display: inline-block; + + & + .menu-item { + margin-left: $menu-item-margin-left;; + } + + @include underline-from-center; + } + + .menu-item-link { + font-size: $menu-link-font-size; + } + } +} + +@include max-screen() { + .site-navbar { + display: none; + } +} diff --git a/source/css/_partial/_iconfont.scss b/source/css/_partial/_iconfont.scss new file mode 100644 index 0000000..cf8c967 --- /dev/null +++ b/source/css/_partial/_iconfont.scss @@ -0,0 +1,102 @@ +// ============================== +// Iconfont +// ============================== + +@font-face { + font-family: 'iconfont'; /* project id 96542 */ + src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot'); + src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.woff') format('woff'), + url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.ttf') format('truetype'), + url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.svg#iconfont') format('svg'); +} + +.iconfont { + font-family: "iconfont" !important; + font-style: normal; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0.2px; + -moz-osx-font-smoothing: grayscale; + cursor: pointer; +} + +.icon-instagram:before { + font-size: .95em; + content: "\e611"; + position: relative; + top: -1px; +} +.icon-douban:before { + content: "\e610"; +} +.icon-tumblr:before { + content: "\e69f"; + font-size: .85em; + position: relative; + top: -4px; +} +.icon-linkedin:before { + content: "\e60d"; + position: relative; + top: -4px; +} +.icon-twitter:before { + content: "\e600"; +} +.icon-weibo:before { + content: "\e602"; +} +.icon-stack-overflow:before { + content: "\e603"; + font-size: .85em; + position: relative; + top: -4px; +} +.icon-email:before { + content: "\e605"; + position: relative; + top: -2px; +} +.icon-facebook:before { + content: "\e601"; + font-size: .95em; + position: relative; + top: -2px; +} +.icon-github:before { + content: "\e606"; + position: relative; + top: -3px; +} +.icon-rss:before { + content: "\e604"; +} +.icon-google:before { + content: "\e609"; +} +.icon-zhihu:before { + content: "\e607"; + font-size: .9em; + position: relative; + top: -2px; +} +.icon-pocket:before { + content: "\e856"; +} + +/* Generic Icon */ +.icon-heart:before { + content: "\e608"; +} +.icon-right:before { + content: "\e60a"; +} +.icon-left:before { + content: "\e60b"; +} +.icon-up:before { + content: "\e60c"; +} +.icon-close:before { + content: "\e60f"; +} diff --git a/source/css/_partial/_mathjax.scss b/source/css/_partial/_mathjax.scss new file mode 100644 index 0000000..7499261 --- /dev/null +++ b/source/css/_partial/_mathjax.scss @@ -0,0 +1,4 @@ +.mjx-chtml:focus { + padding: 1px 0; + outline: none; +} diff --git a/source/css/_partial/_mobile.scss b/source/css/_partial/_mobile.scss new file mode 100644 index 0000000..26e4c76 --- /dev/null +++ b/source/css/_partial/_mobile.scss @@ -0,0 +1,77 @@ +// ============================== +// Mobile Navbar +// ============================== + +.mobile-navbar { + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: $mobile-navbar-height; + background: $white; + box-shadow: 0px 2px 2px $gray; + text-align: center; + transition: transform 300ms ease; + z-index: 99; + + &.fixed-open { + transform: translate3d(180px, 0px, 0px); + } + + .mobile-header-logo { + display: inline-block; + margin-right: 50px; + + .logo { + font-size: 22px; + line-height: $mobile-navbar-height; + font-family: $logo-font-family; + } + } + + .mobile-navbar-icon { + color: $theme-color; + height: $mobile-navbar-height; + width: $mobile-navbar-height; + font-size: 24px; + text-align: center; + float: left; + position: relative; + transition: background 0.5s; + + @include mobile-menu-icon(); + } +} + +.mobile-menu { + background-color: rgba($deputy-color, 0.5); + + .mobile-menu-list { + position: relative; + list-style: none; + margin-top: 50px; + padding: 0; + border-top: 1px solid $deputy-color; + + .mobile-menu-item { + padding: 10px 30px; + border-bottom: 1px solid $deputy-color; + } + + a { + font-size: 18px; + font-family: $global-serif-font-family; + + &:hover { + color: $theme-color; + } + } + } +} + +@include max-screen() { + .mobile-navbar { + display: block; + } +} diff --git a/source/css/_partial/_pagination.scss b/source/css/_partial/_pagination.scss new file mode 100644 index 0000000..c58f8db --- /dev/null +++ b/source/css/_partial/_pagination.scss @@ -0,0 +1,36 @@ +// ============================== +// Pagination +// ============================== + +.pagination { + margin: $pagination-margin; + @include clearfix; + + .prev, + .next { + font-weight: 600; + font-size: $pagination-font-size; + font-family: $global-serif-font-family; + transition-property: transform; + transition-timing-function: ease-out; + transition-duration: 0.3s; + } + + .prev { + float: left; + + &:hover { + color: $theme-color; + transform: translateX(-4px); + } + } + + .next { + float: right; + + &:hover { + color: $theme-color; + transform: translateX(4px); + } + } +} \ No newline at end of file diff --git a/source/css/_partial/_post.scss b/source/css/_partial/_post.scss new file mode 100644 index 0000000..c38b580 --- /dev/null +++ b/source/css/_partial/_post.scss @@ -0,0 +1,22 @@ +// ============================== +// Post +// ============================== + +.posts { + margin-bottom: $post-list-margin-bottom; +} + +.post { + padding: $post-padding; + + & + .post { + border-top: $post-border; + } + + @import '_post/header'; + @import '_post/toc'; + @import '_post/content'; + @import '_post/copyright'; + @import '_post/reward'; + @import '_post/footer'; +} diff --git a/source/css/_partial/_post/_code.scss b/source/css/_partial/_post/_code.scss new file mode 100644 index 0000000..546872e --- /dev/null +++ b/source/css/_partial/_post/_code.scss @@ -0,0 +1,166 @@ +code, pre { + padding: 7px; + font-size: $code-font-size; + font-family: $code-font-family; + background: $code-background; +} + +code { + padding: 3px 5px; + border-radius: 4px; + color: $code-color; +} + +.highlight { + margin: 1em 0; + border-radius: 5px; + overflow-x: auto; + box-shadow: 1px 1px 2px rgba(0,0,0,0.125); + position: relative; + + table { + position: relative; + max-width: none; + + &::after { + position: absolute; + top: 0; + right: 0; + left: 0; + padding: 2px 7px; + font-size: $code-font-size; + font-weight: bold; + color: darken($gray, 10%); + background: darken($code-background, 3%); + content: 'Code'; + } + } + + @each $sign, $text in $code-type-list { + &.#{$sign} > table::after { + content: $text; + } + + &.#{$sign} > figcaption > span::after { + content: ' · ' + $text; + } + + &.#{$sign} figcaption + table { + &::after { + display: none; + } + } + } + + figcaption { + position: absolute; + top: 0; + width: 100%; + padding: 2px 7px; + font-size: $code-font-size; + font-weight: bold; + color: darken($gray, 10%); + background: darken($code-background, 3%); + z-index: 20; + overflow-x: hidden; + box-sizing: border-box; + + & > a { + position: absolute; + right: 0; + display: inline-box; + margin-right: 7px; + font-weight: 400; + + &:hover { + text-decoration: none; + border: 0; + } + } + } + + .code { + pre { + margin: 0; + padding: 30px 10px 10px; + } + } + + .gutter { + width: 10px; + color: $gray; + + pre { + margin: 0; + padding: 30px 7px 10px; + } + } + + .line { + // Fix code block null line height and + // Synchronous gutter and code line highly. + height: round($code-font-size * 1.5); + } + + table, tr, td { + margin: 0; + padding: 0; + width: 100%; + border-collapse: collapse; + } + + .code { + .comment, + .quote { + color: map-get($code-highlight-color, comment); + } + + .keyword, + .selector-tag, + .addition { + color: map-get($code-highlight-color, keyword); + } + + .number, + .string, + .meta .meta-string, + .literal, + .doctag, + .regexp { + color: map-get($code-highlight-color, number); + } + + .title, + .section, + .name, + .selector-id, + .selector-class { + color: map-get($code-highlight-color, title); + } + + .attribute, + .attr, + .variable, + .template-variable, + .class .title, + .type { + color: map-get($code-highlight-color, attribute); + } + + .symbol, + .bullet, + .subst, + .meta, + .meta .keyword, + .selector-attr, + .selector-pseudo, + .link { + color: map-get($code-highlight-color, symbol); + } + + .built_in, + .deletion { + color: map-get($code-highlight-color, built_in); + } + } +} diff --git a/source/css/_partial/_post/_content.scss b/source/css/_partial/_post/_content.scss new file mode 100644 index 0000000..3b8d691 --- /dev/null +++ b/source/css/_partial/_post/_content.scss @@ -0,0 +1,107 @@ +// ============================== +// Post content +// ============================== + +.post-content { + @for $i from 1 through 6 { + h#{$i} { + font-weight: 400; + font-family: $global-serif-font-family; + } + } + + .headerlink { + &:hover { + border-bottom: 0; + } + + @if $content-headings-anchor != "" { + &::before { + content: $content-headings-anchor; + margin-right: 5px; + font-size: 1.1em; + color: $theme-color; + } + } + } + + a { + color: $theme-color; + word-break: break-all; + + &:hover { + border-bottom: $content-link-border; + } + + &.fancybox { + border: 0; + } + } + + ul { + padding-left: 0; + list-style: inside; + + li { + input[type="checkbox"] { + margin-right: 5px; + } + } + } + + blockquote { + margin: 2em 0; + padding: 10px 20px; + position: relative; + color: rgba(#34495e, 0.8); + background-color: $content-blockquote-backgroud; + border-left: $content-blockquote-border-left; + box-shadow: 1px 1px 2px rgba(0,0,0,0.125); + + p { + margin: 0; + } + } + + img { + display: inline-block; + max-width: 100%; + } + + .table-responsive { + width: 100%; + margin-bottom: 20px; + overflow: auto; + border: 3px double $content-table-border-color; + } + + table { + width: 100%; + max-width: 100%; + border-spacing: 0; + box-shadow: 2px 2px 3px rgba(0,0,0,.125); + + thead { + background: $deputy-color; + } + + th, td { + padding: 5px 15px; + border: 1px double $content-table-border-color; + } + } + + @import 'code'; + + .read-more { + .read-more-link { + color: $theme-color; + font-size: 1.1em; + font-family: $global-serif-font-family; + + &:hover { + border-bottom: $post-readMore-border-bottom; + } + } + } +} diff --git a/source/css/_partial/_post/_copyright.scss b/source/css/_partial/_post/_copyright.scss new file mode 100644 index 0000000..524cd1d --- /dev/null +++ b/source/css/_partial/_post/_copyright.scss @@ -0,0 +1,13 @@ +.post-copyright { + margin-top: 20px; + padding-top: 10px; + border-top: 1px dashed $light-gray; + + .copyright-item { + margin: 5px 0; + + a { + color: $theme-color; + } + } +} diff --git a/source/css/_partial/_post/_footer.scss b/source/css/_partial/_post/_footer.scss new file mode 100644 index 0000000..012110f --- /dev/null +++ b/source/css/_partial/_post/_footer.scss @@ -0,0 +1,74 @@ +// ============================== +// Post footer +// ============================== + +.post-footer { + margin-top: $post-footer-margin-top; + border-top: $post-footer-border-top; + font-family: $global-serif-font-family; + + .post-tags { + padding: $post-tags-padding; + + a { + margin-right: 5px; + color: $theme-color; + word-break: break-all; + + &::before { + content: '#'; + } + } + } + + .post-nav { + margin: 1em 0; + @include clearfix; + + .prev, + .next { + font-weight: 600; + font-size: $post-nav-font-size; + font-family: $global-serif-font-family; + transition-property: transform; + transition-timing-function: ease-out; + transition-duration: 0.3s; + } + + .prev { + float: left; + + &:hover { + color: $theme-color; + transform: translateX(-4px); + } + } + + .next { + float: right; + + &:hover { + color: $theme-color; + transform: translateX(4px); + } + } + + .nav-mobile { + display: none; + } + } +} + +@include max-screen() { + .post-footer { + .post-nav { + .nav-default { + display: none; + } + + .nav-mobile { + display: inline; + } + } + } +} \ No newline at end of file diff --git a/source/css/_partial/_post/_header.scss b/source/css/_partial/_post/_header.scss new file mode 100644 index 0000000..2c76d94 --- /dev/null +++ b/source/css/_partial/_post/_header.scss @@ -0,0 +1,57 @@ +.post-header { + margin-bottom: 20px; + + .post-title { + margin: 0; + font-size: $post-title-font-size; + font-weight: $post-title-font-weight; + font-family: $global-serif-font-family; + } + + .post-link { + @include underline-from-center; + } + + .post-meta { + .post-time { + font-size: 15px; + color: $post-meta-font-color; + } + + .post-category { + display: inline; + font-size: 14px; + color: $post-meta-font-color; + + &::before { + content: '·'; + } + + a { + color: inherit; + + & + a { + &::before { + content: '/'; + margin-right: 3px; + color: $post-meta-font-color !important; + } + } + + &:hover { + color: $theme-color; + } + } + } + + .post-visits { + display: inline-block; + font-size: 14px; + color: $post-meta-font-color; + + &::before { + content: '·'; + } + } + } +} diff --git a/source/css/_partial/_post/_reward.scss b/source/css/_partial/_post/_reward.scss new file mode 100644 index 0000000..55728e7 --- /dev/null +++ b/source/css/_partial/_post/_reward.scss @@ -0,0 +1,48 @@ +.post-reward { + margin-top: 20px; + padding-top: 10px; + text-align: center; + border-top: 1px dashed $light-gray; + + .reward-button { + margin: 15px 0; + padding: 3px 7px; + display: inline-block; + color: $theme-color; + border: 1px solid $theme-color; + border-radius: 5px; + cursor: pointer; + + &:hover { + color: $white; + background-color: $theme-color; + transition: 0.5s; + } + } + + #reward:checked { + & ~ .qr-code { + display: block; + } + + & ~ .reward-button { + display: none; + } + } + + .qr-code { + display: none; + margin-top: 15px; + + .qr-code-image { + display: inline-block; + min-width: 200px; + width: 40%; + } + + .image { + width: 200px; + height: 200px; + } + } +} \ No newline at end of file diff --git a/source/css/_partial/_post/_toc.scss b/source/css/_partial/_post/_toc.scss new file mode 100644 index 0000000..e00c371 --- /dev/null +++ b/source/css/_partial/_post/_toc.scss @@ -0,0 +1,47 @@ +.post-toc { + position: absolute; + width: $post-toc-width; + margin-left: $post-toc-margin-left; + padding: 10px; + font-family: $global-serif-font-family; + border-radius: 5px; + background: $post-toc-backgroud; + box-shadow: 1px 1px 2px rgba(0,0,0,0.125); + word-wrap: break-word; + box-sizing: border-box; + + .post-toc-title { + margin: 0 10px; + font-size: $post-toc-title-size; + font-weight: 400; + text-transform: uppercase; + } + + .post-toc-content { + font-size: $post-toc-content; + + .toc, + .toc-child { + list-style: $post-toc-list-style; + } + + .toc { + margin: 10px 0; + padding-left: 20px; + + .toc-child { + padding-left: 15px; + } + } + + .toc-link.active { + color: $theme-color; + } + } +} + +@include max-screen($toc-max-sreen-width) { + .post-toc { + display: none; + } +} diff --git a/source/css/_partial/_slideout.scss b/source/css/_partial/_slideout.scss new file mode 100644 index 0000000..2dc757d --- /dev/null +++ b/source/css/_partial/_slideout.scss @@ -0,0 +1,33 @@ +// ============================== +// slideout (https://github.com/mango/slideout) +// ============================== + +.slideout-menu { + position: fixed; + top: 0; + left: 0px; + bottom: 0; + width: 180px; + min-height: 100vh; + overflow-y: hidden; + -webkit-overflow-scrolling: touch; + z-index: 0; + display: none; +} + +.slideout-panel { + position: relative; + z-index: 1; + background-color: $white; + min-height: 100vh; +} + +.slideout-open, +.slideout-open body, +.slideout-open .slideout-panel { + overflow: hidden; +} + +.slideout-open .slideout-menu { + display: block; +} diff --git a/source/css/_partial/_tags.scss b/source/css/_partial/_tags.scss new file mode 100644 index 0000000..8c1cc5a --- /dev/null +++ b/source/css/_partial/_tags.scss @@ -0,0 +1,37 @@ +// ============================== +// Tags +// ============================= + +.tag-cloud { + margin: 2em 0 3em; + text-align: center; + font-family: $global-serif-font-family; + + .tag-cloud-title { + display: inline-block; + font-size: $tag-cloud-title-size; + color: $theme-color; + border-bottom: $tag-cloud-title-border-bottom; + } + + .tag-cloud-tags { + margin: 10px 0; + + a { + display: inline-block; + position: relative; + margin: $tag-cloud-tags-link-margin; + word-wrap: break-word; + transition-duration: 0.2s; + transition-property: transform; + transition-timing-function: ease-out; + + &:active, + &:focus, + &:hover { + color: $theme-color; + transform: scale(1.1); + } + } + } +} \ No newline at end of file diff --git a/source/css/_variables.scss b/source/css/_variables.scss new file mode 100644 index 0000000..df6e9c9 --- /dev/null +++ b/source/css/_variables.scss @@ -0,0 +1,314 @@ +// ============================== +// Variables +// ============================== + +// ========== Theme Color ========== // +// Theme color config from `even/_config.yml` +$theme-color-config: to-lower-case(hexo-theme-config('color')); + +// Default theme color map +$theme-color-map: ( + 'default': #c05b4d #f8f5ec, + 'mint green': #16982B #f5f5f5, + 'cobalt blue': #0047AB #f0f2f5, + 'hot pink': #FF69B4 #f8f5f5, + 'dark violet': #9932CC #f5f4fa +); + +// Check theme color config. +// if it does not exist, use default theme color. +@if not(map-has-key($theme-color-map, $theme-color-config)) { + $theme-color-config: 'default'; +} +$theme-color-list: map-get($theme-color-map, $theme-color-config); + +// Default theme color of the site. +$theme-color: nth($theme-color-list, 1) !default; + +// Deputy theme color of the site. +$deputy-color: nth($theme-color-list, 2) !default; + +// ========== Color ========== // +$black: #0a0a0a !default; +$white: #fefefe !default; +$light-gray: #e6e6e6 !default; +$gray: #cacaca !default; +$dark-gray: #8a8a8a !default; + + +// ========== Global ========== // +// Text color of the body. +$global-font-color: #34495e !default; + +// Font size attribute applied to '' and ''. +$global-font-size: 16px !default; + +// Global width of ''. +$global-body-width: 800px !default; + +// Padding of container main +$global-container-padding: 0 20px !default; + +// Default line height for all type. `$global-lineheight` is 24px while `$global-font-size` is 16px. +$global-lineheight: 1.5 !default; + +// Font family of the site. +$global-font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif !default; + +// Serif font family of the site. +$global-serif-font-family: Athelas, STHeiti, Microsoft Yahei, serif !default; + +// Background color of the site. +$global-background: $white !default; + +// Headings font size of the site. +$global-headings: ( + h1: 26px, + h2: 24px, + h3: 20px, + h4: 16px, + h5: 14px, + h6: 14px +) !default; + + +// ========== Header ========== // +// Padding of the site header. +$header-padding: 20px 20px !default; + +// Font family: Chancery +@font-face { + font-family: 'Chancery'; + src: url('../fonts/chancery/apple-chancery-webfont.eot'); + src: local('Apple Chancery'), url('../fonts/chancery/apple-chancery-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/chancery/apple-chancery-webfont.woff2') format('woff2'), + url('../fonts/chancery/apple-chancery-webfont.woff') format('woff'), + url('../fonts/chancery/apple-chancery-webfont.ttf') format('truetype'), + url('../fonts/chancery/apple-chancery-webfont.svg#apple-chancery') format('svg'); + font-weight: lighter; + font-style: normal; +} + +// Font size of the logo. +$logo-font-size: 48px !default; + +// Font family of the logo. +$logo-font-family: 'Chancery', cursive, LiSu, sans-serif !default; + +// Margin of menu item. +$menu-item-margin-left: 10px !default; + +// Margin of menu item in mobile. +$menu-item-mobile-margin: 5px !default; + +// Font size of menu item link. +$menu-link-font-size: 18px !default; + +// Height of the mobile header. +$mobile-navbar-height: 50px !default; + +// ========== Post ========== // +// Margin bottom of post list. +$post-list-margin-bottom: 20px !default; + +// Padding of the post. +$post-padding: 1.5em 0 !default; + +// Border top of the post + post. +$post-border: 1px solid $light-gray !default; + +// Font size of post title. +$post-title-font-size: 27px !default; + +// Font weight of post title. +$post-title-font-weight: 400 !default; + +// Margin top of the post meta (post time). +$post-meta-margin-top: 5px !default; + +// Font color of the post meta. +$post-meta-font-color: $dark-gray !default; + +// Border bottom of the read more link when hover it. +$post-readMore-border-bottom: 1px solid $theme-color !default; + +// Margin top of the post footer. +$post-footer-margin-top: 20px !default; + +// Border top of post footer. +$post-footer-border-top: 1px solid $light-gray !default; + +// Padding of the post tags. +$post-tags-padding: 15px 0 !default; + +// Font size of post pagination. +$post-nav-font-size: 18px !default; + + +// ========== TOC ========== // +// Width of the post toc. +$post-toc-width: 200px !default; + +// Backgroud color of the post toc. +$post-toc-backgroud: rgba($deputy-color, 0.6) !default; + +// Margin left of the post toc. +$post-toc-margin-left: $global-body-width - 15px !default; + +// Font size of the post toc title. +$post-toc-title-size: 20px !default; + +// Font size of the post toc content. +$post-toc-content: 15px !default; + +// List style of the post toc list. +$post-toc-list-style: square !default; + +// Max screen media of the post toc. +$toc-max-sreen-width: 2 * $post-toc-width + $post-toc-margin-left !default; + +// ========== Content ========== // +// Headings anchor. +$content-headings-anchor: "" !default; + +// Border bottom of the link when hover it. +$content-link-border: 1px solid $theme-color !default; + +// Background color of the blockquote. +$content-blockquote-backgroud: rgba($theme-color, 0.05) !default; + +// Border left of the blockquote. +$content-blockquote-border-left: 3px solid rgba($theme-color, 0.3) !default; + +// Border color of the table. +$content-table-border-color: darken($deputy-color, 3%) !default; + +// ========== Code ========== // +// Color of the code. +$code-color: #c7254e !default; + +// Font size of code. +$code-font-size: 13px !default; + +// Font family of the code. +$code-font-family: Consolas, Monaco, Menlo, Consolas, monospace !default; + +// Color of code highlight, solarized. +$code-highlight-color: ( + comment: #93a1a1, + keyword: #859900, + number: #2aa198, + title: #268bd2, + attribute: #b58900, + symbol: #cb4b16, + built_in: #dc322f +) !default; + +// Code type list. +$code-type-list: ( + html: "HTML", + js: "JavaScript", + bash: "Bash", + css: "CSS", + scss: "Scss", + java: "Java", + xml: "XML", + python: "Python", + json: "JSON", + swift: "Swift", + ruby: "Ruby", + php: "PHP", + c: "C", + cpp: "C++", + scheme: "Scheme", + objectivec: "Objective-C", + yml: "YAML", + stylus: "Stylus", + sql: "SQL", + http: "HTTP", + go: "Go", + kotlin: "Kotlin" +) !default; + +// Color of the code background. +$code-background: $deputy-color !default; + + +// ========== Pagination ========== // +// Margin of the pagination. +$pagination-margin: 2em 0 !default; + +// Font size of the pagination (Without post, post pagination see line 140). +$pagination-font-size: 20px !default; + + +// ========== Footer ========== // +// Margin top of the footer. +$footer-margin-top: 2em !default; + +// Margin left of the social link. +$social-link-margin-left: 10px !default; + +// Font size of the social icon. +$social-icon-font-size: 30px !default; + +// Margin of the copyright. +$copyright-margin: 10px 0 !default; + + +// ========== Archive ========== // +// Margin of the archive. +$archive-margin: 2em 0px !default; + +// Max width of the archive. +$archive-max-width: 550px !default; + +// Font size of the archive name. +$archive-name-font-size: 30px !default; + +// Font size of the collection title. +$collection-title-font-size: 28px !default; + +// Padding of the archive post. +$archive-post-padding: 3px 20px !default; + +// Padding of the archive post in mobile. +$archive-post-mobile-padding: 5px 10px !default; + +// Font size of the archive post time in mobile. +$archive-post-mobile-time-font-size: 13px !default; + +// Border left of the archive post, use $archive-post-hover-border-left when hover it. +$archive-post-border-left: 1px solid $gray !default; +$archive-post-hover-border-left: 3px solid $theme-color !default; + +// Transition of the archive post when hover it. +$archive-post-hover-transition: 0.2s ease-out !default; + +// Transform of the archive post when hover it. +$archive-post-hover-transform: translateX(4px) !default; + + +// ========== Tags ========== // +// Font soze of the tag cloud title. +$tag-cloud-title-size: 18px !default; + +// Border bottom of the tag cloud title. +$tag-cloud-title-border-bottom: 2px solid $theme-color !default; + +// Margin of the tag cloud tags link. +$tag-cloud-tags-link-margin: 5px 10px !default; + + +// ========== Categories ========== // +// Font soze of the categories title. +$categories-title-size: 18px !default; + +// Border bottom of the categories title. +$categories-title-border-bottom: 2px solid $theme-color !default; + +// Margin of the categories tags link. +$categories-tags-link-margin: 5px 10px !default; + +// Font size of the category count +$category-count-font-size: 12px !default; diff --git a/source/css/style.scss b/source/css/style.scss new file mode 100644 index 0000000..d59eb1a --- /dev/null +++ b/source/css/style.scss @@ -0,0 +1,19 @@ +@import "_variables"; +@import "_custom/custom"; + +@import "_common/utils"; +@import "_common/animation"; + +@import "_base"; +@import "_partial/header"; +@import "_partial/post"; +@import "_partial/pagination"; +@import "_partial/footer"; +@import "_partial/archive"; +@import "_partial/tags"; +@import "_partial/categories"; +@import "_partial/iconfont"; +@import "_partial/slideout"; +@import "_partial/mobile"; +@import "_partial/back-to-top"; +@import "_partial/mathjax"; diff --git a/source/favicon.ico b/source/favicon.ico new file mode 100644 index 0000000..8486d5a Binary files /dev/null and b/source/favicon.ico differ diff --git a/source/fonts/chancery/apple-chancery-webfont.eot b/source/fonts/chancery/apple-chancery-webfont.eot new file mode 100644 index 0000000..39c3936 Binary files /dev/null and b/source/fonts/chancery/apple-chancery-webfont.eot differ diff --git a/source/fonts/chancery/apple-chancery-webfont.svg b/source/fonts/chancery/apple-chancery-webfont.svg new file mode 100644 index 0000000..2b18b6a --- /dev/null +++ b/source/fonts/chancery/apple-chancery-webfont.svg @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/fonts/chancery/apple-chancery-webfont.ttf b/source/fonts/chancery/apple-chancery-webfont.ttf new file mode 100644 index 0000000..8238aa4 Binary files /dev/null and b/source/fonts/chancery/apple-chancery-webfont.ttf differ diff --git a/source/fonts/chancery/apple-chancery-webfont.woff b/source/fonts/chancery/apple-chancery-webfont.woff new file mode 100644 index 0000000..e476776 Binary files /dev/null and b/source/fonts/chancery/apple-chancery-webfont.woff differ diff --git a/source/fonts/chancery/apple-chancery-webfont.woff2 b/source/fonts/chancery/apple-chancery-webfont.woff2 new file mode 100644 index 0000000..922dfb3 Binary files /dev/null and b/source/fonts/chancery/apple-chancery-webfont.woff2 differ diff --git a/source/js/src/kayo.js b/source/js/src/kayo.js new file mode 100644 index 0000000..803c2f8 --- /dev/null +++ b/source/js/src/kayo.js @@ -0,0 +1,253 @@ +(function (window) { + 'use strict'; + + function Kayo(config) { + this.config = config; + } + + Kayo.prototype.setup = function() { + var leancloud = this.config.leancloud; + + this.navbar(); + this.responsiveTable(); + + if (this.config.toc) { + this.scrollToc(); + this.tocFollow(); + } + if (this.config.fancybox) { + this.fancybox(); + } + if (leancloud.app_id && leancloud.app_key) { + this.recordReadings(); + } + if(this.config.latex) { + this.renderLaTeX(); + } + this.backToTop(); + }; + + Kayo.prototype.navbar = function () { + var $nav = $('#mobile-navbar'); + var $navIcon = $('.mobile-navbar-icon'); + + var slideout = new Slideout({ + 'panel': document.getElementById('mobile-panel'), + 'menu': document.getElementById('mobile-menu'), + 'padding': 180, + 'tolerance': 70 + }); + slideout.disableTouch(); + + $navIcon.click(function () { + slideout.toggle(); + }); + + slideout.on('beforeopen', function () { + $nav.addClass('fixed-open'); + $navIcon.addClass('icon-click').removeClass('icon-out'); + }); + + slideout.on('beforeclose', function () { + $nav.removeClass('fixed-open'); + $navIcon.addClass('icon-out').removeClass('icon-click'); + }); + + $('#mobile-panel').on('touchend', function () { + slideout.isOpen() && $navIcon.click(); + }); + }; + + Kayo.prototype.responsiveTable = function () { + var tables = $('.post-content > table') + tables.wrap('
') + }; + + Kayo.prototype.scrollToc = function () { + var SPACING = 20; + var $toc = $('.post-toc'); + var $footer = $('.post-footer'); + + if ($toc.length) { + var minScrollTop = $toc.offset().top - SPACING; + var maxScrollTop = $footer.offset().top - $toc.height() - SPACING; + + var tocState = { + start: { + 'position': 'absolute', + 'top': minScrollTop + }, + process: { + 'position': 'fixed', + 'top': SPACING + }, + end: { + 'position': 'absolute', + 'top': maxScrollTop + } + } + + $(window).scroll(function () { + var scrollTop = $(window).scrollTop(); + + if (scrollTop < minScrollTop) { + $toc.css(tocState.start); + } else if (scrollTop > maxScrollTop) { + $toc.css(tocState.end); + } else { + $toc.css(tocState.process); + } + }) + } + }; + + Kayo.prototype.tocFollow = function () { + var HEADERFIX = 30; + var $toclink = $('.toc-link'), + $headerlink = $('.headerlink'); + + $(window).scroll(function () { + var headerlinkTop = $.map($headerlink, function (link) { + return $(link).offset().top; + }); + var scrollTop = $(window).scrollTop(); + + for (var i = 0; i < $toclink.length; i++) { + var isLastOne = i + 1 === $toclink.length, + currentTop = headerlinkTop[i] - HEADERFIX, + nextTop = isLastOne ? Infinity : headerlinkTop[i + 1] - HEADERFIX; + + if (currentTop < scrollTop && scrollTop <= nextTop) { + $($toclink[i]).addClass('active'); + } else { + $($toclink[i]).removeClass('active'); + } + } + }); + }; + + Kayo.prototype.fancybox = function () { + if ($.fancybox) { + $('.post').each(function () { + $(this).find('img').each(function () { + var href = 'href="' + this.src + '"'; + var title = 'title="' + this.alt + '"'; + $(this).wrap(''); + }); + }); + + $('.fancybox').fancybox({ + openEffect: 'elastic', + closeEffect: 'elastic' + }); + } + }; + + Kayo.prototype.recordReadings = function () { + if (typeof AV !== 'object') return; + + var $visits = $('.post-visits'); + var Counter = AV.Object.extend('Counter'); + if ($visits.length === 1) { + addCounter(Counter); + } else { + showTime(Counter); + } + + function updateVisits(dom, time) { + var readText = dom.text().replace(/(\d+)/i, time) + dom.text(readText); + } + + function addCounter(Counter) { + var query = new AV.Query(Counter); + + var url = $visits.data('url').trim(); + var title = $visits.data('title').trim(); + + query.equalTo('url', url); + query.find().then(function (results) { + if (results.length > 0) { + var counter = results[0]; + counter.save(null, { + fetchWhenSave: true + }).then(function (counter) { + counter.increment('time', 1); + return counter.save(); + }).then(function (counter) { + updateVisits($visits, counter.get('time')); + }); + } else { + var newcounter = new Counter(); + newcounter.set('title', title); + newcounter.set('url', url); + newcounter.set('time', 1); + + var acl = new AV.ACL(); + acl.setWriteAccess('*', true) + acl.setReadAccess('*', true) + newcounter.setACL(acl) + + newcounter.save().then(function () { + updateVisits($visits, newcounter.get('time')); + }); + } + }, function (error) { + // eslint-disable-next-line + console.log('Error:' + error.code + ' ' + error.message); + }); + } + + function showTime(Counter) { + $visits.each(function () { + var $this = $(this); + var query = new AV.Query(Counter); + var url = $this.data('url').trim(); + + query.equalTo('url', url); + query.find().then(function (results) { + if (results.length === 0) { + updateVisits($this, 0); + } else { + var counter = results[0]; + updateVisits($this, counter.get('time')); + } + }, function (error) { + // eslint-disable-next-line + console.log('Error:' + error.code + ' ' + error.message); + }); + }) + } + }; + + Kayo.prototype.backToTop = function () { + var $backToTop = $('#back-to-top'); + + $(window).scroll(function () { + if ($(window).scrollTop() > 100) { + $backToTop.fadeIn(1000); + } else { + $backToTop.fadeOut(1000); + } + }); + + $backToTop.click(function () { + $('body,html').animate({ scrollTop: 0 }); + }); + }; + + Kayo.prototype.renderLaTeX = function () { + var loopID = setInterval(function () { + if(window.MathJax) { + var jax = window.MathJax; + jax.Hub.Config({ tex2jax: { inlineMath: [['$', '$'], ['\\(', '\\)']] }}); + jax.Hub.Queue(['Typeset', jax.Hub, $(document.body)[0]]); + clearInterval(loopID); + } + }, 500); + } + + var config = window.config; + var kayo = new Kayo(config); + kayo.setup(); +}(window)) diff --git a/source/lib/fancybox/blank.gif b/source/lib/fancybox/blank.gif new file mode 100644 index 0000000..35d42e8 Binary files /dev/null and b/source/lib/fancybox/blank.gif differ diff --git a/source/lib/fancybox/fancybox_loading.gif b/source/lib/fancybox/fancybox_loading.gif new file mode 100644 index 0000000..a03a40c Binary files /dev/null and b/source/lib/fancybox/fancybox_loading.gif differ diff --git a/source/lib/fancybox/fancybox_loading@2x.gif b/source/lib/fancybox/fancybox_loading@2x.gif new file mode 100644 index 0000000..9205aeb Binary files /dev/null and b/source/lib/fancybox/fancybox_loading@2x.gif differ diff --git a/source/lib/fancybox/fancybox_overlay.png b/source/lib/fancybox/fancybox_overlay.png new file mode 100644 index 0000000..a439139 Binary files /dev/null and b/source/lib/fancybox/fancybox_overlay.png differ diff --git a/source/lib/fancybox/fancybox_sprite.png b/source/lib/fancybox/fancybox_sprite.png new file mode 100644 index 0000000..fd8d5ca Binary files /dev/null and b/source/lib/fancybox/fancybox_sprite.png differ diff --git a/source/lib/fancybox/fancybox_sprite@2x.png b/source/lib/fancybox/fancybox_sprite@2x.png new file mode 100644 index 0000000..d0e4779 Binary files /dev/null and b/source/lib/fancybox/fancybox_sprite@2x.png differ diff --git a/source/lib/fancybox/helpers/fancybox_buttons.png b/source/lib/fancybox/helpers/fancybox_buttons.png new file mode 100644 index 0000000..0787207 Binary files /dev/null and b/source/lib/fancybox/helpers/fancybox_buttons.png differ diff --git a/source/lib/fancybox/helpers/jquery.fancybox-buttons.css b/source/lib/fancybox/helpers/jquery.fancybox-buttons.css new file mode 100644 index 0000000..a26273a --- /dev/null +++ b/source/lib/fancybox/helpers/jquery.fancybox-buttons.css @@ -0,0 +1,97 @@ +#fancybox-buttons { + position: fixed; + left: 0; + width: 100%; + z-index: 8050; +} + +#fancybox-buttons.top { + top: 10px; +} + +#fancybox-buttons.bottom { + bottom: 10px; +} + +#fancybox-buttons ul { + display: block; + width: 166px; + height: 30px; + margin: 0 auto; + padding: 0; + list-style: none; + border: 1px solid #111; + border-radius: 3px; + -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + background: rgb(50,50,50); + background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51))); + background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 ); +} + +#fancybox-buttons ul li { + float: left; + margin: 0; + padding: 0; +} + +#fancybox-buttons a { + display: block; + width: 30px; + height: 30px; + text-indent: -9999px; + background-color: transparent; + background-image: url('fancybox_buttons.png'); + background-repeat: no-repeat; + outline: none; + opacity: 0.8; +} + +#fancybox-buttons a:hover { + opacity: 1; +} + +#fancybox-buttons a.btnPrev { + background-position: 5px 0; +} + +#fancybox-buttons a.btnNext { + background-position: -33px 0; + border-right: 1px solid #3e3e3e; +} + +#fancybox-buttons a.btnPlay { + background-position: 0 -30px; +} + +#fancybox-buttons a.btnPlayOn { + background-position: -30px -30px; +} + +#fancybox-buttons a.btnToggle { + background-position: 3px -60px; + border-left: 1px solid #111; + border-right: 1px solid #3e3e3e; + width: 35px +} + +#fancybox-buttons a.btnToggleOn { + background-position: -27px -60px; +} + +#fancybox-buttons a.btnClose { + border-left: 1px solid #111; + width: 35px; + background-position: -56px 0px; +} + +#fancybox-buttons a.btnDisabled { + opacity : 0.4; + cursor: default; +} \ No newline at end of file diff --git a/source/lib/fancybox/helpers/jquery.fancybox-buttons.js b/source/lib/fancybox/helpers/jquery.fancybox-buttons.js new file mode 100644 index 0000000..fd8b955 --- /dev/null +++ b/source/lib/fancybox/helpers/jquery.fancybox-buttons.js @@ -0,0 +1,122 @@ + /*! + * Buttons helper for fancyBox + * version: 1.0.5 (Mon, 15 Oct 2012) + * @requires fancyBox v2.0 or later + * + * Usage: + * $(".fancybox").fancybox({ + * helpers : { + * buttons: { + * position : 'top' + * } + * } + * }); + * + */ +(function ($) { + //Shortcut for fancyBox object + var F = $.fancybox; + + //Add helper object + F.helpers.buttons = { + defaults : { + skipSingle : false, // disables if gallery contains single image + position : 'top', // 'top' or 'bottom' + tpl : '
' + }, + + 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 ), + close : this.list.find('.btnClose').click( F.close ) + } + } + + //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)); diff --git a/source/lib/fancybox/helpers/jquery.fancybox-media.js b/source/lib/fancybox/helpers/jquery.fancybox-media.js new file mode 100644 index 0000000..3584c8a --- /dev/null +++ b/source/lib/fancybox/helpers/jquery.fancybox-media.js @@ -0,0 +1,199 @@ +/*! + * Media helper for fancyBox + * version: 1.0.6 (Fri, 14 Jun 2013) + * @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 + * http://www.youtube-nocookie.com/embed/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|youtube-nocookie\.com)\/(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/?size=l' + }, + 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) { + if (opts.hasOwnProperty(what)) { + 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/source/lib/fancybox/helpers/jquery.fancybox-thumbs.css b/source/lib/fancybox/helpers/jquery.fancybox-thumbs.css new file mode 100644 index 0000000..63d2943 --- /dev/null +++ b/source/lib/fancybox/helpers/jquery.fancybox-thumbs.css @@ -0,0 +1,55 @@ +#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; + max-width: none; +} \ No newline at end of file diff --git a/source/lib/fancybox/helpers/jquery.fancybox-thumbs.js b/source/lib/fancybox/helpers/jquery.fancybox-thumbs.js new file mode 100644 index 0000000..5db3d4a --- /dev/null +++ b/source/lib/fancybox/helpers/jquery.fancybox-thumbs.js @@ -0,0 +1,162 @@ + /*! + * 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/source/lib/fancybox/jquery.fancybox.css b/source/lib/fancybox/jquery.fancybox.css new file mode 100644 index 0000000..367890a --- /dev/null +++ b/source/lib/fancybox/jquery.fancybox.css @@ -0,0 +1,274 @@ +/*! fancyBox v2.1.5 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 !important; + width: auto; +} + +.fancybox-lock body { + overflow: hidden !important; +} + +.fancybox-lock-test { + overflow-y: hidden !important; +} + +.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); +} + +/*Retina graphics!*/ +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), + only screen and (min--moz-device-pixel-ratio: 1.5), + only screen and (min-device-pixel-ratio: 1.5){ + + #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { + background-image: url('fancybox_sprite@2x.png'); + background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/ + } + + #fancybox-loading div { + background-image: url('fancybox_loading@2x.gif'); + background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/ + } +} \ No newline at end of file diff --git a/source/lib/fancybox/jquery.fancybox.js b/source/lib/fancybox/jquery.fancybox.js new file mode 100644 index 0000000..e8e1987 --- /dev/null +++ b/source/lib/fancybox/jquery.fancybox.js @@ -0,0 +1,2020 @@ +/*! + * fancyBox - jQuery Plugin + * version: 2.1.5 (Fri, 14 Jun 2013) + * @requires jQuery v1.6 or later + * + * Examples at http://fancyapps.com/fancybox/ + * License: www.fancyapps.com/fancybox/#license + * + * Copyright 2012 Janis Skarnelis - janis@fancyapps.com + * + */ + +(function (window, document, $, undefined) { + "use strict"; + + var H = $("html"), + W = $(window), + D = $(document), + F = $.fancybox = function () { + F.open.apply( this, arguments ); + }, + IE = navigator.userAgent.match(/msie/i), + didUpdate = null, + isTouch = document.createTouch !== undefined, + + isQuery = function(obj) { + return obj && obj.hasOwnProperty && obj instanceof $; + }, + isString = function(str) { + return str && $.type(str) === "string"; + }, + isPercentage = function(str) { + return isString(str) && str.indexOf('%') > 0; + }, + isScrollable = function(el) { + return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight))); + }, + getScalar = function(orig, dim) { + var value = parseInt(orig, 10) || 0; + + if (dim && isPercentage(orig)) { + value = F.getViewport()[ dim ] / 100 * value; + } + + return Math.ceil(value); + }, + getValue = function(value, dim) { + return getScalar(value, dim) + 'px'; + }; + + $.extend(F, { + // The current version of fancyBox + version: '2.1.5', + + defaults: { + padding : 15, + margin : 20, + + width : 800, + height : 600, + minWidth : 100, + minHeight : 100, + maxWidth : 9999, + maxHeight : 9999, + pixelRatio: 1, // Set to 2 for retina display support + + autoSize : true, + autoHeight : false, + autoWidth : false, + + autoResize : true, + autoCenter : !isTouch, + fitToView : true, + aspectRatio : false, + topRatio : 0.5, + leftRatio : 0.5, + + scrolling : 'auto', // 'auto', 'yes' or 'no' + 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', // enter + 34 : 'up', // page down + 39 : 'left', // right arrow + 40 : 'up' // down arrow + }, + prev : { + 8 : 'right', // backspace + 33 : 'down', // page up + 37 : 'right', // left arrow + 38 : 'down' // up arrow + }, + close : [27], // escape key + play : [32], // space - start/stop slideshow + toggle : [70] // letter "f" - toggle fullscreen + }, + + direction : { + next : 'left', + prev : 'right' + }, + + scrollOutside : true, + + // Override some properties + index : 0, + type : null, + href : null, + content : null, + title : null, + + // HTML templates + tpl: { + wrap : '
    ', + image : '', + iframe : '', + error : '

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

    ', + closeBtn : '', + next : '', + prev : '' + }, + + // Properties for each animation type + // Opening fancyBox + openEffect : 'fade', // 'elastic', 'fade' or 'none' + openSpeed : 250, + openEasing : 'swing', + openOpacity : true, + openMethod : 'zoomIn', + + // Closing fancyBox + closeEffect : 'fade', // 'elastic', 'fade' or 'none' + closeSpeed : 250, + closeEasing : 'swing', + closeOpacity : true, + closeMethod : 'zoomOut', + + // Changing next gallery item + nextEffect : 'elastic', // 'elastic', 'fade' or 'none' + nextSpeed : 250, + nextEasing : 'swing', + nextMethod : 'changeIn', + + // Changing previous gallery item + prevEffect : 'elastic', // 'elastic', 'fade' or 'none' + prevSpeed : 250, + prevEasing : 'swing', + prevMethod : 'changeOut', + + // Enable default helpers + helpers : { + overlay : true, + title : true + }, + + // Callbacks + onCancel : $.noop, // If canceling + beforeLoad : $.noop, // Before loading + afterLoad : $.noop, // After loading + beforeShow : $.noop, // Before changing in current item + afterShow : $.noop, // After opening + beforeChange : $.noop, // Before changing gallery item + beforeClose : $.noop, // Before closing + afterClose : $.noop // After closing + }, + + //Current state + group : {}, // Selected group + opts : {}, // Group options + previous : null, // Previous element + coming : null, // Element being loaded + current : null, // Currently loaded element + isActive : false, // Is activated + isOpen : false, // Is currently open + isOpened : false, // Have been fully opened at least once + + wrap : null, + skin : null, + outer : null, + inner : null, + + player : { + timer : null, + isActive : false + }, + + // Loaders + ajaxLoad : null, + imgPreload : null, + + // Some collections + transitions : {}, + helpers : {}, + + /* + * Static methods + */ + + open: function (group, opts) { + if (!group) { + return; + } + + if (!$.isPlainObject(opts)) { + opts = {}; + } + + // Close if already active + if (false === F.close(true)) { + return; + } + + // Normalize group + if (!$.isArray(group)) { + group = isQuery(group) ? $(group).get() : [group]; + } + + // Recheck if the type of each element is `object` and set content type (image, ajax, etc) + $.each(group, function(i, element) { + var obj = {}, + href, + title, + content, + type, + rez, + hrefParts, + selector; + + if ($.type(element) === "object") { + // Check if is DOM element + if (element.nodeType) { + element = $(element); + } + + if (isQuery(element)) { + obj = { + href : element.data('fancybox-href') || element.attr('href'), + title : element.data('fancybox-title') || element.attr('title'), + isDom : true, + element : element + }; + + if ($.metadata) { + $.extend(true, obj, element.metadata()); + } + + } else { + obj = element; + } + } + + href = opts.href || obj.href || (isString(element) ? element : null); + title = opts.title !== undefined ? opts.title : obj.title || ''; + + content = opts.content || obj.content; + type = content ? 'html' : (opts.type || obj.type); + + if (!type && obj.isDom) { + type = element.data('fancybox-type'); + + if (!type) { + rez = element.prop('class').match(/fancybox\.(\w+)/); + type = rez ? rez[1] : null; + } + } + + if (isString(href)) { + // Try to guess the content type + if (!type) { + if (F.isImage(href)) { + type = 'image'; + + } else if (F.isSWF(href)) { + type = 'swf'; + + } else if (href.charAt(0) === '#') { + type = 'inline'; + + } else if (isString(element)) { + type = 'html'; + content = element; + } + } + + // Split url into two pieces with source url and content selector, e.g, + // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id" + if (type === 'ajax') { + hrefParts = href.split(/\s+/, 2); + href = hrefParts.shift(); + selector = hrefParts.shift(); + } + } + + if (!content) { + if (type === 'inline') { + if (href) { + content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7 + + } else if (obj.isDom) { + content = element; + } + + } else if (type === 'html') { + content = href; + + } else if (!type && !href && obj.isDom) { + type = 'inline'; + content = element; + } + } + + $.extend(obj, { + href : href, + type : type, + content : content, + title : title, + selector : selector + }); + + group[ i ] = obj; + }); + + // Extend the defaults + F.opts = $.extend(true, {}, F.defaults, opts); + + // All options are merged recursive except keys + if (opts.keys !== undefined) { + F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false; + } + + F.group = group; + + return F._start(F.opts.index); + }, + + // Cancel image loading or abort ajax request + cancel: function () { + var coming = F.coming; + + if (!coming || false === F.trigger('onCancel')) { + return; + } + + F.hideLoading(); + + if (F.ajaxLoad) { + F.ajaxLoad.abort(); + } + + F.ajaxLoad = null; + + if (F.imgPreload) { + F.imgPreload.onload = F.imgPreload.onerror = null; + } + + if (coming.wrap) { + coming.wrap.stop(true, true).trigger('onReset').remove(); + } + + F.coming = null; + + // If the first item has been canceled, then clear everything + if (!F.current) { + F._afterZoomOut( coming ); + } + }, + + // Start closing animation if is open; remove immediately if opening/closing + close: function (event) { + F.cancel(); + + if (false === F.trigger('beforeClose')) { + return; + } + + F.unbindEvents(); + + if (!F.isActive) { + return; + } + + if (!F.isOpen || event === true) { + $('.fancybox-wrap').stop(true).trigger('onReset').remove(); + + F._afterZoomOut(); + + } else { + F.isOpen = F.isOpened = false; + F.isClosing = true; + + $('.fancybox-item, .fancybox-nav').remove(); + + F.wrap.stop(true, true).removeClass('fancybox-opened'); + + F.transitions[ F.current.closeMethod ](); + } + }, + + // Manage slideshow: + // $.fancybox.play(); - toggle slideshow + // $.fancybox.play( true ); - start + // $.fancybox.play( false ); - stop + play: function ( action ) { + var clear = function () { + clearTimeout(F.player.timer); + }, + set = function () { + clear(); + + if (F.current && F.player.isActive) { + F.player.timer = setTimeout(F.next, F.current.playSpeed); + } + }, + stop = function () { + clear(); + + D.unbind('.player'); + + F.player.isActive = false; + + F.trigger('onPlayEnd'); + }, + start = function () { + if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) { + F.player.isActive = true; + + D.bind({ + 'onCancel.player beforeClose.player' : stop, + 'onUpdate.player' : set, + 'beforeLoad.player' : clear + }); + + set(); + + F.trigger('onPlayStart'); + } + }; + + if (action === true || (!F.player.isActive && action !== false)) { + start(); + } else { + stop(); + } + }, + + // Navigate to next gallery item + next: function ( direction ) { + var current = F.current; + + if (current) { + if (!isString(direction)) { + direction = current.direction.next; + } + + F.jumpto(current.index + 1, direction, 'next'); + } + }, + + // Navigate to previous gallery item + prev: function ( direction ) { + var current = F.current; + + if (current) { + if (!isString(direction)) { + direction = current.direction.prev; + } + + F.jumpto(current.index - 1, direction, 'prev'); + } + }, + + // Navigate to gallery item by index + jumpto: function ( index, direction, router ) { + var current = F.current; + + if (!current) { + return; + } + + index = getScalar(index); + + F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ]; + F.router = router || 'jumpto'; + + if (current.loop) { + if (index < 0) { + index = current.group.length + (index % current.group.length); + } + + index = index % current.group.length; + } + + if (current.group[ index ] !== undefined) { + F.cancel(); + + F._start(index); + } + }, + + // Center inside viewport and toggle position type to fixed or absolute if needed + reposition: function (e, onlyAbsolute) { + var current = F.current, + wrap = current ? current.wrap : null, + pos; + + if (wrap) { + pos = F._getPosition(onlyAbsolute); + + if (e && e.type === 'scroll') { + delete pos.position; + + wrap.stop(true, true).animate(pos, 200); + + } else { + wrap.css(pos); + + current.pos = $.extend({}, current.dim, pos); + } + } + }, + + update: function (e) { + var type = (e && e.type), + anyway = !type || type === 'orientationchange'; + + if (anyway) { + clearTimeout(didUpdate); + + didUpdate = null; + } + + if (!F.isOpen || didUpdate) { + return; + } + + didUpdate = setTimeout(function() { + var current = F.current; + + if (!current || F.isClosing) { + return; + } + + F.wrap.removeClass('fancybox-tmp'); + + if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) { + F._setDimension(); + } + + if (!(type === 'scroll' && current.canShrink)) { + F.reposition(e); + } + + F.trigger('onUpdate'); + + didUpdate = null; + + }, (anyway && !isTouch ? 0 : 300)); + }, + + // Shrink content to fit inside viewport or restore if resized + toggle: function ( action ) { + if (F.isOpen) { + F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView; + + // Help browser to restore document dimensions + if (isTouch) { + F.wrap.removeAttr('style').addClass('fancybox-tmp'); + + F.trigger('onUpdate'); + } + + F.update(); + } + }, + + hideLoading: function () { + D.unbind('.loading'); + + $('#fancybox-loading').remove(); + }, + + showLoading: function () { + var el, viewport; + + F.hideLoading(); + + el = $('
    ').click(F.cancel).appendTo('body'); + + // If user will press the escape-button, the request will be canceled + D.bind('keydown.loading', function(e) { + if ((e.which || e.keyCode) === 27) { + e.preventDefault(); + + F.cancel(); + } + }); + + if (!F.defaults.fixed) { + viewport = F.getViewport(); + + el.css({ + position : 'absolute', + top : (viewport.h * 0.5) + viewport.y, + left : (viewport.w * 0.5) + viewport.x + }); + } + }, + + getViewport: function () { + var locked = (F.current && F.current.locked) || false, + rez = { + x: W.scrollLeft(), + y: W.scrollTop() + }; + + if (locked) { + rez.w = locked[0].clientWidth; + rez.h = locked[0].clientHeight; + + } else { + // See http://bugs.jquery.com/ticket/6724 + rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width(); + rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height(); + } + + return rez; + }, + + // Unbind the keyboard / clicking actions + unbindEvents: function () { + if (F.wrap && isQuery(F.wrap)) { + F.wrap.unbind('.fb'); + } + + D.unbind('.fb'); + W.unbind('.fb'); + }, + + bindEvents: function () { + var current = F.current, + keys; + + if (!current) { + return; + } + + // Changing document height on iOS devices triggers a 'resize' event, + // that can change document height... repeating infinitely + W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update); + + keys = current.keys; + + if (keys) { + D.bind('keydown.fb', function (e) { + var code = e.which || e.keyCode, + target = e.target || e.srcElement; + + // Skip esc key if loading, because showLoading will cancel preloading + if (code === 27 && F.coming) { + return false; + } + + // Ignore key combinations and key events within form elements + if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) { + $.each(keys, function(i, val) { + if (current.group.length > 1 && val[ code ] !== undefined) { + F[ i ]( val[ code ] ); + + e.preventDefault(); + return false; + } + + if ($.inArray(code, val) > -1) { + F[ i ] (); + + e.preventDefault(); + return false; + } + }); + } + }); + } + + if ($.fn.mousewheel && current.mouseWheel) { + F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) { + var target = e.target || null, + parent = $(target), + canScroll = false; + + while (parent.length) { + if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) { + break; + } + + canScroll = isScrollable( parent[0] ); + parent = $(parent).parent(); + } + + if (delta !== 0 && !canScroll) { + if (F.group.length > 1 && !current.canShrink) { + if (deltaY > 0 || deltaX > 0) { + F.prev( deltaY > 0 ? 'down' : 'left' ); + + } else if (deltaY < 0 || deltaX < 0) { + F.next( deltaY < 0 ? 'up' : 'right' ); + } + + e.preventDefault(); + } + } + }); + } + }, + + trigger: function (event, o) { + var ret, obj = o || F.coming || F.current; + + if (!obj) { + return; + } + + if ($.isFunction( obj[event] )) { + ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1)); + } + + if (ret === false) { + return false; + } + + if (obj.helpers) { + $.each(obj.helpers, function (helper, opts) { + if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) { + F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj); + } + }); + } + + D.trigger(event); + }, + + isImage: function (str) { + return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i); + }, + + isSWF: function (str) { + return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i); + }, + + _start: function (index) { + var coming = {}, + obj, + href, + type, + margin, + padding; + + index = getScalar( index ); + obj = F.group[ index ] || null; + + if (!obj) { + return false; + } + + coming = $.extend(true, {}, F.opts, obj); + + // Convert margin and padding properties to array - top, right, bottom, left + margin = coming.margin; + padding = coming.padding; + + if ($.type(margin) === 'number') { + coming.margin = [margin, margin, margin, margin]; + } + + if ($.type(padding) === 'number') { + coming.padding = [padding, padding, padding, padding]; + } + + // 'modal' propery is just a shortcut + if (coming.modal) { + $.extend(true, coming, { + closeBtn : false, + closeClick : false, + nextClick : false, + arrows : false, + mouseWheel : false, + keys : null, + helpers: { + overlay : { + closeClick : false + } + } + }); + } + + // 'autoSize' property is a shortcut, too + if (coming.autoSize) { + coming.autoWidth = coming.autoHeight = true; + } + + if (coming.width === 'auto') { + coming.autoWidth = true; + } + + if (coming.height === 'auto') { + coming.autoHeight = true; + } + + /* + * Add reference to the group, so it`s possible to access from callbacks, example: + * afterLoad : function() { + * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); + * } + */ + + coming.group = F.group; + coming.index = index; + + // Give a chance for callback or helpers to update coming item (type, title, etc) + F.coming = coming; + + if (false === F.trigger('beforeLoad')) { + F.coming = null; + + return; + } + + type = coming.type; + href = coming.href; + + if (!type) { + F.coming = null; + + //If we can not determine content type then drop silently or display next/prev item if looping through gallery + if (F.current && F.router && F.router !== 'jumpto') { + F.current.index = index; + + return F[ F.router ]( F.direction ); + } + + return false; + } + + F.isActive = true; + + if (type === 'image' || type === 'swf') { + coming.autoHeight = coming.autoWidth = false; + coming.scrolling = 'visible'; + } + + if (type === 'image') { + coming.aspectRatio = true; + } + + if (type === 'iframe' && isTouch) { + coming.scrolling = 'scroll'; + } + + // Build the neccessary markup + coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' ); + + $.extend(coming, { + skin : $('.fancybox-skin', coming.wrap), + outer : $('.fancybox-outer', coming.wrap), + inner : $('.fancybox-inner', coming.wrap) + }); + + $.each(["Top", "Right", "Bottom", "Left"], function(i, v) { + coming.skin.css('padding' + v, getValue(coming.padding[ i ])); + }); + + F.trigger('onReady'); + + // Check before try to load; 'inline' and 'html' types need content, others - href + if (type === 'inline' || type === 'html') { + if (!coming.content || !coming.content.length) { + return F._error( 'content' ); + } + + } else if (!href) { + return F._error( 'href' ); + } + + if (type === 'image') { + F._loadImage(); + + } else if (type === 'ajax') { + F._loadAjax(); + + } else if (type === 'iframe') { + F._loadIframe(); + + } else { + F._afterLoad(); + } + }, + + _error: function ( type ) { + $.extend(F.coming, { + type : 'html', + autoWidth : true, + autoHeight : true, + minWidth : 0, + minHeight : 0, + scrolling : 'no', + hasError : type, + content : F.coming.tpl.error + }); + + F._afterLoad(); + }, + + _loadImage: function () { + // Reset preload image so it is later possible to check "complete" property + var img = F.imgPreload = new Image(); + + img.onload = function () { + this.onload = this.onerror = null; + + F.coming.width = this.width / F.opts.pixelRatio; + F.coming.height = this.height / F.opts.pixelRatio; + + F._afterLoad(); + }; + + img.onerror = function () { + this.onload = this.onerror = null; + + F._error( 'image' ); + }; + + img.src = F.coming.href; + + if (img.complete !== true) { + F.showLoading(); + } + }, + + _loadAjax: function () { + var coming = F.coming; + + F.showLoading(); + + F.ajaxLoad = $.ajax($.extend({}, coming.ajax, { + url: coming.href, + error: function (jqXHR, textStatus) { + if (F.coming && textStatus !== 'abort') { + F._error( 'ajax', jqXHR ); + + } else { + F.hideLoading(); + } + }, + success: function (data, textStatus) { + if (textStatus === 'success') { + coming.content = data; + + F._afterLoad(); + } + } + })); + }, + + _loadIframe: function() { + var coming = F.coming, + iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime())) + .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling) + .attr('src', coming.href); + + // This helps IE + $(coming.wrap).bind('onReset', function () { + try { + $(this).find('iframe').hide().attr('src', '//about:blank').end().empty(); + } catch (e) {} + }); + + if (coming.iframe.preload) { + F.showLoading(); + + iframe.one('load', function() { + $(this).data('ready', 1); + + // iOS will lose scrolling if we resize + if (!isTouch) { + $(this).bind('load.fb', F.update); + } + + // Without this trick: + // - iframe won't scroll on iOS devices + // - IE7 sometimes displays empty iframe + $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show(); + + F._afterLoad(); + }); + } + + coming.content = iframe.appendTo( coming.inner ); + + if (!coming.iframe.preload) { + F._afterLoad(); + } + }, + + _preloadImages: function() { + var group = F.group, + current = F.current, + len = group.length, + cnt = current.preload ? Math.min(current.preload, len - 1) : 0, + item, + i; + + for (i = 1; i <= cnt; i += 1) { + item = group[ (current.index + i ) % len ]; + + if (item.type === 'image' && item.href) { + new Image().src = item.href; + } + } + }, + + _afterLoad: function () { + var coming = F.coming, + previous = F.current, + placeholder = 'fancybox-placeholder', + current, + content, + type, + scrolling, + href, + embed; + + F.hideLoading(); + + if (!coming || F.isActive === false) { + return; + } + + if (false === F.trigger('afterLoad', coming, previous)) { + coming.wrap.stop(true).trigger('onReset').remove(); + + F.coming = null; + + return; + } + + if (previous) { + F.trigger('beforeChange', previous); + + previous.wrap.stop(true).removeClass('fancybox-opened') + .find('.fancybox-item, .fancybox-nav') + .remove(); + } + + F.unbindEvents(); + + current = coming; + content = coming.content; + type = coming.type; + scrolling = coming.scrolling; + + $.extend(F, { + wrap : current.wrap, + skin : current.skin, + outer : current.outer, + inner : current.inner, + current : current, + previous : previous + }); + + href = current.href; + + switch (type) { + case 'inline': + case 'ajax': + case 'html': + if (current.selector) { + content = $('
    ').html(content).find(current.selector); + + } else if (isQuery(content)) { + if (!content.data(placeholder)) { + content.data(placeholder, $('
    ').insertAfter( content ).hide() ); + } + + content = content.show().detach(); + + current.wrap.bind('onReset', function () { + if ($(this).find(content).length) { + content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false); + } + }); + } + break; + + case 'image': + content = current.tpl.image.replace('{href}', href); + break; + + case 'swf': + content = ''; + embed = ''; + + $.each(current.swf, function(name, val) { + content += ''; + embed += ' ' + name + '="' + val + '"'; + }); + + content += ''; + break; + } + + if (!(isQuery(content) && content.parent().is(current.inner))) { + current.inner.append( content ); + } + + // Give a chance for helpers or callbacks to update elements + F.trigger('beforeShow'); + + // Set scrolling before calculating dimensions + current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); + + // Set initial dimensions and start position + F._setDimension(); + + F.reposition(); + + F.isOpen = false; + F.coming = null; + + F.bindEvents(); + + if (!F.isOpened) { + $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove(); + + } else if (previous.prevMethod) { + F.transitions[ previous.prevMethod ](); + } + + F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ](); + + F._preloadImages(); + }, + + _setDimension: function () { + var viewport = F.getViewport(), + steps = 0, + canShrink = false, + canExpand = false, + wrap = F.wrap, + skin = F.skin, + inner = F.inner, + current = F.current, + width = current.width, + height = current.height, + minWidth = current.minWidth, + minHeight = current.minHeight, + maxWidth = current.maxWidth, + maxHeight = current.maxHeight, + scrolling = current.scrolling, + scrollOut = current.scrollOutside ? current.scrollbarWidth : 0, + margin = current.margin, + wMargin = getScalar(margin[1] + margin[3]), + hMargin = getScalar(margin[0] + margin[2]), + wPadding, + hPadding, + wSpace, + hSpace, + origWidth, + origHeight, + origMaxWidth, + origMaxHeight, + ratio, + width_, + height_, + maxWidth_, + maxHeight_, + iframe, + body; + + // Reset dimensions so we could re-check actual size + wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp'); + + wPadding = getScalar(skin.outerWidth(true) - skin.width()); + hPadding = getScalar(skin.outerHeight(true) - skin.height()); + + // Any space between content and viewport (margin, padding, border, title) + wSpace = wMargin + wPadding; + hSpace = hMargin + hPadding; + + origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width; + origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height; + + if (current.type === 'iframe') { + iframe = current.content; + + if (current.autoHeight && iframe.data('ready') === 1) { + try { + if (iframe[0].contentWindow.document.location) { + inner.width( origWidth ).height(9999); + + body = iframe.contents().find('body'); + + if (scrollOut) { + body.css('overflow-x', 'hidden'); + } + + origHeight = body.outerHeight(true); + } + + } catch (e) {} + } + + } else if (current.autoWidth || current.autoHeight) { + inner.addClass( 'fancybox-tmp' ); + + // Set width or height in case we need to calculate only one dimension + if (!current.autoWidth) { + inner.width( origWidth ); + } + + if (!current.autoHeight) { + inner.height( origHeight ); + } + + if (current.autoWidth) { + origWidth = inner.width(); + } + + if (current.autoHeight) { + origHeight = inner.height(); + } + + inner.removeClass( 'fancybox-tmp' ); + } + + width = getScalar( origWidth ); + height = getScalar( origHeight ); + + ratio = origWidth / origHeight; + + // Calculations for the content + minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth); + maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth); + + minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight); + maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight); + + // These will be used to determine if wrap can fit in the viewport + origMaxWidth = maxWidth; + origMaxHeight = maxHeight; + + if (current.fitToView) { + maxWidth = Math.min(viewport.w - wSpace, maxWidth); + maxHeight = Math.min(viewport.h - hSpace, maxHeight); + } + + maxWidth_ = viewport.w - wMargin; + maxHeight_ = viewport.h - hMargin; + + if (current.aspectRatio) { + if (width > maxWidth) { + width = maxWidth; + height = getScalar(width / ratio); + } + + if (height > maxHeight) { + height = maxHeight; + width = getScalar(height * ratio); + } + + if (width < minWidth) { + width = minWidth; + height = getScalar(width / ratio); + } + + if (height < minHeight) { + height = minHeight; + width = getScalar(height * ratio); + } + + } else { + width = Math.max(minWidth, Math.min(width, maxWidth)); + + if (current.autoHeight && current.type !== 'iframe') { + inner.width( width ); + + height = inner.height(); + } + + height = Math.max(minHeight, Math.min(height, maxHeight)); + } + + // Try to fit inside viewport (including the title) + if (current.fitToView) { + inner.width( width ).height( height ); + + wrap.width( width + wPadding ); + + // Real wrap dimensions + width_ = wrap.width(); + height_ = wrap.height(); + + if (current.aspectRatio) { + while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) { + if (steps++ > 19) { + break; + } + + height = Math.max(minHeight, Math.min(maxHeight, height - 10)); + width = getScalar(height * ratio); + + if (width < minWidth) { + width = minWidth; + height = getScalar(width / ratio); + } + + if (width > maxWidth) { + width = maxWidth; + height = getScalar(width / ratio); + } + + inner.width( width ).height( height ); + + wrap.width( width + wPadding ); + + width_ = wrap.width(); + height_ = wrap.height(); + } + + } else { + width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_))); + height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_))); + } + } + + if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) { + width += scrollOut; + } + + inner.width( width ).height( height ); + + wrap.width( width + wPadding ); + + width_ = wrap.width(); + height_ = wrap.height(); + + canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight; + canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight)); + + $.extend(current, { + dim : { + width : getValue( width_ ), + height : getValue( height_ ) + }, + origWidth : origWidth, + origHeight : origHeight, + canShrink : canShrink, + canExpand : canExpand, + wPadding : wPadding, + hPadding : hPadding, + wrapSpace : height_ - skin.outerHeight(true), + skinSpace : skin.height() - height + }); + + if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) { + inner.height('auto'); + } + }, + + _getPosition: function (onlyAbsolute) { + var current = F.current, + viewport = F.getViewport(), + margin = current.margin, + width = F.wrap.width() + margin[1] + margin[3], + height = F.wrap.height() + margin[0] + margin[2], + rez = { + position: 'absolute', + top : margin[0], + left : margin[3] + }; + + if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) { + rez.position = 'fixed'; + + } else if (!current.locked) { + rez.top += viewport.y; + rez.left += viewport.x; + } + + rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))); + rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio))); + + return rez; + }, + + _afterZoomIn: function () { + var current = F.current; + + if (!current) { + return; + } + + F.isOpen = F.isOpened = true; + + F.wrap.css('overflow', 'visible').addClass('fancybox-opened'); + + F.update(); + + // Assign a click event + if ( current.closeClick || (current.nextClick && F.group.length > 1) ) { + F.inner.css('cursor', 'pointer').bind('click.fb', function(e) { + if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { + e.preventDefault(); + + F[ current.closeClick ? 'close' : 'next' ](); + } + }); + } + + // Create a close button + if (current.closeBtn) { + $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) { + e.preventDefault(); + + F.close(); + }); + } + + // Create navigation arrows + if (current.arrows && F.group.length > 1) { + if (current.loop || current.index > 0) { + $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); + } + + if (current.loop || current.index < F.group.length - 1) { + $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); + } + } + + F.trigger('afterShow'); + + // Stop the slideshow if this is the last item + if (!current.loop && current.index === current.group.length - 1) { + F.play( false ); + + } else if (F.opts.autoPlay && !F.player.isActive) { + F.opts.autoPlay = false; + + F.play(); + } + }, + + _afterZoomOut: function ( obj ) { + obj = obj || F.current; + + $('.fancybox-wrap').trigger('onReset').remove(); + + $.extend(F, { + group : {}, + opts : {}, + router : false, + current : null, + isActive : false, + isOpened : false, + isOpen : false, + isClosing : false, + wrap : null, + skin : null, + outer : null, + inner : null + }); + + F.trigger('afterClose', obj); + } + }); + + /* + * Default transitions + */ + + F.transitions = { + getOrigPosition: function () { + var current = F.current, + element = current.element, + orig = current.orig, + pos = {}, + width = 50, + height = 50, + hPadding = current.hPadding, + wPadding = current.wPadding, + viewport = F.getViewport(); + + if (!orig && current.isDom && element.is(':visible')) { + orig = element.find('img:first'); + + if (!orig.length) { + orig = element; + } + } + + if (isQuery(orig)) { + pos = orig.offset(); + + if (orig.is('img')) { + width = orig.outerWidth(); + height = orig.outerHeight(); + } + + } else { + pos.top = viewport.y + (viewport.h - height) * current.topRatio; + pos.left = viewport.x + (viewport.w - width) * current.leftRatio; + } + + if (F.wrap.css('position') === 'fixed' || current.locked) { + pos.top -= viewport.y; + pos.left -= viewport.x; + } + + pos = { + top : getValue(pos.top - hPadding * current.topRatio), + left : getValue(pos.left - wPadding * current.leftRatio), + width : getValue(width + wPadding), + height : getValue(height + hPadding) + }; + + return pos; + }, + + step: function (now, fx) { + var ratio, + padding, + value, + prop = fx.prop, + current = F.current, + wrapSpace = current.wrapSpace, + skinSpace = current.skinSpace; + + if (prop === 'width' || prop === 'height') { + ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start); + + if (F.isClosing) { + ratio = 1 - ratio; + } + + padding = prop === 'width' ? current.wPadding : current.hPadding; + value = now - padding; + + F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) ); + F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) ); + } + }, + + zoomIn: function () { + var current = F.current, + startPos = current.pos, + effect = current.openEffect, + elastic = effect === 'elastic', + endPos = $.extend({opacity : 1}, startPos); + + // Remove "position" property that breaks older IE + delete endPos.position; + + if (elastic) { + startPos = this.getOrigPosition(); + + if (current.openOpacity) { + startPos.opacity = 0.1; + } + + } else if (effect === 'fade') { + startPos.opacity = 0.1; + } + + F.wrap.css(startPos).animate(endPos, { + duration : effect === 'none' ? 0 : current.openSpeed, + easing : current.openEasing, + step : elastic ? this.step : null, + complete : F._afterZoomIn + }); + }, + + zoomOut: function () { + var current = F.current, + effect = current.closeEffect, + elastic = effect === 'elastic', + endPos = {opacity : 0.1}; + + if (elastic) { + endPos = this.getOrigPosition(); + + if (current.closeOpacity) { + endPos.opacity = 0.1; + } + } + + F.wrap.animate(endPos, { + duration : effect === 'none' ? 0 : current.closeSpeed, + easing : current.closeEasing, + step : elastic ? this.step : null, + complete : F._afterZoomOut + }); + }, + + changeIn: function () { + var current = F.current, + effect = current.nextEffect, + startPos = current.pos, + endPos = { opacity : 1 }, + direction = F.direction, + distance = 200, + field; + + startPos.opacity = 0.1; + + if (effect === 'elastic') { + field = direction === 'down' || direction === 'up' ? 'top' : 'left'; + + if (direction === 'down' || direction === 'right') { + startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance); + endPos[ field ] = '+=' + distance + 'px'; + + } else { + startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance); + endPos[ field ] = '-=' + distance + 'px'; + } + } + + // Workaround for http://bugs.jquery.com/ticket/12273 + if (effect === 'none') { + F._afterZoomIn(); + + } else { + F.wrap.css(startPos).animate(endPos, { + duration : current.nextSpeed, + easing : current.nextEasing, + complete : F._afterZoomIn + }); + } + }, + + changeOut: function () { + var previous = F.previous, + effect = previous.prevEffect, + endPos = { opacity : 0.1 }, + direction = F.direction, + distance = 200; + + if (effect === 'elastic') { + endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px'; + } + + previous.wrap.animate(endPos, { + duration : effect === 'none' ? 0 : previous.prevSpeed, + easing : previous.prevEasing, + complete : function () { + $(this).trigger('onReset').remove(); + } + }); + } + }; + + /* + * Overlay helper + */ + + F.helpers.overlay = { + defaults : { + closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay + speedOut : 200, // duration of fadeOut animation + showEarly : true, // indicates if should be opened immediately or wait until the content is ready + css : {}, // custom CSS properties + locked : !isTouch, // if true, the content will be locked into overlay + fixed : true // if false, the overlay CSS position property will not be set to "fixed" + }, + + overlay : null, // current handle + fixed : false, // indicates if the overlay has position "fixed" + el : $('html'), // element that contains "the lock" + + // Public methods + create : function(opts) { + opts = $.extend({}, this.defaults, opts); + + if (this.overlay) { + this.close(); + } + + this.overlay = $('
    ').appendTo( F.coming ? F.coming.parent : opts.parent ); + this.fixed = false; + + if (opts.fixed && F.defaults.fixed) { + this.overlay.addClass('fancybox-overlay-fixed'); + + this.fixed = true; + } + }, + + open : function(opts) { + var that = this; + + opts = $.extend({}, this.defaults, opts); + + if (this.overlay) { + this.overlay.unbind('.overlay').width('auto').height('auto'); + + } else { + this.create(opts); + } + + if (!this.fixed) { + W.bind('resize.overlay', $.proxy( this.update, this) ); + + this.update(); + } + + if (opts.closeClick) { + this.overlay.bind('click.overlay', function(e) { + if ($(e.target).hasClass('fancybox-overlay')) { + if (F.isActive) { + F.close(); + } else { + that.close(); + } + + return false; + } + }); + } + + this.overlay.css( opts.css ).show(); + }, + + close : function() { + var scrollV, scrollH; + + W.unbind('resize.overlay'); + + if (this.el.hasClass('fancybox-lock')) { + $('.fancybox-margin').removeClass('fancybox-margin'); + + scrollV = W.scrollTop(); + scrollH = W.scrollLeft(); + + this.el.removeClass('fancybox-lock'); + + W.scrollTop( scrollV ).scrollLeft( scrollH ); + } + + $('.fancybox-overlay').remove().hide(); + + $.extend(this, { + overlay : null, + fixed : false + }); + }, + + // Private, callbacks + + update : function () { + var width = '100%', offsetWidth; + + // Reset width/height so it will not mess + this.overlay.width(width).height('100%'); + + // jQuery does not return reliable result for IE + if (IE) { + offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); + + if (D.width() > offsetWidth) { + width = D.width(); + } + + } else if (D.width() > W.width()) { + width = D.width(); + } + + this.overlay.width(width).height(D.height()); + }, + + // This is where we can manipulate DOM, because later it would cause iframes to reload + onReady : function (opts, obj) { + var overlay = this.overlay; + + $('.fancybox-overlay').stop(true, true); + + if (!overlay) { + this.create(opts); + } + + if (opts.locked && this.fixed && obj.fixed) { + if (!overlay) { + this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false; + } + + obj.locked = this.overlay.append( obj.wrap ); + obj.fixed = false; + } + + if (opts.showEarly === true) { + this.beforeShow.apply(this, arguments); + } + }, + + beforeShow : function(opts, obj) { + var scrollV, scrollH; + + if (obj.locked) { + if (this.margin !== false) { + $('*').filter(function(){ + return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") ); + }).addClass('fancybox-margin'); + + this.el.addClass('fancybox-margin'); + } + + scrollV = W.scrollTop(); + scrollH = W.scrollLeft(); + + this.el.addClass('fancybox-lock'); + + W.scrollTop( scrollV ).scrollLeft( scrollH ); + } + + this.open(opts); + }, + + onUpdate : function() { + if (!this.fixed) { + this.update(); + } + }, + + afterClose: function (opts) { + // Remove overlay if exists and fancyBox is not opening + // (e.g., it is not being open using afterClose callback) + //if (this.overlay && !F.isActive) { + if (this.overlay && !F.coming) { + this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this )); + } + } + }; + + /* + * Title helper + */ + + F.helpers.title = { + defaults : { + type : 'float', // 'float', 'inside', 'outside' or 'over', + position : 'bottom' // 'top' or 'bottom' + }, + + beforeShow: function (opts) { + var current = F.current, + text = current.title, + type = opts.type, + title, + target; + + if ($.isFunction(text)) { + text = text.call(current.element, current); + } + + if (!isString(text) || $.trim(text) === '') { + return; + } + + title = $('
    ' + text + '
    '); + + switch (type) { + case 'inside': + target = F.skin; + break; + + case 'outside': + target = F.wrap; + break; + + case 'over': + target = F.inner; + break; + + default: // 'float' + target = F.skin; + + title.appendTo('body'); + + if (IE) { + title.width( title.width() ); + } + + title.wrapInner(''); + + //Increase bottom margin so this title will also fit into viewport + F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) ); + break; + } + + title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target); + } + }; + + // jQuery plugin initialization + $.fn.fancybox = function (options) { + var index, + that = $(this), + selector = this.selector || '', + run = function(e) { + var what = $(this).blur(), idx = index, relType, relVal; + + if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) { + relType = options.groupAttr || 'data-fancybox-group'; + relVal = what.attr(relType); + + if (!relVal) { + relType = 'rel'; + relVal = what.get(0)[ relType ]; + } + + if (relVal && relVal !== '' && relVal !== 'nofollow') { + what = selector.length ? $(selector) : that; + what = what.filter('[' + relType + '="' + relVal + '"]'); + idx = what.index(this); + } + + options.index = idx; + + // Stop an event from bubbling if everything is fine + if (F.open(what, options) !== false) { + e.preventDefault(); + } + } + }; + + options = options || {}; + index = options.index || 0; + + if (!selector || options.live === false) { + that.unbind('click.fb-start').bind('click.fb-start', run); + + } else { + D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run); + } + + this.filter('[data-fancybox-start=1]').trigger('click'); + + return this; + }; + + // Tests that need a body at doc ready + D.ready(function() { + var w1, w2; + + if ( $.scrollbarWidth === undefined ) { + // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth + $.scrollbarWidth = function() { + var parent = $('
    ').appendTo('body'), + child = parent.children(), + width = child.innerWidth() - child.height( 99 ).innerWidth(); + + parent.remove(); + + return width; + }; + } + + if ( $.support.fixedPosition === undefined ) { + $.support.fixedPosition = (function() { + var elem = $('
    ').appendTo('body'), + fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 ); + + elem.remove(); + + return fixed; + }()); + } + + $.extend(F.defaults, { + scrollbarWidth : $.scrollbarWidth(), + fixed : $.support.fixedPosition, + parent : $('body') + }); + + //Get real width of page scroll-bar + w1 = $(window).width(); + + H.addClass('fancybox-lock-test'); + + w2 = $(window).width(); + + H.removeClass('fancybox-lock-test'); + + $("").appendTo("head"); + }); + +}(window, document, jQuery)); \ No newline at end of file diff --git a/source/lib/fancybox/jquery.fancybox.pack.js b/source/lib/fancybox/jquery.fancybox.pack.js new file mode 100644 index 0000000..73f7578 --- /dev/null +++ b/source/lib/fancybox/jquery.fancybox.pack.js @@ -0,0 +1,46 @@ +/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ +(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0
    ',image:'',iframe:'",error:'

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

    ',closeBtn:'',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, +openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, +isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, +c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& +k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| +b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= +setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d= +a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")), +b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('
    ').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(), +y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement; +if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0, +{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1, +mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio= +!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href"); +"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload= +this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href); +f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload, +e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin, +outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("
    ").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('
    ').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}", +g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll": +"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside? +h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth|| +h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),cz||y>r)&&(c>m&&j>u)&&!(19n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&jz||y>r)&&c>m&&j>u;c=h.aspectRatio?cu&&j
    ').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive? +b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth), +p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"=== +f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d= +b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('
    '+e+"
    ");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d, +e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+ +":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('
    ').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('
    ').appendTo("body");var e=20=== +d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("").appendTo("head")})})(window,document,jQuery); \ No newline at end of file diff --git a/source/lib/jquery/jquery.min.js b/source/lib/jquery/jquery.min.js new file mode 100644 index 0000000..a1c07fd --- /dev/null +++ b/source/lib/jquery/jquery.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
    ",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0 self._tolerance) ? self.open() : self.close(); + } + self._moved = false; + }; + + this.panel.addEventListener(touch.end, this._onTouchEndFn); + + /** + * Translates panel on touchmove + */ + this._onTouchMoveFn = function(eve) { + if ( + scrolling || + self._preventOpen || + typeof eve.touches === 'undefined' || + hasIgnoredElements(eve.target) + ) { + return; + } + + var dif_x = eve.touches[0].clientX - self._startOffsetX; + var translateX = self._currentOffsetX = dif_x; + + if (Math.abs(translateX) > self._padding) { + return; + } + + if (Math.abs(dif_x) > 20) { + + self._opening = true; + + var oriented_dif_x = dif_x * self._orientation; + + if (self._opened && oriented_dif_x > 0 || !self._opened && oriented_dif_x < 0) { + return; + } + + if (!self._moved) { + self.emit('translatestart'); + } + + if (oriented_dif_x <= 0) { + translateX = dif_x + self._padding * self._orientation; + self._opening = false; + } + + if (!(self._moved && html.classList.contains('slideout-open'))) { + html.classList.add('slideout-open'); + } + + self.panel.style[prefix + 'transform'] = self.panel.style.transform = 'translateX(' + translateX + 'px)'; + self.emit('translate', translateX); + self._moved = true; + } + + }; + + this.panel.addEventListener(touch.move, this._onTouchMoveFn); + + return this; +}; + +/** + * Enable opening the slideout via touch events. + */ +Slideout.prototype.enableTouch = function() { + this._touch = true; + return this; +}; + +/** + * Disable opening the slideout via touch events. + */ +Slideout.prototype.disableTouch = function() { + this._touch = false; + return this; +}; + +/** + * Destroy an instance of slideout. + */ +Slideout.prototype.destroy = function() { + // Close before clean + this.close(); + + // Remove event listeners + doc.removeEventListener(touch.move, this._preventMove); + this.panel.removeEventListener(touch.start, this._resetTouchFn); + this.panel.removeEventListener('touchcancel', this._onTouchCancelFn); + this.panel.removeEventListener(touch.end, this._onTouchEndFn); + this.panel.removeEventListener(touch.move, this._onTouchMoveFn); + doc.removeEventListener('scroll', this._onScrollFn); + + // Remove methods + this.open = this.close = function() {}; + + // Return the instance so it can be easily dereferenced + return this; +}; + +/** + * Expose Slideout + */ +module.exports = Slideout; + +},{"decouple":2,"emitter":3}],2:[function(require,module,exports){ +'use strict'; + +var requestAnimFrame = (function() { + return window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + function (callback) { + window.setTimeout(callback, 1000 / 60); + }; +}()); + +function decouple(node, event, fn) { + var eve, + tracking = false; + + function captureEvent(e) { + eve = e; + track(); + } + + function track() { + if (!tracking) { + requestAnimFrame(update); + tracking = true; + } + } + + function update() { + fn.call(node, eve); + tracking = false; + } + + node.addEventListener(event, captureEvent, false); + + return captureEvent; +} + +/** + * Expose decouple + */ +module.exports = decouple; + +},{}],3:[function(require,module,exports){ +"use strict"; + +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; + +exports.__esModule = true; +/** + * Creates a new instance of Emitter. + * @class + * @returns {Object} Returns a new instance of Emitter. + * @example + * // Creates a new instance of Emitter. + * var Emitter = require('emitter'); + * + * var emitter = new Emitter(); + */ + +var Emitter = (function () { + function Emitter() { + _classCallCheck(this, Emitter); + } + + /** + * Adds a listener to the collection for the specified event. + * @memberof! Emitter.prototype + * @function + * @param {String} event - The event name. + * @param {Function} listener - A listener function to add. + * @returns {Object} Returns an instance of Emitter. + * @example + * // Add an event listener to "foo" event. + * emitter.on('foo', listener); + */ + + Emitter.prototype.on = function on(event, listener) { + // Use the current collection or create it. + this._eventCollection = this._eventCollection || {}; + + // Use the current collection of an event or create it. + this._eventCollection[event] = this._eventCollection[event] || []; + + // Appends the listener into the collection of the given event + this._eventCollection[event].push(listener); + + return this; + }; + + /** + * Adds a listener to the collection for the specified event that will be called only once. + * @memberof! Emitter.prototype + * @function + * @param {String} event - The event name. + * @param {Function} listener - A listener function to add. + * @returns {Object} Returns an instance of Emitter. + * @example + * // Will add an event handler to "foo" event once. + * emitter.once('foo', listener); + */ + + Emitter.prototype.once = function once(event, listener) { + var self = this; + + function fn() { + self.off(event, fn); + listener.apply(this, arguments); + } + + fn.listener = listener; + + this.on(event, fn); + + return this; + }; + + /** + * Removes a listener from the collection for the specified event. + * @memberof! Emitter.prototype + * @function + * @param {String} event - The event name. + * @param {Function} listener - A listener function to remove. + * @returns {Object} Returns an instance of Emitter. + * @example + * // Remove a given listener. + * emitter.off('foo', listener); + */ + + Emitter.prototype.off = function off(event, listener) { + + var listeners = undefined; + + // Defines listeners value. + if (!this._eventCollection || !(listeners = this._eventCollection[event])) { + return this; + } + + listeners.forEach(function (fn, i) { + if (fn === listener || fn.listener === listener) { + // Removes the given listener. + listeners.splice(i, 1); + } + }); + + // Removes an empty event collection. + if (listeners.length === 0) { + delete this._eventCollection[event]; + } + + return this; + }; + + /** + * Execute each item in the listener collection in order with the specified data. + * @memberof! Emitter.prototype + * @function + * @param {String} event - The name of the event you want to emit. + * @param {...Object} data - Data to pass to the listeners. + * @returns {Object} Returns an instance of Emitter. + * @example + * // Emits the "foo" event with 'param1' and 'param2' as arguments. + * emitter.emit('foo', 'param1', 'param2'); + */ + + Emitter.prototype.emit = function emit(event) { + var _this = this; + + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var listeners = undefined; + + // Defines listeners value. + if (!this._eventCollection || !(listeners = this._eventCollection[event])) { + return this; + } + + // Clone listeners + listeners = listeners.slice(0); + + listeners.forEach(function (fn) { + return fn.apply(_this, args); + }); + + return this; + }; + + return Emitter; +})(); + +/** + * Exports Emitter + */ +exports["default"] = Emitter; +module.exports = exports["default"]; +},{}]},{},[1])(1) +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9kZWNvdXBsZS9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9lbWl0dGVyL2Rpc3QvaW5kZXguanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO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ndW1lbnRzW19rZXldO1xuICAgIH1cblxuICAgIHZhciBsaXN0ZW5lcnMgPSB1bmRlZmluZWQ7XG5cbiAgICAvLyBEZWZpbmVzIGxpc3RlbmVycyB2YWx1ZS5cbiAgICBpZiAoIXRoaXMuX2V2ZW50Q29sbGVjdGlvbiB8fCAhKGxpc3RlbmVycyA9IHRoaXMuX2V2ZW50Q29sbGVjdGlvbltldmVudF0pKSB7XG4gICAgICByZXR1cm4gdGhpcztcbiAgICB9XG5cbiAgICAvLyBDbG9uZSBsaXN0ZW5lcnNcbiAgICBsaXN0ZW5lcnMgPSBsaXN0ZW5lcnMuc2xpY2UoMCk7XG5cbiAgICBsaXN0ZW5lcnMuZm9yRWFjaChmdW5jdGlvbiAoZm4pIHtcbiAgICAgIHJldHVybiBmbi5hcHBseShfdGhpcywgYXJncyk7XG4gICAgfSk7XG5cbiAgICByZXR1cm4gdGhpcztcbiAgfTtcblxuICByZXR1cm4gRW1pdHRlcjtcbn0pKCk7XG5cbi8qKlxuICogRXhwb3J0cyBFbWl0dGVyXG4gKi9cbmV4cG9ydHNbXCJkZWZhdWx0XCJdID0gRW1pdHRlcjtcbm1vZHVsZS5leHBvcnRzID0gZXhwb3J0c1tcImRlZmF1bHRcIl07Il19 diff --git a/source/lib/slideout/slideout.min.js b/source/lib/slideout/slideout.min.js new file mode 100644 index 0000000..30a90fb --- /dev/null +++ b/source/lib/slideout/slideout.min.js @@ -0,0 +1 @@ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Slideout=t()}}(function(){var t,e,n;return function i(t,e,n){function o(r,a){if(!e[r]){if(!t[r]){var u=typeof require=="function"&&require;if(!a&&u)return u(r,!0);if(s)return s(r,!0);var l=new Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}var f=e[r]={exports:{}};t[r][0].call(f.exports,function(e){var n=t[r][1][e];return o(n?n:e)},f,f.exports,i,t,e,n)}return e[r].exports}var s=typeof require=="function"&&require;for(var r=0;rt._tolerance?t.open():t.close()}t._moved=false};this.panel.addEventListener(f.end,this._onTouchEndFn);this._onTouchMoveFn=function(e){if(r||t._preventOpen||typeof e.touches==="undefined"||d(e.target)){return}var n=e.touches[0].clientX-t._startOffsetX;var i=t._currentOffsetX=n;if(Math.abs(i)>t._padding){return}if(Math.abs(n)>20){t._opening=true;var o=n*t._orientation;if(t._opened&&o>0||!t._opened&&o<0){return}if(!t._moved){t.emit("translatestart")}if(o<=0){i=n+t._padding*t._orientation;t._opening=false}if(!(t._moved&&u.classList.contains("slideout-open"))){u.classList.add("slideout-open")}t.panel.style[h+"transform"]=t.panel.style.transform="translateX("+i+"px)";t.emit("translate",i);t._moved=true}};this.panel.addEventListener(f.move,this._onTouchMoveFn);return this};_.prototype.enableTouch=function(){this._touch=true;return this};_.prototype.disableTouch=function(){this._touch=false;return this};_.prototype.destroy=function(){this.close();a.removeEventListener(f.move,this._preventMove);this.panel.removeEventListener(f.start,this._resetTouchFn);this.panel.removeEventListener("touchcancel",this._onTouchCancelFn);this.panel.removeEventListener(f.end,this._onTouchEndFn);this.panel.removeEventListener(f.move,this._onTouchMoveFn);a.removeEventListener("scroll",this._onScrollFn);this.open=this.close=function(){};return this};e.exports=_},{decouple:2,emitter:3}],2:[function(t,e,n){"use strict";var i=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}();function o(t,e,n){var o,s=false;function r(t){o=t;a()}function a(){if(!s){i(u);s=true}}function u(){n.call(t,o);s=false}t.addEventListener(e,r,false);return r}e.exports=o},{}],3:[function(t,e,n){"use strict";var i=function(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}};n.__esModule=true;var o=function(){function t(){i(this,t)}t.prototype.on=function e(t,n){this._eventCollection=this._eventCollection||{};this._eventCollection[t]=this._eventCollection[t]||[];this._eventCollection[t].push(n);return this};t.prototype.once=function n(t,e){var n=this;function i(){n.off(t,i);e.apply(this,arguments)}i.listener=e;this.on(t,i);return this};t.prototype.off=function o(t,e){var n=undefined;if(!this._eventCollection||!(n=this._eventCollection[t])){return this}n.forEach(function(t,i){if(t===e||t.listener===e){n.splice(i,1)}});if(n.length===0){delete this._eventCollection[t]}return this};t.prototype.emit=function s(t){var e=this;for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o