@orangelogic/orange-dam-content-browser-sdk 2.1.55 → 2.2.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -0
- package/.eslintignore +2 -0
- package/.eslintrc.json +82 -0
- package/.releaserc +17 -0
- package/.travis.yml +20 -0
- package/CBSDKdemo.html +315 -0
- package/GitVersion.yml +18 -0
- package/azure-pipeline.yaml +94 -0
- package/clientlib.config.js +36 -0
- package/config/env.js +105 -0
- package/config/getHttpsConfig.js +67 -0
- package/config/jest/babelTransform.js +30 -0
- package/config/jest/cssTransform.js +14 -0
- package/config/jest/fileTransform.js +41 -0
- package/config/modules.js +135 -0
- package/config/paths.js +79 -0
- package/config/webpack/persistentCache/createEnvironmentHash.js +10 -0
- package/config/webpack.config.js +762 -0
- package/config/webpackDevServer.config.js +128 -0
- package/config-overrides.js +8 -0
- package/gab_extension/GAB.html +85 -0
- package/gab_extension/GoogleChrome/manifest.json +28 -0
- package/gab_extension/GoogleChrome/src/assets/icon48.png +0 -0
- package/gab_extension/GoogleChrome/src/background/index.js +6 -0
- package/gab_extension/GoogleChrome/src/scripts/index.js +347 -0
- package/gab_extension/MozillaFirefox/manifest.json +20 -0
- package/gab_extension/MozillaFirefox/src/assets/icon.png +0 -0
- package/gab_extension/MozillaFirefox/src/background/index.js +5 -0
- package/gab_extension/MozillaFirefox/src/scripts/index.js +347 -0
- package/gab_extension/README.md +11 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.pbxproj +927 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/project.xcworkspace/xcuserdata/oldevmac01.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Orange DAM Asset Browser Extension.xcodeproj/xcuserdata/oldevmac01.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/AppIcon.appiconset/Contents.json +63 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/Contents.json +6 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Assets.xcassets/LargeIcon.imageset/Contents.json +20 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Base.lproj/Main.html +23 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Icon.png +0 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Script.js +24 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/Resources/Style.css +61 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (App)/ViewController.swift +81 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/Shared (Extension)/SafariWebExtensionHandler.swift +26 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/AppDelegate.swift +24 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/LaunchScreen.storyboard +36 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Base.lproj/Main.storyboard +38 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/Info.plist +27 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (App)/SceneDelegate.swift +18 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/iOS (Extension)/Info.plist +13 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/AppDelegate.swift +21 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Base.lproj/Main.storyboard +125 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Info.plist +8 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (App)/Orange DAM Asset Browser Extension.entitlements +12 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Info.plist +13 -0
- package/gab_extension/Safari/Orange DAM Asset Browser Extension/macOS (Extension)/Orange DAM Asset Browser Extension.entitlements +10 -0
- package/package.json +8 -49
- package/public/index.html +92 -0
- package/scripts/build.js +218 -0
- package/scripts/start.js +154 -0
- package/scripts/test.js +53 -0
- package/src/App.tsx +98 -0
- package/src/AppContext.ts +18 -0
- package/src/GlobalConfigContext.ts +46 -0
- package/src/components/ArrayClamp/ArrayClamp.styled.ts +42 -0
- package/src/components/ArrayClamp/ArrayClamp.tsx +167 -0
- package/src/components/ArrayClamp/index.ts +1 -0
- package/src/components/Browser/Browser.styled.ts +82 -0
- package/src/components/Browser/Browser.tsx +284 -0
- package/src/components/Browser/BrowserItem.tsx +98 -0
- package/src/components/ControlBar/ControlBar.constants.tsx +66 -0
- package/src/components/ControlBar/ControlBar.styled.ts +82 -0
- package/src/components/ControlBar/ControlBar.tsx +528 -0
- package/src/components/ControlBar/Facet/Facet.tsx +113 -0
- package/src/components/ControlBar/Facet/index.ts +1 -0
- package/src/components/FormatDialog/CropPreviewer/CropPreviewer.tsx +224 -0
- package/{build/components/FormatDialog/CropPreviewer/index.d.ts → src/components/FormatDialog/CropPreviewer/index.ts} +1 -1
- package/src/components/FormatDialog/CustomRendition/CustomRendition.constants.ts +24 -0
- package/src/components/FormatDialog/CustomRendition/CustomRendition.styled.ts +57 -0
- package/src/components/FormatDialog/CustomRendition/CustomRendition.tsx +178 -0
- package/src/components/FormatDialog/CustomRendition/index.ts +1 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Crop.tsx +249 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Extension.tsx +54 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Format.tsx +86 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Resize.tsx +176 -0
- package/src/components/FormatDialog/CustomRendition/transformations/Rotate.tsx +101 -0
- package/{build/components/FormatDialog/CustomRendition/transformations/index.d.ts → src/components/FormatDialog/CustomRendition/transformations/index.ts} +1 -3
- package/src/components/FormatDialog/FormatDialog.styled.ts +137 -0
- package/src/components/FormatDialog/FormatDialog.tsx +1533 -0
- package/src/components/FormatDialog/Previewer/Previewer.styled.ts +31 -0
- package/src/components/FormatDialog/Previewer/Previewer.tsx +143 -0
- package/src/components/FormatDialog/Previewer/index.ts +1 -0
- package/src/components/FormatDialog/ProxyMenu/ProxyMenu.styled.ts +88 -0
- package/src/components/FormatDialog/ProxyMenu/ProxyMenu.tsx +74 -0
- package/src/components/FormatDialog/ProxyMenu/index.ts +1 -0
- package/src/components/FormatDialog/TrackingParameters/TrackingParameters.tsx +59 -0
- package/src/components/FormatDialog/TrackingParameters/index.ts +1 -0
- package/src/components/FormatDialog/index.ts +1 -0
- package/src/components/Header/Header.styled.ts +51 -0
- package/src/components/Header/Header.tsx +118 -0
- package/src/components/Loader/Loader.tsx +37 -0
- package/src/components/Loader/index.ts +1 -0
- package/src/components/NoResult/NoResult.tsx +37 -0
- package/src/components/NoResult/index.tsx +1 -0
- package/src/components/Result/AssetCard/AssetCard.styled.ts +120 -0
- package/src/components/Result/AssetCard/AssetCard.tsx +192 -0
- package/src/components/Result/AssetCard/AssetCardWrapper.styled.ts +35 -0
- package/src/components/Result/AssetCard/AssetCardWrapper.tsx +165 -0
- package/src/components/Result/AssetCard/index.ts +1 -0
- package/src/components/Result/AssetPreview/AssetPreview.styled.ts +108 -0
- package/src/components/Result/AssetPreview/AssetPreview.tsx +78 -0
- package/src/components/Result/AssetPreview/ImagePreview/ImagePreview.tsx +42 -0
- package/src/components/Result/AssetPreview/ImagePreview/index.ts +1 -0
- package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.ts +23 -0
- package/src/components/Result/AssetPreview/OtherPreview/OtherPreview.tsx +28 -0
- package/src/components/Result/AssetPreview/OtherPreview/index.ts +1 -0
- package/src/components/Result/AssetPreview/VideoPreview/VideoPreview.tsx +132 -0
- package/src/components/Result/AssetPreview/VideoPreview/index.ts +1 -0
- package/src/components/Result/AssetPreview/index.ts +1 -0
- package/src/consts/asset.ts +16 -0
- package/src/consts/data.ts +17 -0
- package/src/index.tsx +305 -0
- package/src/page/Authenticate/Authenticate.tsx +232 -0
- package/src/page/Authenticate/ConnectingBackground.tsx +44 -0
- package/src/page/Authenticate/index.tsx +94 -0
- package/src/page/Home/Home.styled.ts +46 -0
- package/src/page/Home/Home.tsx +941 -0
- package/src/react-web-component.d.ts +4617 -0
- package/src/store/assets/assets.api.ts +167 -0
- package/src/store/assets/assets.service.ts +223 -0
- package/src/store/assets/assets.slice.ts +104 -0
- package/src/store/auth/auth.service.ts +71 -0
- package/src/store/auth/auth.slice.ts +295 -0
- package/src/store/index.ts +27 -0
- package/src/store/search/search.api.ts +319 -0
- package/src/store/search/search.slice.ts +28 -0
- package/src/store/user/user.api.ts +29 -0
- package/src/styles.css +42 -0
- package/src/types/assets.ts +71 -0
- package/src/types/auth.ts +42 -0
- package/src/types/common.ts +11 -0
- package/src/types/download.ts +8 -0
- package/src/types/navigation.ts +3 -0
- package/src/types/search.ts +116 -0
- package/{build/types/storage.d.ts → src/types/storage.ts} +1 -1
- package/src/types/user.ts +6 -0
- package/src/utils/api.ts +186 -0
- package/src/utils/array.ts +25 -0
- package/src/utils/constants.ts +12 -0
- package/src/utils/fetch.ts +116 -0
- package/src/utils/getRequestUrl.ts +15 -0
- package/src/utils/hooks.ts +36 -0
- package/src/utils/icon.ts +22 -0
- package/src/utils/image.ts +157 -0
- package/src/utils/number.ts +11 -0
- package/src/utils/rotate.ts +23 -0
- package/src/utils/storage.ts +184 -0
- package/src/utils/string.ts +24 -0
- package/src/view/AssetsPicker.tsx +24 -0
- package/src/web-component.d.ts +8151 -0
- package/tsconfig.eslint.json +10 -0
- package/tsconfig.json +37 -0
- package/build/ApiService.d.ts +0 -15
- package/build/App.d.ts +0 -62
- package/build/AppContext.d.ts +0 -18
- package/build/GlobalConfigContext.d.ts +0 -32
- package/build/OrangeDAMContentBrowserSDK.min.css +0 -2
- package/build/OrangeDAMContentBrowserSDK.min.css.map +0 -1
- package/build/OrangeDAMContentBrowserSDK.min.js +0 -11468
- package/build/OrangeDAMContentBrowserSDK.min.js.map +0 -1
- package/build/asset-manifest.json +0 -13
- package/build/components/ArrayClamp/ArrayClamp.d.ts +0 -10
- package/build/components/ArrayClamp/ArrayClamp.styled.d.ts +0 -1
- package/build/components/ArrayClamp/index.d.ts +0 -1
- package/build/components/Browser/Browser.constants.d.ts +0 -3
- package/build/components/Browser/Browser.d.ts +0 -21
- package/build/components/Browser/Browser.styled.d.ts +0 -2
- package/build/components/Browser/BrowserItem.d.ts +0 -13
- package/build/components/Browser/LoadMoreButton.d.ts +0 -9
- package/build/components/ControlBar/ControlBar.constants.d.ts +0 -10
- package/build/components/ControlBar/ControlBar.d.ts +0 -23
- package/build/components/ControlBar/ControlBar.styled.d.ts +0 -1
- package/build/components/ControlBar/Facet/Facet.d.ts +0 -14
- package/build/components/ControlBar/Facet/index.d.ts +0 -1
- package/build/components/FormatDialog/CropPreviewer/CropPreviewer.d.ts +0 -41
- package/build/components/FormatDialog/CustomRendition/CustomRendition.constants.d.ts +0 -5
- package/build/components/FormatDialog/CustomRendition/CustomRendition.d.ts +0 -56
- package/build/components/FormatDialog/CustomRendition/CustomRendition.styled.d.ts +0 -1
- package/build/components/FormatDialog/CustomRendition/index.d.ts +0 -1
- package/build/components/FormatDialog/CustomRendition/transformations/Crop.d.ts +0 -26
- package/build/components/FormatDialog/CustomRendition/transformations/Extension.d.ts +0 -11
- package/build/components/FormatDialog/CustomRendition/transformations/Format.d.ts +0 -10
- package/build/components/FormatDialog/CustomRendition/transformations/Metadata.d.ts +0 -7
- package/build/components/FormatDialog/CustomRendition/transformations/Quality.d.ts +0 -7
- package/build/components/FormatDialog/CustomRendition/transformations/Resize.d.ts +0 -18
- package/build/components/FormatDialog/CustomRendition/transformations/Rotate.d.ts +0 -8
- package/build/components/FormatDialog/FormatDialog.d.ts +0 -49
- package/build/components/FormatDialog/FormatDialog.styled.d.ts +0 -3
- package/build/components/FormatDialog/Previewer/Previewer.d.ts +0 -17
- package/build/components/FormatDialog/Previewer/Previewer.styled.d.ts +0 -1
- package/build/components/FormatDialog/Previewer/index.d.ts +0 -1
- package/build/components/FormatDialog/ProxyMenu/ProxyMenu.d.ts +0 -20
- package/build/components/FormatDialog/ProxyMenu/ProxyMenu.styled.d.ts +0 -2
- package/build/components/FormatDialog/ProxyMenu/index.d.ts +0 -1
- package/build/components/FormatDialog/TrackingParameters/TrackingParameters.d.ts +0 -13
- package/build/components/FormatDialog/TrackingParameters/index.d.ts +0 -1
- package/build/components/FormatDialog/VersionHistory/VersionHistory.d.ts +0 -6
- package/build/components/FormatDialog/VersionHistory/VersionHistory.styled.d.ts +0 -1
- package/build/components/FormatDialog/VersionHistory/index.d.ts +0 -1
- package/build/components/FormatDialog/index.d.ts +0 -1
- package/build/components/Header/Header.d.ts +0 -15
- package/build/components/Header/Header.styled.d.ts +0 -5
- package/build/components/Loader/Loader.d.ts +0 -7
- package/build/components/Loader/index.d.ts +0 -1
- package/build/components/NoResult/NoResult.d.ts +0 -7
- package/build/components/NoResult/index.d.ts +0 -1
- package/build/components/Result/AssetCard/AssetCard.d.ts +0 -15
- package/build/components/Result/AssetCard/AssetCard.styled.d.ts +0 -2
- package/build/components/Result/AssetCard/AssetCardWrapper.d.ts +0 -18
- package/build/components/Result/AssetCard/AssetCardWrapper.styled.d.ts +0 -1
- package/build/components/Result/AssetCard/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/AssetPreview.d.ts +0 -11
- package/build/components/Result/AssetPreview/AssetPreview.styled.d.ts +0 -1
- package/build/components/Result/AssetPreview/ImagePreview/ImagePreview.d.ts +0 -11
- package/build/components/Result/AssetPreview/ImagePreview/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.d.ts +0 -9
- package/build/components/Result/AssetPreview/OtherPreview/OtherPreview.styled.d.ts +0 -1
- package/build/components/Result/AssetPreview/OtherPreview/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/VideoPreview/VideoPreview.d.ts +0 -11
- package/build/components/Result/AssetPreview/VideoPreview/index.d.ts +0 -1
- package/build/components/Result/AssetPreview/index.d.ts +0 -1
- package/build/consts/asset.d.ts +0 -14
- package/build/consts/auth.d.ts +0 -4
- package/build/consts/data.d.ts +0 -21
- package/build/index.d.ts +0 -225
- package/build/index.html +0 -1
- package/build/page/Authenticate/Authenticate.d.ts +0 -2
- package/build/page/Authenticate/ConnectingBackground.d.ts +0 -8
- package/build/page/Authenticate/index.d.ts +0 -2
- package/build/page/Home/Home.d.ts +0 -6
- package/build/page/Home/Home.styled.d.ts +0 -2
- package/build/setupTests.d.ts +0 -1
- package/build/store/assets/assets.api.d.ts +0 -66
- package/build/store/assets/assets.service.d.ts +0 -23
- package/build/store/assets/assets.slice.d.ts +0 -65
- package/build/store/auth/auth.service.d.ts +0 -10
- package/build/store/auth/auth.slice.d.ts +0 -76
- package/build/store/index.d.ts +0 -368
- package/build/store/search/search.api.d.ts +0 -39
- package/build/store/search/search.slice.d.ts +0 -12
- package/build/store/user/user.api.d.ts +0 -5
- package/build/types/assets.d.ts +0 -68
- package/build/types/auth.d.ts +0 -35
- package/build/types/common.d.ts +0 -11
- package/build/types/download.d.ts +0 -8
- package/build/types/navigation.d.ts +0 -3
- package/build/types/search.d.ts +0 -148
- package/build/types/user.d.ts +0 -7
- package/build/utils/api.d.ts +0 -27
- package/build/utils/array.d.ts +0 -13
- package/build/utils/constants.d.ts +0 -11
- package/build/utils/function.d.ts +0 -1
- package/build/utils/getRequestUrl.d.ts +0 -1
- package/build/utils/hooks.d.ts +0 -1
- package/build/utils/icon.d.ts +0 -3
- package/build/utils/image.d.ts +0 -24
- package/build/utils/number.d.ts +0 -4
- package/build/utils/rotate.d.ts +0 -4
- package/build/utils/storage.d.ts +0 -23
- package/build/utils/string.d.ts +0 -12
- package/build/view/AssetsPicker.d.ts +0 -6
- /package/{build → public}/favicon.ico +0 -0
- /package/{build → public}/logo192.png +0 -0
- /package/{build → public}/logo512.png +0 -0
- /package/{build → public}/manifest.json +0 -0
- /package/{build → public}/robots.txt +0 -0
- /package/{build/components/Browser/index.d.ts → src/components/Browser/index.ts} +0 -0
- /package/{build/components/ControlBar/index.d.ts → src/components/ControlBar/index.ts} +0 -0
- /package/{build/components/Header/index.d.ts → src/components/Header/index.ts} +0 -0
- /package/{build/page/Home/index.d.ts → src/page/Home/index.ts} +0 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
var modalOpen = false; // Flag to track if the modal is open
|
|
2
|
+
var minimized = false; // Flag to track if the modal is minimized
|
|
3
|
+
|
|
4
|
+
var storage = (typeof browser !== 'undefined' && browser.storage) ? browser.storage : chrome.storage;
|
|
5
|
+
|
|
6
|
+
function createModal(iframeSrc) {
|
|
7
|
+
//! Initialization Helpers
|
|
8
|
+
// Prevent creating the modal if it's already open
|
|
9
|
+
if (modalOpen) return;
|
|
10
|
+
modalOpen = true; // Set the flag to true
|
|
11
|
+
|
|
12
|
+
// Remove existing overlay if it exists
|
|
13
|
+
const existingOverlay = document.getElementById("OrangeDAMAssetBrowserPluginPopupOverlay");
|
|
14
|
+
if (existingOverlay) {
|
|
15
|
+
document.body.removeChild(existingOverlay);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//! Variables
|
|
19
|
+
const highestZIndex = 2147483647;
|
|
20
|
+
const minWidth = 400;
|
|
21
|
+
const minHeight = 400;
|
|
22
|
+
const buttonSize = { width: '24px', height: '24px' };
|
|
23
|
+
const buttonMargin = '-4px';
|
|
24
|
+
const borderRadius = '8px';
|
|
25
|
+
const transition = 'width 500ms, height 500ms, top 500ms, left 500ms, top 500ms, left 500ms';
|
|
26
|
+
const fontSize = '16px';
|
|
27
|
+
const headerHeight = '40px';
|
|
28
|
+
const iframeHeight = `calc(100% - ${headerHeight})`;
|
|
29
|
+
|
|
30
|
+
// Initial position and size
|
|
31
|
+
const initialTop = '20px';
|
|
32
|
+
const initialLeft = '20px';
|
|
33
|
+
const initialWidth = 'calc(100vw - 40px)';
|
|
34
|
+
const initialHeight = 'calc(100vh - 40px)';
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
//! Components
|
|
38
|
+
// Overlay
|
|
39
|
+
const overlay = document.createElement('div');
|
|
40
|
+
overlay.id = "OrangeDAMAssetBrowserPluginPopupOverlay";
|
|
41
|
+
overlay.style.display = 'none';
|
|
42
|
+
overlay.style.position = 'fixed';
|
|
43
|
+
overlay.style.top = '0';
|
|
44
|
+
overlay.style.left = '0';
|
|
45
|
+
overlay.style.width = '100%';
|
|
46
|
+
overlay.style.height = '100%';
|
|
47
|
+
overlay.style.zIndex = highestZIndex;
|
|
48
|
+
overlay.style.pointerEvents = 'none';
|
|
49
|
+
|
|
50
|
+
// Popup
|
|
51
|
+
const popup = document.createElement('div');
|
|
52
|
+
popup.style.display = 'none';
|
|
53
|
+
popup.style.position = 'absolute';
|
|
54
|
+
popup.style.backgroundColor = 'rgb(128, 128, 128)';
|
|
55
|
+
popup.style.boxShadow = '0 0 8px rgba(0, 0, 0, 0.5)';
|
|
56
|
+
popup.style.borderRadius = borderRadius;
|
|
57
|
+
popup.style.pointerEvents = 'auto';
|
|
58
|
+
|
|
59
|
+
// Header
|
|
60
|
+
const header = document.createElement('div');
|
|
61
|
+
header.style.display = 'none';
|
|
62
|
+
header.style.justifyContent = 'space-between';
|
|
63
|
+
header.style.backgroundColor = 'white';
|
|
64
|
+
header.style.color = 'gray';
|
|
65
|
+
header.style.padding = '12px';
|
|
66
|
+
header.style.textAlign = 'right';
|
|
67
|
+
header.style.position = 'relative';
|
|
68
|
+
header.style.borderTopLeftRadius = borderRadius;
|
|
69
|
+
header.style.borderTopRightRadius = borderRadius;
|
|
70
|
+
header.style.lineHeight = fontSize;
|
|
71
|
+
header.style.cursor = 'move';
|
|
72
|
+
header.style.userSelect = 'none';
|
|
73
|
+
header.style.borderBottom = '1px solid var(--cx-color-neutral-300)';
|
|
74
|
+
|
|
75
|
+
// SVG icon for minimize/restore
|
|
76
|
+
const minimizeButton = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
77
|
+
minimizeButton.setAttribute("focusable", "false");
|
|
78
|
+
minimizeButton.setAttribute("aria-hidden", "true");
|
|
79
|
+
minimizeButton.setAttribute("viewBox", "0 0 24 24");
|
|
80
|
+
const minimizePath = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
81
|
+
minimizePath.setAttribute("d", "M22 3.41 16.71 8.7 20 12h-8V4l3.29 3.29L20.59 2 22 3.41zM3.41 22l5.29-5.29L12 20v-8H4l3.29 3.29L2 20.59 3.41 22z");
|
|
82
|
+
minimizePath.style.pointerEvents = 'none';
|
|
83
|
+
minimizeButton.appendChild(minimizePath);
|
|
84
|
+
minimizeButton.style.cursor = 'pointer';
|
|
85
|
+
minimizeButton.style.width = buttonSize.width;
|
|
86
|
+
minimizeButton.style.height = buttonSize.height;
|
|
87
|
+
minimizeButton.style.margin = buttonMargin;
|
|
88
|
+
minimizeButton.style.fill = 'var(--color-secondary)';
|
|
89
|
+
|
|
90
|
+
// SVG icon for minimize/restore
|
|
91
|
+
const restoreButton = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
92
|
+
restoreButton.setAttribute("focusable", "false");
|
|
93
|
+
restoreButton.setAttribute("aria-hidden", "true");
|
|
94
|
+
restoreButton.setAttribute("viewBox", "0 0 24 24");
|
|
95
|
+
const restorePath = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
96
|
+
restorePath.setAttribute("d", "M21 11V3h-8l3.29 3.29-10 10L3 13v8h8l-3.29-3.29 10-10z");
|
|
97
|
+
restorePath.style.pointerEvents = 'none';
|
|
98
|
+
restoreButton.appendChild(restorePath);
|
|
99
|
+
restoreButton.style.cursor = 'pointer';
|
|
100
|
+
restoreButton.style.width = buttonSize.width;
|
|
101
|
+
restoreButton.style.height = buttonSize.height;
|
|
102
|
+
restoreButton.style.margin = buttonMargin;
|
|
103
|
+
restoreButton.style.display = 'none';
|
|
104
|
+
restoreButton.style.fill = 'var(--color-secondary)';
|
|
105
|
+
|
|
106
|
+
// close button
|
|
107
|
+
const closeButton = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
108
|
+
closeButton.setAttribute("focusable", "false");
|
|
109
|
+
closeButton.setAttribute("aria-hidden", "true");
|
|
110
|
+
closeButton.setAttribute("viewBox", "0 0 24 24");
|
|
111
|
+
const closePath = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
112
|
+
closePath.setAttribute("d", "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z");
|
|
113
|
+
closePath.style.pointerEvents = 'none';
|
|
114
|
+
closeButton.appendChild(closePath);
|
|
115
|
+
closeButton.style.cursor = 'pointer';
|
|
116
|
+
closeButton.style.width = buttonSize.width;
|
|
117
|
+
closeButton.style.height = buttonSize.height;
|
|
118
|
+
closeButton.style.margin = buttonMargin;
|
|
119
|
+
closeButton.style.fill = 'var(--color-secondary)';
|
|
120
|
+
|
|
121
|
+
const navigationGroup = document.createElement('div');
|
|
122
|
+
navigationGroup.style.display = 'flex';
|
|
123
|
+
navigationGroup.style.gap = '12px';
|
|
124
|
+
navigationGroup.appendChild(minimizeButton);
|
|
125
|
+
navigationGroup.appendChild(restoreButton);
|
|
126
|
+
navigationGroup.appendChild(closeButton);
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
// popup title
|
|
130
|
+
const popupTitle = document.createElement('span');
|
|
131
|
+
popupTitle.style.fontFamily = '"Fira Sans", Arial, Helvetica, sans-serif';
|
|
132
|
+
popupTitle.textContent = 'Orange DAM Asset Browser Extension';
|
|
133
|
+
popupTitle.style.color = 'var(--color-secondary)';
|
|
134
|
+
popupTitle.style.fontSize = fontSize;
|
|
135
|
+
popupTitle.style.cursor = 'move';
|
|
136
|
+
popupTitle.style.userSelect = 'none';
|
|
137
|
+
|
|
138
|
+
// iframe
|
|
139
|
+
const iframe = document.createElement('iframe');
|
|
140
|
+
iframe.src = iframeSrc;
|
|
141
|
+
iframe.style.width = '100%';
|
|
142
|
+
iframe.style.height = iframeHeight;
|
|
143
|
+
iframe.style.border = 'none';
|
|
144
|
+
iframe.style.borderBottomLeftRadius = borderRadius;
|
|
145
|
+
iframe.style.borderBottomRightRadius = borderRadius;
|
|
146
|
+
iframe.style.userSelect = 'none';
|
|
147
|
+
|
|
148
|
+
// Resize Functionality
|
|
149
|
+
const resizer = document.createElement('div');
|
|
150
|
+
resizer.style.width = '10px';
|
|
151
|
+
resizer.style.height = '10px';
|
|
152
|
+
resizer.style.position = 'absolute';
|
|
153
|
+
resizer.style.right = '2px';
|
|
154
|
+
resizer.style.bottom = '2px';
|
|
155
|
+
resizer.style.overflow = 'auto';
|
|
156
|
+
resizer.style.resize = 'both';
|
|
157
|
+
resizer.style.cursor = 'se-resize';
|
|
158
|
+
|
|
159
|
+
//! Functions
|
|
160
|
+
function savePopupState() {
|
|
161
|
+
const popupState = {
|
|
162
|
+
width: popup.style.width,
|
|
163
|
+
height: popup.style.height,
|
|
164
|
+
top: popup.style.top,
|
|
165
|
+
left: popup.style.left
|
|
166
|
+
};
|
|
167
|
+
storage.local.set({ popupState });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function restorePopupState() {
|
|
171
|
+
return new Promise((resolve) => {
|
|
172
|
+
storage.local.get('popupState', function (data) {
|
|
173
|
+
if (data.popupState) {
|
|
174
|
+
let top = parseInt(data.popupState.top, 10);
|
|
175
|
+
let left = parseInt(data.popupState.left, 10);
|
|
176
|
+
|
|
177
|
+
// Limit the left position
|
|
178
|
+
if (left < 0) left = 0;
|
|
179
|
+
if (left + popup.offsetWidth > window.innerWidth) {
|
|
180
|
+
left = window.innerWidth - popup.offsetWidth;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Limit the top position
|
|
184
|
+
if (top < 0) top = 0;
|
|
185
|
+
if (top + popup.offsetHeight > window.innerHeight) {
|
|
186
|
+
top = window.innerHeight - popup.offsetHeight;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
popup.style.left = left + 'px';
|
|
190
|
+
popup.style.top = top + 'px';
|
|
191
|
+
popup.style.width = data.popupState.width;
|
|
192
|
+
popup.style.height = data.popupState.height;
|
|
193
|
+
popup.style.transform = 'none';
|
|
194
|
+
} else {
|
|
195
|
+
// Center the popup if no position is saved
|
|
196
|
+
popup.style.top = initialTop;
|
|
197
|
+
popup.style.left = initialLeft;
|
|
198
|
+
popup.style.width = initialWidth;
|
|
199
|
+
popup.style.height = initialHeight;
|
|
200
|
+
}
|
|
201
|
+
resolve();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function minimizeModal() {
|
|
207
|
+
restoreButton.style.display = "block";
|
|
208
|
+
minimizeButton.style.display = "none";
|
|
209
|
+
header.style.cursor = 'default';
|
|
210
|
+
popupTitle.style.cursor = 'default';
|
|
211
|
+
popup.style.width = '500px';
|
|
212
|
+
popup.style.height = '40px';
|
|
213
|
+
popup.style.overflow = 'hidden';
|
|
214
|
+
popup.style.top = 'calc(100vh - 60px)';
|
|
215
|
+
popup.style.left = 'calc(100vw - 524px)';
|
|
216
|
+
popup.style.transition = transition;
|
|
217
|
+
resizer.style.display = 'none';
|
|
218
|
+
minimized = true;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function restoreModal() {
|
|
222
|
+
restoreButton.style.display = "none";
|
|
223
|
+
minimizeButton.style.display = "block";
|
|
224
|
+
header.style.cursor = 'move';
|
|
225
|
+
popupTitle.style.cursor = 'move';
|
|
226
|
+
popup.style.overflow = 'unset';
|
|
227
|
+
resizer.style.display = 'block';
|
|
228
|
+
popup.style.transition = transition;
|
|
229
|
+
minimized = false;
|
|
230
|
+
restorePopupState();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function closeModal() {
|
|
234
|
+
document.body.removeChild(overlay);
|
|
235
|
+
modalOpen = false;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function initResize(e) {
|
|
239
|
+
popup.style.transition = 'none'; // Remove transition to prevent animation for resizing
|
|
240
|
+
popup.style.pointerEvents = 'none';
|
|
241
|
+
popup.style.transform = 'none';
|
|
242
|
+
window.addEventListener('mousemove', resize);
|
|
243
|
+
window.addEventListener('mouseup', stopResize);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function resize(e) {
|
|
247
|
+
let newWidth = e.clientX - popup.offsetLeft;
|
|
248
|
+
let newHeight = e.clientY - popup.offsetTop;
|
|
249
|
+
|
|
250
|
+
// Enforce minimum width and height
|
|
251
|
+
if (newWidth < minWidth) newWidth = minWidth;
|
|
252
|
+
if (newHeight < minHeight) newHeight = minHeight;
|
|
253
|
+
|
|
254
|
+
popup.style.width = newWidth + 'px';
|
|
255
|
+
popup.style.height = newHeight + 'px';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function stopResize() {
|
|
259
|
+
popup.style.pointerEvents = 'auto';
|
|
260
|
+
resizer.style.width = '10px';
|
|
261
|
+
resizer.style.height = '10px';
|
|
262
|
+
window.removeEventListener('mousemove', resize);
|
|
263
|
+
window.removeEventListener('mouseup', stopResize);
|
|
264
|
+
savePopupState();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function initMove(e) {
|
|
268
|
+
if (minimized || e.target === minimizeButton || e.target === restoreButton || e.target === closeButton) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
popup.style.transition = 'none'; // Remove transition to prevent animation for resizing
|
|
272
|
+
popup.style.pointerEvents = 'none';
|
|
273
|
+
popup.style.transform = 'none';
|
|
274
|
+
const offsetX = e.clientX - popup.offsetLeft;
|
|
275
|
+
const offsetY = e.clientY - popup.offsetTop;
|
|
276
|
+
window.addEventListener('mousemove', move);
|
|
277
|
+
window.addEventListener('mouseup', stopMove);
|
|
278
|
+
|
|
279
|
+
function move(e) {
|
|
280
|
+
let newLeft = e.clientX - offsetX;
|
|
281
|
+
let newTop = e.clientY - offsetY;
|
|
282
|
+
|
|
283
|
+
// Limit the left position
|
|
284
|
+
if (newLeft < 0) newLeft = 0;
|
|
285
|
+
if (newLeft + popup.offsetWidth > window.innerWidth) {
|
|
286
|
+
newLeft = window.innerWidth - popup.offsetWidth;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Limit the top position
|
|
290
|
+
if (newTop < 0) newTop = 0;
|
|
291
|
+
if (newTop + popup.offsetHeight > window.innerHeight) {
|
|
292
|
+
newTop = window.innerHeight - popup.offsetHeight;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
popup.style.left = newLeft + 'px';
|
|
296
|
+
popup.style.top = newTop + 'px';
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function stopMove() {
|
|
300
|
+
popup.style.pointerEvents = 'auto';
|
|
301
|
+
window.removeEventListener('mousemove', move);
|
|
302
|
+
window.removeEventListener('mouseup', stopMove);
|
|
303
|
+
savePopupState();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
//! Event Listeners
|
|
308
|
+
minimizeButton.addEventListener('click', function () {
|
|
309
|
+
minimizeModal();
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
restoreButton.addEventListener('click', function () {
|
|
313
|
+
restoreModal();
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
closeButton.addEventListener('click', function () {
|
|
317
|
+
closeModal();
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
header.addEventListener('click', function (e) {
|
|
321
|
+
if (e.target === header || e.target === popupTitle && minimized) {
|
|
322
|
+
restoreModal();
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
resizer.addEventListener('mousedown', initResize);
|
|
327
|
+
header.addEventListener('mousedown', initMove);
|
|
328
|
+
|
|
329
|
+
//? Restore popup location and size
|
|
330
|
+
restorePopupState().then(() => {
|
|
331
|
+
// Append elements
|
|
332
|
+
header.appendChild(popupTitle);
|
|
333
|
+
header.appendChild(navigationGroup);
|
|
334
|
+
popup.appendChild(header);
|
|
335
|
+
popup.appendChild(iframe);
|
|
336
|
+
overlay.appendChild(popup);
|
|
337
|
+
document.body.appendChild(overlay);
|
|
338
|
+
popup.appendChild(resizer);
|
|
339
|
+
// Display the popup
|
|
340
|
+
overlay.style.display = 'block';
|
|
341
|
+
popup.style.display = 'block';
|
|
342
|
+
header.style.display = 'flex';
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Call the function with the desired iframe source
|
|
347
|
+
createModal('http://localhost:5500/GAB.html');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
Orange DAM Asset Browser Plugin using GAB as core
|
|
3
|
+
|
|
4
|
+
# Getting Started
|
|
5
|
+
Follow manual plugin installation guide for the respecive platform
|
|
6
|
+
Serve the GAB.html file on your local host
|
|
7
|
+
Edit the URL in src/scripts.index in createModal() function
|
|
8
|
+
Invoke the Plugin from browser
|
|
9
|
+
|
|
10
|
+
# Build and Test
|
|
11
|
+
TODO: Describe and show how to build your code and run the tests.
|