[Libreoffice-commits] online.git: 2 commits - loleaflet/dist loleaflet/src

Pranav Kant pranavk at collabora.com
Mon Apr 25 07:51:54 UTC 2016


 loleaflet/dist/toolbar/toolbar.js       |    2 
 loleaflet/src/control/Control.Dialog.js |    6 +-
 loleaflet/src/layer/tile/GridLayer.js   |   80 ++++++++++++++++----------------
 loleaflet/src/map/Map.js                |   23 ++++-----
 4 files changed, 57 insertions(+), 54 deletions(-)

New commits:
commit c91c2a431f8f6a3e60bf28a1f91c4c8c1f2bbe62
Author: Pranav Kant <pranavk at collabora.com>
Date:   Mon Apr 25 13:17:41 2016 +0530

    loleaflet: Fix lint errors
    
    'jake test' was complaining a lot. There are still few errors
    that needs fixing.
    
    Change-Id: I83bc51c25a3ce3037617378f57dd06f5f9887f77

diff --git a/loleaflet/src/control/Control.Dialog.js b/loleaflet/src/control/Control.Dialog.js
index c377248..9417a8b 100644
--- a/loleaflet/src/control/Control.Dialog.js
+++ b/loleaflet/src/control/Control.Dialog.js
@@ -10,9 +10,9 @@ L.Control.Dialog = L.Control.extend({
 	},
 
 	_onError: function (e) {
-		if (vex.dialog_id > 0) {
+		if (vex.dialogID > 0) {
 			// Close other dialogs before presenting a new one.
-			vex.close(vex.dialog_id);
+			vex.close(vex.dialogID);
 		}
 
 		if (e.msg) {
@@ -25,7 +25,7 @@ L.Control.Dialog = L.Control.extend({
 		}
 
 		// Remember the current dialog ID to close it later.
-		vex.dialog_id = vex.globalID - 1;
+		vex.dialogID = vex.globalID - 1;
 	},
 
 	_onPrint: function (e) {
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index fad90c0..c9cfb48 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -778,12 +778,13 @@ L.GridLayer = L.Layer.extend({
 	},
 
 	_addTiles: function (coordsQueue, fragment) {
+		var coords, key;
 		// first take care of the DOM
 		for (var i = 0; i < coordsQueue.length; i++) {
-			var coords = coordsQueue[i];
+			coords = coordsQueue[i];
 
-			var tilePos = this._getTilePos(coords),
-				key = this._tileCoordsToKey(coords);
+			var tilePos = this._getTilePos(coords);
+			key = this._tileCoordsToKey(coords);
 
 			if (coords.part === this._selectedPart) {
 				var tile = this.createTile(this._wrapCoords(coords), L.bind(this._tileReady, this, coords));
@@ -822,27 +823,27 @@ L.GridLayer = L.Layer.extend({
 		}
 
 		// sort the tiles by the rows
-		coordsQueue.sort(function(a, b){
-			if (a.y != b.y ) {
-				return a.y-b.y;
+		coordsQueue.sort(function(a, b) {
+			if (a.y !== b.y) {
+				return a.y - b.y;
 			} else {
-				return a.x-b.x;
+				return a.x - b.x;
 			}
 		});
 
 		// try group the tiles into rectangular areas
 		var rectangles = [];
 		while (coordsQueue.length > 0) {
-			var coords = coordsQueue[0];
+			coords = coordsQueue[0];
 
 			// tiles that do not interest us
-			var key = this._tileCoordsToKey(coords);
+			key = this._tileCoordsToKey(coords);
 			if (this._tileCache[key] || coords.part !== this._selectedPart) {
 				coordsQueue.splice(0, 1);
 				continue;
 			}
 
-			var rectQueue = [ coords ];
+			var rectQueue = [coords];
 			var bound = new L.Point(coords.x, coords.y);
 
 			// remove it
@@ -850,14 +851,14 @@ L.GridLayer = L.Layer.extend({
 
 			// find the close ones
 			var rowLocked = false;
-			var hasHole = false
-			var i = 0;
+			var hasHole = false;
+			i = 0;
 			while (i < coordsQueue.length) {
 				var current = coordsQueue[i];
 
 				// extend the bound vertically if possible (so far it was
 				// continous)
-				if (!hasHole && (current.y == bound.y + 1)) {
+				if (!hasHole && (current.y === bound.y + 1)) {
 					rowLocked = true;
 					++bound.y;
 				}
@@ -867,7 +868,7 @@ L.GridLayer = L.Layer.extend({
 				}
 
 				if (!rowLocked) {
-					if (current.y == bound.y && current.x == bound.x + 1) {
+					if (current.y === bound.y && current.x === bound.x + 1) {
 						// extend the bound horizontally
 						++bound.x;
 						rectQueue.push(current);
@@ -891,32 +892,33 @@ L.GridLayer = L.Layer.extend({
 			rectangles.push(rectQueue);
 		}
 
+		var twips, msg;
 		for (var r = 0; r < rectangles.length; ++r) {
-			var rectQueue = rectangles[r];
+			rectQueue = rectangles[r];
 
-			if (rectQueue.length == 1) {
+			if (rectQueue.length === 1) {
 				// only one tile here
-				var coords = rectQueue[0];
-				var key = this._tileCoordsToKey(coords);
+				coords = rectQueue[0];
+				key = this._tileCoordsToKey(coords);
 
-				var twips = this._coordsToTwips(coords);
-				var msg = 'tile ' +
-						'part=' + coords.part + ' ' +
-						'width=' + this._tileSize + ' ' +
-						'height=' + this._tileSize + ' ' +
-						'tileposx=' + twips.x + ' '	+
-						'tileposy=' + twips.y + ' ' +
-						'tilewidth=' + this._tileWidthTwips + ' ' +
-						'tileheight=' + this._tileHeightTwips;
+				twips = this._coordsToTwips(coords);
+				msg = 'tile ' +
+					'part=' + coords.part + ' ' +
+					'width=' + this._tileSize + ' ' +
+					'height=' + this._tileSize + ' ' +
+					'tileposx=' + twips.x + ' '	+
+					'tileposy=' + twips.y + ' ' +
+					'tilewidth=' + this._tileWidthTwips + ' ' +
+					'tileheight=' + this._tileHeightTwips;
 				this._map._socket.sendMessage(msg, key);
 			}
 			else {
 				// more tiles, use tilecombine
 				var tilePositionsX = '';
 				var tilePositionsY = '';
-				for (var i = 0; i < rectQueue.length; i++) {
-					var coords = rectQueue[i];
-					var twips = this._coordsToTwips(coords);
+				for (i = 0; i < rectQueue.length; i++) {
+					coords = rectQueue[i];
+					twips = this._coordsToTwips(coords);
 
 					if (tilePositionsX !== '') {
 						tilePositionsX += ',';
@@ -929,15 +931,15 @@ L.GridLayer = L.Layer.extend({
 					tilePositionsY += twips.y;
 				}
 
-				var twips = this._coordsToTwips(coords);
-				var msg = 'tilecombine ' +
-						'part=' + coords.part + ' ' +
-						'width=' + this._tileSize + ' ' +
-						'height=' + this._tileSize + ' ' +
-						'tileposx=' + tilePositionsX + ' '	+
-						'tileposy=' + tilePositionsY + ' ' +
-						'tilewidth=' + this._tileWidthTwips + ' ' +
-						'tileheight=' + this._tileHeightTwips;
+				twips = this._coordsToTwips(coords);
+				msg = 'tilecombine ' +
+					'part=' + coords.part + ' ' +
+					'width=' + this._tileSize + ' ' +
+					'height=' + this._tileSize + ' ' +
+					'tileposx=' + tilePositionsX + ' '	+
+					'tileposy=' + tilePositionsY + ' ' +
+					'tilewidth=' + this._tileWidthTwips + ' ' +
+					'tileheight=' + this._tileHeightTwips;
 				this._map._socket.sendMessage(msg, '');
 			}
 		}
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 847ba85..a177d79 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -2,6 +2,7 @@
  * L.Map is the central class of the API - it is used to create a map.
  */
 
+/* global vex $ */
 L.Map = L.Evented.extend({
 
 	options: {
@@ -64,7 +65,7 @@ L.Map = L.Evented.extend({
 		this._bDisableKeyboard = false;
 		this._active = true;
 
-		vex.dialog_id = -1;
+		vex.dialogID = -1;
 
 		this.callInitHooks();
 
@@ -701,9 +702,9 @@ L.Map = L.Evented.extend({
 				this._docLayer._onMessage('invalidatetiles: part=0 x=0 y=0 width=2147483647 height=2147483647', null);
 				this._active = true;
 
-				if (vex.dialog_id > 0) {
-					id = vex.dialog_id;
-					vex.dialog_id = -1;
+				if (vex.dialogID > 0) {
+					var id = vex.dialogID;
+					vex.dialogID = -1;
 					return vex.close(id);
 				}
 			}
@@ -715,7 +716,7 @@ L.Map = L.Evented.extend({
 	_deactivate: function () {
 		clearTimeout(vex.timer);
 
-		if (!this._active || vex.dialog_id > 0) {
+		if (!this._active || vex.dialogID > 0) {
 			// A dialog is already dimming the screen and probably
 			// shows an error message. Leave it alone.
 			this._active = false;
@@ -732,9 +733,9 @@ L.Map = L.Evented.extend({
 			map._active = false;
 			clearTimeout(vex.timer);
 
-			options = $.extend({}, vex.defaultOptions, {contentCSS: {"background":"rgba(0, 0, 0, 0)"}});
+			options = $.extend({}, vex.defaultOptions, {contentCSS: {'background':'rgba(0, 0, 0, 0)'}});
 			options.id = vex.globalID;
-			vex.dialog_id = options.id;
+			vex.dialogID = options.id;
 			vex.globalID += 1;
 			options.$vex = $('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
 			  vex: options
@@ -744,10 +745,10 @@ L.Map = L.Evented.extend({
 			});
 
 			options.$vexOverlay.bind('click.vex', function(e) {
-			  if (e.target !== this) {
-			    return;
-			  }
-			  return map._activate();
+				if (e.target !== this) {
+					return;
+				}
+				return map._activate();
 			});
 			options.$vex.append(options.$vexOverlay);
 
commit b825cd391f7a1f10399aaaf361342b43dde1a22c
Author: Pranav Kant <pranavk at collabora.com>
Date:   Mon Apr 25 12:56:38 2016 +0530

    bccu#1693: Empty item is not an object
    
    Treating empty item as an object expects `id` attribute on which
    toString method would be invoked. In case of object without `id`, it
    would throw an error trying to call toString on undefined
    attribute.
    
    Change-Id: I44e591044487b0d236760cc79438ccfcf0f53846

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 3e3e0e7..20d35a9 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -705,7 +705,7 @@ map.on('search', function (e) {
 
 map.on('updatetoolbarcommandvalues', function (e) {
 	// we need an empty option for the place holder to work
-	var data = [{text: ''}];
+	var data = [''];
 	var styles = [];
 	var topStyles = [];
 	if (e.commandName === '.uno:StyleApply') {


More information about the Libreoffice-commits mailing list