blob: a6c3c1a8feee877868a473c2765cf2e6ee0b74c7 [file] [log] [blame]
(function(){function d(a){localStorage.getItem("codeStyle")||localStorage.setItem("codeStyle","promise");a=a||localStorage.getItem("codeStyle");if("undefined"!==typeof a&&null!==a){var b=$('[data-code-tablist] [href="#'+a+'"]').parent();$("[data-code-tablist] li").removeClass("active");b.addClass("active");$(".tab-pane").removeClass("active");$('.tab-pane[id="'+a+'"]').addClass("active");localStorage.setItem("codeStyle",a)}}function g(){0<e.length||f.forEach(function(a){var b=$("[data-code-id='"+a+"']"),c=0;b.get().forEach(function(a){var b=
a.style.display;a.style.display="block";var d=a.clientHeight;a.style.display=b;d>c&&(c=d)});b.find("pre").css("height",c);e.push(a)})}var f=$("[data-code-id]").get().map(function(a){return a.attributes["data-code-id"].value}).filter(function(a,b,c){return c.indexOf(a)==b});(function(){f.forEach(function(a){var b=$("[data-code-id='"+a+"']"),c=b.get().map(function(a){return a.outerHTML}).join("");a='<ul class="nav nav-tabs nav-code" data-code-tablist="{{codeId}}"><li class="active"><a href="#promise">Promises</a></li><li><a href="#callback">Callbacks</a></li></ul><div class="tab-content">{{tapPanes}}</div>'.replace(/{{tapPanes}}/g,
c).replace(/{{codeId}}/g,a);b.first().replaceWith(a);b.remove()});$("[data-code-hide]").addClass("hide")})();d();$("[data-code-tablist] [href]").on("click",function(a){var b=$(this).attr("href");d.call(this,b.replace("#",""));g();a.preventDefault()});var e=[]})();