Enables the jshint maximum line length check (80 chars) globally, and only overrides it in certain files.

This commit is contained in:
Boris Grozev 2015-09-10 21:42:15 -05:00
parent a4c844f169
commit bd58e6c799
39 changed files with 89 additions and 35 deletions

View File

@ -13,8 +13,7 @@
"indent": 4, // {int} Number of spaces to use for indentation
"latedef": true, // true: Require variables/functions to be defined before being used
"newcap": true, // true: Require capitalization of all constructor functions e.g. `new F()`
//TODO: set to 80 when the code is compliant..
"maxlen": 1000, // {int} Max number of characters per line
"maxlen": 80, // {int} Max number of characters per line
"latedef": false, //This option prohibits the use of a variable before it was defined
"laxbreak": true //Ignore line breaks around "=", "==", "&&", etc.
}

11
app.js
View File

@ -6,15 +6,18 @@ var APP =
init: function () {
this.UI = require("./modules/UI/UI");
this.API = require("./modules/API/API");
this.connectionquality = require("./modules/connectionquality/connectionquality");
this.connectionquality =
require("./modules/connectionquality/connectionquality");
this.statistics = require("./modules/statistics/statistics");
this.RTC = require("./modules/RTC/RTC");
this.desktopsharing = require("./modules/desktopsharing/desktopsharing");
this.desktopsharing =
require("./modules/desktopsharing/desktopsharing");
this.xmpp = require("./modules/xmpp/xmpp");
this.keyboardshortcut = require("./modules/keyboardshortcut/keyboardshortcut");
this.keyboardshortcut =
require("./modules/keyboardshortcut/keyboardshortcut");
this.translation = require("./modules/translation/translation");
this.settings = require("./modules/settings/Settings");
this.DTMF = require("./modules/DTMF/DTMF");
//this.DTMF = require("./modules/DTMF/DTMF");
this.members = require("./modules/members/MemberList");
this.configFetch = require("./modules/config/HttpConfigFetch");
}

View File

@ -1,3 +1,4 @@
/* jshint -W101 */
var config = {
// configLocation: './config.json', // see ./modules/HttpConfigFetch.js
hosts: {

View File

@ -70,7 +70,8 @@ var JitsiMeetExternalAPI = (function()
if (!interfaceConfigOverwrite.hasOwnProperty(key) ||
typeof key !== 'string')
continue;
this.url += "&interfaceConfig." + key + "=" + interfaceConfigOverwrite[key];
this.url += "&interfaceConfig." + key + "=" +
interfaceConfigOverwrite[key];
}
}
@ -180,7 +181,8 @@ var JitsiMeetExternalAPI = (function()
* {{
* jid: jid //the jid of the participant
* }}
* participantLeft - receives event notifications about participant that left room.
* participantLeft - receives event notifications about the participant that
* left the room.
* The listener will receive object with the following structure:
* {{
* jid: jid //the jid of the participant
@ -225,7 +227,8 @@ var JitsiMeetExternalAPI = (function()
* {{
* jid: jid //the jid of the participant
* }}
* participantLeft - receives event notifications about participant that left room.
* participantLeft - receives event notifications about participant the that
* left the room.
* The listener will receive object with the following structure:
* {{
* jid: jid //the jid of the participant

View File

@ -132,7 +132,8 @@ function setupListeners() {
APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_JOINED, function (from) {
API.triggerEvent("participantJoined", {jid: from});
});
APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid, stamp) {
APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED,
function (from, nick, txt, myjid, stamp) {
if (from != myjid)
API.triggerEvent("incomingMessage",
{"from": from, "nick": nick, "message": txt, "stamp": stamp});
@ -140,10 +141,12 @@ function setupListeners() {
APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_LEFT, function (jid) {
API.triggerEvent("participantLeft", {jid: jid});
});
APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED, function (jid, newDisplayName) {
APP.xmpp.addListener(XMPPEvents.DISPLAY_NAME_CHANGED,
function (jid, newDisplayName) {
var name = displayName[jid];
if(!name || name != newDisplayName) {
API.triggerEvent("displayNameChange", {jid: jid, displayname: newDisplayName});
API.triggerEvent("displayNameChange",
{jid: jid, displayname: newDisplayName});
displayName[jid] = newDisplayName;
}
});

View File

@ -1,4 +1,5 @@
/* global config, APP, Strophe */
/* jshint -W101 */
// cache datachannels to avoid garbage collection
// https://code.google.com/p/chromium/issues/detail?id=405545

View File

@ -65,9 +65,11 @@ var RTC = {
eventEmitter.removeListener(eventType, listener);
},
createLocalStream: function (stream, type, change, videoType, isMuted, isGUMStream) {
createLocalStream: function (stream, type, change, videoType,
isMuted, isGUMStream) {
var localStream = new LocalStream(stream, type, eventEmitter, videoType, isGUMStream);
var localStream =
new LocalStream(stream, type, eventEmitter, videoType, isGUMStream);
//in firefox we have only one stream object
if(this.localStreams.length === 0 ||
this.localStreams[0].getOriginalStream() != stream)
@ -112,7 +114,8 @@ var RTC = {
this.remoteStreams[jid] = {};
}
this.remoteStreams[jid][remoteStream.type]= remoteStream;
eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, remoteStream);
eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED,
remoteStream);
return remoteStream;
},
getPCConstraints: function () {
@ -224,7 +227,8 @@ var RTC = {
stream = stream.videoStream;
}
var videoStream = this.rtcUtils.createStream(stream, true);
this.localVideo = this.createLocalStream(videoStream, "video", true, type);
this.localVideo =
this.createLocalStream(videoStream, "video", true, type);
// Stop the stream to trigger onended event for old stream
oldStream.stop();

View File

@ -1,6 +1,7 @@
/* global APP, config, require, attachMediaStream, getUserMedia,
RTCPeerConnection, webkitMediaStream, webkitURL, webkitRTCPeerConnection,
mozRTCIceCandidate, mozRTCSessionDescription, mozRTCPeerConnection */
/* jshint -W101 */
var RTCBrowserType = require("./RTCBrowserType");
var Resolutions = require("../../service/RTC/Resolutions");
var AdapterJS = require("./adapter.screenshare");

View File

@ -1,4 +1,5 @@
/* global Strophe, APP, $, config, interfaceConfig, toastr */
/* jshint -W101 */
var UI = {};
var VideoLayout = require("./videolayout/VideoLayout.js");

View File

@ -1,4 +1,5 @@
/* global APP, interfaceConfig, $, Strophe */
/* jshint -W101 */
var CanvasUtil = require("./CanvasUtils");
var ASDrawContext = null;

View File

@ -8,7 +8,8 @@ var UIUtil = require("../util/UIUtil");
var etherpadName = null;
var etherpadIFrame = null;
var domain = null;
var options = "?showControls=true&showChat=false&showLineNumbers=true&useMonospaceFont=false";
var options = "?showControls=true&showChat=false&showLineNumbers=true" +
"&useMonospaceFont=false";
/**

View File

@ -1,4 +1,5 @@
/* global PreziPlayer */
/* jshint -W101 */
(function() {
"use strict";
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

View File

@ -103,7 +103,8 @@ var PanelToggler = (function(my) {
toggle(Chat,
'#chatspace',
function () {
// Request the focus in the nickname field or the chat input field.
// Request the focus in the nickname field or the chat input
// field.
if ($('#nickname').css('visibility') === 'visible') {
$('#nickinput').focus();
} else {
@ -164,7 +165,9 @@ var PanelToggler = (function(my) {
};
my.isVisible = function() {
return (Chat.isVisible() || ContactList.isVisible() || SettingsMenu.isVisible());
return (Chat.isVisible() ||
ContactList.isVisible() ||
SettingsMenu.isVisible());
};
return my;

View File

@ -203,7 +203,8 @@ var Chat = (function (my) {
}
else {
var message = UIUtil.escapeHtml(value);
APP.xmpp.sendChatMessage(message, NicknameHandler.getNickname());
APP.xmpp.sendChatMessage(message,
NicknameHandler.getNickname());
}
}
});

View File

@ -1,3 +1,4 @@
/* jshint -W101 */
var Smileys = require("./smileys.json");
/**
* Processes links and smileys in "body"

View File

@ -61,7 +61,8 @@ var SettingsMenu = {
},
update: function() {
var newDisplayName = UIUtil.escapeHtml($('#setDisplayName').get(0).value);
var newDisplayName =
UIUtil.escapeHtml($('#setDisplayName').get(0).value);
var newEmail = UIUtil.escapeHtml($('#setEmail').get(0).value);
if(newDisplayName) {

View File

@ -1,5 +1,6 @@
/* global APP, $, buttonClick, config, lockRoom, interfaceConfig, setSharedKey,
Util */
/* jshint -W101 */
var messageHandler = require("../util/MessageHandler");
var BottomToolbar = require("./BottomToolbar");
var Prezi = require("../prezi/Prezi");

View File

@ -28,7 +28,8 @@ var JitsiPopover = (function () {
element.data("jitsi_popover", this);
this.element = element;
this.template = ' <div class="jitsipopover ' + this.options.skin +
'"><div class="arrow"></div><div class="jitsipopover-content"></div>' +
'"><div class="arrow"></div>' +
'<div class="jitsipopover-content"></div>' +
'<div class="jitsiPopupmenuPadding"></div></div>';
var self = this;
this.element.on("mouseenter", function () {

View File

@ -1,4 +1,5 @@
/* global $, APP, jQuery, toastr, Impromptu */
/* jshint -W101 */
/**
* Flag for enable/disable of the notifications.

View File

@ -1,4 +1,5 @@
/* global APP, $ */
/* jshint -W101 */
var JitsiPopover = require("../util/JitsiPopover");
/**

View File

@ -1,4 +1,5 @@
/* global $, APP, Strophe, interfaceConfig */
/* jshint -W101 */
var Avatar = require("../avatar/Avatar");
var RTCBrowserType = require("../../RTC/RTCBrowserType");
var UIUtil = require("../util/UIUtil");

View File

@ -1,4 +1,5 @@
/* global $, APP, require */
/* jshint -W101 */
var Avatar = require("../avatar/Avatar");
var UIUtil = require("../util/UIUtil");
var LargeVideo = require("./LargeVideo");

View File

@ -1,4 +1,5 @@
/* global config, APP, $, Strophe, require, interfaceConfig */
/* jshint -W101 */
var AudioLevels = require("../audio_levels/AudioLevels");
var ContactList = require("../side_pannels/contactlist/ContactList");
var MediaStreamType = require("../../../service/RTC/MediaStreamTypes");

View File

@ -1,3 +1,4 @@
/* jshint -W101 */
//var nouns = [
//];
var pluralNouns = [

View File

@ -1,4 +1,5 @@
/* global APP, require */
/* jshint -W101 */
var EventEmitter = require("events");
var eventEmitter = new EventEmitter();
var CQEvents = require("../../service/connectionquality/CQEvents");

View File

@ -51,7 +51,8 @@ var KeyboardShortcut = {
APP.UI.clickOnVideo(keycode - "0".charCodeAt(0) + 1);
}
//esc while the smileys are visible hides them
} else if (keycode === 27 && $('#smileysContainer').is(':visible')) {
} else if (keycode === 27 &&
$('#smileysContainer').is(':visible')) {
APP.UI.toggleSmileys();
}
};

View File

@ -66,7 +66,8 @@ function animateLevel(newLevel, lastLevel) {
* @param interval stats refresh interval given in ms.
* @constructor
*/
function LocalStatsCollector(stream, interval, statisticsService, eventEmitter) {
function LocalStatsCollector(stream, interval,
statisticsService, eventEmitter) {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
this.stream = stream;
this.intervalId = null;

View File

@ -1,5 +1,6 @@
/* global require, ssrc2jid */
/* jshint -W117 */
/* jshint -W101 */
var RTCBrowserType = require("../RTC/RTCBrowserType");
/* Whether we support the browser we are running into for logging statistics */

View File

@ -114,13 +114,16 @@ var statistics = {
start: function () {
APP.RTC.addStreamListener(onStreamCreated,
StreamEventTypes.EVENT_TYPE_LOCAL_CREATED);
APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
//FIXME: we may want to change CALL INCOMING event to onnegotiationneeded
APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE,
onDisposeConference);
//FIXME: we may want to change CALL INCOMING event to
// onnegotiationneeded
APP.xmpp.addListener(XMPPEvents.CALL_INCOMING, function (event) {
startRemoteStats(event.peerconnection);
// CallStats.init(event);
});
APP.xmpp.addListener(XMPPEvents.PEERCONNECTION_READY, function (session) {
APP.xmpp.addListener(XMPPEvents.PEERCONNECTION_READY,
function (session) {
CallStats.init(session);
});
APP.RTC.addListener(RTCEvents.AUDIO_MUTE, function (mute) {

View File

@ -31,7 +31,8 @@ var defaultOptions = {
var resPath = "lang/__ns__-__lng__.json";
if(lng === languages.EN)
resPath = "lang/__ns__.json";
var url = i18n.functions.applyReplacement(resPath, { lng: lng, ns: ns });
var url = i18n.functions.applyReplacement(resPath,
{ lng: lng, ns: ns });
i18n.functions.ajax({
url: url,
success: function(data, status, xhr) {

View File

@ -1,4 +1,5 @@
/* jshint -W117 */
/* jshint -W101 */
var JingleSession = require("./JingleSession");
var TraceablePeerConnection = require("./TraceablePeerConnection");
var SDPDiffer = require("./SDPDiffer");

View File

@ -1,3 +1,4 @@
/* jshint -W101 */
/* jshint -W117 */
var SDPUtil = require("./SDPUtil");

View File

@ -1,3 +1,4 @@
/* jshint -W101 */
var SDPUtil = {
filter_special_chars: function (text) {
return text.replace(/[\\\/\{,\}\+]/g, "");

View File

@ -1,5 +1,6 @@
/* global $, config, mozRTCPeerConnection, RTCPeerConnection,
webkitRTCPeerConnection, RTCSessionDescription */
/* jshint -W101 */
var RTC = require('../RTC/RTC');
var RTCBrowserType = require("../RTC/RTCBrowserType.js");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");

View File

@ -50,7 +50,8 @@ function setRecordingJirecon(state, token, callback, connection) {
// TODO wait for an IQ with the real status, since this is
// provisional?
jireconRid = $(result).find('recording').attr('rid');
console.log('Recording ' + ((state === 'on') ? 'started' : 'stopped') +
console.log('Recording ' +
((state === 'on') ? 'started' : 'stopped') +
'(jirecon)' + result);
recordingEnabled = state;
if (state === 'off'){
@ -113,7 +114,9 @@ var Recording = {
useJirecon = config.hosts &&
(typeof config.hosts.jirecon != "undefined");
},
toggleRecording: function (tokenEmptyCallback, recordingStateChangeCallback, connection) {
toggleRecording: function (tokenEmptyCallback,
recordingStateChangeCallback,
connection) {
if (!Moderator.isModerator()) {
console.log(
'non-focus, or conference not yet organized:' +
@ -126,7 +129,9 @@ var Recording = {
if (!recordingToken && !useJirecon) {
tokenEmptyCallback(function (value) {
setRecordingToken(value);
self.toggleRecording(tokenEmptyCallback, recordingStateChangeCallback, connection);
self.toggleRecording(tokenEmptyCallback,
recordingStateChangeCallback,
connection);
});
return;

View File

@ -1,4 +1,5 @@
/* jshint -W117 */
/* jshint -W101 */
var JingleSession = require("./JingleSessionPC");
var XMPPEvents = require("../../service/xmpp/XMPPEvents");

View File

@ -20,7 +20,8 @@ module.exports = function (XMPP, eventEmitter) {
},
setMute: function (jid, mute) {
console.info("set mute", mute);
var iqToFocus = $iq({to: this.connection.emuc.focusMucJid, type: 'set'})
var iqToFocus =
$iq({to: this.connection.emuc.focusMucJid, type: 'set'})
.c('mute', {
xmlns: 'http://jitsi.org/jitmeet/audio',
jid: jid

View File

@ -11,7 +11,8 @@ module.exports = function() {
}
this.connection.addHandler(
this.onRayo.bind(this), this.RAYO_XMLNS, 'iq', 'set', null, null);
this.onRayo.bind(this), this.RAYO_XMLNS, 'iq', 'set',
null, null);
},
onRayo: function (iq) {
console.info("Rayo IQ", iq);
@ -51,9 +52,9 @@ module.exports = function() {
console.info('Dial result ', result);
var resource = $(result).find('ref').attr('uri');
this.call_resource = resource.substr('xmpp:'.length);
self.call_resource = resource.substr('xmpp:'.length);
console.info(
"Received call resource: " + this.call_resource);
"Received call resource: " + self.call_resource);
},
function (error) {
console.info('Dial error ', error);

View File

@ -1,4 +1,5 @@
/* global $, APP, config, Strophe, Base64, $msg */
/* jshint -W101 */
var Moderator = require("./moderator");
var EventEmitter = require("events");
var Recording = require("./recording");