loleaflet/src/control/Control.ColumnHeader.js | 116 ++++++++++++-------------- loleaflet/src/control/Control.Fonts.js | 2 loleaflet/src/control/Control.Formulabar.js | 4 loleaflet/src/control/Control.InsertImg.js | 6 - loleaflet/src/control/Control.RowHeader.js | 108 +++++++++++------------- loleaflet/src/control/Control.Scroll.js | 4 loleaflet/src/control/Control.Styles.js | 12 +- loleaflet/src/control/Toolbar.js | 2 loleaflet/src/core/Socket.js | 2 loleaflet/src/dom/DomEvent.MultiClick.js | 4 loleaflet/src/dom/DomEvent.js | 2 loleaflet/src/layer/tile/CalcTileLayer.js | 68 +++++++-------- loleaflet/src/layer/tile/TileLayer.js | 51 +++++------ loleaflet/src/map/handler/Map.FileInserter.js | 1 loleaflet/src/map/handler/Map.Keyboard.js | 5 - loleaflet/src/map/handler/Map.Mouse.js | 4 loleaflet/src/map/handler/Map.Print.js | 2 loleaflet/src/map/handler/Map.SlideShow.js | 14 +-- 18 files changed, 202 insertions(+), 205 deletions(-)
New commits: commit d8b91fbc293b61a35e9cdef4e260a47dc0dd20fa Author: Mihai Varga <mihai.va...@collabora.com> Date: Fri Nov 13 11:27:54 2015 +0200 loleaflet: fixed js lint errors in src/control/* diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js index b2f9af4..b38fee1 100644 --- a/loleaflet/src/control/Control.ColumnHeader.js +++ b/loleaflet/src/control/Control.ColumnHeader.js @@ -3,75 +3,73 @@ */ L.Control.ColumnHeader = L.Control.extend({ - onAdd: function (map) { - var docContainer = L.DomUtil.get('document-container'); - var divHeader = L.DomUtil.create('div', 'spreadsheet-container-column', docContainer.parentElement); - var tableContainer = L.DomUtil.create('table', 'spreadsheet-container-table', divHeader); - var tbodyContainer = L.DomUtil.create('tbody', '', tableContainer); - var trContainer = L.DomUtil.create('tr', '', tbodyContainer); - L.DomUtil.create('th', 'spreadsheet-container-th-corner', trContainer); - var thColumns = L.DomUtil.create('th', 'spreadsheet-container-th-column', trContainer); - var divInner = L.DomUtil.create('div', 'spreadsheet-container-column-inner', thColumns); - this._table = L.DomUtil.create('table', '', divInner); - this._table.id = 'spreadsheet-table-column'; - L.DomUtil.create('tbody', '', this._table); - this._columns = L.DomUtil.create('tr','', this._table.firstChild); + onAdd: function () { + var docContainer = L.DomUtil.get('document-container'); + var divHeader = L.DomUtil.create('div', 'spreadsheet-container-column', docContainer.parentElement); + var tableContainer = L.DomUtil.create('table', 'spreadsheet-container-table', divHeader); + var tbodyContainer = L.DomUtil.create('tbody', '', tableContainer); + var trContainer = L.DomUtil.create('tr', '', tbodyContainer); + L.DomUtil.create('th', 'spreadsheet-container-th-corner', trContainer); + var thColumns = L.DomUtil.create('th', 'spreadsheet-container-th-column', trContainer); + var divInner = L.DomUtil.create('div', 'spreadsheet-container-column-inner', thColumns); + this._table = L.DomUtil.create('table', '', divInner); + this._table.id = 'spreadsheet-table-column'; + L.DomUtil.create('tbody', '', this._table); + this._columns = L.DomUtil.create('tr', '', this._table.firstChild); - this._position = 0; + this._position = 0; - // dummy initial header - L.DomUtil.create('th','spreadsheet-table-column-cell', this._columns); + // dummy initial header + L.DomUtil.create('th', 'spreadsheet-table-column-cell', this._columns); - return document.createElement('div'); - }, + return document.createElement('div'); + }, - clearColumns : function () { - L.DomUtil.remove(this._columns); - this._columns = L.DomUtil.create('tr', '', this._table.firstChild); - }, + clearColumns : function () { + L.DomUtil.remove(this._columns); + this._columns = L.DomUtil.create('tr', '', this._table.firstChild); + }, - setScrollPosition: function (position) { - this._position = position; - L.DomUtil.setStyle(this._table, 'left', this._position + 'px'); - }, + setScrollPosition: function (position) { + this._position = position; + L.DomUtil.setStyle(this._table, 'left', this._position + 'px'); + }, - offsetScrollPosition: function (offset) { - this._position = this._position - offset; - L.DomUtil.setStyle(this._table, 'left', this._position + 'px'); - }, + offsetScrollPosition: function (offset) { + this._position = this._position - offset; + L.DomUtil.setStyle(this._table, 'left', this._position + 'px'); + }, - fillColumns: function (columns, converter, context) { - var twip, width, column; + fillColumns: function (columns, converter, context) { + var twip, width, column; - this.clearColumns(); - var totalWidth = -1; // beginning offset 1 due to lack of previous column - for (iterator = 0; iterator < columns.length; iterator++) { - twip = new L.Point(parseInt(columns[iterator].size), - parseInt(columns[iterator].size)); - width = Math.round(converter.call(context, twip).x) - 2 - totalWidth; - column = L.DomUtil.create('th', 'spreadsheet-table-column-cell', this._columns); - column.innerHTML = columns[iterator].text; - column.twipWidth = columns[iterator].size; - column.width = width + "px"; - totalWidth += width + 1; - } - }, + this.clearColumns(); + var totalWidth = -1; // beginning offset 1 due to lack of previous column + for (var iterator = 0; iterator < columns.length; iterator++) { + twip = new L.Point(parseInt(columns[iterator].size), parseInt(columns[iterator].size)); + width = Math.round(converter.call(context, twip).x) - 2 - totalWidth; + column = L.DomUtil.create('th', 'spreadsheet-table-column-cell', this._columns); + column.innerHTML = columns[iterator].text; + column.twipWidth = columns[iterator].size; + column.width = width + 'px'; + totalWidth += width + 1; + } + }, - updateColumns: function (converter, context) { - var iterator, twip, width, column; - var totalWidth = -1; - for (iterator = 0; iterator < this._columns.childNodes.length; iterator++) { - column = this._columns.childNodes[iterator]; - twip = new L.Point(parseInt(column.twipWidth), - parseInt(column.twipWidth)); - width = Math.round(converter.call(context, twip).x) - 2 - totalWidth; - column.width = width + "px"; - totalWidth += width + 1; - } - } -}) + updateColumns: function (converter, context) { + var iterator, twip, width, column; + var totalWidth = -1; + for (iterator = 0; iterator < this._columns.childNodes.length; iterator++) { + column = this._columns.childNodes[iterator]; + twip = new L.Point(parseInt(column.twipWidth), parseInt(column.twipWidth)); + width = Math.round(converter.call(context, twip).x) - 2 - totalWidth; + column.width = width + 'px'; + totalWidth += width + 1; + } + } +}); L.control.columnHeader = function (options) { - return new L.Control.ColumnHeader(options); + return new L.Control.ColumnHeader(options); }; diff --git a/loleaflet/src/control/Control.Fonts.js b/loleaflet/src/control/Control.Fonts.js index 96c0104..755c4b0 100644 --- a/loleaflet/src/control/Control.Fonts.js +++ b/loleaflet/src/control/Control.Fonts.js @@ -95,7 +95,7 @@ L.Control.Fonts = L.Control.extend({ }, _setFontSize: function (fontSize) { - for (i = 0; i < this._sizeSelect.length; i++) { + for (var i = 0; i < this._sizeSelect.length; i++) { var value = this._sizeSelect[i].value; if (value === fontSize) { this._sizeSelect.value = fontSize; diff --git a/loleaflet/src/control/Control.Formulabar.js b/loleaflet/src/control/Control.Formulabar.js index 35b68b6..0a6c352 100644 --- a/loleaflet/src/control/Control.Formulabar.js +++ b/loleaflet/src/control/Control.Formulabar.js @@ -4,9 +4,9 @@ L.Control.FormulaBar = L.Control.extend({ onAdd: function (map) { - this._formulaBar = L.DomUtil.create('input', 'leaflet-control-formulabar leaflet-bar'); + this._formulaBar = L.DomUtil.create('input', 'leaflet-control-formulabar leaflet-bar'); this._formulaBar.type = 'text'; - L.DomEvent['on'](this._formulaBar, 'keyup', this._onInput, this); + L.DomEvent.on(this._formulaBar, 'keyup', this._onInput, this); map.on('cellformula', this._onFormulaChange, this); return this._formulaBar; }, diff --git a/loleaflet/src/control/Control.InsertImg.js b/loleaflet/src/control/Control.InsertImg.js index f542eb0..07c26ee 100644 --- a/loleaflet/src/control/Control.InsertImg.js +++ b/loleaflet/src/control/Control.InsertImg.js @@ -3,10 +3,10 @@ */ L.Control.InsertImg = L.Control.extend({ - onAdd: function (map) { - this._insertImg = L.DomUtil.create('input', 'leaflet-control-insertimage leaflet-bar'); + onAdd: function () { + this._insertImg = L.DomUtil.create('input', 'leaflet-control-insertimage leaflet-bar'); this._insertImg.type = 'file'; - L.DomEvent['on'](this._insertImg, 'change', this._onChange, this); + L.DomEvent.on(this._insertImg, 'change', this._onChange, this); return this._insertImg; }, diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js index de28ec2..45bfb17 100644 --- a/loleaflet/src/control/Control.RowHeader.js +++ b/loleaflet/src/control/Control.RowHeader.js @@ -3,71 +3,69 @@ */ L.Control.RowHeader = L.Control.extend({ - onAdd: function (map) { - var docContainer = L.DomUtil.get('document-container'); - var divRowHeader = L.DomUtil.create('div', 'spreadsheet-container-row', docContainer.parentElement); - var divRowInner = L.DomUtil.create('div', 'spreadsheet-container-row-inner', divRowHeader); - this._table = L.DomUtil.create('table', '', divRowInner); - this._table.id = 'spreadsheet-table-row'; - this._rows = L.DomUtil.create('tbody', '', this._table); + onAdd: function () { + var docContainer = L.DomUtil.get('document-container'); + var divRowHeader = L.DomUtil.create('div', 'spreadsheet-container-row', docContainer.parentElement); + var divRowInner = L.DomUtil.create('div', 'spreadsheet-container-row-inner', divRowHeader); + this._table = L.DomUtil.create('table', '', divRowInner); + this._table.id = 'spreadsheet-table-row'; + this._rows = L.DomUtil.create('tbody', '', this._table); - this._position = 0; + this._position = 0; - // dummy initial row header - var row = L.DomUtil.create('tr', '', this._rows); - L.DomUtil.create('th','spreadsheet-table-row-cell', row); + // dummy initial row header + var row = L.DomUtil.create('tr', '', this._rows); + L.DomUtil.create('th', 'spreadsheet-table-row-cell', row); - return document.createElement('div'); - }, + return document.createElement('div'); + }, - clearRows: function () { - L.DomUtil.remove(this._rows); - this._rows = L.DomUtil.create('tbody', '', this._table); - }, + clearRows: function () { + L.DomUtil.remove(this._rows); + this._rows = L.DomUtil.create('tbody', '', this._table); + }, - setScrollPosition: function (position) { - this._position = position; - L.DomUtil.setStyle(this._table, 'top', this._position + 'px'); - }, + setScrollPosition: function (position) { + this._position = position; + L.DomUtil.setStyle(this._table, 'top', this._position + 'px'); + }, - offsetScrollPosition: function (offset) { - this._position = this._position - offset; - L.DomUtil.setStyle(this._table, 'top', this._position + 'px'); - }, + offsetScrollPosition: function (offset) { + this._position = this._position - offset; + L.DomUtil.setStyle(this._table, 'top', this._position + 'px'); + }, - fillRows: function (rows, converter, context) { - var iterator, twip, height, row, cell; + fillRows: function (rows, converter, context) { + var iterator, twip, height, row, cell; - this.clearRows(); - var totalHeight = -1; - for (iterator = 0; iterator < rows.length; iterator++) { - twip = new L.Point(parseInt(rows[iterator].size), - parseInt(rows[iterator].size)); - height = Math.round(converter.call(context, twip).y) - 2 - totalHeight; - row = L.DomUtil.create('tr', '', this._rows); - cell = L.DomUtil.create('th', 'spreadsheet-table-row-cell', row); - cell.innerHTML = rows[iterator].text; - cell.twipHeight = rows[iterator].size; - cell.height = height + "px"; - totalHeight += height + 1; - } - }, + this.clearRows(); + var totalHeight = -1; + for (iterator = 0; iterator < rows.length; iterator++) { + twip = new L.Point(parseInt(rows[iterator].size), parseInt(rows[iterator].size)); + height = Math.round(converter.call(context, twip).y) - 2 - totalHeight; + row = L.DomUtil.create('tr', '', this._rows); + cell = L.DomUtil.create('th', 'spreadsheet-table-row-cell', row); + cell.innerHTML = rows[iterator].text; + cell.twipHeight = rows[iterator].size; + cell.height = height + 'px'; + totalHeight += height + 1; + } + }, - updateRows: function (converter, context) { - var iterator, twip, height, row; + updateRows: function (converter, context) { + var iterator, twip, height, row; - var totalHeight = -1; - for (iterator = 0; iterator < this._rows.childNodes.length; iterator++) { - row = this._rows.childNodes[iterator].firstChild; - twip = new L.Point(parseInt(row.twipHeight), - parseInt(row.twipHeight)); - height = Math.round(converter.call(context, twip).y) - 2 - totalHeight; - row.height = height + "px"; - totalHeight += height + 1; - } - } -}) + var totalHeight = -1; + for (iterator = 0; iterator < this._rows.childNodes.length; iterator++) { + row = this._rows.childNodes[iterator].firstChild; + twip = new L.Point(parseInt(row.twipHeight), parseInt(row.twipHeight)); + height = Math.round(converter.call(context, twip).y) - 2 - totalHeight; + row.height = height + 'px'; + totalHeight += height + 1; + } + } +}); L.control.rowHeader = function (options) { - return new L.Control.RowHeader(options); + return new L.Control.RowHeader(options); }; diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js index 95dd2c0..e3f72c7 100644 --- a/loleaflet/src/control/Control.Scroll.js +++ b/loleaflet/src/control/Control.Scroll.js @@ -52,7 +52,7 @@ L.Control.Scroll = L.Control.extend({ this._prevScrollY = -e.mcs.top; this._prevScrollX = -e.mcs.left; this._map.scroll(offset.x, offset.y); - this._map.fire('scrolloffset', offset); + this._map.fire('scrolloffset', offset); } }, @@ -81,7 +81,7 @@ L.Control.Scroll = L.Control.extend({ }, _onScrollVelocity: function (e) { - if (e.vx == 0 && e.vy == 0) { + if (e.vx === 0 && e.vy === 0) { clearInterval(this._autoScrollTimer); this._autoScrollTimer = null; this._map.isAutoScrolling = false; diff --git a/loleaflet/src/control/Control.Styles.js b/loleaflet/src/control/Control.Styles.js index d98a534..f933206 100644 --- a/loleaflet/src/control/Control.Styles.js +++ b/loleaflet/src/control/Control.Styles.js @@ -42,18 +42,18 @@ L.Control.Styles = L.Control.extend({ // The list contains a total of 100+ styles, the first 7 are // the default styles (as shown on desktop writer), we then // also show a selection of 12 more styles. - styles = e.commandValues['ParagraphStyles'].slice(7, 19); - topStyles = e.commandValues['ParagraphStyles'].slice(0, 7); + styles = e.commandValues.ParagraphStyles.slice(7, 19); + topStyles = e.commandValues.ParagraphStyles.slice(0, 7); } else if (this._map.getDocType() === 'presentation' || this._map.getDocType() === 'drawing') { - styles = e.commandValues['Default']; + styles = e.commandValues.Default; } - else if (this._map.getDocType() === 'spreadsheet' ) { - styles = e.commandValues['CellStyles']; + else if (this._map.getDocType() === 'spreadsheet') { + styles = e.commandValues.CellStyles; } - var commands = e.commandValues['Commands']; + var commands = e.commandValues.Commands; if (commands && commands.length > 0) { this._addSeparator(); commands.forEach(function (command) { diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js index 70609f2..1644947 100644 --- a/loleaflet/src/control/Toolbar.js +++ b/loleaflet/src/control/Toolbar.js @@ -88,7 +88,7 @@ L.Map.include({ if (!unoState.startsWith('.uno:')) { unoState = '.uno:' + unoState; } - sendUnoCommand(unoState); + this.sendUnoCommand(unoState); } }, commit f19be527f5e1622a4f9706e5dc45c706b13a1e0c Author: Mihai Varga <mihai.va...@collabora.com> Date: Fri Nov 13 11:04:17 2015 +0200 loleaflet: fixed js lint erros in core/* diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index bb63f5f..02b0d72 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -48,7 +48,7 @@ L.Socket = { if (this._map._docLayer) { // we are reconnecting after a lost connection msg += ' part=' + this._map.getCurrentPartNumber(); - map.fire('statusindicator', {statusType : 'reconnected'}); + this._map.fire('statusindicator', {statusType : 'reconnected'}); } if (this._map.options.timestamp) { msg += ' timestamp=' + this._map.options.timestamp; diff --git a/loleaflet/src/dom/DomEvent.MultiClick.js b/loleaflet/src/dom/DomEvent.MultiClick.js index a9c4e47..0f5d935 100644 --- a/loleaflet/src/dom/DomEvent.MultiClick.js +++ b/loleaflet/src/dom/DomEvent.MultiClick.js @@ -5,7 +5,7 @@ L.extend(L.DomEvent, { - addMultiClickListener: function (obj, handler, id, type) { + addMultiClickListener: function (obj, handler, id) { var last = [], delay = 250; @@ -58,7 +58,7 @@ L.extend(L.DomEvent, { return this; }, - removeMultiClickListener: function (obj, id, type) { + removeMultiClickListener: function (obj, id) { obj.removeEventListener('click', obj['_leaflet_click' + id], false); return this; diff --git a/loleaflet/src/dom/DomEvent.js b/loleaflet/src/dom/DomEvent.js index 7de458b..a83a5ac 100644 --- a/loleaflet/src/dom/DomEvent.js +++ b/loleaflet/src/dom/DomEvent.js @@ -58,7 +58,7 @@ L.DomEvent = { } else if (L.Browser.touch && (type === 'dblclick') && this.addDoubleTapListener) { this.addDoubleTapListener(obj, handler, id); - } else if (type === "trplclick" || type === "qdrplclick") { + } else if (type === 'trplclick' || type === 'qdrplclick') { this.addMultiClickListener(obj, handler, id, type); } else if ('addEventListener' in obj) { commit 1c6299357db4a59048bcf1274e67ae2531547062 Author: Mihai Varga <mihai.va...@collabora.com> Date: Fri Nov 13 11:01:34 2015 +0200 loleaflet: fixed js lint erros in layer/tile/CalcTileLayer.js diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js index c81eaed..8b0396c 100644 --- a/loleaflet/src/layer/tile/CalcTileLayer.js +++ b/loleaflet/src/layer/tile/CalcTileLayer.js @@ -4,17 +4,17 @@ L.CalcTileLayer = L.TileLayer.extend({ - beforeAdd: function (map) { - map._addZoomLimit(this); - this._columns = L.control.columnHeader(); - this._rows = L.control.rowHeader(); - map.addControl(this._columns); - map.addControl(this._rows); - map.addControl(L.control.tabs()); - map.on('scrolloffset', this._onScrollOffset, this); - map.on('updatescrolloffset', this._onUpdateScrollOffset, this); - map.on('zoomend', this._onZoomRowColumns, this); - }, + beforeAdd: function (map) { + map._addZoomLimit(this); + this._columns = L.control.columnHeader(); + this._rows = L.control.rowHeader(); + map.addControl(this._columns); + map.addControl(this._rows); + map.addControl(L.control.tabs()); + map.on('scrolloffset', this._onScrollOffset, this); + map.on('updatescrolloffset', this._onUpdateScrollOffset, this); + map.on('zoomend', this._onZoomRowColumns, this); + }, _onInvalidateTilesMsg: function (textMsg) { var command = L.Socket.parseServerCmd(textMsg); @@ -112,20 +112,20 @@ L.CalcTileLayer = L.TileLayer.extend({ } }, - _onScrollOffset: function(offset) { - this._columns.offsetScrollPosition(offset.x); - this._rows.offsetScrollPosition(offset.y); - }, + _onScrollOffset: function(offset) { + this._columns.offsetScrollPosition(offset.x); + this._rows.offsetScrollPosition(offset.y); + }, - _onUpdateScrollOffset: function (e) { - this._columns.setScrollPosition(-e.x); - this._rows.setScrollPosition(-e.y); - }, + _onUpdateScrollOffset: function (e) { + this._columns.setScrollPosition(-e.x); + this._rows.setScrollPosition(-e.y); + }, - _onZoomRowColumns: function () { - this._columns.updateColumns(this._twipsToPixels, this); - this._rows.updateRows(this._twipsToPixels, this); - }, + _onZoomRowColumns: function () { + this._columns.updateColumns(this._twipsToPixels, this); + this._rows.updateRows(this._twipsToPixels, this); + }, _onStatusMsg: function (textMsg) { var command = L.Socket.parseServerCmd(textMsg); @@ -155,17 +155,17 @@ L.CalcTileLayer = L.TileLayer.extend({ } } - L.Socket.sendMessage('commandvalues command=.uno:ViewRowColumnHeaders'); + L.Socket.sendMessage('commandvalues command=.uno:ViewRowColumnHeaders'); }, - _onCommandValuesMsg: function (textMsg) { - if (textMsg.match('.uno:ViewRowColumnHeaders')) { - var data = JSON.parse(textMsg.substring(textMsg.indexOf('{'))); - this._columns.fillColumns(data.columns, this._twipsToPixels, this); - this._rows.fillRows(data.rows, this._twipsToPixels, this); - } - else { - L.TileLayer.prototype._onCommandValuesMsg.call(this, textMsg); - } - } + _onCommandValuesMsg: function (textMsg) { + if (textMsg.match('.uno:ViewRowColumnHeaders')) { + var data = JSON.parse(textMsg.substring(textMsg.indexOf('{'))); + this._columns.fillColumns(data.columns, this._twipsToPixels, this); + this._rows.fillRows(data.rows, this._twipsToPixels, this); + } + else { + L.TileLayer.prototype._onCommandValuesMsg.call(this, textMsg); + } + } }); commit 11aecae64533bbff29874602a3bb4b973c43e0df Author: Mihai Varga <mihai.va...@collabora.com> Date: Fri Nov 13 10:59:16 2015 +0200 loleaflet: fixed js lint errors in layer/tile/TileLayer.js diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 316d1c4..5b8a791 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -65,11 +65,11 @@ L.TileLayer = L.GridLayer.extend({ // Cursor is visible or hidden (e.g. for graphic selection). this._isCursorVisible = true; // Original rectangle graphic selection in twips - this._graphicSelectionTwips = new L.bounds(new L.point(0, 0), new L.point(0, 0)); + this._graphicSelectionTwips = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0)); // Rectangle graphic selection this._graphicSelection = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0)); // Original rectangle of cell cursor in twips - this._cellCursorTwips = new L.bounds(new L.point(0, 0), new L.point(0, 0)); + this._cellCursorTwips = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0)); // Rectangle for cell cursor this._cellCursor = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0)); // Position and size of the selection start (as if there would be a cursor caret there). @@ -132,12 +132,12 @@ L.TileLayer = L.GridLayer.extend({ // updated cell cursor when the selected cell is changed and not the initial // cell). map.on('statusindicator', - function (e) { - if (e.statusType === 'alltilesloaded' && this._docType === 'spreadsheet') { - this._onCellCursorShift(true); - } - }, - this); + function (e) { + if (e.statusType === 'alltilesloaded' && this._docType === 'spreadsheet') { + this._onCellCursorShift(true); + } + }, + this); for (var key in this._selectionHandles) { this._selectionHandles[key].on('drag dragend', this._onSelectionHandleDrag, this); } @@ -297,7 +297,7 @@ L.TileLayer = L.GridLayer.extend({ _onCommandValuesMsg: function (textMsg) { var obj = JSON.parse(textMsg.substring(textMsg.indexOf('{'))); - if (obj.commandName === ".uno:CellCursor") { + if (obj.commandName === '.uno:CellCursor') { this._onCellCursorMsg(obj.commandValues); } else if (this._map.unoToolbarCommands.indexOf(obj.commandName) !== -1) { this._toolbarCommandValues[obj.commandName] = obj.commandValues; @@ -358,7 +358,7 @@ L.TileLayer = L.GridLayer.extend({ _onGraphicSelectionMsg: function (textMsg) { if (textMsg.match('EMPTY')) { - this._graphicSelectionTwips = new L.bounds(new L.point(0, 0), new L.point(0, 0)); + this._graphicSelectionTwips = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0)); this._graphicSelection = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0)); } else { @@ -366,7 +366,7 @@ L.TileLayer = L.GridLayer.extend({ var topLeftTwips = new L.Point(parseInt(strTwips[0]), parseInt(strTwips[1])); var offset = new L.Point(parseInt(strTwips[2]), parseInt(strTwips[3])); var bottomRightTwips = topLeftTwips.add(offset); - this._graphicSelectionTwips = new L.bounds(topLeftTwips, bottomRightTwips); + this._graphicSelectionTwips = new L.Bounds(topLeftTwips, bottomRightTwips); this._graphicSelection = new L.LatLngBounds( this._twipsToLatLng(topLeftTwips, this._map.getZoom()), this._twipsToLatLng(bottomRightTwips, this._map.getZoom())); @@ -377,7 +377,7 @@ L.TileLayer = L.GridLayer.extend({ _onCellCursorMsg: function (textMsg) { if (textMsg.match('EMPTY')) { - this._cellCursorTwips = new L.bounds(new L.point(0, 0), new L.point(0, 0)); + this._cellCursorTwips = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0)); this._cellCursor = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0)); } else { @@ -385,7 +385,7 @@ L.TileLayer = L.GridLayer.extend({ var topLeftTwips = new L.Point(parseInt(strTwips[0]), parseInt(strTwips[1])); var offset = new L.Point(parseInt(strTwips[2]), parseInt(strTwips[3])); var bottomRightTwips = topLeftTwips.add(offset); - this._cellCursorTwips = new L.bounds(topLeftTwips, bottomRightTwips); + this._cellCursorTwips = new L.Bounds(topLeftTwips, bottomRightTwips); this._cellCursor = new L.LatLngBounds( this._twipsToLatLng(topLeftTwips, this._map.getZoom()), this._twipsToLatLng(bottomRightTwips, this._map.getZoom())); @@ -481,11 +481,12 @@ L.TileLayer = L.GridLayer.extend({ textMsg = textMsg.substring(18); var obj = JSON.parse(textMsg); var commandName = obj.commandName; - var success = undefined; - if (obj.success === 'true') - success = true; - else if (obj.success === 'false') + if (obj.success === 'true') { + var success = true; + } + else if (obj.success === 'false') { success = false; + } // TODO when implemented in the LOK, add also obj.result this._map.fire('commandresult', {commandName: commandName, success: success}); }, @@ -766,11 +767,11 @@ L.TileLayer = L.GridLayer.extend({ e.target.dragging._draggable._updatePosition(); } - var containerPos = new L.point(expectedPos.x - this._map._container.getBoundingClientRect().left, + var containerPos = new L.Point(expectedPos.x - this._map._container.getBoundingClientRect().left, expectedPos.y - this._map._container.getBoundingClientRect().top); containerPos = containerPos.add(e.target.dragging._draggable.startOffset); - this._map.fire('handleautoscroll', { pos: containerPos, map: this._map }); + this._map.fire('handleautoscroll', {pos: containerPos, map: this._map}); } if (e.type === 'dragend') { e.target.isDragged = false; @@ -816,7 +817,7 @@ L.TileLayer = L.GridLayer.extend({ if (this._cellCursorMarker) { this._map.removeLayer(this._cellCursorMarker); } - this._cellCursorMarker = L.rectangle(this._cellCursor, {fill: false, color: "#000000", weight: 2}); + this._cellCursorMarker = L.rectangle(this._cellCursor, {fill: false, color: '#000000', weight: 2}); if (!this._cellCursorMarker) { this._map.fire('error', {msg: 'Cell Cursor marker initialization'}); return; @@ -878,7 +879,7 @@ L.TileLayer = L.GridLayer.extend({ } if (!endMarker.isDragged) { - var pos = this._map.project(this._textSelectionEnd.getSouthEast()); + pos = this._map.project(this._textSelectionEnd.getSouthEast()); pos = pos.subtract(new L.Point(0, 2)); pos = this._map.unproject(pos); endMarker.setLatLng(pos); @@ -903,7 +904,7 @@ L.TileLayer = L.GridLayer.extend({ } else { // Decode UTF-8. - e.clipboardData.setData('text/plain', decodeURIComponent(escape(this._selectionTextContent))); + e.clipboardData.setData('text/plain', decodeURIComponent(window.escape(this._selectionTextContent))); } }, @@ -931,8 +932,8 @@ L.TileLayer = L.GridLayer.extend({ } else if (e.newSize.x / this._docPixelSize.x > crsScale) { // we could zoom in - var ratio = e.newSize.x / this._docPixelSize.x; - var zoomDelta = Math.ceil(Math.log(ratio) / Math.log(crsScale)); + ratio = e.newSize.x / this._docPixelSize.x; + zoomDelta = Math.ceil(Math.log(ratio) / Math.log(crsScale)); this._map.setZoom(Math.min(10, this._map.getZoom() + zoomDelta), {animate: false}); } } @@ -982,7 +983,7 @@ L.TileLayer = L.GridLayer.extend({ + '?outputHeight=' + this._tileSize + '&outputWidth=' + this._tileSize + '&tileHeight=' + this._tileWidthTwips - + '&tileWidth=' + this._tileHeightTwips ); + + '&tileWidth=' + this._tileHeightTwips); } }, commit 81e773ac2a8ec3d5cdd62e794d7ad4ef1fa46de5 Author: Mihai Varga <mihai.va...@collabora.com> Date: Fri Nov 13 10:38:28 2015 +0200 loleaflet: fixed js lint erros in src/map/handler/* diff --git a/loleaflet/src/map/handler/Map.FileInserter.js b/loleaflet/src/map/handler/Map.FileInserter.js index ed47465..4748186 100644 --- a/loleaflet/src/map/handler/Map.FileInserter.js +++ b/loleaflet/src/map/handler/Map.FileInserter.js @@ -48,7 +48,6 @@ L.Map.FileInserter = L.Handler.extend({ _sendFile: function (name, file) { var url = this._url; - console.log(url); var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState === 4 && xmlHttp.status === 200) { diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js index 3d1f846..ec50e1b 100644 --- a/loleaflet/src/map/handler/Map.Keyboard.js +++ b/loleaflet/src/map/handler/Map.Keyboard.js @@ -229,8 +229,9 @@ L.Map.Keyboard = L.Handler.extend({ this.modifier = shift | ctrl | alt; if (ctrl) { - if (this._handleCtrlCommand(e)) + if (this._handleCtrlCommand(e)) { return; + } } // page up or page down, handled by this.dopagejump @@ -309,7 +310,7 @@ L.Map.Keyboard = L.Handler.extend({ if (e.type !== 'keydown' && e.originalEvent.key !== 'c' && e.originalEvent.key !== 'v') { e.originalEvent.preventDefault(); return true; - }; + } if (e.originalEvent.keyCode !== 67 && e.originalEvent.keyCode !== 86 && e.originalEvent.key !== 'c' && e.originalEvent.key !== 'v') { // not copy or paste diff --git a/loleaflet/src/map/handler/Map.Mouse.js b/loleaflet/src/map/handler/Map.Mouse.js index 82c8c83..2520c7c 100644 --- a/loleaflet/src/map/handler/Map.Mouse.js +++ b/loleaflet/src/map/handler/Map.Mouse.js @@ -154,14 +154,14 @@ L.Map.Mouse = L.Handler.extend({ } } - this._map.fire('handleautoscroll', { pos: e.containerPoint, map: this._map }); + this._map.fire('handleautoscroll', {pos: e.containerPoint, map: this._map}); } } else if (e.type === 'mousemove' && !this._mouseDown) { clearTimeout(this._mouseOverTimeout); mousePos = docLayer._latLngToTwips(e.latlng); this._mouseOverTimeout = setTimeout(L.bind(function() { - docLayer._postMouseEvent('move', mousePos.x, mousePos.y, 1, 0, modifier); + docLayer._postMouseEvent('move', mousePos.x, mousePos.y, 1, 0, modifier); }, this), 100); } diff --git a/loleaflet/src/map/handler/Map.Print.js b/loleaflet/src/map/handler/Map.Print.js index c181005..d121c7e 100644 --- a/loleaflet/src/map/handler/Map.Print.js +++ b/loleaflet/src/map/handler/Map.Print.js @@ -25,7 +25,7 @@ L.Map.Print = L.Handler.extend({ // object URL, because else we might have cross origin security problems var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = L.bind(function () { - if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + if (xmlHttp.readyState === 4 && xmlHttp.status === 200) { this._onInitPrint(xmlHttp); } }, this); diff --git a/loleaflet/src/map/handler/Map.SlideShow.js b/loleaflet/src/map/handler/Map.SlideShow.js index 3a644a5..287699f 100644 --- a/loleaflet/src/map/handler/Map.SlideShow.js +++ b/loleaflet/src/map/handler/Map.SlideShow.js @@ -22,29 +22,29 @@ L.Map.SlideShow = L.Handler.extend({ this._map.off('slidedownloadready', this._onSlideDownloadReady, this); }, - _onFullScreen: function (e) { + _onFullScreen: function () { this._slideShow = L.DomUtil.create('iframe', '', this._map._container); if (this._slideShow.requestFullscreen) { - this._slideShow.requestFullscreen(); + this._slideShow.requestFullscreen(); } else if (this._slideShow.msRequestFullscreen) { - this._slideShow.msRequestFullscreen(); + this._slideShow.msRequestFullscreen(); } else if (this._slideShow.mozRequestFullScreen) { - this._slideShow.mozRequestFullScreen(); + this._slideShow.mozRequestFullScreen(); } else if (this._slideShow.webkitRequestFullscreen) { - this._slideShow.webkitRequestFullscreen(); + this._slideShow.webkitRequestFullscreen(); } - L.DomEvent['on'](document, 'fullscreenchange webkitfullscreenchange mozfullscreenchange msfullscreenchange', + L.DomEvent.on(document, 'fullscreenchange webkitfullscreenchange mozfullscreenchange msfullscreenchange', this._onFullScreenChange, this); this.fullscreen = true; this._map.downloadAs('slideshow.svg', 'svg', null, 'slideshow'); }, - _onFullScreenChange: function (e) { + _onFullScreenChange: function () { this.fullscreen = document.fullscreen || document.webkitIsFullScreen || _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits