loleaflet/src/control/Control.ColumnHeader.js | 2 loleaflet/src/control/Control.ContextMenu.js | 89 ++++++++++++-------------- loleaflet/src/control/Control.Menubar.js | 45 ++++++------- loleaflet/src/control/Control.PartsPreview.js | 5 - loleaflet/src/control/Control.RowHeader.js | 2 loleaflet/src/control/Control.Tabs.js | 5 - loleaflet/src/layer/tile/TileLayer.js | 13 ++- loleaflet/src/map/Map.js | 4 - 8 files changed, 83 insertions(+), 82 deletions(-)
New commits: commit a2f9e2c255a0960d0e3bab5cdd83daecbda7f146 Author: Pranav Kant <pran...@collabora.com> Date: Mon May 23 14:24:00 2016 +0530 loleaflet: Fix lint errors Change-Id: Ib4447ebecf8e95cb1ac9432fcf8ca2f8b0859550 diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js index c928e93..ba5caca 100644 --- a/loleaflet/src/control/Control.ColumnHeader.js +++ b/loleaflet/src/control/Control.ColumnHeader.js @@ -2,7 +2,7 @@ * Control.ColumnHeader */ -/* global */ +/* global $ _ */ L.Control.ColumnHeader = L.Control.extend({ onAdd: function (map) { map.on('updatepermission', this._onUpdatePermission, this); diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js index f0cfc52..50781da 100644 --- a/loleaflet/src/control/Control.ContextMenu.js +++ b/loleaflet/src/control/Control.ContextMenu.js @@ -2,7 +2,7 @@ * Control.ContextMenu */ -/* global */ +/* global $ map _ */ L.Control.ContextMenu = L.Control.extend({ options: { SEPARATOR: '---------', @@ -62,9 +62,9 @@ L.Control.ContextMenu = L.Control.extend({ selector: '.leaflet-layer', className: 'loleaflet-font', trigger: 'none', - build: function(triggerEle, e) { + build: function() { return { - callback: function(key, options) { + callback: function(key) { map.sendUnoCommand(key); }, items: contextMenu @@ -80,63 +80,60 @@ L.Control.ContextMenu = L.Control.extend({ var contextMenu = {}; var sepIdx = 1, itemName; var isLastItemText = false; - for (var idx in obj['menu']) { - var item = obj['menu'][idx]; - if (item['enabled'] === 'false') { + for (var idx in obj.menu) { + var item = obj.menu[idx]; + if (item.enabled === 'false') { continue; } - if (item['type'] === 'separator') { + if (item.type === 'separator') { if (isLastItemText) { contextMenu['sep' + sepIdx++] = this.options.SEPARATOR; } isLastItemText = false; } - else { - if (item['type'] === 'command') { - // Only show whitelisted items - // Command name (excluding '.uno:') starts from index = 5 - var commandName = item['command'].substring(5); - if (this.options.whitelist.general.indexOf(commandName) === -1 && - !(docType === 'text' && this.options.whitelist.text.indexOf(commandName) !== -1) && - !(docType === 'spreadsheet' && this.options.whitelist.spreadsheet.indexOf(commandName) !== -1) && - !(docType === 'presentation' && this.options.whitelist.presentation.indexOf(commandName) !== -1) && - !(docType === 'drawing' && this.options.whitelist.drawing.indexOf(commandName) !== -1)) { - continue; - } + else if (item.type === 'command') { + // Only show whitelisted items + // Command name (excluding '.uno:') starts from index = 5 + var commandName = item.command.substring(5); + if (this.options.whitelist.general.indexOf(commandName) === -1 && + !(docType === 'text' && this.options.whitelist.text.indexOf(commandName) !== -1) && + !(docType === 'spreadsheet' && this.options.whitelist.spreadsheet.indexOf(commandName) !== -1) && + !(docType === 'presentation' && this.options.whitelist.presentation.indexOf(commandName) !== -1) && + !(docType === 'drawing' && this.options.whitelist.drawing.indexOf(commandName) !== -1)) { + continue; + } - itemName = item['text'].replace('~', ''); - contextMenu[item['command']] = { - name: _(itemName) - }; - - if (item['checktype'] === 'checkmark') { - if (item['checked'] === 'true') { - contextMenu[item['command']]['icon'] = 'checkmark'; - } - } else if (item['checktype'] === 'radio') { - if (item['checked'] === 'true') { - contextMenu[item['command']]['icon'] = 'radio'; - } - } + itemName = item.text.replace('~', ''); + contextMenu[item.command] = { + name: _(itemName) + }; - isLastItemText = true; - } else if (item['type'] === 'menu') { - itemName = item['text'].replace('~', ''); - var submenu = this._createContextMenuStructure(item); - // ignore submenus with all items disabled - if (Object.keys(submenu).length === 0) { - continue; + if (item.checktype === 'checkmark') { + if (item.checked === 'true') { + contextMenu[item.command.icon] = 'checkmark'; + } + } else if (item.checktype === 'radio') { + if (item.checked === 'true') { + contextMenu[item.command.icon] = 'radio'; } + } - contextMenu[item['command']] = { - name: itemName, - items: submenu - }; - isLastItemText = true; + isLastItemText = true; + } else if (item.type === 'menu') { + itemName = item.text.replace('~', ''); + var submenu = this._createContextMenuStructure(item); + // ignore submenus with all items disabled + if (Object.keys(submenu).length === 0) { + continue; } - } + contextMenu[item.command] = { + name: itemName, + items: submenu + }; + isLastItemText = true; + } } // Remove separator, if present, at the end diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 09ad026..2e6da81 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -2,8 +2,8 @@ * Control.Menubar */ -/* global $ _ map */ -L.Control.menubar = L.Control.extend({ +/* global $ _ map title vex */ +L.Control.Menubar = L.Control.extend({ options: { text: [ {name: 'File', type: 'menu', menu: [{name: 'Save', type: 'unocommand', uno: '.uno:Save'}, @@ -157,8 +157,9 @@ L.Control.menubar = L.Control.extend({ }, _onUpdatePermission: function() { - if (this._initialized || !this._menubarCont) + if (this._initialized || !this._menubarCont) { return; + } // Add dcoument specific menu var docType = this._map.getDocType(); @@ -255,16 +256,14 @@ L.Control.menubar = L.Control.extend({ } else if (document.documentElement.webkitRequestFullscreen) { document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } - } else { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } + } else if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); } } else if (id === 'fullscreen-presentation' && map.getDocType() === 'presentation') { map.fire('fullscreen'); @@ -274,7 +273,7 @@ L.Control.menubar = L.Control.extend({ map.duplicatePage(); } else if (id === 'deletepage') { vex.dialog.confirm({ - message: _("Are you sure you want to delete this slide?"), + message: _('Are you sure you want to delete this slide?'), callback: this._onDeleteSlide }, this); } @@ -303,22 +302,22 @@ L.Control.menubar = L.Control.extend({ for (var i in menu) { var liItem = L.DomUtil.create('li', ''); var aItem = L.DomUtil.create('a', '', liItem); - aItem.innerHTML = menu[i]['name']; + aItem.innerHTML = menu[i].name; - if (menu[i]['type'] === 'menu') { + if (menu[i].type === 'menu') { var ulItem = L.DomUtil.create('ul', '', liItem); - var subitemList = this._createMenu(menu[i]['menu']); + var subitemList = this._createMenu(menu[i].menu); for (var j in subitemList) { ulItem.appendChild(subitemList[j]); } - } else if (menu[i]['type'] === 'unocommand') { + } else if (menu[i].type === 'unocommand') { $(aItem).data('type', 'unocommand'); - $(aItem).data('uno', menu[i]['uno']); - } else if (menu[i]['type'] === 'separator') { + $(aItem).data('uno', menu[i].uno); + } else if (menu[i].type === 'separator') { $(aItem).addClass('separator'); - } else if (menu[i]['type'] === 'action') { + } else if (menu[i].type === 'action') { $(aItem).data('type', 'action'); - $(aItem).data('id', menu[i]['id']); + $(aItem).data('id', menu[i].id); } itemList.push(liItem); @@ -336,5 +335,5 @@ L.Control.menubar = L.Control.extend({ }); L.control.menubar = function (options) { - return new L.Control.menubar(options); + return new L.Control.Menubar(options); }; diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js index ad9d6b5..092bf6e 100644 --- a/loleaflet/src/control/Control.PartsPreview.js +++ b/loleaflet/src/control/Control.PartsPreview.js @@ -2,7 +2,7 @@ * L.Control.PartsPreview */ -/* global $ */ +/* global $ map */ L.Control.PartsPreview = L.Control.extend({ options: { autoUpdate: true @@ -78,8 +78,9 @@ L.Control.PartsPreview = L.Control.extend({ }, _setPart: function (e) { - if (!map._editlock) + if (!map._editlock) { return; + } var part = $('.parts-preview .mCSB_container .preview-frame').index(e.target.parentNode); if (part !== null) { this._map.setPart(parseInt(part)); diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js index 2285839..091612d 100644 --- a/loleaflet/src/control/Control.RowHeader.js +++ b/loleaflet/src/control/Control.RowHeader.js @@ -2,7 +2,7 @@ * L.Control.RowHeader */ -/* global */ +/* global $ _ */ L.Control.RowHeader = L.Control.extend({ onAdd: function (map) { map.on('updatepermission', this._onUpdatePermission, this); diff --git a/loleaflet/src/control/Control.Tabs.js b/loleaflet/src/control/Control.Tabs.js index 8cd3be8..863dc4d 100644 --- a/loleaflet/src/control/Control.Tabs.js +++ b/loleaflet/src/control/Control.Tabs.js @@ -2,7 +2,7 @@ * L.Control.Tabs is used to switch sheets in Calc */ -/* global $ vex _ */ +/* global $ vex _ map */ L.Control.Tabs = L.Control.extend({ onAdd: function(map) { map.on('updatepermission', this._onUpdatePermission, this); @@ -135,8 +135,9 @@ L.Control.Tabs = L.Control.extend({ }, _setPart: function (e) { - if (!map._editlock) + if (!map._editlock) { return; + } var part = e.target.id.match(/\d+/g)[0]; if (part !== null) { this._map.setPart(parseInt(part)); diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index dfa4222..8cbe56c 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -288,10 +288,11 @@ L.TileLayer = L.GridLayer.extend({ } else if (textMsg.startsWith('invalidatetiles:') && textMsg.match('EMPTY')) { var msg = 'invalidatetiles: '; - if (this._docType == 'text') + if (this._docType === 'text') { msg += 'part=0 '; - else + } else { msg += 'part=' + this._selectedPart + ' '; + } msg += 'x=0 y=0 '; msg += 'width=' + this._docWidthTwips + ' '; msg += 'height=' + this._docHeightTwips; @@ -465,9 +466,11 @@ L.TileLayer = L.GridLayer.extend({ this._twipsToLatLng(bottomRightTwips, this._map.getZoom())); } - var horizontalDirection = 0, - verticalDirection = 0; - var sign = function(x) {return x>0?1:x<0?-1:x;} + var horizontalDirection = 0; + var verticalDirection = 0; + var sign = function(x) { + return x > 0 ? 1 : x < 0 ? -1 : x; + }; if (!this._isEmptyRectangle(this._prevCellCursor) && !this._isEmptyRectangle(this._cellCursor)) { horizontalDirection = sign(this._cellCursor.getWest() - this._prevCellCursor.getWest()); verticalDirection = sign(this._cellCursor.getNorth() - this._prevCellCursor.getNorth()); diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 1c0bcd9..0b4ee8b 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -733,7 +733,7 @@ L.Map = L.Evented.extend({ map._active = false; clearTimeout(vex.timer); - options = $.extend({}, vex.defaultOptions, {contentCSS: {'background':'rgba(0, 0, 0, 0)'}}); + var options = $.extend({}, vex.defaultOptions, {contentCSS: {'background':'rgba(0, 0, 0, 0)'}}); options.id = vex.globalID; vex.dialogID = options.id; vex.globalID += 1; @@ -746,7 +746,7 @@ L.Map = L.Evented.extend({ options.$vexOverlay.bind('click.vex', function(e) { if (e.target !== this) { - return; + return 0; } return map._activate(); }); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits