mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
38 lines
1015 B
JavaScript
Executable File
38 lines
1015 B
JavaScript
Executable File
window.jazzy = {'docset': false}
|
|
if (typeof window.dash != 'undefined') {
|
|
document.documentElement.className += ' dash'
|
|
window.jazzy.docset = true
|
|
}
|
|
if (navigator.userAgent.match(/xcode/i)) {
|
|
document.documentElement.className += ' xcode'
|
|
window.jazzy.docset = true
|
|
}
|
|
|
|
// On doc load, toggle the URL hash discussion if present
|
|
$(document).ready(function() {
|
|
if (!window.jazzy.docset) {
|
|
var linkToHash = $('a[href="' + window.location.hash +'"]');
|
|
linkToHash.trigger("click");
|
|
}
|
|
});
|
|
|
|
// On token click, toggle its discussion and animate token.marginLeft
|
|
$(".token").click(function(event) {
|
|
if (window.jazzy.docset) {
|
|
return;
|
|
}
|
|
var link = $(this);
|
|
var animationDuration = 300;
|
|
$content = link.parent().parent().next();
|
|
$content.slideToggle(animationDuration);
|
|
|
|
// Keeps the document from jumping to the hash.
|
|
var href = $(this).attr('href');
|
|
if (history.pushState) {
|
|
history.pushState({}, '', href);
|
|
} else {
|
|
location.hash = href;
|
|
}
|
|
event.preventDefault();
|
|
});
|