diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-02-10 21:28:20 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-02-10 21:28:20 +0400 |
commit | 6435f2f03442e4ed8a57fc0d0dbca15a3e1a01f0 (patch) | |
tree | 4afe65b8b72a9ddd9f272c0fcf9d16bba3f7703e /plugins/CoreHome/javascripts/top_controls.js | |
parent | 434f1be5889a0d185826c6796d5f86035122aa02 (diff) |
Rewrote top control code to move elements that are not in the top bar, change name of css class js-autoLeftPanel, make segment selector more generic, make dashboard settings widget reusable.
Diffstat (limited to 'plugins/CoreHome/javascripts/top_controls.js')
-rw-r--r-- | plugins/CoreHome/javascripts/top_controls.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/plugins/CoreHome/javascripts/top_controls.js b/plugins/CoreHome/javascripts/top_controls.js index 93e9c6993d..c2089648d0 100644 --- a/plugins/CoreHome/javascripts/top_controls.js +++ b/plugins/CoreHome/javascripts/top_controls.js @@ -5,14 +5,20 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ function initTopControls() { - if ($('#periodString').length) { - var left=0; - $('.top_controls').children('.js-autoLeftPanel').each(function(i, el){ - var control = $(el); - if (left) { - control.css({left: left}); - } - left+=control.outerWidth(true); - }); - } + var $topControlsContainer = $('.top_controls'), + left = 0; + $('.piwikTopControl').each(function () { + var $control = $(this); + if ($control.css('display') == 'none') { + return; + } + + $control.css('left', left); + + if (!$.contains($topControlsContainer[0], this)) { + $control.detach().appendTo($topControlsContainer); + } + + left += $control.outerWidth(true); + }); }
\ No newline at end of file |