summaryrefslogtreecommitdiff
path: root/platform/darwin/docs/theme/assets/js/jazzy.js
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/docs/theme/assets/js/jazzy.js')
-rwxr-xr-xplatform/darwin/docs/theme/assets/js/jazzy.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/platform/darwin/docs/theme/assets/js/jazzy.js b/platform/darwin/docs/theme/assets/js/jazzy.js
new file mode 100755
index 0000000000..70d90890c7
--- /dev/null
+++ b/platform/darwin/docs/theme/assets/js/jazzy.js
@@ -0,0 +1,40 @@
+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;
+ var tokenOffset = "-15px";
+ var original = link.css('marginLeft') == tokenOffset;
+ link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration);
+ $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();
+});