diff --git a/frontend-js/src/main/js/map/ControlType.js b/frontend-js/src/main/js/map/ControlType.js deleted file mode 100644 index 09d41558c3b7c99219f50dd0d899e1998c7364b9..0000000000000000000000000000000000000000 --- a/frontend-js/src/main/js/map/ControlType.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -var ControlType = { - SUBMAP_DIALOGS : "SUBMAP_DIALOGS", - LOGO_IMG : "LOGO_IMG", - LOGO_2_IMG : "LOGO_2_IMG" -}; - -module.exports = ControlType; diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js index 0651ed0be30ecc5f50cc54da2b8def1e57478d68..aef9cff7076179a3ced267c69ed386e0a973f770 100644 --- a/frontend-js/src/main/js/map/CustomMap.js +++ b/frontend-js/src/main/js/map/CustomMap.js @@ -9,7 +9,6 @@ var AbstractCustomMap = require('./AbstractCustomMap'); var Alias = require('./data/Alias'); var CommentDialog = require('../gui/CommentDialog'); var ConfigurationType = require('../ConfigurationType'); -var ControlType = require('./ControlType'); var CustomMapOptions = require('./CustomMapOptions'); var GuiConnector = require('../GuiConnector'); var IdentifiedElement = require('./data/IdentifiedElement'); @@ -131,11 +130,6 @@ CustomMap.prototype.init = function () { } }); }); - }).then(function () { - var logo2 = self.getControl(ControlType.LOGO_2_IMG); - logo2.src = self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_IMG).getValue(); - logo2.setAttribute('title', self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_TEXT).getValue()); - logo2.setAttribute('alt', self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_TEXT).getValue()); }); }; @@ -158,7 +152,7 @@ CustomMap.prototype.createLogo = function () { var logo2 = Functions.createElement({ type: 'IMG', className: "minerva-logo", - id: ControlType.LOGO_2_IMG, + title: self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_TEXT).getValue(), onclick: function () { return self.getServerConnector().getLogoLink().then(function (url) { var win = window.open(url, '_blank'); @@ -166,7 +160,7 @@ CustomMap.prototype.createLogo = function () { }).catch(GuiConnector.alert); } }); - this.addControl(logo2); + logo2.setAttribute('alt', self.getConfiguration().getOption(ConfigurationType.LEFT_LOGO_TEXT).getValue()); logoControlDiv2.appendChild(logo2); @@ -176,14 +170,12 @@ CustomMap.prototype.createLogo = function () { var logo = Functions.createElement({ type: "IMG", src: GuiConnector.getImgPrefix() + GuiConnector.getLcsbLogoImg(this.bigButtons), - style: "cursor: pointer", - id: ControlType.LOGO_IMG, + className: "minerva-logo", onclick: function () { var win = window.open('http://wwwen.uni.lu/lcsb/', '_blank'); win.focus(); } }); - this.addControl(logo); logoControlDiv.appendChild(logo); this.getMapCanvas().addRightBottomControl(logoControlDiv); @@ -1042,32 +1034,6 @@ CustomMap.prototype.getTopMap = function () { return this; }; -/** - * - * @param {HTMLElement} element - */ -CustomMap.prototype.addControl = function (element) { - if (this._controls[element.id] !== undefined) { - throw new Error("Element with id " + element.id + " already added to controls"); - } - if (ControlType[element.id] === undefined) { - throw new Error("Unknown control type: " + element.id); - } - this._controls[element.id] = element; -}; - -/** - * - * @param {string} type - * @returns {HTMLElement} - */ -CustomMap.prototype.getControl = function (type) { - if (ControlType[type] === undefined) { - throw new Error("Unknown control type: " + type); - } - return this._controls[type]; -}; - /** * * @param {CommentDialog} commentDialog diff --git a/frontend-js/src/test/js/map/CustomMap-test.js b/frontend-js/src/test/js/map/CustomMap-test.js index 17f110957e8d56789855869f030a5623491a64ee..b21f25683ec19edf5c64c36cc3fe5f840736ecfd 100644 --- a/frontend-js/src/test/js/map/CustomMap-test.js +++ b/frontend-js/src/test/js/map/CustomMap-test.js @@ -7,7 +7,6 @@ require("../mocha-config.js"); var AliasMarker = require('../../../main/js/map/marker/AliasMarker'); var AliasSurface = require('../../../main/js/map/surface/AliasSurface'); var Comment = require('../../../main/js/map/data/Comment'); -var ControlType = require('../../../main/js/map/ControlType'); var CustomMap = require('../../../main/js/map/CustomMap'); var IdentifiedElement = require('../../../main/js/map/data/IdentifiedElement'); var MapContextMenu = require('../../../main/js/gui/MapContextMenu'); @@ -1010,11 +1009,11 @@ describe('CustomMap', function () { describe("logo link", function () { it("left logo click", function () { var map = helper.createCustomMap(); - return map.getControl(ControlType.LOGO_2_IMG).onclick() + return $(".minerva-logo", map.getElement())[0].onclick() }); it("right logo click", function () { var map = helper.createCustomMap(); - return map.getControl(ControlType.LOGO_IMG).onclick() + return $(".minerva-logo", map.getElement())[1].onclick() }); }); describe("getDistance", function () {