mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
use different global object name
This commit is contained in:
@ -4,7 +4,7 @@
|
|||||||
"es2020": true
|
"es2020": true
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"SETTINGS": "readonly"
|
"MOBILIZON_CONNECTOR": "readonly"
|
||||||
},
|
},
|
||||||
"parser": "@babel/eslint-parser",
|
"parser": "@babel/eslint-parser",
|
||||||
"extends": [
|
"extends": [
|
||||||
|
@ -51,7 +51,7 @@ final class Mobilizon_Connector {
|
|||||||
'timeZone' => wp_timezone_string(),
|
'timeZone' => wp_timezone_string(),
|
||||||
'url' => MobilizonConnector\Settings::getUrl()
|
'url' => MobilizonConnector\Settings::getUrl()
|
||||||
);
|
);
|
||||||
wp_add_inline_script($scriptName, 'const SETTINGS = ' . json_encode($settings), 'before'); // TODO use different name
|
wp_add_inline_script($scriptName, 'const MOBILIZON_CONNECTOR = ' . json_encode($settings), 'before');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register_blocks() {
|
public function register_blocks() {
|
||||||
|
@ -8,7 +8,7 @@ let document
|
|||||||
test.before(() => {
|
test.before(() => {
|
||||||
const window = new JSDOM().window
|
const window = new JSDOM().window
|
||||||
document = window.document
|
document = window.document
|
||||||
window.SETTINGS = {
|
window.MOBILIZON_CONNECTOR = {
|
||||||
locale: 'en-GB',
|
locale: 'en-GB',
|
||||||
timeZone: 'utc',
|
timeZone: 'utc',
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@ export function clearEventsList(container) {
|
|||||||
export function displayEvents({ data, document, container }) {
|
export function displayEvents({ data, document, container }) {
|
||||||
hideLoadingIndicator(container)
|
hideLoadingIndicator(container)
|
||||||
|
|
||||||
const isShortOffsetNameShown = SETTINGS.isShortOffsetNameShown
|
const isShortOffsetNameShown = MOBILIZON_CONNECTOR.isShortOffsetNameShown
|
||||||
const locale = SETTINGS.locale
|
const locale = MOBILIZON_CONNECTOR.locale
|
||||||
const maxEventsCount = container.getAttribute('data-maximum')
|
const maxEventsCount = container.getAttribute('data-maximum')
|
||||||
const timeZone = SETTINGS.timeZone
|
const timeZone = MOBILIZON_CONNECTOR.timeZone
|
||||||
|
|
||||||
const events = data.events
|
const events = data.events
|
||||||
? data.events.elements
|
? data.events.elements
|
||||||
|
@ -19,7 +19,7 @@ function loadEventLists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function loadEventList(container) {
|
export function loadEventList(container) {
|
||||||
const url = SETTINGS.url + URL_SUFFIX
|
const url = MOBILIZON_CONNECTOR.url + URL_SUFFIX
|
||||||
const limit = parseInt(container.getAttribute('data-maximum'))
|
const limit = parseInt(container.getAttribute('data-maximum'))
|
||||||
const groupName = container.getAttribute('data-group-name')
|
const groupName = container.getAttribute('data-group-name')
|
||||||
clearEventsList(container)
|
clearEventsList(container)
|
||||||
|
Reference in New Issue
Block a user