Commit f08e1a12 authored by Francois Marier's avatar Francois Marier
Browse files

Fix Javascript warnings emitted by js2-mode



These are mostly just missing semicolons. No code changes.

If you use emacs already: apt-get install js2-mode
If you don't use emacs: apt-get install emacs js2-mode ;-)

Change-Id: Ie81c438c673084ee9e29a950bafe628a7c3ca7d9
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent e6144927
......@@ -42,7 +42,7 @@ MochiKit.Pagination.VERSION = '0.1';
MochiKit.Pagination.__repr__ = function () { return '[' + this.NAME + ' ' + this.VERSION + ']'; };
MochiKit.Pagination.toString = function () { return this.__repr__(); };
MochiKit.Pagination.EXPORT = [
'Pager',
'Pager'
];
MochiKit.Pagination.Pager = function (count, limit, options) {
......
......@@ -34,7 +34,7 @@ function UserSearch() {
self.selectusers = {};
self.rewriteCheckboxes();
self.params = {};
}
};
this.rewriteInitials = function() {
forEach(getElementsByTagAndClassName('span', 'first-initial', 'firstnamelist'), function(i) {
......@@ -43,11 +43,11 @@ function UserSearch() {
forEach(getElementsByTagAndClassName('span', 'last-initial', 'lastnamelist'), function(i) {
self.rewriteInitial('l', i);
});
}
};
this.rewriteInitial = function(t, i) {
connect(i, 'onclick', partial(self.searchInitial, t));
}
};
this.resetInitials = function() {
forEach(getElementsByTagAndClassName('span', 'selected', 'initials'), function (i) {
......@@ -56,7 +56,7 @@ function UserSearch() {
forEach(getElementsByTagAndClassName('span', 'all', 'initials'), function (i) {
addElementClass(i, 'selected');
});
}
};
this.searchInitial = function(initialtype, e) {
// Clear all search params except for the other initial
......@@ -96,33 +96,33 @@ function UserSearch() {
// so pass true here to avoid clearing the selected users.
self.doSearch(true);
}
}
};
this.changePage = function(e) {
e.stop();
self.searchByChildLink(this);
}
};
this.rewritePaging = function() {
forEach(getElementsByTagAndClassName('span', 'pagination', 'searchresults'), function(i) {
connect(i, 'onclick', self.changePage);
});
}
};
this.sortColumn = function(e) {
e.stop();
self.searchByChildLink(this);
}
};
this.rewriteSorting = function() {
forEach(getElementsByTagAndClassName('th', 'search-results-sort-column', 'searchresults'), function(i) {
connect(i, 'onclick', self.sortColumn);
});
}
};
this.rewriteQueryButton = function() {
connect($('query-button'), 'onclick', self.newQuery);
}
};
this.newQuery = function(e) {
self.params = {};
......@@ -138,7 +138,7 @@ function UserSearch() {
}
self.doSearch();
e.stop();
}
};
this.doSearch = function(saveselected) {
self.params.action = 'search';
......@@ -154,7 +154,7 @@ function UserSearch() {
self.rewriteSetLimit();
}
});
}
};
this.rewriteCheckboxes = function() {
forEach(getElementsByTagAndClassName('input', 'selectusers', 'searchresults'), function(i) {
......@@ -186,7 +186,7 @@ function UserSearch() {
});
});
}
}
};
this.rewriteSetLimit = function() {
if ($('setlimit')) {
......@@ -202,7 +202,7 @@ function UserSearch() {
});
});
}
}
};
addLoadEvent(self.init);
}
......@@ -232,13 +232,13 @@ addLoadEvent(function() {
appendChildNodes('bulkactions', INPUT({
'type': 'hidden',
'name': 'action',
'value': input.name,
'value': input.name
}));
$('bulkactions').submit();
return false;
}
removeElementClass('nousersselected', 'hidden');
return false;
})
});
});
});
......@@ -33,7 +33,7 @@ Array.prototype.compare = function(testArr) {
if (this[i] !== testArr[i]) return false;
}
return true;
}
};
var ul = null;
var initialgroups = new Array();
......
......@@ -299,7 +299,7 @@ function basename(path) {
// Autofocus the first element with a class of 'autofocus' on page load (@todo: move this to pieforms.js)
// Also, connect input elements with the 'emptyonfocus' class to work properly
addLoadEvent(function() {
var element = getFirstElementByTagAndClassName(null, 'autofocus', document.body)
var element = getFirstElementByTagAndClassName(null, 'autofocus', document.body);
if ( element && typeof(element.focus) == 'function' ) {
element.focus();
......@@ -685,7 +685,7 @@ function quotaUpdate(quotaused, quota) {
$('quota_total').innerHTML = data.quota_display;
$('quota_percentage').innerHTML = percentage + '%';
$('quota_fill').style.width = (percentage * 2) + 'px';
}
};
if ((typeof(quotaused) == 'number' || typeof(quotaused) == 'string') && quota) {
var data = { 'quotaused': quotaused, 'quota': quota };
......
......@@ -68,7 +68,7 @@ var MoveSource = function(element, options) {
if (e) {
e.stop();
}
}
};
self.cancelMove = function(e) {
MochiKit.Signal.disconnect(self.onClick);
......@@ -80,7 +80,7 @@ var MoveSource = function(element, options) {
if (e) {
e.stop();
}
}
};
self.onClick = MochiKit.Signal.connect(self.element, 'onclick', self, self.startMove);
MoveSources.register(self);
......
......@@ -41,7 +41,7 @@ var Paginator = function(id, datatable, script, extradata) {
self.extraData = extradata;
self.rewritePaginatorLinks();
}
};
this.rewritePaginatorLinks = function() {
forEach(getElementsByTagAndClassName('span', 'pagination', self.id), function(i) {
......@@ -52,7 +52,7 @@ var Paginator = function(id, datatable, script, extradata) {
self.rewritePaginatorLink(a);
}
});
}
};
this.updateResults = function (data) {
var container = self.datatable;
......@@ -110,14 +110,14 @@ var Paginator = function(id, datatable, script, extradata) {
results.innerHTML = data.data.results;
}
}
}
};
this.sendQuery = function(params) {
sendjsonrequest(self.jsonScript, params, 'GET', function(data) {
self.updateResults(data);
self.alertProxy('pagechanged', data['data']);
});
}
};
this.rewritePaginatorLink = function(a) {
connect(a, 'onclick', function(e) {
......@@ -132,16 +132,16 @@ var Paginator = function(id, datatable, script, extradata) {
self.sendQuery(queryData);
});
}
};
this.alertProxy = function(eventName, data) {
if (typeof(paginatorProxy) == 'object') {
paginatorProxy.alertObservers(eventName, data);
}
}
};
this.init(id, datatable, script, extradata);
}
};
/**
* Any object can subscribe to the PaginatorProxy and thus be alerted when a
......@@ -163,14 +163,14 @@ function PaginatorProxy() {
forEach(self.observers, function(o) {
signal(o, eventName, data);
});
}
};
/**
* Adds an observer to listen to paginator events
*/
this.addObserver = function(o) {
self.observers.push(o);
}
};
this.observers = [];
}
......
......@@ -29,7 +29,7 @@ function SearchTable(id) {
self.rewriteQueryButtons();
self.rewritePaging();
self.params = {};
}
};
this.searchByChildLink = function (element) {
var children = getElementsByTagAndClassName('a', null, element);
......@@ -38,26 +38,26 @@ function SearchTable(id) {
self.params = parseQueryString(href.substring(href.indexOf('?')+1, href.length));
self.doSearch();
}
}
};
this.changePage = function(e) {
e.stop();
self.searchByChildLink(this);
}
};
this.rewritePaging = function() {
forEach(getElementsByTagAndClassName('span', 'pagination', self.id), function(i) {
connect(i, 'onclick', self.changePage);
});
}
};
this.rewriteQueryButtons = function() {
forEach(getElementsByTagAndClassName('button', 'query-button', self.id), function(i) {
connect(i, 'onclick', self.newQuery);
});
}
};
this.rewriteOther = function () {} // Override
this.rewriteOther = function () {}; // Override
this.newQuery = function(e) {
self.params = {};
......@@ -66,7 +66,7 @@ function SearchTable(id) {
});
self.doSearch();
e.stop();
}
};
this.doSearch = function() {
sendjsonrequest(self.id + '.json.php', self.params, 'POST', function(data) {
......@@ -77,7 +77,7 @@ function SearchTable(id) {
self.rewriteOther();
}
});
}
};
addLoadEvent(self.init);
}
......
......@@ -25,7 +25,7 @@
*/
TableRendererPageLoaded = false;
addLoadEvent(function() { TableRendererPageLoaded = true });
addLoadEvent(function() { TableRendererPageLoaded = true; });
document.write('<script type="text/javascript" src="' + config.wwwroot + 'js/Pager.js"></script>');
function TableRenderer(target, source, columns, options) {
......@@ -40,7 +40,7 @@ function TableRenderer(target, source, columns, options) {
this.paginate_firstlast = true;
this.statevars = ['offset','limit'];
this.emptycontent = undefined; // Something to display when no results are found
this.rowfunction = function(rowdata, rownumber, data) { return TR({'class': 'r' + (rownumber % 2)}); }
this.rowfunction = function(rowdata, rownumber, data) { return TR({'class': 'r' + (rownumber % 2)}); };
this.updatecallback = function () {};
this.postupdatecallback = function () {};
this.updateOnLoadFlag = false;
......@@ -132,12 +132,12 @@ function TableRenderer(target, source, columns, options) {
}
appendChildNodes(self.tfoot, self.footRow);
}
}
};
this.pageChange = function(n) {
self.lastArgs.offset = ( n - 1 ) * self.limit;
self.doupdate(self.lastArgs);
}
};
this.onFirstPage = function () {
if (self.offset == 0) {
......@@ -145,7 +145,7 @@ function TableRenderer(target, source, columns, options) {
}
return false;
}
};
this.onLastPage = function () {
// logDebug('offset=' + self.offset + ', limit=' + self.limit + ', count=' + self.count);
if ( self.offset + self.limit >= self.count ) {
......@@ -153,7 +153,7 @@ function TableRenderer(target, source, columns, options) {
}
return false;
}
};
this.renderdata = function(data) {
replaceChildNodes(self.tbody);
......@@ -187,7 +187,7 @@ function TableRenderer(target, source, columns, options) {
appendChildNodes(self.tbody, tr);
});
}
}
};
this.doupdate = function(request_args) {
if (!request_args) {
......@@ -299,7 +299,7 @@ function TableRenderer(target, source, columns, options) {
else {
addLoadEvent(partial(self.doupdate, request_args));
}
}
};
this.defaultPagerOptions = {
'pageChangeCallback': self.pageChange,
......
......@@ -30,7 +30,7 @@ function UserSearch() {
self.rewriteQueryButton();
self.rewritePaging();
self.params = {};
}
};
this.rewriteInitials = function() {
forEach(getElementsByTagAndClassName('span', 'first-initial', 'firstnamelist'), function(i) {
......@@ -39,11 +39,11 @@ function UserSearch() {
forEach(getElementsByTagAndClassName('span', 'last-initial', 'lastnamelist'), function(i) {
self.rewriteInitial('l', i);
});
}
};
this.rewriteInitial = function(t, i) {
connect(i, 'onclick', partial(self.searchInitial, t));
}
};
this.searchInitial = function(initialtype, e) {
// Clear all search params except for the other initial
......@@ -78,7 +78,7 @@ function UserSearch() {
forEach(getElementsByTagAndClassName('span', 'pagination', 'searchresults'), function(i) {
connect(i, 'onclick', self.changePage);
});
}
};
this.changePage = function(e) {
var children = getElementsByTagAndClassName('a', null, this);
......@@ -88,18 +88,18 @@ function UserSearch() {
self.doSearch();
}
e.stop();
}
};
this.rewriteQueryButton = function() {
connect($('query-button'), 'onclick', self.newQuery);
}
};
this.newQuery = function(e) {
self.params = {};
self.params.query = $('query').value;
self.doSearch();
e.stop();
}
};
this.doSearch = function() {
self.params.action = 'search';
......@@ -107,7 +107,7 @@ function UserSearch() {
$('results').innerHTML = data.data;
self.rewritePaging();
});
}
};
addLoadEvent(self.init);
}
......
......@@ -120,7 +120,7 @@ function ViewManager() {
removeElement('views-loading');
showElement(self.bottomPane);
}
};
/**
* Adds a column to the view
......@@ -183,7 +183,7 @@ function ViewManager() {
// Wire up the new column buttons to be AJAX
self.rewriteAddColumnButtons('column_' + id);
self.rewriteRemoveColumnButtons('column_' + id);
}
};
/**
* Removes a column from the view, sizes the others to take its place and
......@@ -260,7 +260,7 @@ function ViewManager() {
i = 1;
}
});
}
};
/**
* Rewrites the category select links to be AJAX
......@@ -280,7 +280,7 @@ function ViewManager() {
e.stop();
});
});
}
};
/**
* Rewrites the blockinstance configure buttons to be AJAX
......@@ -289,7 +289,7 @@ function ViewManager() {
forEach(getElementsByTagAndClassName('input', 'configurebutton', self.bottomPane), function(i) {
self.rewriteConfigureButton(i);
});
}
};
/**
* Rewrites one configure button to be AJAX
......@@ -299,7 +299,7 @@ function ViewManager() {
e.stop();
self.getConfigureForm(getFirstParentByTagAndClassName(button, 'div', 'blockinstance'));
});
}
};
this.getConfigureForm = function(blockinstance) {
......@@ -334,7 +334,7 @@ function ViewManager() {
});
});
}
};
this.hideMediaPlayers = function () {
......@@ -361,7 +361,7 @@ function ViewManager() {
});
insertSiblingNodesBefore(document.body.firstChild, DIV({'id': 'overlay'}));
}
};
this.showMediaPlayers = function () {
......@@ -381,7 +381,7 @@ function ViewManager() {
if ($('overlay')) {
removeElement('overlay');
}
}
};
this.addConfigureBlock = function(oldblock, configblock, removeoncancel) {
......@@ -445,7 +445,7 @@ function ViewManager() {
showElement(newblock);
eval(configblock.javascript);
}
};
this.replaceConfigureBlock = function(data) {
......@@ -453,7 +453,7 @@ function ViewManager() {
if (oldblock) {
var temp = DIV();
temp.innerHTML = data.data.html;
var newblock = getFirstElementByTagAndClassName('div', 'blockinstance', temp)
var newblock = getFirstElementByTagAndClassName('div', 'blockinstance', temp);
swapDOM(oldblock, newblock);
eval(data.data.javascript);
self.makeBlockinstanceDraggable(newblock);
......@@ -462,12 +462,12 @@ function ViewManager() {
}
self.removeConfigureBlocks();
self.showMediaPlayers();
}
};
this.removeConfigureBlocks = function() {
// FF3 hangs unless you delay removal of the iframe inside the old configure block
callLater(0.0001, function () { forEach(getElementsByTagAndClassName('div', 'configure'), removeElement); });
}
};
/**
* Rewrites the blockinstance delete buttons to be AJAX
......@@ -476,7 +476,7 @@ function ViewManager() {
forEach(getElementsByTagAndClassName('input', 'deletebutton', self.bottomPane), function(i) {
self.rewriteDeleteButton(i);
});
}
};
/**
* Rewrites one delete button to be AJAX
......@@ -503,7 +503,7 @@ function ViewManager() {
}
e.stop();
});
}
};
/**
......@@ -522,7 +522,7 @@ function ViewManager() {
});
e.stop();
});
}
};
/**
* Rewrites the add column buttons to be AJAX
......@@ -559,7 +559,7 @@ function ViewManager() {
e.stop();
});
});
}
};
/**
* Rewrite the remove column buttons to be AJAX
......@@ -596,7 +596,7 @@ function ViewManager() {
e.stop();
});
});
}
};
/**
* Disables the 'add column' buttons
......@@ -624,7 +624,7 @@ function ViewManager() {
removeNodeAttribute(i, 'disabled');
}
});
}
};
/**
* Makes block instances draggable
......@@ -633,7 +633,7 @@ function ViewManager() {
forEach(getElementsByTagAndClassName('div', 'blockinstance', self.bottomPane), function(i) {
self.makeBlockinstanceDraggable(i);
});
}
};
/**
* Make a particular blockinstance draggable
......@@ -715,7 +715,7 @@ function ViewManager() {
{x: 0, y: 0, duration: 0});
}
});
}
};
/**
* Makes block types draggable
......@@ -816,7 +816,7 @@ function ViewManager() {
}
});
});
}
};
this.showBlockTypeDescription = function() {
forEach(getElementsByTagAndClassName('li', null, 'blocktype-list'), function(i) {
......@@ -827,7 +827,7 @@ function ViewManager() {
$('current_bt_description').innerHTML = '';
});
});
}
};
/**
* changes the intructions so they are for ajax
......@@ -835,7 +835,7 @@ function ViewManager() {
this.ajaxInstructions = function() {
$('blocksinstruction').innerHTML = get_string('blocksinstructionajax');
}