├── Vue源码学习 └── mvvm.png ├── images ├── avatar.gif ├── loading.gif ├── searchicon.png ├── placeholder.gif ├── favicon-16x16-next.png ├── favicon-32x32-next.png ├── apple-touch-icon-next.png ├── quote-r.svg ├── quote-l.svg ├── logo.svg ├── algolia_logo.svg ├── cc-zero.svg ├── cc-by.svg ├── cc-by-nd.svg ├── cc-by-nc.svg ├── cc-by-sa.svg ├── cc-by-nc-nd.svg └── cc-by-nc-sa.svg ├── 个人通用js方法库d-js-utils └── bg.png ├── 个人网站2-0版本总结个未来规划 ├── html1.0.jpg └── html2.0.jpg ├── lib ├── font-awesome │ ├── fonts │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── bower.json │ └── HELP-US-OUT.txt ├── ua-parser-js │ └── dist │ │ ├── ua-parser.pack.js │ │ └── ua-parser.min.js └── velocity │ └── velocity.ui.min.js ├── js └── src │ ├── scroll-cookie.js │ ├── bootstrap.js │ ├── schemes │ └── pisces.js │ ├── exturl.js │ ├── algolia-search.js │ ├── post-details.js │ ├── js.cookie.js │ ├── affix.js │ ├── scrollspy.js │ ├── utils.js │ ├── motion.js │ └── axios.js └── tags ├── 源码 └── index.html ├── 总结 └── index.html └── 插件 └── index.html /Vue源码学习/mvvm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/Vue源码学习/mvvm.png -------------------------------------------------------------------------------- /images/avatar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/images/avatar.gif -------------------------------------------------------------------------------- /images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/images/loading.gif -------------------------------------------------------------------------------- /images/searchicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/images/searchicon.png -------------------------------------------------------------------------------- /images/placeholder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/images/placeholder.gif -------------------------------------------------------------------------------- /个人通用js方法库d-js-utils/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/个人通用js方法库d-js-utils/bg.png -------------------------------------------------------------------------------- /个人网站2-0版本总结个未来规划/html1.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/个人网站2-0版本总结个未来规划/html1.0.jpg -------------------------------------------------------------------------------- /个人网站2-0版本总结个未来规划/html2.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/个人网站2-0版本总结个未来规划/html2.0.jpg -------------------------------------------------------------------------------- /images/favicon-16x16-next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/images/favicon-16x16-next.png -------------------------------------------------------------------------------- /images/favicon-32x32-next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/images/favicon-32x32-next.png -------------------------------------------------------------------------------- /images/apple-touch-icon-next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/images/apple-touch-icon-next.png -------------------------------------------------------------------------------- /lib/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/lib/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /lib/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/lib/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /lib/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IFmiss/ifmiss.github.io/master/lib/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /lib/font-awesome/bower.json: -------------------------------------------------------------------------------- 1 | {"name":"font-awesome","description":"Font Awesome","keywords":[],"homepage":"http://fontawesome.io","dependencies":{},"devDependencies":{},"license":["OFL-1.1","MIT","CC-BY-3.0"],"main":["less/font-awesome.less","scss/font-awesome.scss"],"ignore":["*/.*","*.json","src","*.yml","Gemfile","Gemfile.lock","*.md"]} -------------------------------------------------------------------------------- /lib/font-awesome/HELP-US-OUT.txt: -------------------------------------------------------------------------------- 1 | I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project, 2 | Fort Awesome (https://fortawesome.com). It makes it easy to put the perfect icons on your website. Choose from our awesome, 3 | comprehensive icon sets or copy and paste your own. 4 | 5 | Please. Check it out. 6 | 7 | -Dave Gandy 8 | -------------------------------------------------------------------------------- /js/src/scroll-cookie.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | /* global Cookies */ 4 | 5 | // Set relative link path (without domain) 6 | var rpath = window.location.href.replace(window.location.origin, ''); 7 | 8 | // Write position in cookie 9 | var timeout; 10 | $(window).on('scroll', function() { 11 | clearTimeout(timeout); 12 | timeout = setTimeout(function() { 13 | Cookies.set('scroll-cookie', $(window).scrollTop() + '|' + rpath, { expires: 365, path: '' }); 14 | }, 250); 15 | }); 16 | 17 | // Read position from cookie 18 | if (Cookies.get('scroll-cookie') !== undefined) { 19 | var cvalues = Cookies.get('scroll-cookie').split('|'); 20 | if (cvalues[1] === rpath) { 21 | $(window).scrollTop(cvalues[0]); 22 | } 23 | } 24 | 25 | }); 26 | -------------------------------------------------------------------------------- /images/quote-r.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /images/quote-l.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /images/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | image/svg+xml 24 | -------------------------------------------------------------------------------- /js/src/bootstrap.js: -------------------------------------------------------------------------------- 1 | /* global NexT, CONFIG */ 2 | 3 | $(document).ready(function() { 4 | 5 | $(document).trigger('bootstrap:before'); 6 | 7 | /** 8 | * Register JS handlers by condition option. 9 | * Need to add config option in Front-End at 'layout/_partials/head.swig' file. 10 | */ 11 | CONFIG.fastclick && NexT.utils.isMobile() && window.FastClick.attach(document.body); 12 | CONFIG.lazyload && NexT.utils.lazyLoadPostsImages(); 13 | 14 | NexT.utils.registerESCKeyEvent(); 15 | 16 | NexT.utils.registerBackToTop(); 17 | 18 | // Mobile top menu bar. 19 | $('.site-nav-toggle button').on('click', function() { 20 | var $siteNav = $('.site-nav'); 21 | var ON_CLASS_NAME = 'site-nav-on'; 22 | var isSiteNavOn = $siteNav.hasClass(ON_CLASS_NAME); 23 | var animateAction = isSiteNavOn ? 'slideUp' : 'slideDown'; 24 | var animateCallback = isSiteNavOn ? 'removeClass' : 'addClass'; 25 | 26 | $siteNav.stop()[animateAction]('fast', function() { 27 | $siteNav[animateCallback](ON_CLASS_NAME); 28 | }); 29 | }); 30 | 31 | /** 32 | * Register JS handlers by condition option. 33 | * Need to add config option in Front-End at 'layout/_partials/head.swig' file. 34 | */ 35 | CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox(); 36 | CONFIG.tabs && NexT.utils.registerTabsTag(); 37 | 38 | NexT.utils.embeddedVideoTransformer(); 39 | 40 | // Define Motion Sequence. 41 | NexT.motion.integrator 42 | .add(NexT.motion.middleWares.logo) 43 | .add(NexT.motion.middleWares.menu) 44 | .add(NexT.motion.middleWares.postList) 45 | .add(NexT.motion.middleWares.sidebar); 46 | 47 | $(document).trigger('motion:before'); 48 | 49 | // Bootstrap Motion. 50 | CONFIG.motion.enable && NexT.motion.integrator.bootstrap(); 51 | 52 | $(document).trigger('bootstrap:after'); 53 | }); 54 | -------------------------------------------------------------------------------- /js/src/schemes/pisces.js: -------------------------------------------------------------------------------- 1 | /* global NexT, CONFIG */ 2 | 3 | $(document).ready(function() { 4 | 5 | var sidebarInner = $('.sidebar-inner'); 6 | var sidebarOffset = CONFIG.sidebar.offset ? CONFIG.sidebar.offset : 12; 7 | 8 | function getHeaderOffset() { 9 | return $('.header-inner').height() + sidebarOffset; 10 | } 11 | 12 | function getFooterOffset() { 13 | var footerInner = $('.footer-inner'); 14 | var footerMargin = footerInner.outerHeight(true) - footerInner.outerHeight(); 15 | var footerOffset = footerInner.outerHeight(true) + footerMargin; 16 | return footerOffset; 17 | } 18 | 19 | function initAffix() { 20 | var headerOffset = getHeaderOffset(); 21 | var footerOffset = getFooterOffset(); 22 | var sidebarHeight = $('#sidebar').height() + NexT.utils.getSidebarb2tHeight(); 23 | var contentHeight = $('#content').height(); 24 | 25 | // Not affix if sidebar taller than content (to prevent bottom jumping). 26 | if (headerOffset + sidebarHeight < contentHeight) { 27 | sidebarInner.affix({ 28 | offset: { 29 | top : headerOffset - sidebarOffset, 30 | bottom: footerOffset 31 | } 32 | }); 33 | sidebarInner.affix('checkPosition'); 34 | } 35 | 36 | $('#sidebar').css({ 'margin-top': headerOffset, 'margin-left': 'initial' }); 37 | } 38 | 39 | function recalculateAffixPosition() { 40 | $(window).off('.affix'); 41 | sidebarInner.removeData('bs.affix').removeClass('affix affix-top affix-bottom'); 42 | initAffix(); 43 | } 44 | 45 | function resizeListener() { 46 | var mql = window.matchMedia('(min-width: 992px)'); 47 | mql.addListener(function(e) { 48 | if (e.matches) { 49 | recalculateAffixPosition(); 50 | } 51 | }); 52 | } 53 | 54 | initAffix(); 55 | resizeListener(); 56 | }); 57 | -------------------------------------------------------------------------------- /js/src/exturl.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | // Create Base64 Object 4 | /* eslint-disable */ 5 | var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}; 6 | 7 | $('.exturl').on('click', function() { 8 | var $exturl = $(this).attr('data-url'); 9 | var $decurl = Base64.decode($exturl); 10 | window.open($decurl, '_blank'); 11 | return false; 12 | }); 13 | 14 | }); 15 | -------------------------------------------------------------------------------- /js/src/algolia-search.js: -------------------------------------------------------------------------------- 1 | /* global instantsearch, CONFIG */ 2 | 3 | $(document).ready(function() { 4 | var algoliaSettings = CONFIG.algolia; 5 | var isAlgoliaSettingsValid = algoliaSettings.applicationID 6 | && algoliaSettings.apiKey 7 | && algoliaSettings.indexName; 8 | 9 | if (!isAlgoliaSettingsValid) { 10 | window.console.error('Algolia Settings are invalid.'); 11 | return; 12 | } 13 | 14 | var search = instantsearch({ 15 | appId : algoliaSettings.applicationID, 16 | apiKey : algoliaSettings.apiKey, 17 | indexName : algoliaSettings.indexName, 18 | searchFunction: function(helper) { 19 | var searchInput = $('#algolia-search-input').find('input'); 20 | 21 | if (searchInput.val()) { 22 | helper.search(); 23 | } 24 | } 25 | }); 26 | 27 | // Registering Widgets 28 | [ 29 | instantsearch.widgets.searchBox({ 30 | container : '#algolia-search-input', 31 | placeholder: algoliaSettings.labels.input_placeholder 32 | }), 33 | 34 | instantsearch.widgets.hits({ 35 | container : '#algolia-hits', 36 | hitsPerPage: algoliaSettings.hits.per_page || 10, 37 | templates : { 38 | item: function(data) { 39 | var link = data.permalink ? data.permalink : CONFIG.root + data.path; 40 | return ( 41 | '' 42 | + data._highlightResult.title.value 43 | + '' 44 | ); 45 | }, 46 | empty: function(data) { 47 | return ( 48 | '
' 49 | + algoliaSettings.labels.hits_empty.replace(/\$\{query}/, data.query) 50 | + '
' 51 | ); 52 | } 53 | }, 54 | cssClasses: { 55 | item: 'algolia-hit-item' 56 | } 57 | }), 58 | 59 | instantsearch.widgets.stats({ 60 | container: '#algolia-stats', 61 | templates: { 62 | body: function(data) { 63 | var stats = algoliaSettings.labels.hits_stats 64 | .replace(/\$\{hits}/, data.nbHits) 65 | .replace(/\$\{time}/, data.processingTimeMS); 66 | return ( 67 | stats 68 | + '' 69 | + ' Algolia' 70 | + '' 71 | + '
' 72 | ); 73 | } 74 | } 75 | }), 76 | 77 | instantsearch.widgets.pagination({ 78 | container : '#algolia-pagination', 79 | scrollTo : false, 80 | showFirstLast: false, 81 | labels : { 82 | first : '', 83 | last : '', 84 | previous: '', 85 | next : '' 86 | }, 87 | cssClasses: { 88 | root : 'pagination', 89 | item : 'pagination-item', 90 | link : 'page-number', 91 | active : 'current', 92 | disabled: 'disabled-item' 93 | } 94 | }) 95 | ].forEach(search.addWidget, search); 96 | 97 | search.start(); 98 | 99 | $('.popup-trigger').on('click', function(e) { 100 | e.stopPropagation(); 101 | $('body') 102 | .append('
') 103 | .css('overflow', 'hidden'); 104 | $('.popup').toggle(); 105 | $('#algolia-search-input').find('input').focus(); 106 | }); 107 | 108 | $('.popup-btn-close').click(function() { 109 | $('.popup').hide(); 110 | $('.algolia-pop-overlay').remove(); 111 | $('body').css('overflow', ''); 112 | }); 113 | 114 | }); 115 | -------------------------------------------------------------------------------- /js/src/post-details.js: -------------------------------------------------------------------------------- 1 | /* global NexT, CONFIG */ 2 | 3 | $(document).ready(function() { 4 | 5 | function initScrollSpy() { 6 | var tocSelector = '.post-toc'; 7 | var $tocElement = $(tocSelector); 8 | var activeCurrentSelector = '.active-current'; 9 | 10 | function removeCurrentActiveClass() { 11 | $(tocSelector + ' ' + activeCurrentSelector) 12 | .removeClass(activeCurrentSelector.substring(1)); 13 | } 14 | 15 | $tocElement 16 | .on('activate.bs.scrollspy', function() { 17 | var $currentActiveElement = $(tocSelector + ' .active').last(); 18 | 19 | removeCurrentActiveClass(); 20 | $currentActiveElement.addClass('active-current'); 21 | 22 | // Scrolling to center active TOC element if TOC content is taller then viewport. 23 | $tocElement.scrollTop($currentActiveElement.offset().top - $tocElement.offset().top + $tocElement.scrollTop() - ($tocElement.height() / 2)); 24 | }) 25 | .on('clear.bs.scrollspy', removeCurrentActiveClass); 26 | 27 | $('body').scrollspy({ target: tocSelector }); 28 | } 29 | 30 | initScrollSpy(); 31 | }); 32 | 33 | $(document).ready(function() { 34 | var html = $('html'); 35 | var TAB_ANIMATE_DURATION = 200; 36 | var hasVelocity = $.isFunction(html.velocity); 37 | 38 | $('.sidebar-nav li').on('click', function() { 39 | var item = $(this); 40 | var activeTabClassName = 'sidebar-nav-active'; 41 | var activePanelClassName = 'sidebar-panel-active'; 42 | if (item.hasClass(activeTabClassName)) { 43 | return; 44 | } 45 | 46 | var currentTarget = $('.' + activePanelClassName); 47 | var target = $('.' + item.data('target')); 48 | 49 | hasVelocity 50 | ? currentTarget.velocity('transition.slideUpOut', TAB_ANIMATE_DURATION, function() { 51 | target 52 | .velocity('stop') 53 | .velocity('transition.slideDownIn', TAB_ANIMATE_DURATION) 54 | .addClass(activePanelClassName); 55 | }) 56 | : currentTarget.animate({ opacity: 0 }, TAB_ANIMATE_DURATION, function() { 57 | currentTarget.hide(); 58 | target 59 | .stop() 60 | .css({'opacity': 0, 'display': 'block'}) 61 | .animate({ opacity: 1 }, TAB_ANIMATE_DURATION, function() { 62 | currentTarget.removeClass(activePanelClassName); 63 | target.addClass(activePanelClassName); 64 | }); 65 | }); 66 | 67 | item.siblings().removeClass(activeTabClassName); 68 | item.addClass(activeTabClassName); 69 | }); 70 | 71 | // TOC item animation navigate & prevent #item selector in adress bar. 72 | $('.post-toc a').on('click', function(e) { 73 | e.preventDefault(); 74 | var targetSelector = NexT.utils.escapeSelector(this.getAttribute('href')); 75 | var offset = $(targetSelector).offset().top; 76 | 77 | hasVelocity 78 | ? html.velocity('stop').velocity('scroll', { 79 | offset : offset + 'px', 80 | mobileHA: false 81 | }) 82 | : $('html, body').stop().animate({ 83 | scrollTop: offset 84 | }, 500); 85 | }); 86 | 87 | // Expand sidebar on post detail page by default, when post has a toc. 88 | var $tocContent = $('.post-toc-content'); 89 | var display = CONFIG.page.sidebar; 90 | if (typeof display !== 'boolean') { 91 | // There's no definition sidebar in the page front-matter 92 | var isSidebarCouldDisplay = CONFIG.sidebar.display === 'post' 93 | || CONFIG.sidebar.display === 'always'; 94 | var hasTOC = $tocContent.length > 0 && $tocContent.html().trim().length > 0; 95 | display = isSidebarCouldDisplay && hasTOC; 96 | } 97 | if (display) { 98 | CONFIG.motion.enable 99 | ? NexT.motion.middleWares.sidebar = function() { 100 | NexT.utils.displaySidebar(); 101 | } 102 | : NexT.utils.displaySidebar(); 103 | } 104 | }); 105 | -------------------------------------------------------------------------------- /images/algolia_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /js/src/js.cookie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * JavaScript Cookie v2.1.4 3 | * https://github.com/js-cookie/js-cookie 4 | * 5 | * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 6 | * Released under the MIT license 7 | */ 8 | ;(function (factory) { 9 | var registeredInModuleLoader = false; 10 | if (typeof define === 'function' && define.amd) { 11 | define(factory); 12 | registeredInModuleLoader = true; 13 | } 14 | if (typeof exports === 'object') { 15 | module.exports = factory(); 16 | registeredInModuleLoader = true; 17 | } 18 | if (!registeredInModuleLoader) { 19 | var OldCookies = window.Cookies; 20 | var api = window.Cookies = factory(); 21 | api.noConflict = function () { 22 | window.Cookies = OldCookies; 23 | return api; 24 | }; 25 | } 26 | }(function () { 27 | function extend () { 28 | var i = 0; 29 | var result = {}; 30 | for (; i < arguments.length; i++) { 31 | var attributes = arguments[ i ]; 32 | for (var key in attributes) { 33 | result[key] = attributes[key]; 34 | } 35 | } 36 | return result; 37 | } 38 | 39 | function init (converter) { 40 | function api (key, value, attributes) { 41 | var result; 42 | if (typeof document === 'undefined') { 43 | return; 44 | } 45 | 46 | // Write 47 | 48 | if (arguments.length > 1) { 49 | attributes = extend({ 50 | path: '/' 51 | }, api.defaults, attributes); 52 | 53 | if (typeof attributes.expires === 'number') { 54 | var expires = new Date(); 55 | expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); 56 | attributes.expires = expires; 57 | } 58 | 59 | // We're using "expires" because "max-age" is not supported by IE 60 | attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; 61 | 62 | try { 63 | result = JSON.stringify(value); 64 | if (/^[\{\[]/.test(result)) { 65 | value = result; 66 | } 67 | } catch (e) {} 68 | 69 | if (!converter.write) { 70 | value = encodeURIComponent(String(value)) 71 | .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 72 | } else { 73 | value = converter.write(value, key); 74 | } 75 | 76 | key = encodeURIComponent(String(key)); 77 | key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); 78 | key = key.replace(/[\(\)]/g, escape); 79 | 80 | var stringifiedAttributes = ''; 81 | 82 | for (var attributeName in attributes) { 83 | if (!attributes[attributeName]) { 84 | continue; 85 | } 86 | stringifiedAttributes += '; ' + attributeName; 87 | if (attributes[attributeName] === true) { 88 | continue; 89 | } 90 | stringifiedAttributes += '=' + attributes[attributeName]; 91 | } 92 | return (document.cookie = key + '=' + value + stringifiedAttributes); 93 | } 94 | 95 | // Read 96 | 97 | if (!key) { 98 | result = {}; 99 | } 100 | 101 | // To prevent the for loop in the first place assign an empty array 102 | // in case there are no cookies at all. Also prevents odd result when 103 | // calling "get()" 104 | var cookies = document.cookie ? document.cookie.split('; ') : []; 105 | var rdecode = /(%[0-9A-Z]{2})+/g; 106 | var i = 0; 107 | 108 | for (; i < cookies.length; i++) { 109 | var parts = cookies[i].split('='); 110 | var cookie = parts.slice(1).join('='); 111 | 112 | if (cookie.charAt(0) === '"') { 113 | cookie = cookie.slice(1, -1); 114 | } 115 | 116 | try { 117 | var name = parts[0].replace(rdecode, decodeURIComponent); 118 | cookie = converter.read ? 119 | converter.read(cookie, name) : converter(cookie, name) || 120 | cookie.replace(rdecode, decodeURIComponent); 121 | 122 | if (this.json) { 123 | try { 124 | cookie = JSON.parse(cookie); 125 | } catch (e) {} 126 | } 127 | 128 | if (key === name) { 129 | result = cookie; 130 | break; 131 | } 132 | 133 | if (!key) { 134 | result[name] = cookie; 135 | } 136 | } catch (e) {} 137 | } 138 | 139 | return result; 140 | } 141 | 142 | api.set = api; 143 | api.get = function (key) { 144 | return api.call(api, key); 145 | }; 146 | api.getJSON = function () { 147 | return api.apply({ 148 | json: true 149 | }, [].slice.call(arguments)); 150 | }; 151 | api.defaults = {}; 152 | 153 | api.remove = function (key, attributes) { 154 | api(key, '', extend(attributes, { 155 | expires: -1 156 | })); 157 | }; 158 | 159 | api.withConverter = init; 160 | 161 | return api; 162 | } 163 | 164 | return init(function () {}); 165 | })); 166 | -------------------------------------------------------------------------------- /js/src/affix.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: affix.js v3.3.5 3 | * http://getbootstrap.com/javascript/#affix 4 | * ======================================================================== 5 | * Copyright 2011-2015 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | /** 10 | * Customized by Ivan.Nginx 11 | * 12 | * - Refactored with eslint-config-theme-next style. 13 | */ 14 | 15 | (function($) { 16 | 'use strict'; 17 | 18 | // AFFIX CLASS DEFINITION 19 | // ====================== 20 | 21 | var Affix = function(element, options) { 22 | this.options = $.extend({}, Affix.DEFAULTS, options); 23 | 24 | this.$target = $(this.options.target) 25 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 26 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)); 27 | 28 | this.$element = $(element); 29 | this.affixed = null; 30 | this.unpin = null; 31 | this.pinnedOffset = null; 32 | 33 | this.checkPosition(); 34 | }; 35 | 36 | Affix.VERSION = '3.3.5'; 37 | 38 | Affix.RESET = 'affix affix-top affix-bottom'; 39 | 40 | Affix.DEFAULTS = { 41 | offset: 0, 42 | target: window 43 | }; 44 | 45 | Affix.prototype.getState = function(scrollHeight, height, offsetTop, offsetBottom) { 46 | var scrollTop = this.$target.scrollTop(); 47 | var position = this.$element.offset(); 48 | var targetHeight = this.$target.height(); 49 | 50 | if (offsetTop != null && this.affixed === 'top') return scrollTop < offsetTop ? 'top' : false; 51 | 52 | if (this.affixed === 'bottom') { 53 | if (offsetTop != null) return scrollTop + this.unpin <= position.top ? false : 'bottom'; 54 | return scrollTop + targetHeight <= scrollHeight - offsetBottom ? false : 'bottom'; 55 | } 56 | 57 | var initializing = this.affixed == null; 58 | var colliderTop = initializing ? scrollTop : position.top; 59 | var colliderHeight = initializing ? targetHeight : height; 60 | 61 | if (offsetTop != null && scrollTop <= offsetTop) return 'top'; 62 | if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'; 63 | 64 | return false; 65 | }; 66 | 67 | Affix.prototype.getPinnedOffset = function() { 68 | if (this.pinnedOffset) return this.pinnedOffset; 69 | this.$element.removeClass(Affix.RESET).addClass('affix'); 70 | var scrollTop = this.$target.scrollTop(); 71 | var position = this.$element.offset(); 72 | return (this.pinnedOffset = position.top - scrollTop); 73 | }; 74 | 75 | Affix.prototype.checkPositionWithEventLoop = function() { 76 | setTimeout($.proxy(this.checkPosition, this), 1); 77 | }; 78 | 79 | Affix.prototype.checkPosition = function() { 80 | if (!this.$element.is(':visible')) return; 81 | 82 | var height = this.$element.height(); 83 | var offset = this.options.offset; 84 | var offsetTop = offset.top; 85 | var offsetBottom = offset.bottom; 86 | var scrollHeight = Math.max($(document).height(), $(document.body).height()); 87 | 88 | /* eslint-disable */ 89 | if (typeof offset !== 'object') offsetBottom = offsetTop = offset; 90 | if (typeof offsetTop === 'function') offsetTop = offset.top(this.$element); 91 | if (typeof offsetBottom === 'function') offsetBottom = offset.bottom(this.$element); 92 | /* eslint-enable */ 93 | 94 | var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom); 95 | 96 | if (this.affixed !== affix) { 97 | if (this.unpin != null) this.$element.css('top', ''); 98 | 99 | var affixType = 'affix' + (affix ? '-' + affix : ''); 100 | var e = new $.Event(affixType + '.bs.affix'); 101 | 102 | this.$element.trigger(e); 103 | 104 | if (e.isDefaultPrevented()) return; 105 | 106 | this.affixed = affix; 107 | this.unpin = affix === 'bottom' ? this.getPinnedOffset() : null; 108 | 109 | this.$element 110 | .removeClass(Affix.RESET) 111 | .addClass(affixType) 112 | .trigger(affixType.replace('affix', 'affixed') + '.bs.affix'); 113 | } 114 | 115 | if (affix === 'bottom') { 116 | this.$element.offset({ 117 | top: scrollHeight - height - offsetBottom 118 | }); 119 | } 120 | }; 121 | 122 | // AFFIX PLUGIN DEFINITION 123 | // ======================= 124 | 125 | function Plugin(option) { 126 | return this.each(function() { 127 | var $this = $(this); 128 | var data = $this.data('bs.affix'); 129 | var options = typeof option === 'object' && option; 130 | 131 | if (!data) $this.data('bs.affix', data = new Affix(this, options)); 132 | if (typeof option === 'string') data[option](); 133 | }); 134 | } 135 | 136 | var old = $.fn.affix; 137 | 138 | $.fn.affix = Plugin; 139 | $.fn.affix.Constructor = Affix; 140 | 141 | // AFFIX NO CONFLICT 142 | // ================= 143 | 144 | $.fn.affix.noConflict = function() { 145 | $.fn.affix = old; 146 | return this; 147 | }; 148 | 149 | // AFFIX DATA-API 150 | // ============== 151 | 152 | $(window).on('load', function() { 153 | $('[data-spy="affix"]').each(function() { 154 | var $spy = $(this); 155 | var data = $spy.data(); 156 | 157 | data.offset = data.offset || {}; 158 | 159 | /* eslint-disable */ 160 | if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom; 161 | if (data.offsetTop != null) data.offset.top = data.offsetTop; 162 | /* eslint-enable */ 163 | 164 | Plugin.call($spy, data); 165 | }); 166 | }); 167 | 168 | }(jQuery)); 169 | -------------------------------------------------------------------------------- /js/src/scrollspy.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: scrollspy.js v3.3.2 3 | * http://getbootstrap.com/javascript/#scrollspy 4 | * ======================================================================== 5 | * Copyright 2011-2015 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | /** 10 | * Customized by iissnan & Ivan.Nginx 11 | * 12 | * - Add a `clear.bs.scrollspy` event. 13 | * - Esacpe targets selector. 14 | * - Refactored with eslint-config-theme-next style. 15 | */ 16 | 17 | /* global NexT */ 18 | 19 | (function($) { 20 | 'use strict'; 21 | 22 | // SCROLLSPY CLASS DEFINITION 23 | // ========================== 24 | function ScrollSpy(element, options) { 25 | this.$body = $(document.body); 26 | this.$scrollElement = $(element).is(document.body) ? $(window) : $(element); 27 | this.options = $.extend({}, ScrollSpy.DEFAULTS, options); 28 | this.selector = (this.options.target || '') + ' .nav li > a'; 29 | this.offsets = []; 30 | this.targets = []; 31 | this.activeTarget = null; 32 | this.scrollHeight = 0; 33 | 34 | this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)); 35 | this.refresh(); 36 | this.process(); 37 | } 38 | 39 | ScrollSpy.VERSION = '3.3.2'; 40 | 41 | ScrollSpy.DEFAULTS = { 42 | offset: 10 43 | }; 44 | 45 | ScrollSpy.prototype.getScrollHeight = function() { 46 | return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight); 47 | }; 48 | 49 | ScrollSpy.prototype.refresh = function() { 50 | var that = this; 51 | var offsetMethod = 'offset'; 52 | var offsetBase = 0; 53 | 54 | this.offsets = []; 55 | this.targets = []; 56 | this.scrollHeight = this.getScrollHeight(); 57 | 58 | if (!$.isWindow(this.$scrollElement[0])) { 59 | offsetMethod = 'position'; 60 | offsetBase = this.$scrollElement.scrollTop(); 61 | } 62 | 63 | this.$body 64 | .find(this.selector) 65 | .map(function() { 66 | var $el = $(this); 67 | var href = $el.data('target') || $el.attr('href'); 68 | var $href = /^#./.test(href) && $(NexT.utils.escapeSelector(href)); // Need to escape selector. 69 | 70 | return ($href 71 | && $href.length 72 | && $href.is(':visible') 73 | && [[$href[offsetMethod]().top + offsetBase, href]]) || null; 74 | }) 75 | .sort(function(a, b) { 76 | return a[0] - b[0]; 77 | }) 78 | .each(function() { 79 | that.offsets.push(this[0]); 80 | that.targets.push(this[1]); 81 | }); 82 | 83 | 84 | }; 85 | 86 | ScrollSpy.prototype.process = function() { 87 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset; 88 | var scrollHeight = this.getScrollHeight(); 89 | var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height(); 90 | var offsets = this.offsets; 91 | var targets = this.targets; 92 | var activeTarget = this.activeTarget; 93 | var i; 94 | 95 | if (this.scrollHeight !== scrollHeight) { 96 | this.refresh(); 97 | } 98 | 99 | if (scrollTop >= maxScroll) { 100 | return activeTarget !== (i = targets[targets.length - 1]) && this.activate(i); 101 | } 102 | 103 | if (activeTarget && scrollTop < offsets[0]) { 104 | $(this.selector).trigger('clear.bs.scrollspy'); // Add a custom event. 105 | this.activeTarget = null; 106 | return this.clear(); 107 | } 108 | 109 | for (i = offsets.length; i--;) { 110 | activeTarget !== targets[i] 111 | && scrollTop >= offsets[i] 112 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) 113 | && this.activate(targets[i]); 114 | } 115 | }; 116 | 117 | ScrollSpy.prototype.activate = function(target) { 118 | this.activeTarget = target; 119 | 120 | this.clear(); 121 | 122 | var selector = this.selector 123 | + '[data-target="' + target + '"],' 124 | + this.selector + '[href="' + target + '"]'; 125 | 126 | var active = $(selector) 127 | .parents('li') 128 | .addClass('active'); 129 | 130 | if (active.parent('.dropdown-menu').length) { 131 | active = active 132 | .closest('li.dropdown') 133 | .addClass('active'); 134 | } 135 | 136 | active.trigger('activate.bs.scrollspy'); 137 | }; 138 | 139 | ScrollSpy.prototype.clear = function() { 140 | $(this.selector) 141 | .parentsUntil(this.options.target, '.active') 142 | .removeClass('active'); 143 | }; 144 | 145 | // SCROLLSPY PLUGIN DEFINITION 146 | // =========================== 147 | function Plugin(option) { 148 | return this.each(function() { 149 | var $this = $(this); 150 | var data = $this.data('bs.scrollspy'); 151 | var options = typeof option === 'object' && option; 152 | 153 | if (!data) $this.data('bs.scrollspy', data = new ScrollSpy(this, options)); 154 | if (typeof option === 'string') data[option](); 155 | }); 156 | } 157 | 158 | var old = $.fn.scrollspy; 159 | 160 | $.fn.scrollspy = Plugin; 161 | $.fn.scrollspy.Constructor = ScrollSpy; 162 | 163 | // SCROLLSPY NO CONFLICT 164 | // ===================== 165 | $.fn.scrollspy.noConflict = function() { 166 | $.fn.scrollspy = old; 167 | return this; 168 | }; 169 | 170 | // SCROLLSPY DATA-API 171 | // ================== 172 | $(window).on('load.bs.scrollspy.data-api', function() { 173 | $('[data-spy="scroll"]').each(function() { 174 | var $spy = $(this); 175 | Plugin.call($spy, $spy.data()); 176 | }); 177 | }); 178 | 179 | }(jQuery)); 180 | -------------------------------------------------------------------------------- /images/cc-zero.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 38 | 45 | 46 | 47 | 53 | 57 | 63 | 66 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /images/cc-by.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 21 | 24 | 31 | 32 | 33 | 56 | 58 | 59 | 61 | image/svg+xml 62 | 64 | 65 | 66 | 67 | 71 | 74 | 77 | 84 | 91 | 96 | 100 | 109 | 113 | 114 | 115 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /images/cc-by-nd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 21 | 24 | 31 | 32 | 33 | 56 | 58 | 59 | 61 | image/svg+xml 62 | 64 | 65 | 66 | 67 | 71 | 74 | 81 | 88 | 93 | 97 | 106 | 110 | 111 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /images/cc-by-nc.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 21 | 24 | 31 | 32 | 33 | 56 | 58 | 59 | 61 | image/svg+xml 62 | 64 | 65 | 66 | 67 | 71 | 74 | 77 | 84 | 91 | 96 | 100 | 109 | 113 | 114 | 115 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /lib/ua-parser-js/dist/ua-parser.pack.js: -------------------------------------------------------------------------------- 1 | /** 2 | * UAParser.js v0.7.9 3 | * Lightweight JavaScript-based User-Agent string parser 4 | * https://github.com/faisalman/ua-parser-js 5 | * 6 | * Copyright © 2012-2015 Faisal Salman 7 | * Dual licensed under GPLv2 & MIT 8 | */ 9 | !function(i,e){"use strict";var s="0.7.9",o="",r="?",n="function",a="undefined",t="object",w="string",l="major",d="model",p="name",c="type",u="vendor",m="version",f="architecture",g="console",b="mobile",h="tablet",v="smarttv",x="wearable",k="embedded",y={extend:function(i,e){for(var s in e)-1!=="browser cpu device engine os".indexOf(s)&&e[s].length%2===0&&(i[s]=e[s].concat(i[s]));return i},has:function(i,e){return"string"==typeof i?-1!==e.toLowerCase().indexOf(i.toLowerCase()):!1},lowerize:function(i){return i.toLowerCase()},major:function(i){return typeof i===w?i.split(".")[0]:e}},A={rgx:function(){for(var i,s,o,r,w,l,d,p=0,c=arguments;p0?2==w.length?i[w[0]]=typeof w[1]==n?w[1].call(this,d):w[1]:3==w.length?i[w[0]]=typeof w[1]!==n||w[1].exec&&w[1].test?d?d.replace(w[1],w[2]):e:d?w[1].call(this,d,w[2]):e:4==w.length&&(i[w[0]]=d?w[3].call(this,d.replace(w[1],w[2])):e):i[w]=d?d:e;p+=2}return i},str:function(i,s){for(var o in s)if(typeof s[o]===t&&s[o].length>0){for(var n=0;n 2 | 3 | 19 | 21 | 24 | 31 | 32 | 33 | 56 | 58 | 59 | 61 | image/svg+xml 62 | 64 | 65 | 66 | 67 | 71 | 74 | 77 | 84 | 91 | 96 | 100 | 109 | 113 | 114 | 115 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /images/cc-by-nc-nd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 21 | 24 | 31 | 32 | 33 | 56 | 58 | 59 | 61 | image/svg+xml 62 | 64 | 65 | 66 | 67 | 71 | 74 | 77 | 84 | 91 | 96 | 100 | 109 | 113 | 114 | 115 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /images/cc-by-nc-sa.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 21 | 24 | 31 | 32 | 33 | 56 | 58 | 59 | 61 | image/svg+xml 62 | 64 | 65 | 66 | 67 | 71 | 74 | 77 | 84 | 91 | 96 | 100 | 109 | 113 | 114 | 115 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /js/src/utils.js: -------------------------------------------------------------------------------- 1 | /* global NexT, CONFIG */ 2 | 3 | NexT.utils = NexT.$u = { 4 | 5 | /** 6 | * Wrap images with fancybox support. 7 | */ 8 | wrapImageWithFancyBox: function() { 9 | $('.content img') 10 | .not('[hidden]') 11 | .not('.group-picture img, .post-gallery img') 12 | .each(function() { 13 | var $image = $(this); 14 | var imageTitle = $image.attr('title'); 15 | var $imageWrapLink = $image.parent('a'); 16 | 17 | if ($imageWrapLink.length < 1) { 18 | var imageLink = $image.attr('data-original') ? this.getAttribute('data-original') : this.getAttribute('src'); 19 | $imageWrapLink = $image.wrap('').parent('a'); 20 | $imageWrapLink.addClass('fancybox fancybox.image'); 21 | $imageWrapLink.attr('rel', 'group'); 22 | } 23 | 24 | if (imageTitle) { 25 | $imageWrapLink.append('

' + imageTitle + '

'); 26 | 27 | //make sure img title tag will show correctly in fancybox 28 | $imageWrapLink.attr('title', imageTitle); 29 | } 30 | }); 31 | 32 | $('.fancybox').fancybox({ 33 | helpers: { 34 | overlay: { 35 | locked: false 36 | } 37 | } 38 | }); 39 | }, 40 | 41 | lazyLoadPostsImages: function() { 42 | $('#posts').find('img').lazyload({ 43 | //placeholder: '/images/loading.gif', 44 | effect : 'fadeIn', 45 | threshold: 0 46 | }); 47 | }, 48 | 49 | /** 50 | * Tabs tag listener (without twitter bootstrap). 51 | */ 52 | registerTabsTag: function() { 53 | var tNav = '.tabs ul.nav-tabs '; 54 | 55 | // Binding `nav-tabs` & `tab-content` by real time permalink changing. 56 | $(function() { 57 | $(window).bind('hashchange', function() { 58 | var tHash = location.hash; 59 | if (tHash !== '' && !tHash.match(/%\S{2}/)) { 60 | $(tNav + 'li:has(a[href="' + tHash + '"])').addClass('active').siblings().removeClass('active'); 61 | $(tHash).addClass('active').siblings().removeClass('active'); 62 | } 63 | }).trigger('hashchange'); 64 | }); 65 | 66 | $(tNav + '.tab').on('click', function(href) { 67 | href.preventDefault(); 68 | // Prevent selected tab to select again. 69 | if (!$(this).hasClass('active')) { 70 | 71 | // Add & Remove active class on `nav-tabs` & `tab-content`. 72 | $(this).addClass('active').siblings().removeClass('active'); 73 | var tActive = $(this).find('a').attr('href'); 74 | $(tActive).addClass('active').siblings().removeClass('active'); 75 | 76 | // Clear location hash in browser if #permalink exists. 77 | if (location.hash !== '') { 78 | history.pushState('', document.title, window.location.pathname + window.location.search); 79 | } 80 | } 81 | }); 82 | 83 | }, 84 | 85 | registerESCKeyEvent: function() { 86 | $(document).on('keyup', function(event) { 87 | var shouldDismissSearchPopup = event.which === 27 88 | && $('.search-popup').is(':visible'); 89 | if (shouldDismissSearchPopup) { 90 | $('.search-popup').hide(); 91 | $('.search-popup-overlay').remove(); 92 | $('body').css('overflow', ''); 93 | } 94 | }); 95 | }, 96 | 97 | registerBackToTop: function() { 98 | var THRESHOLD = 50; 99 | var $top = $('.back-to-top'); 100 | 101 | function initBackToTop() { 102 | $top.toggleClass('back-to-top-on', window.pageYOffset > THRESHOLD); 103 | 104 | var scrollTop = $(window).scrollTop(); 105 | var contentVisibilityHeight = NexT.utils.getContentVisibilityHeight(); 106 | var scrollPercent = scrollTop / contentVisibilityHeight; 107 | var scrollPercentRounded = Math.round(scrollPercent * 100); 108 | var scrollPercentMaxed = scrollPercentRounded > 100 ? 100 : scrollPercentRounded; 109 | $('#scrollpercent>span').html(scrollPercentMaxed); 110 | } 111 | 112 | // For init back to top in sidebar if page was scrolled after page refresh. 113 | $(window).on('load', function() { 114 | initBackToTop(); 115 | }); 116 | 117 | $(window).on('scroll', function() { 118 | initBackToTop(); 119 | }); 120 | 121 | $top.on('click', function() { 122 | $('body').velocity('scroll'); 123 | }); 124 | }, 125 | 126 | /** 127 | * Transform embedded video to support responsive layout. 128 | * @see http://toddmotto.com/fluid-and-responsive-youtube-and-vimeo-videos-with-fluidvids-js/ 129 | */ 130 | embeddedVideoTransformer: function() { 131 | var $iframes = $('iframe'); 132 | 133 | // Supported Players. Extend this if you need more players. 134 | var SUPPORTED_PLAYERS = [ 135 | 'www.youtube.com', 136 | 'player.vimeo.com', 137 | 'player.youku.com', 138 | 'music.163.com', 139 | 'www.tudou.com' 140 | ]; 141 | var pattern = new RegExp(SUPPORTED_PLAYERS.join('|')); 142 | 143 | function getDimension($element) { 144 | return { 145 | width : $element.width(), 146 | height: $element.height() 147 | }; 148 | } 149 | 150 | function getAspectRadio(width, height) { 151 | return height / width * 100; 152 | } 153 | 154 | $iframes.each(function() { 155 | var iframe = this; 156 | var $iframe = $(this); 157 | var oldDimension = getDimension($iframe); 158 | var newDimension; 159 | 160 | if (this.src.search(pattern) > 0) { 161 | 162 | // Calculate the video ratio based on the iframe's w/h dimensions 163 | var videoRatio = getAspectRadio(oldDimension.width, oldDimension.height); 164 | 165 | // Replace the iframe's dimensions and position the iframe absolute 166 | // This is the trick to emulate the video ratio 167 | $iframe.width('100%').height('100%') 168 | .css({ 169 | position: 'absolute', 170 | top : '0', 171 | left : '0' 172 | }); 173 | 174 | // Wrap the iframe in a new
which uses a dynamically fetched padding-top property 175 | // based on the video's w/h dimensions 176 | var wrap = document.createElement('div'); 177 | wrap.className = 'fluid-vids'; 178 | wrap.style.position = 'relative'; 179 | wrap.style.marginBottom = '20px'; 180 | wrap.style.width = '100%'; 181 | wrap.style.paddingTop = videoRatio + '%'; 182 | // Fix for appear inside tabs tag. 183 | (wrap.style.paddingTop === '') && (wrap.style.paddingTop = '50%'); 184 | 185 | // Add the iframe inside our newly created
186 | var iframeParent = iframe.parentNode; 187 | iframeParent.insertBefore(wrap, iframe); 188 | wrap.appendChild(iframe); 189 | 190 | // Additional adjustments for 163 Music 191 | if (this.src.search('music.163.com') > 0) { 192 | newDimension = getDimension($iframe); 193 | var shouldRecalculateAspect = newDimension.width > oldDimension.width 194 | || newDimension.height < oldDimension.height; 195 | 196 | // 163 Music Player has a fixed height, so we need to reset the aspect radio 197 | if (shouldRecalculateAspect) { 198 | wrap.style.paddingTop = getAspectRadio(newDimension.width, oldDimension.height) + '%'; 199 | } 200 | } 201 | } 202 | }); 203 | 204 | }, 205 | 206 | hasMobileUA: function() { 207 | var nav = window.navigator; 208 | var ua = nav.userAgent; 209 | var pa = /iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g; 210 | 211 | return pa.test(ua); 212 | }, 213 | 214 | isTablet: function() { 215 | return window.screen.width < 992 && window.screen.width > 767 && this.hasMobileUA(); 216 | }, 217 | 218 | isMobile: function() { 219 | return window.screen.width < 767 && this.hasMobileUA(); 220 | }, 221 | 222 | isDesktop: function() { 223 | return !this.isTablet() && !this.isMobile(); 224 | }, 225 | 226 | /** 227 | * Escape meta symbols in jQuery selectors. 228 | * 229 | * @param selector 230 | * @returns {string|void|XML|*} 231 | */ 232 | escapeSelector: function(selector) { 233 | return selector.replace(/[!"$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, '\\$&'); 234 | }, 235 | 236 | displaySidebar: function() { 237 | if (!this.isDesktop() || this.isPisces() || this.isGemini()) { 238 | return; 239 | } 240 | $('.sidebar-toggle').trigger('click'); 241 | }, 242 | 243 | isMist: function() { 244 | return CONFIG.scheme === 'Mist'; 245 | }, 246 | 247 | isPisces: function() { 248 | return CONFIG.scheme === 'Pisces'; 249 | }, 250 | 251 | isGemini: function() { 252 | return CONFIG.scheme === 'Gemini'; 253 | }, 254 | 255 | getScrollbarWidth: function() { 256 | var $div = $('
').addClass('scrollbar-measure').prependTo('body'); 257 | var div = $div[0]; 258 | var scrollbarWidth = div.offsetWidth - div.clientWidth; 259 | 260 | $div.remove(); 261 | 262 | return scrollbarWidth; 263 | }, 264 | 265 | getContentVisibilityHeight: function() { 266 | var docHeight = $('#content').height(); 267 | var winHeight = $(window).height(); 268 | var contentVisibilityHeight = docHeight > winHeight ? docHeight - winHeight : $(document).height() - winHeight; 269 | return contentVisibilityHeight; 270 | }, 271 | 272 | getSidebarb2tHeight: function() { 273 | //var sidebarb2tHeight = (CONFIG.sidebar.b2t) ? document.getElementsByClassName('back-to-top')[0].clientHeight : 0; 274 | var sidebarb2tHeight = CONFIG.sidebar.b2t ? $('.back-to-top').height() : 0; 275 | return sidebarb2tHeight; 276 | }, 277 | 278 | getSidebarSchemePadding: function() { 279 | var sidebarNavHeight = $('.sidebar-nav').css('display') === 'block' ? $('.sidebar-nav').outerHeight(true) : 0; 280 | var sidebarInner = $('.sidebar-inner'); 281 | var sidebarPadding = sidebarInner.innerWidth() - sidebarInner.width(); 282 | var sidebarOffset = CONFIG.sidebar.offset ? CONFIG.sidebar.offset : 12; 283 | var sidebarSchemePadding = this.isPisces() || this.isGemini() 284 | ? (sidebarPadding * 2) + sidebarNavHeight + sidebarOffset + this.getSidebarb2tHeight() 285 | : (sidebarPadding * 2) + (sidebarNavHeight / 2); 286 | return sidebarSchemePadding; 287 | } 288 | 289 | }; 290 | 291 | $(document).ready(function() { 292 | 293 | /** 294 | * Init Sidebar & TOC inner dimensions on all pages and for all schemes. 295 | * Need for Sidebar/TOC inner scrolling if content taller then viewport. 296 | */ 297 | 298 | function updateSidebarHeight(height) { 299 | height = height || 'auto'; 300 | $('.site-overview, .post-toc').css('max-height', height); 301 | } 302 | 303 | function initSidebarDimension() { 304 | var updateSidebarHeightTimer; 305 | 306 | $(window).on('resize', function() { 307 | updateSidebarHeightTimer && clearTimeout(updateSidebarHeightTimer); 308 | 309 | updateSidebarHeightTimer = setTimeout(function() { 310 | var sidebarWrapperHeight = document.body.clientHeight - NexT.utils.getSidebarSchemePadding(); 311 | 312 | updateSidebarHeight(sidebarWrapperHeight); 313 | }, 0); 314 | }); 315 | 316 | // Initialize Sidebar & TOC Width. 317 | var scrollbarWidth = NexT.utils.getScrollbarWidth(); 318 | if ($('.site-overview-wrap').height() > (document.body.clientHeight - NexT.utils.getSidebarSchemePadding())) { 319 | $('.site-overview').css('width', 'calc(100% + ' + scrollbarWidth + 'px)'); 320 | } 321 | if ($('.post-toc-wrap').height() > (document.body.clientHeight - NexT.utils.getSidebarSchemePadding())) { 322 | $('.post-toc').css('width', 'calc(100% + ' + scrollbarWidth + 'px)'); 323 | } 324 | 325 | // Initialize Sidebar & TOC Height. 326 | updateSidebarHeight(document.body.clientHeight - NexT.utils.getSidebarSchemePadding()); 327 | } 328 | 329 | initSidebarDimension(); 330 | 331 | }); 332 | -------------------------------------------------------------------------------- /js/src/motion.js: -------------------------------------------------------------------------------- 1 | /* global NexT, CONFIG */ 2 | 3 | $(document).ready(function() { 4 | NexT.motion = {}; 5 | 6 | var sidebarToggleLines = { 7 | lines: [], 8 | push : function(line) { 9 | this.lines.push(line); 10 | }, 11 | init: function() { 12 | this.lines.forEach(function(line) { 13 | line.init(); 14 | }); 15 | }, 16 | arrow: function() { 17 | this.lines.forEach(function(line) { 18 | line.arrow(); 19 | }); 20 | }, 21 | close: function() { 22 | this.lines.forEach(function(line) { 23 | line.close(); 24 | }); 25 | } 26 | }; 27 | 28 | function SidebarToggleLine(settings) { 29 | this.el = $(settings.el); 30 | this.status = $.extend({}, { 31 | init: { 32 | width : '100%', 33 | opacity: 1, 34 | left : 0, 35 | rotateZ: 0, 36 | top : 0 37 | } 38 | }, settings.status); 39 | } 40 | 41 | SidebarToggleLine.prototype.init = function() { 42 | this.transform('init'); 43 | }; 44 | SidebarToggleLine.prototype.arrow = function() { 45 | this.transform('arrow'); 46 | }; 47 | SidebarToggleLine.prototype.close = function() { 48 | this.transform('close'); 49 | }; 50 | SidebarToggleLine.prototype.transform = function(status) { 51 | this.el.velocity('stop').velocity(this.status[status]); 52 | }; 53 | 54 | var sidebarToggleLine1st = new SidebarToggleLine({ 55 | el : '.sidebar-toggle-line-first', 56 | status: { 57 | arrow: {width: '50%', rotateZ: '-45deg', top: '2px'}, 58 | close: {width: '100%', rotateZ: '-45deg', top: '5px'} 59 | } 60 | }); 61 | var sidebarToggleLine2nd = new SidebarToggleLine({ 62 | el : '.sidebar-toggle-line-middle', 63 | status: { 64 | arrow: {width: '90%'}, 65 | close: {opacity: 0} 66 | } 67 | }); 68 | var sidebarToggleLine3rd = new SidebarToggleLine({ 69 | el : '.sidebar-toggle-line-last', 70 | status: { 71 | arrow: {width: '50%', rotateZ: '45deg', top: '-2px'}, 72 | close: {width: '100%', rotateZ: '45deg', top: '-5px'} 73 | } 74 | }); 75 | 76 | sidebarToggleLines.push(sidebarToggleLine1st); 77 | sidebarToggleLines.push(sidebarToggleLine2nd); 78 | sidebarToggleLines.push(sidebarToggleLine3rd); 79 | 80 | var SIDEBAR_WIDTH = CONFIG.sidebar.width ? CONFIG.sidebar.width : '320px'; 81 | var SIDEBAR_DISPLAY_DURATION = 200; 82 | var xPos, yPos; 83 | 84 | var sidebarToggleMotion = { 85 | toggleEl : $('.sidebar-toggle'), 86 | dimmerEl : $('#sidebar-dimmer'), 87 | sidebarEl : $('.sidebar'), 88 | isSidebarVisible: false, 89 | init : function() { 90 | this.toggleEl.on('click', this.clickHandler.bind(this)); 91 | this.dimmerEl.on('click', this.clickHandler.bind(this)); 92 | this.toggleEl.on('mouseenter', this.mouseEnterHandler.bind(this)); 93 | this.toggleEl.on('mouseleave', this.mouseLeaveHandler.bind(this)); 94 | this.sidebarEl.on('touchstart', this.touchstartHandler.bind(this)); 95 | this.sidebarEl.on('touchend', this.touchendHandler.bind(this)); 96 | this.sidebarEl.on('touchmove', function(e) { e.preventDefault(); }); 97 | 98 | $(document) 99 | .on('sidebar.isShowing', function() { 100 | NexT.utils.isDesktop() && $('body').velocity('stop').velocity( 101 | {paddingRight: SIDEBAR_WIDTH}, 102 | SIDEBAR_DISPLAY_DURATION 103 | ); 104 | }) 105 | .on('sidebar.isHiding', function() { 106 | }); 107 | }, 108 | clickHandler: function() { 109 | this.isSidebarVisible ? this.hideSidebar() : this.showSidebar(); 110 | this.isSidebarVisible = !this.isSidebarVisible; 111 | }, 112 | mouseEnterHandler: function() { 113 | if (this.isSidebarVisible) { 114 | return; 115 | } 116 | sidebarToggleLines.arrow(); 117 | }, 118 | mouseLeaveHandler: function() { 119 | if (this.isSidebarVisible) { 120 | return; 121 | } 122 | sidebarToggleLines.init(); 123 | }, 124 | touchstartHandler: function(e) { 125 | xPos = e.originalEvent.touches[0].clientX; 126 | yPos = e.originalEvent.touches[0].clientY; 127 | }, 128 | touchendHandler: function(e) { 129 | var _xPos = e.originalEvent.changedTouches[0].clientX; 130 | var _yPos = e.originalEvent.changedTouches[0].clientY; 131 | if (_xPos - xPos > 30 && Math.abs(_yPos - yPos) < 20) { 132 | this.clickHandler(); 133 | } 134 | }, 135 | showSidebar: function() { 136 | var self = this; 137 | 138 | sidebarToggleLines.close(); 139 | 140 | this.sidebarEl.velocity('stop').velocity({ 141 | width: SIDEBAR_WIDTH 142 | }, { 143 | display : 'block', 144 | duration: SIDEBAR_DISPLAY_DURATION, 145 | begin : function() { 146 | $('.sidebar .motion-element').velocity( 147 | 'transition.slideRightIn', 148 | { 149 | stagger : 50, 150 | drag : true, 151 | complete: function() { 152 | self.sidebarEl.trigger('sidebar.motion.complete'); 153 | } 154 | } 155 | ); 156 | }, 157 | complete: function() { 158 | self.sidebarEl.addClass('sidebar-active'); 159 | self.sidebarEl.trigger('sidebar.didShow'); 160 | } 161 | } 162 | ); 163 | 164 | this.sidebarEl.trigger('sidebar.isShowing'); 165 | }, 166 | hideSidebar: function() { 167 | NexT.utils.isDesktop() && $('body').velocity('stop').velocity({paddingRight: 0}); 168 | this.sidebarEl.find('.motion-element').velocity('stop').css('display', 'none'); 169 | this.sidebarEl.velocity('stop').velocity({width: 0}, {display: 'none'}); 170 | 171 | sidebarToggleLines.init(); 172 | 173 | this.sidebarEl.removeClass('sidebar-active'); 174 | this.sidebarEl.trigger('sidebar.isHiding'); 175 | 176 | // Prevent adding TOC to Overview if Overview was selected when close & open sidebar. 177 | if ($('.post-toc-wrap')) { 178 | if ($('.site-overview-wrap').css('display') === 'block') { 179 | $('.post-toc-wrap').removeClass('motion-element'); 180 | } else { 181 | $('.post-toc-wrap').addClass('motion-element'); 182 | } 183 | } 184 | } 185 | }; 186 | sidebarToggleMotion.init(); 187 | 188 | NexT.motion.integrator = { 189 | queue : [], 190 | cursor: -1, 191 | add : function(fn) { 192 | this.queue.push(fn); 193 | return this; 194 | }, 195 | next: function() { 196 | this.cursor++; 197 | var fn = this.queue[this.cursor]; 198 | $.isFunction(fn) && fn(NexT.motion.integrator); 199 | }, 200 | bootstrap: function() { 201 | this.next(); 202 | } 203 | }; 204 | 205 | NexT.motion.middleWares = { 206 | logo: function(integrator) { 207 | var sequence = []; 208 | var $brand = $('.brand'); 209 | var $title = $('.site-title'); 210 | var $subtitle = $('.site-subtitle'); 211 | var $logoLineTop = $('.logo-line-before i'); 212 | var $logoLineBottom = $('.logo-line-after i'); 213 | 214 | $brand.length > 0 && sequence.push({ 215 | e: $brand, 216 | p: {opacity: 1}, 217 | o: {duration: 200} 218 | }); 219 | 220 | /** 221 | * Check if $elements exist. 222 | * @param {jQuery|Array} $elements 223 | * @returns {boolean} 224 | */ 225 | function hasElement($elements) { 226 | $elements = Array.isArray($elements) ? $elements : [$elements]; 227 | return $elements.every(function($element) { 228 | return $element.length > 0; 229 | }); 230 | } 231 | 232 | function getMistLineSettings(element, translateX) { 233 | return { 234 | e: $(element), 235 | p: {translateX: translateX}, 236 | o: { 237 | duration : 500, 238 | sequenceQueue: false 239 | } 240 | }; 241 | } 242 | 243 | NexT.utils.isMist() && hasElement([$logoLineTop, $logoLineBottom]) 244 | && sequence.push( 245 | getMistLineSettings($logoLineTop, '100%'), 246 | getMistLineSettings($logoLineBottom, '-100%') 247 | ); 248 | 249 | hasElement($title) && sequence.push({ 250 | e: $title, 251 | p: {opacity: 1, top: 0}, 252 | o: { duration: 200 } 253 | }); 254 | 255 | hasElement($subtitle) && sequence.push({ 256 | e: $subtitle, 257 | p: {opacity: 1, top: 0}, 258 | o: {duration: 200} 259 | }); 260 | 261 | if (CONFIG.motion.async) { 262 | integrator.next(); 263 | } 264 | 265 | if (sequence.length > 0) { 266 | sequence[sequence.length - 1].o.complete = function() { 267 | integrator.next(); 268 | }; 269 | /* eslint-disable */ 270 | $.Velocity.RunSequence(sequence); 271 | /* eslint-enable */ 272 | } else { 273 | integrator.next(); 274 | } 275 | }, 276 | 277 | menu: function(integrator) { 278 | 279 | if (CONFIG.motion.async) { 280 | integrator.next(); 281 | } 282 | 283 | $('.menu-item').velocity('transition.slideDownIn', { 284 | display : null, 285 | duration: 200, 286 | complete: function() { 287 | integrator.next(); 288 | } 289 | }); 290 | }, 291 | 292 | postList: function(integrator) { 293 | 294 | //var $post = $('.post'); 295 | var $postBlock = $('.post-block, .pagination, .comments'); 296 | var $postBlockTransition = CONFIG.motion.transition.post_block; 297 | var $postHeader = $('.post-header'); 298 | var $postHeaderTransition = CONFIG.motion.transition.post_header; 299 | var $postBody = $('.post-body'); 300 | var $postBodyTransition = CONFIG.motion.transition.post_body; 301 | var $collHeader = $('.collection-title, .archive-year'); 302 | var $collHeaderTransition = CONFIG.motion.transition.coll_header; 303 | var $sidebarAffix = $('.sidebar-inner'); 304 | var $sidebarAffixTransition = CONFIG.motion.transition.sidebar; 305 | var hasPost = $postBlock.length > 0; 306 | 307 | function postMotion() { 308 | var postMotionOptions = window.postMotionOptions || { 309 | stagger: 100, 310 | drag : true 311 | }; 312 | postMotionOptions.complete = function() { 313 | // After motion complete need to remove transform from sidebar to let affix work on Pisces | Gemini. 314 | if (CONFIG.motion.transition.sidebar && (NexT.utils.isPisces() || NexT.utils.isGemini())) { 315 | $sidebarAffix.css({ 'transform': 'initial' }); 316 | } 317 | integrator.next(); 318 | }; 319 | 320 | //$post.velocity('transition.slideDownIn', postMotionOptions); 321 | if (CONFIG.motion.transition.post_block) { 322 | $postBlock.velocity('transition.' + $postBlockTransition, postMotionOptions); 323 | } 324 | if (CONFIG.motion.transition.post_header) { 325 | $postHeader.velocity('transition.' + $postHeaderTransition, postMotionOptions); 326 | } 327 | if (CONFIG.motion.transition.post_body) { 328 | $postBody.velocity('transition.' + $postBodyTransition, postMotionOptions); 329 | } 330 | if (CONFIG.motion.transition.coll_header) { 331 | $collHeader.velocity('transition.' + $collHeaderTransition, postMotionOptions); 332 | } 333 | // Only for Pisces | Gemini. 334 | if (CONFIG.motion.transition.sidebar && (NexT.utils.isPisces() || NexT.utils.isGemini())) { 335 | $sidebarAffix.velocity('transition.' + $sidebarAffixTransition, postMotionOptions); 336 | } 337 | } 338 | 339 | hasPost ? postMotion() : integrator.next(); 340 | 341 | if (CONFIG.motion.async) { 342 | integrator.next(); 343 | } 344 | }, 345 | 346 | sidebar: function(integrator) { 347 | if (CONFIG.sidebar.display === 'always') { 348 | NexT.utils.displaySidebar(); 349 | } 350 | integrator.next(); 351 | } 352 | }; 353 | 354 | }); 355 | -------------------------------------------------------------------------------- /js/src/axios.js: -------------------------------------------------------------------------------- 1 | /* axios v0.18.0 | (c) 2018 by Matt Zabriskie */ 2 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new s(e),n=i(s.prototype.request,t);return o.extend(n,s.prototype,t),o.extend(n,t),n}var o=n(2),i=n(3),s=n(5),u=n(6),a=r(u);a.Axios=s,a.create=function(e){return r(o.merge(u,e))},a.Cancel=n(23),a.CancelToken=n(24),a.isCancel=n(20),a.all=function(e){return Promise.all(e)},a.spread=n(25),e.exports=a,e.exports.default=a},function(e,t,n){"use strict";function r(e){return"[object Array]"===R.call(e)}function o(e){return"[object ArrayBuffer]"===R.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function a(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===R.call(e)}function d(e){return"[object File]"===R.call(e)}function l(e){return"[object Blob]"===R.call(e)}function h(e){return"[object Function]"===R.call(e)}function m(e){return f(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function w(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n 6 | * @license MIT 7 | */ 8 | e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new s,response:new s}}var o=n(6),i=n(2),s=n(17),u=n(18);r.prototype.request=function(e){"string"==typeof e&&(e=i.merge({url:arguments[0]},arguments[1])),e=i.merge(o,{method:"get"},this.defaults,e),e.method=e.method.toLowerCase();var t=[u,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},i.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(8):"undefined"!=typeof process&&(e=n(8)),e}var i=n(2),s=n(7),u={"Content-Type":"application/x-www-form-urlencoded"},a={adapter:o(),transformRequest:[function(e,t){return s(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};a.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){a.headers[e]={}}),i.forEach(["post","put","patch"],function(e){a.headers[e]=i.merge(u)}),e.exports=a},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(9),i=n(12),s=n(13),u=n(14),a=n(10),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(15);e.exports=function(e){return new Promise(function(t,f){var p=e.data,d=e.headers;r.isFormData(p)&&delete d["Content-Type"];var l=new XMLHttpRequest,h="onreadystatechange",m=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in l||u(e.url)||(l=new window.XDomainRequest,h="onload",m=!0,l.onprogress=function(){},l.ontimeout=function(){}),e.auth){var y=e.auth.username||"",w=e.auth.password||"";d.Authorization="Basic "+c(y+":"+w)}if(l.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,l[h]=function(){if(l&&(4===l.readyState||m)&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in l?s(l.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?l.response:l.responseText,i={data:r,status:1223===l.status?204:l.status,statusText:1223===l.status?"No Content":l.statusText,headers:n,config:e,request:l};o(t,f,i),l=null}},l.onerror=function(){f(a("Network Error",e,null,l)),l=null},l.ontimeout=function(){f(a("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",l)),l=null},r.isStandardBrowserEnv()){var g=n(16),v=(e.withCredentials||u(e.url))&&e.xsrfCookieName?g.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in l&&r.forEach(d,function(e,t){"undefined"==typeof p&&"content-type"===t.toLowerCase()?delete d[t]:l.setRequestHeader(t,e)}),e.withCredentials&&(l.withCredentials=!0),e.responseType)try{l.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){l&&(l.abort(),f(e),l=null)}),void 0===p&&(p=null),l.send(p)})}},function(e,t,n){"use strict";var r=n(10);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},function(e,t,n){"use strict";var r=n(11);e.exports=function(e,t,n,o,i){var s=new Error(e);return r(s,t,n,o,i)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(o.isURLSearchParams(t))i=t.toString();else{var s=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),s.push(r(t)+"="+r(e))}))}),i=s.join("&")}return i&&(e+=(e.indexOf("?")===-1?"?":"&")+i),e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,s={};return e?(r.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(s[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?s[t]=(s[t]?s[t]:[]).concat([n]):s[t]=s[t]?s[t]+", "+n:n}}),s):s}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function n(){this.message="String contains an invalid character"}function r(e){for(var t,r,i=String(e),s="",u=0,a=o;i.charAt(0|u)||(a="=",u%1);s+=a.charAt(63&t>>8-u%1*8)){if(r=i.charCodeAt(u+=.75),r>255)throw new n;t=t<<8|r}return s}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",e.exports=r},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,s){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),s===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),i=n(19),s=n(20),u=n(6),a=n(21),c=n(22);e.exports=function(e){r(e),e.baseURL&&!a(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||u.adapter;return t(e).then(function(t){return r(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return s(t)||(r(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); 9 | //# sourceMappingURL=axios.min.map -------------------------------------------------------------------------------- /lib/ua-parser-js/dist/ua-parser.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * UAParser.js v0.7.9 3 | * Lightweight JavaScript-based User-Agent string parser 4 | * https://github.com/faisalman/ua-parser-js 5 | * 6 | * Copyright © 2012-2015 Faisal Salman 7 | * Dual licensed under GPLv2 & MIT 8 | */ 9 | (function(window,undefined){"use strict";var LIBVERSION="0.7.9",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded";var util={extend:function(regexes,extensions){for(var i in extensions){if("browser cpu device engine os".indexOf(i)!==-1&&extensions[i].length%2===0){regexes[i]=extensions[i].concat(regexes[i])}}return regexes},has:function(str1,str2){if(typeof str1==="string"){return str2.toLowerCase().indexOf(str1.toLowerCase())!==-1}else{return false}},lowerize:function(str){return str.toLowerCase()},major:function(version){return typeof version===STR_TYPE?version.split(".")[0]:undefined}};var mapper={rgx:function(){var result,i=0,j,k,p,q,matches,match,args=arguments;while(i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){result[q[0]]=q[1].call(this,match)}else{result[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){result[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{result[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){result[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{result[q]=match?match:undefined}}}}i+=2}return result},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;jparseFloat(e[1])):!1}if(!t.Velocity||!t.Velocity.Utilities)return void(a.console&&console.log("Velocity UI Pack: Velocity must be loaded first. Aborting."));var i=t.Velocity,$=i.Utilities,s=i.version,o={major:1,minor:1,patch:0};if(n(o,s)){var l="Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.";throw alert(l),new Error(l)}i.RegisterEffect=i.RegisterUI=function(t,a){function e(t,a,e,r){var n=0,s;$.each(t.nodeType?[t]:t,function(t,a){r&&(e+=t*r),s=a.parentNode,$.each(["height","paddingTop","paddingBottom","marginTop","marginBottom"],function(t,e){n+=parseFloat(i.CSS.getPropertyValue(a,e))})}),i.animate(s,{height:("In"===a?"+":"-")+"="+n},{queue:!1,easing:"ease-in-out",duration:e*("In"===a?.6:1)})}return i.Redirects[t]=function(n,s,o,l,c,u){function f(){s.display!==r&&"none"!==s.display||!/Out$/.test(t)||$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"display","none")}),s.complete&&s.complete.call(c,c),u&&u.resolver(c||n)}var p=o===l-1;a.defaultDuration="function"==typeof a.defaultDuration?a.defaultDuration.call(c,c):parseFloat(a.defaultDuration);for(var d=0;d1&&($.each(a.reverse(),function(t,e){var r=a[t+1];if(r){var n=e.o||e.options,s=r.o||r.options,o=n&&n.sequenceQueue===!1?"begin":"complete",l=s&&s[o],c={};c[o]=function(){var t=r.e||r.elements,a=t.nodeType?[t]:t;l&&l.call(a,a),i(e)},r.o?r.o=$.extend({},s,c):r.options=$.extend({},s,c)}}),a.reverse()),i(a[0])}}(window.jQuery||window.Zepto||window,window,document)}); -------------------------------------------------------------------------------- /tags/源码/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 125 | 126 | Tag: 源码 | 戴伟的个人博客 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 565 | 566 | 567 | 568 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | -------------------------------------------------------------------------------- /tags/总结/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 125 | 126 | Tag: 总结 | 戴伟的个人博客 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 565 | 566 | 567 | 568 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | -------------------------------------------------------------------------------- /tags/插件/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 125 | 126 | Tag: 插件 | 戴伟的个人博客 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 565 | 566 | 567 | 568 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | --------------------------------------------------------------------------------