forked from project-sunbird/project-sunbird.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue project-sunbird#33 feat: Table of content - Design changes
- Loading branch information
Lakhan Mandloi
committed
Nov 8, 2017
1 parent
f79e901
commit 7c56ea5
Showing
5 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* jQuery Table of Content Generator Support for Jekyll v1.0 | ||
* | ||
* https://github.com/dafi/jekyll-tocmd-generator | ||
* Examples and documentation at: https://github.com/dafi/jekyll-tocmd-generator | ||
* | ||
* Requires: jQuery v1.7+ | ||
* | ||
* Copyright (c) 2013 Davide Ficano | ||
* | ||
* Dual licensed under the MIT and GPL licenses: | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* http://www.gnu.org/licenses/gpl.html | ||
*/ | ||
(function($) { | ||
$.toc = {}; | ||
$.toc.clickHideButton = function(settings) { | ||
var config = { | ||
saveShowStatus: false, | ||
hideText: 'hide', | ||
showText: 'show'}; | ||
|
||
if (settings) { | ||
$.extend(config, settings); | ||
} | ||
|
||
$('#toctogglelink').click(function() { | ||
var ul = $($('#toc ul')[0]); | ||
|
||
if (ul.is(':visible')) { | ||
ul.hide(); | ||
$(this).text(config.showText); | ||
if (config.saveShowStatus) { | ||
$.cookie('toc-hide', '1', { expires: 365, path: '/' }); | ||
} | ||
$('#toc').addClass('tochidden'); | ||
} else { | ||
ul.show(); | ||
$(this).text(config.hideText); | ||
if (config.saveShowStatus) { | ||
$.removeCookie('toc-hide', { path: '/' }); | ||
} | ||
$('#toc').removeClass('tochidden'); | ||
} | ||
return false; | ||
}); | ||
|
||
if (config.saveShowStatus && $.cookie('toc-hide')) { | ||
var ul = $($('#toc ul')[0]); | ||
|
||
ul.hide(); | ||
$('#toctogglelink').text(config.showText); | ||
$('#toc').addClass('tochidden'); | ||
} | ||
|
||
} | ||
})(jQuery); |