From 22de40bf6a5f103c2228caed73e631499ffa1931 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 23 Jul 2013 19:12:24 +0400 Subject: [PATCH] resize editor only when tab is fully shown --- doc/site/js/main.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/site/js/main.js b/doc/site/js/main.js index f4d2f951..ed9fbff4 100644 --- a/doc/site/js/main.js +++ b/doc/site/js/main.js @@ -75,16 +75,16 @@ $(function() { $('.menu-item a').click(magicClickInterceptor); $('a.argument').click(magicClickInterceptor); - $('a.external').click(function(e) { + $('a.external').click(function(e) { e.preventDefault(); }); - var tabs = $("#tabnav"), - tab_a_selector = "a"; + var tabs = $("#tabnav"), + tab_a_selector = "a"; - var firstLoad = true; + var firstLoad = true; - tabs.find(tab_a_selector).click(function(e) { + tabs.find(tab_a_selector).click(function(e) { e.preventDefault(); if ($(this).attr("href") === "/") { window.location = "http://ace.ajax.org"; @@ -122,14 +122,18 @@ $(function() { } $(this).tab("show"); - embedded_editor.resize(); - editor.resize(); var state = {}; state.nav = $(this).attr("href").substr(1); $.bbq.pushState(state); }); + $('#tabnav a[data-toggle="tab"]').on('shown', function (e) { + $(".tab-content .tab-pane.active .ace_editor").each(function(i, el){ + el.env.onResize(); + }); + }); + $(window).on("hashchange", function(e) { _gaq.push(['_trackPageview',location.pathname + location.search + location.hash]); tabs.each(function() {