├── README.md
├── .gitignore
├── favicon.ico
├── theme
├── favicon.ico
├── assets
│ ├── icons
│ │ ├── favicon.ico
│ │ ├── origin.png
│ │ ├── apple-icon.png
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon-96x96.png
│ │ ├── ms-icon-70x70.png
│ │ ├── apple-icon-57x57.png
│ │ ├── apple-icon-60x60.png
│ │ ├── apple-icon-72x72.png
│ │ ├── apple-icon-76x76.png
│ │ ├── ms-icon-144x144.png
│ │ ├── ms-icon-150x150.png
│ │ ├── ms-icon-310x310.png
│ │ ├── android-icon-36x36.png
│ │ ├── android-icon-48x48.png
│ │ ├── android-icon-72x72.png
│ │ ├── android-icon-96x96.png
│ │ ├── apple-icon-114x114.png
│ │ ├── apple-icon-120x120.png
│ │ ├── apple-icon-144x144.png
│ │ ├── apple-icon-152x152.png
│ │ ├── apple-icon-180x180.png
│ │ ├── android-icon-144x144.png
│ │ ├── android-icon-192x192.png
│ │ ├── apple-icon-precomposed.png
│ │ ├── browserconfig.xml
│ │ └── manifest.json
│ ├── fonts
│ │ ├── iconfont.eot
│ │ ├── iconfont.ttf
│ │ ├── iconfont.woff
│ │ └── iconfont.svg
│ ├── js
│ │ ├── social-share.min.js
│ │ └── app.js
│ └── css
│ │ └── app.min.css.map
├── foot.template
├── hero.template
├── favicon.template
├── pre-next.template
├── breadcrumb.template
├── page.template
├── main.template
├── nav.template
├── chapters.template
└── script.template
├── index.js
├── scripts
├── hashChange.js
├── support.js
├── insertArticleToc.js
├── goTop.js
├── tocHide.js
├── navbarHandler.js
├── index.js
├── setMinHeight.js
├── menuHandler.js
└── social-share.js
├── postcss.config.js
├── package.json
└── sass
├── highlight.sass.vs2015
├── generic.scss
├── highlight.sass
├── wangdoc.sass
└── social.scss
/README.md:
--------------------------------------------------------------------------------
1 | Wangdoc 文档页面的默认主题。
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | npm-debug.log
3 | package-lock.json
4 |
--------------------------------------------------------------------------------
/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/favicon.ico
--------------------------------------------------------------------------------
/theme/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/favicon.ico
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | var path = require('path');
2 |
3 | module.exports = path.resolve(__dirname, `theme`);
4 |
--------------------------------------------------------------------------------
/theme/assets/icons/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/favicon.ico
--------------------------------------------------------------------------------
/theme/assets/icons/origin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/origin.png
--------------------------------------------------------------------------------
/theme/assets/fonts/iconfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/fonts/iconfont.eot
--------------------------------------------------------------------------------
/theme/assets/fonts/iconfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/fonts/iconfont.ttf
--------------------------------------------------------------------------------
/theme/assets/fonts/iconfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/fonts/iconfont.woff
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon.png
--------------------------------------------------------------------------------
/theme/assets/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/theme/assets/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/theme/assets/icons/favicon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/favicon-96x96.png
--------------------------------------------------------------------------------
/theme/assets/icons/ms-icon-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/ms-icon-70x70.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-57x57.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-60x60.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-72x72.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-76x76.png
--------------------------------------------------------------------------------
/theme/assets/icons/ms-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/ms-icon-144x144.png
--------------------------------------------------------------------------------
/theme/assets/icons/ms-icon-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/ms-icon-150x150.png
--------------------------------------------------------------------------------
/theme/assets/icons/ms-icon-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/ms-icon-310x310.png
--------------------------------------------------------------------------------
/theme/assets/icons/android-icon-36x36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/android-icon-36x36.png
--------------------------------------------------------------------------------
/theme/assets/icons/android-icon-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/android-icon-48x48.png
--------------------------------------------------------------------------------
/theme/assets/icons/android-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/android-icon-72x72.png
--------------------------------------------------------------------------------
/theme/assets/icons/android-icon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/android-icon-96x96.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-114x114.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-120x120.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-144x144.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-152x152.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-180x180.png
--------------------------------------------------------------------------------
/theme/assets/icons/android-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/android-icon-144x144.png
--------------------------------------------------------------------------------
/theme/assets/icons/android-icon-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/android-icon-192x192.png
--------------------------------------------------------------------------------
/theme/assets/icons/apple-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangdoc/loppo-theme-wangdoc/HEAD/theme/assets/icons/apple-icon-precomposed.png
--------------------------------------------------------------------------------
/theme/foot.template:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/theme/assets/icons/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 | <%= site %>
5 |
本教程采用知识共享 署名-相同方式共享 3.0协议。
28 |分享本文
29 |二维码便可将本文分享至朋友圈。
",wechatQrcodeSize:100,sites:["weibo","qq","wechat","tencent","douban","qzone","linkedin","diandian","facebook","twitter","google"],mobileSites:[],disabled:[],initialized:!1},w={qzone:"http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={{URL}}&title={{TITLE}}&desc={{DESCRIPTION}}&summary={{SUMMARY}}&site={{SOURCE}}",qq:'http://connect.qq.com/widget/shareqq/index.html?url={{URL}}&title={{TITLE}}&source={{SOURCE}}&desc={{DESCRIPTION}}&pics={{IMAGE}}&summary="{{SUMMARY}}"',tencent:"http://share.v.t.qq.com/index.php?c=share&a=index&title={{TITLE}}&url={{URL}}&pic={{IMAGE}}",weibo:"http://service.weibo.com/share/share.php?url={{URL}}&title={{TITLE}}&pic={{IMAGE}}&appkey={{WEIBOKEY}}",wechat:"javascript:",douban:"http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11",diandian:"http://www.diandian.com/share?lo={{URL}}&ti={{TITLE}}&type=link",linkedin:"http://www.linkedin.com/shareArticle?mini=true&ro=true&title={{TITLE}}&url={{URL}}&summary={{SUMMARY}}&source={{SOURCE}}&armin=armin",facebook:"https://www.facebook.com/sharer/sharer.php?u={{URL}}",twitter:"https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}&via={{ORIGIN}}",google:"https://plus.google.com/share?url={{URL}}"};t.socialShare=function(t,e){(t="string"==typeof t?n(t):t).length===r&&(t=[t]),h(t,function(t){t.initialized||i(t,e)})},function(r){var i="addEventListener",n=e[i]?"":"on";~e.readyState.indexOf("m")?r():"load DOMContentLoaded readystatechange".replace(/\w+/g,function(o,a){(a?e:t)[n?"attachEvent":i](n+o,function(){r&&(a<6||~e.readyState.indexOf("m"))&&(r(),r=0)},!1)})}(function(){socialShare(".social-share, .share-component")})}(window,document); 2 | -------------------------------------------------------------------------------- /theme/assets/js/app.js: -------------------------------------------------------------------------------- 1 | (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i微信里点“发现”,扫一下
二维码便可将本文分享至朋友圈。
",wechatQrcodeSize:100,sites:["weibo","qq","wechat","tencent","douban","qzone","linkedin","diandian","facebook","twitter","google"],mobileSites:[],disabled:[],initialized:!1},p={qzone:"http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={{URL}}&title={{TITLE}}&desc={{DESCRIPTION}}&summary={{SUMMARY}}&site={{SOURCE}}",qq:'http://connect.qq.com/widget/shareqq/index.html?url={{URL}}&title={{TITLE}}&source={{SOURCE}}&desc={{DESCRIPTION}}&pics={{IMAGE}}&summary="{{SUMMARY}}"',tencent:"http://share.v.t.qq.com/index.php?c=share&a=index&title={{TITLE}}&url={{URL}}&pic={{IMAGE}}",weibo:"https://service.weibo.com/share/share.php?url={{URL}}&title={{TITLE}}&pic={{IMAGE}}&appkey={{WEIBOKEY}}",wechat:"javascript:",douban:"http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11",diandian:"http://www.diandian.com/share?lo={{URL}}&ti={{TITLE}}&type=link",linkedin:"http://www.linkedin.com/shareArticle?mini=true&ro=true&title={{TITLE}}&url={{URL}}&summary={{SUMMARY}}&source={{SOURCE}}&armin=armin",facebook:"https://www.facebook.com/sharer/sharer.php?u={{URL}}",twitter:"https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}",google:"https://plus.google.com/share?url={{URL}}"};function m(r){return(e.querySelectorAll||t.jQuery||t.Zepto||function(t){var r=[];return C(t.split(/\s*,\s*/),function(i){var n=i.match(/([#.])(\w+)/);if(null===n)throw Error("Supports only simple single #ID or .CLASS selector.");if(n[1]){var o=e.getElementById(n[2]);o&&r.push(o)}r=r.concat(w(t))}),r}).call(e,r)}function v(t){return(e.getElementsByName(t)[0]||0).content}function w(t,e,r){if(t.getElementsByClassName)return t.getElementsByClassName(e);var i=[],n=t.getElementsByTagName(r||"*");return e=" "+e+" ",C(n,function(t){(" "+(t.className||"")+" ").indexOf(e)>=0&&i.push(t)}),i}function _(t){var r=e.createElement("div");return r.innerHTML=t,r.childNodes}function C(t,e){var i=t.length;if(i===r){for(var n in t)if(t.hasOwnProperty(n)&&!1===e.call(t[n],t[n],n))break}else for(var o=0;o');if(!a.length)return!0;a[0].href=o,"wechat"===i?a[0].tabindex=-1:a[0].target="_blank",e.initialized||(n?t.insertBefore(a[0],t.firstChild):t.appendChild(a[0]))})}(t,i),function(t,e){var r=w(t,"icon-wechat","a");if(0===r.length)return!1;var i=_('| '); 249 | } 250 | 251 | aHTML.push(' |
624 | * socialShare('.share-components');
625 | *
626 | * // or
627 | *
628 | * socialShare('.share-bar', {
629 | * sites: ['qzone', 'qq', 'weibo','wechat'],
630 | * // ...
631 | * });
632 | *
633 | */
634 | ;(function (window, document, undefined) {
635 |
636 | // Initialize a variables.
637 |
638 | var Array$indexOf = Array.prototype.indexOf;
639 | var Object$assign = Object.assign;
640 |
641 | var runningInWeChat = /MicroMessenger/i.test(navigator.userAgent);
642 | var isMobileScreen = document.documentElement.clientWidth <= 768;
643 |
644 | var image = (document.images[0] || 0).src || '';
645 | var site = getMetaContentByName('site') || getMetaContentByName('Site') || document.title;
646 | var title = getMetaContentByName('title') || getMetaContentByName('Title') || document.title;
647 | var description = getMetaContentByName('description') || getMetaContentByName('Description') || '';
648 |
649 | var defaults = {
650 | url: location.href,
651 | origin: location.origin,
652 | source: site,
653 | title: title,
654 | description: description,
655 | image: image,
656 | imageSelector: undefined,
657 |
658 | weiboKey: '',
659 |
660 | wechatQrcodeTitle: '微信扫一扫:分享',
661 | wechatQrcodeHelper: '微信里点“发现”,扫一下
二维码便可将本文分享至朋友圈。
', 662 | wechatQrcodeSize: 100, 663 | 664 | sites: ['weibo', 'qq', 'wechat', 'tencent', 'douban', 'qzone', 'linkedin', 'diandian', 'facebook', 'twitter', 'google'], 665 | mobileSites: [], 666 | disabled: [], 667 | initialized: false 668 | }; 669 | 670 | var templates = { 671 | qzone: 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={{URL}}&title={{TITLE}}&desc={{DESCRIPTION}}&summary={{SUMMARY}}&site={{SOURCE}}', 672 | qq: 'http://connect.qq.com/widget/shareqq/index.html?url={{URL}}&title={{TITLE}}&source={{SOURCE}}&desc={{DESCRIPTION}}&pics={{IMAGE}}&summary="{{SUMMARY}}"', 673 | tencent: 'http://share.v.t.qq.com/index.php?c=share&a=index&title={{TITLE}}&url={{URL}}&pic={{IMAGE}}', 674 | weibo: 'https://service.weibo.com/share/share.php?url={{URL}}&title={{TITLE}}&pic={{IMAGE}}&appkey={{WEIBOKEY}}', 675 | wechat: 'javascript:', 676 | douban: 'http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11', 677 | diandian: 'http://www.diandian.com/share?lo={{URL}}&ti={{TITLE}}&type=link', 678 | linkedin: 'http://www.linkedin.com/shareArticle?mini=true&ro=true&title={{TITLE}}&url={{URL}}&summary={{SUMMARY}}&source={{SOURCE}}&armin=armin', 679 | facebook: 'https://www.facebook.com/sharer/sharer.php?u={{URL}}', 680 | twitter: 'https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}', 681 | google: 'https://plus.google.com/share?url={{URL}}' 682 | }; 683 | 684 | 685 | /** 686 | * Expose API to the global 687 | * 688 | * @param {String|Element} elem 689 | * @param {Object} options 690 | */ 691 | window.socialShare = function (elem, options) { 692 | elem = typeof elem === 'string' ? querySelectorAlls(elem) : elem; 693 | 694 | if (elem.length === undefined) { 695 | elem = [elem]; 696 | } 697 | 698 | each(elem, function (el) { 699 | if (!el.initialized) { 700 | share(el, options); 701 | } 702 | }); 703 | }; 704 | 705 | // Domready after initialization 706 | alReady(function () { 707 | socialShare('.social-share, .share-component'); 708 | }); 709 | 710 | 711 | /** 712 | * Initialize a share bar. 713 | * 714 | * @param {Object} $options globals (optional). 715 | * 716 | * @return {Void} 717 | */ 718 | function share(elem, options) { 719 | var data = mixin({}, defaults, options || {}, dataset(elem)); 720 | 721 | if (data.imageSelector) { 722 | data.image = querySelectorAlls(data.imageSelector).map(function(item) { 723 | return item.src; 724 | }).join('||'); 725 | } 726 | 727 | addClass(elem, 'share-component social-share'); 728 | createIcons(elem, data); 729 | createWechat(elem, data); 730 | 731 | elem.initialized = true; 732 | } 733 | 734 | 735 | /** 736 | * Create site icons 737 | * 738 | * @param {Element} elem 739 | * @param {Object} data 740 | */ 741 | function createIcons(elem, data) { 742 | var sites = getSites(data); 743 | var isPrepend = data.mode == 'prepend'; 744 | 745 | each(isPrepend ? sites.reverse() : sites, function (name) { 746 | var url = makeUrl(name, data); 747 | var link = data.initialized ? getElementsByClassName(elem, 'icon-' + name) : createElementByString(''); 748 | 749 | if (!link.length) { 750 | return true; 751 | } 752 | 753 | link[0].href = url; 754 | 755 | if (name === 'wechat') { 756 | link[0].tabindex = -1; 757 | } else { 758 | link[0].target = '_blank'; 759 | } 760 | 761 | if (!data.initialized) { 762 | isPrepend ? elem.insertBefore(link[0], elem.firstChild) : elem.appendChild(link[0]); 763 | } 764 | }); 765 | } 766 | 767 | 768 | /** 769 | * Create the wechat icon and QRCode. 770 | * 771 | * @param {Element} elem 772 | * @param {Object} data 773 | */ 774 | function createWechat (elem, data) { 775 | var wechat = getElementsByClassName(elem, 'icon-wechat', 'a'); 776 | 777 | if (wechat.length === 0) { 778 | return false; 779 | } 780 | 781 | var elems = createElementByString('