Passed
Push — master ( 33ca92...23b088 )
by Ahmad
10:28
created

app/assets/javascripts/header.js   A

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 20
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 5
eloc 12
mnd 1
bc 1
fnc 4
bpm 0.25
cpm 1.25
noi 0
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
  // Stores the current url when the user clicks the sign in button
19
  $(".sign-in-button").click(function(){
20
    var url = location.href
21
    // Add the slash at the end if it's missing
22
    url += url.endsWith("/") ? "" : "/"
23
    document.cookie ="return_to=" + url
24
  })
25
26
  // Checks to see if the user provided an image url and displays it if they did
27
  $("#user-image")
28
    .on("load", function() {
29
      $("#user-image").show()
30
      $("#user-avatar").hide()
31
    })
32
    .on("error", function() {
33
      $("#user-image").hide()
34
      $("#user-avatar").show()
35
    })
36
})
37