@orangelogic/orange-dam-content-browser-sdk 2.1.55 → 2.2.0-beta
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,128 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
|
|
6
|
+
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
|
|
7
|
+
const ignoredFiles = require('react-dev-utils/ignoredFiles');
|
|
8
|
+
const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
|
|
9
|
+
const paths = require('./paths');
|
|
10
|
+
const getHttpsConfig = require('./getHttpsConfig');
|
|
11
|
+
|
|
12
|
+
const host = process.env.HOST || '0.0.0.0';
|
|
13
|
+
const sockHost = process.env.WDS_SOCKET_HOST;
|
|
14
|
+
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
|
|
15
|
+
const sockPort = process.env.WDS_SOCKET_PORT;
|
|
16
|
+
|
|
17
|
+
module.exports = function (proxy, allowedHost) {
|
|
18
|
+
const disableFirewall =
|
|
19
|
+
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
|
|
20
|
+
return {
|
|
21
|
+
// WebpackDevServer 2.4.3 introduced a security fix that prevents remote
|
|
22
|
+
// websites from potentially accessing local content through DNS rebinding:
|
|
23
|
+
// https://github.com/webpack/webpack-dev-server/issues/887
|
|
24
|
+
// https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
|
|
25
|
+
// However, it made several existing use cases such as development in cloud
|
|
26
|
+
// environment or subdomains in development significantly more complicated:
|
|
27
|
+
// https://github.com/facebook/create-react-app/issues/2271
|
|
28
|
+
// https://github.com/facebook/create-react-app/issues/2233
|
|
29
|
+
// While we're investigating better solutions, for now we will take a
|
|
30
|
+
// compromise. Since our WDS configuration only serves files in the `public`
|
|
31
|
+
// folder we won't consider accessing them a vulnerability. However, if you
|
|
32
|
+
// use the `proxy` feature, it gets more dangerous because it can expose
|
|
33
|
+
// remote code execution vulnerabilities in backends like Django and Rails.
|
|
34
|
+
// So we will disable the host check normally, but enable it if you have
|
|
35
|
+
// specified the `proxy` setting. Finally, we let you override it if you
|
|
36
|
+
// really know what you're doing with a special environment variable.
|
|
37
|
+
// Note: ["localhost", ".localhost"] will support subdomains - but we might
|
|
38
|
+
// want to allow setting the allowedHosts manually for more complex setups
|
|
39
|
+
allowedHosts: disableFirewall ? 'all' : [allowedHost],
|
|
40
|
+
headers: {
|
|
41
|
+
'Access-Control-Allow-Origin': '*',
|
|
42
|
+
'Access-Control-Allow-Methods': '*',
|
|
43
|
+
'Access-Control-Allow-Headers': '*',
|
|
44
|
+
},
|
|
45
|
+
// Enable gzip compression of generated files.
|
|
46
|
+
compress: true,
|
|
47
|
+
static: {
|
|
48
|
+
// By default WebpackDevServer serves physical files from current directory
|
|
49
|
+
// in addition to all the virtual build products that it serves from memory.
|
|
50
|
+
// This is confusing because those files won’t automatically be available in
|
|
51
|
+
// production build folder unless we copy them. However, copying the whole
|
|
52
|
+
// project directory is dangerous because we may expose sensitive files.
|
|
53
|
+
// Instead, we establish a convention that only files in `public` directory
|
|
54
|
+
// get served. Our build script will copy `public` into the `build` folder.
|
|
55
|
+
// In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
|
|
56
|
+
// <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
|
|
57
|
+
// In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
|
|
58
|
+
// Note that we only recommend to use `public` folder as an escape hatch
|
|
59
|
+
// for files like `favicon.ico`, `manifest.json`, and libraries that are
|
|
60
|
+
// for some reason broken when imported through webpack. If you just want to
|
|
61
|
+
// use an image, put it in `src` and `import` it from JavaScript instead.
|
|
62
|
+
directory: paths.appPublic,
|
|
63
|
+
publicPath: [paths.publicUrlOrPath],
|
|
64
|
+
// By default files from `contentBase` will not trigger a page reload.
|
|
65
|
+
watch: {
|
|
66
|
+
// Reportedly, this avoids CPU overload on some systems.
|
|
67
|
+
// https://github.com/facebook/create-react-app/issues/293
|
|
68
|
+
// src/node_modules is not ignored to support absolute imports
|
|
69
|
+
// https://github.com/facebook/create-react-app/issues/1065
|
|
70
|
+
ignored: ignoredFiles(paths.appSrc),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
client: {
|
|
74
|
+
webSocketURL: {
|
|
75
|
+
// Enable custom sockjs pathname for websocket connection to hot reloading server.
|
|
76
|
+
// Enable custom sockjs hostname, pathname and port for websocket connection
|
|
77
|
+
// to hot reloading server.
|
|
78
|
+
hostname: sockHost,
|
|
79
|
+
pathname: sockPath,
|
|
80
|
+
port: sockPort,
|
|
81
|
+
},
|
|
82
|
+
overlay: {
|
|
83
|
+
errors: true,
|
|
84
|
+
warnings: false,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
devMiddleware: {
|
|
88
|
+
// It is important to tell WebpackDevServer to use the same "publicPath" path as
|
|
89
|
+
// we specified in the webpack config. When homepage is '.', default to serving
|
|
90
|
+
// from the root.
|
|
91
|
+
// remove last slash so user can land on `/test` instead of `/test/`
|
|
92
|
+
publicPath: paths.publicUrlOrPath.slice(0, -1),
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
https: getHttpsConfig(),
|
|
96
|
+
host,
|
|
97
|
+
historyApiFallback: {
|
|
98
|
+
// Paths with dots should still use the history fallback.
|
|
99
|
+
// See https://github.com/facebook/create-react-app/issues/387.
|
|
100
|
+
disableDotRule: true,
|
|
101
|
+
index: paths.publicUrlOrPath,
|
|
102
|
+
},
|
|
103
|
+
// `proxy` is run between `before` and `after` `webpack-dev-server` hooks
|
|
104
|
+
proxy,
|
|
105
|
+
onBeforeSetupMiddleware(devServer) {
|
|
106
|
+
// Keep `evalSourceMapMiddleware`
|
|
107
|
+
// middlewares before `redirectServedPath` otherwise will not have any effect
|
|
108
|
+
// This lets us fetch source contents from webpack for the error overlay
|
|
109
|
+
devServer.app.use(evalSourceMapMiddleware(devServer));
|
|
110
|
+
|
|
111
|
+
if (fs.existsSync(paths.proxySetup)) {
|
|
112
|
+
// This registers user provided middleware for proxy reasons
|
|
113
|
+
require(paths.proxySetup)(devServer.app);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
onAfterSetupMiddleware(devServer) {
|
|
117
|
+
// Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
|
|
118
|
+
devServer.app.use(redirectServedPath(paths.publicUrlOrPath));
|
|
119
|
+
|
|
120
|
+
// This service worker file is effectively a 'no-op' that will reset any
|
|
121
|
+
// previous service worker registered for the same host:port combination.
|
|
122
|
+
// We do this in development to avoid hitting the production cache if
|
|
123
|
+
// it used the same host and port.
|
|
124
|
+
// https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
|
|
125
|
+
devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap">
|
|
6
|
+
<script src="https://downloads.orangelogic.com/Cortex/AssetBrowser/v2.2.0-beta/OrangeDamAssetBrowser.min.js"></script>
|
|
7
|
+
<link rel="stylesheet" type="text/css"
|
|
8
|
+
href="https://downloads.orangelogic.com/Cortex/AssetBrowser/v2.2.0-beta/OrangeDamAssetBrowser.min.css">
|
|
9
|
+
<style>
|
|
10
|
+
#orangelogic-GAB-browser-wrapper {
|
|
11
|
+
min-width: 382px;
|
|
12
|
+
min-height: 360px;
|
|
13
|
+
width: 100vw;
|
|
14
|
+
height: 100vh;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
</head>
|
|
19
|
+
|
|
20
|
+
<body onload="myFunction()" allow="clipboard-read; clipboard-write"
|
|
21
|
+
style="background-color: rgb(255, 255, 255); margin:0;">
|
|
22
|
+
<div id="orangelogic-GAB-browser-wrapper">
|
|
23
|
+
</div>
|
|
24
|
+
</body>
|
|
25
|
+
<script>
|
|
26
|
+
function myFunction() {
|
|
27
|
+
CortexAssetPicker.open({
|
|
28
|
+
onError: console.error,
|
|
29
|
+
// baseUrl: "local.orangelogic.com",
|
|
30
|
+
availableDocTypes: ['Images', 'Videos', 'Audio', 'Others'],
|
|
31
|
+
availableRepresentativeSubtypes: ['Standard Image', 'Other'],
|
|
32
|
+
displayInfo: {
|
|
33
|
+
title: true,
|
|
34
|
+
dimension: true,
|
|
35
|
+
fileSize: true,
|
|
36
|
+
tags: false,
|
|
37
|
+
},
|
|
38
|
+
extraFields: ['coreField.OriginalFileName', 'coreField.DocType'],
|
|
39
|
+
multiSelect: false, // single or multiple file picker
|
|
40
|
+
persistMode: true,
|
|
41
|
+
// pluginName: "Generic Asset Browser",
|
|
42
|
+
// pluginShortName: "GAB"
|
|
43
|
+
searchInDrive: false,
|
|
44
|
+
showCollections: true,
|
|
45
|
+
containerId: "orangelogic-GAB-browser-wrapper",
|
|
46
|
+
onClose: () => { },
|
|
47
|
+
onAssetSelected: function (assets) {
|
|
48
|
+
if (assets && assets.length > 0) {
|
|
49
|
+
console.table(assets);
|
|
50
|
+
const imageUrl = assets[0].imageUrl;
|
|
51
|
+
function copyToClipboard(text) {
|
|
52
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
53
|
+
console.log('Text copied to clipboard:', text);
|
|
54
|
+
}).catch(err => {
|
|
55
|
+
console.warn('Failed to copy text to clipboard:', err);
|
|
56
|
+
|
|
57
|
+
// Use the 'out of viewport hidden text area' trick
|
|
58
|
+
const textArea = document.createElement("textarea");
|
|
59
|
+
textArea.value = text;
|
|
60
|
+
|
|
61
|
+
// Move textarea out of the viewport so it's not visible
|
|
62
|
+
textArea.style.position = "absolute";
|
|
63
|
+
textArea.style.left = "-999999px";
|
|
64
|
+
|
|
65
|
+
document.body.prepend(textArea);
|
|
66
|
+
textArea.select();
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
document.execCommand('copy');
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error(error);
|
|
72
|
+
} finally {
|
|
73
|
+
textArea.remove();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
copyToClipboard(imageUrl);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"name": "Orange DAM Asset Browser Extension",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"icons": {
|
|
6
|
+
"16": "src/assets/icon48.png",
|
|
7
|
+
"32": "src/assets/icon48.png",
|
|
8
|
+
"48": "src/assets/icon48.png",
|
|
9
|
+
"128": "src/assets/icon48.png"
|
|
10
|
+
},
|
|
11
|
+
"description": "Get Orange DAM Assets everywhere",
|
|
12
|
+
"externally_connectable": {
|
|
13
|
+
"matches": [ "*://*/*"]
|
|
14
|
+
},
|
|
15
|
+
"action": {
|
|
16
|
+
"default_icon":{
|
|
17
|
+
"16":"src/assets/icon48.png",
|
|
18
|
+
"24":"src/assets/icon48.png",
|
|
19
|
+
"32":"src/assets/icon48.png",
|
|
20
|
+
"48":"src/assets/icon48.png"
|
|
21
|
+
},
|
|
22
|
+
"default_title": "Orange DAM Asset Browser Extension"
|
|
23
|
+
},
|
|
24
|
+
"permissions":["scripting","activeTab","storage","clipboard"],
|
|
25
|
+
"background":{
|
|
26
|
+
"service_worker":"src/background/index.js"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
Binary file
|
|
@@ -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,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 2,
|
|
3
|
+
"name": "Orange DAM Asset Browser Extension",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"icons": {
|
|
6
|
+
"16": "src/assets/icon48.png",
|
|
7
|
+
"32": "src/assets/icon48.png",
|
|
8
|
+
"48": "src/assets/icon48.png",
|
|
9
|
+
"128": "src/assets/icon48.png"
|
|
10
|
+
},
|
|
11
|
+
"description": "Get Orange DAM Assets everywhere",
|
|
12
|
+
"browser_action": {
|
|
13
|
+
"default_icon": "src/assets/icon.png",
|
|
14
|
+
"default_title": "Orange DAM Asset Browser Extension"
|
|
15
|
+
},
|
|
16
|
+
"permissions":["scripting","activeTab","storage","clipboard"],
|
|
17
|
+
"background": {
|
|
18
|
+
"scripts": ["src/background/index.js"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
Binary file
|