ae-agent-setup 0.2.0

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.
Files changed (34) hide show
  1. package/CSXS/manifest.xml +44 -0
  2. package/README.ja.md +249 -0
  3. package/README.md +249 -0
  4. package/bin/ae-agent-setup.mjs +337 -0
  5. package/client/CSInterface.js +1291 -0
  6. package/client/index.html +64 -0
  7. package/client/lib/bridge_utils.js +56 -0
  8. package/client/lib/logging.js +10 -0
  9. package/client/lib/request_handlers.js +468 -0
  10. package/client/lib/request_handlers_essential.js +35 -0
  11. package/client/lib/request_handlers_layer_structure.js +180 -0
  12. package/client/lib/request_handlers_scene.js +38 -0
  13. package/client/lib/request_handlers_shape.js +288 -0
  14. package/client/lib/request_handlers_timeline.js +115 -0
  15. package/client/lib/runtime.js +35 -0
  16. package/client/lib/server.js +33 -0
  17. package/client/main.js +1 -0
  18. package/host/index.jsx +11 -0
  19. package/host/json2.js +504 -0
  20. package/host/lib/common.jsx +128 -0
  21. package/host/lib/mutation_handlers.jsx +358 -0
  22. package/host/lib/mutation_keyframe_handlers.jsx +265 -0
  23. package/host/lib/mutation_layer_structure_handlers.jsx +235 -0
  24. package/host/lib/mutation_scene_handlers.jsx +1226 -0
  25. package/host/lib/mutation_shape_handlers.jsx +358 -0
  26. package/host/lib/mutation_timeline_handlers.jsx +137 -0
  27. package/host/lib/property_utils.jsx +105 -0
  28. package/host/lib/query_handlers.jsx +427 -0
  29. package/package.json +21 -0
  30. package/scripts/signing/build-zxp.sh +56 -0
  31. package/scripts/signing/create-dev-cert.sh +97 -0
  32. package/scripts/signing/install-zxp.sh +29 -0
  33. package/templates/skills/aftereffects-cli.SKILL.md +74 -0
  34. package/templates/skills/aftereffects-declarative.SKILL.md +112 -0
@@ -0,0 +1,1291 @@
1
+ /**************************************************************************************************
2
+ *
3
+ * ADOBE SYSTEMS INCORPORATED
4
+ * Copyright 2020 Adobe Systems Incorporated
5
+ * All Rights Reserved.
6
+ *
7
+ * NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
8
+ * terms of the Adobe license agreement accompanying it. If you have received this file from a
9
+ * source other than Adobe, then your use, modification, or distribution of it requires the prior
10
+ * written permission of Adobe.
11
+ *
12
+ **************************************************************************************************/
13
+
14
+ /** CSInterface - v12.0.0 */
15
+
16
+ /**
17
+ * Stores constants for the window types supported by the CSXS infrastructure.
18
+ */
19
+ function CSXSWindowType()
20
+ {
21
+ }
22
+
23
+ /** Constant for the CSXS window type Panel. */
24
+ CSXSWindowType._PANEL = "Panel";
25
+
26
+ /** Constant for the CSXS window type Modeless. */
27
+ CSXSWindowType._MODELESS = "Modeless";
28
+
29
+ /** Constant for the CSXS window type ModalDialog. */
30
+ CSXSWindowType._MODAL_DIALOG = "ModalDialog";
31
+
32
+ /** EvalScript error message */
33
+ EvalScript_ErrMessage = "EvalScript error.";
34
+
35
+ /**
36
+ * @class Version
37
+ * Defines a version number with major, minor, micro, and special
38
+ * components. The major, minor and micro values are numeric; the special
39
+ * value can be any string.
40
+ *
41
+ * @param major The major version component, a positive integer up to nine digits long.
42
+ * @param minor The minor version component, a positive integer up to nine digits long.
43
+ * @param micro The micro version component, a positive integer up to nine digits long.
44
+ * @param special The special version component, an arbitrary string.
45
+ *
46
+ * @return A new \c Version object.
47
+ */
48
+ function Version(major, minor, micro, special)
49
+ {
50
+ this.major = major;
51
+ this.minor = minor;
52
+ this.micro = micro;
53
+ this.special = special;
54
+ }
55
+
56
+ /**
57
+ * The maximum value allowed for a numeric version component.
58
+ * This reflects the maximum value allowed in PlugPlug and the manifest schema.
59
+ */
60
+ Version.MAX_NUM = 999999999;
61
+
62
+ /**
63
+ * @class VersionBound
64
+ * Defines a boundary for a version range, which associates a \c Version object
65
+ * with a flag for whether it is an inclusive or exclusive boundary.
66
+ *
67
+ * @param version The \c #Version object.
68
+ * @param inclusive True if this boundary is inclusive, false if it is exclusive.
69
+ *
70
+ * @return A new \c VersionBound object.
71
+ */
72
+ function VersionBound(version, inclusive)
73
+ {
74
+ this.version = version;
75
+ this.inclusive = inclusive;
76
+ }
77
+
78
+ /**
79
+ * @class VersionRange
80
+ * Defines a range of versions using a lower boundary and optional upper boundary.
81
+ *
82
+ * @param lowerBound The \c #VersionBound object.
83
+ * @param upperBound The \c #VersionBound object, or null for a range with no upper boundary.
84
+ *
85
+ * @return A new \c VersionRange object.
86
+ */
87
+ function VersionRange(lowerBound, upperBound)
88
+ {
89
+ this.lowerBound = lowerBound;
90
+ this.upperBound = upperBound;
91
+ }
92
+
93
+ /**
94
+ * @class Runtime
95
+ * Represents a runtime related to the CEP infrastructure.
96
+ * Extensions can declare dependencies on particular
97
+ * CEP runtime versions in the extension manifest.
98
+ *
99
+ * @param name The runtime name.
100
+ * @param version A \c #VersionRange object that defines a range of valid versions.
101
+ *
102
+ * @return A new \c Runtime object.
103
+ */
104
+ function Runtime(name, versionRange)
105
+ {
106
+ this.name = name;
107
+ this.versionRange = versionRange;
108
+ }
109
+
110
+ /**
111
+ * @class Extension
112
+ * Encapsulates a CEP-based extension to an Adobe application.
113
+ *
114
+ * @param id The unique identifier of this extension.
115
+ * @param name The localizable display name of this extension.
116
+ * @param mainPath The path of the "index.html" file.
117
+ * @param basePath The base path of this extension.
118
+ * @param windowType The window type of the main window of this extension.
119
+ Valid values are defined by \c #CSXSWindowType.
120
+ * @param width The default width in pixels of the main window of this extension.
121
+ * @param height The default height in pixels of the main window of this extension.
122
+ * @param minWidth The minimum width in pixels of the main window of this extension.
123
+ * @param minHeight The minimum height in pixels of the main window of this extension.
124
+ * @param maxWidth The maximum width in pixels of the main window of this extension.
125
+ * @param maxHeight The maximum height in pixels of the main window of this extension.
126
+ * @param defaultExtensionDataXml The extension data contained in the default \c ExtensionDispatchInfo section of the extension manifest.
127
+ * @param specialExtensionDataXml The extension data contained in the application-specific \c ExtensionDispatchInfo section of the extension manifest.
128
+ * @param requiredRuntimeList An array of \c Runtime objects for runtimes required by this extension.
129
+ * @param isAutoVisible True if this extension is visible on loading.
130
+ * @param isPluginExtension True if this extension has been deployed in the Plugins folder of the host application.
131
+ *
132
+ * @return A new \c Extension object.
133
+ */
134
+ function Extension(id, name, mainPath, basePath, windowType, width, height, minWidth, minHeight, maxWidth, maxHeight,
135
+ defaultExtensionDataXml, specialExtensionDataXml, requiredRuntimeList, isAutoVisible, isPluginExtension)
136
+ {
137
+ this.id = id;
138
+ this.name = name;
139
+ this.mainPath = mainPath;
140
+ this.basePath = basePath;
141
+ this.windowType = windowType;
142
+ this.width = width;
143
+ this.height = height;
144
+ this.minWidth = minWidth;
145
+ this.minHeight = minHeight;
146
+ this.maxWidth = maxWidth;
147
+ this.maxHeight = maxHeight;
148
+ this.defaultExtensionDataXml = defaultExtensionDataXml;
149
+ this.specialExtensionDataXml = specialExtensionDataXml;
150
+ this.requiredRuntimeList = requiredRuntimeList;
151
+ this.isAutoVisible = isAutoVisible;
152
+ this.isPluginExtension = isPluginExtension;
153
+ }
154
+
155
+ /**
156
+ * @class CSEvent
157
+ * A standard JavaScript event, the base class for CEP events.
158
+ *
159
+ * @param type The name of the event type.
160
+ * @param scope The scope of event, can be "GLOBAL" or "APPLICATION".
161
+ * @param appId The unique identifier of the application that generated the event.
162
+ * @param extensionId The unique identifier of the extension that generated the event.
163
+ *
164
+ * @return A new \c CSEvent object
165
+ */
166
+ function CSEvent(type, scope, appId, extensionId)
167
+ {
168
+ this.type = type;
169
+ this.scope = scope;
170
+ this.appId = appId;
171
+ this.extensionId = extensionId;
172
+ }
173
+
174
+ /** Event-specific data. */
175
+ CSEvent.prototype.data = "";
176
+
177
+ /**
178
+ * @class SystemPath
179
+ * Stores operating-system-specific location constants for use in the
180
+ * \c #CSInterface.getSystemPath() method.
181
+ * @return A new \c SystemPath object.
182
+ */
183
+ function SystemPath()
184
+ {
185
+ }
186
+
187
+ /** The path to user data. */
188
+ SystemPath.USER_DATA = "userData";
189
+
190
+ /** The path to common files for Adobe applications. */
191
+ SystemPath.COMMON_FILES = "commonFiles";
192
+
193
+ /** The path to the user's default document folder. */
194
+ SystemPath.MY_DOCUMENTS = "myDocuments";
195
+
196
+ /** @deprecated. Use \c #SystemPath.Extension. */
197
+ SystemPath.APPLICATION = "application";
198
+
199
+ /** The path to current extension. */
200
+ SystemPath.EXTENSION = "extension";
201
+
202
+ /** The path to hosting application's executable. */
203
+ SystemPath.HOST_APPLICATION = "hostApplication";
204
+
205
+ /**
206
+ * @class ColorType
207
+ * Stores color-type constants.
208
+ */
209
+ function ColorType()
210
+ {
211
+ }
212
+
213
+ /** RGB color type. */
214
+ ColorType.RGB = "rgb";
215
+
216
+ /** Gradient color type. */
217
+ ColorType.GRADIENT = "gradient";
218
+
219
+ /** Null color type. */
220
+ ColorType.NONE = "none";
221
+
222
+ /**
223
+ * @class RGBColor
224
+ * Stores an RGB color with red, green, blue, and alpha values.
225
+ * All values are in the range [0.0 to 255.0]. Invalid numeric values are
226
+ * converted to numbers within this range.
227
+ *
228
+ * @param red The red value, in the range [0.0 to 255.0].
229
+ * @param green The green value, in the range [0.0 to 255.0].
230
+ * @param blue The blue value, in the range [0.0 to 255.0].
231
+ * @param alpha The alpha (transparency) value, in the range [0.0 to 255.0].
232
+ * The default, 255.0, means that the color is fully opaque.
233
+ *
234
+ * @return A new RGBColor object.
235
+ */
236
+ function RGBColor(red, green, blue, alpha)
237
+ {
238
+ this.red = red;
239
+ this.green = green;
240
+ this.blue = blue;
241
+ this.alpha = alpha;
242
+ }
243
+
244
+ /**
245
+ * @class Direction
246
+ * A point value in which the y component is 0 and the x component
247
+ * is positive or negative for a right or left direction,
248
+ * or the x component is 0 and the y component is positive or negative for
249
+ * an up or down direction.
250
+ *
251
+ * @param x The horizontal component of the point.
252
+ * @param y The vertical component of the point.
253
+ *
254
+ * @return A new \c Direction object.
255
+ */
256
+ function Direction(x, y)
257
+ {
258
+ this.x = x;
259
+ this.y = y;
260
+ }
261
+
262
+ /**
263
+ * @class GradientStop
264
+ * Stores gradient stop information.
265
+ *
266
+ * @param offset The offset of the gradient stop, in the range [0.0 to 1.0].
267
+ * @param rgbColor The color of the gradient at this point, an \c #RGBColor object.
268
+ *
269
+ * @return GradientStop object.
270
+ */
271
+ function GradientStop(offset, rgbColor)
272
+ {
273
+ this.offset = offset;
274
+ this.rgbColor = rgbColor;
275
+ }
276
+
277
+ /**
278
+ * @class GradientColor
279
+ * Stores gradient color information.
280
+ *
281
+ * @param type The gradient type, must be "linear".
282
+ * @param direction A \c #Direction object for the direction of the gradient
283
+ (up, down, right, or left).
284
+ * @param numStops The number of stops in the gradient.
285
+ * @param gradientStopList An array of \c #GradientStop objects.
286
+ *
287
+ * @return A new \c GradientColor object.
288
+ */
289
+ function GradientColor(type, direction, numStops, arrGradientStop)
290
+ {
291
+ this.type = type;
292
+ this.direction = direction;
293
+ this.numStops = numStops;
294
+ this.arrGradientStop = arrGradientStop;
295
+ }
296
+
297
+ /**
298
+ * @class UIColor
299
+ * Stores color information, including the type, anti-alias level, and specific color
300
+ * values in a color object of an appropriate type.
301
+ *
302
+ * @param type The color type, 1 for "rgb" and 2 for "gradient".
303
+ The supplied color object must correspond to this type.
304
+ * @param antialiasLevel The anti-alias level constant.
305
+ * @param color A \c #RGBColor or \c #GradientColor object containing specific color information.
306
+ *
307
+ * @return A new \c UIColor object.
308
+ */
309
+ function UIColor(type, antialiasLevel, color)
310
+ {
311
+ this.type = type;
312
+ this.antialiasLevel = antialiasLevel;
313
+ this.color = color;
314
+ }
315
+
316
+ /**
317
+ * @class AppSkinInfo
318
+ * Stores window-skin properties, such as color and font. All color parameter values are \c #UIColor objects except that systemHighlightColor is \c #RGBColor object.
319
+ *
320
+ * @param baseFontFamily The base font family of the application.
321
+ * @param baseFontSize The base font size of the application.
322
+ * @param appBarBackgroundColor The application bar background color.
323
+ * @param panelBackgroundColor The background color of the extension panel.
324
+ * @param appBarBackgroundColorSRGB The application bar background color, as sRGB.
325
+ * @param panelBackgroundColorSRGB The background color of the extension panel, as sRGB.
326
+ * @param systemHighlightColor The highlight color of the extension panel, if provided by the host application. Otherwise, the operating-system highlight color.
327
+ *
328
+ * @return AppSkinInfo object.
329
+ */
330
+ function AppSkinInfo(baseFontFamily, baseFontSize, appBarBackgroundColor, panelBackgroundColor, appBarBackgroundColorSRGB, panelBackgroundColorSRGB, systemHighlightColor)
331
+ {
332
+ this.baseFontFamily = baseFontFamily;
333
+ this.baseFontSize = baseFontSize;
334
+ this.appBarBackgroundColor = appBarBackgroundColor;
335
+ this.panelBackgroundColor = panelBackgroundColor;
336
+ this.appBarBackgroundColorSRGB = appBarBackgroundColorSRGB;
337
+ this.panelBackgroundColorSRGB = panelBackgroundColorSRGB;
338
+ this.systemHighlightColor = systemHighlightColor;
339
+ }
340
+
341
+ /**
342
+ * @class HostEnvironment
343
+ * Stores information about the environment in which the extension is loaded.
344
+ *
345
+ * @param appName The application's name.
346
+ * @param appVersion The application's version.
347
+ * @param appLocale The application's current license locale.
348
+ * @param appUILocale The application's current UI locale.
349
+ * @param appId The application's unique identifier.
350
+ * @param isAppOnline True if the application is currently online.
351
+ * @param appSkinInfo An \c #AppSkinInfo object containing the application's default color and font styles.
352
+ *
353
+ * @return A new \c HostEnvironment object.
354
+ */
355
+ function HostEnvironment(appName, appVersion, appLocale, appUILocale, appId, isAppOnline, appSkinInfo)
356
+ {
357
+ this.appName = appName;
358
+ this.appVersion = appVersion;
359
+ this.appLocale = appLocale;
360
+ this.appUILocale = appUILocale;
361
+ this.appId = appId;
362
+ this.isAppOnline = isAppOnline;
363
+ this.appSkinInfo = appSkinInfo;
364
+ }
365
+
366
+ /**
367
+ * @class HostCapabilities
368
+ * Stores information about the host capabilities.
369
+ *
370
+ * @param EXTENDED_PANEL_MENU True if the application supports panel menu.
371
+ * @param EXTENDED_PANEL_ICONS True if the application supports panel icon.
372
+ * @param DELEGATE_APE_ENGINE True if the application supports delegated APE engine.
373
+ * @param SUPPORT_HTML_EXTENSIONS True if the application supports HTML extensions.
374
+ * @param DISABLE_FLASH_EXTENSIONS True if the application disables FLASH extensions.
375
+ *
376
+ * @return A new \c HostCapabilities object.
377
+ */
378
+ function HostCapabilities(EXTENDED_PANEL_MENU, EXTENDED_PANEL_ICONS, DELEGATE_APE_ENGINE, SUPPORT_HTML_EXTENSIONS, DISABLE_FLASH_EXTENSIONS)
379
+ {
380
+ this.EXTENDED_PANEL_MENU = EXTENDED_PANEL_MENU;
381
+ this.EXTENDED_PANEL_ICONS = EXTENDED_PANEL_ICONS;
382
+ this.DELEGATE_APE_ENGINE = DELEGATE_APE_ENGINE;
383
+ this.SUPPORT_HTML_EXTENSIONS = SUPPORT_HTML_EXTENSIONS;
384
+ this.DISABLE_FLASH_EXTENSIONS = DISABLE_FLASH_EXTENSIONS; // Since 5.0.0
385
+ }
386
+
387
+ /**
388
+ * @class ApiVersion
389
+ * Stores current api version.
390
+ *
391
+ * Since 4.2.0
392
+ *
393
+ * @param major The major version
394
+ * @param minor The minor version.
395
+ * @param micro The micro version.
396
+ *
397
+ * @return ApiVersion object.
398
+ */
399
+ function ApiVersion(major, minor, micro)
400
+ {
401
+ this.major = major;
402
+ this.minor = minor;
403
+ this.micro = micro;
404
+ }
405
+
406
+ /**
407
+ * @class MenuItemStatus
408
+ * Stores flyout menu item status
409
+ *
410
+ * Since 5.2.0
411
+ *
412
+ * @param menuItemLabel The menu item label.
413
+ * @param enabled True if user wants to enable the menu item.
414
+ * @param checked True if user wants to check the menu item.
415
+ *
416
+ * @return MenuItemStatus object.
417
+ */
418
+ function MenuItemStatus(menuItemLabel, enabled, checked)
419
+ {
420
+ this.menuItemLabel = menuItemLabel;
421
+ this.enabled = enabled;
422
+ this.checked = checked;
423
+ }
424
+
425
+ /**
426
+ * @class ContextMenuItemStatus
427
+ * Stores the status of the context menu item.
428
+ *
429
+ * Since 5.2.0
430
+ *
431
+ * @param menuItemID The menu item id.
432
+ * @param enabled True if user wants to enable the menu item.
433
+ * @param checked True if user wants to check the menu item.
434
+ *
435
+ * @return MenuItemStatus object.
436
+ */
437
+ function ContextMenuItemStatus(menuItemID, enabled, checked)
438
+ {
439
+ this.menuItemID = menuItemID;
440
+ this.enabled = enabled;
441
+ this.checked = checked;
442
+ }
443
+ //------------------------------ CSInterface ----------------------------------
444
+
445
+ /**
446
+ * @class CSInterface
447
+ * This is the entry point to the CEP extensibility infrastructure.
448
+ * Instantiate this object and use it to:
449
+ * <ul>
450
+ * <li>Access information about the host application in which an extension is running</li>
451
+ * <li>Launch an extension</li>
452
+ * <li>Register interest in event notifications, and dispatch events</li>
453
+ * </ul>
454
+ *
455
+ * @return A new \c CSInterface object
456
+ */
457
+ function CSInterface()
458
+ {
459
+ }
460
+
461
+ /**
462
+ * User can add this event listener to handle native application theme color changes.
463
+ * Callback function gives extensions ability to fine-tune their theme color after the
464
+ * global theme color has been changed.
465
+ * The callback function should be like below:
466
+ *
467
+ * @example
468
+ * // event is a CSEvent object, but user can ignore it.
469
+ * function OnAppThemeColorChanged(event)
470
+ * {
471
+ * // Should get a latest HostEnvironment object from application.
472
+ * var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo;
473
+ * // Gets the style information such as color info from the skinInfo,
474
+ * // and redraw all UI controls of your extension according to the style info.
475
+ * }
476
+ */
477
+ CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged";
478
+
479
+ /** The host environment data object. */
480
+ CSInterface.prototype.hostEnvironment = window.__adobe_cep__ ? JSON.parse(window.__adobe_cep__.getHostEnvironment()) : null;
481
+
482
+ /** Retrieves information about the host environment in which the
483
+ * extension is currently running.
484
+ *
485
+ * @return A \c #HostEnvironment object.
486
+ */
487
+ CSInterface.prototype.getHostEnvironment = function()
488
+ {
489
+ this.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment());
490
+ return this.hostEnvironment;
491
+ };
492
+
493
+ /** Loads binary file created which is located at url asynchronously
494
+ *
495
+ *@param urlName url at which binary file is located. Local files should start with 'file://'
496
+ *@param callback Optional. A callback function that returns after binary is loaded
497
+
498
+ *@example
499
+ * To create JS binary use command ./cep_compiler test.js test.bin
500
+ * To load JS binary asyncronously
501
+ * var CSLib = new CSInterface();
502
+ * CSLib.loadBinAsync(url, function () { });
503
+ */
504
+ CSInterface.prototype.loadBinAsync = function(urlName,callback)
505
+ {
506
+ try
507
+ {
508
+ var xhr = new XMLHttpRequest();
509
+ xhr.responseType = 'arraybuffer'; // make response as ArrayBuffer
510
+ xhr.open('GET', urlName, true);
511
+ xhr.onerror = function ()
512
+ {
513
+ console.log("Unable to load snapshot from given URL");
514
+ return false;
515
+ };
516
+ xhr.send();
517
+ xhr.onload = () => {
518
+ window.__adobe_cep__.loadSnapshot(xhr.response);
519
+ if (typeof callback === "function")
520
+ {
521
+ callback();
522
+ }
523
+ else if(typeof callback !== "undefined")
524
+ {
525
+ console.log("Provided callback is not a function");
526
+ }
527
+ }
528
+ }
529
+ catch(err)
530
+ {
531
+ console.log(err);
532
+ return false;
533
+ }
534
+
535
+ return true;
536
+ };
537
+
538
+ /** Loads binary file created synchronously
539
+ *
540
+ *@param pathName the local path at which binary file is located
541
+
542
+ *@example
543
+ * To create JS binary use command ./cep_compiler test.js test.bin
544
+ * To load JS binary syncronously
545
+ * var CSLib = new CSInterface();
546
+ * CSLib.loadBinSync(path);
547
+ */
548
+ CSInterface.prototype.loadBinSync = function(pathName)
549
+ {
550
+ try
551
+ {
552
+ var OSVersion = this.getOSInformation();
553
+ if(pathName.startsWith("file://"))
554
+ {
555
+ if (OSVersion.indexOf("Windows") >= 0)
556
+ {
557
+ pathName = pathName.replace("file:///", "");
558
+ }
559
+ else if (OSVersion.indexOf("Mac") >= 0)
560
+ {
561
+ pathName = pathName.replace("file://", "");
562
+ }
563
+ window.__adobe_cep__.loadSnapshot(pathName);
564
+ return true;
565
+ }
566
+ }
567
+ catch(err)
568
+ {
569
+ console.log(err);
570
+ return false;
571
+ }
572
+ //control should not come here
573
+ return false;
574
+ };
575
+
576
+ /** Closes this extension. */
577
+ CSInterface.prototype.closeExtension = function()
578
+ {
579
+ window.__adobe_cep__.closeExtension();
580
+ };
581
+
582
+ /**
583
+ * Retrieves a path for which a constant is defined in the system.
584
+ *
585
+ * @param pathType The path-type constant defined in \c #SystemPath ,
586
+ *
587
+ * @return The platform-specific system path string.
588
+ */
589
+ CSInterface.prototype.getSystemPath = function(pathType)
590
+ {
591
+ var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType));
592
+ var OSVersion = this.getOSInformation();
593
+ if (OSVersion.indexOf("Windows") >= 0)
594
+ {
595
+ path = path.replace("file:///", "");
596
+ }
597
+ else if (OSVersion.indexOf("Mac") >= 0)
598
+ {
599
+ path = path.replace("file://", "");
600
+ }
601
+ return path;
602
+ };
603
+
604
+ /**
605
+ * Evaluates a JavaScript script, which can use the JavaScript DOM
606
+ * of the host application.
607
+ *
608
+ * @param script The JavaScript script.
609
+ * @param callback Optional. A callback function that receives the result of execution.
610
+ * If execution fails, the callback function receives the error message \c EvalScript_ErrMessage.
611
+ */
612
+ CSInterface.prototype.evalScript = function(script, callback)
613
+ {
614
+ if(callback === null || callback === undefined)
615
+ {
616
+ callback = function(result){};
617
+ }
618
+ window.__adobe_cep__.evalScript(script, callback);
619
+ };
620
+
621
+ /**
622
+ * Retrieves the unique identifier of the application.
623
+ * in which the extension is currently running.
624
+ *
625
+ * @return The unique ID string.
626
+ */
627
+ CSInterface.prototype.getApplicationID = function()
628
+ {
629
+ var appId = this.hostEnvironment.appId;
630
+ return appId;
631
+ };
632
+
633
+ /**
634
+ * Retrieves host capability information for the application
635
+ * in which the extension is currently running.
636
+ *
637
+ * @return A \c #HostCapabilities object.
638
+ */
639
+ CSInterface.prototype.getHostCapabilities = function()
640
+ {
641
+ var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() );
642
+ return hostCapabilities;
643
+ };
644
+
645
+ /**
646
+ * Triggers a CEP event programmatically. Yoy can use it to dispatch
647
+ * an event of a predefined type, or of a type you have defined.
648
+ *
649
+ * @param event A \c CSEvent object.
650
+ */
651
+ CSInterface.prototype.dispatchEvent = function(event)
652
+ {
653
+ if (typeof event.data == "object")
654
+ {
655
+ event.data = JSON.stringify(event.data);
656
+ }
657
+
658
+ window.__adobe_cep__.dispatchEvent(event);
659
+ };
660
+
661
+ /**
662
+ * Registers an interest in a CEP event of a particular type, and
663
+ * assigns an event handler.
664
+ * The event infrastructure notifies your extension when events of this type occur,
665
+ * passing the event object to the registered handler function.
666
+ *
667
+ * @param type The name of the event type of interest.
668
+ * @param listener The JavaScript handler function or method.
669
+ * @param obj Optional, the object containing the handler method, if any.
670
+ * Default is null.
671
+ */
672
+ CSInterface.prototype.addEventListener = function(type, listener, obj)
673
+ {
674
+ window.__adobe_cep__.addEventListener(type, listener, obj);
675
+ };
676
+
677
+ /**
678
+ * Removes a registered event listener.
679
+ *
680
+ * @param type The name of the event type of interest.
681
+ * @param listener The JavaScript handler function or method that was registered.
682
+ * @param obj Optional, the object containing the handler method, if any.
683
+ * Default is null.
684
+ */
685
+ CSInterface.prototype.removeEventListener = function(type, listener, obj)
686
+ {
687
+ window.__adobe_cep__.removeEventListener(type, listener, obj);
688
+ };
689
+
690
+ /**
691
+ * Loads and launches another extension, or activates the extension if it is already loaded.
692
+ *
693
+ * @param extensionId The extension's unique identifier.
694
+ * @param startupParams Not currently used, pass "".
695
+ *
696
+ * @example
697
+ * To launch the extension "help" with ID "HLP" from this extension, call:
698
+ * <code>requestOpenExtension("HLP", ""); </code>
699
+ *
700
+ */
701
+ CSInterface.prototype.requestOpenExtension = function(extensionId, params)
702
+ {
703
+ window.__adobe_cep__.requestOpenExtension(extensionId, params);
704
+ };
705
+
706
+ /**
707
+ * Retrieves the list of extensions currently loaded in the current host application.
708
+ * The extension list is initialized once, and remains the same during the lifetime
709
+ * of the CEP session.
710
+ *
711
+ * @param extensionIds Optional, an array of unique identifiers for extensions of interest.
712
+ * If omitted, retrieves data for all extensions.
713
+ *
714
+ * @return Zero or more \c #Extension objects.
715
+ */
716
+ CSInterface.prototype.getExtensions = function(extensionIds)
717
+ {
718
+ var extensionIdsStr = JSON.stringify(extensionIds);
719
+ var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr);
720
+
721
+ var extensions = JSON.parse(extensionsStr);
722
+ return extensions;
723
+ };
724
+
725
+ /**
726
+ * Retrieves network-related preferences.
727
+ *
728
+ * @return A JavaScript object containing network preferences.
729
+ */
730
+ CSInterface.prototype.getNetworkPreferences = function()
731
+ {
732
+ var result = window.__adobe_cep__.getNetworkPreferences();
733
+ var networkPre = JSON.parse(result);
734
+
735
+ return networkPre;
736
+ };
737
+
738
+ /**
739
+ * Initializes the resource bundle for this extension with property values
740
+ * for the current application and locale.
741
+ * To support multiple locales, you must define a property file for each locale,
742
+ * containing keyed display-string values for that locale.
743
+ * See localization documentation for Extension Builder and related products.
744
+ *
745
+ * Keys can be in the
746
+ * form <code>key.value="localized string"</code>, for use in HTML text elements.
747
+ * For example, in this input element, the localized \c key.value string is displayed
748
+ * instead of the empty \c value string:
749
+ *
750
+ * <code><input type="submit" value="" data-locale="key"/></code>
751
+ *
752
+ * @return An object containing the resource bundle information.
753
+ */
754
+ CSInterface.prototype.initResourceBundle = function()
755
+ {
756
+ var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle());
757
+ var resElms = document.querySelectorAll('[data-locale]');
758
+ for (var n = 0; n < resElms.length; n++)
759
+ {
760
+ var resEl = resElms[n];
761
+ // Get the resource key from the element.
762
+ var resKey = resEl.getAttribute('data-locale');
763
+ if (resKey)
764
+ {
765
+ // Get all the resources that start with the key.
766
+ for (var key in resourceBundle)
767
+ {
768
+ if (key.indexOf(resKey) === 0)
769
+ {
770
+ var resValue = resourceBundle[key];
771
+ if (key.length == resKey.length)
772
+ {
773
+ resEl.innerHTML = resValue;
774
+ }
775
+ else if ('.' == key.charAt(resKey.length))
776
+ {
777
+ var attrKey = key.substring(resKey.length + 1);
778
+ resEl[attrKey] = resValue;
779
+ }
780
+ }
781
+ }
782
+ }
783
+ }
784
+ return resourceBundle;
785
+ };
786
+
787
+ /**
788
+ * Writes installation information to a file.
789
+ *
790
+ * @return The file path.
791
+ */
792
+ CSInterface.prototype.dumpInstallationInfo = function()
793
+ {
794
+ return window.__adobe_cep__.dumpInstallationInfo();
795
+ };
796
+
797
+ /**
798
+ * Retrieves version information for the current Operating System,
799
+ * See http://www.useragentstring.com/pages/Chrome/ for Chrome \c navigator.userAgent values.
800
+ *
801
+ * @return A string containing the OS version, or "unknown Operation System".
802
+ * If user customizes the User Agent by setting CEF command parameter "--user-agent", only
803
+ * "Mac OS X" or "Windows" will be returned.
804
+ */
805
+ CSInterface.prototype.getOSInformation = function()
806
+ {
807
+ var userAgent = navigator.userAgent;
808
+
809
+ if ((navigator.platform == "Win32") || (navigator.platform == "Windows"))
810
+ {
811
+ var winVersion = "Windows";
812
+ var winBit = "";
813
+ if (userAgent.indexOf("Windows") > -1)
814
+ {
815
+ if (userAgent.indexOf("Windows NT 5.0") > -1)
816
+ {
817
+ winVersion = "Windows 2000";
818
+ }
819
+ else if (userAgent.indexOf("Windows NT 5.1") > -1)
820
+ {
821
+ winVersion = "Windows XP";
822
+ }
823
+ else if (userAgent.indexOf("Windows NT 5.2") > -1)
824
+ {
825
+ winVersion = "Windows Server 2003";
826
+ }
827
+ else if (userAgent.indexOf("Windows NT 6.0") > -1)
828
+ {
829
+ winVersion = "Windows Vista";
830
+ }
831
+ else if (userAgent.indexOf("Windows NT 6.1") > -1)
832
+ {
833
+ winVersion = "Windows 7";
834
+ }
835
+ else if (userAgent.indexOf("Windows NT 6.2") > -1)
836
+ {
837
+ winVersion = "Windows 8";
838
+ }
839
+ else if (userAgent.indexOf("Windows NT 6.3") > -1)
840
+ {
841
+ winVersion = "Windows 8.1";
842
+ }
843
+ else if (userAgent.indexOf("Windows NT 10") > -1)
844
+ {
845
+ winVersion = "Windows 10";
846
+ }
847
+
848
+ if (userAgent.indexOf("WOW64") > -1 || userAgent.indexOf("Win64") > -1)
849
+ {
850
+ winBit = " 64-bit";
851
+ }
852
+ else
853
+ {
854
+ winBit = " 32-bit";
855
+ }
856
+ }
857
+
858
+ return winVersion + winBit;
859
+ }
860
+ else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh"))
861
+ {
862
+ var result = "Mac OS X";
863
+
864
+ if (userAgent.indexOf("Mac OS X") > -1)
865
+ {
866
+ result = userAgent.substring(userAgent.indexOf("Mac OS X"), userAgent.indexOf(")"));
867
+ result = result.replace(/_/g, ".");
868
+ }
869
+
870
+ return result;
871
+ }
872
+
873
+ return "Unknown Operation System";
874
+ };
875
+
876
+ /**
877
+ * Opens a page in the default system browser.
878
+ *
879
+ * Since 4.2.0
880
+ *
881
+ * @param url The URL of the page/file to open, or the email address.
882
+ * Must use HTTP/HTTPS/file/mailto protocol. For example:
883
+ * "http://www.adobe.com"
884
+ * "https://github.com"
885
+ * "file:///C:/log.txt"
886
+ * "mailto:test@adobe.com"
887
+ *
888
+ * @return One of these error codes:\n
889
+ * <ul>\n
890
+ * <li>NO_ERROR - 0</li>\n
891
+ * <li>ERR_UNKNOWN - 1</li>\n
892
+ * <li>ERR_INVALID_PARAMS - 2</li>\n
893
+ * <li>ERR_INVALID_URL - 201</li>\n
894
+ * </ul>\n
895
+ */
896
+ CSInterface.prototype.openURLInDefaultBrowser = function(url)
897
+ {
898
+ return cep.util.openURLInDefaultBrowser(url);
899
+ };
900
+
901
+ /**
902
+ * Retrieves extension ID.
903
+ *
904
+ * Since 4.2.0
905
+ *
906
+ * @return extension ID.
907
+ */
908
+ CSInterface.prototype.getExtensionID = function()
909
+ {
910
+ return window.__adobe_cep__.getExtensionId();
911
+ };
912
+
913
+ /**
914
+ * Retrieves the scale factor of screen.
915
+ * On Windows platform, the value of scale factor might be different from operating system's scale factor,
916
+ * since host application may use its self-defined scale factor.
917
+ *
918
+ * Since 4.2.0
919
+ *
920
+ * @return One of the following float number.
921
+ * <ul>\n
922
+ * <li> -1.0 when error occurs </li>\n
923
+ * <li> 1.0 means normal screen </li>\n
924
+ * <li> >1.0 means HiDPI screen </li>\n
925
+ * </ul>\n
926
+ */
927
+ CSInterface.prototype.getScaleFactor = function()
928
+ {
929
+ return window.__adobe_cep__.getScaleFactor();
930
+ };
931
+
932
+ /**
933
+ * Retrieves the scale factor of Monitor.
934
+ *
935
+ * Since 8.5.0
936
+ *
937
+ * @return value >= 1.0f
938
+ * only available for windows machine
939
+ */
940
+ if(navigator.appVersion.toLowerCase().indexOf("windows") >= 0) {
941
+ CSInterface.prototype.getMonitorScaleFactor = function()
942
+ {
943
+ return window.__adobe_cep__.getMonitorScaleFactor();
944
+ };
945
+ }
946
+
947
+ /**
948
+ * Set a handler to detect any changes of scale factor. This only works on Mac.
949
+ *
950
+ * Since 4.2.0
951
+ *
952
+ * @param handler The function to be called when scale factor is changed.
953
+ *
954
+ */
955
+ CSInterface.prototype.setScaleFactorChangedHandler = function(handler)
956
+ {
957
+ window.__adobe_cep__.setScaleFactorChangedHandler(handler);
958
+ };
959
+
960
+ /**
961
+ * Retrieves current API version.
962
+ *
963
+ * Since 4.2.0
964
+ *
965
+ * @return ApiVersion object.
966
+ *
967
+ */
968
+ CSInterface.prototype.getCurrentApiVersion = function()
969
+ {
970
+ var apiVersion = JSON.parse(window.__adobe_cep__.getCurrentApiVersion());
971
+ return apiVersion;
972
+ };
973
+
974
+ /**
975
+ * Set panel flyout menu by an XML.
976
+ *
977
+ * Since 5.2.0
978
+ *
979
+ * Register a callback function for "com.adobe.csxs.events.flyoutMenuClicked" to get notified when a
980
+ * menu item is clicked.
981
+ * The "data" attribute of event is an object which contains "menuId" and "menuName" attributes.
982
+ *
983
+ * Register callback functions for "com.adobe.csxs.events.flyoutMenuOpened" and "com.adobe.csxs.events.flyoutMenuClosed"
984
+ * respectively to get notified when flyout menu is opened or closed.
985
+ *
986
+ * @param menu A XML string which describes menu structure.
987
+ * An example menu XML:
988
+ * <Menu>
989
+ * <MenuItem Id="menuItemId1" Label="TestExample1" Enabled="true" Checked="false"/>
990
+ * <MenuItem Label="TestExample2">
991
+ * <MenuItem Label="TestExample2-1" >
992
+ * <MenuItem Label="TestExample2-1-1" Enabled="false" Checked="true"/>
993
+ * </MenuItem>
994
+ * <MenuItem Label="TestExample2-2" Enabled="true" Checked="true"/>
995
+ * </MenuItem>
996
+ * <MenuItem Label="---" />
997
+ * <MenuItem Label="TestExample3" Enabled="false" Checked="false"/>
998
+ * </Menu>
999
+ *
1000
+ */
1001
+ CSInterface.prototype.setPanelFlyoutMenu = function(menu)
1002
+ {
1003
+ if ("string" != typeof menu)
1004
+ {
1005
+ return;
1006
+ }
1007
+
1008
+ window.__adobe_cep__.invokeSync("setPanelFlyoutMenu", menu);
1009
+ };
1010
+
1011
+ /**
1012
+ * Updates a menu item in the extension window's flyout menu, by setting the enabled
1013
+ * and selection status.
1014
+ *
1015
+ * Since 5.2.0
1016
+ *
1017
+ * @param menuItemLabel The menu item label.
1018
+ * @param enabled True to enable the item, false to disable it (gray it out).
1019
+ * @param checked True to select the item, false to deselect it.
1020
+ *
1021
+ * @return false when the host application does not support this functionality (HostCapabilities.EXTENDED_PANEL_MENU is false).
1022
+ * Fails silently if menu label is invalid.
1023
+ *
1024
+ * @see HostCapabilities.EXTENDED_PANEL_MENU
1025
+ */
1026
+ CSInterface.prototype.updatePanelMenuItem = function(menuItemLabel, enabled, checked)
1027
+ {
1028
+ var ret = false;
1029
+ if (this.getHostCapabilities().EXTENDED_PANEL_MENU)
1030
+ {
1031
+ var itemStatus = new MenuItemStatus(menuItemLabel, enabled, checked);
1032
+ ret = window.__adobe_cep__.invokeSync("updatePanelMenuItem", JSON.stringify(itemStatus));
1033
+ }
1034
+ return ret;
1035
+ };
1036
+
1037
+
1038
+ /**
1039
+ * Set context menu by XML string.
1040
+ *
1041
+ * Since 5.2.0
1042
+ *
1043
+ * There are a number of conventions used to communicate what type of menu item to create and how it should be handled.
1044
+ * - an item without menu ID or menu name is disabled and is not shown.
1045
+ * - if the item name is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL.
1046
+ * - Checkable attribute takes precedence over Checked attribute.
1047
+ * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item.
1048
+ The Chrome extension contextMenus API was taken as a reference.
1049
+ https://developer.chrome.com/extensions/contextMenus
1050
+ * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter.
1051
+ *
1052
+ * @param menu A XML string which describes menu structure.
1053
+ * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item.
1054
+ *
1055
+ * @description An example menu XML:
1056
+ * <Menu>
1057
+ * <MenuItem Id="menuItemId1" Label="TestExample1" Enabled="true" Checkable="true" Checked="false" Icon="./image/small_16X16.png"/>
1058
+ * <MenuItem Id="menuItemId2" Label="TestExample2">
1059
+ * <MenuItem Id="menuItemId2-1" Label="TestExample2-1" >
1060
+ * <MenuItem Id="menuItemId2-1-1" Label="TestExample2-1-1" Enabled="false" Checkable="true" Checked="true"/>
1061
+ * </MenuItem>
1062
+ * <MenuItem Id="menuItemId2-2" Label="TestExample2-2" Enabled="true" Checkable="true" Checked="true"/>
1063
+ * </MenuItem>
1064
+ * <MenuItem Label="---" />
1065
+ * <MenuItem Id="menuItemId3" Label="TestExample3" Enabled="false" Checkable="true" Checked="false"/>
1066
+ * </Menu>
1067
+ */
1068
+ CSInterface.prototype.setContextMenu = function(menu, callback)
1069
+ {
1070
+ if ("string" != typeof menu)
1071
+ {
1072
+ return;
1073
+ }
1074
+
1075
+ window.__adobe_cep__.invokeAsync("setContextMenu", menu, callback);
1076
+ };
1077
+
1078
+ /**
1079
+ * Set context menu by JSON string.
1080
+ *
1081
+ * Since 6.0.0
1082
+ *
1083
+ * There are a number of conventions used to communicate what type of menu item to create and how it should be handled.
1084
+ * - an item without menu ID or menu name is disabled and is not shown.
1085
+ * - if the item label is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL.
1086
+ * - Checkable attribute takes precedence over Checked attribute.
1087
+ * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item.
1088
+ The Chrome extension contextMenus API was taken as a reference.
1089
+ * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter.
1090
+ https://developer.chrome.com/extensions/contextMenus
1091
+ *
1092
+ * @param menu A JSON string which describes menu structure.
1093
+ * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item.
1094
+ *
1095
+ * @description An example menu JSON:
1096
+ *
1097
+ * {
1098
+ * "menu": [
1099
+ * {
1100
+ * "id": "menuItemId1",
1101
+ * "label": "testExample1",
1102
+ * "enabled": true,
1103
+ * "checkable": true,
1104
+ * "checked": false,
1105
+ * "icon": "./image/small_16X16.png"
1106
+ * },
1107
+ * {
1108
+ * "id": "menuItemId2",
1109
+ * "label": "testExample2",
1110
+ * "menu": [
1111
+ * {
1112
+ * "id": "menuItemId2-1",
1113
+ * "label": "testExample2-1",
1114
+ * "menu": [
1115
+ * {
1116
+ * "id": "menuItemId2-1-1",
1117
+ * "label": "testExample2-1-1",
1118
+ * "enabled": false,
1119
+ * "checkable": true,
1120
+ * "checked": true
1121
+ * }
1122
+ * ]
1123
+ * },
1124
+ * {
1125
+ * "id": "menuItemId2-2",
1126
+ * "label": "testExample2-2",
1127
+ * "enabled": true,
1128
+ * "checkable": true,
1129
+ * "checked": true
1130
+ * }
1131
+ * ]
1132
+ * },
1133
+ * {
1134
+ * "label": "---"
1135
+ * },
1136
+ * {
1137
+ * "id": "menuItemId3",
1138
+ * "label": "testExample3",
1139
+ * "enabled": false,
1140
+ * "checkable": true,
1141
+ * "checked": false
1142
+ * }
1143
+ * ]
1144
+ * }
1145
+ *
1146
+ */
1147
+ CSInterface.prototype.setContextMenuByJSON = function(menu, callback)
1148
+ {
1149
+ if ("string" != typeof menu)
1150
+ {
1151
+ return;
1152
+ }
1153
+
1154
+ window.__adobe_cep__.invokeAsync("setContextMenuByJSON", menu, callback);
1155
+ };
1156
+
1157
+ /**
1158
+ * Updates a context menu item by setting the enabled and selection status.
1159
+ *
1160
+ * Since 5.2.0
1161
+ *
1162
+ * @param menuItemID The menu item ID.
1163
+ * @param enabled True to enable the item, false to disable it (gray it out).
1164
+ * @param checked True to select the item, false to deselect it.
1165
+ */
1166
+ CSInterface.prototype.updateContextMenuItem = function(menuItemID, enabled, checked)
1167
+ {
1168
+ var itemStatus = new ContextMenuItemStatus(menuItemID, enabled, checked);
1169
+ ret = window.__adobe_cep__.invokeSync("updateContextMenuItem", JSON.stringify(itemStatus));
1170
+ };
1171
+
1172
+ /**
1173
+ * Get the visibility status of an extension window.
1174
+ *
1175
+ * Since 6.0.0
1176
+ *
1177
+ * @return true if the extension window is visible; false if the extension window is hidden.
1178
+ */
1179
+ CSInterface.prototype.isWindowVisible = function()
1180
+ {
1181
+ return window.__adobe_cep__.invokeSync("isWindowVisible", "");
1182
+ };
1183
+
1184
+ /**
1185
+ * Resize extension's content to the specified dimensions.
1186
+ * 1. Works with modal and modeless extensions in all Adobe products.
1187
+ * 2. Extension's manifest min/max size constraints apply and take precedence.
1188
+ * 3. For panel extensions
1189
+ * 3.1 This works in all Adobe products except:
1190
+ * * Premiere Pro
1191
+ * * Prelude
1192
+ * * After Effects
1193
+ * 3.2 When the panel is in certain states (especially when being docked),
1194
+ * it will not change to the desired dimensions even when the
1195
+ * specified size satisfies min/max constraints.
1196
+ *
1197
+ * Since 6.0.0
1198
+ *
1199
+ * @param width The new width
1200
+ * @param height The new height
1201
+ */
1202
+ CSInterface.prototype.resizeContent = function(width, height)
1203
+ {
1204
+ window.__adobe_cep__.resizeContent(width, height);
1205
+ };
1206
+
1207
+ /**
1208
+ * Register the invalid certificate callback for an extension.
1209
+ * This callback will be triggered when the extension tries to access the web site that contains the invalid certificate on the main frame.
1210
+ * But if the extension does not call this function and tries to access the web site containing the invalid certificate, a default error page will be shown.
1211
+ *
1212
+ * Since 6.1.0
1213
+ *
1214
+ * @param callback the callback function
1215
+ */
1216
+ CSInterface.prototype.registerInvalidCertificateCallback = function(callback)
1217
+ {
1218
+ return window.__adobe_cep__.registerInvalidCertificateCallback(callback);
1219
+ };
1220
+
1221
+ /**
1222
+ * Register an interest in some key events to prevent them from being sent to the host application.
1223
+ *
1224
+ * This function works with modeless extensions and panel extensions.
1225
+ * Generally all the key events will be sent to the host application for these two extensions if the current focused element
1226
+ * is not text input or dropdown,
1227
+ * If you want to intercept some key events and want them to be handled in the extension, please call this function
1228
+ * in advance to prevent them being sent to the host application.
1229
+ *
1230
+ * Since 6.1.0
1231
+ *
1232
+ * @param keyEventsInterest A JSON string describing those key events you are interested in. A null object or
1233
+ an empty string will lead to removing the interest
1234
+ *
1235
+ * This JSON string should be an array, each object has following keys:
1236
+ *
1237
+ * keyCode: [Required] represents an OS system dependent virtual key code identifying
1238
+ * the unmodified value of the pressed key.
1239
+ * ctrlKey: [optional] a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred.
1240
+ * altKey: [optional] a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred.
1241
+ * shiftKey: [optional] a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred.
1242
+ * metaKey: [optional] (Mac Only) a Boolean that indicates if the Meta key was pressed (true) or not (false) when the event occurred.
1243
+ * On Macintosh keyboards, this is the command key. To detect Windows key on Windows, please use keyCode instead.
1244
+ * An example JSON string:
1245
+ *
1246
+ * [
1247
+ * {
1248
+ * "keyCode": 48
1249
+ * },
1250
+ * {
1251
+ * "keyCode": 123,
1252
+ * "ctrlKey": true
1253
+ * },
1254
+ * {
1255
+ * "keyCode": 123,
1256
+ * "ctrlKey": true,
1257
+ * "metaKey": true
1258
+ * }
1259
+ * ]
1260
+ *
1261
+ */
1262
+ CSInterface.prototype.registerKeyEventsInterest = function(keyEventsInterest)
1263
+ {
1264
+ return window.__adobe_cep__.registerKeyEventsInterest(keyEventsInterest);
1265
+ };
1266
+
1267
+ /**
1268
+ * Set the title of the extension window.
1269
+ * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver.
1270
+ *
1271
+ * Since 6.1.0
1272
+ *
1273
+ * @param title The window title.
1274
+ */
1275
+ CSInterface.prototype.setWindowTitle = function(title)
1276
+ {
1277
+ window.__adobe_cep__.invokeSync("setWindowTitle", title);
1278
+ };
1279
+
1280
+ /**
1281
+ * Get the title of the extension window.
1282
+ * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver.
1283
+ *
1284
+ * Since 6.1.0
1285
+ *
1286
+ * @return The window title.
1287
+ */
1288
+ CSInterface.prototype.getWindowTitle = function()
1289
+ {
1290
+ return window.__adobe_cep__.invokeSync("getWindowTitle", "");
1291
+ };