Browse Source

Hook 'show-popup'

master
parent
commit
04a7e3d737
  1. 1
      README.md
  2. 8
      src/CategoryOverpass.js

1
README.md

@ -119,4 +119,5 @@ With the function `register_hook` you can hook into several functions. The follo
* `state-get`: modules can add values into the current state. Parameters: `state`: an object, which can be modified by modules.
* `state-apply`: when a state is applied to the app. Parameters: `state`: state which should be applied.
* `show-details`: called when details are being displayed. Parameters: data (see properties in doc/TwigJS.md), category, dom, callback.
* `show-popup`: called when a popup is being displayed. Parameters: data (see properties in doc/TwigJS.md), category, dom, callback.
* `options_save`: called when options are saved. Parameters: options (the new object), old_options (before save)

8
src/CategoryOverpass.js

@ -223,6 +223,14 @@ CategoryOverpass.prototype.notifyPopupOpen = function (object, popup) {
}
CategoryOverpass.prototype.updatePopupContent = function (object, popup) {
call_hooks_callback('show-popup', object, this, popup._contentNode,
function (err) {
if (err.length) {
console.log('show-popup produced errors:', err)
}
}
)
if (object.data.popupDescription || object.data.description) {
var div = document.createElement('div')
div.className = 'description'

Loading…
Cancel
Save