audioPresets
2 years ago
branding
4 years ago
chapters
2 years ago
components
2 years ago
media
3 years ago
overlays
4 years ago
presets
2 years ago
services
4 years ago
settings
4 years ago
styles
2 years ago
tracks
5 years ago
BlockInspectorControls.js
4 years ago
LinkPlaceholder.js
5 years ago
Player.js
2 years ago
Preview.js
2 years ago
ProUpgradeModal.js
5 years ago
VisibilityEditor.js
5 years ago
audio-placeholder.js
4 years ago
helpers.js
5 years ago
options.js
5 years ago
placeholder.js
2 years ago
helpers.js
32 lines
| 1 | const helpers = { |
| 2 | setUrlPrivate: () => { |
| 3 | const separator = window.location.href.indexOf("?") === -1 ? "?" : "&"; |
| 4 | const newurl = |
| 5 | window.location.href + separator + "presto_video_type=private"; |
| 6 | window.history.pushState({ path: newurl }, "", newurl); |
| 7 | }, |
| 8 | setUrlPublic: () => { |
| 9 | const separator = window.location.href.indexOf("?") === -1 ? "?" : "&"; |
| 10 | const newurl = |
| 11 | window.location.href + separator + "presto_video_type=public"; |
| 12 | window.history.pushState({ path: newurl }, "", newurl); |
| 13 | }, |
| 14 | unsetUrlParams: () => { |
| 15 | let removed = removeURLParameters(window.location.href, [ |
| 16 | "presto_video_type", |
| 17 | ]); |
| 18 | window.history.pushState({ path: removed }, "", removed); |
| 19 | }, |
| 20 | }; |
| 21 | |
| 22 | function removeURLParameters(url, parameters = []) { |
| 23 | const parsedUrl = new URL(url); |
| 24 | parameters.forEach((param) => { |
| 25 | parsedUrl.searchParams.delete(param); |
| 26 | }); |
| 27 | |
| 28 | return parsedUrl.href; |
| 29 | } |
| 30 | |
| 31 | export default helpers; |
| 32 |