Skip to content

Commit

Permalink
Merge pull request #648 from xscreach/feature/Hide-portal-levels-plug…
Browse files Browse the repository at this point in the history
…in-fix
  • Loading branch information
modos189 authored Jul 25, 2023
2 parents 98c4a06 + 8333e48 commit 43fcec2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions plugins/hide-portal-levels.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
// @author johnd0e
// @name Hide portal levels
// @category Layer
// @version 0.1.0
// @version 0.1.1
// @description Replace all levels with single layerChooser's entry; reverting on longclick

/* exported setup, changelog --eslint */

// use own namespace for plugin
var hideLevels = {};
window.plugin.hideLevels = hideLevels;

hideLevels.layerFilterRegexp = new RegExp(/Level \d* Portals/);
hideLevels.initCollapsed = true;

var changelog = [
{
version: '0.1.1',
changes: ['FIX: Hide only portal layers'],
},
{
version: '0.1.0',
changes: ['Initial version'],
},
];

function setup () {
var ctrl = window.layerChooser;

hideLevels.portals = L.layerGroup();

var levels = ctrl._layers.filter(function (data) {
return data.overlay && data.name.endsWith(' Portals');
return data.overlay && (data.name === 'Unclaimed/Placeholder Portals' || data.name.match(hideLevels.layerFilterRegexp));
});
hideLevels.collapse = function (set) {
var allDisabled = true;
Expand Down

0 comments on commit 43fcec2

Please sign in to comment.