|
1 |
| -var api={config:{}};api.config.scrollSettings=function(){var a=80,b=100;navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i)&&(a=2,b=15);return{scrollInertia:0,theme:"minimal-dark",mouseWheel:{enable:!0,scrollAmount:a},keyboard:{enable:!0,scrollAmount:b,scrollType:"stepless"}}}();api.links={};api.links.typeLinkClickWithScroll=function(a){};api.links.typeLinkClick=function(a){};api.page={};api.page.scrollToEntry=function(a){$(".method-block").removeClass("active");$("#"+a).addClass("active");window.setTimeout(function(){$("#content").css("min-height",$("#content").height());$("#content-wrapper").mCustomScrollbar("scrollTo",$("#"+a),{scrollInertia:700});$(".panel").on("hide.bs.collapse",function(a){var c=$(this).parent().parent();c.hasClass("selected")&&(a.preventDefault(),c.removeClass("selected"))})},200)};api.page.fixLinks=function(){$("#content a.type-link").click(api.links.typeLinkClickWithScroll)}; |
2 |
| -api.page.fixListings=function(){prettyPrint()};api.page.highlight=function(a,b,c){b=void 0==b?!0:b;c=void 0==c?!0:c;$(".content-container .active").removeClass("active");b&&(b=getEntryFromUrl(location.pathname),doExpandInTree(b,a));c&&setTimeout(function(){$("#content-wrapper").mCustomScrollbar("scrollTo",$("#"+a),{scrollInertia:700})},100);$("#"+a).parent().addClass("active");location.hash=a};api.page.load=function(a,b,c){};api.resize={};api.resize.stopResize_=function(a){$("body").off("mouseup",api.resize.stopResize_);$("body").off("mousemove",api.resize.doResize_)};api.resize.doResize_=function(a){250<a.pageX&&a.pageX<window.innerWidth-300&&($("#menu-bar").css("width",a.pageX),$("#content-wrapper").css("margin-left",a.pageX).css("width",window.innerWidth-a.pageX),$(".breadcrumb").css("left",$("#menu-bar").width()));return!1}; |
3 |
| -api.resize.startResize_=function(a){$("body").on("mouseup",api.resize.stopResize_);$("body").on("mousemove",api.resize.doResize_);return!1};api.resize.init=function(){$("#size-controller").on("mousedown",api.resize.startResize_)};api.search={};api.search.init=function(){};api.tree={};api.tree.scrollToEntry=function(a,b){var c=$("#tree li[x-data-name='"+(a+(b?"#"+b:""))+"']");window.setTimeout(function(){$("#tree-wrapper").mCustomScrollbar("scrollTo",c.offset().top-120,{scrollInertia:700})},200)}; |
4 |
| -api.tree.expand_=function(a,b){$("#tree .active").removeClass("active");for(var c=a.split("."),e=0;e<c.length;e++){var d=c.slice(0,e+1).join("."),d=$("#tree li[x-data-name='"+d+"']");d.find(">ul").show();d.find(">a i").removeClass("fa-chevron-right").addClass("fa-chevron-down");d.addClass("active")}b&&(d=$("#tree li.item[x-data-name='"+a+"#"+b+"']"),d.addClass("active"))};api.tree.expand=function(a){a=cleanupPath(a);(a=a.match("^/[^/]+/(.*)$")[1])&&api.tree.expand_(a)}; |
5 |
| -api.tree.init=function(){$("#tree-wrapper").mCustomScrollbar(api.config.scrollSettings);$("#tree li.group").each(function(){var a=$(this).find(">ul");$(this).find(">a").click(function(b){if(b.ctrlKey||b.metaKey)return!0;a.toggle();a.is(":visible")?$(this).find("i").addClass("fa-chevron-down").removeClass("fa-chevron-right"):$(this).find("i").addClass("fa-chevron-right").removeClass("fa-chevron-down");return api.page.load($(this).attr("href"))})});$("#tree li.item a").click(function(a){return a.ctrlKey|| |
6 |
| -a.metaKey?!0:api.page.load($(this).attr("href"))})};api.pageScrolling={};api.pageSrolling.isTopVisible_=!1;api.pageSrolling.currentVisible_=null;api.pageScrolling.checkTopVisible_=function(a){0>a?api.pageScrolling.isTopVisible_||($("#top-page-content").fadeIn(),api.pageScrolling.isTopVisible_=!0):api.pageScrolling.isTopVisible_&&($("#top-page-content").fadeOut(),api.pageScrolling.isTopVisible_=!1)}; |
7 |
| -api.pageScrolling.getFirstVisible_=function(){var a=Number.MAX_VALUE,b=null;$("div.content-block.methods h3").each(function(){var c=$(this),e=Math.abs(c.offset().top-100);e<a&&(a=e,b=c)});return b?b.attr("id"):null};api.pageScrolling.onContentScroll_=function(){api.pageScrolling.checkTopVisible_(this.mcs.top);var a=api.pageScrolling.getFirstVisible_();a&&a!=api.pageSrolling.currentVisible_&&(api.pageSrolling.currentVisible_=a,api.tree.expand(page,a),api.page.highlight(a,!1,!1))}; |
8 |
| -api.pageScrolling.update=function(){$("#top-page-content").hide();api.pageScrolling.isTopVisible_=!1;api.pageScrolling.currentVisible_=null;$("#content-wrapper").mCustomScrollbar($.extend(api.config.scrollSettings,{callbacks:{onScroll:api.pageScrolling.onContentScroll_}}))};api.pageScrolling.scrollTo=function(a){$("#content-wrapper").mCustomScrollbar("scrollTo",$(a))};api.utils={};api.utils.cleanupPath=function(a){-1!=a.indexOf("http")&&(a=a.substr(a.indexOf("/",a.indexOf("//")+2)));-1!=a.indexOf("#")&&(a=a.substr(0,a.indexOf("#")));return a};api.utils.getEntryFromURL=function(a){a=cleanupPath(a);return a.match("^/[^/]+/(.*)$")[1]};api.breadcrumb={};api.breadcrumb.update=function(a){a=api.utils.cleanupPath(a);$("ol.breadcrumb").html("");a=a.split(".");for(var b=0;b<a.length;b++){var c;b<a.length-1?(c=a.slice(0,b+1).join("."),c=$("<li><a href='/"+version+"/"+c+"'>"+a[b]+"</a></li>"),c.find("a").click(api.links.typeLinkClickWithScroll)):c=$("<li class='active'>"+a[b]+"</li>");$("ol.breadcrumb").append(c)}};api.versions={};api.versions.init=function(){$(".versionselect").on("change",function(){location.href="/"+$(this).find("option:selected").val()+"/try/"+api.utils.getEntryFromUrl(location.pathname)})};api.core={};$(function(){api.versions.init();api.resize.init();api.page.fixLinks();api.page.fixListings();api.tree.init();api.pageScrolling.update();api.search.init();api.tree.expand(location.pathname);api.breadcrumb.update(api.utils.getEntryFromUrl(location.pathname));api.tree.scrollToEntry(page,location.hash?location.hash.substr(1):null);location.hash&&api.pageScrolling.scrollTo(location.hash)}); |
| 1 | +var api = {config:{}}; |
| 2 | +api.config.scrollSettings = function() { |
| 3 | + var a = 80, b = 100; |
| 4 | + navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i) && (a = 2, b = 15); |
| 5 | + return {scrollInertia:0, theme:"minimal-dark", mouseWheel:{enable:!0, scrollAmount:a}, keyboard:{enable:!0, scrollAmount:b, scrollType:"stepless"}}; |
| 6 | +}(); |
| 7 | +api.links = {}; |
| 8 | +api.links.typeLinkClickWithScroll = function(a) { |
| 9 | +}; |
| 10 | +api.links.typeLinkClick = function(a) { |
| 11 | +}; |
| 12 | +api.page = {}; |
| 13 | +api.page.scrollToEntry = function(a) { |
| 14 | + $(".method-block").removeClass("active"); |
| 15 | + $("#" + a).addClass("active"); |
| 16 | + window.setTimeout(function() { |
| 17 | + $("#content").css("min-height", $("#content").height()); |
| 18 | + $("#content-wrapper").mCustomScrollbar("scrollTo", $("#" + a), {scrollInertia:700}); |
| 19 | + $(".panel").on("hide.bs.collapse", function(a) { |
| 20 | + var c = $(this).parent().parent(); |
| 21 | + c.hasClass("selected") && (a.preventDefault(), c.removeClass("selected")); |
| 22 | + }); |
| 23 | + }, 200); |
| 24 | +}; |
| 25 | +api.page.fixLinks = function() { |
| 26 | + $("#content a.type-link").click(api.links.typeLinkClickWithScroll); |
| 27 | +}; |
| 28 | +api.page.fixListings = function() { |
| 29 | + prettyPrint(); |
| 30 | +}; |
| 31 | +api.page.highlight = function(a, b, c) { |
| 32 | + b = void 0 == b ? !0 : b; |
| 33 | + c = void 0 == c ? !0 : c; |
| 34 | + $(".content-container .active").removeClass("active"); |
| 35 | + b && (b = getEntryFromUrl(location.pathname), doExpandInTree(b, a)); |
| 36 | + c && setTimeout(function() { |
| 37 | + $("#content-wrapper").mCustomScrollbar("scrollTo", $("#" + a), {scrollInertia:700}); |
| 38 | + }, 100); |
| 39 | + $("#" + a).parent().addClass("active"); |
| 40 | + location.hash = a; |
| 41 | +}; |
| 42 | +api.page.load = function(a, b, c) { |
| 43 | +}; |
| 44 | +api.resize = {}; |
| 45 | +api.resize.stopResize_ = function(a) { |
| 46 | + $("body").off("mouseup", api.resize.stopResize_); |
| 47 | + $("body").off("mousemove", api.resize.doResize_); |
| 48 | +}; |
| 49 | +api.resize.doResize_ = function(a) { |
| 50 | + 250 < a.pageX && a.pageX < window.innerWidth - 300 && ($("#menu-bar").css("width", a.pageX), $("#content-wrapper").css("margin-left", a.pageX).css("width", window.innerWidth - a.pageX), $(".breadcrumb").css("left", $("#menu-bar").width())); |
| 51 | + return !1; |
| 52 | +}; |
| 53 | +api.resize.startResize_ = function(a) { |
| 54 | + $("body").on("mouseup", api.resize.stopResize_); |
| 55 | + $("body").on("mousemove", api.resize.doResize_); |
| 56 | + return !1; |
| 57 | +}; |
| 58 | +api.resize.init = function() { |
| 59 | + $("#size-controller").on("mousedown", api.resize.startResize_); |
| 60 | +}; |
| 61 | +api.search = {}; |
| 62 | +api.search.init = function() { |
| 63 | +}; |
| 64 | +api.utils = {}; |
| 65 | +api.utils.cleanupPath = function(a) { |
| 66 | + -1 != a.indexOf("http") && (a = a.substr(a.indexOf("/", a.indexOf("//") + 2))); |
| 67 | + -1 != a.indexOf("#") && (a = a.substr(0, a.indexOf("#"))); |
| 68 | + return a; |
| 69 | +}; |
| 70 | +api.utils.getEntryFromURL = function(a) { |
| 71 | + a = api.utils.cleanupPath(a); |
| 72 | + return a.match("^/[^/]+/(.*)$")[1]; |
| 73 | +}; |
| 74 | +api.breadcrumb = {}; |
| 75 | +api.breadcrumb.update = function(a) { |
| 76 | + a = api.utils.cleanupPath(a); |
| 77 | + $("ol.breadcrumb").html(""); |
| 78 | + a = a.split("."); |
| 79 | + for (var b = 0;b < a.length;b++) { |
| 80 | + var c; |
| 81 | + b < a.length - 1 ? (c = a.slice(0, b + 1).join("."), c = $("<li><a href='/" + version + "/" + c + "'>" + a[b] + "</a></li>"), c.find("a").click(api.links.typeLinkClickWithScroll)) : c = $("<li class='active'>" + a[b] + "</li>"); |
| 82 | + $("ol.breadcrumb").append(c); |
| 83 | + } |
| 84 | +}; |
| 85 | +api.tree = {}; |
| 86 | +api.tree.scrollToEntry = function(a, b) { |
| 87 | + var c = $("#tree li[x-data-name='" + (a + (b ? "#" + b : "")) + "']"); |
| 88 | + window.setTimeout(function() { |
| 89 | + $("#tree-wrapper").mCustomScrollbar("scrollTo", c.offset().top - 120, {scrollInertia:700}); |
| 90 | + }, 200); |
| 91 | +}; |
| 92 | +api.tree.expand_ = function(a, b) { |
| 93 | + $("#tree .active").removeClass("active"); |
| 94 | + for (var c = a.split("."), e = 0;e < c.length;e++) { |
| 95 | + var d = c.slice(0, e + 1).join("."), d = $("#tree li[x-data-name='" + d + "']"); |
| 96 | + d.find(">ul").show(); |
| 97 | + d.find(">a i").removeClass("fa-chevron-right").addClass("fa-chevron-down"); |
| 98 | + d.addClass("active"); |
| 99 | + } |
| 100 | + b && (d = $("#tree li.item[x-data-name='" + a + "#" + b + "']"), d.addClass("active")); |
| 101 | +}; |
| 102 | +api.tree.expand = function(a) { |
| 103 | + a = api.utils.cleanupPath(a); |
| 104 | + (a = a.match("^/[^/]+/(.*)$")) && api.tree.expand_(a[1]); |
| 105 | +}; |
| 106 | +api.tree.init = function() { |
| 107 | + $("#tree-wrapper").mCustomScrollbar(api.config.scrollSettings); |
| 108 | + $("#tree li.group").each(function() { |
| 109 | + var a = $(this).find(">ul"); |
| 110 | + $(this).find(">a").click(function(b) { |
| 111 | + if (b.ctrlKey || b.metaKey) { |
| 112 | + return !0; |
| 113 | + } |
| 114 | + a.toggle(); |
| 115 | + a.is(":visible") ? $(this).find("i").addClass("fa-chevron-down").removeClass("fa-chevron-right") : $(this).find("i").addClass("fa-chevron-right").removeClass("fa-chevron-down"); |
| 116 | + return api.page.load($(this).attr("href")); |
| 117 | + }); |
| 118 | + }); |
| 119 | + $("#tree li.item a").click(function(a) { |
| 120 | + return a.ctrlKey || a.metaKey ? !0 : api.page.load($(this).attr("href")); |
| 121 | + }); |
| 122 | +}; |
| 123 | +api.pageScrolling = {}; |
| 124 | +api.pageScrolling.isTopVisible_ = !1; |
| 125 | +api.pageScrolling.currentVisible_ = null; |
| 126 | +api.pageScrolling.checkTopVisible_ = function(a) { |
| 127 | + 0 > a ? api.pageScrolling.isTopVisible_ || ($("#top-page-content").fadeIn(), api.pageScrolling.isTopVisible_ = !0) : api.pageScrolling.isTopVisible_ && ($("#top-page-content").fadeOut(), api.pageScrolling.isTopVisible_ = !1); |
| 128 | +}; |
| 129 | +api.pageScrolling.getFirstVisible_ = function() { |
| 130 | + var a = Number.MAX_VALUE, b = null; |
| 131 | + $("div.content-block.methods h3").each(function() { |
| 132 | + var c = $(this), e = Math.abs(c.offset().top - 100); |
| 133 | + e < a && (a = e, b = c); |
| 134 | + }); |
| 135 | + return b ? b.attr("id") : null; |
| 136 | +}; |
| 137 | +api.pageScrolling.onContentScroll_ = function() { |
| 138 | + api.pageScrolling.checkTopVisible_(this.mcs.top); |
| 139 | + var a = api.pageScrolling.getFirstVisible_(); |
| 140 | + a && a != api.pageScrolling.currentVisible_ && (api.pageScrolling.currentVisible_ = a, api.tree.expand(page, a), api.page.highlight(a, !1, !1)); |
| 141 | +}; |
| 142 | +api.pageScrolling.update = function() { |
| 143 | + $("#top-page-content").hide(); |
| 144 | + api.pageScrolling.isTopVisible_ = !1; |
| 145 | + api.pageScrolling.currentVisible_ = null; |
| 146 | + $("#content-wrapper").mCustomScrollbar($.extend(api.config.scrollSettings, {callbacks:{onScroll:api.pageScrolling.onContentScroll_}})); |
| 147 | +}; |
| 148 | +api.pageScrolling.scrollTo = function(a) { |
| 149 | + $("#content-wrapper").mCustomScrollbar("scrollTo", $(a)); |
| 150 | +}; |
| 151 | +api.versions = {}; |
| 152 | +api.versions.init = function() { |
| 153 | + $(".versionselect").on("change", function() { |
| 154 | + location.href = "/" + $(this).find("option:selected").val() + "/try/" + api.utils.getEntryFromUrl(location.pathname); |
| 155 | + }); |
| 156 | +}; |
| 157 | +api.core = {}; |
| 158 | +$(function() { |
| 159 | + api.versions.init(); |
| 160 | + api.resize.init(); |
| 161 | + api.page.fixLinks(); |
| 162 | + api.page.fixListings(); |
| 163 | + api.tree.init(); |
| 164 | + api.pageScrolling.update(); |
| 165 | + api.search.init(); |
| 166 | + api.tree.expand(location.pathname); |
| 167 | + api.breadcrumb.update(api.utils.getEntryFromURL(location.pathname)); |
| 168 | + api.tree.scrollToEntry(page, location.hash ? location.hash.substr(1) : null); |
| 169 | + location.hash && api.pageScrolling.scrollTo(location.hash); |
| 170 | +}); |
| 171 | + |
0 commit comments