Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: docsifyjs/docsify
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.2
Choose a base ref
...
head repository: docsifyjs/docsify
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.3
Choose a head ref
  • 6 commits
  • 16 files changed
  • 3 contributors

Commits on Feb 19, 2017

  1. tweaks code

    QingWei-Li committed Feb 19, 2017
    Copy the full SHA
    46ff5e1 View commit details
  2. fix(scroll) highlight bug

    QingWei-Li committed Feb 19, 2017
    Copy the full SHA
    6b08546 View commit details
  3. fixed look of links in blockquote

    Jintzo authored and QingWei-Li committed Feb 19, 2017
    Copy the full SHA
    f15e45c View commit details
  4. Change description for Snipaste (#84)

    liulex authored and QingWei-Li committed Feb 19, 2017
    Copy the full SHA
    42fb331 View commit details
  5. bump: 3.0.3

    QingWei-Li committed Feb 19, 2017
    Copy the full SHA
    066fff4 View commit details
  6. -> v3.0.3

    QingWei-Li committed Feb 19, 2017
    Copy the full SHA
    be6dcac View commit details
Showing with 137 additions and 119 deletions.
  1. +6 −0 CHANGELOG.md
  2. +1 −1 README.md
  3. +1 −2 dev.html
  4. +56 −54 lib/docsify.js
  5. +2 −2 lib/docsify.min.js
  6. +1 −1 lib/themes/buble.css
  7. +1 −1 lib/themes/dark.css
  8. +1 −1 lib/themes/pure.css
  9. +1 −1 lib/themes/vue.css
  10. +1 −1 package.json
  11. +51 −50 src/core/event/scroll.js
  12. +0 −1 src/core/index.js
  13. +3 −1 src/core/render/index.js
  14. +1 −1 src/core/util/dom.js
  15. +10 −1 src/themes/basic/_coverpage.css
  16. +1 −1 src/themes/basic/_layout.css
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

3.0.3 / 2017-02-19
==================

* fixed look of links in blockquote
* fix(scroll) highlight bug

3.0.2 / 2017-02-19
==================

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ Modern browsers and Internet Explorer 9+.
## Showcase
These open-source projects are using docsify to generate their sites. Pull requests welcome : )

- [Snipaste](https://docs.snipaste.com/) - A new way to boost your productivity.
- [Snipaste](https://docs.snipaste.com/) - Snip & Paste
- [puck](https://puck.zz173.com/) - A small & magical php framework.
- [Samaritan](http://samaritan.stockdb.org) - An Algorithmic Trading Framework for Digital Currency.
- [Vudash](http://vudash.github.io/vudash/) - Powerful, Flexible, Open Source dashboards for anything
3 changes: 1 addition & 2 deletions dev.html
Original file line number Diff line number Diff line change
@@ -26,8 +26,7 @@
</script>
<script
src="/lib/docsify.js"
data-name="sdfsdf"
data-name-link="//www.baidu.com"
data-name="docsify"
data-base-path="/docs/"
data-load-sidebar
data-sub-max-level="2"
110 changes: 56 additions & 54 deletions lib/docsify.js
Original file line number Diff line number Diff line change
@@ -213,11 +213,11 @@ function on (el, type, handler) {
: el.addEventListener(type, handler);
}

var off = function on (el, type, handler) {
function off (el, type, handler) {
isFn(type)
? window.removeEventListener(el, type)
: el.removeEventListener(type, handler);
};
}

/**
* Toggle class
@@ -464,17 +464,62 @@ function getAndActive (el, isParent, autoTitle) {
return target
}

function scrollActiveSidebar () {
if (isMobile) { return }
var nav = {};
var hoverOver = false;

var hoverOver = false;
function highlight () {
var sidebar = getNode('.sidebar');
var anchors = findAll('.anchor');
var sidebar = find('.sidebar');
var wrap = find(sidebar, '.sidebar-nav');
var active = find(sidebar, 'li.active');
var top = body.scrollTop;
var last;

for (var i = 0, len = anchors.length; i < len; i += 1) {
var node = anchors[i];

if (node.offsetTop > top) {
if (!last) { last = node; }
break
} else {
last = node;
}
}
if (!last) { return }
var li = nav[last.getAttribute('data-id')];

if (!li || li === active) { return }

active && active.classList.remove('active');
li.classList.add('active');
active = li;

// scroll into view
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
if (!hoverOver && body.classList.contains('sticky')) {
var height = sidebar.clientHeight;
var curOffset = 0;
var cur = active.offsetTop + active.clientHeight + 40;
var isInView = (
active.offsetTop >= wrap.scrollTop &&
cur <= wrap.scrollTop + height
);
var notThan = cur - curOffset < height;
var top$1 = isInView
? wrap.scrollTop
: notThan
? curOffset
: cur - height;

sidebar.scrollTop = top$1;
}
}

function scrollActiveSidebar () {
if (isMobile) { return }

var nav = {};
var sidebar = getNode('.sidebar');
var lis = findAll(sidebar, 'li');
var active = find(sidebar, 'li.active');

for (var i = 0, len = lis.length; i < len; i += 1) {
var li = lis[i];
@@ -489,50 +534,6 @@ function scrollActiveSidebar () {
nav[decodeURIComponent(href)] = li;
}

function highlight () {
var top = body.scrollTop;
var last;

for (var i = 0, len = anchors.length; i < len; i += 1) {
var node = anchors[i];

if (node.offsetTop > top) {
if (!last) { last = node; }
break
} else {
last = node;
}
}
if (!last) { return }
var li = nav[last.getAttribute('data-id')];

if (!li || li === active) { return }

active && active.classList.remove('active');
li.classList.add('active');
active = li;

// scroll into view
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
if (!hoverOver && body.classList.contains('sticky')) {
var height = sidebar.clientHeight;
var curOffset = 0;
var cur = active.offsetTop + active.clientHeight + 40;
var isInView = (
active.offsetTop >= wrap.scrollTop &&
cur <= wrap.scrollTop + height
);
var notThan = cur - curOffset < height;
var top$1 = isInView
? wrap.scrollTop
: notThan
? curOffset
: cur - height;

sidebar.scrollTop = top$1;
}
}

off('scroll', highlight);
on('scroll', highlight);
on(sidebar, 'mouseover', function () { hoverOver = true; });
@@ -3108,10 +3109,12 @@ function renderMain (html) {
// execute script
this.config.executeScript && executeScript();

if (!this.config.executeScript &&
if (this.config.executeScript !== false &&
typeof window.Vue !== 'undefined' &&
!executeScript()) {
setTimeout(function (_) {
var vueVM = window.__EXECUTE_RESULT__;
vueVM && vueVM.$destroy && vueVM.$destroy();
window.__EXECUTE_RESULT__ = new window.Vue().$mount('#main');
}, 0);
}
@@ -3449,7 +3452,6 @@ initGlobalAPI();
/**
* Run Docsify
*/

setTimeout(function (_) { return new Docsify(); }, 0);

}());
Loading