From 420b898e6af538d37679ba01272cd8592a23d7f2 Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 10:34:31 +0200 Subject: [PATCH 1/8] Add callback to animation end --- src/javascripts/jquery.tocify.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index f464d95..7a309a0 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -130,7 +130,7 @@ // **highlightDefault**: Accepts a boolean: true or false // Set's the first TOC item as active if no other TOC item is active. - highlightDefault: true + highlightDefault: true, }, @@ -973,6 +973,8 @@ // Sets the smoothScroll animation time duration to the smoothScrollSpeed option "duration": duration + }, function(){ + currentDiv.trigger('tocify.scrollEnd'); }); }); From 9cddc8c29ecba1ad0e5185632b3672b0405dab0e Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 10:36:22 +0200 Subject: [PATCH 2/8] fix spelling --- src/javascripts/jquery.tocify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index 7a309a0..e372559 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -130,7 +130,7 @@ // **highlightDefault**: Accepts a boolean: true or false // Set's the first TOC item as active if no other TOC item is active. - highlightDefault: true, + highlightDefault: true }, From 3b139daecb96eee53a307a00a9e2f1b3c9e6ce51 Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 10:46:38 +0200 Subject: [PATCH 3/8] Update jquery.tocify.js --- src/javascripts/jquery.tocify.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index e372559..84f9786 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -971,10 +971,11 @@ }, { // Sets the smoothScroll animation time duration to the smoothScrollSpeed option - "duration": duration - - }, function(){ - currentDiv.trigger('tocify.scrollEnd'); + "duration": duration, + "complete": function() { + currentDiv.trigger('tocify.scrollEnd'); + } + } }); }); From dddf6bc19c67d514c5b0e65cce5fe2eb05fe2676 Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 10:48:19 +0200 Subject: [PATCH 4/8] Update jquery.tocify.js --- src/javascripts/jquery.tocify.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index 84f9786..2cb4612 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -975,7 +975,6 @@ "complete": function() { currentDiv.trigger('tocify.scrollEnd'); } - } }); }); From 0092ca55ce7c66c0903b23466f6019c7f00076f8 Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 10:54:53 +0200 Subject: [PATCH 5/8] Update jquery.tocify.js --- src/javascripts/jquery.tocify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index 2cb4612..8bf19cf 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -972,7 +972,7 @@ // Sets the smoothScroll animation time duration to the smoothScrollSpeed option "duration": duration, - "complete": function() { + "done": function() { currentDiv.trigger('tocify.scrollEnd'); } }); From 7dfd24c0cc65845a9c638cf012b525fccc30514f Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 11:02:38 +0200 Subject: [PATCH 6/8] Change to promise --- src/javascripts/jquery.tocify.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index 8bf19cf..ae96dcb 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -971,12 +971,11 @@ }, { // Sets the smoothScroll animation time duration to the smoothScrollSpeed option - "duration": duration, - "done": function() { - currentDiv.trigger('tocify.scrollEnd'); - } + "duration": duration }); + }).promise().done(function(){ + currentDiv.trigger('tocify.scrollEnd'); }); // Maintains chainability From 45d6d52a832b9bf49935d04f9685f9e7d447658e Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 11:25:03 +0200 Subject: [PATCH 7/8] Fix promise --- src/javascripts/jquery.tocify.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/javascripts/jquery.tocify.js b/src/javascripts/jquery.tocify.js index ae96dcb..a878b53 100644 --- a/src/javascripts/jquery.tocify.js +++ b/src/javascripts/jquery.tocify.js @@ -972,10 +972,9 @@ // Sets the smoothScroll animation time duration to the smoothScrollSpeed option "duration": duration + }).promise().done(function(){ + currentDiv.trigger('tocify.scrollEnd'); }); - - }).promise().done(function(){ - currentDiv.trigger('tocify.scrollEnd'); }); // Maintains chainability From fb553bb9db557e08d5e7b21d6205ea9fe2e87f88 Mon Sep 17 00:00:00 2001 From: moshfeu Date: Tue, 9 Feb 2016 11:34:34 +0200 Subject: [PATCH 8/8] Update jquery.tocify.min.js --- src/javascripts/jquery.tocify.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/javascripts/jquery.tocify.min.js b/src/javascripts/jquery.tocify.min.js index 0fc0442..af65699 100644 --- a/src/javascripts/jquery.tocify.min.js +++ b/src/javascripts/jquery.tocify.min.js @@ -1,4 +1,4 @@ /*! jquery.tocify - v1.9.0 - 2013-10-01 * http://gregfranko.com/jquery.tocify.js/ * Copyright (c) 2013 Greg Franko; Licensed MIT*/ -(function(e){"use strict";e(window.jQuery,window,document)})(function(e,t,s){"use strict";var i="tocify",o="tocify-focus",n="tocify-hover",a="tocify-hide",l="tocify-header",h="."+l,r="tocify-subheader",d="."+r,c="tocify-item",f="."+c,u="tocify-extend-page",p="."+u;e.widget("toc.tocify",{version:"1.9.0",options:{context:"body",ignoreSelector:null,selectors:"h1, h2, h3",showAndHide:!0,showEffect:"slideDown",showEffectSpeed:"medium",hideEffect:"slideUp",hideEffectSpeed:"medium",smoothScroll:!0,smoothScrollSpeed:"medium",scrollTo:0,showAndHideOnScroll:!0,highlightOnScroll:!0,highlightOffset:40,theme:"bootstrap",extendPage:!0,extendPageOffset:100,history:!0,scrollHistory:!1,hashGenerator:"compact",highlightDefault:!0},_create:function(){var s=this;s.extendPageScroll=!0,s.items=[],s._generateToc(),s._addCSSClasses(),s.webkit=function(){for(var e in t)if(e&&-1!==e.toLowerCase().indexOf("webkit"))return!0;return!1}(),s._setEventHandlers(),e(t).load(function(){s._setActiveElement(!0),e("html, body").promise().done(function(){setTimeout(function(){s.extendPageScroll=!1},0)})})},_generateToc:function(){var t,s,o=this,n=o.options.ignoreSelector;return t=-1!==this.options.selectors.indexOf(",")?e(this.options.context).find(this.options.selectors.replace(/ /g,"").substr(0,this.options.selectors.indexOf(","))):e(this.options.context).find(this.options.selectors.replace(/ /g,"")),t.length?(o.element.addClass(i),t.each(function(t){e(this).is(n)||(s=e("