mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-11-02 14:29:36 +00:00
1 line
3.6 KiB
JavaScript
Executable File
1 line
3.6 KiB
JavaScript
Executable File
function toggleDropdown(e){var t=$(e.target).parents(".dropdown-wrapper");$(".dropdown-wrapper .dropdown").removeClass("active"),t.find(".dropdown").eq(0).toggleClass("active")}function openInDojo(e){var t,o;e.preventDefault(),window.dojo||(t=$("#dojo-js").toArray(),o=$.Deferred(),loadScripts(t,o)),postToDojo(e)}function postToDojo(e){var t=$(e.target).closest(".try-kendo");$.get(t.data("url")).done(function(e){window.dojo.postSnippet($(e).text(),window.location.href)})}function loadStyles(){$("link[data-href]").each(function(e,t){$(t).attr("href",$(t).attr("data-href"))})}function loadDemo(){var e,t;$(".demo-button-wrapper").hide(),loadStyles(),e=$("script[data-src]").toArray(),t=$.Deferred(),t.done(function(){$(".kd-loader-wrap").hide(),IS_ANGULARJS_EXAMPLE||(resetThemableOptions(),$("#demo-runner").html($("#demoCode").text()),$(document).trigger("kendoReady"))}),loadScripts(e,t)}function loadScripts(e,t){if(e.length){var o=e.shift();$(o).on("load",function(a){$(o).is("#dojo-js")&&(dojo.configuration={url:DOJO_ROOT,cdnRoot:CDN_ROOT}),0==e.length&&t.resolve(),loadScripts(e,t)}),$(o).attr("src",$(o).attr("data-src")),$(o).removeAttr("data-src")}}function resetThemableOptions(){var e,t,o,a=window.selectedTheme,r=["Chart","TreeMap","Diagram","StockChart","Sparkline","RadialGauge","LinearGauge","ArcGauge"];if(kendo.dataviz&&a)for(e="default-v2"===a||"bootstrap-v4"===a||"material-v2"===a,e&&kendo.dataviz.autoTheme(!0),t=0;t<r.length;t++)o=kendo.dataviz.ui[r[t]],o&&(o.fn.options.theme=e?"sass":a)}function tabStripSelect(e){var t,o=$(e.target).closest(".tabstrip-item"),a=o.closest(".tabstrip"),r=a.siblings(".tabstrip-pane"),n=$("#"+o.data("container"));if(!o.is(".active"))return t=a.find(".tabstrip-item.active").add($.grep(r,function(e){return $(e).is(".active")})),t.removeClass("active"),o.add(n).addClass("active"),n.is("#source-code-pane")&&!n.find(".active").length?void loadFirstSource(n):void(o.is("[data-url]")&&loadSource(o,n))}function loadFirstSource(e){var t=e.find(".tabstrip"),o=t.find("li.tabstrip-item").eq(0),a=$("#"+o.data("container"));o.add(a).addClass("active"),loadSource(o,a)}function loadSource(e,t){var o=e.data("url");0===e.index();window.prettyPrint||loadPrettify(),$.get(o).done(function(o){e.removeAttr("data-url"),t.html(o),window.prettyPrint&&prettyPrint()})}function loadPrettify(){var e=$("#prettify-js").toArray(),t=$.Deferred();loadScripts(e,t),t.done(function(){prettyPrint()})}function toggleThemeChooser(){$(".theme-chooser-dropdown").toggleClass("active")}function themeChooserChange(e){var t=$(e.target).closest("li[data-val]").data("val");window.location.search="autoRun=true&theme="+t}function themeTypeChange(e){var t=$(e.target),o=$(".theme-chooser-dropdown .themes-list"),a=$(".type-chooser .theme-type"),r=t.data().select;t.hasClass("active")||(o.hide(),a.toggleClass("active"),$("."+r).show())}function clearConsole(){kendoConsole.clear()}$(document).on("kendoReady",function(){$(window).on("resize",function(){window.kendo&&kendo.resize($(".k-chart"))})}),$(document).ready(function(){var e=$("#runDemo");e.length&&isMobile()?($(".demo-button-wrapper").show(),$("#runDemo").on("click",loadDemo)):loadDemo(),$(".tabstrip .tabstrip-tab").on("click",tabStripSelect),$(".try-kendo").click(openInDojo),$(document).on("click",function(e){var t=$(e.target);t.parents(".dropdown-wrapper").length||t.is(".dropdown-toggle")||($(".dropdown.active").removeClass("active"),$(".dropdown-wrapper.active").removeClass("active"))}),$(".tabstrip .dropdown-toggle").on("click",toggleDropdown),$(".theme-chooser-dropdown .kd-theme").on("click",themeChooserChange),$(".type-chooser").on("click",themeTypeChange),$(".kd-example-console .clear").on("click",clearConsole)}); |