diff options
author | Dominic Clifton <me@dominicclifton.name> | 2015-12-15 14:35:52 +0300 |
---|---|---|
committer | Dominic Clifton <me@dominicclifton.name> | 2015-12-15 14:35:52 +0300 |
commit | 55a2677a2b705c92a32557c9ef744acc4c73df67 (patch) | |
tree | 971f6c7667a2851119aea3140e24f4372b2a78f7 /main.js | |
parent | 4e12db9c5e9c89f086e35ad6c929ff933aeef530 (diff) | |
parent | 1273bd94400630b7d93e53ceafdf7aa72944ec46 (diff) |
Merge branch 'development' into thenickdude-private-development
Conflicts:
js/data_storage.js
js/gui.js
js/msp.js
main.html
tabs/dataflash.css
tabs/dataflash.js
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 81 |
1 files changed, 54 insertions, 27 deletions
@@ -42,6 +42,13 @@ $(document).ready(function () { console.log('Application version expired'); GUI.log('You are using an old version of ' + chrome.runtime.getManifest().name + '. There may be a more recent version with improvements and fixes.'); } + + chrome.storage.local.get('logopen', function (result) { + if (result.logopen) { + $("#showlog").trigger('click'); + } + }); + // log webgl capability // it would seem the webgl "enabling" through advanced settings will be ignored in the future @@ -126,7 +133,9 @@ $(document).ready(function () { case 'led_strip': TABS.led_strip.initialize(content_ready); break; - + case 'failsafe': + TABS.failsafe.initialize(content_ready); + break; case 'setup': TABS.setup.initialize(content_ready); break; @@ -304,6 +313,45 @@ $(document).ready(function () { } } }); + + $("#showlog").on('click', function() { + var state = $(this).data('state'); + if ( state ) { + $("#log").animate({height: 27}, 200, function() { + var command_log = $('div#log'); + command_log.scrollTop($('div.wrapper', command_log).height()); + }); + $("#log").removeClass('active'); + $("#content").removeClass('logopen'); + $(".tab_container").removeClass('logopen'); + $("#scrollicon").removeClass('active'); + chrome.storage.local.set({'logopen': false}); + + state = false; + }else{ + $("#log").animate({height: 111}, 200); + $("#log").addClass('active'); + $("#content").addClass('logopen'); + $(".tab_container").addClass('logopen'); + $("#scrollicon").addClass('active'); + chrome.storage.local.set({'logopen': true}); + + state = true; + } + $(this).text(state ? 'Hide Log' : 'Show Log'); + $(this).data('state', state); + + }); + + var profile_e = $('select[name="profilechange"]'); + + profile_e.change(function () { + var profile = parseInt($(this).val()); + MSP.send_message(MSP_codes.MSP_SELECT_SETTING, [profile], false, function () { + GUI.log(chrome.i18n.getMessage('pidTuningLoadedProfile', [profile + 1])); + updateActivatedTab(); + }); + }); }); function catch_startup_time(startTime) { @@ -359,31 +407,10 @@ String.prototype.format = function () { }); }; -/** log trigger **/ -$(document).ready(function () { - -$("#showlog").on('click', function() { - var state = $(this).data('state'); - if ( state ) { - $("#log").animate({height: 27}, 200); - $("#log").removeClass('active'); - $("#content").removeClass('logopen'); - $(".tab_container").removeClass('logopen'); - $("#scrollicon").removeClass('active'); - - state = false; - }else{ - $("#log").animate({height: 111}, 200); - $("#log").addClass('active'); - $("#content").addClass('logopen'); - $(".tab_container").addClass('logopen'); - $("#scrollicon").addClass('active'); - state = true; - } - $(this).text(state ? 'Hide Log' : 'Show Log'); - $(this).data('state', state); - -}); -});
\ No newline at end of file +function updateActivatedTab() { + var activeTab = $('#tabs > ul li.active'); + activeTab.removeClass('active'); + $('a', activeTab).trigger('click'); +}
\ No newline at end of file |