diff options
author | NightHawk32 <nighthawk2244@gmail.com> | 2015-11-23 00:00:01 +0300 |
---|---|---|
committer | NightHawk32 <nighthawk2244@gmail.com> | 2015-11-23 00:00:01 +0300 |
commit | 7531ce69fe7369ca0db160b20963869ec8adc0ae (patch) | |
tree | 2a0284ec486c865601d0308c1fb625f69f3f5a5c /main.js | |
parent | 77deaa9af3208360806b7e7976cd70189c26a0c2 (diff) |
Profile is now changable globally.
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 69 |
1 files changed, 41 insertions, 28 deletions
@@ -311,6 +311,42 @@ $(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'); + 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) { @@ -366,33 +402,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'); - 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); - -}); -});
\ 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 |