var DEFAULT_TEXT_SIZE = 14; var flag_display_image = true; $(function() { /*$('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); //return false; } } });*/ $('#accessibility-bar').hide(); $('#techsheet').hide(); $("#color-swap-white").addClass('active'); }); function setTextSize(textsize){ return parseInt(textsize.slice(0,2)); } function incrementTextSize(textsize, maxtextsize, increment) { var fontsize = 0; if(textsize <= maxtextsize){ fontsize = textsize + increment; return fontsize/DEFAULT_TEXT_SIZE; }else{ return textsize/DEFAULT_TEXT_SIZE; } } function decreaseTextSize(textsize, mintextsize, increment) { var fontsize = 0; if(textsize > mintextsize){ fontsize = textsize - increment; return fontsize/DEFAULT_TEXT_SIZE; }else{ return textsize/DEFAULT_TEXT_SIZE; } } $("#font-increase1").click(function(event){ var textsize = setTextSize($(".main-book").css('font-size')); $(".main-book").animate({"font-size":""+incrementTextSize(textsize,42,2)+"em"}); }); $("#font-decrease1").click(function(event){ var textsize = setTextSize($(".main-book").css('font-size')); $(".main-book").animate({"font-size":""+decreaseTextSize(textsize,10,2)+"em"}); }); $("#font-default").click(function(event){ event.preventDefault(); $(".main-book").animate({"font-size":"1em"}); }); $("#insert-images").click(function(event){ if (flag_display_image == false){ $("

Figure 1: The AD production process

").appendTo($("#fig1")); $("

Figure 1: The AD production process

").appendTo($("#fig2")); flag_display_image = true; } }); $("#remove-images").click(function(event){ event.preventDefault(); $("#fig1").empty(); $("#fig2").empty(); flag_display_image = false }); $("#color-swap-black").click(function(){ $("#color-swap-yellow").removeClass(); $("#color-swap-white").removeClass(); $(this).addClass('active'); $("body").removeClass() .addClass('black-helper'); }); $("#color-swap-white").click(function(){ $("#color-swap-black").removeClass(); $("#color-swap-yellow").removeClass(); $(this).addClass('active'); $("body").removeClass(); }); $("#color-swap-yellow").click(function(){ $("#color-swap-black").removeClass(); $("#color-swap-white").removeClass(); $(this).addClass('active'); $("body").removeClass() .addClass('yellow-helper'); }); $('#accessibility-toggle button').click(function(event){ if($('#accessibility-bar').attr('aria-expanded') == "true" ){ $(this).html('Opções de acessibilidade'); $('#accessibility-bar').hide() .attr('aria-expanded', 'false'); }else{ $('#accessibility-bar').show(); $(this).html('Esconder opções'); $('#accessibility-bar').attr('aria-expanded', 'true'); } }); $('#technicalsheet').click(function(event) { if($('#techsheet').attr('aria-expanded') == "true" ){ $('#techsheet').slideUp() .attr('aria-expanded', 'false'); }else{ $('#techsheet').slideDown() .attr('aria-expanded', 'true'); $('html, body').animate({scrollTop: $(document).height()}, 'slow'); } });