Commit be2e830c authored by jonnybradley's avatar jonnybradley

[FIX] JSLint: Part 4 of JSLint* corrections: various js - mostly missing line...

[FIX] JSLint: Part 4 of JSLint* corrections: various js - mostly missing line terminations and var declarations (*actually phpStorm code inspections)
parent 4e30823f
...@@ -202,7 +202,7 @@ function initPreviewWindow (editorId, autoSaveId, allowHtml) { ...@@ -202,7 +202,7 @@ function initPreviewWindow (editorId, autoSaveId, allowHtml) {
var features = 'menubar=no,toolbar=no,fullscreen=no,titlebar=no,status=no,width=600'; var features = 'menubar=no,toolbar=no,fullscreen=no,titlebar=no,status=no,width=600';
var url = $.service("edit", "preview", {editor_id: editorId, autoSaveId: autoSaveId, allowHtml: allowHtml }); var url = $.service("edit", "preview", {editor_id: editorId, autoSaveId: autoSaveId, allowHtml: allowHtml });
window.open(url, "_blank", features); window.open(url, "_blank", features);
}; }
$(window).unload(function () { $(window).unload(function () {
if (ajaxPreviewWindow && typeof ajaxPreviewWindow.get_new_preview === 'function') { if (ajaxPreviewWindow && typeof ajaxPreviewWindow.get_new_preview === 'function') {
......
...@@ -17,8 +17,8 @@ CKEDITOR.plugins.add( 'autosave', ...@@ -17,8 +17,8 @@ CKEDITOR.plugins.add( 'autosave',
editor: null, editor: null,
init: function( editor ) { init: function( editor ) {
asplugin = this; // for closure references later var asplugin = this, command; // for closure references later
this.editor = editor; this.editor = editor;
editor.ui.addButton( 'autosave', { editor.ui.addButton( 'autosave', {
......
...@@ -8,7 +8,7 @@ CKEDITOR.plugins.add('inlinecancel', ...@@ -8,7 +8,7 @@ CKEDITOR.plugins.add('inlinecancel',
{ {
init: function (editor) { init: function (editor) {
var asplugin = this; // for closure references later var asplugin = this, command; // for closure references later
this.editor = editor; this.editor = editor;
editor.ui.addButton('inlinecancel', { editor.ui.addButton('inlinecancel', {
......
...@@ -17,7 +17,7 @@ CKEDITOR.addTemplates('default', ...@@ -17,7 +17,7 @@ CKEDITOR.addTemplates('default',
// Template definitions. // Template definitions.
templates: getContentTemplates() templates: getContentTemplates()
}) });
function getContentTemplates() { function getContentTemplates() {
...@@ -43,7 +43,7 @@ function getContentTemplates() { ...@@ -43,7 +43,7 @@ function getContentTemplates() {
result.push( result.push(
[{ [{
title: content[i]['title'], title: content[i]['title'],
html: content[i]['html'], html: content[i]['html']
}]); }]);
} }
return result; return result;
......
...@@ -306,7 +306,7 @@ jQuery.fn.extend({ ...@@ -306,7 +306,7 @@ jQuery.fn.extend({
var editor = syntaxHighlighter.ready(textarea, settings, mode), var editor = syntaxHighlighter.ready(textarea, settings, mode),
editorWindow = jQuery(editor.getWrapperElement()).find('.CodeMirror-scroll').addBack(), editorWindow = jQuery(editor.getWrapperElement()).find('.CodeMirror-scroll').addBack(),
scroller = jQuery(editor.getScrollerElement()); scroller = jQuery(editor.getScrollerElement());
scroller.scrollTop(scrollTop * (scroller.innerHeight() / textareaHeight)) scroller.scrollTop(scrollTop * (scroller.innerHeight() / textareaHeight));
o.removeClass('CodeMirrorHide'); o.removeClass('CodeMirrorHide');
...@@ -702,11 +702,11 @@ var syntaxHighlighter = { ...@@ -702,11 +702,11 @@ var syntaxHighlighter = {
return; return;
}, },
selection: function(textareaEditor, getStartEnd) { selection: function(textareaEditor, getStartEnd) {
selection = textareaEditor.getSelection(); var selection = textareaEditor.getSelection();
if (getStartEnd) { if (getStartEnd) {
var startCursor = textareaEditor.getCursor(true), var startCursor = textareaEditor.getCursor(true),
endCursor = textareaEditor.getCursor(false); endCursor = textareaEditor.getCursor(false), val;
val = (textareaEditor.getValue() + '').split('\n'); val = (textareaEditor.getValue() + '').split('\n');
var result = { var result = {
......
...@@ -39,7 +39,7 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) { ...@@ -39,7 +39,7 @@ CodeMirror.defineMode('tiki', function(config, parserConfig) {
case "{": //plugin case "{": //plugin
type = stream.eat("/") ? "closeTag" : "openTag"; type = stream.eat("/") ? "closeTag" : "openTag";
stream.eatSpace(); stream.eatSpace();
tagName = ""; var tagName = "";
var c; var c;
while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c; while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c;
state.tokenize = inPlugin; state.tokenize = inPlugin;
......
...@@ -8,7 +8,7 @@ $(document).ready(function() { ...@@ -8,7 +8,7 @@ $(document).ready(function() {
// when previewing a comment set the page anchor to the comment preview // when previewing a comment set the page anchor to the comment preview
$('#comments_previewComment').click(function() { $('#comments_previewComment').click(function() {
action = $('#editpostform').attr('action'); var action = $('#editpostform').attr('action');
$('#editpostform').attr('action', action.replace('#comments', '#form')); $('#editpostform').attr('action', action.replace('#comments', '#form'));
}); });
......
...@@ -398,7 +398,7 @@ $.fn.reportBuilderImport = function(data, o) { ...@@ -398,7 +398,7 @@ $.fn.reportBuilderImport = function(data, o) {
if (!o) o = ""; if (!o) o = "";
me.find(':checkbox').removeAttr('checked'); me.find(':checkbox').removeAttr('checked');
var i = 0; var i = 0, type;
//TODO: needs further application, but the idea is to apply the name of the array to the object on the page ;) //TODO: needs further application, but the idea is to apply the name of the array to the object on the page ;)
var importData = function(dataItem, trail, I) { var importData = function(dataItem, trail, I) {
for(type in dataItem) { for(type in dataItem) {
...@@ -454,7 +454,7 @@ $.fn.reportBuilderImport = function(data, o) { ...@@ -454,7 +454,7 @@ $.fn.reportBuilderImport = function(data, o) {
}; };
$.cleanArray = function(arr) { $.cleanArray = function(arr) {
$.each(arr, function() {}) $.each(arr, function() {});
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (!arr[i]) { if (!arr[i]) {
arr.splice(i, 1); arr.splice(i, 1);
......
...@@ -31,18 +31,18 @@ function Diaporama(imgName, arrPixId, options) ...@@ -31,18 +31,18 @@ function Diaporama(imgName, arrPixId, options)
this.sliding = 0; this.sliding = 0;
this.backward = 0; this.backward = 0;
this.toTheEnd = 0; this.toTheEnd = 0;
for (opt in options) { for (var opt in options) {
this[opt] = options[opt]; this[opt] = options[opt];
} }
for (this.curPix = 0; for (this.curPix = 0;
this.curPix < this.length && arrPixId[this.curPix] !== this.startId; this.curPix < this.length && arrPixId[this.curPix] !== this.startId;
this.curPix++) {} ; this.curPix++) {}
this.curPix = this.curPix % this.length; this.curPix = this.curPix % this.length;
this.hopePix = 0; this.hopePix = 0;
this.thePix = null; this.thePix = null;
this.timerPix = null; this.timerPix = null;
this.arrPix = new Array(); this.arrPix = [];
} }
Diaporama.prototype.setClassStyle = function (className, prop, val) { Diaporama.prototype.setClassStyle = function (className, prop, val) {
var elts = this.root.all ? this.root.all : this.root.getElementsByTagName('*'); var elts = this.root.all ? this.root.all : this.root.getElementsByTagName('*');
......
...@@ -32,7 +32,7 @@ var canTranslateIt = function( e ) { ...@@ -32,7 +32,7 @@ var canTranslateIt = function( e ) {
} else { } else {
return true; return true;
} }
} };
var interTransDeepestElement = -1; var interTransDeepestElement = -1;
......
...@@ -11,6 +11,7 @@ function foo() { ...@@ -11,6 +11,7 @@ function foo() {
} }
function msg(msg) { function msg(msg) {
var req;
try { try {
// for Mozilla // for Mozilla
req = new XMLHttpRequest(); req = new XMLHttpRequest();
...@@ -27,6 +28,7 @@ function msg(msg) { ...@@ -27,6 +28,7 @@ function msg(msg) {
} }
function msgxml(msg) { function msgxml(msg) {
var req;
try { try {
// for Mozilla // for Mozilla
req = new XMLHttpRequest(); req = new XMLHttpRequest();
...@@ -62,6 +64,7 @@ function pollForEvents() { ...@@ -62,6 +64,7 @@ function pollForEvents() {
+ document.getElementById('reqId').value + '&senderId=' + document.getElementById('senderId').value); + document.getElementById('reqId').value + '&senderId=' + document.getElementById('senderId').value);
/* alert(ret); /* alert(ret);
alert(last_event); */ alert(last_event); */
var last_event;
if (ret > last_event) { if (ret > last_event) {
while (last_event < ret) { while (last_event < ret) {
last_event = last_event + 1; last_event = last_event + 1;
...@@ -114,7 +117,7 @@ function client_close() { ...@@ -114,7 +117,7 @@ function client_close() {
/*** Operator console functions ***/ /*** Operator console functions ***/
function pollForRequests() { function pollForRequests() {
var last = msg('tiki-live_support_server.php?poll_requests=1'); var last = msg('tiki-live_support_server.php?poll_requests=1'), last_req;
if (last > last_req) { if (last > last_req) {
window.location.reload(); window.location.reload();
......
...@@ -95,8 +95,8 @@ rangy.createModule("Phraser", function(api, module) { ...@@ -95,8 +95,8 @@ rangy.createModule("Phraser", function(api, module) {
} }
return (rootNode = $(rootNode)); return (rootNode = $(rootNode));
} }
var dom = api.dom; var dom = api.dom, Phraser;
api = $.extend(api, { api = $.extend(api, {
words: {}, words: {},
chs: {}, chs: {},
...@@ -119,14 +119,15 @@ rangy.createModule("Phraser", function(api, module) { ...@@ -119,14 +119,15 @@ rangy.createModule("Phraser", function(api, module) {
boundaries = parentConcat.split(phraseConcat), boundaries = parentConcat.split(phraseConcat),
indexes = []; indexes = [];
var boundaryLength;
for (var i = 0; i < boundaries.length; i++) { for (var i = 0; i < boundaries.length; i++) {
boundaryLength = boundaries[i].split('|').length - 1; boundaryLength = boundaries[i].split('|').length - 1;
indexes.push({ indexes.push({
start: Math.min(parentWords.length - phraseWords.length, boundaryLength), start: Math.min(parentWords.length - phraseWords.length, boundaryLength),
end: Math.min(parentWords.length, boundaryLength + phraseLength) end: Math.min(parentWords.length, boundaryLength + phraseLength)
}); });
i++; i++;
} }
...@@ -241,8 +242,8 @@ rangy.createModule("Phraser", function(api, module) { ...@@ -241,8 +242,8 @@ rangy.createModule("Phraser", function(api, module) {
sanitized = sanitized.replace(/\W/g, ' '); sanitized = sanitized.replace(/\W/g, ' ');
sanitized = sanitized.split(' '); sanitized = sanitized.split(' ');
var sanitizedFiltered = []; var sanitizedFiltered = [], i;
for(i in sanitized) { for(i in sanitized) {
if (sanitized[i]) if (sanitized[i])
sanitizedFiltered.push(sanitized[i]); sanitizedFiltered.push(sanitized[i]);
......
...@@ -111,7 +111,7 @@ var ttlResizeTimerID = null; ...@@ -111,7 +111,7 @@ var ttlResizeTimerID = null;
$(window).resize( function () { $(window).resize( function () {
if (ttlTimeline && ttlResizeTimerID == null) { if (ttlTimeline && ttlResizeTimerID == null) {
ttlResizeTimerID = window.setTimeout(function() { ttlResizeTimerID = window.setTimeout(function() {
resizeTimerID = null; ttlResizeTimerID = null;
ttlTimeline.layout(); ttlTimeline.layout();
}, 500); }, 500);
} }
......
...@@ -197,7 +197,7 @@ $.fn.loadDraw = function(o) { ...@@ -197,7 +197,7 @@ $.fn.loadDraw = function(o) {
}, function(data) { }, function(data) {
if (data.removeButtons) { if (data.removeButtons) {
if (!$.isArray(data.removeButtons)) data.removeButtons = data.removeButtons.split(','); if (!$.isArray(data.removeButtons)) data.removeButtons = data.removeButtons.split(',');
for(id in data.removeButtons) { for(var id in data.removeButtons) {
me.data('doc').find('#' + $.trim(data.removeButtons[id])).wrap('<div style="display:none;"/>'); me.data('doc').find('#' + $.trim(data.removeButtons[id])).wrap('<div style="display:none;"/>');
} }
} }
......
...@@ -76,7 +76,7 @@ $(document).ready(function () { ...@@ -76,7 +76,7 @@ $(document).ready(function () {
sortList(this); sortList(this);
} }
}); });
sortList = function (list) { var sortList = function (list) {
var arr = $(list).children().get(), item, labelA, labelB; var arr = $(list).children().get(), item, labelA, labelB;
arr.sort(function(a, b) { arr.sort(function(a, b) {
labelA = $(a).text().toUpperCase(); labelA = $(a).text().toUpperCase();
...@@ -96,8 +96,8 @@ $(document).ready(function () { ...@@ -96,8 +96,8 @@ $(document).ready(function () {
$('.qt-custom').dblclick(function () { showToolEditForm(this); }); $('.qt-custom').dblclick(function () { showToolEditForm(this); });
// show edit form dialogue // show edit form dialogue
showToolEditForm = function(item) { var showToolEditForm = function (item) {
if (item) { if (item) {
$('#toolbar_edit_div #tool_name').val($(item).text()); //.attr('disabled','disabled'); $('#toolbar_edit_div #tool_name').val($(item).text()); //.attr('disabled','disabled');
$('#toolbar_edit_div #tool_label').val($(item).children('img').attr('title')); $('#toolbar_edit_div #tool_label').val($(item).children('img').attr('title'));
...@@ -160,8 +160,8 @@ $(document).ready(function () { ...@@ -160,8 +160,8 @@ $(document).ready(function () {
$(this).find('input[type=text]').val('').removeClass('ui-state-error'); $(this).find('input[type=text]').val('').removeClass('ui-state-error');
} }
}); });
checkLength = function (o, n, min, max) { var checkLength = function (o, n, min, max) {
if (o.val().length > max || o.val().length < min) { if (o.val().length > max || o.val().length < min) {
o.addClass('ui-state-error'); o.addClass('ui-state-error');
o.prev("label").find(".dialog_tips").text(" Length must be between " + min + " and " + max).addClass('ui-state-highlight'); o.prev("label").find(".dialog_tips").text(" Length must be between " + min + " and " + max).addClass('ui-state-highlight');
...@@ -175,7 +175,7 @@ $(document).ready(function () { ...@@ -175,7 +175,7 @@ $(document).ready(function () {
}; };
// save toolbars // save toolbars
saveRows = function () { var saveRows = function () {
var ser, text; var ser, text;
ser = $('.toolbars-admin .row').map(function (){ /* do this on everything of class 'row' inside toolbars-admin div */ ser = $('.toolbars-admin .row').map(function (){ /* do this on everything of class 'row' inside toolbars-admin div */
var right_section = false; var right_section = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment