diff --git a/scripts/system/places/places.html b/scripts/system/places/places.html index 980d8f0f1f..fda67f4066 100644 --- a/scripts/system/places/places.html +++ b/scripts/system/places/places.html @@ -150,7 +150,11 @@ if (message.channel === channel && message.action === "CURRENT_LOCATION") { currentLocation = message.data; displayCurrentLocation(); - } + } + if (message.channel === channel && message.action === "MATURITY_FILTER") { + maturityFilter = message.filter; + displayMaturityFilter(); + } }); var goSignal = { @@ -600,8 +604,16 @@ maturityFilter = arrayRemove(maturityFilter, targeted); } loadRecordsUpTo = NUMBER_OF_RECORDS_PER_LOAD; + + var messageSent = { + "channel": channel, + "action": "SET_MATURITY_FILTER", + "filter": maturityFilter + }; + EventBridge.emitWebEvent(JSON.stringify(messageSent)); + displayMaturityFilter(); - generateContent(); + generateContent(); } function filterSearchField(targeted) { diff --git a/scripts/system/places/places.js b/scripts/system/places/places.js index b9cd49bb1f..fa22d536b7 100644 --- a/scripts/system/places/places.js +++ b/scripts/system/places/places.js @@ -19,6 +19,8 @@ var metaverseServers = []; var SETTING_METAVERSE_TO_FETCH = "placesAppMetaverseToFetch"; var SETTING_PINNED_METAVERSE = "placesAppPinnedMetaverse"; + var SETTING_MATURITY_FILTER = "placesAppMaturityFilter"; + var DEFAULT_MATURITY = ["adult", "mature", "teen", "everyone", "unrated"]; var REQUEST_TIMEOUT = 10000; //10 seconds var httpRequest = null; @@ -78,8 +80,8 @@ if (messageObj.action === "READY_FOR_CONTENT" && (n - timestamp) > INTERCALL_DELAY) { d = new Date(); timestamp = d.getTime(); + sendPersistedMaturityFilter(); transmitPortalList(); - sendCurrentLocationToUI(); } else if (messageObj.action === "TELEPORT" && (n - timestamp) > INTERCALL_DELAY) { @@ -88,17 +90,23 @@ if (messageObj.address.length > 0) { Window.location = messageObj.address; - } + } } else if (messageObj.action === "GO_HOME" && (n - timestamp) > INTERCALL_DELAY) { + d = new Date(); + timestamp = d.getTime(); if (LocationBookmarks.getHomeLocationAddress()) { location.handleLookupString(LocationBookmarks.getHomeLocationAddress()); } else { Window.location = "file:///~/serverless/tutorial.json"; } } else if (messageObj.action === "GO_BACK" && (n - timestamp) > INTERCALL_DELAY) { + d = new Date(); + timestamp = d.getTime(); location.goBack(); } else if (messageObj.action === "GO_FORWARD" && (n - timestamp) > INTERCALL_DELAY) { + d = new Date(); + timestamp = d.getTime(); location.goForward(); } else if (messageObj.action === "PIN_META" && (n - timestamp) > INTERCALL_DELAY) { d = new Date(); @@ -122,6 +130,10 @@ } metaverseServers.push(newMs); savePinnedMetaverseSetting(); + } else if (messageObj.action === "SET_MATURITY_FILTER" && (n - timestamp) > INTERCALL_DELAY) { + d = new Date(); + timestamp = d.getTime(); + Settings.setValue(SETTING_MATURITY_FILTER, messageObj.filter); } } } @@ -224,6 +236,15 @@ }; + function sendPersistedMaturityFilter() { + var messageSent = { + "channel": channel, + "action": "MATURITY_FILTER", + "filter": Settings.getValue(SETTING_MATURITY_FILTER, DEFAULT_MATURITY) + }; + tablet.emitScriptEvent(messageSent); + } + function getFederationData() { /* //If federation.json is got from the Metaverse Server (not implemented yet)