diff --git a/2018/12/09/bc/index.html b/2018/12/09/bc/index.html index 1ec458f4..2c595524 100644 --- a/2018/12/09/bc/index.html +++ b/2018/12/09/bc/index.html @@ -1,85 +1,129 @@ - + - - + + + + + + + - - 配置浏览器地址栏作为超级计算器(bc) | uWeb - - - - - - - - - - - - - - - - - - - - + + + 配置浏览器地址栏作为超级计算器(bc) - undefined + + + + + + + + + + - - -
-
- -
-
- -
- - -
- - -

- 配置浏览器地址栏作为超级计算器(bc) -

- -
+ + + + +
+ +
+ +
-
- +
+ + + + +
+
+
+ + + search +
+
+ +
+
+
+
+ +
+
+ +
+ + + + +
+
+ 配置浏览器地址栏作为超级计算器(bc) +
+ + +

使用Android端uweb浏览器
Gnu bc计算器支持无限精度,可轻易扩展函数库、常数库。

  • 安装uweb定制Termux应用(长按[PC]选择”Symbian”再刷新网页可直接下载):

    https://pan.baidu.com/s/1WwQ9yhPlu95sFtttlzDXFA
  • @@ -87,105 +131,62 @@

    • bc: 计算器。


    • 配置文件/sdcard/uweb/cmds.txt如下:

      计算器:text/html:echo “%s”|bc -l -q



      更多bc扩展库:(扩展库可下载至/sdcard/uweb目录下)

      https://github.com/susca/bc-extensions

      phodd.net/gnu-bc

      www.numbertheory.org/gnubc/gnubc.html



      使用扩展库以后cmds.txt配置如下:

      计算器:text/html:echo “%s”|bc -l -q extensions.bc scientific_constants.bc

      全能计算器:text/html:echo “%s”|bc -l -q *.bc


      - + +
      +
      +
      +
      + +
      +
      +
      - -
      - - - - - -
      - -
      - -
      +
      - +
      - - - - + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/2018/12/09/gluplot/index.html b/2018/12/09/gluplot/index.html index d0e5fb1c..816be1d1 100644 --- a/2018/12/09/gluplot/index.html +++ b/2018/12/09/gluplot/index.html @@ -1,85 +1,129 @@ - + - - + + + + + + + - - 利用浏览器地址栏对函数作图 | uWeb - - - - - - - - - - - - - - - - - - - - + + + 利用浏览器地址栏对函数作图 - undefined + + + + + + + + + + - - -
      -
      - -
      -
      - -
      - - -
      - - -

      - 利用浏览器地址栏对函数作图 -

      - -
      + + + + +
      + +
      + +
      -
      - +
      + + + + +
      +
      +
      + + + search +
      +
      + +
      +
      +
      +
      + +
      +
      + +
      + + + + +
      +
      + 利用浏览器地址栏对函数作图 +
      + + +

      使用Android端uweb浏览器
      Termux提供了方便的软件包管理系统,缺省的uWeb地址栏功能配置需用到作图软件gnuplot。

      • 安装uweb定制Termux应用(长按[PC]选择”Symbian”再刷新网页可直接下载):

        https://pan.baidu.com/s/1WwQ9yhPlu95sFtttlzDXFA
      • @@ -88,105 +132,62 @@

      • gnuplot: 作图工具。


      • 配置文件/sdcard/uweb/cmds.txt如下:

        命令:text/plain:%s

        函数作图:image/svg+xml:gnuplot -e ‘set term svg;set output; plot %s’

        函数作图(3d):image/svg+xml:gnuplot -e ‘set term svg;set output; splot %s’

        超级计算器:text/html:echo “%s”|bc -l -q

        长按uweb浏览器底部工具条刷新按钮弹出地址栏功能选择,选择“函数作图”,地址栏内输入函数如sin(x)**5就可显示函数图案。

        - + +
        +
        +
        +
        + +
        +
        +
        - -
        - - - - - -
        - -
        - -
        +
        - +
        - - - - + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/2018/12/09/hosts/index.html b/2018/12/09/hosts/index.html index e708378e..e248e895 100644 --- a/2018/12/09/hosts/index.html +++ b/2018/12/09/hosts/index.html @@ -1,182 +1,188 @@ - + - - + + + + + + + - - 利用超级hosts文件加速访问国外网站 | uWeb - - - - - - - - - - - - - - - - - - - - + + + 利用超级hosts文件加速访问国外网站 - undefined + + + + + + + + + + - - -
        -
        - -
        -
        - -
        - - -
        - - -

        - 利用超级hosts文件加速访问国外网站 -

        - -
        + + + + +
        + +
        + +
        -
        - +
        + + + + +
        +
        +
        + + + search +
        +
        + +
        +
        +
        +
        + +
        +
        + +
        + + + + +
        +
        + 利用超级hosts文件加速访问国外网站 +
        + + +

        不少国外网站本身虽可访问,但由于网站需要下载google,
        facebook等屏蔽网址的资源而导致无法访问。超级hosts文件可屏蔽文件中域名的一切子域名、孙域名、……,从而主动屏蔽这些网址,最终允许浏览器快速访问合法网站。

        使用Android端uweb浏览器
        /sdcard/uweb/hosts内容如下:

        googleadservices.com

        googlesyndication.com

        adsense.com

        google.com

        google-analytics.com

        googletagservices.com

        twitter.com

        facebook.com

        fbcdn.net

        - + +
        +
        +
        +
        + +
        +
        +
        - -
        - - - - - -
        - -
        - -
        +
        - +
        - - - - + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/2018/12/09/search/index.html b/2018/12/09/search/index.html index 69ea9608..8496f36e 100644 --- a/2018/12/09/search/index.html +++ b/2018/12/09/search/index.html @@ -1,179 +1,189 @@ - + - - + + + + + + + - - 浏览器多搜索引擎一键直达 | uWeb - - - - - - - - - - - - - - - - - - - - + + + 浏览器多搜索引擎一键直达 - undefined + + + + + + + + + + - - -
        -
        - -
        -
        - -
        - - -
        - - -

        - 浏览器多搜索引擎一键直达 -

        - -
        + + + + +
        + +
        + +
        -
        - +
        + + + + +
        +
        +
        + + + search +
        +
        + +
        +
        +
        +
        + +
        +
        + +
        + + + + +
        +
        + 浏览器多搜索引擎一键直达 +
        + + +

        使用Android端uweb浏览器

        推荐引擎(将下面文本添加到/sdcard/uweb/searchurl.txt中):
        化学品:http://www.basechem.org/search?q=
        大百科全书:http://h.bkzx.cn/search?sublibId=2&query=
        柯林斯双解:http://www.iciba.com/
        柯林斯汉英大词典:https://www.hjdict.com/w/
        剑桥双解:https://dictionary.cambridge.org/dictionary/english-chinese-simplified/
        现代日汉双解:https://dict.hjenglish.com/jp/jc/
        wolfram:https://www.wolframalpha.com/input/?i=
        duck:https://duckduckgo.com/?q=
        wiki:https://en.wikipedia.org/wiki/
        git:https://github.com/search?type=Repositories&q=
        man:http://man.cx/
        code:http://searchcode.com/?q=
        牛津搭配:http://www.freecollocation.com/search?word=
        chem:https://www.ncbi.nlm.nih.gov/pccompound?term=
        googledict:http://googledictionary.freecollocation.com/meaning?word=

        其中中国大百科全书注册登录后才可免费查阅。更多引擎可参看:
        https://www.pdawiki.com/forum/thread-28557-1-1.html?x=4030(需免费注册才可查看,正与站长协商开放权限)
        https://github.com/Dictionaryphile/All_Dictionaries

        - + +
        +
        +
        +
        + +
        +
        +
        - -
        - - - - - -
        - -
        - -
        +
        - +
        - - - - + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/archives/2018/12/index.html b/archives/2018/12/index.html index f567303b..6cc33664 100644 --- a/archives/2018/12/index.html +++ b/archives/2018/12/index.html @@ -1,218 +1,231 @@ - + - - + + + + + + + - - Archives: 2018/12 | uWeb - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + -
        -
        - -
        -
        - - + + + +
        + +
        + +
        - - - -
        -
        - 2018 +
        + +
        - - - -
        - -
        - - - -
        -
        + + + - - - + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/archives/2018/index.html b/archives/2018/index.html index f02ea6ea..6cc33664 100644 --- a/archives/2018/index.html +++ b/archives/2018/index.html @@ -1,218 +1,231 @@ - + - - + + + + + + + - - Archives: 2018 | uWeb - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + -
        -
        - -
        -
        - - + + + +
        + +
        + +
        - - - -
        -
        - 2018 +
        + +
        - - - -
        - -
        - - - -
        -
        + + + - - - + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/archives/index.html b/archives/index.html index 294b5d72..6cc33664 100644 --- a/archives/index.html +++ b/archives/index.html @@ -1,218 +1,231 @@ - + - - + + + + + + + - - Archives | uWeb - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + -
        -
        - -
        -
        - - + + + +
        + +
        + +
        - - - -
        -
        - 2018 +
        + +
        - - - -
        - -
        - - - -
        -
        + + + - - - + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/css/aircloud.css b/css/aircloud.css new file mode 100644 index 00000000..b447c84c --- /dev/null +++ b/css/aircloud.css @@ -0,0 +1,1208 @@ +/*varibles*/ +* { + font-family: "italic", Helvetica, Arial, "Heiti SC", "Microsoft YaHei"; +} +body, +html { + margin: 0; + padding: 0; +} +body { + margin-left: calc(100vw - 100%) !important; +} +.red { + color: red; +} +.hide { + display: none !important; +} +.show-block { + display: block !important; +} +.show-block { + animation: showBlock 0.4s forwards; + display: block !important; +} +@keyframes showBlock { + from { + opacity: 0; + transform: translateY(-100%); + } + to { + opacity: 1; + transform: translateY(0); + } +} +.hide-block { + display: block !important; + animation: hideBlock 0.4s forwards; + opacity: 1; + transform: translateY(0); +} +@keyframes hideBlock { + from { + opacity: 1; + transform: translateY(0); + } + to { + opacity: 0; + transform: translateY(-100%); + display: none; + } +} +.show-flex-fade { + animation: showFade 0.4s forwards; + display: flex !important; +} +.hide-flex-fade { + animation: hideFade 0.4s forwards; +} +@keyframes showFade { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +@keyframes hideFade { + from { + opacity: 1; + } + to { + opacity: 0; + display: none !important; + } +} +.no-indent { + text-indent: 0 !important; +} +.no-indent p, +.no-indent h1, +.no-indent h2, +.no-indent h3, +.no-indent h4, +.no-indent h5, +.no-indent h6, +.no-indent ul, +.no-indent ol { + text-indent: 0 !important; +} +.nav { + position: relative; + padding-top: 50px; + color: #333333; + width: 100%; + display: flex; + flex-direction: column; + align-items: center; +} +.nav .avatar-name { + display: flex; + flex-direction: column; + align-items: center; + border-bottom: 1px solid #979797; +} +.nav .avatar-name .avatar { + width: 120px; + height: 120px; + padding: 10px; + box-sizing: border-box; +} +.nav .avatar-name .avatar img { + width: 100px; + height: 100px; +} +.nav .avatar-name .name { + margin-top: 10px; + margin-bottom: 20px; +} +.nav .avatar-name .name i { + font-size: 16px; + font-family: "italic" !important; + font-weight: 300; + color: #666666; +} +.nav .contents ul { + width: 100%; + padding-left: 0; + margin-top: 25px; + margin-bottom: 25px; +} +.nav .contents ul li, +.nav .contents ul li a { + text-decoration: none; + font-size: 15px; + margin: 20px auto; + padding-left: 0; + list-style: none; +} +.nav .contents ul li i, +.nav .contents ul li a i { + cursor: pointer; + color: #999999; + margin-right: 5px; +} +.nav .contents ul li span, +.nav .contents ul li a span { + cursor: pointer; + color: #999999; +} +.nav .contents ul li.active span, +.nav .contents ul li.active i { + color: #4a4a4a; +} +.nav .contents ul li:hover span, +.nav .contents ul li:hover i { + color: #4a4a4a; +} +.site-nav-toggle { + display: none; +} +.site-nav-toggle button { + outline: none; + margin-top: 2px; + padding: 9px 10px; + background: transparent; + border: none; + user-select: none; +} +.site-nav-toggle button .btn-bar { + display: block; + width: 22px; + height: 2px; + background: #666666; + border-radius: 1px; +} +.site-nav-toggle button .btn-bar + .btn-bar { + margin-top: 4px; +} +.search-field { + overflow: hidden; + display: none; + position: fixed; + top: 0; + bottom: 0; + z-index: 3; + left: 0; + right: 0; + width: 100vw; + height: 100vh; + background-color: rgba(0, 0, 0, 0.3); + align-items: center; + flex-direction: column; +} +.search-field .search-container { + width: 40vw; + min-width: 500px; + height: 70vh; + margin-top: 15vh; + background-color: white; +} +.search-field .search-container .search-input { + width: 100%; + display: flex; + align-items: center; + padding-top: 10px; +} +.search-field .search-container .search-input span { + width: 60px; + color: #999999; + line-height: 30px; + text-align: center; +} +.search-field .search-container .search-input span:nth-child(1) { + width: 40px; +} +.search-field .search-container .search-input #begin-search { + cursor: pointer; +} +.search-field .search-container .search-input #begin-search:hover { + color: #4a4a4a; +} +.search-field .search-container .search-input input { + flex: 1; + background-color: #f3f4f7; + border: 1px solid #cccccc; + height: 30px; + font-size: 18px; + color: #4a4a4a; + box-sizing: border-box; + font-weight: 300; + padding-left: 5px; + padding-right: 5px; +} +.search-field .search-result-container { + height: calc(70vh - 50px); + overflow-y: scroll; + overflow-x: hidden; +} +.search-field .search-result-container::-webkit-scrollbar { + width: 4px; +} +.search-field .search-result-container .no-search-result { + width: 100%; + height: 200px; + text-align: center; + padding-top: 100px; + color: #999999; + font-size: 16px; +} +.search-field .search-result-container::-webkit-scrollbar-thumb { + background-color: #c3c4c7; + -webkit-border-radius: 2px; + border-radius: 2px; +} +.search-field .search-result-container ul { + margin-top: 10px; + width: calc(100% - 25px); + padding-left: 10px; +} +.search-field .search-result-container ul li { + margin-bottom: 15px; + list-style: none; +} +.search-field .search-result-container ul li a { + text-decoration: none; + cursor: pointer; + font-size: 16px; + color: #4a4a4a; + font-weight: 300; + padding-bottom: 5px; +} +.search-field .search-result-container ul li ul { + padding-left: 10px; +} +.search-field .search-result-container ul li ul li { + list-style: none; + color: #666666; + font-weight: 300; + font-size: 13px; +} +@media screen and (max-width: 680px) { + .search-field .search-container { + min-width: 0; + width: 100%; + height: 100%; + margin: 0; + } + .search-field .search-result-container { + height: calc(100vh - 50px); + } + .nav { + margin-top: 50px; + position: relative; + top: 0; + width: 100%; + } + .nav .avatar-name { + border-bottom: none; + } + .nav .contents { + display: none; + position: fixed; + left: 0; + top: 40px; + background-color: white; + width: 100%; + border-bottom: 1px solid #CCCCCC; + border-top: 1px solid #CCCCCC; + } + .nav .contents ul { + padding-left: 30px; + } + .site-nav-toggle { + height: 40px; + box-sizing: border-box; + display: block; + position: fixed; + width: 100%; + padding-top: 2px; + padding-left: 20px; + z-index: 2; + background-color: white; + } +} +.post-preview { + width: 100%; + height: max-content; + margin-bottom: 10px; + box-sizing: border-box; + display: flex; + flex-direction: row; +} +.post-preview .post-time { + font-size: 17px; + color: #999999; + width: 125px; + font-weight: 300; + line-height: 24px; +} +.post-preview .post-info { + flex: 1; +} +.post-preview .post-info a { + cursor: pointer; + text-decoration: none; +} +.post-preview .post-info a h3 { + line-height: 24px; + cursor: pointer; + margin-top: 0; + margin-bottom: 5px; + color: #101010; + font-size: 18px; + font-weight: 300; + transition: color 0.4s; +} +.post-preview .post-info a h3:hover { + color: #4990E2; +} +.post-preview .post-info p { + margin-top: 0; +} +.post-preview .post-info p span, +.post-preview .post-info p a { + font-weight: 300; + color: #999999; + font-size: 14px; + text-decoration: none; +} +.post-preview-container { + min-height: 420px; +} +.pager { + width: 100%; + height: 40px; + padding-left: 0; + display: flex; +} +.pager .previous { + flex: 1; + display: flex; + flex-direction: row; + cursor: pointer; +} +.pager .next { + flex: 1; + display: flex; + flex-direction: row-reverse; + cursor: pointer; +} +.pager .previous a, +.pager .next a { + box-sizing: border-box; + cursor: pointer; + transition: color 0.4s, background-color 0.4s; + border: 1px solid #999999; + line-height: 40px; + width: 150px; + height: 40px; + font-size: 18px; + color: #999999; + text-align: center; + text-decoration: none; +} +.pager .previous a:hover, +.pager .next a:hover { + color: white; + cursor: pointer; + background-color: #666666; +} +@media screen and (max-width: 680px) { + .post-preview-container { + min-height: 0 !important; + } + .post-preview { + width: 100%; + height: max-content; + margin-bottom: 10px; + box-sizing: border-box; + display: flex; + flex-direction: column; + padding-left: 10px; + padding-right: 10px; + border-bottom: 1px solid #EEEEEE; + } + .post-preview .post-time { + font-size: 11px; + color: #999999; + width: 125px; + font-weight: 300; + line-height: 20px; + font-style: oblique; + } + .post-preview .post-info { + flex: 1; + } + .post-preview .post-info a { + cursor: pointer; + text-decoration: none; + } + .post-preview .post-info a h3 { + line-height: 20px; + cursor: pointer; + margin-top: 0; + margin-bottom: 5px; + color: #101010; + font-size: 15px; + font-weight: 300; + } + .post-preview .post-info p { + margin-top: 0; + } + .post-preview .post-info p span, + .post-preview .post-info p a { + font-weight: 300; + color: #999999; + font-size: 12px; + text-decoration: none; + } + .pager { + width: 100%; + height: 40px; + padding-left: 10px; + padding-right: 10px; + display: flex; + } + .pager .previous { + flex: 1; + display: flex; + flex-direction: row; + cursor: pointer; + } + .pager .next { + flex: 1; + display: flex; + flex-direction: row-reverse; + cursor: pointer; + } + .pager .previous a, + .pager .next a { + box-sizing: border-box; + cursor: pointer; + transition: color 0.4s, background-color 0.4s; + border: 1px solid #999999; + line-height: 30px; + width: 120px; + height: 30px; + font-size: 14px; + color: #999999; + text-align: center; + text-decoration: none; + } + .pager .previous a:hover, + .pager .next a:hover { + color: white; + cursor: pointer; + background-color: #666666; + } +} +.tags { + line-height: 30px; + margin-bottom: 25px; +} +.tags a { + text-decoration: none; + color: #999999; + margin-right: 15px; +} +.tags a:hover { + color: #4a4a4a; +} +.tags a::before { + content: "#"; +} +.one-tag-list { + margin-bottom: 25px; +} +.one-tag-list .fa-tag { + margin-bottom: 15px; + display: block; + color: #999999; +} +.one-tag-list .post-preview { + padding-left: 2em; +} +.one-tag-list .post-preview a { + cursor: pointer; + text-decoration: none; +} +.one-tag-list .post-preview a .post-title { + margin-bottom: 5px; + line-height: 20px; + cursor: pointer; + margin-top: 0; + color: #101010; + font-size: 18px; + font-weight: 300; + transition: color 0.4s; +} +.one-tag-list .post-preview a .post-title:hover { + color: #4990E2; +} +@media screen and (max-width: 680px) { + .one-tag-list { + margin-bottom: 25px; + } + .one-tag-list .fa-tag { + margin-bottom: 15px; + display: block; + color: #999999; + } + .one-tag-list .post-preview { + padding-left: 2em; + } + .one-tag-list .post-preview a { + cursor: pointer; + text-decoration: none; + } + .one-tag-list .post-preview a .post-title { + font-size: 14px; + font-weight: 300; + text-decoration: none; + line-height: 20px; + color: #4a4a4a; + margin-bottom: 5px; + cursor: pointer; + margin-top: 0; + transition: color 0.4s; + } + .one-tag-list .post-preview a .post-title:hover { + color: #4990E2; + } +} +.post-container { + width: 100%; + height: max-content; + display: flex; + flex-direction: column; +} +.post-container .post-title { + width: 100%; + text-align: center; + line-height: 24px; + margin-top: 0; + margin-bottom: 5px; + color: #101010; + font-size: 20px; + font-weight: 300; +} +.post-container .post-meta { + text-align: center; + margin-top: 0; + margin-bottom: 20px; +} +.post-container .post-meta span, +.post-container .post-meta a { + font-weight: 300; + color: #999999; + font-size: 13px; + text-decoration: none; +} +.post-container .post-meta .attr { + margin-right: 5px; + margin-left: 5px; +} +.post-content { + line-height: 20px; + font-size: 15px; + text-indent: 2em; + color: #333333; + font-weight: 300; +} +.post-content blockquote { + border-top: 1px solid #cccccc; + border-bottom: 1px solid #cccccc; + margin-left: 2em; + margin-right: 2em; + padding-left: 0; + padding-right: 0; +} +.post-content blockquote p { + margin-top: 10px; + margin-bottom: 10px; + color: #666666; +} +.post-content a { + text-decoration: none; + color: #4990E2; +} +.post-content p { + color: #404040; + font-size: 14px; + line-height: 30px; + text-indent: 2em; + letter-spacing: 1px; +} +.post-content p img { + width: 80%; +} +.post-content ul, +.post-content ol { + padding-left: 2em; +} +.post-content ul li, +.post-content ol li { + list-style: none; + color: #404040; + font-size: 14px; + line-height: 30px; + text-indent: 2em; + letter-spacing: 1px; + margin-bottom: 5px; + margin-top: 5px; +} +.post-content ul li:before, +.post-content ol li:before { + content: '• '; +} +.post-content pre { + text-indent: 0; + padding: 10px; +} +.post-content pre code { + color: white; + line-height: 175%; +} +.post-content h1 { + color: #333333; + margin-top: 20px; + margin-bottom: 20px; +} +.post-content h2 { + color: #333333; + margin-top: 20px; + margin-bottom: 20px; +} +.post-content h3 { + color: #333333; + margin-top: 20px; + margin-bottom: 20px; +} +.post-content h4 { + color: #333333; + margin-top: 20px; + margin-bottom: 20px; +} +.post-content h5 { + color: #333333; + margin-top: 20px; + margin-bottom: 20px; +} +.post-content h6 { + color: #333333; + margin-top: 20px; + margin-bottom: 20px; +} +#comment-container { + text-indent: 0; +} +#lv-container { + text-indent: 0; +} +.post-content li p { + display: inline; +} +.index-about { + text-align: center; + width: 100%; + margin-top: 45px; + margin-bottom: 40px; + opacity: 0; + animation: showBlock 1.6s forwards; +} +.index-about i { + font-size: 15px; + font-family: "italic" !important; + font-weight: 300; + color: #444444; +} +.index-about-mobile { + display: none; +} +.index-container { + justify-content: center; + height: max-content; + position: relative; + width: 1024px; + margin: auto; + display: flex; + flex-direction: row; + background-color: white; +} +.index-container .index-left { + width: 240px; +} +.index-container .index-middle { + max-width: 784px; + flex: 1; +} +@media screen and (max-width: 1180px) { + .index-container { + left: 0; + width: 100%; + box-sizing: border-box; + margin: auto; + padding: 0 40px 0 10px; + display: flex; + flex-direction: row; + } + .index-container .index-left { + width: 180px; + } + .index-container .index-middle { + flex: 1; + max-width: calc(100% - 180px); + } +} +@media screen and (max-width: 680px) { + .index-container { + width: 100%; + box-sizing: border-box; + margin: auto; + display: flex; + flex-direction: column; + padding: 0 25px 0 25px; + min-height: 0; + } + .index-container .index-left { + width: 100%; + } + .index-container .index-middle { + max-width: 100%; + flex: 1; + } + .index-about { + display: none; + } + .index-about-mobile { + display: block; + text-align: center; + width: 100%; + margin-top: 0; + margin-bottom: 40px; + } + .index-about-mobile i { + font-size: 15px; + font-family: "italic" !important; + font-weight: 300; + color: #444444; + } +} +.donate-container { + width: 100%; + display: flex; + align-items: center; + flex-direction: column; +} +.donate-container .donate-button { + margin-bottom: 10px; + text-align: center; + display: flex; + align-items: center; + flex-direction: column; +} +.donate-container .donate-button button { + border: none; + cursor: pointer; + box-shadow: none; + outline: none; + border-radius: 6px; + width: 60px; + height: 24px; + text-align: center; + color: white; + background-color: orange; +} +.donate-container .donate-button button:active { + background-color: darkorange; +} +.donate-container .donate-img-container { + display: flex; + align-items: center; + flex-direction: column; +} +.donate-container .donate-img-container img { + max-width: 400px; + max-height: 360px; +} +.donate-container .donate-img-container p { + text-align: center; + font-size: 14px; + color: #999999; +} +@media screen and (max-width: 680px) { + .donate-container .donate-img-container img { + max-width: 75vw; + max-height: 240px; + } + .donate-container .donate-img-container p { + text-align: center; + font-size: 14px; + color: #999999; + } +} +.archives-container .one-tag-list .listing-seperator { + font-size: 18px; + color: #999999; +} +.archives-container .one-tag-list ul { + list-style: none; +} +.archives-container .one-tag-list ul li { + display: flex; + align-items: center; + flex-direction: row; + margin-bottom: 10px; +} +.archives-container .one-tag-list ul li span { + color: #999999; + margin-right: 15px; + min-width: 45px; +} +.archives-container .one-tag-list ul li a { + text-decoration: none; + line-height: 20px; + color: #4a4a4a; +} +.archives-container .one-tag-list ul li a span { + color: #4a4a4a; + transition: color 0.4s; +} +.archives-container .one-tag-list ul li a span:hover { + color: #4990E2; +} +@media screen and (max-width: 680px) { + .archives-container .one-tag-list .listing-seperator { + font-size: 18px; + color: #999999; + } + .archives-container .one-tag-list ul { + list-style: none; + padding-left: 1em; + } + .archives-container .one-tag-list ul li { + display: flex; + align-items: center; + flex-direction: row; + margin-bottom: 10px; + } + .archives-container .one-tag-list ul li span { + color: #999999; + margin-right: 15px; + min-width: 45px; + font-size: 14px; + } + .archives-container .one-tag-list ul li i { + font-size: 12px; + } + .archives-container .one-tag-list ul li a { + font-size: 14px; + font-weight: 300; + text-decoration: none; + line-height: 20px; + color: #4a4a4a; + } + .archives-container .one-tag-list ul li a span { + color: #4a4a4a; + } +} +pre, +.highlight { + overflow: auto; + margin: 20px 0; + padding: 0; + font-size: 13px; + color: #4d4d4c; + background: #f7f7f7; + line-height: 1.6; +} +pre, +code { + font-family: consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace; +} +code { + padding: 2px 4px; + word-wrap: break-word; + color: #555; + background: #eee; + border-radius: 3px; + font-size: 13px; +} +pre { + padding: 10px; +} +pre code { + padding: 0; + color: #4d4d4c; + background: none; + text-shadow: none; +} +.highlight { + border-radius: 1px; +} +.highlight pre { + border: none; + margin: 0; + padding: 10px 0; +} +.highlight table { + margin: 0; + width: auto; + border: none; +} +.highlight td { + border: none; + padding: 0; +} +.highlight figcaption { + font-size: 1em; + color: #4d4d4c; + line-height: 1em; + margin-bottom: 1em; +} +.highlight figcaption a { + float: right; + color: #4d4d4c; +} +.highlight figcaption a:hover { + border-bottom-color: #4d4d4c; +} +.highlight .gutter pre { + padding-left: 10px; + padding-right: 10px; + color: #869194; + text-align: right; + background-color: #eff2f3; +} +.highlight .code pre { + width: 100%; + padding-left: 10px; + padding-right: 10px; + background-color: #f7f7f7; +} +.highlight .line { + height: 20px; +} +.gutter { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.gist table { + width: auto; +} +.gist table td { + border: none; +} +pre .deletion { + background: #fdd; +} +pre .addition { + background: #dfd; +} +pre .meta { + color: #8959a8; +} +pre .comment { + color: #8e908c; +} +pre .variable, +pre .attribute, +pre .tag, +pre .regexp, +pre .ruby .constant, +pre .xml .tag .title, +pre .xml .pi, +pre .xml .doctype, +pre .html .doctype, +pre .css .id, +pre .css .class, +pre .css .pseudo { + color: #c82829; +} +pre .number, +pre .preprocessor, +pre .built_in, +pre .literal, +pre .params, +pre .constant, +pre .command { + color: #f5871f; +} +pre .ruby .class .title, +pre .css .rules .attribute, +pre .string, +pre .value, +pre .inheritance, +pre .header, +pre .ruby .symbol, +pre .xml .cdata, +pre .special, +pre .number, +pre .formula { + color: #718c00; +} +pre .title, +pre .css .hexcolor { + color: #3e999f; +} +pre .function, +pre .python .decorator, +pre .python .title, +pre .ruby .function .title, +pre .ruby .title .keyword, +pre .perl .sub, +pre .javascript .title, +pre .coffeescript .title { + color: #4271ae; +} +pre .keyword, +pre .javascript .function { + color: #8959a8; +} +.footer { + width: 100%; + align-items: center; + display: flex; + flex-direction: column; + color: #979797; + margin-bottom: 10px; +} +.footer p { + font-family: "Montserrat", "Helvetica Neue", "Hiragino Sans GB", "LiHei Pro", Arial, sans-serif; + font-size: 14px; + margin-top: 5px; + margin-bottom: 0; + font-weight: 300; +} +.footer p a { + font-weight: 300; + font-family: "Montserrat", "Helvetica Neue", "Hiragino Sans GB", "LiHei Pro", Arial, sans-serif; + cursor: pointer; + color: #333333; +} +.footer p span a { + font-weight: 300; + font-family: "Montserrat", "Helvetica Neue", "Hiragino Sans GB", "LiHei Pro", Arial, sans-serif; + cursor: pointer; + color: #979797; + text-decoration: none; +} +.footer p span a:hover { + color: #333333; +} +.list-inline.text-center { + color: #444444; + font-size: 20px; + padding-left: 0; + margin-bottom: 0; +} +.list-inline.text-center li { + display: inline-block; + margin: 0 2px; + background-color: #979797; + height: 24px; + width: 24px; + border-radius: 12px; + text-align: center; +} +.list-inline.text-center li a { + text-decoration: none; +} +.list-inline.text-center li a span i { + line-height: 20px; + color: white; +} +.list-inline.text-center li:hover { + background-color: #333333; +} +@media screen and (max-width: 680px) { + .footer { + box-sizing: border-box; + padding-left: 20px; + padding-right: 20px; + } + .footer p { + font-family: "Montserrat", "Helvetica Neue", "Hiragino Sans GB", "LiHei Pro", Arial, sans-serif; + font-size: 11px; + margin-top: 5px; + margin-bottom: 0; + font-weight: 300; + } + .footer p span a { + font-size: 11px; + font-weight: 300; + font-family: "Montserrat", "Helvetica Neue", "Hiragino Sans GB", "LiHei Pro", Arial, sans-serif; + cursor: pointer; + color: #979797; + text-decoration: none; + } + .footer p span a:hover { + color: #333333; + } +} +.toc-article { + width: 240px; +} +.toc-article ol { + padding-left: 10px; + cursor: pointer; + font-size: 0; +} +.toc-article li { + font-size: 0; + box-sizing: border-box; + border-left: 2px solid #cccccc; + list-style: none; + padding-left: 10px; +} +.toc-article li a { + display: block; + line-height: 20px; + margin-bottom: 10px; + text-decoration: none; + color: #999999; + font-size: 14px; +} +.toc-article li a span { + word-break: break-all; +} +.toc-article li.active { + border-left: 2px solid #4990E2; +} +.toc-article li.active > a { + color: #4990E2; +} +.toc-article li:hover { + border-left: 2px solid #4990E2; +} +.toc-article li:hover > a { + color: #4990E2; +} +.toc-article > ol > li { + border-left: none !important; +} +.toc-fixed { + position: fixed; + top: 10px; + width: 240px; +} +.toc-fixed::-webkit-scrollbar { + width: 0; +} +.toc-fixed::-webkit-scrollbar-thumb { + background-color: #ffffff; + -webkit-border-radius: 4px; + border-radius: 2px; +} +@media screen and (max-width: 1180px) { + .toc-article { + display: none; + } +} +.gitment-comment p { + text-indent: 0; +} diff --git a/css/aircloud.less b/css/aircloud.less new file mode 100644 index 00000000..c25ceeed --- /dev/null +++ b/css/aircloud.less @@ -0,0 +1,21 @@ +@import "../_less/variables"; +@import "../_less/common"; +@import "../_less/nav"; +@import "../_less/about"; +@import "../_less/index"; +@import "../_less/tag"; +@import "../_less/post"; +@import "../_less/page"; +@import "../_less/layout"; + +@import "../_less/donate"; + +@import "../_less/archive"; + +@import "../_less/hightlight"; +// _partial: +@import "../_less/_partial/footer"; + +@import "../_less/toc"; + +@import "../_less/gitment"; diff --git a/css/fonts/FontAwesome.otf b/css/fonts/FontAwesome.otf deleted file mode 100644 index 8b0f54e4..00000000 Binary files a/css/fonts/FontAwesome.otf and /dev/null differ diff --git a/css/fonts/fontawesome-webfont.eot b/css/fonts/fontawesome-webfont.eot deleted file mode 100644 index 7c79c6a6..00000000 Binary files a/css/fonts/fontawesome-webfont.eot and /dev/null differ diff --git a/css/fonts/fontawesome-webfont.svg b/css/fonts/fontawesome-webfont.svg deleted file mode 100644 index 45fdf338..00000000 --- a/css/fonts/fontawesome-webfont.svg +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/css/fonts/fontawesome-webfont.ttf b/css/fonts/fontawesome-webfont.ttf deleted file mode 100644 index e89738de..00000000 Binary files a/css/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/css/fonts/fontawesome-webfont.woff b/css/fonts/fontawesome-webfont.woff deleted file mode 100644 index 8c1748aa..00000000 Binary files a/css/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/css/gitment.css b/css/gitment.css new file mode 100644 index 00000000..5414f78c --- /dev/null +++ b/css/gitment.css @@ -0,0 +1,1146 @@ +.gitment-container { + font-family: sans-serif; + font-size: 14px; + line-height: 1.5; + color: #333; + word-wrap: break-word; +} + +.gitment-container * { + box-sizing: border-box; +} + +.gitment-container *:disabled { + cursor: not-allowed; +} + +.gitment-container a, +.gitment-container a:visited { + cursor: pointer; + text-decoration: none; +} + +.gitment-container a:hover { + text-decoration: underline; +} + +.gitment-container .gitment-hidden { + display: none; +} + +.gitment-container .gitment-spinner-icon { + fill: #333; + + -webkit-animation: gitment-spin 1s steps(12) infinite; + animation: gitment-spin 1s steps(12) infinite; +} + +@-webkit-keyframes gitment-spin { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg) + } +} + +@keyframes gitment-spin { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg) + } +} + +.gitment-root-container { + margin: 19px 0; +} + +.gitment-header-container { + margin: 19px 0; +} + +.gitment-header-like-btn, +.gitment-comment-like-btn { + cursor: pointer; +} + +.gitment-comment-like-btn { + float: right; +} + +.gitment-comment-like-btn.liked { + color: #F44336; +} + +.gitment-header-like-btn svg { + vertical-align: middle; + height: 30px; +} + +.gitment-comment-like-btn svg { + vertical-align: middle; + height: 20px; +} + +.gitment-header-like-btn.liked svg, +.gitment-comment-like-btn.liked svg { + fill: #F44336; +} + +a.gitment-header-issue-link, +a.gitment-header-issue-link:visited { + float: right; + line-height: 30px; + color: #666; +} + +a.gitment-header-issue-link:hover { + color: #666; +} + +.gitment-comments-loading, +.gitment-comments-error, +.gitment-comments-empty { + text-align: center; + margin: 50px 0; +} + +.gitment-comments-list { + list-style: none; + padding-left: 0; + margin: 0 0 38px; +} + +.gitment-comment, +.gitment-editor-container { + position: relative; + min-height: 60px; + padding-left: 60px; + margin: 19px 0; +} + +.gitment-comment-avatar, +.gitment-editor-avatar { + float: left; + margin-left: -60px; +} + +.gitment-comment-avatar, +.gitment-comment-avatar-img, +.gitment-comment-avatar, +.gitment-editor-avatar-img, +.gitment-editor-avatar svg { + width: 44px; + height: 44px; + border-radius: 3px; +} + +.gitment-editor-avatar .gitment-github-icon { + fill: #fff; + background-color: #333; +} + +.gitment-comment-main, +.gitment-editor-main { + position: relative; + border: 1px solid #CFD8DC; + border-radius: 0; +} + +.gitment-editor-main::before, +.gitment-editor-main::after, +.gitment-comment-main::before, +.gitment-comment-main::after { + position: absolute; + top: 11px; + left: -16px; + display: block; + width: 0; + height: 0; + pointer-events: none; + content: ""; + border-color: transparent; + border-style: solid solid outset; +} + +.gitment-editor-main::before, +.gitment-comment-main::before { + border-width: 8px; + border-right-color: #CFD8DC; +} + +.gitment-editor-main::after, +.gitment-comment-main::after { + margin-top: 1px; + margin-left: 2px; + border-width: 7px; + border-right-color: #fff; +} + +.gitment-comment-header { + margin: 12px 15px; + color: #666; + background-color: #fff; + border-radius: 3px; +} + +.gitment-editor-header { + padding: 0; + margin: 0; + border-bottom: 1px solid #CFD8DC; +} + +a.gitment-comment-name, +a.gitment-comment-name:visited { + font-weight: 600; + color: #666; +} + +.gitment-editor-tabs { + margin-bottom: -1px; + margin-left: -1px; +} + +.gitment-editor-tab { + display: inline-block; + padding: 11px 12px; + font-size: 14px; + line-height: 20px; + color: #666; + text-decoration: none; + background-color: transparent; + border-width: 0 1px; + border-style: solid; + border-color: transparent; + border-radius: 0; + + white-space: nowrap; + cursor: pointer; + user-select: none; + + outline: none; +} + +.gitment-editor-tab.gitment-selected { + color: #333; + background-color: #fff; + border-color: #CFD8DC; +} + +.gitment-editor-login { + float: right; + margin-top: -30px; + margin-right: 15px; +} + +a.gitment-footer-project-link, +a.gitment-footer-project-link:visited, +a.gitment-editor-login-link, +a.gitment-editor-login-link:visited { + color: #2196F3; +} + +a.gitment-editor-logout-link, +a.gitment-editor-logout-link:visited { + color: #666; +} + +a.gitment-editor-logout-link:hover { + color: #2196F3; + text-decoration: none; +} + +.gitment-comment-body { + position: relative; + margin: 12px 15px; + overflow: hidden; + border-radius: 3px; +} + +.gitment-comment-body-folded { + cursor: pointer; +} + +.gitment-comment-body-folded::before { + display: block !important; + content: ""; + position: absolute; + width: 100%; + left: 0; + top: 0; + bottom: 50px; + pointer-events: none; + background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0), rgba(255, 255, 255, .9)); + background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .9)); +} + +.gitment-comment-body-folded::after { + display: block !important; + content: "Click to Expand" !important; + text-align: center; + color: #666; + position: absolute; + width: 100%; + height: 50px; + line-height: 50px; + left: 0; + bottom: 0; + pointer-events: none; + background: rgba(255, 255, 255, .9); +} + +.gitment-editor-body { + margin: 0; +} + +.gitment-comment-body > *:first-child, +.gitment-editor-preview > *:first-child { + margin-top: 0 !important; +} + +.gitment-comment-body > *:last-child, +.gitment-editor-preview > *:last-child { + margin-bottom: 0 !important; +} + +.gitment-editor-body textarea { + display: block; + width: 100%; + min-height: 150px; + max-height: 500px; + padding: 16px; + resize: vertical; + + max-width: 100%; + margin: 0; + font-size: 14px; + line-height: 1.6; + + background-color: #fff; + + color: #333; + vertical-align: middle; + border: none; + border-radius: 0; + outline: none; + box-shadow: none; + + overflow: visible; +} + +.gitment-editor-body textarea:focus { + background-color: #fff; +} + +.gitment-editor-preview { + min-height: 150px; + + padding: 16px; + background-color: transparent; + + width: 100%; + font-size: 14px; + + line-height: 1.5; + word-wrap: break-word; +} + +.gitment-editor-footer { + padding: 0; + margin-top: 10px; +} + +.gitment-editor-footer::after { + display: table; + clear: both; + content: ""; +} + +a.gitment-editor-footer-tip { + display: inline-block; + padding-top: 10px; + font-size: 12px; + color: #666; +} + +a.gitment-editor-footer-tip:hover { + color: #2196F3; + text-decoration: none; +} + +.gitment-comments-pagination { + list-style: none; + text-align: right; + border-radius: 0; + margin: -19px 0 19px 0; +} + +.gitment-comments-page-item { + display: inline-block; + cursor: pointer; + border: 1px solid #CFD8DC; + margin-left: -1px; + padding: .25rem .5rem; +} + +.gitment-comments-page-item:hover { + background-color: #f5f5f5; +} + +.gitment-comments-page-item.gitment-selected { + background-color: #f5f5f5; +} + +.gitment-editor-submit, +.gitment-comments-init-btn { + color: #fff; + background-color: #00BCD4; + + position: relative; + display: inline-block; + padding: 7px 13px; + font-size: 14px; + font-weight: 600; + line-height: 20px; + white-space: nowrap; + vertical-align: middle; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-size: 110% 110%; + border: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.gitment-editor-submit:hover, +.gitment-comments-init-btn:hover { + background-color: #00ACC1; +} + +.gitment-comments-init-btn:disabled, +.gitment-editor-submit:disabled { + color: rgba(255,255,255,0.75); + background-color: #4DD0E1; + box-shadow: none; +} + +.gitment-editor-submit { + float: right; +} + +.gitment-footer-container { + margin-top: 30px; + margin-bottom: 20px; + text-align: right; + font-size: 12px; +} + +/* + * Markdown CSS + * Copied from https://github.com/sindresorhus/github-markdown-css + */ +.gitment-markdown { + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + line-height: 1.5; + color: #333; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-size: 16px; + line-height: 1.5; + word-wrap: break-word; +} + +.gitment-markdown .pl-c { + color: #969896; +} + +.gitment-markdown .pl-c1, +.gitment-markdown .pl-s .pl-v { + color: #0086b3; +} + +.gitment-markdown .pl-e, +.gitment-markdown .pl-en { + color: #795da3; +} + +.gitment-markdown .pl-smi, +.gitment-markdown .pl-s .pl-s1 { + color: #333; +} + +.gitment-markdown .pl-ent { + color: #63a35c; +} + +.gitment-markdown .pl-k { + color: #a71d5d; +} + +.gitment-markdown .pl-s, +.gitment-markdown .pl-pds, +.gitment-markdown .pl-s .pl-pse .pl-s1, +.gitment-markdown .pl-sr, +.gitment-markdown .pl-sr .pl-cce, +.gitment-markdown .pl-sr .pl-sre, +.gitment-markdown .pl-sr .pl-sra { + color: #183691; +} + +.gitment-markdown .pl-v, +.gitment-markdown .pl-smw { + color: #ed6a43; +} + +.gitment-markdown .pl-bu { + color: #b52a1d; +} + +.gitment-markdown .pl-ii { + color: #f8f8f8; + background-color: #b52a1d; +} + +.gitment-markdown .pl-c2 { + color: #f8f8f8; + background-color: #b52a1d; +} + +.gitment-markdown .pl-c2::before { + content: "^M"; +} + +.gitment-markdown .pl-sr .pl-cce { + font-weight: bold; + color: #63a35c; +} + +.gitment-markdown .pl-ml { + color: #693a17; +} + +.gitment-markdown .pl-mh, +.gitment-markdown .pl-mh .pl-en, +.gitment-markdown .pl-ms { + font-weight: bold; + color: #1d3e81; +} + +.gitment-markdown .pl-mq { + color: #008080; +} + +.gitment-markdown .pl-mi { + font-style: italic; + color: #333; +} + +.gitment-markdown .pl-mb { + font-weight: bold; + color: #333; +} + +.gitment-markdown .pl-md { + color: #bd2c00; + background-color: #ffecec; +} + +.gitment-markdown .pl-mi1 { + color: #55a532; + background-color: #eaffea; +} + +.gitment-markdown .pl-mc { + color: #ef9700; + background-color: #ffe3b4; +} + +.gitment-markdown .pl-mi2 { + color: #d8d8d8; + background-color: #808080; +} + +.gitment-markdown .pl-mdr { + font-weight: bold; + color: #795da3; +} + +.gitment-markdown .pl-mo { + color: #1d3e81; +} + +.gitment-markdown .pl-ba { + color: #595e62; +} + +.gitment-markdown .pl-sg { + color: #c0c0c0; +} + +.gitment-markdown .pl-corl { + text-decoration: underline; + color: #183691; +} + +.gitment-markdown .octicon { + display: inline-block; + vertical-align: text-top; + fill: currentColor; +} + +.gitment-markdown a { + background-color: transparent; + -webkit-text-decoration-skip: objects; +} + +.gitment-markdown a:active, +.gitment-markdown a:hover { + outline-width: 0; +} + +.gitment-markdown strong { + font-weight: inherit; +} + +.gitment-markdown strong { + font-weight: bolder; +} + +.gitment-markdown h1 { + font-size: 2em; + margin: 0.67em 0; +} + +.gitment-markdown img { + border-style: none; +} + +.gitment-markdown svg:not(:root) { + overflow: hidden; +} + +.gitment-markdown code, +.gitment-markdown kbd, +.gitment-markdown pre { + font-family: monospace, monospace; + font-size: 1em; +} + +.gitment-markdown hr { + box-sizing: content-box; + height: 0; + overflow: visible; +} + +.gitment-markdown input { + font: inherit; + margin: 0; +} + +.gitment-markdown input { + overflow: visible; +} + +.gitment-markdown [type="checkbox"] { + box-sizing: border-box; + padding: 0; +} + +.gitment-markdown * { + box-sizing: border-box; +} + +.gitment-markdown input { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} + +.gitment-markdown a { + color: #0366d6; + text-decoration: none; +} + +.gitment-markdown a:hover { + text-decoration: underline; +} + +.gitment-markdown strong { + font-weight: 600; +} + +.gitment-markdown hr { + height: 0; + margin: 15px 0; + overflow: hidden; + background: transparent; + border: 0; + border-bottom: 1px solid #dfe2e5; +} + +.gitment-markdown hr::before { + display: table; + content: ""; +} + +.gitment-markdown hr::after { + display: table; + clear: both; + content: ""; +} + +.gitment-markdown table { + border-spacing: 0; + border-collapse: collapse; +} + +.gitment-markdown td, +.gitment-markdown th { + padding: 0; +} + +.gitment-markdown h1, +.gitment-markdown h2, +.gitment-markdown h3, +.gitment-markdown h4, +.gitment-markdown h5, +.gitment-markdown h6 { + margin-top: 0; + margin-bottom: 0; +} + +.gitment-markdown h1 { + font-size: 32px; + font-weight: 600; +} + +.gitment-markdown h2 { + font-size: 24px; + font-weight: 600; +} + +.gitment-markdown h3 { + font-size: 20px; + font-weight: 600; +} + +.gitment-markdown h4 { + font-size: 16px; + font-weight: 600; +} + +.gitment-markdown h5 { + font-size: 14px; + font-weight: 600; +} + +.gitment-markdown h6 { + font-size: 12px; + font-weight: 600; +} + +.gitment-markdown p { + margin-top: 0; + margin-bottom: 10px; +} + +.gitment-markdown blockquote { + margin: 0; +} + +.gitment-markdown ul, +.gitment-markdown ol { + padding-left: 0; + margin-top: 0; + margin-bottom: 0; +} + +.gitment-markdown ol ol, +.gitment-markdown ul ol { + list-style-type: lower-roman; +} + +.gitment-markdown ul ul ol, +.gitment-markdown ul ol ol, +.gitment-markdown ol ul ol, +.gitment-markdown ol ol ol { + list-style-type: lower-alpha; +} + +.gitment-markdown dd { + margin-left: 0; +} + +.gitment-markdown code { + font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 12px; +} + +.gitment-markdown pre { + margin-top: 0; + margin-bottom: 0; + font: 12px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; +} + +.gitment-markdown .octicon { + vertical-align: text-bottom; +} + +.gitment-markdown .pl-0 { + padding-left: 0 !important; +} + +.gitment-markdown .pl-1 { + padding-left: 4px !important; +} + +.gitment-markdown .pl-2 { + padding-left: 8px !important; +} + +.gitment-markdown .pl-3 { + padding-left: 16px !important; +} + +.gitment-markdown .pl-4 { + padding-left: 24px !important; +} + +.gitment-markdown .pl-5 { + padding-left: 32px !important; +} + +.gitment-markdown .pl-6 { + padding-left: 40px !important; +} + +.gitment-markdown::before { + display: table; + content: ""; +} + +.gitment-markdown::after { + display: table; + clear: both; + content: ""; +} + +.gitment-markdown>*:first-child { + margin-top: 0 !important; +} + +.gitment-markdown>*:last-child { + margin-bottom: 0 !important; +} + +.gitment-markdown a:not([href]) { + color: inherit; + text-decoration: none; +} + +.gitment-markdown .anchor { + float: left; + padding-right: 4px; + margin-left: -20px; + line-height: 1; +} + +.gitment-markdown .anchor:focus { + outline: none; +} + +.gitment-markdown p, +.gitment-markdown blockquote, +.gitment-markdown ul, +.gitment-markdown ol, +.gitment-markdown dl, +.gitment-markdown table, +.gitment-markdown pre { + margin-top: 0; + margin-bottom: 16px; +} + +.gitment-markdown hr { + height: 0.25em; + padding: 0; + margin: 24px 0; + background-color: #e1e4e8; + border: 0; +} + +.gitment-markdown blockquote { + padding: 0 1em; + color: #6a737d; + border-left: 0.25em solid #dfe2e5; +} + +.gitment-markdown blockquote>:first-child { + margin-top: 0; +} + +.gitment-markdown blockquote>:last-child { + margin-bottom: 0; +} + +.gitment-markdown kbd { + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #444d56; + vertical-align: middle; + background-color: #fafbfc; + border: solid 1px #c6cbd1; + border-bottom-color: #959da5; + border-radius: 0; + box-shadow: inset 0 -1px 0 #959da5; +} + +.gitment-markdown h1, +.gitment-markdown h2, +.gitment-markdown h3, +.gitment-markdown h4, +.gitment-markdown h5, +.gitment-markdown h6 { + margin-top: 24px; + margin-bottom: 16px; + font-weight: 600; + line-height: 1.25; +} + +.gitment-markdown h1 .octicon-link, +.gitment-markdown h2 .octicon-link, +.gitment-markdown h3 .octicon-link, +.gitment-markdown h4 .octicon-link, +.gitment-markdown h5 .octicon-link, +.gitment-markdown h6 .octicon-link { + color: #1b1f23; + vertical-align: middle; + visibility: hidden; +} + +.gitment-markdown h1:hover .anchor, +.gitment-markdown h2:hover .anchor, +.gitment-markdown h3:hover .anchor, +.gitment-markdown h4:hover .anchor, +.gitment-markdown h5:hover .anchor, +.gitment-markdown h6:hover .anchor { + text-decoration: none; +} + +.gitment-markdown h1:hover .anchor .octicon-link, +.gitment-markdown h2:hover .anchor .octicon-link, +.gitment-markdown h3:hover .anchor .octicon-link, +.gitment-markdown h4:hover .anchor .octicon-link, +.gitment-markdown h5:hover .anchor .octicon-link, +.gitment-markdown h6:hover .anchor .octicon-link { + visibility: visible; +} + +.gitment-markdown h1 { + padding-bottom: 0.3em; + font-size: 2em; + border-bottom: 1px solid #eaecef; +} + +.gitment-markdown h2 { + padding-bottom: 0.3em; + font-size: 1.5em; + border-bottom: 1px solid #eaecef; +} + +.gitment-markdown h3 { + font-size: 1.25em; +} + +.gitment-markdown h4 { + font-size: 1em; +} + +.gitment-markdown h5 { + font-size: 0.875em; +} + +.gitment-markdown h6 { + font-size: 0.85em; + color: #6a737d; +} + +.gitment-markdown ul, +.gitment-markdown ol { + padding-left: 2em; +} + +.gitment-markdown ul ul, +.gitment-markdown ul ol, +.gitment-markdown ol ol, +.gitment-markdown ol ul { + margin-top: 0; + margin-bottom: 0; +} + +.gitment-markdown li>p { + margin-top: 16px; +} + +.gitment-markdown li+li { + margin-top: 0.25em; +} + +.gitment-markdown dl { + padding: 0; +} + +.gitment-markdown dl dt { + padding: 0; + margin-top: 16px; + font-size: 1em; + font-style: italic; + font-weight: 600; +} + +.gitment-markdown dl dd { + padding: 0 16px; + margin-bottom: 16px; +} + +.gitment-markdown table { + display: block; + width: 100%; + overflow: auto; +} + +.gitment-markdown table th { + font-weight: 600; +} + +.gitment-markdown table th, +.gitment-markdown table td { + padding: 6px 13px; + border: 1px solid #dfe2e5; +} + +.gitment-markdown table tr { + background-color: #fff; + border-top: 1px solid #c6cbd1; +} + +.gitment-markdown table tr:nth-child(2n) { + background-color: #f5f5f5; +} + +.gitment-markdown img { + max-width: 100%; + box-sizing: content-box; + background-color: #fff; +} + +.gitment-markdown code { + padding: 0; + padding-top: 0.2em; + padding-bottom: 0.2em; + margin: 0; + font-size: 85%; + background-color: rgba(27,31,35,0.05); + border-radius: 0; +} + +.gitment-markdown code::before, +.gitment-markdown code::after { + letter-spacing: -0.2em; + content: "\00a0"; +} + +.gitment-markdown pre { + word-wrap: normal; +} + +.gitment-markdown pre>code { + padding: 0; + margin: 0; + font-size: 100%; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; +} + +.gitment-markdown .highlight { + margin-bottom: 16px; +} + +.gitment-markdown .highlight pre { + margin-bottom: 0; + word-break: normal; +} + +.gitment-markdown .highlight pre, +.gitment-markdown pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f5f5f5; + border-radius: 0; +} + +.gitment-markdown pre code { + display: inline; + max-width: auto; + padding: 0; + margin: 0; + overflow: visible; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; +} + +.gitment-markdown pre code::before, +.gitment-markdown pre code::after { + content: normal; +} + +.gitment-markdown .full-commit .btn-outline:not(:disabled):hover { + color: #005cc5; + border-color: #005cc5; +} + +.gitment-markdown kbd { + display: inline-block; + padding: 3px 5px; + font: 11px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; + line-height: 10px; + color: #444d56; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #c6cbd1; + border-bottom-color: #959da5; + border-radius: 0; + box-shadow: inset 0 -1px 0 #959da5; +} + +.gitment-markdown :checked+.radio-label { + position: relative; + z-index: 1; + border-color: #0366d6; +} + +.gitment-markdown .task-list-item { + list-style-type: none; +} + +.gitment-markdown .task-list-item+.task-list-item { + margin-top: 3px; +} + +.gitment-markdown .task-list-item input { + margin: 0 0.2em 0.25em -1.6em; + vertical-align: middle; +} + +.gitment-markdown hr { + border-bottom-color: #eee; +} \ No newline at end of file diff --git a/css/images/banner.jpg b/css/images/banner.jpg deleted file mode 100644 index b963e064..00000000 Binary files a/css/images/banner.jpg and /dev/null differ diff --git a/css/style.css b/css/style.css deleted file mode 100644 index 8c8a0a18..00000000 --- a/css/style.css +++ /dev/null @@ -1,1379 +0,0 @@ -body { - width: 100%; -} -body:before, -body:after { - content: ""; - display: table; -} -body:after { - clear: both; -} -html, -body, -div, -span, -applet, -object, -iframe, -h1, -h2, -h3, -h4, -h5, -h6, -p, -blockquote, -pre, -a, -abbr, -acronym, -address, -big, -cite, -code, -del, -dfn, -em, -img, -ins, -kbd, -q, -s, -samp, -small, -strike, -strong, -sub, -sup, -tt, -var, -dl, -dt, -dd, -ol, -ul, -li, -fieldset, -form, -label, -legend, -table, -caption, -tbody, -tfoot, -thead, -tr, -th, -td { - margin: 0; - padding: 0; - border: 0; - outline: 0; - font-weight: inherit; - font-style: inherit; - font-family: inherit; - font-size: 100%; - vertical-align: baseline; -} -body { - line-height: 1; - color: #000; - background: #fff; -} -ol, -ul { - list-style: none; -} -table { - border-collapse: separate; - border-spacing: 0; - vertical-align: middle; -} -caption, -th, -td { - text-align: left; - font-weight: normal; - vertical-align: middle; -} -a img { - border: none; -} -input, -button { - margin: 0; - padding: 0; -} -input::-moz-focus-inner, -button::-moz-focus-inner { - border: 0; - padding: 0; -} -@font-face { - font-family: FontAwesome; - font-style: normal; - font-weight: normal; - src: url("fonts/fontawesome-webfont.eot?v=#4.0.3"); - src: url("fonts/fontawesome-webfont.eot?#iefix&v=#4.0.3") format("embedded-opentype"), url("fonts/fontawesome-webfont.woff?v=#4.0.3") format("woff"), url("fonts/fontawesome-webfont.ttf?v=#4.0.3") format("truetype"), url("fonts/fontawesome-webfont.svg#fontawesomeregular?v=#4.0.3") format("svg"); -} -html, -body, -#container { - height: 100%; -} -body { - background: #eee; - font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; - -webkit-text-size-adjust: 100%; -} -.outer { - max-width: 1220px; - margin: 0 auto; - padding: 0 20px; -} -.outer:before, -.outer:after { - content: ""; - display: table; -} -.outer:after { - clear: both; -} -.inner { - display: inline; - float: left; - width: 98.33333333333333%; - margin: 0 0.833333333333333%; -} -.left, -.alignleft { - float: left; -} -.right, -.alignright { - float: right; -} -.clear { - clear: both; -} -#container { - position: relative; -} -.mobile-nav-on { - overflow: hidden; -} -#wrap { - height: 100%; - width: 100%; - position: absolute; - top: 0; - left: 0; - -webkit-transition: 0.2s ease-out; - -moz-transition: 0.2s ease-out; - -ms-transition: 0.2s ease-out; - transition: 0.2s ease-out; - z-index: 1; - background: #eee; -} -.mobile-nav-on #wrap { - left: 280px; -} -@media screen and (min-width: 768px) { - #main { - display: inline; - float: left; - width: 73.33333333333333%; - margin: 0 0.833333333333333%; - } -} -@media screen and (min-width: 768px) { - #main { - float: right; - } -} -.article-date, -.article-category-link, -.archive-year, -.widget-title { - text-decoration: none; - text-transform: uppercase; - letter-spacing: 2px; - color: #999; - margin-bottom: 1em; - margin-left: 5px; - line-height: 1em; - text-shadow: 0 1px #fff; - font-weight: bold; -} -.article-inner, -.archive-article-inner { - background: #fff; - -webkit-box-shadow: 1px 2px 3px #ddd; - box-shadow: 1px 2px 3px #ddd; - border: 1px solid #ddd; - border-radius: 3px; -} -.article-entry h1, -.widget h1 { - font-size: 2em; -} -.article-entry h2, -.widget h2 { - font-size: 1.5em; -} -.article-entry h3, -.widget h3 { - font-size: 1.3em; -} -.article-entry h4, -.widget h4 { - font-size: 1.2em; -} -.article-entry h5, -.widget h5 { - font-size: 1em; -} -.article-entry h6, -.widget h6 { - font-size: 1em; - color: #999; -} -.article-entry hr, -.widget hr { - border: 1px dashed #ddd; -} -.article-entry strong, -.widget strong { - font-weight: bold; -} -.article-entry em, -.widget em, -.article-entry cite, -.widget cite { - font-style: italic; -} -.article-entry sup, -.widget sup, -.article-entry sub, -.widget sub { - font-size: 0.75em; - line-height: 0; - position: relative; - vertical-align: baseline; -} -.article-entry sup, -.widget sup { - top: -0.5em; -} -.article-entry sub, -.widget sub { - bottom: -0.2em; -} -.article-entry small, -.widget small { - font-size: 0.85em; -} -.article-entry acronym, -.widget acronym, -.article-entry abbr, -.widget abbr { - border-bottom: 1px dotted; -} -.article-entry ul, -.widget ul, -.article-entry ol, -.widget ol, -.article-entry dl, -.widget dl { - margin: 0 20px; - line-height: 1.6em; -} -.article-entry ul ul, -.widget ul ul, -.article-entry ol ul, -.widget ol ul, -.article-entry ul ol, -.widget ul ol, -.article-entry ol ol, -.widget ol ol { - margin-top: 0; - margin-bottom: 0; -} -.article-entry ul, -.widget ul { - list-style: disc; -} -.article-entry ol, -.widget ol { - list-style: decimal; -} -.article-entry dt, -.widget dt { - font-weight: bold; -} -#header { - height: 300px; - position: relative; - border-bottom: 1px solid #ddd; -} -#header:before, -#header:after { - content: ""; - position: absolute; - left: 0; - right: 0; - height: 40px; -} -#header:before { - top: 0; - background: -webkit-linear-gradient(rgba(0,0,0,0.2), transparent); - background: -moz-linear-gradient(rgba(0,0,0,0.2), transparent); - background: -ms-linear-gradient(rgba(0,0,0,0.2), transparent); - background: linear-gradient(rgba(0,0,0,0.2), transparent); -} -#header:after { - bottom: 0; - background: -webkit-linear-gradient(transparent, rgba(0,0,0,0.2)); - background: -moz-linear-gradient(transparent, rgba(0,0,0,0.2)); - background: -ms-linear-gradient(transparent, rgba(0,0,0,0.2)); - background: linear-gradient(transparent, rgba(0,0,0,0.2)); -} -#header-outer { - height: 100%; - position: relative; -} -#header-inner { - position: relative; - overflow: hidden; -} -#banner { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: url("images/banner.jpg") center #000; - -webkit-background-size: cover; - -moz-background-size: cover; - background-size: cover; - z-index: -1; -} -#header-title { - text-align: center; - height: 40px; - position: absolute; - top: 50%; - left: 0; - margin-top: -20px; -} -#logo, -#subtitle { - text-decoration: none; - color: #fff; - font-weight: 300; - text-shadow: 0 1px 4px rgba(0,0,0,0.3); -} -#logo { - font-size: 40px; - line-height: 40px; - letter-spacing: 2px; -} -#subtitle { - font-size: 16px; - line-height: 16px; - letter-spacing: 1px; -} -#subtitle-wrap { - margin-top: 16px; -} -#main-nav { - float: left; - margin-left: -15px; -} -.nav-icon, -.main-nav-link { - float: left; - color: #fff; - opacity: 0.6; - text-decoration: none; - text-shadow: 0 1px rgba(0,0,0,0.2); - -webkit-transition: opacity 0.2s; - -moz-transition: opacity 0.2s; - -ms-transition: opacity 0.2s; - transition: opacity 0.2s; - display: block; - padding: 20px 15px; -} -.nav-icon:hover, -.main-nav-link:hover { - opacity: 1; -} -.nav-icon { - font-family: FontAwesome; - text-align: center; - font-size: 14px; - width: 14px; - height: 14px; - padding: 20px 15px; - position: relative; - cursor: pointer; -} -.main-nav-link { - font-weight: 300; - letter-spacing: 1px; -} -@media screen and (max-width: 479px) { - .main-nav-link { - display: none; - } -} -#main-nav-toggle { - display: none; -} -#main-nav-toggle:before { - content: "\f0c9"; -} -@media screen and (max-width: 479px) { - #main-nav-toggle { - display: block; - } -} -#sub-nav { - float: right; - margin-right: -15px; -} -#nav-rss-link:before { - content: "\f09e"; -} -#nav-search-btn:before { - content: "\f002"; -} -#search-form-wrap { - position: absolute; - top: 15px; - width: 150px; - height: 30px; - right: -150px; - opacity: 0; - -webkit-transition: 0.2s ease-out; - -moz-transition: 0.2s ease-out; - -ms-transition: 0.2s ease-out; - transition: 0.2s ease-out; -} -#search-form-wrap.on { - opacity: 1; - right: 0; -} -@media screen and (max-width: 479px) { - #search-form-wrap { - width: 100%; - right: -100%; - } -} -.search-form { - position: absolute; - top: 0; - left: 0; - right: 0; - background: #fff; - padding: 5px 15px; - border-radius: 15px; - -webkit-box-shadow: 0 0 10px rgba(0,0,0,0.3); - box-shadow: 0 0 10px rgba(0,0,0,0.3); -} -.search-form-input { - border: none; - background: none; - color: #555; - width: 100%; - font: 13px -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; - outline: none; -} -.search-form-input::-webkit-search-results-decoration, -.search-form-input::-webkit-search-cancel-button { - -webkit-appearance: none; -} -.search-form-submit { - position: absolute; - top: 50%; - right: 10px; - margin-top: -7px; - font: 13px FontAwesome; - border: none; - background: none; - color: #bbb; - cursor: pointer; -} -.search-form-submit:hover, -.search-form-submit:focus { - color: #777; -} -.article { - margin: 50px 0; -} -.article-inner { - overflow: hidden; -} -.article-meta:before, -.article-meta:after { - content: ""; - display: table; -} -.article-meta:after { - clear: both; -} -.article-date { - float: left; -} -.article-category { - float: left; - line-height: 1em; - color: #ccc; - text-shadow: 0 1px #fff; - margin-left: 8px; -} -.article-category:before { - content: "\2022"; -} -.article-category-link { - margin: 0 12px 1em; -} -.article-header { - padding: 20px 20px 0; -} -.article-title { - text-decoration: none; - font-size: 2em; - font-weight: bold; - color: #555; - line-height: 1.1em; - -webkit-transition: color 0.2s; - -moz-transition: color 0.2s; - -ms-transition: color 0.2s; - transition: color 0.2s; -} -a.article-title:hover { - color: #258fb8; -} -.article-entry { - color: #555; - padding: 0 20px; -} -.article-entry:before, -.article-entry:after { - content: ""; - display: table; -} -.article-entry:after { - clear: both; -} -.article-entry p, -.article-entry table { - line-height: 1.6em; - margin: 1.6em 0; -} -.article-entry h1, -.article-entry h2, -.article-entry h3, -.article-entry h4, -.article-entry h5, -.article-entry h6 { - font-weight: bold; -} -.article-entry h1, -.article-entry h2, -.article-entry h3, -.article-entry h4, -.article-entry h5, -.article-entry h6 { - line-height: 1.1em; - margin: 1.1em 0; -} -.article-entry a { - color: #258fb8; - text-decoration: none; -} -.article-entry a:hover { - text-decoration: underline; -} -.article-entry ul, -.article-entry ol, -.article-entry dl { - margin-top: 1.6em; - margin-bottom: 1.6em; -} -.article-entry img, -.article-entry video { - max-width: 100%; - height: auto; - display: block; - margin: auto; -} -.article-entry iframe { - border: none; -} -.article-entry table { - width: 100%; - border-collapse: collapse; - border-spacing: 0; -} -.article-entry th { - font-weight: bold; - border-bottom: 3px solid #ddd; - padding-bottom: 0.5em; -} -.article-entry td { - border-bottom: 1px solid #ddd; - padding: 10px 0; -} -.article-entry blockquote { - font-family: Georgia, "Times New Roman", serif; - font-size: 1.4em; - margin: 1.6em 20px; - text-align: center; -} -.article-entry blockquote footer { - font-size: 14px; - margin: 1.6em 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -} -.article-entry blockquote footer cite:before { - content: "—"; - padding: 0 0.5em; -} -.article-entry .pullquote { - text-align: left; - width: 45%; - margin: 0; -} -.article-entry .pullquote.left { - margin-left: 0.5em; - margin-right: 1em; -} -.article-entry .pullquote.right { - margin-right: 0.5em; - margin-left: 1em; -} -.article-entry .caption { - color: #999; - display: block; - font-size: 0.9em; - margin-top: 0.5em; - position: relative; - text-align: center; -} -.article-entry .video-container { - position: relative; - padding-top: 56.25%; - height: 0; - overflow: hidden; -} -.article-entry .video-container iframe, -.article-entry .video-container object, -.article-entry .video-container embed { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - margin-top: 0; -} -.article-more-link a { - display: inline-block; - line-height: 1em; - padding: 6px 15px; - border-radius: 15px; - background: #eee; - color: #999; - text-shadow: 0 1px #fff; - text-decoration: none; -} -.article-more-link a:hover { - background: #258fb8; - color: #fff; - text-decoration: none; - text-shadow: 0 1px #1e7293; -} -.article-footer { - font-size: 0.85em; - line-height: 1.6em; - border-top: 1px solid #ddd; - padding-top: 1.6em; - margin: 0 20px 20px; -} -.article-footer:before, -.article-footer:after { - content: ""; - display: table; -} -.article-footer:after { - clear: both; -} -.article-footer a { - color: #999; - text-decoration: none; -} -.article-footer a:hover { - color: #555; -} -.article-tag-list-item { - float: left; - margin-right: 10px; -} -.article-tag-list-link:before { - content: "#"; -} -.article-comment-link { - float: right; -} -.article-comment-link:before { - content: "\f075"; - font-family: FontAwesome; - padding-right: 8px; -} -.article-share-link { - cursor: pointer; - float: right; - margin-left: 20px; -} -.article-share-link:before { - content: "\f064"; - font-family: FontAwesome; - padding-right: 6px; -} -#article-nav { - position: relative; -} -#article-nav:before, -#article-nav:after { - content: ""; - display: table; -} -#article-nav:after { - clear: both; -} -@media screen and (min-width: 768px) { - #article-nav { - margin: 50px 0; - } - #article-nav:before { - width: 8px; - height: 8px; - position: absolute; - top: 50%; - left: 50%; - margin-top: -4px; - margin-left: -4px; - content: ""; - border-radius: 50%; - background: #ddd; - -webkit-box-shadow: 0 1px 2px #fff; - box-shadow: 0 1px 2px #fff; - } -} -.article-nav-link-wrap { - text-decoration: none; - text-shadow: 0 1px #fff; - color: #999; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - margin-top: 50px; - text-align: center; - display: block; -} -.article-nav-link-wrap:hover { - color: #555; -} -@media screen and (min-width: 768px) { - .article-nav-link-wrap { - width: 50%; - margin-top: 0; - } -} -@media screen and (min-width: 768px) { - #article-nav-newer { - float: left; - text-align: right; - padding-right: 20px; - } -} -@media screen and (min-width: 768px) { - #article-nav-older { - float: right; - text-align: left; - padding-left: 20px; - } -} -.article-nav-caption { - text-transform: uppercase; - letter-spacing: 2px; - color: #ddd; - line-height: 1em; - font-weight: bold; -} -#article-nav-newer .article-nav-caption { - margin-right: -2px; -} -.article-nav-title { - font-size: 0.85em; - line-height: 1.6em; - margin-top: 0.5em; -} -.article-share-box { - position: absolute; - display: none; - background: #fff; - -webkit-box-shadow: 1px 2px 10px rgba(0,0,0,0.2); - box-shadow: 1px 2px 10px rgba(0,0,0,0.2); - border-radius: 3px; - margin-left: -145px; - overflow: hidden; - z-index: 1; -} -.article-share-box.on { - display: block; -} -.article-share-input { - width: 100%; - background: none; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; - padding: 0 15px; - color: #555; - outline: none; - border: 1px solid #ddd; - border-radius: 3px 3px 0 0; - height: 36px; - line-height: 36px; -} -.article-share-links { - background: #eee; -} -.article-share-links:before, -.article-share-links:after { - content: ""; - display: table; -} -.article-share-links:after { - clear: both; -} -.article-share-twitter, -.article-share-facebook, -.article-share-pinterest, -.article-share-google { - width: 50px; - height: 36px; - display: block; - float: left; - position: relative; - color: #999; - text-shadow: 0 1px #fff; -} -.article-share-twitter:before, -.article-share-facebook:before, -.article-share-pinterest:before, -.article-share-google:before { - font-size: 20px; - font-family: FontAwesome; - width: 20px; - height: 20px; - position: absolute; - top: 50%; - left: 50%; - margin-top: -10px; - margin-left: -10px; - text-align: center; -} -.article-share-twitter:hover, -.article-share-facebook:hover, -.article-share-pinterest:hover, -.article-share-google:hover { - color: #fff; -} -.article-share-twitter:before { - content: "\f099"; -} -.article-share-twitter:hover { - background: #00aced; - text-shadow: 0 1px #008abe; -} -.article-share-facebook:before { - content: "\f09a"; -} -.article-share-facebook:hover { - background: #3b5998; - text-shadow: 0 1px #2f477a; -} -.article-share-pinterest:before { - content: "\f0d2"; -} -.article-share-pinterest:hover { - background: #cb2027; - text-shadow: 0 1px #a21a1f; -} -.article-share-google:before { - content: "\f0d5"; -} -.article-share-google:hover { - background: #dd4b39; - text-shadow: 0 1px #be3221; -} -.article-gallery { - background: #000; - position: relative; -} -.article-gallery-photos { - position: relative; - overflow: hidden; -} -.article-gallery-img { - display: none; - max-width: 100%; -} -.article-gallery-img:first-child { - display: block; -} -.article-gallery-img.loaded { - position: absolute; - display: block; -} -.article-gallery-img img { - display: block; - max-width: 100%; - margin: 0 auto; -} -#comments { - background: #fff; - -webkit-box-shadow: 1px 2px 3px #ddd; - box-shadow: 1px 2px 3px #ddd; - padding: 20px; - border: 1px solid #ddd; - border-radius: 3px; - margin: 50px 0; -} -#comments a { - color: #258fb8; -} -.archives-wrap { - margin: 50px 0; -} -.archives:before, -.archives:after { - content: ""; - display: table; -} -.archives:after { - clear: both; -} -.archive-year-wrap { - margin-bottom: 1em; -} -.archives { - -webkit-column-gap: 10px; - -moz-column-gap: 10px; - column-gap: 10px; -} -@media screen and (min-width: 480px) and (max-width: 767px) { - .archives { - -webkit-column-count: 2; - -moz-column-count: 2; - column-count: 2; - } -} -@media screen and (min-width: 768px) { - .archives { - -webkit-column-count: 3; - -moz-column-count: 3; - column-count: 3; - } -} -.archive-article { - -webkit-column-break-inside: avoid; - page-break-inside: avoid; - overflow: hidden; - break-inside: avoid-column; -} -.archive-article-inner { - padding: 10px; - margin-bottom: 15px; -} -.archive-article-title { - text-decoration: none; - font-weight: bold; - color: #555; - -webkit-transition: color 0.2s; - -moz-transition: color 0.2s; - -ms-transition: color 0.2s; - transition: color 0.2s; - line-height: 1.6em; -} -.archive-article-title:hover { - color: #258fb8; -} -.archive-article-footer { - margin-top: 1em; -} -.archive-article-date { - color: #999; - text-decoration: none; - font-size: 0.85em; - line-height: 1em; - margin-bottom: 0.5em; - display: block; -} -#page-nav { - margin: 50px auto; - background: #fff; - -webkit-box-shadow: 1px 2px 3px #ddd; - box-shadow: 1px 2px 3px #ddd; - border: 1px solid #ddd; - border-radius: 3px; - text-align: center; - color: #999; - overflow: hidden; -} -#page-nav:before, -#page-nav:after { - content: ""; - display: table; -} -#page-nav:after { - clear: both; -} -#page-nav a, -#page-nav span { - padding: 10px 20px; - line-height: 1; - height: 2ex; -} -#page-nav a { - color: #999; - text-decoration: none; -} -#page-nav a:hover { - background: #999; - color: #fff; -} -#page-nav .prev { - float: left; -} -#page-nav .next { - float: right; -} -#page-nav .page-number { - display: inline-block; -} -@media screen and (max-width: 479px) { - #page-nav .page-number { - display: none; - } -} -#page-nav .current { - color: #555; - font-weight: bold; -} -#page-nav .space { - color: #ddd; -} -#footer { - background: #262a30; - padding: 50px 0; - border-top: 1px solid #ddd; - color: #999; -} -#footer a { - color: #258fb8; - text-decoration: none; -} -#footer a:hover { - text-decoration: underline; -} -#footer-info { - line-height: 1.6em; - font-size: 0.85em; -} -.article-entry pre, -.article-entry .highlight { - background: #2d2d2d; - margin: 0 -20px; - padding: 15px 20px; - border-style: solid; - border-color: #ddd; - border-width: 1px 0; - overflow: auto; - color: #ccc; - line-height: 22.400000000000002px; -} -.article-entry .highlight .gutter pre, -.article-entry .gist .gist-file .gist-data .line-numbers { - color: #666; - font-size: 0.85em; -} -.article-entry pre, -.article-entry code { - font-family: "Source Code Pro", Consolas, Monaco, Menlo, Consolas, monospace; -} -.article-entry code { - background: #eee; - text-shadow: 0 1px #fff; - padding: 0 0.3em; -} -.article-entry pre code { - background: none; - text-shadow: none; - padding: 0; -} -.article-entry .highlight pre { - border: none; - margin: 0; - padding: 0; -} -.article-entry .highlight table { - margin: 0; - width: auto; -} -.article-entry .highlight td { - border: none; - padding: 0; -} -.article-entry .highlight figcaption { - font-size: 0.85em; - color: #999; - line-height: 1em; - margin-bottom: 1em; -} -.article-entry .highlight figcaption:before, -.article-entry .highlight figcaption:after { - content: ""; - display: table; -} -.article-entry .highlight figcaption:after { - clear: both; -} -.article-entry .highlight figcaption a { - float: right; -} -.article-entry .highlight .gutter pre { - text-align: right; - padding-right: 20px; -} -.article-entry .highlight .line { - height: 22.400000000000002px; -} -.article-entry .highlight .line.marked { - background: #515151; -} -.article-entry .gist { - margin: 0 -20px; - border-style: solid; - border-color: #ddd; - border-width: 1px 0; - background: #2d2d2d; - padding: 15px 20px 15px 0; -} -.article-entry .gist .gist-file { - border: none; - font-family: "Source Code Pro", Consolas, Monaco, Menlo, Consolas, monospace; - margin: 0; -} -.article-entry .gist .gist-file .gist-data { - background: none; - border: none; -} -.article-entry .gist .gist-file .gist-data .line-numbers { - background: none; - border: none; - padding: 0 20px 0 0; -} -.article-entry .gist .gist-file .gist-data .line-data { - padding: 0 !important; -} -.article-entry .gist .gist-file .highlight { - margin: 0; - padding: 0; - border: none; -} -.article-entry .gist .gist-file .gist-meta { - background: #2d2d2d; - color: #999; - font: 0.85em -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; - text-shadow: 0 0; - padding: 0; - margin-top: 1em; - margin-left: 20px; -} -.article-entry .gist .gist-file .gist-meta a { - color: #258fb8; - font-weight: normal; -} -.article-entry .gist .gist-file .gist-meta a:hover { - text-decoration: underline; -} -pre .comment, -pre .title { - color: #999; -} -pre .variable, -pre .attribute, -pre .tag, -pre .regexp, -pre .ruby .constant, -pre .xml .tag .title, -pre .xml .pi, -pre .xml .doctype, -pre .html .doctype, -pre .css .id, -pre .css .class, -pre .css .pseudo { - color: #f2777a; -} -pre .number, -pre .preprocessor, -pre .built_in, -pre .literal, -pre .params, -pre .constant { - color: #f99157; -} -pre .class, -pre .ruby .class .title, -pre .css .rules .attribute { - color: #9c9; -} -pre .string, -pre .value, -pre .inheritance, -pre .header, -pre .ruby .symbol, -pre .xml .cdata { - color: #9c9; -} -pre .css .hexcolor { - color: #6cc; -} -pre .function, -pre .python .decorator, -pre .python .title, -pre .ruby .function .title, -pre .ruby .title .keyword, -pre .perl .sub, -pre .javascript .title, -pre .coffeescript .title { - color: #69c; -} -pre .keyword, -pre .javascript .function { - color: #c9c; -} -@media screen and (max-width: 479px) { - #mobile-nav { - position: absolute; - top: 0; - left: 0; - width: 280px; - height: 100%; - background: #191919; - border-right: 1px solid #fff; - } -} -@media screen and (max-width: 479px) { - .mobile-nav-link { - display: block; - color: #999; - text-decoration: none; - padding: 15px 20px; - font-weight: bold; - } - .mobile-nav-link:hover { - color: #fff; - } -} -@media screen and (min-width: 768px) { - #sidebar { - display: inline; - float: left; - width: 23.333333333333332%; - margin: 0 0.833333333333333%; - } -} -.widget-wrap { - margin: 50px 0; -} -.widget { - color: #777; - text-shadow: 0 1px #fff; - background: #ddd; - -webkit-box-shadow: 0 -1px 4px #ccc inset; - box-shadow: 0 -1px 4px #ccc inset; - border: 1px solid #ccc; - padding: 15px; - border-radius: 3px; -} -.widget a { - color: #258fb8; - text-decoration: none; -} -.widget a:hover { - text-decoration: underline; -} -.widget ul ul, -.widget ol ul, -.widget dl ul, -.widget ul ol, -.widget ol ol, -.widget dl ol, -.widget ul dl, -.widget ol dl, -.widget dl dl { - margin-left: 15px; - list-style: disc; -} -.widget { - line-height: 1.6em; - word-wrap: break-word; - font-size: 0.9em; -} -.widget ul, -.widget ol { - list-style: none; - margin: 0; -} -.widget ul ul, -.widget ol ul, -.widget ul ol, -.widget ol ol { - margin: 0 20px; -} -.widget ul ul, -.widget ol ul { - list-style: disc; -} -.widget ul ol, -.widget ol ol { - list-style: decimal; -} -.category-list-count, -.tag-list-count, -.archive-list-count { - padding-left: 5px; - color: #999; - font-size: 0.85em; -} -.category-list-count:before, -.tag-list-count:before, -.archive-list-count:before { - content: "("; -} -.category-list-count:after, -.tag-list-count:after, -.archive-list-count:after { - content: ")"; -} -.tagcloud a { - margin-right: 5px; - display: inline-block; -} diff --git a/fancybox/blank.gif b/fancybox/blank.gif deleted file mode 100644 index 35d42e80..00000000 Binary files a/fancybox/blank.gif and /dev/null differ diff --git a/fancybox/fancybox_loading.gif b/fancybox/fancybox_loading.gif deleted file mode 100644 index a03a40c0..00000000 Binary files a/fancybox/fancybox_loading.gif and /dev/null differ diff --git a/fancybox/fancybox_loading@2x.gif b/fancybox/fancybox_loading@2x.gif deleted file mode 100644 index 9205aeb0..00000000 Binary files a/fancybox/fancybox_loading@2x.gif and /dev/null differ diff --git a/fancybox/fancybox_overlay.png b/fancybox/fancybox_overlay.png deleted file mode 100644 index a4391396..00000000 Binary files a/fancybox/fancybox_overlay.png and /dev/null differ diff --git a/fancybox/fancybox_sprite.png b/fancybox/fancybox_sprite.png deleted file mode 100644 index fd8d5ca5..00000000 Binary files a/fancybox/fancybox_sprite.png and /dev/null differ diff --git a/fancybox/fancybox_sprite@2x.png b/fancybox/fancybox_sprite@2x.png deleted file mode 100644 index d0e4779f..00000000 Binary files a/fancybox/fancybox_sprite@2x.png and /dev/null differ diff --git a/fancybox/helpers/fancybox_buttons.png b/fancybox/helpers/fancybox_buttons.png deleted file mode 100644 index 07872072..00000000 Binary files a/fancybox/helpers/fancybox_buttons.png and /dev/null differ diff --git a/fancybox/helpers/jquery.fancybox-buttons.css b/fancybox/helpers/jquery.fancybox-buttons.css deleted file mode 100644 index a26273af..00000000 --- a/fancybox/helpers/jquery.fancybox-buttons.css +++ /dev/null @@ -1,97 +0,0 @@ -#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/fancybox/helpers/jquery.fancybox-buttons.js b/fancybox/helpers/jquery.fancybox-buttons.js deleted file mode 100644 index 352bb5f0..00000000 --- a/fancybox/helpers/jquery.fancybox-buttons.js +++ /dev/null @@ -1,122 +0,0 @@ - /*! - * 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/fancybox/helpers/jquery.fancybox-media.js b/fancybox/helpers/jquery.fancybox-media.js deleted file mode 100644 index 62737a51..00000000 --- a/fancybox/helpers/jquery.fancybox-media.js +++ /dev/null @@ -1,199 +0,0 @@ -/*! - * 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/fancybox/helpers/jquery.fancybox-thumbs.css b/fancybox/helpers/jquery.fancybox-thumbs.css deleted file mode 100644 index 63d29436..00000000 --- a/fancybox/helpers/jquery.fancybox-thumbs.css +++ /dev/null @@ -1,55 +0,0 @@ -#fancybox-thumbs { - position: fixed; - left: 0; - width: 100%; - overflow: hidden; - z-index: 8050; -} - -#fancybox-thumbs.bottom { - bottom: 2px; -} - -#fancybox-thumbs.top { - top: 2px; -} - -#fancybox-thumbs ul { - position: relative; - list-style: none; - margin: 0; - padding: 0; -} - -#fancybox-thumbs ul li { - float: left; - padding: 1px; - opacity: 0.5; -} - -#fancybox-thumbs ul li.active { - opacity: 0.75; - padding: 0; - border: 1px solid #fff; -} - -#fancybox-thumbs ul li:hover { - opacity: 1; -} - -#fancybox-thumbs ul li a { - display: block; - position: relative; - overflow: hidden; - border: 1px solid #222; - background: #111; - outline: none; -} - -#fancybox-thumbs ul li img { - display: block; - position: relative; - border: 0; - padding: 0; - max-width: none; -} \ No newline at end of file diff --git a/fancybox/helpers/jquery.fancybox-thumbs.js b/fancybox/helpers/jquery.fancybox-thumbs.js deleted file mode 100644 index 58c97194..00000000 --- a/fancybox/helpers/jquery.fancybox-thumbs.js +++ /dev/null @@ -1,165 +0,0 @@ - /*! - * Thumbnail helper for fancyBox - * version: 1.0.7 (Mon, 01 Oct 2012) - * @requires fancyBox v2.0 or later - * - * Usage: - * $(".fancybox").fancybox({ - * helpers : { - * thumbs: { - * width : 50, - * height : 50 - * } - * } - * }); - * - */ -;(function ($) { - //Shortcut for fancyBox object - var F = $.fancybox; - - //Add helper object - F.helpers.thumbs = { - defaults : { - width : 50, // thumbnail width - height : 50, // thumbnail height - position : 'bottom', // 'top' or 'bottom' - source : function ( item ) { // function to obtain the URL of the thumbnail image - var href; - - if (item.element) { - href = $(item.element).find('img').attr('src'); - } - - if (!href && item.type === 'image' && item.href) { - href = item.href; - } - - return href; - } - }, - - wrap : null, - list : null, - width : 0, - - init: function (opts, obj) { - var that = this, - list, - thumbWidth = opts.width, - thumbHeight = opts.height, - thumbSource = opts.source; - - //Build list structure - list = ''; - - for (var n = 0; n < obj.group.length; n++) { - list += '
      • '; - } - - this.wrap = $('
        ').addClass(opts.position).appendTo('body'); - this.list = $('').appendTo(this.wrap); - - //Load each thumbnail - $.each(obj.group, function (i) { - var el = obj.group[ i ], - href = thumbSource( el ); - - 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) - .attr('title', el.title); - }); - - //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/fancybox/jquery.fancybox.css b/fancybox/jquery.fancybox.css deleted file mode 100644 index c75d0513..00000000 --- a/fancybox/jquery.fancybox.css +++ /dev/null @@ -1,273 +0,0 @@ -/*! 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; - max-width: 99999px; - max-height: 99999px; - overflow: visible !important; -} - -/* Overlay helper */ - -.fancybox-lock { - overflow: visible !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/fancybox/jquery.fancybox.js b/fancybox/jquery.fancybox.js deleted file mode 100644 index 7a0f8acb..00000000 --- a/fancybox/jquery.fancybox.js +++ /dev/null @@ -1,2017 +0,0 @@ -/*! - * 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 : $('
        ').text( element.data('fancybox-title') || element.attr('title') ).html(), - 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 (!coming) { - return; - } - - 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.originalEvent && e.originalEvent.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 - }); - } - - F.trigger('onLoading'); - }, - - getViewport: function () { - var locked = (F.current && F.current.locked) || false, - rez = { - x: W.scrollLeft(), - y: W.scrollTop() - }; - - if (locked && locked.length) { - 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) { - 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\}/g, 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').hide().show(0); - - 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(true); - } - }, - - _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) { - var parent; - - opts = $.extend({}, this.defaults, opts); - - if (this.overlay) { - this.close(); - } - - parent = F.coming ? F.coming.parent : opts.parent; - - this.overlay = $('
        ').appendTo( parent && parent.lenth ? parent : 'body' ); - 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() { - W.unbind('resize.overlay'); - - if (this.el.hasClass('fancybox-lock')) { - $('.fancybox-margin').removeClass('fancybox-margin'); - - this.el.removeClass('fancybox-lock'); - - W.scrollTop( this.scrollV ).scrollLeft( this.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) { - obj.locked = this.overlay.append( obj.wrap ); - obj.fixed = false; - } - - if (opts.showEarly === true) { - this.beforeShow.apply(this, arguments); - } - }, - - beforeShow : function(opts, obj) { - if (obj.locked && !this.el.hasClass('fancybox-lock')) { - if (this.fixPosition !== false) { - $('*').filter(function(){ - return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") ); - }).addClass('fancybox-margin'); - } - - this.el.addClass('fancybox-margin'); - - this.scrollV = W.scrollTop(); - this.scrollH = W.scrollLeft(); - - this.el.addClass('fancybox-lock'); - - W.scrollTop( this.scrollV ).scrollLeft( this.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.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/fancybox/jquery.fancybox.pack.js b/fancybox/jquery.fancybox.pack.js deleted file mode 100644 index 2db12808..00000000 --- a/fancybox/jquery.fancybox.pack.js +++ /dev/null @@ -1,46 +0,0 @@ -/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ -(function(s,H,f,w){var K=f("html"),q=f(s),p=f(H),b=f.fancybox=function(){b.open.apply(this,arguments)},J=navigator.userAgent.match(/msie/i),C=null,t=H.createTouch!==w,u=function(a){return a&&a.hasOwnProperty&&a instanceof f},r=function(a){return a&&"string"===f.type(a)},F=function(a){return r(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=u(a)?f(a).get():[a]),f.each(a,function(e,c){var l={},g,h,k,n,m;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),u(c)?(l={href:c.data("fancybox-href")||c.attr("href"),title:f("
        ").text(c.data("fancybox-title")||c.attr("title")).html(),isDom:!0,element:c}, -f.metadata&&f.extend(!0,l,c.metadata())):l=c);g=d.href||l.href||(r(c)?c:null);h=d.title!==w?d.title:l.title||"";n=(k=d.content||l.content)?"html":d.type||l.type;!n&&l.isDom&&(n=c.data("fancybox-type"),n||(n=(n=c.prop("class").match(/fancybox\.(\w+)/))?n[1]:null));r(g)&&(n||(b.isImage(g)?n="image":b.isSWF(g)?n="swf":"#"===g.charAt(0)?n="inline":r(c)&&(n="html",k=c)),"ajax"===n&&(m=g.split(/\s+/,2),g=m.shift(),m=m.shift()));k||("inline"===n?g?k=f(r(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):l.isDom&&(k=c): -"html"===n?k=g:n||g||!l.isDom||(n="inline",k=c));f.extend(l,{href:g,type:n,content:k,title:h,selector:m});a[e]=l}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==w&&(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(),a&&(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?(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]()):(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut())))},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")};!0===a||!b.player.isActive&&!1!==a?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]!==w&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,l;c&&(l=b._getPosition(d),a&&"scroll"===a.type?(delete l.position,c.stop(!0,!0).animate(l,200)):(c.css(l),e.pos=f.extend({},e.dim,l)))}, -update:function(a){var d=a&&a.originalEvent&&a.originalEvent.type,e=!d||"orientationchange"===d;e&&(clearTimeout(C),C=null);b.isOpen&&!C&&(C=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"),C=null)},e&&!t?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,t&&(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){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}));b.trigger("onLoading")},getViewport:function(){var a=b.current&& -b.current.locked||!1,d={x:q.scrollLeft(),y:q.scrollTop()};a&&a.length?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=t&&s.innerWidth?s.innerWidth:q.width(),d.h=t&&s.innerHeight?s.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&u(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(t?"":" 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,l=e.target||e.srcElement;if(27===c&&b.coming)return!1;e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||l&&(l.type||f(l).is("[contenteditable]"))||f.each(d,function(d,l){if(1h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();0!==c&&!k&&1g||0>l)&&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 r(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return r(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=m(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&&t&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(t?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady"); -if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width= -this.width/b.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",t?"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);t||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,l,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;l=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):u(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,g);break;case "swf":e='',h="",f.each(a.swf,function(a,b){e+='';h+=" "+a+'="'+b+'"'}),e+='"}u(e)&&e.parent().is(a.inner)||a.inner.append(e);b.trigger("beforeShow"); -a.inner.css("overflow","yes"===l?"scroll":"no"===l?"hidden":l);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(!b.isOpened)f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();else if(d.prevMethod)b.transitions[d.prevMethod]();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,l=b.skin,g=b.inner,h=b.current,c=h.width,k=h.height,n=h.minWidth,v=h.minHeight,p=h.maxWidth, -q=h.maxHeight,t=h.scrolling,r=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,z=m(y[1]+y[3]),s=m(y[0]+y[2]),w,A,u,D,B,G,C,E,I;e.add(l).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=m(l.outerWidth(!0)-l.width());w=m(l.outerHeight(!0)-l.height());A=z+y;u=s+w;D=F(c)?(a.w-A)*m(c)/100:c;B=F(k)?(a.h-u)*m(k)/100:k;if("iframe"===h.type){if(I=h.content,h.autoHeight&&1===I.data("ready"))try{I[0].contentWindow.document.location&&(g.width(D).height(9999),G=I.contents().find("body"),r&&G.css("overflow-x", -"hidden"),B=G.outerHeight(!0))}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=m(D);k=m(B);E=D/B;n=m(F(n)?m(n,"w")-A:n);p=m(F(p)?m(p,"w")-A:p);v=m(F(v)?m(v,"h")-u:v);q=m(F(q)?m(q,"h")-u:q);G=p;C=q;h.fitToView&&(p=Math.min(a.w-A,p),q=Math.min(a.h-u,q));A=a.w-z;s=a.h-s;h.aspectRatio?(c>p&&(c=p,k=m(c/E)),k>q&&(k=q,c=m(k*E)),cA||z>s)&&c>n&&k>v&&!(19p&&(c=p,k=m(c/E)),g.width(c).height(k),e.width(c+y),a=e.width(),z=e.height();else c=Math.max(n,Math.min(c,c-(a-A))),k=Math.max(v,Math.min(k,k-(z-s)));r&&"auto"===t&&kA||z>s)&&c>n&&k>v;c=h.aspectRatio?cv&&k
        ').appendTo(d&&d.lenth?d:"body");this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay", -function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){q.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),this.el.removeClass("fancybox-lock"),q.scrollTop(this.scrollV).scrollLeft(this.scrollH));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%"); -J?(b=Math.max(H.documentElement.offsetWidth,H.body.offsetWidth),p.width()>b&&(a=p.width())):p.width()>q.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&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&!this.el.hasClass("fancybox-lock")&&(!1!==this.fixPosition&&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"),this.scrollV=q.scrollTop(),this.scrollH=q.scrollLeft(),this.el.addClass("fancybox-lock"),q.scrollTop(this.scrollV).scrollLeft(this.scrollH));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(r(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"),J&&d.width(d.width()),d.wrapInner(''),b.current.margin[2]+=Math.abs(m(d.css("margin-bottom")))}d["top"===a.position?"prependTo": -"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",l=function(g){var h=f(this).blur(),k=d,l,m;g.ctrlKey||g.altKey||g.shiftKey||g.metaKey||h.is(".fancybox-wrap")||(l=a.groupAttr||"data-fancybox-group",m=h.attr(l),m||(l="rel",m=h.get(0)[l]),m&&""!==m&&"nofollow"!==m&&(h=c.length?f(c):e,h=h.filter("["+l+'="'+m+'"]'),k=h.index(this)),a.index=k,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;c&&!1!==a.live?p.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')", -"click.fb-start",l):e.unbind("click.fb-start").bind("click.fb-start",l);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===w&&(f.scrollbarWidth=function(){var a=f('
        ').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});f.support.fixedPosition===w&&(f.support.fixedPosition=function(){var a=f('
        ').appendTo("body"), -b=20===a[0].offsetTop||15===a[0].offsetTop;a.remove();return b}());f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(s).width();K.addClass("fancybox-lock-test");d=f(s).width();K.removeClass("fancybox-lock-test");f("").appendTo("head")})})(window,document,jQuery); \ No newline at end of file diff --git a/index.html b/index.html index 87b3bd74..f6c99d44 100644 --- a/index.html +++ b/index.html @@ -1,292 +1,218 @@ - + - - + + + + + + + - - uWeb - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - + -
        -
        - -
        -
        - -
        - -
        - - -
        - - -

        - 浏览器多搜索引擎一键直达 -

        - +
        - - -
        - -

        使用Android端uweb浏览器

        -

        推荐引擎(将下面文本添加到/sdcard/uweb/searchurl.txt中):
        化学品:http://www.basechem.org/search?q=
        大百科全书:http://h.bkzx.cn/search?sublibId=2&query=
        柯林斯双解:http://www.iciba.com/
        柯林斯汉英大词典:https://www.hjdict.com/w/
        剑桥双解:https://dictionary.cambridge.org/dictionary/english-chinese-simplified/
        现代日汉双解:https://dict.hjenglish.com/jp/jc/
        wolfram:https://www.wolframalpha.com/input/?i=
        duck:https://duckduckgo.com/?q=
        wiki:https://en.wikipedia.org/wiki/
        git:https://github.com/search?type=Repositories&q=
        man:http://man.cx/
        code:http://searchcode.com/?q=
        牛津搭配:http://www.freecollocation.com/search?word=
        chem:https://www.ncbi.nlm.nih.gov/pccompound?term=
        googledict:http://googledictionary.freecollocation.com/meaning?word=

        -

        其中中国大百科全书注册登录后才可免费查阅。更多引擎可参看:
        https://www.pdawiki.com/forum/thread-28557-1-1.html?x=4030(需免费注册才可查看,正与站长协商开放权限)
        https://github.com/Dictionaryphile/All_Dictionaries

        - +
        +
        +
        + + + search +
        +
        + +
        - -
        - -
        - - - -
        - -
        - - -
        - - -

        - 利用浏览器地址栏对函数作图 -

        - - -
        - -
        - -

        使用Android端uweb浏览器
        Termux提供了方便的软件包管理系统,缺省的uWeb地址栏功能配置需用到作图软件gnuplot。

        -

          -

        • 安装uweb定制Termux应用(长按[PC]选择”Symbian”再刷新网页可直接下载):

          https://pan.baidu.com/s/1WwQ9yhPlu95sFtttlzDXFA
        • -

        • Termux下运行以下命令:

          apt update

          apt upgrade

          apt install gnuplot


        • Termux软件包推荐::

          -

            -

          • gnuplot: 作图工具。


          • 配置文件/sdcard/uweb/cmds.txt如下:

            命令:text/plain:%s

            函数作图:image/svg+xml:gnuplot -e ‘set term svg;set output; plot %s’

            函数作图(3d):image/svg+xml:gnuplot -e ‘set term svg;set output; splot %s’

            超级计算器:text/html:echo “%s”|bc -l -q

            -

            长按uweb浏览器底部工具条刷新按钮弹出地址栏功能选择,选择“函数作图”,地址栏内输入函数如sin(x)**5就可显示函数图案。

            - - +
            +
            + +
            - -
            - - - - - -
            - -
            - - -
            +
            +
            -
            - -

            使用Android端uweb浏览器
            Gnu bc计算器支持无限精度,可轻易扩展函数库、常数库。

            -

              -

            • 安装uweb定制Termux应用(长按[PC]选择”Symbian”再刷新网页可直接下载):

              https://pan.baidu.com/s/1WwQ9yhPlu95sFtttlzDXFA
            • -

            • Termux下运行以下命令:

              apt update

              apt upgrade

              apt install bc


            • Termux软件包推荐::

              -

                -

              • bc: 计算器。


              • 配置文件/sdcard/uweb/cmds.txt如下:

                计算器:text/html:echo “%s”|bc -l -q



                更多bc扩展库:(扩展库可下载至/sdcard/uweb目录下)

                https://github.com/susca/bc-extensions

                phodd.net/gnu-bc

                www.numbertheory.org/gnubc/gnubc.html



                使用扩展库以后cmds.txt配置如下:

                计算器:text/html:echo “%s”|bc -l -q extensions.bc scientific_constants.bc

                全能计算器:text/html:echo “%s”|bc -l -q *.bc


                - - +
                +
                2018-12-09
                +
                - -
                - -
                - - - -
                - -
                - - -
                - - -

                - 利用超级hosts文件加速访问国外网站 -

                - - -
                - -
                - -

                不少国外网站本身虽可访问,但由于网站需要下载google,
                facebook等屏蔽网址的资源而导致无法访问。超级hosts文件可屏蔽文件中域名的一切子域名、孙域名、……,从而主动屏蔽这些网址,最终允许浏览器快速访问合法网站。

                -

                使用Android端uweb浏览器
                /sdcard/uweb/hosts内容如下:

                googleadservices.com

                googlesyndication.com

                adsense.com

                google.com

                google-analytics.com

                googletagservices.com

                twitter.com

                facebook.com

                fbcdn.net

                - - +
                +
                2018-12-09
                +
                - -
                - -
                - - - - - - - - - -
                -
                - -
                - -
                +
                + + +
                +
                  + + + + + + + + + + + +
                + +

                + + PV + + + UV + + Created By Hexo Theme AirCloud

                -
                - -
                + + + + - \ No newline at end of file + + + + + + + + + + diff --git a/js/gitment.js b/js/gitment.js new file mode 100644 index 00000000..ef8778ba --- /dev/null +++ b/js/gitment.js @@ -0,0 +1,3757 @@ +/** + * Created by Xiaotao.Nie on 11/04/2018. + * All right reserved + * IF you have any question please email onlythen@yeah.net + */ + +var Gitment = + /******/ (function(modules) { // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; + /******/ + /******/ // The require function + /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if(installedModules[moduleId]) + /******/ return installedModules[moduleId].exports; + /******/ + /******/ // Create a new module (and put it into the cache) + /******/ var module = installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ }; + /******/ + /******/ // Execute the module function + /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + /******/ + /******/ // Flag the module as loaded + /******/ module.l = true; + /******/ + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } + /******/ + /******/ + /******/ // expose the modules object (__webpack_modules__) + /******/ __webpack_require__.m = modules; + /******/ + /******/ // expose the module cache + /******/ __webpack_require__.c = installedModules; + /******/ + /******/ // identity function for calling harmony imports with the correct context + /******/ __webpack_require__.i = function(value) { return value; }; + /******/ + /******/ // define getter function for harmony exports + /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if(!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ }); + /******/ } + /******/ }; + /******/ + /******/ // getDefaultExport function for compatibility with non-harmony modules + /******/ __webpack_require__.n = function(module) { + /******/ var getter = module && module.__esModule ? + /******/ function getDefault() { return module['default']; } : + /******/ function getModuleExports() { return module; }; + /******/ __webpack_require__.d(getter, 'a', getter); + /******/ return getter; + /******/ }; + /******/ + /******/ // Object.prototype.hasOwnProperty.call + /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; + /******/ + /******/ // __webpack_public_path__ + /******/ __webpack_require__.p = ""; + /******/ + /******/ // Load entry module and return exports + /******/ return __webpack_require__(__webpack_require__.s = 5); + /******/ }) +/************************************************************************/ +/******/ ([ + /* 0 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var LS_ACCESS_TOKEN_KEY = exports.LS_ACCESS_TOKEN_KEY = 'gitment-comments-token'; + var LS_USER_KEY = exports.LS_USER_KEY = 'gitment-user-info'; + + var NOT_INITIALIZED_ERROR = exports.NOT_INITIALIZED_ERROR = new Error('Comments Not Initialized'); + + /***/ }), + /* 1 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + /* WEBPACK VAR INJECTION */(function(global) { + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var __extends = undefined && undefined.__extends || function () { + var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) { + if (b.hasOwnProperty(p)) d[p] = b[p]; + } + }; + return function (d, b) { + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports, "__esModule", { value: true }); + registerGlobals(); + exports.extras = { + allowStateChanges: allowStateChanges, + deepEqual: deepEqual, + getAtom: getAtom, + getDebugName: getDebugName, + getDependencyTree: getDependencyTree, + getAdministration: getAdministration, + getGlobalState: getGlobalState, + getObserverTree: getObserverTree, + isComputingDerivation: isComputingDerivation, + isSpyEnabled: isSpyEnabled, + onReactionError: onReactionError, + resetGlobalState: resetGlobalState, + shareGlobalState: shareGlobalState, + spyReport: spyReport, + spyReportEnd: spyReportEnd, + spyReportStart: spyReportStart, + setReactionScheduler: setReactionScheduler + }; + if ((typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "undefined" ? "undefined" : _typeof(__MOBX_DEVTOOLS_GLOBAL_HOOK__)) === "object") { + __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx(module.exports); + } + module.exports.default = module.exports; + var actionFieldDecorator = createClassPropertyDecorator(function (target, key, value, args, originalDescriptor) { + var actionName = args && args.length === 1 ? args[0] : value.name || key || ""; + var wrappedAction = action(actionName, value); + addHiddenProp(target, key, wrappedAction); + }, function (key) { + return this[key]; + }, function () { + invariant(false, getMessage("m001")); + }, false, true); + var boundActionDecorator = createClassPropertyDecorator(function (target, key, value) { + defineBoundAction(target, key, value); + }, function (key) { + return this[key]; + }, function () { + invariant(false, getMessage("m001")); + }, false, false); + var action = function action(arg1, arg2, arg3, arg4) { + if (arguments.length === 1 && typeof arg1 === "function") return createAction(arg1.name || "", arg1); + if (arguments.length === 2 && typeof arg2 === "function") return createAction(arg1, arg2); + if (arguments.length === 1 && typeof arg1 === "string") return namedActionDecorator(arg1); + return namedActionDecorator(arg2).apply(null, arguments); + }; + exports.action = action; + action.bound = function boundAction(arg1, arg2, arg3) { + if (typeof arg1 === "function") { + var action_1 = createAction("", arg1); + action_1.autoBind = true; + return action_1; + } + return boundActionDecorator.apply(null, arguments); + }; + function namedActionDecorator(name) { + return function (target, prop, descriptor) { + if (descriptor && typeof descriptor.value === "function") { + descriptor.value = createAction(name, descriptor.value); + descriptor.enumerable = false; + descriptor.configurable = true; + return descriptor; + } + return actionFieldDecorator(name).apply(this, arguments); + }; + } + function runInAction(arg1, arg2, arg3) { + var actionName = typeof arg1 === "string" ? arg1 : arg1.name || ""; + var fn = typeof arg1 === "function" ? arg1 : arg2; + var scope = typeof arg1 === "function" ? arg2 : arg3; + invariant(typeof fn === "function", getMessage("m002")); + invariant(fn.length === 0, getMessage("m003")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + return executeAction(actionName, fn, scope, undefined); + } + exports.runInAction = runInAction; + function isAction(thing) { + return typeof thing === "function" && thing.isMobxAction === true; + } + exports.isAction = isAction; + function defineBoundAction(target, propertyName, fn) { + var res = function res() { + return executeAction(propertyName, fn, target, arguments); + }; + res.isMobxAction = true; + addHiddenProp(target, propertyName, res); + } + function autorun(arg1, arg2, arg3) { + var name, view, scope; + if (typeof arg1 === "string") { + name = arg1; + view = arg2; + scope = arg3; + } else { + name = arg1.name || "Autorun@" + getNextId(); + view = arg1; + scope = arg2; + } + invariant(typeof view === "function", getMessage("m004")); + invariant(isAction(view) === false, getMessage("m005")); + if (scope) view = view.bind(scope); + var reaction = new Reaction(name, function () { + this.track(reactionRunner); + }); + function reactionRunner() { + view(reaction); + } + reaction.schedule(); + return reaction.getDisposer(); + } + exports.autorun = autorun; + function when(arg1, arg2, arg3, arg4) { + var name, predicate, effect, scope; + if (typeof arg1 === "string") { + name = arg1; + predicate = arg2; + effect = arg3; + scope = arg4; + } else { + name = "When@" + getNextId(); + predicate = arg1; + effect = arg2; + scope = arg3; + } + var disposer = autorun(name, function (r) { + if (predicate.call(scope)) { + r.dispose(); + var prevUntracked = untrackedStart(); + effect.call(scope); + untrackedEnd(prevUntracked); + } + }); + return disposer; + } + exports.when = when; + function autorunAsync(arg1, arg2, arg3, arg4) { + var name, func, delay, scope; + if (typeof arg1 === "string") { + name = arg1; + func = arg2; + delay = arg3; + scope = arg4; + } else { + name = arg1.name || "AutorunAsync@" + getNextId(); + func = arg1; + delay = arg2; + scope = arg3; + } + invariant(isAction(func) === false, getMessage("m006")); + if (delay === void 0) delay = 1; + if (scope) func = func.bind(scope); + var isScheduled = false; + var r = new Reaction(name, function () { + if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + if (!r.isDisposed) r.track(reactionRunner); + }, delay); + } + }); + function reactionRunner() { + func(r); + } + r.schedule(); + return r.getDisposer(); + } + exports.autorunAsync = autorunAsync; + function reaction(expression, effect, arg3) { + if (arguments.length > 3) { + fail(getMessage("m007")); + } + if (isModifierDescriptor(expression)) { + fail(getMessage("m008")); + } + var opts; + if ((typeof arg3 === "undefined" ? "undefined" : _typeof(arg3)) === "object") { + opts = arg3; + } else { + opts = {}; + } + opts.name = opts.name || expression.name || effect.name || "Reaction@" + getNextId(); + opts.fireImmediately = arg3 === true || opts.fireImmediately === true; + opts.delay = opts.delay || 0; + opts.compareStructural = opts.compareStructural || opts.struct || false; + effect = action(opts.name, opts.context ? effect.bind(opts.context) : effect); + if (opts.context) { + expression = expression.bind(opts.context); + } + var firstTime = true; + var isScheduled = false; + var nextValue; + var r = new Reaction(opts.name, function () { + if (firstTime || opts.delay < 1) { + reactionRunner(); + } else if (!isScheduled) { + isScheduled = true; + setTimeout(function () { + isScheduled = false; + reactionRunner(); + }, opts.delay); + } + }); + function reactionRunner() { + if (r.isDisposed) return; + var changed = false; + r.track(function () { + var v = expression(r); + changed = valueDidChange(opts.compareStructural, nextValue, v); + nextValue = v; + }); + if (firstTime && opts.fireImmediately) effect(nextValue, r); + if (!firstTime && changed === true) effect(nextValue, r); + if (firstTime) firstTime = false; + } + r.schedule(); + return r.getDisposer(); + } + exports.reaction = reaction; + function createComputedDecorator(compareStructural) { + return createClassPropertyDecorator(function (target, name, _, __, originalDescriptor) { + invariant(typeof originalDescriptor !== "undefined", getMessage("m009")); + invariant(typeof originalDescriptor.get === "function", getMessage("m010")); + var adm = asObservableObject(target, ""); + defineComputedProperty(adm, name, originalDescriptor.get, originalDescriptor.set, compareStructural, false); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined) return undefined; + return observable.get(); + }, function (name, value) { + this.$mobx.values[name].set(value); + }, false, false); + } + var computedDecorator = createComputedDecorator(false); + var computedStructDecorator = createComputedDecorator(true); + var computed = function computed(arg1, arg2, arg3) { + if (typeof arg2 === "string") { + return computedDecorator.apply(null, arguments); + } + invariant(typeof arg1 === "function", getMessage("m011")); + invariant(arguments.length < 3, getMessage("m012")); + var opts = (typeof arg2 === "undefined" ? "undefined" : _typeof(arg2)) === "object" ? arg2 : {}; + opts.setter = typeof arg2 === "function" ? arg2 : opts.setter; + return new ComputedValue(arg1, opts.context, opts.compareStructural || opts.struct || false, opts.name || arg1.name || "", opts.setter); + }; + exports.computed = computed; + computed.struct = computedStructDecorator; + function createTransformer(transformer, onCleanup) { + invariant(typeof transformer === "function" && transformer.length < 2, "createTransformer expects a function that accepts one argument"); + var objectCache = {}; + var resetId = globalState.resetId; + var Transformer = function (_super) { + __extends(Transformer, _super); + function Transformer(sourceIdentifier, sourceObject) { + var _this = _super.call(this, function () { + return transformer(sourceObject); + }, undefined, false, "Transformer-" + transformer.name + "-" + sourceIdentifier, undefined) || this; + _this.sourceIdentifier = sourceIdentifier; + _this.sourceObject = sourceObject; + return _this; + } + Transformer.prototype.onBecomeUnobserved = function () { + var lastValue = this.value; + _super.prototype.onBecomeUnobserved.call(this); + delete objectCache[this.sourceIdentifier]; + if (onCleanup) onCleanup(lastValue, this.sourceObject); + }; + return Transformer; + }(ComputedValue); + return function (object) { + if (resetId !== globalState.resetId) { + objectCache = {}; + resetId = globalState.resetId; + } + var identifier = getMemoizationId(object); + var reactiveTransformer = objectCache[identifier]; + if (reactiveTransformer) return reactiveTransformer.get(); + reactiveTransformer = objectCache[identifier] = new Transformer(identifier, object); + return reactiveTransformer.get(); + }; + } + exports.createTransformer = createTransformer; + function getMemoizationId(object) { + if (object === null || (typeof object === "undefined" ? "undefined" : _typeof(object)) !== "object") throw new Error("[mobx] transform expected some kind of object, got: " + object); + var tid = object.$transformId; + if (tid === undefined) { + tid = getNextId(); + addHiddenProp(object, "$transformId", tid); + } + return tid; + } + function expr(expr, scope) { + if (!isComputingDerivation()) console.warn(getMessage("m013")); + return computed(expr, { context: scope }).get(); + } + exports.expr = expr; + function extendObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, deepEnhancer, properties); + } + exports.extendObservable = extendObservable; + function extendShallowObservable(target) { + var properties = []; + for (var _i = 1; _i < arguments.length; _i++) { + properties[_i - 1] = arguments[_i]; + } + return extendObservableHelper(target, referenceEnhancer, properties); + } + exports.extendShallowObservable = extendShallowObservable; + function extendObservableHelper(target, defaultEnhancer, properties) { + invariant(arguments.length >= 2, getMessage("m014")); + invariant((typeof target === "undefined" ? "undefined" : _typeof(target)) === "object", getMessage("m015")); + invariant(!isObservableMap(target), getMessage("m016")); + properties.forEach(function (propSet) { + invariant((typeof propSet === "undefined" ? "undefined" : _typeof(propSet)) === "object", getMessage("m017")); + invariant(!isObservable(propSet), getMessage("m018")); + }); + var adm = asObservableObject(target); + var definedProps = {}; + for (var i = properties.length - 1; i >= 0; i--) { + var propSet = properties[i]; + for (var key in propSet) { + if (definedProps[key] !== true && hasOwnProperty(propSet, key)) { + definedProps[key] = true; + if (target === propSet && !isPropertyConfigurable(target, key)) continue; + var descriptor = Object.getOwnPropertyDescriptor(propSet, key); + defineObservablePropertyFromDescriptor(adm, key, descriptor, defaultEnhancer); + } + } + } + return target; + } + function getDependencyTree(thing, property) { + return nodeToDependencyTree(getAtom(thing, property)); + } + function nodeToDependencyTree(node) { + var result = { + name: node.name + }; + if (node.observing && node.observing.length > 0) result.dependencies = unique(node.observing).map(nodeToDependencyTree); + return result; + } + function getObserverTree(thing, property) { + return nodeToObserverTree(getAtom(thing, property)); + } + function nodeToObserverTree(node) { + var result = { + name: node.name + }; + if (hasObservers(node)) result.observers = getObservers(node).map(nodeToObserverTree); + return result; + } + function intercept(thing, propOrHandler, handler) { + if (typeof handler === "function") return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler); + } + exports.intercept = intercept; + function interceptInterceptable(thing, handler) { + return getAdministration(thing).intercept(handler); + } + function interceptProperty(thing, property, handler) { + return getAdministration(thing, property).intercept(handler); + } + function isComputed(value, property) { + if (value === null || value === undefined) return false; + if (property !== undefined) { + if (isObservableObject(value) === false) return false; + var atom = getAtom(value, property); + return isComputedValue(atom); + } + return isComputedValue(value); + } + exports.isComputed = isComputed; + function isObservable(value, property) { + if (value === null || value === undefined) return false; + if (property !== undefined) { + if (isObservableArray(value) || isObservableMap(value)) throw new Error(getMessage("m019"));else if (isObservableObject(value)) { + var o = value.$mobx; + return o.values && !!o.values[property]; + } + return false; + } + return isObservableObject(value) || !!value.$mobx || isAtom(value) || isReaction(value) || isComputedValue(value); + } + exports.isObservable = isObservable; + var deepDecorator = createDecoratorForEnhancer(deepEnhancer); + var shallowDecorator = createDecoratorForEnhancer(shallowEnhancer); + var refDecorator = createDecoratorForEnhancer(referenceEnhancer); + var deepStructDecorator = createDecoratorForEnhancer(deepStructEnhancer); + var refStructDecorator = createDecoratorForEnhancer(refStructEnhancer); + function createObservable(v) { + if (v === void 0) { + v = undefined; + } + if (typeof arguments[1] === "string") return deepDecorator.apply(null, arguments); + invariant(arguments.length <= 1, getMessage("m021")); + invariant(!isModifierDescriptor(v), getMessage("m020")); + if (isObservable(v)) return v; + var res = deepEnhancer(v, undefined, undefined); + if (res !== v) return res; + return observable.box(v); + } + var IObservableFactories = function () { + function IObservableFactories() {} + IObservableFactories.prototype.box = function (value, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("box"); + return new ObservableValue(value, deepEnhancer, name); + }; + IObservableFactories.prototype.shallowBox = function (value, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("shallowBox"); + return new ObservableValue(value, referenceEnhancer, name); + }; + IObservableFactories.prototype.array = function (initialValues, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("array"); + return new ObservableArray(initialValues, deepEnhancer, name); + }; + IObservableFactories.prototype.shallowArray = function (initialValues, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("shallowArray"); + return new ObservableArray(initialValues, referenceEnhancer, name); + }; + IObservableFactories.prototype.map = function (initialValues, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("map"); + return new ObservableMap(initialValues, deepEnhancer, name); + }; + IObservableFactories.prototype.shallowMap = function (initialValues, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("shallowMap"); + return new ObservableMap(initialValues, referenceEnhancer, name); + }; + IObservableFactories.prototype.object = function (props, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("object"); + var res = {}; + asObservableObject(res, name); + extendObservable(res, props); + return res; + }; + IObservableFactories.prototype.shallowObject = function (props, name) { + if (arguments.length > 2) incorrectlyUsedAsDecorator("shallowObject"); + var res = {}; + asObservableObject(res, name); + extendShallowObservable(res, props); + return res; + }; + IObservableFactories.prototype.ref = function () { + if (arguments.length < 2) { + return createModifierDescriptor(referenceEnhancer, arguments[0]); + } else { + return refDecorator.apply(null, arguments); + } + }; + IObservableFactories.prototype.shallow = function () { + if (arguments.length < 2) { + return createModifierDescriptor(shallowEnhancer, arguments[0]); + } else { + return shallowDecorator.apply(null, arguments); + } + }; + IObservableFactories.prototype.deep = function () { + if (arguments.length < 2) { + return createModifierDescriptor(deepEnhancer, arguments[0]); + } else { + return deepDecorator.apply(null, arguments); + } + }; + IObservableFactories.prototype.struct = function () { + if (arguments.length < 2) { + return createModifierDescriptor(deepStructEnhancer, arguments[0]); + } else { + return deepStructDecorator.apply(null, arguments); + } + }; + return IObservableFactories; + }(); + exports.IObservableFactories = IObservableFactories; + var observable = createObservable; + exports.observable = observable; + Object.keys(IObservableFactories.prototype).forEach(function (key) { + return observable[key] = IObservableFactories.prototype[key]; + }); + observable.deep.struct = observable.struct; + observable.ref.struct = function () { + if (arguments.length < 2) { + return createModifierDescriptor(refStructEnhancer, arguments[0]); + } else { + return refStructDecorator.apply(null, arguments); + } + }; + function incorrectlyUsedAsDecorator(methodName) { + fail("Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?"); + } + function createDecoratorForEnhancer(enhancer) { + invariant(!!enhancer, ":("); + return createClassPropertyDecorator(function (target, name, baseValue, _, baseDescriptor) { + assertPropertyConfigurable(target, name); + invariant(!baseDescriptor || !baseDescriptor.get, getMessage("m022")); + var adm = asObservableObject(target, undefined); + defineObservableProperty(adm, name, baseValue, enhancer); + }, function (name) { + var observable = this.$mobx.values[name]; + if (observable === undefined) return undefined; + return observable.get(); + }, function (name, value) { + setPropertyValue(this, name, value); + }, true, false); + } + function observe(thing, propOrCb, cbOrFire, fireImmediately) { + if (typeof cbOrFire === "function") return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire); + } + exports.observe = observe; + function observeObservable(thing, listener, fireImmediately) { + return getAdministration(thing).observe(listener, fireImmediately); + } + function observeObservableProperty(thing, property, listener, fireImmediately) { + return getAdministration(thing, property).observe(listener, fireImmediately); + } + function toJS(source, detectCycles, __alreadySeen) { + if (detectCycles === void 0) { + detectCycles = true; + } + if (__alreadySeen === void 0) { + __alreadySeen = []; + } + function cache(value) { + if (detectCycles) __alreadySeen.push([source, value]); + return value; + } + if (isObservable(source)) { + if (detectCycles && __alreadySeen === null) __alreadySeen = []; + if (detectCycles && source !== null && (typeof source === "undefined" ? "undefined" : _typeof(source)) === "object") { + for (var i = 0, l = __alreadySeen.length; i < l; i++) { + if (__alreadySeen[i][0] === source) return __alreadySeen[i][1]; + } + } + if (isObservableArray(source)) { + var res = cache([]); + var toAdd = source.map(function (value) { + return toJS(value, detectCycles, __alreadySeen); + }); + res.length = toAdd.length; + for (var i = 0, l = toAdd.length; i < l; i++) { + res[i] = toAdd[i]; + }return res; + } + if (isObservableObject(source)) { + var res = cache({}); + for (var key in source) { + res[key] = toJS(source[key], detectCycles, __alreadySeen); + }return res; + } + if (isObservableMap(source)) { + var res_1 = cache({}); + source.forEach(function (value, key) { + return res_1[key] = toJS(value, detectCycles, __alreadySeen); + }); + return res_1; + } + if (isObservableValue(source)) return toJS(source.get(), detectCycles, __alreadySeen); + } + return source; + } + exports.toJS = toJS; + function transaction(action, thisArg) { + if (thisArg === void 0) { + thisArg = undefined; + } + deprecated(getMessage("m023")); + return runInTransaction.apply(undefined, arguments); + } + exports.transaction = transaction; + function runInTransaction(action, thisArg) { + if (thisArg === void 0) { + thisArg = undefined; + } + return executeAction("", action); + } + function log(msg) { + console.log(msg); + return msg; + } + function whyRun(thing, prop) { + switch (arguments.length) { + case 0: + thing = globalState.trackingDerivation; + if (!thing) return log(getMessage("m024")); + break; + case 2: + thing = getAtom(thing, prop); + break; + } + thing = getAtom(thing); + if (isComputedValue(thing)) return log(thing.whyRun());else if (isReaction(thing)) return log(thing.whyRun()); + return fail(getMessage("m025")); + } + exports.whyRun = whyRun; + function createAction(actionName, fn) { + invariant(typeof fn === "function", getMessage("m026")); + invariant(typeof actionName === "string" && actionName.length > 0, "actions should have valid names, got: '" + actionName + "'"); + var res = function res() { + return executeAction(actionName, fn, this, arguments); + }; + res.originalFn = fn; + res.isMobxAction = true; + return res; + } + function executeAction(actionName, fn, scope, args) { + var runInfo = startAction(actionName, fn, scope, args); + try { + return fn.apply(scope, args); + } finally { + endAction(runInfo); + } + } + function startAction(actionName, fn, scope, args) { + var notifySpy = isSpyEnabled() && !!actionName; + var startTime = 0; + if (notifySpy) { + startTime = Date.now(); + var l = args && args.length || 0; + var flattendArgs = new Array(l); + if (l > 0) for (var i = 0; i < l; i++) { + flattendArgs[i] = args[i]; + }spyReportStart({ + type: "action", + name: actionName, + fn: fn, + object: scope, + arguments: flattendArgs + }); + } + var prevDerivation = untrackedStart(); + startBatch(); + var prevAllowStateChanges = allowStateChangesStart(true); + return { + prevDerivation: prevDerivation, + prevAllowStateChanges: prevAllowStateChanges, + notifySpy: notifySpy, + startTime: startTime + }; + } + function endAction(runInfo) { + allowStateChangesEnd(runInfo.prevAllowStateChanges); + endBatch(); + untrackedEnd(runInfo.prevDerivation); + if (runInfo.notifySpy) spyReportEnd({ time: Date.now() - runInfo.startTime }); + } + function useStrict(strict) { + invariant(globalState.trackingDerivation === null, getMessage("m028")); + globalState.strictMode = strict; + globalState.allowStateChanges = !strict; + } + exports.useStrict = useStrict; + function isStrictModeEnabled() { + return globalState.strictMode; + } + exports.isStrictModeEnabled = isStrictModeEnabled; + function allowStateChanges(allowStateChanges, func) { + var prev = allowStateChangesStart(allowStateChanges); + var res; + try { + res = func(); + } finally { + allowStateChangesEnd(prev); + } + return res; + } + function allowStateChangesStart(allowStateChanges) { + var prev = globalState.allowStateChanges; + globalState.allowStateChanges = allowStateChanges; + return prev; + } + function allowStateChangesEnd(prev) { + globalState.allowStateChanges = prev; + } + var BaseAtom = function () { + function BaseAtom(name) { + if (name === void 0) { + name = "Atom@" + getNextId(); + } + this.name = name; + this.isPendingUnobservation = true; + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.NOT_TRACKING; + } + BaseAtom.prototype.onBecomeUnobserved = function () {}; + BaseAtom.prototype.reportObserved = function () { + reportObserved(this); + }; + BaseAtom.prototype.reportChanged = function () { + startBatch(); + propagateChanged(this); + endBatch(); + }; + BaseAtom.prototype.toString = function () { + return this.name; + }; + return BaseAtom; + }(); + exports.BaseAtom = BaseAtom; + var Atom = function (_super) { + __extends(Atom, _super); + function Atom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) { + if (name === void 0) { + name = "Atom@" + getNextId(); + } + if (onBecomeObservedHandler === void 0) { + onBecomeObservedHandler = noop; + } + if (onBecomeUnobservedHandler === void 0) { + onBecomeUnobservedHandler = noop; + } + var _this = _super.call(this, name) || this; + _this.name = name; + _this.onBecomeObservedHandler = onBecomeObservedHandler; + _this.onBecomeUnobservedHandler = onBecomeUnobservedHandler; + _this.isPendingUnobservation = false; + _this.isBeingTracked = false; + return _this; + } + Atom.prototype.reportObserved = function () { + startBatch(); + _super.prototype.reportObserved.call(this); + if (!this.isBeingTracked) { + this.isBeingTracked = true; + this.onBecomeObservedHandler(); + } + endBatch(); + return !!globalState.trackingDerivation; + }; + Atom.prototype.onBecomeUnobserved = function () { + this.isBeingTracked = false; + this.onBecomeUnobservedHandler(); + }; + return Atom; + }(BaseAtom); + exports.Atom = Atom; + var isAtom = createInstanceofPredicate("Atom", BaseAtom); + var ComputedValue = function () { + function ComputedValue(derivation, scope, compareStructural, name, setter) { + this.derivation = derivation; + this.scope = scope; + this.compareStructural = compareStructural; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.observing = []; + this.newObserving = null; + this.isPendingUnobservation = false; + this.observers = []; + this.observersIndexes = {}; + this.diffValue = 0; + this.runId = 0; + this.lastAccessedBy = 0; + this.lowestObserverState = IDerivationState.UP_TO_DATE; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.value = undefined; + this.isComputing = false; + this.isRunningSetter = false; + this.name = name || "ComputedValue@" + getNextId(); + if (setter) this.setter = createAction(name + "-setter", setter); + } + ComputedValue.prototype.onBecomeStale = function () { + propagateMaybeChanged(this); + }; + ComputedValue.prototype.onBecomeUnobserved = function () { + invariant(this.dependenciesState !== IDerivationState.NOT_TRACKING, getMessage("m029")); + clearObserving(this); + this.value = undefined; + }; + ComputedValue.prototype.get = function () { + invariant(!this.isComputing, "Cycle detected in computation " + this.name, this.derivation); + if (globalState.inBatch === 0) { + startBatch(); + if (shouldCompute(this)) this.value = this.computeValue(false); + endBatch(); + } else { + reportObserved(this); + if (shouldCompute(this)) if (this.trackAndCompute()) propagateChangeConfirmed(this); + } + var result = this.value; + if (isCaughtException(result)) throw result.cause; + return result; + }; + ComputedValue.prototype.peek = function () { + var res = this.computeValue(false); + if (isCaughtException(res)) throw res.cause; + return res; + }; + ComputedValue.prototype.set = function (value) { + if (this.setter) { + invariant(!this.isRunningSetter, "The setter of computed value '" + this.name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"); + this.isRunningSetter = true; + try { + this.setter.call(this.scope, value); + } finally { + this.isRunningSetter = false; + } + } else invariant(false, "[ComputedValue '" + this.name + "'] It is not possible to assign a new value to a computed value."); + }; + ComputedValue.prototype.trackAndCompute = function () { + if (isSpyEnabled()) { + spyReport({ + object: this.scope, + type: "compute", + fn: this.derivation + }); + } + var oldValue = this.value; + var newValue = this.value = this.computeValue(true); + return isCaughtException(newValue) || valueDidChange(this.compareStructural, newValue, oldValue); + }; + ComputedValue.prototype.computeValue = function (track) { + this.isComputing = true; + globalState.computationDepth++; + var res; + if (track) { + res = trackDerivedFunction(this, this.derivation, this.scope); + } else { + try { + res = this.derivation.call(this.scope); + } catch (e) { + res = new CaughtException(e); + } + } + globalState.computationDepth--; + this.isComputing = false; + return res; + }; + ; + ComputedValue.prototype.observe = function (listener, fireImmediately) { + var _this = this; + var firstTime = true; + var prevValue = undefined; + return autorun(function () { + var newValue = _this.get(); + if (!firstTime || fireImmediately) { + var prevU = untrackedStart(); + listener({ + type: "update", + object: _this, + newValue: newValue, + oldValue: prevValue + }); + untrackedEnd(prevU); + } + firstTime = false; + prevValue = newValue; + }); + }; + ComputedValue.prototype.toJSON = function () { + return this.get(); + }; + ComputedValue.prototype.toString = function () { + return this.name + "[" + this.derivation.toString() + "]"; + }; + ComputedValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + ; + ComputedValue.prototype.whyRun = function () { + var isTracking = Boolean(globalState.trackingDerivation); + var observing = unique(this.isComputing ? this.newObserving : this.observing).map(function (dep) { + return dep.name; + }); + var observers = unique(getObservers(this).map(function (dep) { + return dep.name; + })); + return "\nWhyRun? computation '" + this.name + "':\n * Running because: " + (isTracking ? "[active] the value of this computation is needed by a reaction" : this.isComputing ? "[get] The value of this computed was requested outside a reaction" : "[idle] not running at the moment") + "\n" + (this.dependenciesState === IDerivationState.NOT_TRACKING ? getMessage("m032") : " * This computation will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this.isComputing && isTracking ? " (... or any observable accessed during the remainder of the current run)" : "") + "\n\t" + getMessage("m038") + "\n\n * If the outcome of this computation changes, the following observers will be re-run:\n " + joinStrings(observers) + "\n"); + }; + return ComputedValue; + }(); + ComputedValue.prototype[primitiveSymbol()] = ComputedValue.prototype.valueOf; + var isComputedValue = createInstanceofPredicate("ComputedValue", ComputedValue); + var IDerivationState; + (function (IDerivationState) { + IDerivationState[IDerivationState["NOT_TRACKING"] = -1] = "NOT_TRACKING"; + IDerivationState[IDerivationState["UP_TO_DATE"] = 0] = "UP_TO_DATE"; + IDerivationState[IDerivationState["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE"; + IDerivationState[IDerivationState["STALE"] = 2] = "STALE"; + })(IDerivationState || (IDerivationState = {})); + exports.IDerivationState = IDerivationState; + var CaughtException = function () { + function CaughtException(cause) { + this.cause = cause; + } + return CaughtException; + }(); + function isCaughtException(e) { + return e instanceof CaughtException; + } + function shouldCompute(derivation) { + switch (derivation.dependenciesState) { + case IDerivationState.UP_TO_DATE: + return false; + case IDerivationState.NOT_TRACKING: + case IDerivationState.STALE: + return true; + case IDerivationState.POSSIBLY_STALE: + { + var prevUntracked = untrackedStart(); + var obs = derivation.observing, + l = obs.length; + for (var i = 0; i < l; i++) { + var obj = obs[i]; + if (isComputedValue(obj)) { + try { + obj.get(); + } catch (e) { + untrackedEnd(prevUntracked); + return true; + } + if (derivation.dependenciesState === IDerivationState.STALE) { + untrackedEnd(prevUntracked); + return true; + } + } + } + changeDependenciesStateTo0(derivation); + untrackedEnd(prevUntracked); + return false; + } + } + } + function isComputingDerivation() { + return globalState.trackingDerivation !== null; + } + function checkIfStateModificationsAreAllowed(atom) { + var hasObservers = atom.observers.length > 0; + if (globalState.computationDepth > 0 && hasObservers) fail(getMessage("m031") + atom.name); + if (!globalState.allowStateChanges && hasObservers) fail(getMessage(globalState.strictMode ? "m030a" : "m030b") + atom.name); + } + function trackDerivedFunction(derivation, f, context) { + changeDependenciesStateTo0(derivation); + derivation.newObserving = new Array(derivation.observing.length + 100); + derivation.unboundDepsCount = 0; + derivation.runId = ++globalState.runId; + var prevTracking = globalState.trackingDerivation; + globalState.trackingDerivation = derivation; + var result; + try { + result = f.call(context); + } catch (e) { + result = new CaughtException(e); + } + globalState.trackingDerivation = prevTracking; + bindDependencies(derivation); + return result; + } + function bindDependencies(derivation) { + var prevObserving = derivation.observing; + var observing = derivation.observing = derivation.newObserving; + derivation.newObserving = null; + var i0 = 0, + l = derivation.unboundDepsCount; + for (var i = 0; i < l; i++) { + var dep = observing[i]; + if (dep.diffValue === 0) { + dep.diffValue = 1; + if (i0 !== i) observing[i0] = dep; + i0++; + } + } + observing.length = i0; + l = prevObserving.length; + while (l--) { + var dep = prevObserving[l]; + if (dep.diffValue === 0) { + removeObserver(dep, derivation); + } + dep.diffValue = 0; + } + while (i0--) { + var dep = observing[i0]; + if (dep.diffValue === 1) { + dep.diffValue = 0; + addObserver(dep, derivation); + } + } + } + function clearObserving(derivation) { + var obs = derivation.observing; + var i = obs.length; + while (i--) { + removeObserver(obs[i], derivation); + }derivation.dependenciesState = IDerivationState.NOT_TRACKING; + obs.length = 0; + } + function untracked(action) { + var prev = untrackedStart(); + var res = action(); + untrackedEnd(prev); + return res; + } + exports.untracked = untracked; + function untrackedStart() { + var prev = globalState.trackingDerivation; + globalState.trackingDerivation = null; + return prev; + } + function untrackedEnd(prev) { + globalState.trackingDerivation = prev; + } + function changeDependenciesStateTo0(derivation) { + if (derivation.dependenciesState === IDerivationState.UP_TO_DATE) return; + derivation.dependenciesState = IDerivationState.UP_TO_DATE; + var obs = derivation.observing; + var i = obs.length; + while (i--) { + obs[i].lowestObserverState = IDerivationState.UP_TO_DATE; + } + } + var persistentKeys = ["mobxGuid", "resetId", "spyListeners", "strictMode", "runId"]; + var MobXGlobals = function () { + function MobXGlobals() { + this.version = 5; + this.trackingDerivation = null; + this.computationDepth = 0; + this.runId = 0; + this.mobxGuid = 0; + this.inBatch = 0; + this.pendingUnobservations = []; + this.pendingReactions = []; + this.isRunningReactions = false; + this.allowStateChanges = true; + this.strictMode = false; + this.resetId = 0; + this.spyListeners = []; + this.globalReactionErrorHandlers = []; + } + return MobXGlobals; + }(); + var globalState = new MobXGlobals(); + function shareGlobalState() { + var global = getGlobal(); + var ownState = globalState; + if (global.__mobservableTrackingStack || global.__mobservableViewStack) throw new Error("[mobx] An incompatible version of mobservable is already loaded."); + if (global.__mobxGlobal && global.__mobxGlobal.version !== ownState.version) throw new Error("[mobx] An incompatible version of mobx is already loaded."); + if (global.__mobxGlobal) globalState = global.__mobxGlobal;else global.__mobxGlobal = ownState; + } + function getGlobalState() { + return globalState; + } + function registerGlobals() {} + function resetGlobalState() { + globalState.resetId++; + var defaultGlobals = new MobXGlobals(); + for (var key in defaultGlobals) { + if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key]; + }globalState.allowStateChanges = !globalState.strictMode; + } + function hasObservers(observable) { + return observable.observers && observable.observers.length > 0; + } + function getObservers(observable) { + return observable.observers; + } + function invariantObservers(observable) { + var list = observable.observers; + var map = observable.observersIndexes; + var l = list.length; + for (var i = 0; i < l; i++) { + var id = list[i].__mapid; + if (i) { + invariant(map[id] === i, "INTERNAL ERROR maps derivation.__mapid to index in list"); + } else { + invariant(!(id in map), "INTERNAL ERROR observer on index 0 shouldnt be held in map."); + } + } + invariant(list.length === 0 || Object.keys(map).length === list.length - 1, "INTERNAL ERROR there is no junk in map"); + } + function addObserver(observable, node) { + var l = observable.observers.length; + if (l) { + observable.observersIndexes[node.__mapid] = l; + } + observable.observers[l] = node; + if (observable.lowestObserverState > node.dependenciesState) observable.lowestObserverState = node.dependenciesState; + } + function removeObserver(observable, node) { + if (observable.observers.length === 1) { + observable.observers.length = 0; + queueForUnobservation(observable); + } else { + var list = observable.observers; + var map_1 = observable.observersIndexes; + var filler = list.pop(); + if (filler !== node) { + var index = map_1[node.__mapid] || 0; + if (index) { + map_1[filler.__mapid] = index; + } else { + delete map_1[filler.__mapid]; + } + list[index] = filler; + } + delete map_1[node.__mapid]; + } + } + function queueForUnobservation(observable) { + if (!observable.isPendingUnobservation) { + observable.isPendingUnobservation = true; + globalState.pendingUnobservations.push(observable); + } + } + function startBatch() { + globalState.inBatch++; + } + function endBatch() { + if (--globalState.inBatch === 0) { + runReactions(); + var list = globalState.pendingUnobservations; + for (var i = 0; i < list.length; i++) { + var observable_1 = list[i]; + observable_1.isPendingUnobservation = false; + if (observable_1.observers.length === 0) { + observable_1.onBecomeUnobserved(); + } + } + globalState.pendingUnobservations = []; + } + } + function reportObserved(observable) { + var derivation = globalState.trackingDerivation; + if (derivation !== null) { + if (derivation.runId !== observable.lastAccessedBy) { + observable.lastAccessedBy = derivation.runId; + derivation.newObserving[derivation.unboundDepsCount++] = observable; + } + } else if (observable.observers.length === 0) { + queueForUnobservation(observable); + } + } + function invariantLOS(observable, msg) { + var min = getObservers(observable).reduce(function (a, b) { + return Math.min(a, b.dependenciesState); + }, 2); + if (min >= observable.lowestObserverState) return; + throw new Error("lowestObserverState is wrong for " + msg + " because " + min + " < " + observable.lowestObserverState); + } + function propagateChanged(observable) { + if (observable.lowestObserverState === IDerivationState.STALE) return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) d.onBecomeStale(); + d.dependenciesState = IDerivationState.STALE; + } + } + function propagateChangeConfirmed(observable) { + if (observable.lowestObserverState === IDerivationState.STALE) return; + observable.lowestObserverState = IDerivationState.STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.POSSIBLY_STALE) d.dependenciesState = IDerivationState.STALE;else if (d.dependenciesState === IDerivationState.UP_TO_DATE) observable.lowestObserverState = IDerivationState.UP_TO_DATE; + } + } + function propagateMaybeChanged(observable) { + if (observable.lowestObserverState !== IDerivationState.UP_TO_DATE) return; + observable.lowestObserverState = IDerivationState.POSSIBLY_STALE; + var observers = observable.observers; + var i = observers.length; + while (i--) { + var d = observers[i]; + if (d.dependenciesState === IDerivationState.UP_TO_DATE) { + d.dependenciesState = IDerivationState.POSSIBLY_STALE; + d.onBecomeStale(); + } + } + } + var Reaction = function () { + function Reaction(name, onInvalidate) { + if (name === void 0) { + name = "Reaction@" + getNextId(); + } + this.name = name; + this.onInvalidate = onInvalidate; + this.observing = []; + this.newObserving = []; + this.dependenciesState = IDerivationState.NOT_TRACKING; + this.diffValue = 0; + this.runId = 0; + this.unboundDepsCount = 0; + this.__mapid = "#" + getNextId(); + this.isDisposed = false; + this._isScheduled = false; + this._isTrackPending = false; + this._isRunning = false; + } + Reaction.prototype.onBecomeStale = function () { + this.schedule(); + }; + Reaction.prototype.schedule = function () { + if (!this._isScheduled) { + this._isScheduled = true; + globalState.pendingReactions.push(this); + runReactions(); + } + }; + Reaction.prototype.isScheduled = function () { + return this._isScheduled; + }; + Reaction.prototype.runReaction = function () { + if (!this.isDisposed) { + startBatch(); + this._isScheduled = false; + if (shouldCompute(this)) { + this._isTrackPending = true; + this.onInvalidate(); + if (this._isTrackPending && isSpyEnabled()) { + spyReport({ + object: this, + type: "scheduled-reaction" + }); + } + } + endBatch(); + } + }; + Reaction.prototype.track = function (fn) { + startBatch(); + var notify = isSpyEnabled(); + var startTime; + if (notify) { + startTime = Date.now(); + spyReportStart({ + object: this, + type: "reaction", + fn: fn + }); + } + this._isRunning = true; + var result = trackDerivedFunction(this, fn, undefined); + this._isRunning = false; + this._isTrackPending = false; + if (this.isDisposed) { + clearObserving(this); + } + if (isCaughtException(result)) this.reportExceptionInDerivation(result.cause); + if (notify) { + spyReportEnd({ + time: Date.now() - startTime + }); + } + endBatch(); + }; + Reaction.prototype.reportExceptionInDerivation = function (error) { + var _this = this; + if (this.errorHandler) { + this.errorHandler(error, this); + return; + } + var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this; + var messageToUser = getMessage("m037"); + console.error(message || messageToUser, error); + if (isSpyEnabled()) { + spyReport({ + type: "error", + message: message, + error: error, + object: this + }); + } + globalState.globalReactionErrorHandlers.forEach(function (f) { + return f(error, _this); + }); + }; + Reaction.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + if (!this._isRunning) { + startBatch(); + clearObserving(this); + endBatch(); + } + } + }; + Reaction.prototype.getDisposer = function () { + var r = this.dispose.bind(this); + r.$mobx = this; + r.onError = registerErrorHandler; + return r; + }; + Reaction.prototype.toString = function () { + return "Reaction[" + this.name + "]"; + }; + Reaction.prototype.whyRun = function () { + var observing = unique(this._isRunning ? this.newObserving : this.observing).map(function (dep) { + return dep.name; + }); + return "\nWhyRun? reaction '" + this.name + "':\n * Status: [" + (this.isDisposed ? "stopped" : this._isRunning ? "running" : this.isScheduled() ? "scheduled" : "idle") + "]\n * This reaction will re-run if any of the following observables changes:\n " + joinStrings(observing) + "\n " + (this._isRunning ? " (... or any observable accessed during the remainder of the current run)" : "") + "\n\t" + getMessage("m038") + "\n"; + }; + return Reaction; + }(); + exports.Reaction = Reaction; + function registerErrorHandler(handler) { + invariant(this && this.$mobx && isReaction(this.$mobx), "Invalid `this`"); + invariant(!this.$mobx.errorHandler, "Only one onErrorHandler can be registered"); + this.$mobx.errorHandler = handler; + } + function onReactionError(handler) { + globalState.globalReactionErrorHandlers.push(handler); + return function () { + var idx = globalState.globalReactionErrorHandlers.indexOf(handler); + if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1); + }; + } + var MAX_REACTION_ITERATIONS = 100; + var reactionScheduler = function reactionScheduler(f) { + return f(); + }; + function runReactions() { + if (globalState.inBatch > 0 || globalState.isRunningReactions) return; + reactionScheduler(runReactionsHelper); + } + function runReactionsHelper() { + globalState.isRunningReactions = true; + var allReactions = globalState.pendingReactions; + var iterations = 0; + while (allReactions.length > 0) { + if (++iterations === MAX_REACTION_ITERATIONS) { + console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + (" Probably there is a cycle in the reactive function: " + allReactions[0])); + allReactions.splice(0); + } + var remainingReactions = allReactions.splice(0); + for (var i = 0, l = remainingReactions.length; i < l; i++) { + remainingReactions[i].runReaction(); + } + } + globalState.isRunningReactions = false; + } + var isReaction = createInstanceofPredicate("Reaction", Reaction); + function setReactionScheduler(fn) { + var baseScheduler = reactionScheduler; + reactionScheduler = function reactionScheduler(f) { + return fn(function () { + return baseScheduler(f); + }); + }; + } + function isSpyEnabled() { + return !!globalState.spyListeners.length; + } + function spyReport(event) { + if (!globalState.spyListeners.length) return; + var listeners = globalState.spyListeners; + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i](event); + } + } + function spyReportStart(event) { + var change = objectAssign({}, event, { spyReportStart: true }); + spyReport(change); + } + var END_EVENT = { spyReportEnd: true }; + function spyReportEnd(change) { + if (change) spyReport(objectAssign({}, change, END_EVENT));else spyReport(END_EVENT); + } + function spy(listener) { + globalState.spyListeners.push(listener); + return once(function () { + var idx = globalState.spyListeners.indexOf(listener); + if (idx !== -1) globalState.spyListeners.splice(idx, 1); + }); + } + exports.spy = spy; + function hasInterceptors(interceptable) { + return interceptable.interceptors && interceptable.interceptors.length > 0; + } + function registerInterceptor(interceptable, handler) { + var interceptors = interceptable.interceptors || (interceptable.interceptors = []); + interceptors.push(handler); + return once(function () { + var idx = interceptors.indexOf(handler); + if (idx !== -1) interceptors.splice(idx, 1); + }); + } + function interceptChange(interceptable, change) { + var prevU = untrackedStart(); + try { + var interceptors = interceptable.interceptors; + if (interceptors) for (var i = 0, l = interceptors.length; i < l; i++) { + change = interceptors[i](change); + invariant(!change || change.type, "Intercept handlers should return nothing or a change object"); + if (!change) break; + } + return change; + } finally { + untrackedEnd(prevU); + } + } + function hasListeners(listenable) { + return listenable.changeListeners && listenable.changeListeners.length > 0; + } + function registerListener(listenable, handler) { + var listeners = listenable.changeListeners || (listenable.changeListeners = []); + listeners.push(handler); + return once(function () { + var idx = listeners.indexOf(handler); + if (idx !== -1) listeners.splice(idx, 1); + }); + } + function notifyListeners(listenable, change) { + var prevU = untrackedStart(); + var listeners = listenable.changeListeners; + if (!listeners) return; + listeners = listeners.slice(); + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i](change); + } + untrackedEnd(prevU); + } + function asReference(value) { + deprecated("asReference is deprecated, use observable.ref instead"); + return observable.ref(value); + } + exports.asReference = asReference; + function asStructure(value) { + deprecated("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."); + return observable.struct(value); + } + exports.asStructure = asStructure; + function asFlat(value) { + deprecated("asFlat is deprecated, use observable.shallow instead"); + return observable.shallow(value); + } + exports.asFlat = asFlat; + function asMap(data) { + deprecated("asMap is deprecated, use observable.map or observable.shallowMap instead"); + return observable.map(data || {}); + } + exports.asMap = asMap; + function isModifierDescriptor(thing) { + return (typeof thing === "undefined" ? "undefined" : _typeof(thing)) === "object" && thing !== null && thing.isMobxModifierDescriptor === true; + } + exports.isModifierDescriptor = isModifierDescriptor; + function createModifierDescriptor(enhancer, initialValue) { + invariant(!isModifierDescriptor(initialValue), "Modifiers cannot be nested"); + return { + isMobxModifierDescriptor: true, + initialValue: initialValue, + enhancer: enhancer + }; + } + function deepEnhancer(v, _, name) { + if (isModifierDescriptor(v)) fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + if (isObservable(v)) return v; + if (Array.isArray(v)) return observable.array(v, name); + if (isPlainObject(v)) return observable.object(v, name); + if (isES6Map(v)) return observable.map(v, name); + return v; + } + function shallowEnhancer(v, _, name) { + if (isModifierDescriptor(v)) fail("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"); + if (v === undefined || v === null) return v; + if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v)) return v; + if (Array.isArray(v)) return observable.shallowArray(v, name); + if (isPlainObject(v)) return observable.shallowObject(v, name); + if (isES6Map(v)) return observable.shallowMap(v, name); + return fail("The shallow modifier / decorator can only used in combination with arrays, objects and maps"); + } + function referenceEnhancer(newValue) { + return newValue; + } + function deepStructEnhancer(v, oldValue, name) { + if (deepEqual(v, oldValue)) return oldValue; + if (isObservable(v)) return v; + if (Array.isArray(v)) return new ObservableArray(v, deepStructEnhancer, name); + if (isES6Map(v)) return new ObservableMap(v, deepStructEnhancer, name); + if (isPlainObject(v)) { + var res = {}; + asObservableObject(res, name); + extendObservableHelper(res, deepStructEnhancer, [v]); + return res; + } + return v; + } + function refStructEnhancer(v, oldValue, name) { + if (deepEqual(v, oldValue)) return oldValue; + return v; + } + var MAX_SPLICE_SIZE = 10000; + var safariPrototypeSetterInheritanceBug = function () { + var v = false; + var p = {}; + Object.defineProperty(p, "0", { set: function set() { + v = true; + } }); + Object.create(p)["0"] = 1; + return v === false; + }(); + var OBSERVABLE_ARRAY_BUFFER_SIZE = 0; + var StubArray = function () { + function StubArray() {} + return StubArray; + }(); + StubArray.prototype = []; + var ObservableArrayAdministration = function () { + function ObservableArrayAdministration(name, enhancer, array, owned) { + this.array = array; + this.owned = owned; + this.lastKnownLength = 0; + this.interceptors = null; + this.changeListeners = null; + this.atom = new BaseAtom(name || "ObservableArray@" + getNextId()); + this.enhancer = function (newV, oldV) { + return enhancer(newV, oldV, name + "[..]"); + }; + } + ObservableArrayAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { + fireImmediately = false; + } + if (fireImmediately) { + listener({ + object: this.array, + type: "splice", + index: 0, + added: this.values.slice(), + addedCount: this.values.length, + removed: [], + removedCount: 0 + }); + } + return registerListener(this, listener); + }; + ObservableArrayAdministration.prototype.getArrayLength = function () { + this.atom.reportObserved(); + return this.values.length; + }; + ObservableArrayAdministration.prototype.setArrayLength = function (newLength) { + if (typeof newLength !== "number" || newLength < 0) throw new Error("[mobx.array] Out of range: " + newLength); + var currentLength = this.values.length; + if (newLength === currentLength) return;else if (newLength > currentLength) { + var newItems = new Array(newLength - currentLength); + for (var i = 0; i < newLength - currentLength; i++) { + newItems[i] = undefined; + }this.spliceWithArray(currentLength, 0, newItems); + } else this.spliceWithArray(newLength, currentLength - newLength); + }; + ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) { + if (oldLength !== this.lastKnownLength) throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?"); + this.lastKnownLength += delta; + if (delta > 0 && oldLength + delta + 1 > OBSERVABLE_ARRAY_BUFFER_SIZE) reserveArrayBuffer(oldLength + delta + 1); + }; + ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) { + var _this = this; + checkIfStateModificationsAreAllowed(this.atom); + var length = this.values.length; + if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index); + if (arguments.length === 1) deleteCount = length - index;else if (deleteCount === undefined || deleteCount === null) deleteCount = 0;else deleteCount = Math.max(0, Math.min(deleteCount, length - index)); + if (newItems === undefined) newItems = []; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + object: this.array, + type: "splice", + index: index, + removedCount: deleteCount, + added: newItems + }); + if (!change) return EMPTY_ARRAY; + deleteCount = change.removedCount; + newItems = change.added; + } + newItems = newItems.map(function (v) { + return _this.enhancer(v, undefined); + }); + var lengthDelta = newItems.length - deleteCount; + this.updateArrayLength(length, lengthDelta); + var res = this.spliceItemsIntoValues(index, deleteCount, newItems); + if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice(index, newItems, res); + return res; + }; + ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) { + if (newItems.length < MAX_SPLICE_SIZE) { + return (_a = this.values).splice.apply(_a, [index, deleteCount].concat(newItems)); + } else { + var res = this.values.slice(index, index + deleteCount); + this.values = this.values.slice(0, index).concat(newItems, this.values.slice(index + deleteCount)); + return res; + } + var _a; + }; + ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy ? { + object: this.array, + type: "update", + index: index, newValue: newValue, oldValue: oldValue + } : null; + if (notifySpy) spyReportStart(change); + this.atom.reportChanged(); + if (notify) notifyListeners(this, change); + if (notifySpy) spyReportEnd(); + }; + ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) { + var notifySpy = !this.owned && isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy ? { + object: this.array, + type: "splice", + index: index, removed: removed, added: added, + removedCount: removed.length, + addedCount: added.length + } : null; + if (notifySpy) spyReportStart(change); + this.atom.reportChanged(); + if (notify) notifyListeners(this, change); + if (notifySpy) spyReportEnd(); + }; + return ObservableArrayAdministration; + }(); + var ObservableArray = function (_super) { + __extends(ObservableArray, _super); + function ObservableArray(initialValues, enhancer, name, owned) { + if (name === void 0) { + name = "ObservableArray@" + getNextId(); + } + if (owned === void 0) { + owned = false; + } + var _this = _super.call(this) || this; + var adm = new ObservableArrayAdministration(name, enhancer, _this, owned); + addHiddenFinalProp(_this, "$mobx", adm); + if (initialValues && initialValues.length) { + adm.updateArrayLength(0, initialValues.length); + adm.values = initialValues.map(function (v) { + return enhancer(v, undefined, name + "[..]"); + }); + adm.notifyArraySplice(0, adm.values.slice(), EMPTY_ARRAY); + } else { + adm.values = []; + } + if (safariPrototypeSetterInheritanceBug) { + Object.defineProperty(adm.array, "0", ENTRY_0); + } + return _this; + } + ObservableArray.prototype.intercept = function (handler) { + return this.$mobx.intercept(handler); + }; + ObservableArray.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately === void 0) { + fireImmediately = false; + } + return this.$mobx.observe(listener, fireImmediately); + }; + ObservableArray.prototype.clear = function () { + return this.splice(0); + }; + ObservableArray.prototype.concat = function () { + var arrays = []; + for (var _i = 0; _i < arguments.length; _i++) { + arrays[_i] = arguments[_i]; + } + this.$mobx.atom.reportObserved(); + return Array.prototype.concat.apply(this.peek(), arrays.map(function (a) { + return isObservableArray(a) ? a.peek() : a; + })); + }; + ObservableArray.prototype.replace = function (newItems) { + return this.$mobx.spliceWithArray(0, this.$mobx.values.length, newItems); + }; + ObservableArray.prototype.toJS = function () { + return this.slice(); + }; + ObservableArray.prototype.toJSON = function () { + return this.toJS(); + }; + ObservableArray.prototype.peek = function () { + return this.$mobx.values; + }; + ObservableArray.prototype.find = function (predicate, thisArg, fromIndex) { + if (fromIndex === void 0) { + fromIndex = 0; + } + this.$mobx.atom.reportObserved(); + var items = this.$mobx.values, + l = items.length; + for (var i = fromIndex; i < l; i++) { + if (predicate.call(thisArg, items[i], i, this)) return items[i]; + }return undefined; + }; + ObservableArray.prototype.splice = function (index, deleteCount) { + var newItems = []; + for (var _i = 2; _i < arguments.length; _i++) { + newItems[_i - 2] = arguments[_i]; + } + switch (arguments.length) { + case 0: + return []; + case 1: + return this.$mobx.spliceWithArray(index); + case 2: + return this.$mobx.spliceWithArray(index, deleteCount); + } + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.spliceWithArray = function (index, deleteCount, newItems) { + return this.$mobx.spliceWithArray(index, deleteCount, newItems); + }; + ObservableArray.prototype.push = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(adm.values.length, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.pop = function () { + return this.splice(Math.max(this.$mobx.values.length - 1, 0), 1)[0]; + }; + ObservableArray.prototype.shift = function () { + return this.splice(0, 1)[0]; + }; + ObservableArray.prototype.unshift = function () { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; + } + var adm = this.$mobx; + adm.spliceWithArray(0, 0, items); + return adm.values.length; + }; + ObservableArray.prototype.reverse = function () { + this.$mobx.atom.reportObserved(); + var clone = this.slice(); + return clone.reverse.apply(clone, arguments); + }; + ObservableArray.prototype.sort = function (compareFn) { + this.$mobx.atom.reportObserved(); + var clone = this.slice(); + return clone.sort.apply(clone, arguments); + }; + ObservableArray.prototype.remove = function (value) { + var idx = this.$mobx.values.indexOf(value); + if (idx > -1) { + this.splice(idx, 1); + return true; + } + return false; + }; + ObservableArray.prototype.move = function (fromIndex, toIndex) { + function checkIndex(index) { + if (index < 0) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is negative"); + } + var length = this.$mobx.values.length; + if (index >= length) { + throw new Error("[mobx.array] Index out of bounds: " + index + " is not smaller than " + length); + } + } + checkIndex.call(this, fromIndex); + checkIndex.call(this, toIndex); + if (fromIndex === toIndex) { + return; + } + var oldItems = this.$mobx.values; + var newItems; + if (fromIndex < toIndex) { + newItems = oldItems.slice(0, fromIndex).concat(oldItems.slice(fromIndex + 1, toIndex + 1), [oldItems[fromIndex]], oldItems.slice(toIndex + 1)); + } else { + newItems = oldItems.slice(0, toIndex).concat([oldItems[fromIndex]], oldItems.slice(toIndex, fromIndex), oldItems.slice(fromIndex + 1)); + } + this.replace(newItems); + }; + ObservableArray.prototype.toString = function () { + this.$mobx.atom.reportObserved(); + return Array.prototype.toString.apply(this.$mobx.values, arguments); + }; + ObservableArray.prototype.toLocaleString = function () { + this.$mobx.atom.reportObserved(); + return Array.prototype.toLocaleString.apply(this.$mobx.values, arguments); + }; + return ObservableArray; + }(StubArray); + declareIterator(ObservableArray.prototype, function () { + return arrayAsIterator(this.slice()); + }); + makeNonEnumerable(ObservableArray.prototype, ["constructor", "intercept", "observe", "clear", "concat", "replace", "toJS", "toJSON", "peek", "find", "splice", "spliceWithArray", "push", "pop", "shift", "unshift", "reverse", "sort", "remove", "move", "toString", "toLocaleString"]); + Object.defineProperty(ObservableArray.prototype, "length", { + enumerable: false, + configurable: true, + get: function get() { + return this.$mobx.getArrayLength(); + }, + set: function set(newLength) { + this.$mobx.setArrayLength(newLength); + } + }); + ["every", "filter", "forEach", "indexOf", "join", "lastIndexOf", "map", "reduce", "reduceRight", "slice", "some"].forEach(function (funcName) { + var baseFunc = Array.prototype[funcName]; + invariant(typeof baseFunc === "function", "Base function not defined on Array prototype: '" + funcName + "'"); + addHiddenProp(ObservableArray.prototype, funcName, function () { + this.$mobx.atom.reportObserved(); + return baseFunc.apply(this.$mobx.values, arguments); + }); + }); + var ENTRY_0 = { + configurable: true, + enumerable: false, + set: createArraySetter(0), + get: createArrayGetter(0) + }; + function createArrayBufferItem(index) { + var set = createArraySetter(index); + var get = createArrayGetter(index); + Object.defineProperty(ObservableArray.prototype, "" + index, { + enumerable: false, + configurable: true, + set: set, get: get + }); + } + function createArraySetter(index) { + return function (newValue) { + var adm = this.$mobx; + var values = adm.values; + if (index < values.length) { + checkIfStateModificationsAreAllowed(adm.atom); + var oldValue = values[index]; + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: adm.array, + index: index, newValue: newValue + }); + if (!change) return; + newValue = change.newValue; + } + newValue = adm.enhancer(newValue, oldValue); + var changed = newValue !== oldValue; + if (changed) { + values[index] = newValue; + adm.notifyArrayChildUpdate(index, newValue, oldValue); + } + } else if (index === values.length) { + adm.spliceWithArray(index, 0, [newValue]); + } else throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values.length); + }; + } + function createArrayGetter(index) { + return function () { + var impl = this.$mobx; + if (impl) { + if (index < impl.values.length) { + impl.atom.reportObserved(); + return impl.values[index]; + } + console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + impl.values.length + "). Please check length first. Out of bound indices will not be tracked by MobX"); + } + return undefined; + }; + } + function reserveArrayBuffer(max) { + for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max; index++) { + createArrayBufferItem(index); + }OBSERVABLE_ARRAY_BUFFER_SIZE = max; + } + reserveArrayBuffer(1000); + var isObservableArrayAdministration = createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration); + function isObservableArray(thing) { + return isObject(thing) && isObservableArrayAdministration(thing.$mobx); + } + exports.isObservableArray = isObservableArray; + var ObservableMapMarker = {}; + var ObservableMap = function () { + function ObservableMap(initialData, enhancer, name) { + if (enhancer === void 0) { + enhancer = deepEnhancer; + } + if (name === void 0) { + name = "ObservableMap@" + getNextId(); + } + this.enhancer = enhancer; + this.name = name; + this.$mobx = ObservableMapMarker; + this._data = {}; + this._hasMap = {}; + this._keys = new ObservableArray(undefined, referenceEnhancer, this.name + ".keys()", true); + this.interceptors = null; + this.changeListeners = null; + this.merge(initialData); + } + ObservableMap.prototype._has = function (key) { + return typeof this._data[key] !== "undefined"; + }; + ObservableMap.prototype.has = function (key) { + if (!this.isValidKey(key)) return false; + key = "" + key; + if (this._hasMap[key]) return this._hasMap[key].get(); + return this._updateHasMapEntry(key, false).get(); + }; + ObservableMap.prototype.set = function (key, value) { + this.assertValidKey(key); + key = "" + key; + var hasKey = this._has(key); + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: hasKey ? "update" : "add", + object: this, + newValue: value, + name: key + }); + if (!change) return this; + value = change.newValue; + } + if (hasKey) { + this._updateValue(key, value); + } else { + this._addValue(key, value); + } + return this; + }; + ObservableMap.prototype.delete = function (key) { + var _this = this; + this.assertValidKey(key); + key = "" + key; + if (hasInterceptors(this)) { + var change = interceptChange(this, { + type: "delete", + object: this, + name: key + }); + if (!change) return false; + } + if (this._has(key)) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy ? { + type: "delete", + object: this, + oldValue: this._data[key].value, + name: key + } : null; + if (notifySpy) spyReportStart(change); + runInTransaction(function () { + _this._keys.remove(key); + _this._updateHasMapEntry(key, false); + var observable = _this._data[key]; + observable.setNewValue(undefined); + _this._data[key] = undefined; + }); + if (notify) notifyListeners(this, change); + if (notifySpy) spyReportEnd(); + return true; + } + return false; + }; + ObservableMap.prototype._updateHasMapEntry = function (key, value) { + var entry = this._hasMap[key]; + if (entry) { + entry.setNewValue(value); + } else { + entry = this._hasMap[key] = new ObservableValue(value, referenceEnhancer, this.name + "." + key + "?", false); + } + return entry; + }; + ObservableMap.prototype._updateValue = function (name, newValue) { + var observable = this._data[name]; + newValue = observable.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy ? { + type: "update", + object: this, + oldValue: observable.value, + name: name, newValue: newValue + } : null; + if (notifySpy) spyReportStart(change); + observable.setNewValue(newValue); + if (notify) notifyListeners(this, change); + if (notifySpy) spyReportEnd(); + } + }; + ObservableMap.prototype._addValue = function (name, newValue) { + var _this = this; + runInTransaction(function () { + var observable = _this._data[name] = new ObservableValue(newValue, _this.enhancer, _this.name + "." + name, false); + newValue = observable.value; + _this._updateHasMapEntry(name, true); + _this._keys.push(name); + }); + var notifySpy = isSpyEnabled(); + var notify = hasListeners(this); + var change = notify || notifySpy ? { + type: "add", + object: this, + name: name, newValue: newValue + } : null; + if (notifySpy) spyReportStart(change); + if (notify) notifyListeners(this, change); + if (notifySpy) spyReportEnd(); + }; + ObservableMap.prototype.get = function (key) { + key = "" + key; + if (this.has(key)) return this._data[key].get(); + return undefined; + }; + ObservableMap.prototype.keys = function () { + return arrayAsIterator(this._keys.slice()); + }; + ObservableMap.prototype.values = function () { + return arrayAsIterator(this._keys.map(this.get, this)); + }; + ObservableMap.prototype.entries = function () { + var _this = this; + return arrayAsIterator(this._keys.map(function (key) { + return [key, _this.get(key)]; + })); + }; + ObservableMap.prototype.forEach = function (callback, thisArg) { + var _this = this; + this.keys().forEach(function (key) { + return callback.call(thisArg, _this.get(key), key, _this); + }); + }; + ObservableMap.prototype.merge = function (other) { + var _this = this; + if (isObservableMap(other)) { + other = other.toJS(); + } + runInTransaction(function () { + if (isPlainObject(other)) Object.keys(other).forEach(function (key) { + return _this.set(key, other[key]); + });else if (Array.isArray(other)) other.forEach(function (_a) { + var key = _a[0], + value = _a[1]; + return _this.set(key, value); + });else if (isES6Map(other)) other.forEach(function (value, key) { + return _this.set(key, value); + });else if (other !== null && other !== undefined) fail("Cannot initialize map from " + other); + }); + return this; + }; + ObservableMap.prototype.clear = function () { + var _this = this; + runInTransaction(function () { + untracked(function () { + _this.keys().forEach(_this.delete, _this); + }); + }); + }; + ObservableMap.prototype.replace = function (values) { + var _this = this; + runInTransaction(function () { + _this.clear(); + _this.merge(values); + }); + return this; + }; + Object.defineProperty(ObservableMap.prototype, "size", { + get: function get() { + return this._keys.length; + }, + enumerable: true, + configurable: true + }); + ObservableMap.prototype.toJS = function () { + var _this = this; + var res = {}; + this.keys().forEach(function (key) { + return res[key] = _this.get(key); + }); + return res; + }; + ObservableMap.prototype.toJSON = function () { + return this.toJS(); + }; + ObservableMap.prototype.isValidKey = function (key) { + if (key === null || key === undefined) return false; + if (typeof key === "string" || typeof key === "number" || typeof key === "boolean") return true; + return false; + }; + ObservableMap.prototype.assertValidKey = function (key) { + if (!this.isValidKey(key)) throw new Error("[mobx.map] Invalid key: '" + key + "', only strings, numbers and booleans are accepted as key in observable maps."); + }; + ObservableMap.prototype.toString = function () { + var _this = this; + return this.name + "[{ " + this.keys().map(function (key) { + return key + ": " + ("" + _this.get(key)); + }).join(", ") + " }]"; + }; + ObservableMap.prototype.observe = function (listener, fireImmediately) { + invariant(fireImmediately !== true, getMessage("m033")); + return registerListener(this, listener); + }; + ObservableMap.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableMap; + }(); + exports.ObservableMap = ObservableMap; + declareIterator(ObservableMap.prototype, function () { + return this.entries(); + }); + function map(initialValues) { + deprecated("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"); + return observable.map(initialValues); + } + exports.map = map; + var isObservableMap = createInstanceofPredicate("ObservableMap", ObservableMap); + exports.isObservableMap = isObservableMap; + var ObservableObjectAdministration = function () { + function ObservableObjectAdministration(target, name) { + this.target = target; + this.name = name; + this.values = {}; + this.changeListeners = null; + this.interceptors = null; + } + ObservableObjectAdministration.prototype.observe = function (callback, fireImmediately) { + invariant(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects."); + return registerListener(this, callback); + }; + ObservableObjectAdministration.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + return ObservableObjectAdministration; + }(); + function asObservableObject(target, name) { + if (isObservableObject(target)) return target.$mobx; + invariant(Object.isExtensible(target), getMessage("m035")); + if (!isPlainObject(target)) name = (target.constructor.name || "ObservableObject") + "@" + getNextId(); + if (!name) name = "ObservableObject@" + getNextId(); + var adm = new ObservableObjectAdministration(target, name); + addHiddenFinalProp(target, "$mobx", adm); + return adm; + } + function defineObservablePropertyFromDescriptor(adm, propName, descriptor, defaultEnhancer) { + if (adm.values[propName]) { + invariant("value" in descriptor, "The property " + propName + " in " + adm.name + " is already observable, cannot redefine it as computed property"); + adm.target[propName] = descriptor.value; + return; + } + if ("value" in descriptor) { + if (isModifierDescriptor(descriptor.value)) { + var modifierDescriptor = descriptor.value; + defineObservableProperty(adm, propName, modifierDescriptor.initialValue, modifierDescriptor.enhancer); + } else if (isAction(descriptor.value) && descriptor.value.autoBind === true) { + defineBoundAction(adm.target, propName, descriptor.value.originalFn); + } else if (isComputedValue(descriptor.value)) { + defineComputedPropertyFromComputedValue(adm, propName, descriptor.value); + } else { + defineObservableProperty(adm, propName, descriptor.value, defaultEnhancer); + } + } else { + defineComputedProperty(adm, propName, descriptor.get, descriptor.set, false, true); + } + } + function defineObservableProperty(adm, propName, newValue, enhancer) { + assertPropertyConfigurable(adm.target, propName); + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + object: adm.target, + name: propName, + type: "add", + newValue: newValue + }); + if (!change) return; + newValue = change.newValue; + } + var observable = adm.values[propName] = new ObservableValue(newValue, enhancer, adm.name + "." + propName, false); + newValue = observable.value; + Object.defineProperty(adm.target, propName, generateObservablePropConfig(propName)); + notifyPropertyAddition(adm, adm.target, propName, newValue); + } + function defineComputedProperty(adm, propName, getter, setter, compareStructural, asInstanceProperty) { + if (asInstanceProperty) assertPropertyConfigurable(adm.target, propName); + adm.values[propName] = new ComputedValue(getter, adm.target, compareStructural, adm.name + "." + propName, setter); + if (asInstanceProperty) { + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); + } + } + function defineComputedPropertyFromComputedValue(adm, propName, computedValue) { + var name = adm.name + "." + propName; + computedValue.name = name; + if (!computedValue.scope) computedValue.scope = adm.target; + adm.values[propName] = computedValue; + Object.defineProperty(adm.target, propName, generateComputedPropConfig(propName)); + } + var observablePropertyConfigs = {}; + var computedPropertyConfigs = {}; + function generateObservablePropConfig(propName) { + return observablePropertyConfigs[propName] || (observablePropertyConfigs[propName] = { + configurable: true, + enumerable: true, + get: function get() { + return this.$mobx.values[propName].get(); + }, + set: function set(v) { + setPropertyValue(this, propName, v); + } + }); + } + function generateComputedPropConfig(propName) { + return computedPropertyConfigs[propName] || (computedPropertyConfigs[propName] = { + configurable: true, + enumerable: false, + get: function get() { + return this.$mobx.values[propName].get(); + }, + set: function set(v) { + return this.$mobx.values[propName].set(v); + } + }); + } + function setPropertyValue(instance, name, newValue) { + var adm = instance.$mobx; + var observable = adm.values[name]; + if (hasInterceptors(adm)) { + var change = interceptChange(adm, { + type: "update", + object: instance, + name: name, newValue: newValue + }); + if (!change) return; + newValue = change.newValue; + } + newValue = observable.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy ? { + type: "update", + object: instance, + oldValue: observable.value, + name: name, newValue: newValue + } : null; + if (notifySpy) spyReportStart(change); + observable.setNewValue(newValue); + if (notify) notifyListeners(adm, change); + if (notifySpy) spyReportEnd(); + } + } + function notifyPropertyAddition(adm, object, name, newValue) { + var notify = hasListeners(adm); + var notifySpy = isSpyEnabled(); + var change = notify || notifySpy ? { + type: "add", + object: object, name: name, newValue: newValue + } : null; + if (notifySpy) spyReportStart(change); + if (notify) notifyListeners(adm, change); + if (notifySpy) spyReportEnd(); + } + var isObservableObjectAdministration = createInstanceofPredicate("ObservableObjectAdministration", ObservableObjectAdministration); + function isObservableObject(thing) { + if (isObject(thing)) { + runLazyInitializers(thing); + return isObservableObjectAdministration(thing.$mobx); + } + return false; + } + exports.isObservableObject = isObservableObject; + var UNCHANGED = {}; + var ObservableValue = function (_super) { + __extends(ObservableValue, _super); + function ObservableValue(value, enhancer, name, notifySpy) { + if (name === void 0) { + name = "ObservableValue@" + getNextId(); + } + if (notifySpy === void 0) { + notifySpy = true; + } + var _this = _super.call(this, name) || this; + _this.enhancer = enhancer; + _this.hasUnreportedChange = false; + _this.value = enhancer(value, undefined, name); + if (notifySpy && isSpyEnabled()) { + spyReport({ type: "create", object: _this, newValue: _this.value }); + } + return _this; + } + ObservableValue.prototype.set = function (newValue) { + var oldValue = this.value; + newValue = this.prepareNewValue(newValue); + if (newValue !== UNCHANGED) { + var notifySpy = isSpyEnabled(); + if (notifySpy) { + spyReportStart({ + type: "update", + object: this, + newValue: newValue, oldValue: oldValue + }); + } + this.setNewValue(newValue); + if (notifySpy) spyReportEnd(); + } + }; + ObservableValue.prototype.prepareNewValue = function (newValue) { + checkIfStateModificationsAreAllowed(this); + if (hasInterceptors(this)) { + var change = interceptChange(this, { object: this, type: "update", newValue: newValue }); + if (!change) return UNCHANGED; + newValue = change.newValue; + } + newValue = this.enhancer(newValue, this.value, this.name); + return this.value !== newValue ? newValue : UNCHANGED; + }; + ObservableValue.prototype.setNewValue = function (newValue) { + var oldValue = this.value; + this.value = newValue; + this.reportChanged(); + if (hasListeners(this)) { + notifyListeners(this, { + type: "update", + object: this, + newValue: newValue, + oldValue: oldValue + }); + } + }; + ObservableValue.prototype.get = function () { + this.reportObserved(); + return this.value; + }; + ObservableValue.prototype.intercept = function (handler) { + return registerInterceptor(this, handler); + }; + ObservableValue.prototype.observe = function (listener, fireImmediately) { + if (fireImmediately) listener({ + object: this, + type: "update", + newValue: this.value, + oldValue: undefined + }); + return registerListener(this, listener); + }; + ObservableValue.prototype.toJSON = function () { + return this.get(); + }; + ObservableValue.prototype.toString = function () { + return this.name + "[" + this.value + "]"; + }; + ObservableValue.prototype.valueOf = function () { + return toPrimitive(this.get()); + }; + return ObservableValue; + }(BaseAtom); + ObservableValue.prototype[primitiveSymbol()] = ObservableValue.prototype.valueOf; + var isObservableValue = createInstanceofPredicate("ObservableValue", ObservableValue); + exports.isBoxedObservable = isObservableValue; + function getAtom(thing, property) { + if ((typeof thing === "undefined" ? "undefined" : _typeof(thing)) === "object" && thing !== null) { + if (isObservableArray(thing)) { + invariant(property === undefined, getMessage("m036")); + return thing.$mobx.atom; + } + if (isObservableMap(thing)) { + var anyThing = thing; + if (property === undefined) return getAtom(anyThing._keys); + var observable_2 = anyThing._data[property] || anyThing._hasMap[property]; + invariant(!!observable_2, "the entry '" + property + "' does not exist in the observable map '" + getDebugName(thing) + "'"); + return observable_2; + } + runLazyInitializers(thing); + if (isObservableObject(thing)) { + if (!property) return fail("please specify a property"); + var observable_3 = thing.$mobx.values[property]; + invariant(!!observable_3, "no observable property '" + property + "' found on the observable object '" + getDebugName(thing) + "'"); + return observable_3; + } + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) { + return thing; + } + } else if (typeof thing === "function") { + if (isReaction(thing.$mobx)) { + return thing.$mobx; + } + } + return fail("Cannot obtain atom from " + thing); + } + function getAdministration(thing, property) { + invariant(thing, "Expecting some object"); + if (property !== undefined) return getAdministration(getAtom(thing, property)); + if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing; + if (isObservableMap(thing)) return thing; + runLazyInitializers(thing); + if (thing.$mobx) return thing.$mobx; + invariant(false, "Cannot obtain administration from " + thing); + } + function getDebugName(thing, property) { + var named; + if (property !== undefined) named = getAtom(thing, property);else if (isObservableObject(thing) || isObservableMap(thing)) named = getAdministration(thing);else named = getAtom(thing); + return named.name; + } + function createClassPropertyDecorator(onInitialize, _get, _set, enumerable, allowCustomArguments) { + function classPropertyDecorator(target, key, descriptor, customArgs, argLen) { + if (argLen === void 0) { + argLen = 0; + } + invariant(allowCustomArguments || quacksLikeADecorator(arguments), "This function is a decorator, but it wasn't invoked like a decorator"); + if (!descriptor) { + var newDescriptor = { + enumerable: enumerable, + configurable: true, + get: function get() { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) typescriptInitializeProperty(this, key, undefined, onInitialize, customArgs, descriptor); + return _get.call(this, key); + }, + set: function set(v) { + if (!this.__mobxInitializedProps || this.__mobxInitializedProps[key] !== true) { + typescriptInitializeProperty(this, key, v, onInitialize, customArgs, descriptor); + } else { + _set.call(this, key, v); + } + } + }; + if (arguments.length < 3 || arguments.length === 5 && argLen < 3) { + Object.defineProperty(target, key, newDescriptor); + } + return newDescriptor; + } else { + if (!hasOwnProperty(target, "__mobxLazyInitializers")) { + addHiddenProp(target, "__mobxLazyInitializers", target.__mobxLazyInitializers && target.__mobxLazyInitializers.slice() || []); + } + var value_1 = descriptor.value, + initializer_1 = descriptor.initializer; + target.__mobxLazyInitializers.push(function (instance) { + onInitialize(instance, key, initializer_1 ? initializer_1.call(instance) : value_1, customArgs, descriptor); + }); + return { + enumerable: enumerable, configurable: true, + get: function get() { + if (this.__mobxDidRunLazyInitializers !== true) runLazyInitializers(this); + return _get.call(this, key); + }, + set: function set(v) { + if (this.__mobxDidRunLazyInitializers !== true) runLazyInitializers(this); + _set.call(this, key, v); + } + }; + } + } + if (allowCustomArguments) { + return function () { + if (quacksLikeADecorator(arguments)) return classPropertyDecorator.apply(null, arguments); + var outerArgs = arguments; + var argLen = arguments.length; + return function (target, key, descriptor) { + return classPropertyDecorator(target, key, descriptor, outerArgs, argLen); + }; + }; + } + return classPropertyDecorator; + } + function typescriptInitializeProperty(instance, key, v, onInitialize, customArgs, baseDescriptor) { + if (!hasOwnProperty(instance, "__mobxInitializedProps")) addHiddenProp(instance, "__mobxInitializedProps", {}); + instance.__mobxInitializedProps[key] = true; + onInitialize(instance, key, v, customArgs, baseDescriptor); + } + function runLazyInitializers(instance) { + if (instance.__mobxDidRunLazyInitializers === true) return; + if (instance.__mobxLazyInitializers) { + addHiddenProp(instance, "__mobxDidRunLazyInitializers", true); + instance.__mobxDidRunLazyInitializers && instance.__mobxLazyInitializers.forEach(function (initializer) { + return initializer(instance); + }); + } + } + function quacksLikeADecorator(args) { + return (args.length === 2 || args.length === 3) && typeof args[1] === "string"; + } + function iteratorSymbol() { + return typeof Symbol === "function" && Symbol.iterator || "@@iterator"; + } + var IS_ITERATING_MARKER = "__$$iterating"; + function arrayAsIterator(array) { + invariant(array[IS_ITERATING_MARKER] !== true, "Illegal state: cannot recycle array as iterator"); + addHiddenFinalProp(array, IS_ITERATING_MARKER, true); + var idx = -1; + addHiddenFinalProp(array, "next", function next() { + idx++; + return { + done: idx >= this.length, + value: idx < this.length ? this[idx] : undefined + }; + }); + return array; + } + function declareIterator(prototType, iteratorFactory) { + addHiddenFinalProp(prototType, iteratorSymbol(), iteratorFactory); + } + var messages = { + "m001": "It is not allowed to assign new values to @action fields", + "m002": "`runInAction` expects a function", + "m003": "`runInAction` expects a function without arguments", + "m004": "autorun expects a function", + "m005": "Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + "m006": "Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.", + "m007": "reaction only accepts 2 or 3 arguments. If migrating from MobX 2, please provide an options object", + "m008": "wrapping reaction expression in `asReference` is no longer supported, use options object instead", + "m009": "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.", + "m010": "@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'", + "m011": "First argument to `computed` should be an expression. If using computed as decorator, don't pass it arguments", + "m012": "computed takes one or two arguments if used as function", + "m013": "[mobx.expr] 'expr' should only be used inside other reactive functions.", + "m014": "extendObservable expected 2 or more arguments", + "m015": "extendObservable expects an object as first argument", + "m016": "extendObservable should not be used on maps, use map.merge instead", + "m017": "all arguments of extendObservable should be objects", + "m018": "extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540", + "m019": "[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.", + "m020": "modifiers can only be used for individual object properties", + "m021": "observable expects zero or one arguments", + "m022": "@observable can not be used on getters, use @computed instead", + "m023": "Using `transaction` is deprecated, use `runInAction` or `(@)action` instead.", + "m024": "whyRun() can only be used if a derivation is active, or by passing an computed value / reaction explicitly. If you invoked whyRun from inside a computation; the computation is currently suspended but re-evaluating because somebody requested its value.", + "m025": "whyRun can only be used on reactions and computed values", + "m026": "`action` can only be invoked on functions", + "m028": "It is not allowed to set `useStrict` when a derivation is running", + "m029": "INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row", + "m030a": "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ", + "m030b": "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ", + "m031": "Computed values are not allowed to not cause side effects by changing observables that are already being observed. Tried to modify: ", + "m032": "* This computation is suspended (not in use by any reaction) and won't run automatically.\n Didn't expect this computation to be suspended at this point?\n 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).", + "m033": "`observe` doesn't support the fire immediately property for observable maps.", + "m034": "`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead", + "m035": "Cannot make the designated object observable; it is not extensible", + "m036": "It is not possible to get index atoms from arrays", + "m037": "Hi there! I'm sorry you have just run into an exception.\nIf your debugger ends up here, know that some reaction (like the render() of an observer component, autorun or reaction)\nthrew an exception and that mobx caught it, to avoid that it brings the rest of your application down.\nThe original cause of the exception (the code that caused this reaction to run (again)), is still in the stack.\n\nHowever, more interesting is the actual stack trace of the error itself.\nHopefully the error is an instanceof Error, because in that case you can inspect the original stack of the error from where it was thrown.\nSee `error.stack` property, or press the very subtle \"(...)\" link you see near the console.error message that probably brought you here.\nThat stack is more interesting than the stack of this console.error itself.\n\nIf the exception you see is an exception you created yourself, make sure to use `throw new Error(\"Oops\")` instead of `throw \"Oops\"`,\nbecause the javascript environment will only preserve the original stack trace in the first form.\n\nYou can also make sure the debugger pauses the next time this very same exception is thrown by enabling \"Pause on caught exception\".\n(Note that it might pause on many other, unrelated exception as well).\n\nIf that all doesn't help you out, feel free to open an issue https://github.com/mobxjs/mobx/issues!\n", + "m038": "Missing items in this list?\n 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n" + }; + function getMessage(id) { + return messages[id]; + } + var EMPTY_ARRAY = []; + Object.freeze(EMPTY_ARRAY); + function getGlobal() { + return global; + } + function getNextId() { + return ++globalState.mobxGuid; + } + function fail(message, thing) { + invariant(false, message, thing); + throw "X"; + } + function invariant(check, message, thing) { + if (!check) throw new Error("[mobx] Invariant failed: " + message + (thing ? " in '" + thing + "'" : "")); + } + var deprecatedMessages = []; + function deprecated(msg) { + if (deprecatedMessages.indexOf(msg) !== -1) return false; + deprecatedMessages.push(msg); + console.error("[mobx] Deprecated: " + msg); + return true; + } + function once(func) { + var invoked = false; + return function () { + if (invoked) return; + invoked = true; + return func.apply(this, arguments); + }; + } + var noop = function noop() {}; + function unique(list) { + var res = []; + list.forEach(function (item) { + if (res.indexOf(item) === -1) res.push(item); + }); + return res; + } + function joinStrings(things, limit, separator) { + if (limit === void 0) { + limit = 100; + } + if (separator === void 0) { + separator = " - "; + } + if (!things) return ""; + var sliced = things.slice(0, limit); + return "" + sliced.join(separator) + (things.length > limit ? " (... and " + (things.length - limit) + "more)" : ""); + } + function isObject(value) { + return value !== null && (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object"; + } + function isPlainObject(value) { + if (value === null || (typeof value === "undefined" ? "undefined" : _typeof(value)) !== "object") return false; + var proto = Object.getPrototypeOf(value); + return proto === Object.prototype || proto === null; + } + function objectAssign() { + var res = arguments[0]; + for (var i = 1, l = arguments.length; i < l; i++) { + var source = arguments[i]; + for (var key in source) { + if (hasOwnProperty(source, key)) { + res[key] = source[key]; + } + } + } + return res; + } + function valueDidChange(compareStructural, oldValue, newValue) { + if (typeof oldValue === 'number' && isNaN(oldValue)) { + return typeof newValue !== 'number' || !isNaN(newValue); + } + return compareStructural ? !deepEqual(oldValue, newValue) : oldValue !== newValue; + } + var prototypeHasOwnProperty = Object.prototype.hasOwnProperty; + function hasOwnProperty(object, propName) { + return prototypeHasOwnProperty.call(object, propName); + } + function makeNonEnumerable(object, propNames) { + for (var i = 0; i < propNames.length; i++) { + addHiddenProp(object, propNames[i], object[propNames[i]]); + } + } + function addHiddenProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: true, + configurable: true, + value: value + }); + } + function addHiddenFinalProp(object, propName, value) { + Object.defineProperty(object, propName, { + enumerable: false, + writable: false, + configurable: true, + value: value + }); + } + function isPropertyConfigurable(object, prop) { + var descriptor = Object.getOwnPropertyDescriptor(object, prop); + return !descriptor || descriptor.configurable !== false && descriptor.writable !== false; + } + function assertPropertyConfigurable(object, prop) { + invariant(isPropertyConfigurable(object, prop), "Cannot make property '" + prop + "' observable, it is not configurable and writable in the target object"); + } + function getEnumerableKeys(obj) { + var res = []; + for (var key in obj) { + res.push(key); + }return res; + } + function deepEqual(a, b) { + if (a === null && b === null) return true; + if (a === undefined && b === undefined) return true; + if ((typeof a === "undefined" ? "undefined" : _typeof(a)) !== "object") return a === b; + var aIsArray = isArrayLike(a); + var aIsMap = isMapLike(a); + if (aIsArray !== isArrayLike(b)) { + return false; + } else if (aIsMap !== isMapLike(b)) { + return false; + } else if (aIsArray) { + if (a.length !== b.length) return false; + for (var i = a.length - 1; i >= 0; i--) { + if (!deepEqual(a[i], b[i])) return false; + }return true; + } else if (aIsMap) { + if (a.size !== b.size) return false; + var equals_1 = true; + a.forEach(function (value, key) { + equals_1 = equals_1 && deepEqual(b.get(key), value); + }); + return equals_1; + } else if ((typeof a === "undefined" ? "undefined" : _typeof(a)) === "object" && (typeof b === "undefined" ? "undefined" : _typeof(b)) === "object") { + if (a === null || b === null) return false; + if (isMapLike(a) && isMapLike(b)) { + if (a.size !== b.size) return false; + return deepEqual(observable.shallowMap(a).entries(), observable.shallowMap(b).entries()); + } + if (getEnumerableKeys(a).length !== getEnumerableKeys(b).length) return false; + for (var prop in a) { + if (!(prop in b)) return false; + if (!deepEqual(a[prop], b[prop])) return false; + } + return true; + } + return false; + } + function createInstanceofPredicate(name, clazz) { + var propName = "isMobX" + name; + clazz.prototype[propName] = true; + return function (x) { + return isObject(x) && x[propName] === true; + }; + } + function isArrayLike(x) { + return Array.isArray(x) || isObservableArray(x); + } + exports.isArrayLike = isArrayLike; + function isMapLike(x) { + return isES6Map(x) || isObservableMap(x); + } + function isES6Map(thing) { + if (getGlobal().Map !== undefined && thing instanceof getGlobal().Map) return true; + return false; + } + function primitiveSymbol() { + return typeof Symbol === "function" && Symbol.toPrimitive || "@@toPrimitive"; + } + function toPrimitive(value) { + return value === null ? null : (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" ? "" + value : value; + } + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) + + /***/ }), + /* 2 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + + var _icons = __webpack_require__(6); + + var _constants = __webpack_require__(0); + + function renderHeader(_ref, instance) { + var meta = _ref.meta, + user = _ref.user, + reactions = _ref.reactions; + + var container = document.createElement('div'); + container.lang = "en-US"; + container.className = 'gitment-container gitment-header-container'; + + var likeButton = document.createElement('span'); + var likedReaction = reactions.find(function (reaction) { + return reaction.content === 'heart' && reaction.user.login === user.login; + }); + likeButton.className = 'gitment-header-like-btn'; + likeButton.innerHTML = '\n ' + _icons.heart + '\n ' + (likedReaction ? 'Unlike' : 'Like') + '\n ' + (meta.reactions && meta.reactions.heart ? ' \u2022 ' + meta.reactions.heart + ' Liked' : '') + '\n '; + + if (likedReaction) { + likeButton.classList.add('liked'); + likeButton.onclick = function () { + return instance.unlike(); + }; + } else { + likeButton.classList.remove('liked'); + likeButton.onclick = function () { + return instance.like(); + }; + } + container.appendChild(likeButton); + + var commentsCount = document.createElement('span'); + commentsCount.innerHTML = '\n ' + (meta.comments ? ' \u2022 ' + meta.comments + ' Comments' : '') + '\n '; + container.appendChild(commentsCount); + + var issueLink = document.createElement('a'); + issueLink.className = 'gitment-header-issue-link'; + issueLink.href = meta.html_url; + issueLink.target = '_blank'; + issueLink.innerText = 'Issue Page'; + container.appendChild(issueLink); + + return container; + } + + function renderComments(_ref2, instance) { + var meta = _ref2.meta, + comments = _ref2.comments, + commentReactions = _ref2.commentReactions, + currentPage = _ref2.currentPage, + user = _ref2.user, + error = _ref2.error; + + var container = document.createElement('div'); + container.lang = "en-US"; + container.className = 'gitment-container gitment-comments-container'; + + if (error) { + var errorBlock = document.createElement('div'); + errorBlock.className = 'gitment-comments-error'; + + if (error === _constants.NOT_INITIALIZED_ERROR && user.login && user.login.toLowerCase() === instance.owner.toLowerCase()) { + var initHint = document.createElement('div'); + var initButton = document.createElement('button'); + initButton.className = 'gitment-comments-init-btn'; + initButton.onclick = function () { + initButton.setAttribute('disabled', true); + instance.init().catch(function (e) { + initButton.removeAttribute('disabled'); + alert(e); + }); + }; + initButton.innerText = 'Initialize Comments'; + initHint.appendChild(initButton); + errorBlock.appendChild(initHint); + } else { + errorBlock.innerText = error; + } + container.appendChild(errorBlock); + return container; + } else if (comments === undefined) { + var loading = document.createElement('div'); + loading.innerText = 'Loading comments...'; + loading.className = 'gitment-comments-loading'; + container.appendChild(loading); + return container; + } else if (!comments.length) { + var emptyBlock = document.createElement('div'); + emptyBlock.className = 'gitment-comments-empty'; + emptyBlock.innerText = 'No Comment Yet'; + container.appendChild(emptyBlock); + return container; + } + + var commentsList = document.createElement('ul'); + commentsList.className = 'gitment-comments-list'; + + comments.forEach(function (comment) { + var createDate = new Date(comment.created_at); + var updateDate = new Date(comment.updated_at); + var commentItem = document.createElement('li'); + commentItem.className = 'gitment-comment'; + commentItem.innerHTML = '\n \n \n \n
                \n
                \n \n ' + comment.user.login + '\n \n commented on\n ' + createDate.toDateString() + '\n ' + (createDate.toString() !== updateDate.toString() ? ' \u2022 edited' : '') + '\n
                ' + _icons.heart + ' ' + (comment.reactions.heart || '') + '
                \n
                \n
                ' + comment.body_html + '
                \n
                \n '; + var likeButton = commentItem.querySelector('.gitment-comment-like-btn'); + var likedReaction = commentReactions[comment.id] && commentReactions[comment.id].find(function (reaction) { + return reaction.content === 'heart' && reaction.user.login === user.login; + }); + if (likedReaction) { + likeButton.classList.add('liked'); + likeButton.onclick = function () { + return instance.unlikeAComment(comment.id); + }; + } else { + likeButton.classList.remove('liked'); + likeButton.onclick = function () { + return instance.likeAComment(comment.id); + }; + } + + // dirty + // use a blank image to trigger height calculating when element rendered + var imgTrigger = document.createElement('img'); + var markdownBody = commentItem.querySelector('.gitment-comment-body'); + imgTrigger.className = 'gitment-hidden'; + imgTrigger.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; + imgTrigger.onload = function () { + if (markdownBody.clientHeight > instance.maxCommentHeight) { + markdownBody.classList.add('gitment-comment-body-folded'); + markdownBody.style.maxHeight = instance.maxCommentHeight + 'px'; + markdownBody.title = 'Click to Expand'; + markdownBody.onclick = function () { + markdownBody.classList.remove('gitment-comment-body-folded'); + markdownBody.style.maxHeight = ''; + markdownBody.title = ''; + markdownBody.onclick = null; + }; + } + }; + commentItem.appendChild(imgTrigger); + + commentsList.appendChild(commentItem); + }); + + container.appendChild(commentsList); + + if (meta) { + var pageCount = Math.ceil(meta.comments / instance.perPage); + if (pageCount > 1) { + var pagination = document.createElement('ul'); + pagination.className = 'gitment-comments-pagination'; + + if (currentPage > 1) { + var previousButton = document.createElement('li'); + previousButton.className = 'gitment-comments-page-item'; + previousButton.innerText = 'Previous'; + previousButton.onclick = function () { + return instance.goto(currentPage - 1); + }; + pagination.appendChild(previousButton); + } + + var _loop = function _loop(i) { + var pageItem = document.createElement('li'); + pageItem.className = 'gitment-comments-page-item'; + pageItem.innerText = i; + pageItem.onclick = function () { + return instance.goto(i); + }; + if (currentPage === i) pageItem.classList.add('gitment-selected'); + pagination.appendChild(pageItem); + }; + + for (var i = 1; i <= pageCount; i++) { + _loop(i); + } + + if (currentPage < pageCount) { + var nextButton = document.createElement('li'); + nextButton.className = 'gitment-comments-page-item'; + nextButton.innerText = 'Next'; + nextButton.onclick = function () { + return instance.goto(currentPage + 1); + }; + pagination.appendChild(nextButton); + } + + container.appendChild(pagination); + } + } + + return container; + } + + function renderEditor(_ref3, instance) { + var user = _ref3.user, + error = _ref3.error; + + var container = document.createElement('div'); + container.lang = "en-US"; + container.className = 'gitment-container gitment-editor-container'; + + var shouldDisable = user.login && !error ? '' : 'disabled'; + var disabledTip = user.login ? '' : 'Login to Comment'; + container.innerHTML = '\n ' + (user.login ? '\n \n ' : user.isLoggingIn ? '
                ' + _icons.spinner + '
                ' : '\n ' + _icons.github + '\n ') + '\n \n
                \n
                \n \n \n
                \n
                \n
                \n \n
                \n
                \n
                \n
                \n
                \n
                \n \n '; + if (user.login) { + container.querySelector('.gitment-editor-logout-link').onclick = function () { + return instance.logout(); + }; + } + + var writeField = container.querySelector('.gitment-editor-write-field'); + var previewField = container.querySelector('.gitment-editor-preview-field'); + + var textarea = writeField.querySelector('textarea'); + textarea.oninput = function () { + textarea.style.height = 'auto'; + var style = window.getComputedStyle(textarea, null); + var height = parseInt(style.height, 10); + var clientHeight = textarea.clientHeight; + var scrollHeight = textarea.scrollHeight; + if (clientHeight < scrollHeight) { + textarea.style.height = height + scrollHeight - clientHeight + 'px'; + } + }; + + var _container$querySelec = container.querySelectorAll('.gitment-editor-tab'), + _container$querySelec2 = _slicedToArray(_container$querySelec, 2), + writeTab = _container$querySelec2[0], + previewTab = _container$querySelec2[1]; + + writeTab.onclick = function () { + writeTab.classList.add('gitment-selected'); + previewTab.classList.remove('gitment-selected'); + writeField.classList.remove('gitment-hidden'); + previewField.classList.add('gitment-hidden'); + + textarea.focus(); + }; + previewTab.onclick = function () { + previewTab.classList.add('gitment-selected'); + writeTab.classList.remove('gitment-selected'); + previewField.classList.remove('gitment-hidden'); + writeField.classList.add('gitment-hidden'); + + var preview = previewField.querySelector('.gitment-editor-preview'); + var content = textarea.value.trim(); + if (!content) { + preview.innerText = 'Nothing to preview'; + return; + } + + preview.innerText = 'Loading preview...'; + instance.markdown(content).then(function (html) { + return preview.innerHTML = html; + }); + }; + + var submitButton = container.querySelector('.gitment-editor-submit'); + submitButton.onclick = function () { + submitButton.innerText = 'Submitting...'; + submitButton.setAttribute('disabled', true); + instance.post(textarea.value.trim()).then(function (data) { + textarea.value = ''; + textarea.style.height = 'auto'; + submitButton.removeAttribute('disabled'); + submitButton.innerText = 'Comment'; + }).catch(function (e) { + alert(e); + submitButton.removeAttribute('disabled'); + submitButton.innerText = 'Comment'; + }); + }; + + return container; + } + + function renderFooter() { + var container = document.createElement('div'); + container.lang = "en-US"; + container.className = 'gitment-container gitment-footer-container'; + container.innerHTML = '\n Powered by\n \n Gitment\n \n '; + return container; + } + + function render(state, instance) { + var container = document.createElement('div'); + container.lang = "en-US"; + container.className = 'gitment-container gitment-root-container'; + container.appendChild(instance.renderHeader(state, instance)); + container.appendChild(instance.renderComments(state, instance)); + container.appendChild(instance.renderEditor(state, instance)); + container.appendChild(instance.renderFooter(state, instance)); + return container; + } + + exports.default = { render: render, renderHeader: renderHeader, renderComments: renderComments, renderEditor: renderEditor, renderFooter: renderFooter }; + + /***/ }), + /* 3 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.http = exports.Query = exports.isString = undefined; + + var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + + exports.getTargetContainer = getTargetContainer; + + var _constants = __webpack_require__(0); + + var isString = exports.isString = function isString(s) { + return toString.call(s) === '[object String]'; + }; + + function getTargetContainer(container) { + var targetContainer = void 0; + if (container instanceof Element) { + targetContainer = container; + } else if (isString(container)) { + targetContainer = document.getElementById(container); + } else { + targetContainer = document.createElement('div'); + } + + return targetContainer; + } + + var Query = exports.Query = { + parse: function parse() { + var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.search; + + if (!search) return {}; + var queryString = search[0] === '?' ? search.substring(1) : search; + var query = {}; + queryString.split('&').forEach(function (queryStr) { + var _queryStr$split = queryStr.split('='), + _queryStr$split2 = _slicedToArray(_queryStr$split, 2), + key = _queryStr$split2[0], + value = _queryStr$split2[1]; + + if (key) query[key] = value; + }); + + return query; + }, + stringify: function stringify(query) { + var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '?'; + + var queryString = Object.keys(query).map(function (key) { + return key + '=' + encodeURIComponent(query[key] || ''); + }).join('&'); + return queryString ? prefix + queryString : ''; + } + }; + + function ajaxFactory(method) { + return function (apiPath) { + var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'https://api.github.com'; + + var req = new XMLHttpRequest(); + var token = localStorage.getItem(_constants.LS_ACCESS_TOKEN_KEY); + + var url = '' + base + apiPath; + var body = null; + if (method === 'GET' || method === 'DELETE') { + url += Query.stringify(data); + } + + var p = new Promise(function (resolve, reject) { + req.addEventListener('load', function () { + var contentType = req.getResponseHeader('content-type'); + var res = req.responseText; + if (!/json/.test(contentType)) { + resolve(res); + return; + } + var data = req.responseText ? JSON.parse(res) : {}; + if (data.message) { + reject(new Error(data.message)); + } else { + resolve(data); + } + }); + req.addEventListener('error', function (error) { + return reject(error); + }); + }); + req.open(method, url, true); + + req.setRequestHeader('Accept', 'application/vnd.github.squirrel-girl-preview, application/vnd.github.html+json'); + if (token) { + req.setRequestHeader('Authorization', 'token ' + token); + } + if (method !== 'GET' && method !== 'DELETE') { + body = JSON.stringify(data); + req.setRequestHeader('Content-Type', 'application/json'); + } + + req.send(body); + return p; + }; + } + + var http = exports.http = { + get: ajaxFactory('GET'), + post: ajaxFactory('POST'), + delete: ajaxFactory('DELETE'), + put: ajaxFactory('PUT') + }; + + /***/ }), + /* 4 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var g; + +// This works in non-strict mode + g = function () { + return this; + }(); + + try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1, eval)("this"); + } catch (e) { + // This works if the window reference is available + if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window; + } + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + + module.exports = g; + + /***/ }), + /* 5 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _mobx = __webpack_require__(1); + + var _constants = __webpack_require__(0); + + var _utils = __webpack_require__(3); + + var _default = __webpack_require__(2); + + var _default2 = _interopRequireDefault(_default); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var scope = 'public_repo'; + + function extendRenderer(instance, renderer) { + instance[renderer] = function (container) { + var targetContainer = (0, _utils.getTargetContainer)(container); + var render = instance.theme[renderer] || instance.defaultTheme[renderer]; + + (0, _mobx.autorun)(function () { + var e = render(instance.state, instance); + if (targetContainer.firstChild) { + targetContainer.replaceChild(e, targetContainer.firstChild); + } else { + targetContainer.appendChild(e); + } + }); + + return targetContainer; + }; + } + + var Gitment = function () { + _createClass(Gitment, [{ + key: 'accessToken', + get: function get() { + return localStorage.getItem(_constants.LS_ACCESS_TOKEN_KEY); + }, + set: function set(token) { + localStorage.setItem(_constants.LS_ACCESS_TOKEN_KEY, token); + } + }, { + key: 'loginLink', + get: function get() { + var oauthUri = 'https://github.com/login/oauth/authorize'; + var redirect_uri = this.oauth.redirect_uri || window.location.href; + + var oauthParams = Object.assign({ + scope: scope, + redirect_uri: redirect_uri + }, this.oauth); + + return '' + oauthUri + _utils.Query.stringify(oauthParams); + } + }]); + + function Gitment() { + var _this = this; + + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, Gitment); + + this.defaultTheme = _default2.default; + this.useTheme(_default2.default); + + Object.assign(this, { + id: window.location.href, + title: window.document.title, + link: window.location.href, + desc: '', + labels: [], + theme: _default2.default, + oauth: {}, + perPage: 20, + maxCommentHeight: 250 + }, options); + + this.useTheme(this.theme); + + var user = {}; + try { + var userInfo = localStorage.getItem(_constants.LS_USER_KEY); + if (this.accessToken && userInfo) { + Object.assign(user, JSON.parse(userInfo), { + fromCache: true + }); + } + } catch (e) { + localStorage.removeItem(_constants.LS_USER_KEY); + } + + this.state = (0, _mobx.observable)({ + user: user, + error: null, + meta: {}, + comments: undefined, + reactions: [], + commentReactions: {}, + currentPage: 1 + }); + + var query = _utils.Query.parse(); + if (query.code) { + var _oauth = this.oauth, + client_id = _oauth.client_id, + client_secret = _oauth.client_secret; + + var code = query.code; + delete query.code; + var search = _utils.Query.stringify(query); + var replacedUrl = '' + window.location.origin + window.location.pathname + search + window.location.hash; + history.replaceState({}, '', replacedUrl); + + Object.assign(this, { + id: replacedUrl, + link: replacedUrl + }, options); + + this.state.user.isLoggingIn = true; + _utils.http.post('https://gh-oauth.imsun.net', { + code: code, + client_id: client_id, + client_secret: client_secret + }, '').then(function (data) { + _this.accessToken = data.access_token; + _this.update(); + }).catch(function (e) { + _this.state.user.isLoggingIn = false; + alert(e); + }); + } else { + this.update(); + } + } + + _createClass(Gitment, [{ + key: 'init', + value: function init() { + var _this2 = this; + + return this.createIssue().then(function () { + return _this2.loadComments(); + }).then(function (comments) { + _this2.state.error = null; + return comments; + }); + } + }, { + key: 'useTheme', + value: function useTheme() { + var _this3 = this; + + var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.theme = theme; + + var renderers = Object.keys(this.theme); + renderers.forEach(function (renderer) { + return extendRenderer(_this3, renderer); + }); + } + }, { + key: 'update', + value: function update() { + var _this4 = this; + + return Promise.all([this.loadMeta(), this.loadUserInfo()]).then(function () { + return Promise.all([_this4.loadComments().then(function () { + return _this4.loadCommentReactions(); + }), _this4.loadReactions()]); + }).catch(function (e) { + return _this4.state.error = e; + }); + } + }, { + key: 'markdown', + value: function markdown(text) { + return _utils.http.post('/markdown', { + text: text, + mode: 'gfm' + }); + } + }, { + key: 'createIssue', + value: function createIssue() { + var _this5 = this; + + var id = this.id, + owner = this.owner, + repo = this.repo, + title = this.title, + link = this.link, + desc = this.desc, + labels = this.labels; + + + return _utils.http.post('/repos/' + owner + '/' + repo + '/issues', { + title: title, + labels: labels.concat(['gitment', id]), + body: link + '\n\n' + desc + }).then(function (meta) { + _this5.state.meta = meta; + return meta; + }); + } + }, { + key: 'getIssue', + value: function getIssue() { + if (this.state.meta.id) return Promise.resolve(this.state.meta); + + return this.loadMeta(); + } + }, { + key: 'post', + value: function post(body) { + var _this6 = this; + + return this.getIssue().then(function (issue) { + return _utils.http.post(issue.comments_url, { body: body }, ''); + }).then(function (data) { + _this6.state.meta.comments++; + var pageCount = Math.ceil(_this6.state.meta.comments / _this6.perPage); + if (_this6.state.currentPage === pageCount) { + _this6.state.comments.push(data); + } + return data; + }); + } + }, { + key: 'loadMeta', + value: function loadMeta() { + var _this7 = this; + + var id = this.id, + owner = this.owner, + repo = this.repo; + + return _utils.http.get('/repos/' + owner + '/' + repo + '/issues', { + creator: owner, + labels: id + }).then(function (issues) { + if (!issues.length) return Promise.reject(_constants.NOT_INITIALIZED_ERROR); + _this7.state.meta = issues[0]; + return issues[0]; + }); + } + }, { + key: 'loadComments', + value: function loadComments() { + var _this8 = this; + + var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state.currentPage; + + return this.getIssue().then(function (issue) { + return _utils.http.get(issue.comments_url, { page: page, per_page: _this8.perPage }, ''); + }).then(function (comments) { + _this8.state.comments = comments; + return comments; + }); + } + }, { + key: 'loadUserInfo', + value: function loadUserInfo() { + var _this9 = this; + + if (!this.accessToken) { + this.logout(); + return Promise.resolve({}); + } + + return _utils.http.get('/user').then(function (user) { + _this9.state.user = user; + localStorage.setItem(_constants.LS_USER_KEY, JSON.stringify(user)); + return user; + }); + } + }, { + key: 'loadReactions', + value: function loadReactions() { + var _this10 = this; + + if (!this.accessToken) { + this.state.reactions = []; + return Promise.resolve([]); + } + + return this.getIssue().then(function (issue) { + if (!issue.reactions.total_count) return []; + return _utils.http.get(issue.reactions.url, {}, ''); + }).then(function (reactions) { + _this10.state.reactions = reactions; + return reactions; + }); + } + }, { + key: 'loadCommentReactions', + value: function loadCommentReactions() { + var _this11 = this; + + if (!this.accessToken) { + this.state.commentReactions = {}; + return Promise.resolve([]); + } + + var comments = this.state.comments; + var comentReactions = {}; + + return Promise.all(comments.map(function (comment) { + if (!comment.reactions.total_count) return []; + + var owner = _this11.owner, + repo = _this11.repo; + + return _utils.http.get('/repos/' + owner + '/' + repo + '/issues/comments/' + comment.id + '/reactions', {}); + })).then(function (reactionsArray) { + comments.forEach(function (comment, index) { + comentReactions[comment.id] = reactionsArray[index]; + }); + _this11.state.commentReactions = comentReactions; + + return comentReactions; + }); + } + }, { + key: 'login', + value: function login() { + window.location.href = this.loginLink; + } + }, { + key: 'logout', + value: function logout() { + localStorage.removeItem(_constants.LS_ACCESS_TOKEN_KEY); + localStorage.removeItem(_constants.LS_USER_KEY); + this.state.user = {}; + } + }, { + key: 'goto', + value: function goto(page) { + this.state.currentPage = page; + this.state.comments = undefined; + return this.loadComments(page); + } + }, { + key: 'like', + value: function like() { + var _this12 = this; + + if (!this.accessToken) { + alert('Login to Like'); + return Promise.reject(); + } + + var owner = this.owner, + repo = this.repo; + + + return _utils.http.post('/repos/' + owner + '/' + repo + '/issues/' + this.state.meta.number + '/reactions', { + content: 'heart' + }).then(function (reaction) { + _this12.state.reactions.push(reaction); + _this12.state.meta.reactions.heart++; + }); + } + }, { + key: 'unlike', + value: function unlike() { + var _this13 = this; + + if (!this.accessToken) return Promise.reject(); + + var _state = this.state, + user = _state.user, + reactions = _state.reactions; + + var index = reactions.findIndex(function (reaction) { + return reaction.user.login === user.login; + }); + return _utils.http.delete('/reactions/' + reactions[index].id).then(function () { + reactions.splice(index, 1); + _this13.state.meta.reactions.heart--; + }); + } + }, { + key: 'likeAComment', + value: function likeAComment(commentId) { + var _this14 = this; + + if (!this.accessToken) { + alert('Login to Like'); + return Promise.reject(); + } + + var owner = this.owner, + repo = this.repo; + + var comment = this.state.comments.find(function (comment) { + return comment.id === commentId; + }); + + return _utils.http.post('/repos/' + owner + '/' + repo + '/issues/comments/' + commentId + '/reactions', { + content: 'heart' + }).then(function (reaction) { + _this14.state.commentReactions[commentId].push(reaction); + comment.reactions.heart++; + }); + } + }, { + key: 'unlikeAComment', + value: function unlikeAComment(commentId) { + if (!this.accessToken) return Promise.reject(); + + var reactions = this.state.commentReactions[commentId]; + var comment = this.state.comments.find(function (comment) { + return comment.id === commentId; + }); + var user = this.state.user; + + var index = reactions.findIndex(function (reaction) { + return reaction.user.login === user.login; + }); + + return _utils.http.delete('/reactions/' + reactions[index].id).then(function () { + reactions.splice(index, 1); + comment.reactions.heart--; + }); + } + }]); + + return Gitment; + }(); + + module.exports = Gitment; + + /***/ }), + /* 6 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /** + * Modified from https://github.com/evil-icons/evil-icons + */ + + var close = exports.close = ''; + var github = exports.github = ''; + var heart = exports.heart = ''; + var spinner = exports.spinner = ''; + + /***/ }) + /******/ ]); +//# sourceMappingURL=gitment.browser.js.map \ No newline at end of file diff --git a/js/index.js b/js/index.js new file mode 100644 index 00000000..faec5217 --- /dev/null +++ b/js/index.js @@ -0,0 +1,367 @@ +/** + * Created by Xiaotao.Nie on 09/04/2018. + * All right reserved + * IF you have any question please email onlythen@yeah.net + */ + +// Global functions and listeners +window.onresize = () => { + // when window resize , we show remove some class that me be added + // often for debug + if(window.document.documentElement.clientWidth > 680){ + let aboutContent = document.getElementById('nav-content') + aboutContent.classList.remove('hide-block') + aboutContent.classList.remove('show-block'); + } + // if(window.isPost){ + // reLayout() + // } + + reHeightToc(); +}; + +// Nav switch function on mobile +/*****************************************************************************/ +const navToggle = document.getElementById('site-nav-toggle'); +navToggle.addEventListener('click', () => { + let aboutContent = document.getElementById('nav-content') + if (!aboutContent.classList.contains('show-block')) { + aboutContent.classList.add('show-block'); + aboutContent.classList.remove('hide-block') + } else { + aboutContent.classList.add('hide-block') + aboutContent.classList.remove('show-block'); + } +}) + + +// global search +/*****************************************************************************/ + +const searchButton = document.getElementById('search') +const searchField = document.getElementById('search-field') +const searchInput = document.getElementById('search-input') +const searchResultContainer = document.getElementById('search-result-container') +const escSearch = document.getElementById('esc-search') +const beginSearch = document.getElementById('begin-search') + +searchField.addEventListener('mousewheel',(e) => { + // e.preventDefault() + e.stopPropagation() + return false +}, false) + +var searchJson; +var caseSensitive = false + +searchButton.addEventListener('click', () => { + search() +}); + +escSearch.addEventListener('click',() => { + hideSearchField() +}) + +beginSearch.addEventListener('click',() => { + let keyword = searchInput.value; + if(keyword){ + searchFromKeyWord(keyword) + } +}) + +function toggleSeachField(){ + if (!searchField.classList.contains('show-flex-fade')) { + showSearchField() + } else { + hideSearchField() + } +} + +function showSearchField() { + searchInput.focus() + searchField.classList.add('show-flex-fade'); + searchField.classList.remove('hide-flex-fade'); +} + +function hideSearchField(){ + window.onkeydown = null; + searchField.classList.add('hide-flex-fade'); + searchField.classList.remove('show-flex-fade'); +} + +function searchFromKeyWord(keyword = ""){ + let result = []; + + let sildeWindowSize = 100; + + let handleKeyword = keyword + + if(!caseSensitive){ + handleKeyword = keyword.toLowerCase() + } + if(!searchJson) return -1; + else { + searchJson.forEach((item) => { + + if(!item.title || !item.content) return 0; // break + + let title = item.title + let content = item.content.trim().replace(/<[^>]+>/g,"").replace(/[`#\n]/g,""); + + let lowerTitle = title,lowerContent = content; + + if(!caseSensitive){ + lowerTitle = title.toLowerCase(); + lowerContent = content.toLowerCase(); + } + + + if(lowerTitle.indexOf(handleKeyword) !== -1 || lowerContent.indexOf(handleKeyword) !== -1){ + let resultItem = {} + resultItem.title = title.replace(keyword, "" + keyword + ''); + resultItem.url = item.url; + + resultItem.content = []; + + let lastend = 0 + + while(lowerContent.indexOf(handleKeyword) !== -1){ + let begin = lowerContent.indexOf(handleKeyword) - sildeWindowSize / 2 < 0 ? 0 : lowerContent.indexOf(handleKeyword) - sildeWindowSize / 2 + let end = begin + sildeWindowSize; + let reg = caseSensitive ? new RegExp('('+keyword+')','g') : new RegExp('('+keyword+')','ig') + resultItem.content.push("..." + content.slice(lastend + begin, lastend + end).replace(reg, "$1") + "...") + lowerContent = lowerContent.slice(end, lowerContent.length) + lastend = end + } + // resultItem.title = title.replace(keyword, "" + keyword + ''); + result.push(resultItem) + } + }) + } + + if(!result.length){ + searchResultContainer.innerHTML = ` +
                No Result
                + ` + return; + } + + let searchFragment = document.createElement('ul') + + for(let item of result){ + let searchItem = document.createElement('li'); + let searchTitle = document.createElement('a'); + searchTitle.href = item.url + searchTitle.innerHTML = item.title; + searchItem.appendChild(searchTitle) + if(item.content.length) { + let searchContentLiContainer = document.createElement('ul') + for (let citem of item.content) { + let searchContentFragment = document.createElement('li') + searchContentFragment.innerHTML = citem; + searchContentLiContainer.appendChild(searchContentFragment) + } + searchItem.appendChild(searchContentLiContainer) + } + searchFragment.appendChild(searchItem) + } + while(searchResultContainer.firstChild){ + searchResultContainer.removeChild(searchResultContainer.firstChild) + } + searchResultContainer.appendChild(searchFragment) +} + +function search(){ + + toggleSeachField() + + window.onkeydown = (e) => { + if (e.which === 27) { + /** 这里编写当ESC按下时的处理逻辑! */ + toggleSeachField() + } else if(e.which === 13){ + // 回车按下 + let keyword = searchInput.value; + if(keyword){ + searchFromKeyWord(keyword) + } + } + } + + + if(!searchJson){ + let isXml; + let search_path = window.hexo_search_path; + if (search_path.length === 0) { + search_path = "search.json"; + } else if (/json$/i.test(search_path)) { + isXml = false; + } + let path = window.hexo_root+ search_path; + $.ajax({ + url: path, + dataType: isXml ? "xml" : "json", + async: true, + success: function (res) { + searchJson = isXml ? $("entry", res).map(function() { + return { + title: $("title", this).text(), + content: $("content",this).text(), + url: $("url" , this).text() + }; + }).get() : res; + } + }); + } + +} + +// directory function in post pages +/*****************************************************************************/ +function getDistanceOfLeft(obj) { + let left = 0; + let top = 0; + while (obj) { + left += obj.offsetLeft; + top += obj.offsetTop; + obj = obj.offsetParent; + } + return { + left:left, + top:top + }; +} + +var toc = document.getElementById('toc') + +var tocToTop = getDistanceOfLeft(toc).top; + +function reHeightToc(){ + if(toc) { // resize toc height + toc.style.height = ( document.documentElement.clientHeight - 10 ) + 'px'; + toc.style.overflowY = 'scroll'; + } +} + +reHeightToc(); + +if(window.isPost){ + var result = [] + + var nameSet = new Set(); + + if(!toc || !toc.children || !toc.children[0]){ + // do nothing + } + else { + if (toc.children[0].nodeName === "OL") { + let ol = Array.from(toc.children[0].children) + + function getArrayFromOl(ol) { + let result = [] + + // let escape = function (item) { + // return item.replace(/<[^>]+>/g, "").replace(/^\s\s*/, '').replace(/\s\s*$/, '').replace(/[\. _]/g, '-') + // } + + ol.forEach((item) => { + if (item.children.length === 1) { + // TODO: need change + let value = item.children[0].getAttribute('href').replace(/^#/,"") + result.push({ + value: [value], + dom: item + }) + nameSet.add(value) + } + else { + let concatArray = getArrayFromOl(Array.from(item.children[1].children)) + nameSet.add(item.children[0].getAttribute('href').replace(/^#/,"")) + result.push({ + value: [item.children[0].getAttribute('href').replace(/^#/,"")].concat(concatArray.reduce((p, n) => { + p = p.concat(n.value) + return p; + }, [])), + dom: item + }) + result = result.concat(concatArray) + } + }) + return result + } + + result = getArrayFromOl(ol) + } + + var nameArray = Array.from(nameSet) + + function reLayout() { + let scrollToTop = document.documentElement.scrollTop || window.pageYOffset // Safari is special + if(tocToTop === 0) { + // Fix bug that when resize window the toc layout may be wrong + toc = document.getElementById('toc') + toc.classList.remove('toc-fixed') + tocToTop = getDistanceOfLeft(toc).top; + } + if (tocToTop <= scrollToTop + 10) { + if (!toc.classList.contains('toc-fixed')) + toc.classList.add('toc-fixed') + } else { + if (toc.classList.contains('toc-fixed')) + toc.classList.remove('toc-fixed') + } + + let minTop = 9999; + let minTopsValue = "" + + for (let item of nameArray) { + let dom = document.getElementById(item) || document.getElementById(item.replace(/\s/g, '')) + if (!dom) continue + let toTop = getDistanceOfLeft(dom).top - scrollToTop; + + if (Math.abs(toTop) < minTop) { + minTop = Math.abs(toTop) + minTopsValue = item + } + + // console.log(minTopsValue, minTop) + } + + if (minTopsValue) { + for (let item of result) { + if (item.value.indexOf(minTopsValue) !== -1) { + item.dom.classList.add("active") + } else { + item.dom.classList.remove("active") + } + } + } + } + + reLayout() + + window.addEventListener('scroll', (e) => { + reLayout() + }) + } +} + + +// donate +/*****************************************************************************/ +const donateButton = document.getElementById('donate-button') +const donateImgContainer = document.getElementById('donate-img-container') +const donateImg = document.getElementById('donate-img') + +if(donateButton) { + donateButton.addEventListener('click', () => { + if (donateImgContainer.classList.contains('hide')) { + donateImgContainer.classList.remove('hide') + } else { + donateImgContainer.classList.add('hide') + } + }) + + donateImg.src = donateImg.dataset.src +} + diff --git a/js/script.js b/js/script.js deleted file mode 100644 index 1e587674..00000000 --- a/js/script.js +++ /dev/null @@ -1,137 +0,0 @@ -(function($){ - // Search - var $searchWrap = $('#search-form-wrap'), - isSearchAnim = false, - searchAnimDuration = 200; - - var startSearchAnim = function(){ - isSearchAnim = true; - }; - - var stopSearchAnim = function(callback){ - setTimeout(function(){ - isSearchAnim = false; - callback && callback(); - }, searchAnimDuration); - }; - - $('#nav-search-btn').on('click', function(){ - if (isSearchAnim) return; - - startSearchAnim(); - $searchWrap.addClass('on'); - stopSearchAnim(function(){ - $('.search-form-input').focus(); - }); - }); - - $('.search-form-input').on('blur', function(){ - startSearchAnim(); - $searchWrap.removeClass('on'); - stopSearchAnim(); - }); - - // Share - $('body').on('click', function(){ - $('.article-share-box.on').removeClass('on'); - }).on('click', '.article-share-link', function(e){ - e.stopPropagation(); - - var $this = $(this), - url = $this.attr('data-url'), - encodedUrl = encodeURIComponent(url), - id = 'article-share-box-' + $this.attr('data-id'), - offset = $this.offset(); - - if ($('#' + id).length){ - var box = $('#' + id); - - if (box.hasClass('on')){ - box.removeClass('on'); - return; - } - } else { - var html = [ - '
                ', - '', - '
                ', - '', - '', - '', - '', - '
                ', - '
                ' - ].join(''); - - var box = $(html); - - $('body').append(box); - } - - $('.article-share-box.on').hide(); - - box.css({ - top: offset.top + 25, - left: offset.left - }).addClass('on'); - }).on('click', '.article-share-box', function(e){ - e.stopPropagation(); - }).on('click', '.article-share-box-input', function(){ - $(this).select(); - }).on('click', '.article-share-box-link', function(e){ - e.preventDefault(); - e.stopPropagation(); - - window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450'); - }); - - // Caption - $('.article-entry').each(function(i){ - $(this).find('img').each(function(){ - if ($(this).parent().hasClass('fancybox')) return; - - var alt = this.alt; - - if (alt) $(this).after('' + alt + ''); - - $(this).wrap(''); - }); - - $(this).find('.fancybox').each(function(){ - $(this).attr('rel', 'article' + i); - }); - }); - - if ($.fancybox){ - $('.fancybox').fancybox(); - } - - // Mobile nav - var $container = $('#container'), - isMobileNavAnim = false, - mobileNavAnimDuration = 200; - - var startMobileNavAnim = function(){ - isMobileNavAnim = true; - }; - - var stopMobileNavAnim = function(){ - setTimeout(function(){ - isMobileNavAnim = false; - }, mobileNavAnimDuration); - } - - $('#main-nav-toggle').on('click', function(){ - if (isMobileNavAnim) return; - - startMobileNavAnim(); - $container.toggleClass('mobile-nav-on'); - stopMobileNavAnim(); - }); - - $('#wrap').on('click', function(){ - if (isMobileNavAnim || !$container.hasClass('mobile-nav-on')) return; - - $container.removeClass('mobile-nav-on'); - }); -})(jQuery); \ No newline at end of file