Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide portal levels plugin fix #648

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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