Avoid unnecessary jquery calls.

This commit is contained in:
Boris Grozev 2015-04-08 12:49:49 +02:00
parent 886fb2ac43
commit 029851fe3f
1 changed files with 8 additions and 6 deletions

View File

@ -549,12 +549,13 @@ var Toolbar = (function (my) {
// Sets the state of the recording button // Sets the state of the recording button
my.setRecordingButtonState = function (isRecording) { my.setRecordingButtonState = function (isRecording) {
var selector = $('#recordButton');
if (isRecording) { if (isRecording) {
$('#recordButton').removeClass("icon-recEnable"); selector.removeClass("icon-recEnable");
$('#recordButton').addClass("icon-recEnable active"); selector.addClass("icon-recEnable active");
} else { } else {
$('#recordButton').removeClass("icon-recEnable active"); selector.removeClass("icon-recEnable active");
$('#recordButton').addClass("icon-recEnable"); selector.addClass("icon-recEnable");
} }
}; };
@ -573,8 +574,9 @@ var Toolbar = (function (my) {
*/ */
my.setAuthenticatedIdentity = function (authIdentity) { my.setAuthenticatedIdentity = function (authIdentity) {
if (authIdentity) { if (authIdentity) {
$('#toolbar_auth_identity').css({display: "list-item"}); var selector = $('#toolbar_auth_identity');
$('#toolbar_auth_identity').text(authIdentity); selector.css({display: "list-item"});
selector.text(authIdentity);
} else { } else {
$('#toolbar_auth_identity').css({display: "none"}); $('#toolbar_auth_identity').css({display: "none"});
} }