Clean code with PhpStorm (semicolons)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2015-09-27 08:05:31 +02:00
parent 9fe423db62
commit f3406313e5
24 changed files with 107 additions and 107 deletions

View File

@ -42,7 +42,7 @@ var config = {
getComposerUrl: 'https://getcomposer.org/installer',
phpBin: 'php -d "suhosin.executor.include.whitelist = phar"',
package: require('./composer.json')
}
};
// Cleans all built files
@ -322,7 +322,7 @@ gulp.task('pack-sources', ['composer-install', 'bower-install'], function() {
// At the same we need to see all errors that take place.
strict: false,
silent: false
}
};
var version = config.package.version;
return eventStream.merge(
@ -405,7 +405,7 @@ var getClientSideApp = function(name) {
{base: process.cwd()}
))
.pipe(concat(name + '_app.js'));
}
};
/**
* Wraps a handlebars template with a function and attach it to the
@ -424,7 +424,7 @@ var wrapHandlebarsTemplate = function() {
return {relative: context.file.relative.replace(/\.js$/, '').replace(/\\/g, '/')};
}
});
}
};
/**
* Extracts gettext messages from handlebars templates.
@ -465,4 +465,4 @@ var xgettextHandlebars = function() {
callback();
});
}
};

View File

@ -119,7 +119,7 @@
eventArgs = {
'messageData': messageData,
'model': false
}
};
// Trigger event. See description of eventName and eventArgs
// above.

View File

@ -41,5 +41,5 @@ MibewAPIChatInteraction = function() {
'result'
];
}
}
};
MibewAPIChatInteraction.prototype = new MibewAPIInteraction();

View File

@ -48,7 +48,7 @@
* Move to secure chat
*/
secure: function() {
var link = this.model.get('link')
var link = this.model.get('link');
if (link) {
var style = Mibew.Objects.Models.page.get('style');
window.location.href = link.replace(/\&amp\;/g, '&')

View File

@ -258,7 +258,7 @@
// Restart server updater because module just started and there are no
// reasons to wait refresh time to get results of previous request
Mibew.Objects.server.restartUpdater();
})
});
// Add module finalizer
chat.addFinalizer(function() {

View File

@ -90,7 +90,7 @@
// Restart server updater because module just started and there are no
// reasons to wait refresh time to get results of previous request
Mibew.Objects.server.restartUpdater();
})
});
// Add module finalizer
invitation.addFinalizer(function() {

View File

@ -62,7 +62,7 @@ var Mibew = Mibew || {};
+ "path=/; "
+ (domain ? ("domain=" + domain[1] + "; ") : '')
+ (expires ? ('expires=' + expires.toUTCString() + '; ') : '');
}
};
/**
* Try to read cookie.
@ -82,7 +82,7 @@ var Mibew = Mibew || {};
}
}
return value;
}
};
/**
* Deletes cookie.
@ -91,7 +91,7 @@ var Mibew = Mibew || {};
*/
Mibew.Utils.deleteCookie = function(name) {
Mibew.Utils.createCookie(name, '', (new Date(0)));
}
};
/**
* Sets correct prototypes chain.
@ -169,7 +169,7 @@ var Mibew = Mibew || {};
document.getElementsByTagName('head')[0].appendChild(styleSheet);
return styleSheet;
}
};
/**
* Loads JavaScript file and attach it to DOM.
@ -189,7 +189,7 @@ var Mibew = Mibew || {};
document.getElementsByTagName('head')[0].appendChild(script);
return script;
}
};
/**
* Initialize a proper chat popup.
@ -205,7 +205,7 @@ var Mibew = Mibew || {};
Popup = canUseIFrame ? Mibew.ChatPopup.IFrame : Mibew.ChatPopup.Window;
Mibew.Objects.ChatPopups[options.id] = new Popup(options);
}
};
/**
* A constructor for base (abstract) popup object.
@ -260,7 +260,7 @@ var Mibew = Mibew || {};
* @type {Boolean}
*/
this.modSecurity = options.modSecurity || false;
}
};
/**
* Builds an URL that initializes a chat.
@ -279,7 +279,7 @@ var Mibew = Mibew || {};
return this.url
+ ((this.url.indexOf('?') === -1) ? '?' : '&') + 'url=' + encodeURIComponent(href)
+ '&referrer=' + encodeURIComponent(referrer);
}
};
/**
* Constructs IFrame popup.
@ -317,7 +317,7 @@ var Mibew = Mibew || {};
// new page is visited.
this.open(openedChatUrl);
}
}
};
// Set correct prototype chain for IFrame popup.
Mibew.Utils.inherits(Mibew.ChatPopup.IFrame, BasePopup);
@ -386,7 +386,7 @@ var Mibew = Mibew || {};
this.iframe.style.display = 'block';
this.iframe.src = url || this.buildChatUrl();
this.isOpened = true;
}
};
/**
* Closes the popup.
@ -401,7 +401,7 @@ var Mibew = Mibew || {};
this.iframe.src = '';
this.isOpened = false;
Mibew.Utils.deleteCookie('mibew-chat-frame-' + this.id);
}
};
/**
* Constructs Window popup.
@ -414,7 +414,7 @@ var Mibew = Mibew || {};
BasePopup.call(this, options);
this.window = null;
}
};
// Set correct prototype chain for Window popup.
Mibew.Utils.inherits(Mibew.ChatPopup.Window, BasePopup);
@ -433,7 +433,7 @@ var Mibew = Mibew || {};
);
this.window.focus();
this.window.opener = window;
}
};
/**
* Closes the popup.
@ -446,7 +446,7 @@ var Mibew = Mibew || {};
this.window.close();
this.window = null;
}
};
/**
* Builds window params string.
@ -468,7 +468,7 @@ var Mibew = Mibew || {};
'height=' + this.height.toString(),
'resizable=' + (this.resizable ? '1' : '0')
].join(',');
}
};
// Attach a listener to window's "message" event to get the url of the chat
// which is opened in iframe popup.

View File

@ -41,7 +41,7 @@
} else {
return new ChildViewType(options);
}
}
};
/**
* @class Represents base collection view

View File

@ -26,7 +26,7 @@ var Mibew = {};
// Use Backbone.Marionette with handlebars.js
Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) {
return Handlebars.compile(rawTemplate);
}
};
// Use all handlebars template as partials too
// We does not use Handlebars.partials property because of it can be changed

View File

@ -47,7 +47,7 @@
return localized.replace(/\{([0-9]+)\}/g, function(match, index) {
return placeholders[parseInt(index)] || '';
});
}
};
/**
* Store localization object. Can be call multiple times, localization

View File

@ -92,7 +92,7 @@
* @type Object
* @private
*/
this.functions = {}
this.functions = {};
/**
* Id of the last registered function
@ -107,7 +107,7 @@
* @private
*/
this.mibewAPI = new MibewAPI(new this.options['interactionType']());
}
};
/**
* Make call to the server
@ -148,7 +148,7 @@
return false;
}
return true;
}
};
/**
* Call function at every request to build functions list
@ -165,7 +165,7 @@
callbackFunction: callbackFunction
};
return this.callPeriodicallyLastId;
}
};
/**
* Stop calling function at every request.
@ -177,7 +177,7 @@
if (id in this.callPeriodically) {
delete this.callPeriodically[id];
}
}
};
/**
* Generates unique request token
@ -195,7 +195,7 @@
// Check token uniqueness
} while(token in this.callbacks);
return token;
}
};
/**
* Process request
@ -236,7 +236,7 @@
delete this.callbacks[requestObject.token];
}
}
}
};
/**
* Process function
@ -266,7 +266,7 @@
// Add function results to the execution context
context.storeFunctionResults(functionObject, results);
}
};
/**
* Send the request to the server
@ -291,14 +291,14 @@
success: _.bind(self.receiveResponse, self),
error: _.bind(self.onError, self)
});
}
};
/**
* Start automatic updater
*/
Mibew.Server.prototype.runUpdater = function() {
this.update();
}
};
/**
* Call Mibew.Server.update after specified timeout
@ -310,7 +310,7 @@
_.bind(this.update, this),
time * 1000
);
}
};
/**
* Restarts the automatic updater
@ -326,7 +326,7 @@
}
// Restart updater. Try to reconnect after a while
this.updateAfter(this.options.reconnectPause);
}
};
/**
* Send request to server
@ -360,7 +360,7 @@
// Handle errors
this.options.onUpdateError(e);
}
}
};
/**
* Process response from the Server
@ -387,7 +387,7 @@
} finally {
this.updateAfter(this.options.requestsFrequency);
}
}
};
/**
* Add function that can be called by the Server
@ -403,7 +403,7 @@
}
this.functions[functionName][this.functionsLastId] = handler;
return this.functionsLastId;
}
};
/**
* Remove function that can be called by Server

View File

@ -36,7 +36,7 @@
return str;
}
return str.substring(0, 1).toUpperCase() + str.substring(1);
}
};
/**
* Cast string in camel case to dash format.
@ -61,7 +61,7 @@
}
return parts.join('-');
}
};
/**
* Check if email address valid or not.
@ -99,7 +99,7 @@
// The regular exprassion is base on RFC 2822. It's not fully compatible
// with RFC but is sutabe for most real cases.
return /^(([a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+(\.[a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+)*)|(\".+\"))$/.test(localPart);
}
};
/**
* Play .wav or .mp3 sound file
@ -121,7 +121,7 @@
audioTag.attr('data-file', file);
}
}
}
};
/**
* Builds params string for window.open method.
@ -150,7 +150,7 @@
'height=' + allOptions.height,
'resizable=' + (allOptions.resizable ? '1' : '0')
].join(',');
}
};
/**
* Sets default options for Vex dialogs.
@ -170,7 +170,7 @@
*/
var isVexOpened = function () {
return (vex.getAllVexes().length > 0);
}
};
/**
* Alerts a message.
@ -183,7 +183,7 @@
return;
}
vex.dialog.alert({message: message});
}
};
/**
* Requires user confirmation.
@ -198,7 +198,7 @@
message: message,
callback: callback
});
}
};
/**
* Requests some info from the user.

View File

@ -100,7 +100,7 @@ MibewAPI.prototype.checkFunction = function(functionObject, filterReservedFuncti
functionObject["function"] + "' function"
);
}
}
};
/**
* Validate request
@ -134,7 +134,7 @@ MibewAPI.prototype.checkRequest = function(requestObject) {
for (var i = 0; i < requestObject.functions.length; i++) {
this.checkFunction(requestObject.functions[i]);
}
}
};
/**
* Validate package.
@ -177,7 +177,7 @@ MibewAPI.prototype.checkPackage = function (packageObject) {
for (var i = 0; i < packageObject.requests.length; i++) {
this.checkRequest(packageObject.requests[i]);
}
}
};
/**
* Search 'result' function in functionsList. If request contains more than
@ -222,7 +222,7 @@ MibewAPI.prototype.getResultFunction = function(functionsList, existance){
throw new Error("There is 'result' function in functions list");
}
return resultFunction;
}
};
/**
* Builds result package
@ -249,7 +249,7 @@ MibewAPI.prototype.buildResult = function(resultArguments, token) {
}
]
}
}
};
/**
* Encodes package
@ -265,7 +265,7 @@ MibewAPI.prototype.encodePackage = function(requests) {
packageObject.async = true;
packageObject.requests = requests;
return encodeURIComponent(JSON.stringify(packageObject)).replace(/\%20/gi, '+');
}
};
/**
* Decodes package and validate package structure
@ -280,7 +280,7 @@ MibewAPI.prototype.decodePackage = function(encodedPackage){
var decodedPackage = JSON.parse(decodeURIComponent(encodedPackage.replace(/\+/gi, ' ')));
this.checkPackage(decodedPackage);
return decodedPackage;
}
};
/**
* End of MibewAPI Class
*/
@ -318,7 +318,7 @@ function MibewAPIInteraction(){
*/
this.mandatoryArguments = function() {
return {};
}
};
/**
* Returns reserved (system) functions' names
@ -362,7 +362,7 @@ MibewAPIInteraction.prototype.getMandatoryArguments = function(functionName) {
}
}
return mandatoryArguments;
}
};
/**
* Returns default values of mandatory arguments for the functionName function
@ -393,7 +393,7 @@ MibewAPIInteraction.prototype.getMandatoryArgumentsDefaults = function(functionN
}
}
return mandatoryArguments;
}
};
/**
* End of MibewAPIInteraction class
*/
@ -470,7 +470,7 @@ MibewAPIExecutionContext.prototype.getArgumentsList = function(functionObject) {
argumentsList[variableName] = this.functionsResults[funcNum - 1][referenceTo];
}
return argumentsList;
}
};
/**
* Returns requets results
@ -479,7 +479,7 @@ MibewAPIExecutionContext.prototype.getArgumentsList = function(functionObject) {
*/
MibewAPIExecutionContext.prototype.getResults = function(){
return this.returnValues;
}
};
/**
* Stores functions results in execution context and add values to request
@ -516,7 +516,7 @@ MibewAPIExecutionContext.prototype.storeFunctionResults = function(functionObjec
}
// Store function results in execution context
this.functionsResults.push(results);
}
};
/**
* End of MibewAPIExecutionContext class
*/

View File

@ -36,7 +36,7 @@
Mibew.Utils.alert(Mibew.Localization.trans('Network problems detected. Please refresh the page.'));
badRequestsCount = 0;
}
}
};
// Create application instance
var App = new Backbone.Marionette.Application();

View File

@ -90,7 +90,7 @@
// Create default sort field
var sort = {
field: thread.get('waitingTime').toString()
}
};
// Trigger event to provide an ability to change sorting order
this.trigger('sort:field', thread, sort);

View File

@ -77,7 +77,7 @@
// Create default sort field
var sort = {
field: visitor.get('firstTime').toString()
}
};
// Trigger event to provide an ability to change sorting order
this.trigger('sort:field', visitor, sort);

View File

@ -43,7 +43,7 @@
newWindow.focus();
newWindow.opener = window;
}
};
/**
* Update time in timers

View File

@ -33,12 +33,12 @@ MibewAPIUsersInteraction = function() {
'errorCode': 0
}
};
}
};
this.getReservedFunctionsNames = function() {
return [
'result'
];
}
}
};
MibewAPIUsersInteraction.prototype = new MibewAPIInteraction();

View File

@ -96,7 +96,7 @@
* @returns {Object} Template data
*/
serializeData: function() {
var thread = this.model
var thread = this.model;
var page = Mibew.Objects.Models.page;
var data = thread.toJSON();
data.stateDesc = this.stateToDesc(thread.get('state'));

View File

@ -99,7 +99,7 @@ var Mibew = Mibew || {};
// Load additional styles
Mibew.Utils.loadStyleSheet(options.inviteStyle);
}
};
/**
* Make request to the server.
@ -130,7 +130,7 @@ var Mibew = Mibew || {};
// Clean up request data
this.dataToSend = {};
}
};
/**
* Build GET request params list
@ -146,7 +146,7 @@ var Mibew = Mibew || {};
query.push(index + '=' + this.dataToSend[index]);
}
return query.join('&');
}
};
/**
* Send arbitrary data to the Server as GET params
@ -176,7 +176,7 @@ var Mibew = Mibew || {};
this.dataToSend[index] = value;
}
}
};
/**
* Parse server response. Called as JSONP callback function
@ -241,7 +241,7 @@ var Mibew = Mibew || {};
context.makeRequest();
},
this.requestTimeout);
}
};
/**
* Remove dynamically loaded request script from DOM
@ -250,7 +250,7 @@ var Mibew = Mibew || {};
Mibew.Widget.prototype.cleanUpAfterRequest = function() {
document.getElementsByTagName('head')[0]
.removeChild(document.getElementById('mibew-response-script'));
}
};
/**
* Load script and add handler for script onLoad event
@ -266,14 +266,14 @@ var Mibew = Mibew || {};
// Check if script loaded
script.onload = function(){
context.scriptReady(id);
}
};
// Do it in crossbrowser way
script.onreadystatechange = function(){
if (this.readyState == 'complete' || this.readyState == 'loaded') {
context.scriptReady(id);
}
}
}
};
/**
* Event listener for script onLoad event. Run handlers which have no
@ -291,7 +291,7 @@ var Mibew = Mibew || {};
delete this.handlers[handlerName];
}
}
}
};
/**
* Check if handler can be run
@ -305,7 +305,7 @@ var Mibew = Mibew || {};
}
}
return true;
}
};
/**
* Helper function which create new widget object, store it into
@ -314,7 +314,7 @@ var Mibew = Mibew || {};
Mibew.Widget.init = function(options) {
Mibew.Objects.widget = new Mibew.Widget(options);
Mibew.Objects.widget.makeRequest();
}
};
/**
* @namespace Holds invitation stuff
@ -380,7 +380,7 @@ var Mibew = Mibew || {};
if (invitationdiv) {
invitationdiv.innerHTML = popuptext;
}
}
};
/**
* Display invitation popup
@ -391,7 +391,7 @@ var Mibew = Mibew || {};
Mibew.Invitation.trigger('show');
invitationPopup.style.display = 'block';
}
}
};
/**
* Hide invitation popup and remove it from DOM
@ -402,7 +402,7 @@ var Mibew = Mibew || {};
Mibew.Invitation.trigger('hide');
invitationPopup.parentNode.removeChild(invitationPopup);
}
}
};
/**
* Accept invitation and open chat window
@ -413,7 +413,7 @@ var Mibew = Mibew || {};
document.getElementById('mibew-agent-button').onclick();
Mibew.Invitation.hide();
}
}
};
/**
* Visitor rejects invitation
@ -422,7 +422,7 @@ var Mibew = Mibew || {};
Mibew.Invitation.trigger('reject');
Mibew.Objects.widget.sendToServer({'invitation_rejected': 1});
Mibew.Invitation.hide();
}
};
/**
* Contains callbacks for invitation events.
@ -451,7 +451,7 @@ var Mibew = Mibew || {};
}
invitaionEventsCallbacks[event].push(callback);
}
};
/**
* Triggers invitation event.
@ -476,7 +476,7 @@ var Mibew = Mibew || {};
for(var i = 0, length = callbacks.length; i < length; i++) {
callbacks[i](data);
}
}
};
/**
* @namespace Holds functions that can be called by the Core
@ -492,7 +492,7 @@ var Mibew = Mibew || {};
Mibew.Objects.widget.visitorCookieName,
response.user.id
);
}
};
/**
* Show invitation popup
@ -500,7 +500,7 @@ var Mibew = Mibew || {};
*/
Mibew.APIFunctions.invitationCreate = function(data) {
Mibew.Invitation.create(data.invitation);
}
};
/**
* Close invitation popup

View File

@ -73,7 +73,7 @@
if ($ava.size() > 0) {
$ava.height($msgs.innerHeight());
}
}
};
/**
* Fix bug with window resize event.
@ -88,7 +88,7 @@
t = setTimeout(function() {
updateHeight(recalculateHeight || false);
}, 0);
}
};
// Stretch messages region after chat page initialize
Mibew.Application.Chat.addInitializer(function() {
@ -119,7 +119,7 @@
// Stretch messages region on resize
$(window).resize(updateHeightWrapper);
}
}
};
// Change size of message region only after all images will be loaded
$('img').each(function(){

View File

@ -28,7 +28,7 @@
$("#dashboard-locales-popup").fadeIn("slow");
isPopupOpened = true;
}
}
};
var disablePopup = function(){
if(isPopupOpened){
@ -36,14 +36,14 @@
$("#dashboard-locales-popup").fadeOut("slow");
isPopupOpened = false;
}
}
};
var normalizePosition = function(a) {
if(a < 10) {
return 10;
}
return a;
}
};
var centerPopup = function(){
var windowWidth = document.documentElement.clientWidth;
@ -58,7 +58,7 @@
$("#background-popup").css({
"height": windowHeight
});
}
};
$(function(){
$("#change-language").on('click', function(){

View File

@ -262,7 +262,7 @@ test('inheritance', function() {
childOuterBlock: Handlebars.compile(
'{{#extends "parent"}}{{#override "first"}}foo{{/override}}{{/extends}}'
)
}
};
equal(
Handlebars.templates['childInnerBlock']({}),

View File

@ -18,7 +18,7 @@ function MibewAPITestInteraction() {
'bar': 127
}
};
}
};
this.getReservedFunctionsNames = function() {
return [
@ -181,7 +181,7 @@ test("checkRequest", function() {
"references" : [],
"testArgument" : "testValue"
}
}
};
// Try to check request without token
try {
@ -274,7 +274,7 @@ test("checkPackage", function() {
}
}
]
}
};
// Try to check package with no signature
try {
@ -407,7 +407,7 @@ test("getResult", function() {
var resultFunction = {
"function" : "result",
"test_field" : "test_value"
}
};
// Try to get result function from function list, but it contains more than
// one 'result' function
@ -483,7 +483,7 @@ test("buildResult", function() {
var testArguments = {
"first" : "test_value",
"second" : "test_value"
}
};
var token = "some token";
var testPackage = {
"token" : token,
@ -498,7 +498,7 @@ test("buildResult", function() {
}
}
]
}
};
// Compare result package
deepEqual(
@ -517,7 +517,7 @@ test("encodePackage", function() {
"proto" : mibewAPI.protocolVersion,
"async" : true,
"requests" : [testRequest]
}
};
// Compare encoded packages
equal(
@ -536,7 +536,7 @@ test("decodePackage", function() {
"proto" : mibewAPI.protocolVersion,
"async" : true,
"requests" : [testRequest]
}
};
var encodedPackage = mibewAPI.encodePackage([testRequest]);
// Try to decode broken package