Plugin broken after upgrading to latest Edge version
Closed this issue · 2 comments
Hi!
My plugin used for "renaming" ships is broken since I upgraded to latest Edge version.
I changed to version: 3, but it isn't doing anything and it shows up as loaded.
// {"author":"flygfantast","description":"Translates IMEI into ship names", "version": 3} const shipNames = { 2332: {name:"HKP15 - K32",callsign:"TROOPER32"}, 2358: {name:"HKP14 - K58",callsign:"ICEPAC58"}, 2190074: {name:"VTS SKAGEN (DK)",callsign:"VTS"}, 2573115: {name:"VTS SKIEN (NO)",callsign:"VTS"}, 2655085: {name:"VTS NORRKOPING",callsign:"VTS"}, 2655087: {name:"VTS MOTALA",callsign:"VTS"}, 2655090: {name:"VTS FARO",callsign:"VTS"}, 2655100: {name:"VTS VISBY",callsign:"VTS"}, 2655161: {name:"VTS BACKEFORS",callsign:"VTS"}, 2655162: {name:"VTS KARLSTAD",callsign:"VTS"}, 2655619: {name:"METEO",callsign:"VISINGSO"}, 11265526: {name:"HKP15 - K26",callsign:"TROOPER26"}, 11265529: {name:"HKP15 - K29",callsign:"TROOPER29"}, 111265520: {name:"HKP15 - K20",callsign:"TROOPER20"}, 111265521: {name:"HKP15 - K21",callsign:"TROOPER21"}, 111265522: {name:"HKP15 - K22",callsign:"TROOPER22"}, 111265523: {name:"HKP15 - K23",callsign:"TROOPER23"}, 111265524: {name:"HKP15 - K24",callsign:"TROOPER24"}, 111265525: {name:"HKP15 - K25",callsign:"TROOPER25"}, 111265526: {name:"HKP15 - K26",callsign:"TROOPER26"}, 111265527: {name:"HKP15 - K27",callsign:"TROOPER27"}, 111265528: {name:"HKP15 - K28",callsign:"TROOPER28"}, 111265529: {name:"HKP15 - K29",callsign:"TROOPER29"}, 111265530: {name:"HKP15 - K30",callsign:"TROOPER30"}, 111265531: {name:"HKP15 - K31",callsign:"TROOPER31"}, 111265532: {name:"HKP15 - K32",callsign:"TROOPER32"}, 111265533: {name:"HKP15 - K33",callsign:"TROOPER33"}, 111265534: {name:"HKP15 - K34",callsign:"TROOPER34"}, 111265535: {name:"HKP15 - K35",callsign:"TROOPER35"}, 111265536: {name:"HKP15 - K36",callsign:"TROOPER36"}, 111265537: {name:"HKP15 - K37",callsign:"TROOPER37"}, 111265538: {name:"HKP15 - K38",callsign:"TROOPER38"}, 111265539: {name:"HKP15 - K39",callsign:"TROOPER39"}, 111265555: {name:"HKP14 - K55",callsign:"ICEPAC55"}, 111265558: {name:"HKP14 - K58",callsign:"ICEPAC58"}, 111265911: {name:"SE-JOC",callsign:"SE-JOC"}, 111265581: {name:"LIFEGUARD 001",callsign:"SE-JRH"}, 111265582: {name:"LIFEGUARD 002",callsign:"SE-JRI"}, 111265583: {name:"LIFEGUARD 003",callsign:"SE-JRJ"}, 111265584: {name:"LIFEGUARD 004",callsign:"SE-JRK"}, 111265585: {name:"LIFEGUARD 005",callsign:"SE-JRL"}, 111265586: {name:"LIFEGUARD 006",callsign:"SE-JRM"}, 111265101: {name:"SE-MAA",callsign:"KBV501"}, 111265102: {name:"SE-MAB",callsign:"KBV502"}, 111265103: {name:"SE-MAC",callsign:"KBV503"} }; function getShipName(ship) { return (ship.mmsi in shipNames && shipNames[ship.mmsi].hasOwnProperty("name")) ? shipNames[ship.mmsi].name : ship.shipname; } function getCallSign(ship) { return (ship.mmsi in shipNames && shipNames[ship.mmsi].hasOwnProperty("callsign")) ? shipNames[ship.mmsi].callsign : ship.callsign; }
Can you replace the definiton of the functions with the following and see if that resolves it?
window.getShipName = function(ship) {
return (ship.mmsi in shipNames && shipNames[ship.mmsi].hasOwnProperty("name"))
? shipNames[ship.mmsi].name
: ship.shipname;
};
window.getCallSign = function(ship) {
return (ship.mmsi in shipNames && shipNames[ship.mmsi].hasOwnProperty("callsign"))
? shipNames[ship.mmsi].callsign
: ship.callsign;
};
Thanks, that did resolve the problem :)