Merge 67a56cc189
into e484e6e34f
This commit is contained in:
commit
45411903c3
60
.jshintrc
60
.jshintrc
|
@ -4,12 +4,66 @@
|
|||
"loopfunc": true,
|
||||
"curly": false,
|
||||
"evil": true,
|
||||
"white": true,
|
||||
"undef": true,
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"trailing": true,
|
||||
"indent": 4,
|
||||
"latedef": true,
|
||||
"newcap": true
|
||||
"newcap": true,
|
||||
"globals": {
|
||||
// Predefs
|
||||
"$": false,
|
||||
"$iq": false,
|
||||
"Prezi": false,
|
||||
|
||||
// Global Objects
|
||||
"AudioLevels": true,
|
||||
"CanvasUtil": true,
|
||||
"Chat": true,
|
||||
"CommandsProcessor": true,
|
||||
"ContactList": true,
|
||||
"RTC": true,
|
||||
"Strophe": true,
|
||||
"ToolbarToggler": true,
|
||||
"Util": true,
|
||||
"VideoLayout": true,
|
||||
|
||||
// Global Vars
|
||||
"bindDataChannelListener": true,
|
||||
"buttonClick": true,
|
||||
"config": true,
|
||||
"connection": true,
|
||||
"currentVideoHeight": true,
|
||||
"currentVideoWidth": true,
|
||||
"flipXLocalVideo": true,
|
||||
"focusedVideoSrc": true,
|
||||
"getCameraVideoPosition": true,
|
||||
"getCameraVideoSize": true,
|
||||
"getDesktopVideoPosition": true,
|
||||
"getJidFromVideoSrc": true,
|
||||
"getVideoPosition": true,
|
||||
"getVideoSize": true,
|
||||
"isVideoSrcDesktop": true,
|
||||
"linkify": true,
|
||||
"localVideoSrc": true,
|
||||
"lockRoom": true,
|
||||
"mediaStreams": true,
|
||||
"mutedAudios": true,
|
||||
"nickname": true,
|
||||
"processReplacements": true,
|
||||
"roomUrl": true,
|
||||
"setSharedKey": true,
|
||||
"sharedKey": true,
|
||||
"showDesktopSharingButton": true,
|
||||
"toggleAudio": true,
|
||||
"videoSpan": true,
|
||||
"videoSrcToSsrc": true,
|
||||
"waitForRemoteVideo": true
|
||||
},
|
||||
|
||||
// Reverse these later
|
||||
"laxbreak": true,
|
||||
"strict": false,
|
||||
"quotmark": false,
|
||||
"unused": false
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* jshint ignore:start */
|
||||
/**
|
||||
* Google Analytics
|
||||
*/
|
||||
|
@ -5,4 +6,5 @@
|
|||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-319188-14', 'jit.si');
|
||||
ga('send', 'pageview');
|
||||
ga('send', 'pageview');
|
||||
/* jshint ignore:end */
|
|
@ -97,7 +97,7 @@ var AudioLevels = (function(my) {
|
|||
thumbnailHeight) {
|
||||
audioLevelCanvas.width = thumbnailWidth + CANVAS_EXTRA;
|
||||
audioLevelCanvas.height = thumbnailHeight + CANVAS_EXTRA;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the audio level canvas into the cached canvas object.
|
||||
|
@ -146,7 +146,7 @@ var AudioLevels = (function(my) {
|
|||
CANVAS_RADIUS,
|
||||
SHADOW_COLOR,
|
||||
shadowLevel);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shadow/glow level for the given audio level.
|
||||
|
@ -167,7 +167,7 @@ var AudioLevels = (function(my) {
|
|||
shadowLevel = Math.round(CANVAS_EXTRA/2*((audioLevel - 0.6) / 0.4));
|
||||
}
|
||||
return shadowLevel;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the video span id corresponding to the given resourceJid or local
|
||||
|
@ -183,7 +183,7 @@ var AudioLevels = (function(my) {
|
|||
videoSpanId = 'participant_' + resourceJid;
|
||||
|
||||
return videoSpanId;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the remote video has been resized.
|
||||
|
|
5
chat.js
5
chat.js
|
@ -1,4 +1,3 @@
|
|||
/* global $, Util, connection, nickname:true, getVideoSize, getVideoPosition, showToolbar, processReplacements */
|
||||
/**
|
||||
* Chat related user interface.
|
||||
*/
|
||||
|
@ -126,7 +125,7 @@ var Chat = (function (my) {
|
|||
if(subject)
|
||||
subject = subject.trim();
|
||||
$('#subject').html(linkify(Util.escapeHtml(subject)));
|
||||
if(subject == "")
|
||||
if(subject === "")
|
||||
{
|
||||
$("#subject").css({display: "none"});
|
||||
}
|
||||
|
@ -204,7 +203,7 @@ var Chat = (function (my) {
|
|||
duration: 500});
|
||||
}
|
||||
else {
|
||||
// Undock the toolbar when the chat is shown and if we're in a
|
||||
// Undock the toolbar when the chat is shown and if we're in a
|
||||
// video mode.
|
||||
if (VideoLayout.isLargeVideoVisible())
|
||||
ToolbarToggler.dockToolbar(false);
|
||||
|
|
14
commands.js
14
commands.js
|
@ -21,12 +21,12 @@ var CommandsProcessor = (function()
|
|||
{
|
||||
for(var command in commands)
|
||||
{
|
||||
if(message.indexOf("/" + command) == 0)
|
||||
if(message.indexOf("/" + command) === 0)
|
||||
return command;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
var command = getCommand(message);
|
||||
|
||||
|
@ -37,7 +37,7 @@ var CommandsProcessor = (function()
|
|||
this.getCommand = function()
|
||||
{
|
||||
return command;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var messageArgument = message.substr(command.length + 2);
|
||||
|
@ -49,7 +49,7 @@ var CommandsProcessor = (function()
|
|||
this.getArgument = function()
|
||||
{
|
||||
return messageArgument;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ var CommandsProcessor = (function()
|
|||
if(this.getCommand())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Processes the command.
|
||||
|
@ -73,7 +73,7 @@ var CommandsProcessor = (function()
|
|||
|
||||
commands[this.getCommand()](this.getArgument());
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Processes the data for topic command.
|
||||
|
@ -83,7 +83,7 @@ var CommandsProcessor = (function()
|
|||
{
|
||||
var topic = Util.escapeHtml(commandArguments);
|
||||
connection.emuc.setSubject(topic);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* List with supported commands. The keys are the names of the commands and
|
||||
|
|
|
@ -140,7 +140,7 @@ var ContactList = (function (my) {
|
|||
duration: 500});
|
||||
}
|
||||
else {
|
||||
// Undock the toolbar when the chat is shown and if we're in a
|
||||
// Undock the toolbar when the chat is shown and if we're in a
|
||||
// video mode.
|
||||
if (VideoLayout.isLargeVideoVisible())
|
||||
ToolbarToggler.dockToolbar(false);
|
||||
|
@ -193,7 +193,7 @@ var ContactList = (function (my) {
|
|||
|
||||
/**
|
||||
* Creates the avatar element.
|
||||
*
|
||||
*
|
||||
* @return the newly created avatar element
|
||||
*/
|
||||
function createAvatar() {
|
||||
|
@ -201,7 +201,7 @@ var ContactList = (function (my) {
|
|||
avatar.className = "icon-avatar avatar";
|
||||
|
||||
return avatar;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the display name paragraph.
|
||||
|
@ -213,7 +213,7 @@ var ContactList = (function (my) {
|
|||
p.innerHTML = displayName;
|
||||
|
||||
return p;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the display name has changed.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/* global connection, Strophe, updateLargeVideo, focusedVideoSrc*/
|
||||
|
||||
// cache datachannels to avoid garbage collection
|
||||
// https://code.google.com/p/chromium/issues/detail?id=405545
|
||||
var _dataChannels = [];
|
||||
|
@ -100,7 +98,7 @@ function onDataChannel(event)
|
|||
{
|
||||
console.info("The Data Channel closed", dataChannel);
|
||||
var idx = _dataChannels.indexOf(dataChannel);
|
||||
if (idx > -1)
|
||||
if (idx > -1)
|
||||
_dataChannels = _dataChannels.splice(idx, 1);
|
||||
};
|
||||
_dataChannels.push(dataChannel);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global $, config, Prezi, Util, connection, setLargeVideoVisible, dockToolbar */
|
||||
var Etherpad = (function (my) {
|
||||
var etherpadName = null;
|
||||
var etherpadIFrame = null;
|
||||
|
|
|
@ -39,7 +39,7 @@ var LocalStatsCollector = (function() {
|
|||
if (!window.AudioContext)
|
||||
return;
|
||||
|
||||
var context = new AudioContext();
|
||||
var context = new window.AudioContext();
|
||||
var analyser = context.createAnalyser();
|
||||
analyser.smoothingTimeConstant = WEBAUDIO_ANALIZER_SMOOTING_TIME;
|
||||
analyser.fftSize = WEBAUDIO_ANALIZER_FFT_SIZE;
|
||||
|
@ -55,7 +55,7 @@ var LocalStatsCollector = (function() {
|
|||
function () {
|
||||
var array = new Uint8Array(analyser.frequencyBinCount);
|
||||
analyser.getByteTimeDomainData(array);
|
||||
var audioLevel = TimeDomainDataToAudioLevel(array);
|
||||
var audioLevel = timeDomainDataToAudioLevel(array);
|
||||
if(audioLevel != self.audioLevel) {
|
||||
self.audioLevel = animateLevel(audioLevel, self.audioLevel);
|
||||
self.updateCallback(LocalStatsCollectorProto.LOCAL_JID, self.audioLevel);
|
||||
|
@ -81,7 +81,7 @@ var LocalStatsCollector = (function() {
|
|||
* @param array the time domain data array.
|
||||
* @returns {number} the audio level
|
||||
*/
|
||||
var TimeDomainDataToAudioLevel = function (samples) {
|
||||
var timeDomainDataToAudioLevel = function (samples) {
|
||||
|
||||
var maxVolume = 0;
|
||||
|
||||
|
|
|
@ -135,9 +135,9 @@ var RoomNameGenerator = function(my) {
|
|||
number_of_words = NUMBER_OF_WORDS;
|
||||
var name = "";
|
||||
for(var i = 0; i<number_of_words; i++)
|
||||
name += ((i != 0)? separator : "") + generateWord();
|
||||
name += ((i !== 0)? separator : "") + generateWord();
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates new room name.
|
||||
|
@ -155,7 +155,7 @@ var RoomNameGenerator = function(my) {
|
|||
name += word ;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
return RoomNameGeneratorProto;
|
||||
}();
|
||||
|
|
10
toolbar.js
10
toolbar.js
|
@ -52,7 +52,7 @@ var Toolbar = (function (my) {
|
|||
submit: function (e, v, m, f) {
|
||||
if (v) {
|
||||
var lockKey = document.getElementById('lockKey');
|
||||
|
||||
|
||||
if (lockKey.value) {
|
||||
setSharedKey(Util.escapeHtml(lockKey.value));
|
||||
lockRoom(true);
|
||||
|
@ -70,7 +70,7 @@ var Toolbar = (function (my) {
|
|||
*/
|
||||
my.openLinkDialog = function () {
|
||||
var inviteLink;
|
||||
if (roomUrl == null)
|
||||
if (roomUrl === null)
|
||||
inviteLink = "Your conference is currently being created...";
|
||||
else
|
||||
inviteLink = encodeURI(roomUrl);
|
||||
|
@ -104,7 +104,7 @@ var Toolbar = (function (my) {
|
|||
* Invite participants to conference.
|
||||
*/
|
||||
function inviteParticipants() {
|
||||
if (roomUrl == null)
|
||||
if (roomUrl === null)
|
||||
return;
|
||||
|
||||
var sharedKeyText = "";
|
||||
|
@ -154,13 +154,13 @@ var Toolbar = (function (my) {
|
|||
if ($('#initMuted').is(":checked")) {
|
||||
// it is checked
|
||||
}
|
||||
|
||||
|
||||
if ($('#requireNicknames').is(":checked")) {
|
||||
// it is checked
|
||||
}
|
||||
/*
|
||||
var lockKey = document.getElementById('lockKey');
|
||||
|
||||
|
||||
if (lockKey.value)
|
||||
{
|
||||
setSharedKey(lockKey.value);
|
||||
|
|
|
@ -24,7 +24,7 @@ var ToolbarToggler = (function(my) {
|
|||
TOOLBAR_TIMEOUT = 4000;
|
||||
}
|
||||
|
||||
if (focus != null)
|
||||
if (focus !== null)
|
||||
{
|
||||
// TODO: Enable settings functionality. Need to uncomment the settings button in index.html.
|
||||
// $('#settingsButton').css({visibility:"visible"});
|
||||
|
|
2
util.js
2
util.js
|
@ -66,7 +66,7 @@ var Util = (function (my) {
|
|||
|
||||
for (var i = 0, n = pixels.length; i < n; i += 4) {
|
||||
var grayscale
|
||||
= pixels[i] * .3 + pixels[i+1] * .59 + pixels[i+2] * .11;
|
||||
= pixels[i] * 0.3 + pixels[i+1] * 0.59 + pixels[i+2] * 0.11;
|
||||
pixels[i ] = grayscale; // red
|
||||
pixels[i+1] = grayscale; // green
|
||||
pixels[i+2] = grayscale; // blue
|
||||
|
|
|
@ -177,7 +177,7 @@ var VideoLayout = (function (my) {
|
|||
oldContainer.removeClass("videoContainerFocused");
|
||||
}
|
||||
|
||||
// Unlock current focused.
|
||||
// Unlock current focused.
|
||||
if (focusedVideoSrc === videoSrc)
|
||||
{
|
||||
focusedVideoSrc = null;
|
||||
|
@ -284,9 +284,9 @@ var VideoLayout = (function (my) {
|
|||
/**
|
||||
* Checks if container for participant identified by given peerJid exists
|
||||
* in the document and creates it eventually.
|
||||
*
|
||||
*
|
||||
* @param peerJid peer Jid to check.
|
||||
*
|
||||
*
|
||||
* @return Returns <tt>true</tt> if the peer container exists,
|
||||
* <tt>false</tt> - otherwise
|
||||
*/
|
||||
|
@ -335,7 +335,7 @@ var VideoLayout = (function (my) {
|
|||
|
||||
// If the peerJid is null then this video span couldn't be directly
|
||||
// associated with a participant (this could happen in the case of prezi).
|
||||
if (focus && peerJid != null)
|
||||
if (focus && peerJid !== null)
|
||||
addRemoteVideoMenu(peerJid, container);
|
||||
|
||||
remotes.appendChild(container);
|
||||
|
@ -440,7 +440,7 @@ var VideoLayout = (function (my) {
|
|||
/**
|
||||
* Removes the remote stream element corresponding to the given stream and
|
||||
* parent container.
|
||||
*
|
||||
*
|
||||
* @param stream the stream
|
||||
* @param container
|
||||
*/
|
||||
|
@ -493,7 +493,7 @@ var VideoLayout = (function (my) {
|
|||
peerContainer.show();
|
||||
else if (peerContainer.is(':visible') && !isShow)
|
||||
peerContainer.hide();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display name for the given video span id.
|
||||
|
@ -601,7 +601,7 @@ var VideoLayout = (function (my) {
|
|||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows/hides the display name on the remote video.
|
||||
|
@ -611,7 +611,7 @@ var VideoLayout = (function (my) {
|
|||
my.showDisplayName = function(videoSpanId, isShow) {
|
||||
var nameSpan = $('#' + videoSpanId + '>span.displayname').get(0);
|
||||
if (isShow) {
|
||||
if (nameSpan && nameSpan.innerHTML && nameSpan.innerHTML.length)
|
||||
if (nameSpan && nameSpan.innerHTML && nameSpan.innerHTML.length)
|
||||
nameSpan.setAttribute("style", "display:inline-block;");
|
||||
}
|
||||
else {
|
||||
|
@ -658,8 +658,10 @@ var VideoLayout = (function (my) {
|
|||
* from the connection.jingle.sessions.
|
||||
*/
|
||||
my.showFocusIndicator = function() {
|
||||
var indicatorSpan;
|
||||
|
||||
if (focus !== null) {
|
||||
var indicatorSpan = $('#localVideoContainer .focusindicator');
|
||||
indicatorSpan = $('#localVideoContainer .focusindicator');
|
||||
|
||||
if (indicatorSpan.children().length === 0)
|
||||
{
|
||||
|
@ -679,7 +681,7 @@ var VideoLayout = (function (my) {
|
|||
console.error("No focus container!");
|
||||
return;
|
||||
}
|
||||
var indicatorSpan = $('#' + focusId + ' .focusindicator');
|
||||
indicatorSpan = $('#' + focusId + ' .focusindicator');
|
||||
|
||||
if (!indicatorSpan || indicatorSpan.length === 0) {
|
||||
indicatorSpan = document.createElement('span');
|
||||
|
@ -961,7 +963,7 @@ var VideoLayout = (function (my) {
|
|||
|
||||
/**
|
||||
* Creates the edit display name button.
|
||||
*
|
||||
*
|
||||
* @returns the edit button
|
||||
*/
|
||||
function createEditDisplayNameButton() {
|
||||
|
@ -1037,7 +1039,7 @@ var VideoLayout = (function (my) {
|
|||
var i = containerElement.id.indexOf('participant_');
|
||||
|
||||
if (i >= 0)
|
||||
return containerElement.id.substring(i + 12);
|
||||
return containerElement.id.substring(i + 12);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1083,7 +1085,7 @@ var VideoLayout = (function (my) {
|
|||
}
|
||||
|
||||
muteLinkItem.onclick = function(){
|
||||
if ($(this).attr('disabled') != undefined) {
|
||||
if ($(this).attr('disabled') !== undefined) {
|
||||
event.preventDefault();
|
||||
}
|
||||
var isMute = !mutedAudios[jid];
|
||||
|
|
Loading…
Reference in New Issue