$(document).ready(function (){ if ($('#menu ul').html()) { $('aside').html(''+$('aside').html()); } if ($('#submenu ul').html()) { if ($('aside .menu-links .on')) { $('aside .menu-links .on').after('
'+$('#submenu ul').html()+'
'); } else { $('aside .menu-links').append('
'+$('#submenu ul').html()+'
'); } } $('.mobilemenu').click(function(){ if ($('aside').hasClass('active')) { $('aside').removeClass('active'); } else { $('aside').addClass('active'); } }); if ($(window).width() < 768) { $("aside #login h2").click(function() { $("aside #login form").slideToggle(); }); $("#request h2").click(function() { $("#request-cnt").slideToggle(); }); $("aside .roleselect > div > li > a").click(function(e) { e.preventDefault(); $("aside .roleselect > div > li > ul").slideToggle(); }); $("#calculate").appendTo("#content"); $("#request").appendTo("#content"); $("table").wrap('
'); $(".container_tabs li").removeClass("on"); $('.table-outer').each(function(){ if ($(this).width() < $(this).children('table').width()) { //$(this).addClass('display-cursor'); $(this).after('
'); } }); $('.order .tabs > ul').each(function(){ var $columns = $('li',this); var maxHeight = Math.max.apply(Math, $columns.map(function(){ return $(this).height(); }).get()); $columns.height(maxHeight); }); } if ($(window).width() > 768) { $( ".label-xs" ).insertAfter( ".input-xs" ); } make_selects_pretty(); }); /* Pretty selects */ function make_selects_pretty_init(el_sel) { if (el_sel.attr('i-like-myself') == '1') { return; } el_sel.each(function(){ el_sel = $(this); el_sel.attr('i-like-myself', '1'); el_sel.hide().before('
'+el_sel.children('option:selected').text()+'
'); make_selects_pretty_options(el_sel); }).change(function(){ make_selects_pretty_options($(this)); el_p_sel = $(this).siblings('.p-select'); el_p_opt_sel = $(this).children('option:selected'); el_p_sel.children('span').html( ((el_p_opt_sel.attr('data-img-src')) ? '':'') +el_p_opt_sel.text()); el_p_sel.children('div').children('div').removeClass('active'); el_p_sel.children('div').children('div[attr-option-index='+el_p_opt_sel.index()+']').addClass('active'); }); } function make_selects_pretty_options(el_sel) { el_pretty = el_sel.siblings('.p-select'); el_options = el_pretty.children('div'); el_options.html(''); $('option', el_sel).each(function(){ el_options.append('
' +(($(this).attr('data-img-src')) ? '':'') +$(this).text() +'
'); }); el_options.children('div[attr-option-index='+el_sel.children('option:selected').index()+']').addClass('active'); } function make_selects_pretty_each() { $('.pretty-select select').each(function(){ make_selects_pretty_init($(this)); }); } function make_selects_pretty() { make_selects_pretty_each(); $(document).on('click', '.p-select:not(.disabled)', function(){ a = 0; if ($(this).hasClass('active')) { a = 1; } $('.p-select').removeClass('active'); if (a == 0) { $(this).addClass('active'); } }); $(document).on('click', '.p-select > div > div:not(.disabled)', function(event){ $(this).parents('.p-select').removeClass('active'); my_select = $(this).parents('.p-select').siblings('select'); my_select.children('option').eq($(this).attr('attr-option-index')).prop('selected', true); my_select.trigger('change'); event.stopPropagation(); }); }