From 2b9c43858edb131d11a94e61ead49e8db85d9ed1 Mon Sep 17 00:00:00 2001 From: Boris Gulay Date: Fri, 20 May 2016 18:10:52 +0300 Subject: [PATCH] Fixed bug when account selected is shown twice on settings pages. --- ident_switch.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ident_switch.js b/ident_switch.js index 0c04bc3..a853b26 100644 --- a/ident_switch.js +++ b/ident_switch.js @@ -3,10 +3,15 @@ */ $(function() { - if ($('#plugin-ident_switch-account').size() > 0) { - $('#plugin-ident_switch-account').prependTo('.topright'); - $('.topright .username').hide(); - $('#plugin-ident_switch-account').show(); + var $truName = $('.topright .username'); + if ($truName.size() > 0) { + $sw = $('#plugin-ident_switch-account'); + if ($sw.size() > 0) { + $sw.prependTo('.topright'); + $truName.hide(); + $('#plugin-ident_switch-account').show(); + console.log("Doing replace."); + } } var $enFld = $("INPUT[name='_ident_switch.form.enabled']");