Prechádzať zdrojové kódy

Site updated: 2020-04-07 12:19:16

schtonn 5 rokov pred
rodič
commit
4730d3a57f

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 392
archives/2020/index.html


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
css/main.css


+ 25 - 0
js/algolia-search.js

@@ -0,0 +1,25 @@
+'use strict';
+window.addEventListener('DOMContentLoaded', function () {
+    var t = CONFIG.algolia, e = t.indexName, a = t.appID, i = t.apiKey, s = instantsearch({
+            indexName: e,
+            searchClient: algoliasearch(a, i),
+            searchFunction: function (e) {
+                document.querySelector('.search-input').value && e.search();
+            }
+        });
+    window.pjax && s.on('render', function () {
+        window.pjax.refresh(document.getElementById('algolia-hits'));
+    }), s.addWidgets([instantsearch.widgets.configure({hitsPerPage:t.hits.per_page||10}),instantsearch.widgets.searchBox({container:".search-input-container",placeholder:t.labels.input_placeholder,showReset:!1,showSubmit:!1,showLoadingIndicator:!1,cssClasses:{input:"search-input"}}),instantsearch.widgets.stats({container:"#algolia-stats",templates:{text:function(e){return t.labels.hits_stats.replace(/\$\{hits}/,e.nbHits).replace(/\$\{time}/,e.processingTimeMS)+'\n            <span class="algolia-powered">\n              <img src="'+CONFIG.root+'images/algolia_logo.svg" alt="Algolia">\n            </span>\n            <hr>'}}}),instantsearch.widgets.hits({container:"#algolia-hits",templates:{item:function(e){return'<a href="'+(e.permalink?e.permalink:CONFIG.root+e.path)+'" class="algolia-hit-item-link">'+e._highlightResult.title.value+"</a>"},empty:function(e){return'<div id="algolia-hits-empty">\n              '+t.labels.hits_empty.replace(/\$\{query}/,e.query)+"\n            </div>"}},cssClasses:{item:"algolia-hit-item"}}),instantsearch.widgets.pagination({container:"#algolia-pagination",scrollTo:!1,showFirst:!1,showLast:!1,templates:{first:'<i class="fa fa-angle-double-left"></i>',last:'<i class="fa fa-angle-double-right"></i>',previous:'<i class="fa fa-angle-left"></i>',next:'<i class="fa fa-angle-right"></i>'},cssClasses:{root:"pagination",item:"pagination-item",link:"page-number",selectedItem:"current",disabledItem:"disabled-item"}})]), s.start(), document.querySelectorAll('.popup-trigger').forEach(function (e) {
+        e.addEventListener('click', function () {
+            document.body.style.overflow = 'hidden', document.querySelector('.search-pop-overlay').classList.add('search-active'), document.querySelector('.search-input').focus();
+        });
+    });
+    function n() {
+        document.body.style.overflow = '', document.querySelector('.search-pop-overlay').classList.remove('search-active');
+    }
+    document.querySelector('.search-pop-overlay').addEventListener('click', function (e) {
+        e.target === document.querySelector('.search-pop-overlay') && n();
+    }), document.querySelector('.popup-btn-close').addEventListener('click', n), window.addEventListener('pjax:success', n), window.addEventListener('keyup', function (e) {
+        'Escape' === e.key && n();
+    });
+});

+ 31 - 0
js/bookmark.js

@@ -0,0 +1,31 @@
+'use strict';
+window.addEventListener('DOMContentLoaded', function () {
+    function n() {
+        localStorage.setItem('bookmark' + location.pathname, window.scrollY);
+    }
+    function e() {
+        var n = localStorage.getItem('bookmark' + location.pathname);
+        n = parseInt(n, 10), isNaN(n) || '' !== location.hash || window.anime({
+            targets: document.scrollingElement,
+            duration: 200,
+            easing: 'linear',
+            scrollTop: n
+        });
+    }
+    var o, t;
+    o = CONFIG.bookmark.save, t = document.querySelector('.book-mark-link'), window.addEventListener('scroll', function () {
+        return t.classList.toggle('book-mark-link-fixed', 0 === window.scrollY);
+    }), 'auto' === o && (window.addEventListener('beforeunload', n), window.addEventListener('pjax:send', n)), t.addEventListener('click', function () {
+        n(), window.anime({
+            targets: t,
+            duration: 200,
+            easing: 'linear',
+            top: -30,
+            complete: function () {
+                setTimeout(function () {
+                    t.style.top = '';
+                }, 400);
+            }
+        });
+    }), e(), window.addEventListener('pjax:success', e);
+});

+ 136 - 0
js/local-search.js

@@ -0,0 +1,136 @@
+'use strict';
+function _toConsumableArray(e) {
+    if (Array.isArray(e)) {
+        for (var t = 0, n = Array(e.length); t < e.length; t++)
+            n[t] = e[t];
+        return n;
+    }
+    return Array.from(e);
+}
+window.addEventListener('DOMContentLoaded', function () {
+    var t = !1, n = void 0, r = !0, e = CONFIG.path;
+    0 === e.length ? e = 'search.xml' : e.endsWith('json') && (r = !1);
+    function T(e, t, n) {
+        if (CONFIG.localsearch.unescape) {
+            var r = document.createElement('div');
+            r.innerText = e, e = r.innerHTML;
+        }
+        var o = e.length;
+        if (0 === o)
+            return [];
+        var i = 0, a = [], c = [];
+        for (n || (t = t.toLowerCase(), e = e.toLowerCase()); -1 < (a = t.indexOf(e, i));)
+            c.push({
+                position: a,
+                word: e
+            }), i = a + o;
+        return c;
+    }
+    function S(e, t, n, r) {
+        for (var o = n[n.length - 1], i = o.position, a = o.word, c = [], s = 0; i + a.length <= t && 0 !== n.length;) {
+            a === r && s++, c.push({
+                position: i,
+                length: a.length
+            });
+            var l = i + a.length;
+            for (n.pop(); 0 !== n.length && (i = (o = n[n.length - 1]).position, a = o.word, i < l);)
+                n.pop();
+        }
+        return {
+            hits: c,
+            start: e,
+            end: t,
+            searchTextCount: s
+        };
+    }
+    function q(n, e) {
+        var r = '', o = e.start;
+        return e.hits.forEach(function (e) {
+            r += n.substring(o, e.position);
+            var t = e.position + e.length;
+            r += '<b class="search-keyword">' + n.substring(e.position, t) + '</b>', o = t;
+        }), r += n.substring(o, e.end);
+    }
+    function o() {
+        if (t) {
+            var w = a.value.trim().toLowerCase(), L = w.split(/[-\s]+/);
+            1 < L.length && L.push(w);
+            var E = [];
+            0 < w.length && n.forEach(function (e) {
+                var t = e.title, n = e.content, r = e.url, o = t.toLowerCase(), i = n.toLowerCase(), a = [], c = [], s = 0;
+                if (L.forEach(function (e) {
+                        a = a.concat(T(e, o, !1)), c = c.concat(T(e, i, !1));
+                    }), 0 < a.length || 0 < c.length) {
+                    var l = a.length + c.length;
+                    [a,c].forEach(function (e) {
+                        e.sort(function (e, t) {
+                            return t.position !== e.position ? t.position - e.position : e.word.length - t.word.length;
+                        });
+                    });
+                    var u = [];
+                    if (0 !== a.length) {
+                        var h = S(0, t.length, a, w);
+                        s += h.searchTextCountInSlice, u.push(h);
+                    }
+                    for (var d = []; 0 !== c.length;) {
+                        var f = c[c.length - 1], p = f.position, g = f.word, v = p - 20, C = p + 80;
+                        v < 0 && (v = 0), C < p + g.length && (C = p + g.length), C > n.length && (C = n.length);
+                        var y = S(v, C, c, w);
+                        s += y.searchTextCountInSlice, d.push(y);
+                    }
+                    d.sort(function (e, t) {
+                        return e.searchTextCount !== t.searchTextCount ? t.searchTextCount - e.searchTextCount : e.hits.length !== t.hits.length ? t.hits.length - e.hits.length : e.start - t.start;
+                    });
+                    var m = parseInt(CONFIG.localsearch.top_n_per_article, 10);
+                    0 <= m && (d = d.slice(0, m));
+                    var x = '';
+                    0 !== u.length ? x += '<li><a href="' + r + '" class="search-result-title">' + q(t, u[0]) + '</a>' : x += '<li><a href="' + r + '" class="search-result-title">' + t + '</a>', d.forEach(function (e) {
+                        x += '<a href="' + r + '"><p class="search-result">' + q(n, e) + '...</p></a>';
+                    }), x += '</li>', E.push({
+                        item: x,
+                        id: E.length,
+                        hitCount: l,
+                        searchTextCount: s
+                    });
+                }
+            }), 1 === L.length && '' === L[0] ? c.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x"></i></div>' : 0 === E.length ? c.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x"></i></div>' : (E.sort(function (e, t) {
+                return e.searchTextCount !== t.searchTextCount ? t.searchTextCount - e.searchTextCount : e.hitCount !== t.hitCount ? t.hitCount - e.hitCount : t.id - e.id;
+            }), c.innerHTML = '<ul class="search-result-list">' + E.map(function (e) {
+                return e.item;
+            }).join('') + '</ul>', window.pjax && window.pjax.refresh(c));
+        }
+    }
+    function i() {
+        fetch(CONFIG.root + e).then(function (e) {
+            return e.text();
+        }).then(function (e) {
+            t = !0, n = (n = r ? [].concat(_toConsumableArray(new DOMParser().parseFromString(e, 'text/xml').querySelectorAll('entry'))).map(function (e) {
+                return {
+                    title: e.querySelector('title').textContent,
+                    content: e.querySelector('content').textContent,
+                    url: e.querySelector('url').textContent
+                };
+            }) : JSON.parse(e)).filter(function (e) {
+                return e.title;
+            }).map(function (e) {
+                return e.title = e.title.trim(), e.content = e.content ? e.content.trim().replace(/<[^>]+>/g, '') : '', e.url = decodeURIComponent(e.url).replace(/\/{2,}/g, '/'), e;
+            }), document.getElementById('no-result').innerHTML = '<i class="fa fa-search fa-5x"></i>', o();
+        });
+    }
+    var a = document.querySelector('.search-input'), c = document.getElementById('search-result');
+    CONFIG.localsearch.preload && i(), 'auto' === CONFIG.localsearch.trigger ? a.addEventListener('input', o) : (document.querySelector('.search-icon').addEventListener('click', o), a.addEventListener('keypress', function (e) {
+        'Enter' === e.key && o();
+    })), document.querySelectorAll('.popup-trigger').forEach(function (e) {
+        e.addEventListener('click', function () {
+            document.body.style.overflow = 'hidden', document.querySelector('.search-pop-overlay').classList.add('search-active'), a.focus(), t || i();
+        });
+    });
+    function s() {
+        document.body.style.overflow = '', document.querySelector('.search-pop-overlay').classList.remove('search-active');
+    }
+    document.querySelector('.search-pop-overlay').addEventListener('click', function (e) {
+        e.target === document.querySelector('.search-pop-overlay') && s();
+    }), document.querySelector('.popup-btn-close').addEventListener('click', s), window.addEventListener('pjax:success', s), window.addEventListener('keyup', function (e) {
+        'Escape' === e.key && s();
+    });
+});

+ 1 - 2
js/next-boot.js

@@ -17,8 +17,7 @@ NexT.boot = {}, NexT.boot.registerEvents = function () {
                 e.classList.toggle('site-nav-on');
             }
         }) : e.classList.toggle('site-nav-on');
-    });
-    document.querySelectorAll('.sidebar-nav li').forEach(function (e, s) {
+    }), document.querySelectorAll('.sidebar-nav li').forEach(function (e, s) {
         e.addEventListener('click', function (e) {
             var t = e.currentTarget, i = 'sidebar-nav-active', o = 'sidebar-panel-active';
             if (!t.classList.contains(i)) {

+ 0 - 26
js/offlineClient.js

@@ -1,26 +0,0 @@
-'use strict';
-var _createClass = function () {
-    function s(e, a) {
-        for (var n = 0; n < a.length; n++) {
-            var s = a[n];
-            s.enumerable = s.enumerable || !1, s.configurable = !0, 'value' in s && (s.writable = !0), Object.defineProperty(e, s.key, s);
-        }
-    }
-    return function (e, a, n) {
-        return a && s(e.prototype, a), n && s(e, n), e;
-    };
-}();
-function _classCallCheck(e, a) {
-    if (!(e instanceof a))
-        throw new TypeError('Cannot call a class as a function');
-}
-!function () {
-    var e = (_createClass(n, [{key:"_OnBroadcastChannelMessage",value:function(e){this._onMessageCallback?this._onMessageCallback(e):this._queuedMessages.push(e)}},{key:"SetMessageCallback",value:function(e){this._onMessageCallback=e;var a=!0,n=!1,s=void 0;try{for(var t,l=this._queuedMessages[Symbol.iterator]();!(a=(t=l.next()).done);a=!0){var r=t.value;this._onMessageCallback(r)}}catch(e){n=!0,s=e}finally{try{!a&&l.return&&l.return()}finally{if(n)throw s}}this._queuedMessages.length=0}}]), n);
-    function n() {
-        var a = this;
-        _classCallCheck(this, n), this._broadcastChannel = 'undefined' == typeof BroadcastChannel ? null : new BroadcastChannel('offline'), this._queuedMessages = [], this._onMessageCallback = null, this._broadcastChannel && (this._broadcastChannel.onmessage = function (e) {
-            return a._OnBroadcastChannelMessage(e);
-        });
-    }
-    window.OfflineClientInfo = new e();
-}();

+ 86 - 0
js/schemes/pisces.js

@@ -0,0 +1,86 @@
+/* global NexT, CONFIG */
+
+var Affix = {
+  init: function(element, options) {
+    this.element = element;
+    this.offset = options || 0;
+    this.affixed = null;
+    this.unpin = null;
+    this.pinnedOffset = null;
+    this.checkPosition();
+    window.addEventListener('scroll', this.checkPosition.bind(this));
+    window.addEventListener('click', this.checkPositionWithEventLoop.bind(this));
+    window.matchMedia('(min-width: 992px)').addListener(event => {
+      if (event.matches) {
+        this.offset = NexT.utils.getAffixParam();
+        this.checkPosition();
+      }
+    });
+  },
+  getState: function(scrollHeight, height, offsetTop, offsetBottom) {
+    let scrollTop = window.scrollY;
+    let targetHeight = window.innerHeight;
+    if (offsetTop != null && this.affixed === 'top') {
+      if (document.querySelector('.content-wrap').offsetHeight < offsetTop) return 'top';
+      return scrollTop < offsetTop ? 'top' : false;
+    }
+    if (this.affixed === 'bottom') {
+      if (offsetTop != null) return this.unpin <= this.element.getBoundingClientRect().top ? false : 'bottom';
+      return scrollTop + targetHeight <= scrollHeight - offsetBottom ? false : 'bottom';
+    }
+    let initializing = this.affixed === null;
+    let colliderTop = initializing ? scrollTop : this.element.getBoundingClientRect().top + scrollTop;
+    let colliderHeight = initializing ? targetHeight : height;
+    if (offsetTop != null && scrollTop <= offsetTop) return 'top';
+    if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom';
+    return false;
+  },
+  getPinnedOffset: function() {
+    if (this.pinnedOffset) return this.pinnedOffset;
+    this.element.classList.remove('affix-top', 'affix-bottom');
+    this.element.classList.add('affix');
+    return (this.pinnedOffset = this.element.getBoundingClientRect().top);
+  },
+  checkPositionWithEventLoop() {
+    setTimeout(this.checkPosition.bind(this), 1);
+  },
+  checkPosition: function() {
+    if (window.getComputedStyle(this.element).display === 'none') return;
+    let height = this.element.offsetHeight;
+    let { offset } = this;
+    let offsetTop = offset.top;
+    let offsetBottom = offset.bottom;
+    let { scrollHeight } = document.body;
+    let affix = this.getState(scrollHeight, height, offsetTop, offsetBottom);
+    if (this.affixed !== affix) {
+      if (this.unpin != null) this.element.style.top = '';
+      let affixType = 'affix' + (affix ? '-' + affix : '');
+      this.affixed = affix;
+      this.unpin = affix === 'bottom' ? this.getPinnedOffset() : null;
+      this.element.classList.remove('affix', 'affix-top', 'affix-bottom');
+      this.element.classList.add(affixType);
+    }
+    if (affix === 'bottom') {
+      this.element.style.top = scrollHeight - height - offsetBottom + 'px';
+    }
+  }
+};
+
+NexT.utils.getAffixParam = function() {
+  const sidebarOffset = CONFIG.sidebar.offset || 12;
+
+  let headerOffset = document.querySelector('.header-inner').offsetHeight;
+  let footerOffset = document.querySelector('.footer').offsetHeight;
+
+  document.querySelector('.sidebar').style.marginTop = headerOffset + sidebarOffset + 'px';
+
+  return {
+    top   : headerOffset,
+    bottom: footerOffset
+  };
+};
+
+window.addEventListener('DOMContentLoaded', () => {
+
+  Affix.init(document.querySelector('.sidebar-inner'), NexT.utils.getAffixParam());
+});

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 374
posts/computer/index.html


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 345
posts/dinic/index.html


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
sans/index.html


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov