Issues (27)

app/assets/javascripts/main.js (2 issues)

Labels
Severity
1
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2
//
3
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
4
//
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU Lesser General Public License as published by the Free Software
7
// Foundation; either version 3.0 of the License, or (at your option) any later
8
// version.
9
//
10
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License along
15
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
16
17
$(document).on('turbolinks:load', function(){
18
  $.rails.refreshCSRFTokens();
19
})
20
21
document.addEventListener("turbolinks:before-cache", function() {
22
  $(".alert").remove()
23
})
24
25
// Gets the localized string
26
function getLocalizedString(key) {
27
  var keyArr = key.split(".")
28
  var translated = I18n
0 ignored issues
show
The variable I18n seems to be never declared. If this is a global, consider adding a /** global: I18n */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
29
30
  // Search current language for the key
31
  try {
32
    keyArr.forEach(function(k) {
33
      translated = translated[k]
34
    })
35
  } catch (e) {
36
    // Key is missing in selected language so default to english
37
    translated = undefined;
38
  }
39
40
41
  // If key is not found, search the fallback language for the key
42
  if (translated === null || translated === undefined) { 
43
    translated = I18nFallback
0 ignored issues
show
The variable I18nFallback seems to be never declared. If this is a global, consider adding a /** global: I18nFallback */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
44
45
    keyArr.forEach(function(k) {
46
      translated = translated[k]
47
    })
48
  }
49
50
  return translated
51
}