Skip to content

Commit

Permalink
Fix minor code
Browse files Browse the repository at this point in the history
Another PHP project library include for the backend.
PHP warning from changelog query paths.
Spacing and ordering style.
  • Loading branch information
Pysis868 committed Apr 5, 2023
1 parent 59f4e28 commit 3c22bdf
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 139 deletions.
1 change: 1 addition & 0 deletions ajax.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
include_once(__DIR__.'/config.php');
include_once(__DIR__.'/lib/common/database.php');
include_once(__DIR__.'/lib/common/session.php');
open();

if(!isset($_GET["command"])) {
Expand Down
1 change: 1 addition & 0 deletions ajax/get_changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
$sqlGroup = "GROUP BY `version`";
} else {
$sqlSelectUnseenVersion = "SELECT MAX($sqlVersionFieldsConcat) `version`";
$sqlGroup = "";
}
// $resDebug['_GET["allSince"]'] = $_GET["allSince"];
if(!$settingIncludeHidden) {
Expand Down
245 changes: 126 additions & 119 deletions scripts/controls/ZLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ L.Control.ZLayers = L.Control.Layers.extend({
_initLayout: function () {
var container = this._container;

if (!this.options.showMapControl) {
container.style.display = 'none';
container.style.marginTop = '0px';
}
if (!this.options.showMapControl) {
container.style.display = 'none';
container.style.marginTop = '0px';
}

if (!L.Browser.touch) {
L.DomEvent.disableClickPropagation(container);
Expand All @@ -99,108 +99,108 @@ L.Control.ZLayers = L.Control.Layers.extend({
// Why did we need the expand click iteraction at least?
// This was getting in the way of having a nice default focus
// into the search area.
// L.DomEvent
// .on(container, 'click', this._expand, this)
// //.on(container, 'mouseout', this._collapse, this)
// ;
// L.DomEvent
// .on(container, 'click', this._expand, this)
// //.on(container, 'mouseout', this._collapse, this)
// ;

var link = this._layersLink = L.DomUtil.create('a', this.options.className + '-toggle', container);
link.href = '#';
link.title = 'Layers';

L.DomEvent
.on(container, 'click', L.DomEvent.stopPropagation)
//.on(container, 'click', L.DomEvent.preventDefault)
.on(container, 'dblclick', L.DomEvent.stopPropagation)
.on(container, 'dblclick', L.DomEvent.preventDefault);

if (L.Browser.touch) {
L.DomEvent
/*.on(link, 'click', L.DomEvent.stopPropagation)
.on(link, 'click', L.DomEvent.preventDefault)*/
.on(link, 'click', this._expand, this);
}
else {
L.DomEvent.on(link, 'focus', this._expand, this);
}

var link = this._layersLink = L.DomUtil.create('a', this.options.className + '-toggle', container);
link.href = '#';
link.title = 'Layers';
form1.style.width = '360px';

L.DomEvent
.on(container, 'click', L.DomEvent.stopPropagation)
//.on(container, 'click', L.DomEvent.preventDefault)
.on(container, 'dblclick', L.DomEvent.stopPropagation)
.on(container, 'dblclick', L.DomEvent.preventDefault);

if (L.Browser.touch) {
L.DomEvent
/*.on(link, 'click', L.DomEvent.stopPropagation)
.on(link, 'click', L.DomEvent.preventDefault)*/
.on(link, 'click', this._expand, this);
}
else {
L.DomEvent.on(link, 'focus', this._expand, this);
}
this.headerBar = new HeaderBar({
parent: form1,
mapControl: this,
shrinkButton: true
});

form1.style.width = '360px';
this._separator = L.DomUtil.create('div', this.options.className + '-separator', form1);

this.headerBar = new HeaderBar({
parent: form1,
mapControl: this,
shrinkButton: true
});
var headerMenu = L.DomUtil.create('header', 'ex1', form1);
headerMenu.style.height = (this.options.headerHeight - 2) + 'px'; // Need to remove 2px because of the separator

this._separator = L.DomUtil.create('div', this.options.className + '-separator', form1);

var headerMenu = L.DomUtil.create('header', 'ex1', form1);
headerMenu.style.height = (this.options.headerHeight - 2) + 'px'; // Need to remove 2px because of the separator

var logo = new Logo({ parent: headerMenu });

_thisLayer = this;
this._gameMenu = this.createGameMenu();
this._mapsMenu = this.createMapsMenu();

this._mapsButton = new MapButton({
toggledOn: false,
onToggle: function(toggledOn) {
if (toggledOn) {
_thisLayer.setContent(_thisLayer._mapsMenu.domNode, "maps");
_thisLayer._gamesButton.clear();
} else {
_thisLayer.resetContent();
_thisLayer._gamesButton.clear();
_thisLayer._mapsButton.clear();
}
}.bind(this) // Where should the cookie code come from.... some config object with an abstracted persistence layer?,
});
// this.categoryButtonCompleted.domNode.on('toggle', opts.onCompletedToggle.bind(this.categoryButtonCompleted));
$(headerMenu).append(this._mapsButton.domNode);

this._gamesButton = new GameButton({
toggledOn: false,
onToggle: function(toggledOn) {
if (toggledOn) {
_thisLayer.setContent(_thisLayer._gameMenu.domNode, "game");
_thisLayer._mapsButton.clear();
} else {
_thisLayer.resetContent();
_thisLayer._gamesButton.clear();
_thisLayer._mapsButton.clear();
}

}.bind(this) // Where should the cookie code come from.... some config object with an abstracted persistence layer?,
});
// this.categoryButtonCompleted.domNode.on('toggle', opts.onCompletedToggle.bind(this.categoryButtonCompleted));
$(headerMenu).append(this._gamesButton.domNode);

var logo = new Logo({ parent: headerMenu });

_thisLayer = this;
this._gameMenu = this.createGameMenu();
this._mapsMenu = this.createMapsMenu();

this._separator = L.DomUtil.create('div', this.options.className + '-separator', form1);
this._mapsButton = new MapButton({
toggledOn: false,
onToggle: function(toggledOn) {
if (toggledOn) {
_thisLayer.setContent(_thisLayer._mapsMenu.domNode, "maps");
_thisLayer._gamesButton.clear();
} else {
_thisLayer.resetContent();
_thisLayer._gamesButton.clear();
_thisLayer._mapsButton.clear();
}
}.bind(this) // Where should the cookie code come from.... some config object with an abstracted persistence layer?,
});
// this.categoryButtonCompleted.domNode.on('toggle', opts.onCompletedToggle.bind(this.categoryButtonCompleted));
$(headerMenu).append(this._mapsButton.domNode);

this._gamesButton = new GameButton({
toggledOn: false,
onToggle: function(toggledOn) {
if (toggledOn) {
_thisLayer.setContent(_thisLayer._gameMenu.domNode, "game");
_thisLayer._mapsButton.clear();
} else {
_thisLayer.resetContent();
_thisLayer._gamesButton.clear();
_thisLayer._mapsButton.clear();
}

this._contents = L.DomUtil.create('div', 'main-content ' + this.options.className + '-list');
L.DomEvent.disableClickPropagation(this._contents);
L.DomEvent.on(this._contents, 'mousewheel', L.DomEvent.stopPropagation);
this._contents.id = 'menu-cat-content';
}.bind(this) // Where should the cookie code come from.... some config object with an abstracted persistence layer?,
});
// this.categoryButtonCompleted.domNode.on('toggle', opts.onCompletedToggle.bind(this.categoryButtonCompleted));
$(headerMenu).append(this._gamesButton.domNode);

this._categoryMenu = this.createCategoryMenu();


this.resetContent();

this._contents.style.clear = 'both';
this._contents.style.maxHeight = (window.innerHeight>250?window.innerHeight - 250:250) + 'px';
this._contents.style.width = '360px';
this._separator = L.DomUtil.create('div', this.options.className + '-separator', form1);

this._contents = L.DomUtil.create('div', 'main-content ' + this.options.className + '-list');
L.DomEvent.disableClickPropagation(this._contents);
L.DomEvent.on(this._contents, 'mousewheel', L.DomEvent.stopPropagation);
this._contents.id = 'menu-cat-content';

this._categoryMenu = this.createCategoryMenu();


this.resetContent();

this._contents.style.clear = 'both';
this._contents.style.maxHeight = (window.innerHeight>250?window.innerHeight - 250:250) + 'px';
this._contents.style.width = '360px';

container.appendChild(form1);
container.appendChild(this._contents);
},
rebuildMapsMenu: function () {
this._mapsMenu = this.createMapsMenu();
},

rebuildMapsMenu: function () {
this._mapsMenu = this.createMapsMenu();
},

createCategoryMenu: function() {
return new CategoryMenu({
Expand Down Expand Up @@ -229,15 +229,15 @@ L.Control.ZLayers = L.Control.Layers.extend({
defaultToggledState: (this.options.categorySelectionMethod == "focus")
});
},

createMapsMenu: function() {
return new MapsMenu({
categoryTree: maps,
onCategoryToggle: function(toggledOn, category) {
if (this.currentMapLayer.id != category.id) {
map.removeLayer(this.currentMapLayer);
map.addLayer(category);
this.currentMapLayer = category;
this.currentMapLayer = category;
this.currentMapLayer.bringToBack();
map.fire("baselayerchange", this.currentMapLayer);
}
Expand All @@ -246,11 +246,11 @@ L.Control.ZLayers = L.Control.Layers.extend({
defaultToggledState: (this.options.categorySelectionMethod == "focus")
});
},

changeMapLayer: function(category) {

},

setDefaultFocus: function() {
this.headerBar.focus();
},
Expand Down Expand Up @@ -361,22 +361,26 @@ L.Control.ZLayers = L.Control.Layers.extend({
return this.options.collapsed;
},

_collapse: function() {
this.resetContent();
this.options.collapsed = true;
return this.collapse();
},
_collapse: function() {
this.resetContent();
this.options.collapsed = true;
return this.collapse();
},

_expand: function() {
this._triggerHandler("before_expand");
if (this._contents != undefined) {
this._contents.style.maxHeight = (window.innerHeight>250?window.innerHeight - 250:250) + 'px';
}
_expand: function() {
this._triggerHandler("before_expand");
if (this._contents != undefined) {
this._contents.style.maxHeight = (
(window.innerHeight > 250)
? (window.innerHeight - 250)
: 250
) + 'px';
}

this.options.collapsed = false;
this.expand();
this.options.collapsed = false;
this.expand();
this._triggerHandler("after_expand");
},
},

after_expand: function() {
this.setDefaultFocus();
Expand Down Expand Up @@ -450,21 +454,24 @@ L.Control.ZLayers = L.Control.Layers.extend({
setContentFunction();
}
},

// @method expand(): this
// Expand the control container if collapsed.
expand: function () {
L.DomUtil.addClass(this._container, 'leaflet-control-layers-expanded');
if (this._section) {
this._section.style.height = null;
var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
if (acceptableHeight < this._section.clientHeight) {
DomUtil.addClass(this._section, 'leaflet-control-layers-scrollbar');
this._section.style.height = acceptableHeight + 'px';
} else {
DomUtil.removeClass(this._section, 'leaflet-control-layers-scrollbar');
}
L.DomUtil.addClass(
this._container,
'leaflet-control-layers-expanded'
);
if (this._section) {
this._section.style.height = null;
var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
if (acceptableHeight < this._section.clientHeight) {
DomUtil.addClass(this._section, 'leaflet-control-layers-scrollbar');
this._section.style.height = acceptableHeight + 'px';
} else {
DomUtil.removeClass(this._section, 'leaflet-control-layers-scrollbar');
}
}
this._checkDisabledLayers();
return this;
},
Expand Down
14 changes: 7 additions & 7 deletions scripts/handlers/ChangelogHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ ChangelogHandler.prototype._fetchChangelogEntriesByCookie = function(seenChangel
}.bind(this));
};

ChangelogHandler.prototype._notifyChangelogVersionUpdates = function(entries, user) {
var entriesByVersion = this._groupChangelogEntriesByVersion(entries);
for (version in entriesByVersion) {
this._notifyChangelogVersionUpdate(version, entriesByVersion[version], user);
}
};

ChangelogHandler.prototype._groupChangelogEntriesByVersion = function(entries) {
return groupObjects({
arrayOfObjects: entries,
Expand Down Expand Up @@ -99,3 +92,10 @@ ChangelogHandler.prototype._notifyChangelogVersionUpdate = function(version, ver
.css(this.notificationWidth);
// Width-setting from the old code, in case we decide to not use the full top placement.
};

ChangelogHandler.prototype._notifyChangelogVersionUpdates = function(entries, user) {
var entriesByVersion = this._groupChangelogEntriesByVersion(entries);
for (version in entriesByVersion) {
this._notifyChangelogVersionUpdate(version, entriesByVersion[version], user);
}
};
2 changes: 1 addition & 1 deletion scripts/util/ZConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ZConfig = {

// Main config set-up with defaults

// "exact", "focus" (Jason's default)
// "exact", "focus" (ZU default)
ZConfig.setConfig("categorySelectionMethod", "focus");
ZConfig.setConfig("tilesBaseURL", "https://zeldamaps.com/tiles/");
ZConfig.setConfig("zoomDirectories", 'false');
Expand Down
Loading

0 comments on commit 3c22bdf

Please sign in to comment.