resources/js/video_embed.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 42
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 22
c 0
b 0
f 0
dl 0
loc 42
rs 10
wmc 5
mnd 1
bc 1
fnc 4
bpm 0.25
cpm 1.25
noi 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A video_embed.js ➔ resizeYoutubeVideoFrame 0 8 2
1
// When scroll down change opacity of the title
2
jQuery(window).scroll(function(event){
0 ignored issues
show
Unused Code introduced by
The parameter event is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
3
    var fromTop = (jQuery(window).scrollTop());
4
    var offSet = 1 - (fromTop * 0.006);
5
    //console.log(offSet);
6
    jQuery('.lifeVideo .container').css('opacity', offSet);
7
8
9
});
10
11
12
// When resize the window scale the youtube video according with window width
13
function resizeYoutubeVideoFrame(windowWidth){
14
    var windowWidth = jQuery(window).width();   // returns width of browser viewport
15
    var videoHeight = windowWidth/16*9;
16
    jQuery('.lifeVideo.youtube .t-cover__carrier iframe').width(windowWidth);
17
    jQuery('.lifeVideo.youtube .t-cover__carrier iframe').height(videoHeight);
18
    jQuery('.lifeVideo.youtube').height(videoHeight);
19
    //alert("Window width: "+windowWidth);
20
}
21
22
// Resize video - on first page loading
23
var windowWidth = jQuery(window).width();
24
resizeYoutubeVideoFrame(windowWidth);
25
26
27
// Resize video - when the use resize the window
28
jQuery(window).resize(function() {
29
    var windowWidth = jQuery(window).width();
30
    resizeYoutubeVideoFrame(windowWidth);
31
});
32
33
34
$(function () {
35
    if (/Mobi/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent)) {
0 ignored issues
show
Bug introduced by
The variable navigator seems to be never declared. If this is a global, consider adding a /** global: navigator */ 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...
36
        console.log( "mobile!" );
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
37
        $(".lifeVideo.youtube").remove();
38
    }
39
    else{
40
        console.log( "desktop!" );
41
        $(".lifeVideo.local_vertical").remove();
42
    }
43
});
44