38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Extension Testing/js/json2.js:
--------------------------------------------------------------------------------
1 | // json2.js
2 | // 2016-10-28
3 | // Public Domain.
4 | // NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
5 | // See http://www.JSON.org/js.html
6 | // This code should be minified before deployment.
7 | // See http://javascript.crockford.com/jsmin.html
8 |
9 | // USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
10 | // NOT CONTROL.
11 |
12 | // This file creates a global JSON object containing two methods: stringify
13 | // and parse. This file provides the ES5 JSON capability to ES3 systems.
14 | // If a project might run on IE8 or earlier, then this file should be included.
15 | // This file does nothing on ES5 systems.
16 |
17 | // JSON.stringify(value, replacer, space)
18 | // value any JavaScript value, usually an object or array.
19 | // replacer an optional parameter that determines how object
20 | // values are stringified for objects. It can be a
21 | // function or an array of strings.
22 | // space an optional parameter that specifies the indentation
23 | // of nested structures. If it is omitted, the text will
24 | // be packed without extra whitespace. If it is a number,
25 | // it will specify the number of spaces to indent at each
26 | // level. If it is a string (such as "\t" or " "),
27 | // it contains the characters used to indent at each level.
28 | // This method produces a JSON text from a JavaScript value.
29 | // When an object value is found, if the object contains a toJSON
30 | // method, its toJSON method will be called and the result will be
31 | // stringified. A toJSON method does not serialize: it returns the
32 | // value represented by the name/value pair that should be serialized,
33 | // or undefined if nothing should be serialized. The toJSON method
34 | // will be passed the key associated with the value, and this will be
35 | // bound to the value.
36 |
37 | // For example, this would serialize Dates as ISO strings.
38 |
39 | // Date.prototype.toJSON = function (key) {
40 | // function f(n) {
41 | // // Format integers to have at least two digits.
42 | // return (n < 10)
43 | // ? "0" + n
44 | // : n;
45 | // }
46 | // return this.getUTCFullYear() + "-" +
47 | // f(this.getUTCMonth() + 1) + "-" +
48 | // f(this.getUTCDate()) + "T" +
49 | // f(this.getUTCHours()) + ":" +
50 | // f(this.getUTCMinutes()) + ":" +
51 | // f(this.getUTCSeconds()) + "Z";
52 | // };
53 |
54 | // You can provide an optional replacer method. It will be passed the
55 | // key and value of each member, with this bound to the containing
56 | // object. The value that is returned from your method will be
57 | // serialized. If your method returns undefined, then the member will
58 | // be excluded from the serialization.
59 |
60 | // If the replacer parameter is an array of strings, then it will be
61 | // used to select the members to be serialized. It filters the results
62 | // such that only members with keys listed in the replacer array are
63 | // stringified.
64 |
65 | // Values that do not have JSON representations, such as undefined or
66 | // functions, will not be serialized. Such values in objects will be
67 | // dropped; in arrays they will be replaced with null. You can use
68 | // a replacer function to replace those with JSON values.
69 |
70 | // JSON.stringify(undefined) returns undefined.
71 |
72 | // The optional space parameter produces a stringification of the
73 | // value that is filled with line breaks and indentation to make it
74 | // easier to read.
75 |
76 | // If the space parameter is a non-empty string, then that string will
77 | // be used for indentation. If the space parameter is a number, then
78 | // the indentation will be that many spaces.
79 |
80 | // Example:
81 |
82 | // text = JSON.stringify(["e", {pluribus: "unum"}]);
83 | // // text is '["e",{"pluribus":"unum"}]'
84 |
85 | // text = JSON.stringify(["e", {pluribus: "unum"}], null, "\t");
86 | // // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
87 |
88 | // text = JSON.stringify([new Date()], function (key, value) {
89 | // return this[key] instanceof Date
90 | // ? "Date(" + this[key] + ")"
91 | // : value;
92 | // });
93 | // // text is '["Date(---current time---)"]'
94 |
95 | // JSON.parse(text, reviver)
96 | // This method parses a JSON text to produce an object or array.
97 | // It can throw a SyntaxError exception.
98 |
99 | // The optional reviver parameter is a function that can filter and
100 | // transform the results. It receives each of the keys and values,
101 | // and its return value is used instead of the original value.
102 | // If it returns what it received, then the structure is not modified.
103 | // If it returns undefined then the member is deleted.
104 |
105 | // Example:
106 |
107 | // // Parse the text. Values that look like ISO date strings will
108 | // // be converted to Date objects.
109 |
110 | // myData = JSON.parse(text, function (key, value) {
111 | // var a;
112 | // if (typeof value === "string") {
113 | // a =
114 | // /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
115 | // if (a) {
116 | // return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
117 | // +a[5], +a[6]));
118 | // }
119 | // }
120 | // return value;
121 | // });
122 |
123 | // myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
124 | // var d;
125 | // if (typeof value === "string" &&
126 | // value.slice(0, 5) === "Date(" &&
127 | // value.slice(-1) === ")") {
128 | // d = new Date(value.slice(5, -1));
129 | // if (d) {
130 | // return d;
131 | // }
132 | // }
133 | // return value;
134 | // });
135 |
136 | // This is a reference implementation. You are free to copy, modify, or
137 | // redistribute.
138 |
139 | /*jslint
140 | eval, for, this
141 | */
142 |
143 | /*property
144 | JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
145 | getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
146 | lastIndex, length, parse, prototype, push, replace, slice, stringify,
147 | test, toJSON, toString, valueOf
148 | */
149 |
150 |
151 | // Create a JSON object only if one does not already exist. We create the
152 | // methods in a closure to avoid creating global variables.
153 |
154 | if (typeof JSON !== "object") {
155 | JSON = {};
156 | }
157 |
158 | (function () {
159 | "use strict";
160 |
161 | var rx_one = /^[\],:{}\s]*$/;
162 | var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
163 | var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
164 | var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
165 | var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
166 | var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
167 |
168 | function f(n) {
169 | // Format integers to have at least two digits.
170 | return n < 10
171 | ? "0" + n
172 | : n;
173 | }
174 |
175 | function this_value() {
176 | return this.valueOf();
177 | }
178 |
179 | if (typeof Date.prototype.toJSON !== "function") {
180 |
181 | Date.prototype.toJSON = function () {
182 |
183 | return isFinite(this.valueOf())
184 | ? this.getUTCFullYear() + "-" +
185 | f(this.getUTCMonth() + 1) + "-" +
186 | f(this.getUTCDate()) + "T" +
187 | f(this.getUTCHours()) + ":" +
188 | f(this.getUTCMinutes()) + ":" +
189 | f(this.getUTCSeconds()) + "Z"
190 | : null;
191 | };
192 |
193 | Boolean.prototype.toJSON = this_value;
194 | Number.prototype.toJSON = this_value;
195 | String.prototype.toJSON = this_value;
196 | }
197 |
198 | var gap;
199 | var indent;
200 | var meta;
201 | var rep;
202 |
203 |
204 | function quote(string) {
205 |
206 | // If the string contains no control characters, no quote characters, and no
207 | // backslash characters, then we can safely slap some quotes around it.
208 | // Otherwise we must also replace the offending characters with safe escape
209 | // sequences.
210 |
211 | rx_escapable.lastIndex = 0;
212 | return rx_escapable.test(string)
213 | ? "\"" + string.replace(rx_escapable, function (a) {
214 | var c = meta[a];
215 | return typeof c === "string"
216 | ? c
217 | : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
218 | }) + "\""
219 | : "\"" + string + "\"";
220 | }
221 |
222 |
223 | function str(key, holder) {
224 |
225 | // Produce a string from holder[key].
226 |
227 | var i; // The loop counter.
228 | var k; // The member key.
229 | var v; // The member value.
230 | var length;
231 | var mind = gap;
232 | var partial;
233 | var value = holder[key];
234 |
235 | // If the value has a toJSON method, call it to obtain a replacement value.
236 |
237 | if (value && typeof value === "object" &&
238 | typeof value.toJSON === "function") {
239 | value = value.toJSON(key);
240 | }
241 |
242 | // If we were called with a replacer function, then call the replacer to
243 | // obtain a replacement value.
244 |
245 | if (typeof rep === "function") {
246 | value = rep.call(holder, key, value);
247 | }
248 |
249 | // What happens next depends on the value's type.
250 |
251 | switch (typeof value) {
252 | case "string":
253 | return quote(value);
254 |
255 | case "number":
256 |
257 | // JSON numbers must be finite. Encode non-finite numbers as null.
258 |
259 | return isFinite(value)
260 | ? String(value)
261 | : "null";
262 |
263 | case "boolean":
264 | case "null":
265 |
266 | // If the value is a boolean or null, convert it to a string. Note:
267 | // typeof null does not produce "null". The case is included here in
268 | // the remote chance that this gets fixed someday.
269 |
270 | return String(value);
271 |
272 | // If the type is "object", we might be dealing with an object or an array or
273 | // null.
274 |
275 | case "object":
276 |
277 | // Due to a specification blunder in ECMAScript, typeof null is "object",
278 | // so watch out for that case.
279 |
280 | if (!value) {
281 | return "null";
282 | }
283 |
284 | // Make an array to hold the partial results of stringifying this object value.
285 |
286 | gap += indent;
287 | partial = [];
288 |
289 | // Is the value an array?
290 |
291 | if (Object.prototype.toString.apply(value) === "[object Array]") {
292 |
293 | // The value is an array. Stringify every element. Use null as a placeholder
294 | // for non-JSON values.
295 |
296 | length = value.length;
297 | for (i = 0; i < length; i += 1) {
298 | partial[i] = str(i, value) || "null";
299 | }
300 |
301 | // Join all of the elements together, separated with commas, and wrap them in
302 | // brackets.
303 |
304 | v = partial.length === 0
305 | ? "[]"
306 | : gap
307 | ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]"
308 | : "[" + partial.join(",") + "]";
309 | gap = mind;
310 | return v;
311 | }
312 |
313 | // If the replacer is an array, use it to select the members to be stringified.
314 |
315 | if (rep && typeof rep === "object") {
316 | length = rep.length;
317 | for (i = 0; i < length; i += 1) {
318 | if (typeof rep[i] === "string") {
319 | k = rep[i];
320 | v = str(k, value);
321 | if (v) {
322 | partial.push(quote(k) + (
323 | gap
324 | ? ": "
325 | : ":"
326 | ) + v);
327 | }
328 | }
329 | }
330 | } else {
331 |
332 | // Otherwise, iterate through all of the keys in the object.
333 |
334 | for (k in value) {
335 | if (Object.prototype.hasOwnProperty.call(value, k)) {
336 | v = str(k, value);
337 | if (v) {
338 | partial.push(quote(k) + (
339 | gap
340 | ? ": "
341 | : ":"
342 | ) + v);
343 | }
344 | }
345 | }
346 | }
347 |
348 | // Join all of the member texts together, separated with commas,
349 | // and wrap them in braces.
350 |
351 | v = partial.length === 0
352 | ? "{}"
353 | : gap
354 | ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}"
355 | : "{" + partial.join(",") + "}";
356 | gap = mind;
357 | return v;
358 | }
359 | }
360 |
361 | // If the JSON object does not yet have a stringify method, give it one.
362 |
363 | if (typeof JSON.stringify !== "function") {
364 | meta = { // table of character substitutions
365 | "\b": "\\b",
366 | "\t": "\\t",
367 | "\n": "\\n",
368 | "\f": "\\f",
369 | "\r": "\\r",
370 | "\"": "\\\"",
371 | "\\": "\\\\"
372 | };
373 | JSON.stringify = function (value, replacer, space) {
374 |
375 | // The stringify method takes a value and an optional replacer, and an optional
376 | // space parameter, and returns a JSON text. The replacer can be a function
377 | // that can replace values, or an array of strings that will select the keys.
378 | // A default replacer method can be provided. Use of the space parameter can
379 | // produce text that is more easily readable.
380 |
381 | var i;
382 | gap = "";
383 | indent = "";
384 |
385 | // If the space parameter is a number, make an indent string containing that
386 | // many spaces.
387 |
388 | if (typeof space === "number") {
389 | for (i = 0; i < space; i += 1) {
390 | indent += " ";
391 | }
392 |
393 | // If the space parameter is a string, it will be used as the indent string.
394 |
395 | } else if (typeof space === "string") {
396 | indent = space;
397 | }
398 |
399 | // If there is a replacer, it must be a function or an array.
400 | // Otherwise, throw an error.
401 |
402 | rep = replacer;
403 | if (replacer && typeof replacer !== "function" &&
404 | (typeof replacer !== "object" ||
405 | typeof replacer.length !== "number")) {
406 | throw new Error("JSON.stringify");
407 | }
408 |
409 | // Make a fake root object containing our value under the key of "".
410 | // Return the result of stringifying the value.
411 |
412 | return str("", {"": value});
413 | };
414 | }
415 |
416 |
417 | // If the JSON object does not yet have a parse method, give it one.
418 |
419 | if (typeof JSON.parse !== "function") {
420 | JSON.parse = function (text, reviver) {
421 |
422 | // The parse method takes a text and an optional reviver function, and returns
423 | // a JavaScript value if the text is a valid JSON text.
424 |
425 | var j;
426 |
427 | function walk(holder, key) {
428 |
429 | // The walk method is used to recursively walk the resulting structure so
430 | // that modifications can be made.
431 |
432 | var k;
433 | var v;
434 | var value = holder[key];
435 | if (value && typeof value === "object") {
436 | for (k in value) {
437 | if (Object.prototype.hasOwnProperty.call(value, k)) {
438 | v = walk(value, k);
439 | if (v !== undefined) {
440 | value[k] = v;
441 | } else {
442 | delete value[k];
443 | }
444 | }
445 | }
446 | }
447 | return reviver.call(holder, key, value);
448 | }
449 |
450 |
451 | // Parsing happens in four stages. In the first stage, we replace certain
452 | // Unicode characters with escape sequences. JavaScript handles many characters
453 | // incorrectly, either silently deleting them, or treating them as line endings.
454 |
455 | text = String(text);
456 | rx_dangerous.lastIndex = 0;
457 | if (rx_dangerous.test(text)) {
458 | text = text.replace(rx_dangerous, function (a) {
459 | return "\\u" +
460 | ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
461 | });
462 | }
463 |
464 | // In the second stage, we run the text against regular expressions that look
465 | // for non-JSON patterns. We are especially concerned with "()" and "new"
466 | // because they can cause invocation, and "=" because it can cause mutation.
467 | // But just to be safe, we want to reject all unexpected forms.
468 |
469 | // We split the second stage into 4 regexp operations in order to work around
470 | // crippling inefficiencies in IE's and Safari's regexp engines. First we
471 | // replace the JSON backslash pairs with "@" (a non-JSON character). Second, we
472 | // replace all simple value tokens with "]" characters. Third, we delete all
473 | // open brackets that follow a colon or comma or that begin the text. Finally,
474 | // we look to see that the remaining characters are only whitespace or "]" or
475 | // "," or ":" or "{" or "}". If that is so, then the text is safe for eval.
476 |
477 | if (
478 | rx_one.test(
479 | text
480 | .replace(rx_two, "@")
481 | .replace(rx_three, "]")
482 | .replace(rx_four, "")
483 | )
484 | ) {
485 |
486 | // In the third stage we use the eval function to compile the text into a
487 | // JavaScript structure. The "{" operator is subject to a syntactic ambiguity
488 | // in JavaScript: it can begin a block or an object literal. We wrap the text
489 | // in parens to eliminate the ambiguity.
490 |
491 | j = eval("(" + text + ")");
492 |
493 | // In the optional fourth stage, we recursively walk the new structure, passing
494 | // each name/value pair to a reviver function for possible transformation.
495 |
496 | return (typeof reviver === "function")
497 | ? walk({"": j}, "")
498 | : j;
499 | }
500 |
501 | // If the text is not JSON parseable, then a SyntaxError is thrown.
502 |
503 | throw new SyntaxError("JSON.parse");
504 | };
505 | }
506 | }());
507 |
--------------------------------------------------------------------------------
/Extension Testing/js/libs/CSInterface.js:
--------------------------------------------------------------------------------
1 | /**************************************************************************************************
2 | *
3 | * ADOBE SYSTEMS INCORPORATED
4 | * Copyright 2013 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 - v7.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 operating-system highlight color, as sRGB.
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 | *
450 | *
Access information about the host application in which an extension is running
451 | *
Launch an extension
452 | *
Register interest in event notifications, and dispatch events
453 | *
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 = JSON.parse(window.__adobe_cep__.getHostEnvironment());
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 | /** Closes this extension. */
494 | CSInterface.prototype.closeExtension = function()
495 | {
496 | window.__adobe_cep__.closeExtension();
497 | };
498 |
499 | /**
500 | * Retrieves a path for which a constant is defined in the system.
501 | *
502 | * @param pathType The path-type constant defined in \c #SystemPath ,
503 | *
504 | * @return The platform-specific system path string.
505 | */
506 | CSInterface.prototype.getSystemPath = function(pathType)
507 | {
508 | var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType));
509 | var OSVersion = this.getOSInformation();
510 | if (OSVersion.indexOf("Windows") >= 0)
511 | {
512 | path = path.replace("file:///", "");
513 | }
514 | else if (OSVersion.indexOf("Mac") >= 0)
515 | {
516 | path = path.replace("file://", "");
517 | }
518 | return path;
519 | };
520 |
521 | /**
522 | * Evaluates a JavaScript script, which can use the JavaScript DOM
523 | * of the host application.
524 | *
525 | * @param script The JavaScript script.
526 | * @param callback Optional. A callback function that receives the result of execution.
527 | * If execution fails, the callback function receives the error message \c EvalScript_ErrMessage.
528 | */
529 | CSInterface.prototype.evalScript = function(script, callback)
530 | {
531 | if(callback === null || callback === undefined)
532 | {
533 | callback = function(result){};
534 | }
535 | window.__adobe_cep__.evalScript(script, callback);
536 | };
537 |
538 | /**
539 | * Retrieves the unique identifier of the application.
540 | * in which the extension is currently running.
541 | *
542 | * @return The unique ID string.
543 | */
544 | CSInterface.prototype.getApplicationID = function()
545 | {
546 | var appId = this.hostEnvironment.appId;
547 | return appId;
548 | };
549 |
550 | /**
551 | * Retrieves host capability information for the application
552 | * in which the extension is currently running.
553 | *
554 | * @return A \c #HostCapabilities object.
555 | */
556 | CSInterface.prototype.getHostCapabilities = function()
557 | {
558 | var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() );
559 | return hostCapabilities;
560 | };
561 |
562 | /**
563 | * Triggers a CEP event programmatically. Yoy can use it to dispatch
564 | * an event of a predefined type, or of a type you have defined.
565 | *
566 | * @param event A \c CSEvent object.
567 | */
568 | CSInterface.prototype.dispatchEvent = function(event)
569 | {
570 | if (typeof event.data == "object")
571 | {
572 | event.data = JSON.stringify(event.data);
573 | }
574 |
575 | window.__adobe_cep__.dispatchEvent(event);
576 | };
577 |
578 | /**
579 | * Registers an interest in a CEP event of a particular type, and
580 | * assigns an event handler.
581 | * The event infrastructure notifies your extension when events of this type occur,
582 | * passing the event object to the registered handler function.
583 | *
584 | * @param type The name of the event type of interest.
585 | * @param listener The JavaScript handler function or method.
586 | * @param obj Optional, the object containing the handler method, if any.
587 | * Default is null.
588 | */
589 | CSInterface.prototype.addEventListener = function(type, listener, obj)
590 | {
591 | window.__adobe_cep__.addEventListener(type, listener, obj);
592 | };
593 |
594 | /**
595 | * Removes a registered event listener.
596 | *
597 | * @param type The name of the event type of interest.
598 | * @param listener The JavaScript handler function or method that was registered.
599 | * @param obj Optional, the object containing the handler method, if any.
600 | * Default is null.
601 | */
602 | CSInterface.prototype.removeEventListener = function(type, listener, obj)
603 | {
604 | window.__adobe_cep__.removeEventListener(type, listener, obj);
605 | };
606 |
607 | /**
608 | * Loads and launches another extension, or activates the extension if it is already loaded.
609 | *
610 | * @param extensionId The extension's unique identifier.
611 | * @param startupParams Not currently used, pass "".
612 | *
613 | * @example
614 | * To launch the extension "help" with ID "HLP" from this extension, call:
615 | * requestOpenExtension("HLP", "");
616 | *
617 | */
618 | CSInterface.prototype.requestOpenExtension = function(extensionId, params)
619 | {
620 | window.__adobe_cep__.requestOpenExtension(extensionId, params);
621 | };
622 |
623 | /**
624 | * Retrieves the list of extensions currently loaded in the current host application.
625 | * The extension list is initialized once, and remains the same during the lifetime
626 | * of the CEP session.
627 | *
628 | * @param extensionIds Optional, an array of unique identifiers for extensions of interest.
629 | * If omitted, retrieves data for all extensions.
630 | *
631 | * @return Zero or more \c #Extension objects.
632 | */
633 | CSInterface.prototype.getExtensions = function(extensionIds)
634 | {
635 | var extensionIdsStr = JSON.stringify(extensionIds);
636 | var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr);
637 |
638 | var extensions = JSON.parse(extensionsStr);
639 | return extensions;
640 | };
641 |
642 | /**
643 | * Retrieves network-related preferences.
644 | *
645 | * @return A JavaScript object containing network preferences.
646 | */
647 | CSInterface.prototype.getNetworkPreferences = function()
648 | {
649 | var result = window.__adobe_cep__.getNetworkPreferences();
650 | var networkPre = JSON.parse(result);
651 |
652 | return networkPre;
653 | };
654 |
655 | /**
656 | * Initializes the resource bundle for this extension with property values
657 | * for the current application and locale.
658 | * To support multiple locales, you must define a property file for each locale,
659 | * containing keyed display-string values for that locale.
660 | * See localization documentation for Extension Builder and related products.
661 | *
662 | * Keys can be in the
663 | * form key.value="localized string", for use in HTML text elements.
664 | * For example, in this input element, the localized \c key.value string is displayed
665 | * instead of the empty \c value string:
666 | *
667 | *
668 | *
669 | * @return An object containing the resource bundle information.
670 | */
671 | CSInterface.prototype.initResourceBundle = function()
672 | {
673 | var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle());
674 | var resElms = document.querySelectorAll('[data-locale]');
675 | for (var n = 0; n < resElms.length; n++)
676 | {
677 | var resEl = resElms[n];
678 | // Get the resource key from the element.
679 | var resKey = resEl.getAttribute('data-locale');
680 | if (resKey)
681 | {
682 | // Get all the resources that start with the key.
683 | for (var key in resourceBundle)
684 | {
685 | if (key.indexOf(resKey) === 0)
686 | {
687 | var resValue = resourceBundle[key];
688 | if (key.length == resKey.length)
689 | {
690 | resEl.innerHTML = resValue;
691 | }
692 | else if ('.' == key.charAt(resKey.length))
693 | {
694 | var attrKey = key.substring(resKey.length + 1);
695 | resEl[attrKey] = resValue;
696 | }
697 | }
698 | }
699 | }
700 | }
701 | return resourceBundle;
702 | };
703 |
704 | /**
705 | * Writes installation information to a file.
706 | *
707 | * @return The file path.
708 | */
709 | CSInterface.prototype.dumpInstallationInfo = function()
710 | {
711 | return window.__adobe_cep__.dumpInstallationInfo();
712 | };
713 |
714 | /**
715 | * Retrieves version information for the current Operating System,
716 | * See http://www.useragentstring.com/pages/Chrome/ for Chrome \c navigator.userAgent values.
717 | *
718 | * @return A string containing the OS version, or "unknown Operation System".
719 | * If user customizes the User Agent by setting CEF command parameter "--user-agent", only
720 | * "Mac OS X" or "Windows" will be returned.
721 | */
722 | CSInterface.prototype.getOSInformation = function()
723 | {
724 | var userAgent = navigator.userAgent;
725 |
726 | if ((navigator.platform == "Win32") || (navigator.platform == "Windows"))
727 | {
728 | var winVersion = "Windows";
729 | var winBit = "";
730 | if (userAgent.indexOf("Windows") > -1)
731 | {
732 | if (userAgent.indexOf("Windows NT 5.0") > -1)
733 | {
734 | winVersion = "Windows 2000";
735 | }
736 | else if (userAgent.indexOf("Windows NT 5.1") > -1)
737 | {
738 | winVersion = "Windows XP";
739 | }
740 | else if (userAgent.indexOf("Windows NT 5.2") > -1)
741 | {
742 | winVersion = "Windows Server 2003";
743 | }
744 | else if (userAgent.indexOf("Windows NT 6.0") > -1)
745 | {
746 | winVersion = "Windows Vista";
747 | }
748 | else if (userAgent.indexOf("Windows NT 6.1") > -1)
749 | {
750 | winVersion = "Windows 7";
751 | }
752 | else if (userAgent.indexOf("Windows NT 6.2") > -1)
753 | {
754 | winVersion = "Windows 8";
755 | }
756 | else if (userAgent.indexOf("Windows NT 6.3") > -1)
757 | {
758 | winVersion = "Windows 8.1";
759 | }
760 | else if (userAgent.indexOf("Windows NT 10") > -1)
761 | {
762 | winVersion = "Windows 10";
763 | }
764 |
765 | if (userAgent.indexOf("WOW64") > -1 || userAgent.indexOf("Win64") > -1)
766 | {
767 | winBit = " 64-bit";
768 | }
769 | else
770 | {
771 | winBit = " 32-bit";
772 | }
773 | }
774 |
775 | return winVersion + winBit;
776 | }
777 | else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh"))
778 | {
779 | var result = "Mac OS X";
780 |
781 | if (userAgent.indexOf("Mac OS X") > -1)
782 | {
783 | result = userAgent.substring(userAgent.indexOf("Mac OS X"), userAgent.indexOf(")"));
784 | result = result.replace(/_/g, ".");
785 | }
786 |
787 | return result;
788 | }
789 |
790 | return "Unknown Operation System";
791 | };
792 |
793 | /**
794 | * Opens a page in the default system browser.
795 | *
796 | * Since 4.2.0
797 | *
798 | * @param url The URL of the page/file to open, or the email address.
799 | * Must use HTTP/HTTPS/file/mailto protocol. For example:
800 | * "http://www.adobe.com"
801 | * "https://github.com"
802 | * "file:///C:/log.txt"
803 | * "mailto:test@adobe.com"
804 | *
805 | * @return One of these error codes:\n
806 | *
\n
807 | *
NO_ERROR - 0
\n
808 | *
ERR_UNKNOWN - 1
\n
809 | *
ERR_INVALID_PARAMS - 2
\n
810 | *
ERR_INVALID_URL - 201
\n
811 | *
\n
812 | */
813 | CSInterface.prototype.openURLInDefaultBrowser = function(url)
814 | {
815 | return cep.util.openURLInDefaultBrowser(url);
816 | };
817 |
818 | /**
819 | * Retrieves extension ID.
820 | *
821 | * Since 4.2.0
822 | *
823 | * @return extension ID.
824 | */
825 | CSInterface.prototype.getExtensionID = function()
826 | {
827 | return window.__adobe_cep__.getExtensionId();
828 | };
829 |
830 | /**
831 | * Retrieves the scale factor of screen.
832 | * On Windows platform, the value of scale factor might be different from operating system's scale factor,
833 | * since host application may use its self-defined scale factor.
834 | *
835 | * Since 4.2.0
836 | *
837 | * @return One of the following float number.
838 | *
\n
839 | *
-1.0 when error occurs
\n
840 | *
1.0 means normal screen
\n
841 | *
>1.0 means HiDPI screen
\n
842 | *
\n
843 | */
844 | CSInterface.prototype.getScaleFactor = function()
845 | {
846 | return window.__adobe_cep__.getScaleFactor();
847 | };
848 |
849 | /**
850 | * Set a handler to detect any changes of scale factor. This only works on Mac.
851 | *
852 | * Since 4.2.0
853 | *
854 | * @param handler The function to be called when scale factor is changed.
855 | *
856 | */
857 | CSInterface.prototype.setScaleFactorChangedHandler = function(handler)
858 | {
859 | window.__adobe_cep__.setScaleFactorChangedHandler(handler);
860 | };
861 |
862 | /**
863 | * Retrieves current API version.
864 | *
865 | * Since 4.2.0
866 | *
867 | * @return ApiVersion object.
868 | *
869 | */
870 | CSInterface.prototype.getCurrentApiVersion = function()
871 | {
872 | var apiVersion = JSON.parse(window.__adobe_cep__.getCurrentApiVersion());
873 | return apiVersion;
874 | };
875 |
876 | /**
877 | * Set panel flyout menu by an XML.
878 | *
879 | * Since 5.2.0
880 | *
881 | * Register a callback function for "com.adobe.csxs.events.flyoutMenuClicked" to get notified when a
882 | * menu item is clicked.
883 | * The "data" attribute of event is an object which contains "menuId" and "menuName" attributes.
884 | *
885 | * Register callback functions for "com.adobe.csxs.events.flyoutMenuOpened" and "com.adobe.csxs.events.flyoutMenuClosed"
886 | * respectively to get notified when flyout menu is opened or closed.
887 | *
888 | * @param menu A XML string which describes menu structure.
889 | * An example menu XML:
890 | *
901 | *
902 | */
903 | CSInterface.prototype.setPanelFlyoutMenu = function(menu)
904 | {
905 | if ("string" != typeof menu)
906 | {
907 | return;
908 | }
909 |
910 | window.__adobe_cep__.invokeSync("setPanelFlyoutMenu", menu);
911 | };
912 |
913 | /**
914 | * Updates a menu item in the extension window's flyout menu, by setting the enabled
915 | * and selection status.
916 | *
917 | * Since 5.2.0
918 | *
919 | * @param menuItemLabel The menu item label.
920 | * @param enabled True to enable the item, false to disable it (gray it out).
921 | * @param checked True to select the item, false to deselect it.
922 | *
923 | * @return false when the host application does not support this functionality (HostCapabilities.EXTENDED_PANEL_MENU is false).
924 | * Fails silently if menu label is invalid.
925 | *
926 | * @see HostCapabilities.EXTENDED_PANEL_MENU
927 | */
928 | CSInterface.prototype.updatePanelMenuItem = function(menuItemLabel, enabled, checked)
929 | {
930 | var ret = false;
931 | if (this.getHostCapabilities().EXTENDED_PANEL_MENU)
932 | {
933 | var itemStatus = new MenuItemStatus(menuItemLabel, enabled, checked);
934 | ret = window.__adobe_cep__.invokeSync("updatePanelMenuItem", JSON.stringify(itemStatus));
935 | }
936 | return ret;
937 | };
938 |
939 |
940 | /**
941 | * Set context menu by XML string.
942 | *
943 | * Since 5.2.0
944 | *
945 | * There are a number of conventions used to communicate what type of menu item to create and how it should be handled.
946 | * - an item without menu ID or menu name is disabled and is not shown.
947 | * - if the item name is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL.
948 | * - Checkable attribute takes precedence over Checked attribute.
949 | * - 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.
950 | The Chrome extension contextMenus API was taken as a reference.
951 | https://developer.chrome.com/extensions/contextMenus
952 | * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter.
953 | *
954 | * @param menu A XML string which describes menu structure.
955 | * @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.
956 | *
957 | * @description An example menu XML:
958 | *
969 | */
970 | CSInterface.prototype.setContextMenu = function(menu, callback)
971 | {
972 | if ("string" != typeof menu)
973 | {
974 | return;
975 | }
976 |
977 | window.__adobe_cep__.invokeAsync("setContextMenu", menu, callback);
978 | };
979 |
980 | /**
981 | * Set context menu by JSON string.
982 | *
983 | * Since 6.0.0
984 | *
985 | * There are a number of conventions used to communicate what type of menu item to create and how it should be handled.
986 | * - an item without menu ID or menu name is disabled and is not shown.
987 | * - if the item label is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL.
988 | * - Checkable attribute takes precedence over Checked attribute.
989 | * - 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.
990 | The Chrome extension contextMenus API was taken as a reference.
991 | * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter.
992 | https://developer.chrome.com/extensions/contextMenus
993 | *
994 | * @param menu A JSON string which describes menu structure.
995 | * @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.
996 | *
997 | * @description An example menu JSON:
998 | *
999 | * {
1000 | * "menu": [
1001 | * {
1002 | * "id": "menuItemId1",
1003 | * "label": "testExample1",
1004 | * "enabled": true,
1005 | * "checkable": true,
1006 | * "checked": false,
1007 | * "icon": "./image/small_16X16.png"
1008 | * },
1009 | * {
1010 | * "id": "menuItemId2",
1011 | * "label": "testExample2",
1012 | * "menu": [
1013 | * {
1014 | * "id": "menuItemId2-1",
1015 | * "label": "testExample2-1",
1016 | * "menu": [
1017 | * {
1018 | * "id": "menuItemId2-1-1",
1019 | * "label": "testExample2-1-1",
1020 | * "enabled": false,
1021 | * "checkable": true,
1022 | * "checked": true
1023 | * }
1024 | * ]
1025 | * },
1026 | * {
1027 | * "id": "menuItemId2-2",
1028 | * "label": "testExample2-2",
1029 | * "enabled": true,
1030 | * "checkable": true,
1031 | * "checked": true
1032 | * }
1033 | * ]
1034 | * },
1035 | * {
1036 | * "label": "---"
1037 | * },
1038 | * {
1039 | * "id": "menuItemId3",
1040 | * "label": "testExample3",
1041 | * "enabled": false,
1042 | * "checkable": true,
1043 | * "checked": false
1044 | * }
1045 | * ]
1046 | * }
1047 | *
1048 | */
1049 | CSInterface.prototype.setContextMenuByJSON = function(menu, callback)
1050 | {
1051 | if ("string" != typeof menu)
1052 | {
1053 | return;
1054 | }
1055 |
1056 | window.__adobe_cep__.invokeAsync("setContextMenuByJSON", menu, callback);
1057 | };
1058 |
1059 | /**
1060 | * Updates a context menu item by setting the enabled and selection status.
1061 | *
1062 | * Since 5.2.0
1063 | *
1064 | * @param menuItemID The menu item ID.
1065 | * @param enabled True to enable the item, false to disable it (gray it out).
1066 | * @param checked True to select the item, false to deselect it.
1067 | */
1068 | CSInterface.prototype.updateContextMenuItem = function(menuItemID, enabled, checked)
1069 | {
1070 | var itemStatus = new ContextMenuItemStatus(menuItemID, enabled, checked);
1071 | ret = window.__adobe_cep__.invokeSync("updateContextMenuItem", JSON.stringify(itemStatus));
1072 | };
1073 |
1074 | /**
1075 | * Get the visibility status of an extension window.
1076 | *
1077 | * Since 6.0.0
1078 | *
1079 | * @return true if the extension window is visible; false if the extension window is hidden.
1080 | */
1081 | CSInterface.prototype.isWindowVisible = function()
1082 | {
1083 | return window.__adobe_cep__.invokeSync("isWindowVisible", "");
1084 | };
1085 |
1086 | /**
1087 | * Resize extension's content to the specified dimensions.
1088 | * 1. Works with modal and modeless extensions in all Adobe products.
1089 | * 2. Extension's manifest min/max size constraints apply and take precedence.
1090 | * 3. For panel extensions
1091 | * 3.1 This works in all Adobe products except:
1092 | * * Premiere Pro
1093 | * * Prelude
1094 | * * After Effects
1095 | * 3.2 When the panel is in certain states (especially when being docked),
1096 | * it will not change to the desired dimensions even when the
1097 | * specified size satisfies min/max constraints.
1098 | *
1099 | * Since 6.0.0
1100 | *
1101 | * @param width The new width
1102 | * @param height The new height
1103 | */
1104 | CSInterface.prototype.resizeContent = function(width, height)
1105 | {
1106 | window.__adobe_cep__.resizeContent(width, height);
1107 | };
1108 |
1109 | /**
1110 | * Register the invalid certificate callback for an extension.
1111 | * This callback will be triggered when the extension tries to access the web site that contains the invalid certificate on the main frame.
1112 | * 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.
1113 | *
1114 | * Since 6.1.0
1115 | *
1116 | * @param callback the callback function
1117 | */
1118 | CSInterface.prototype.registerInvalidCertificateCallback = function(callback)
1119 | {
1120 | return window.__adobe_cep__.registerInvalidCertificateCallback(callback);
1121 | };
1122 |
1123 | /**
1124 | * Register an interest in some key events to prevent them from being sent to the host application.
1125 | *
1126 | * This function works with modeless extensions and panel extensions.
1127 | * Generally all the key events will be sent to the host application for these two extensions if the current focused element
1128 | * is not text input or dropdown,
1129 | * If you want to intercept some key events and want them to be handled in the extension, please call this function
1130 | * in advance to prevent them being sent to the host application.
1131 | *
1132 | * Since 6.1.0
1133 | *
1134 | * @param keyEventsInterest A JSON string describing those key events you are interested in. A null object or
1135 | an empty string will lead to removing the interest
1136 | *
1137 | * This JSON string should be an array, each object has following keys:
1138 | *
1139 | * keyCode: [Required] represents an OS system dependent virtual key code identifying
1140 | * the unmodified value of the pressed key.
1141 | * ctrlKey: [optional] a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred.
1142 | * altKey: [optional] a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred.
1143 | * shiftKey: [optional] a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred.
1144 | * metaKey: [optional] (Mac Only) a Boolean that indicates if the Meta key was pressed (true) or not (false) when the event occurred.
1145 | * On Macintosh keyboards, this is the command key. To detect Windows key on Windows, please use keyCode instead.
1146 | * An example JSON string:
1147 | *
1148 | * [
1149 | * {
1150 | * "keyCode": 48
1151 | * },
1152 | * {
1153 | * "keyCode": 123,
1154 | * "ctrlKey": true
1155 | * },
1156 | * {
1157 | * "keyCode": 123,
1158 | * "ctrlKey": true,
1159 | * "metaKey": true
1160 | * }
1161 | * ]
1162 | *
1163 | */
1164 | CSInterface.prototype.registerKeyEventsInterest = function(keyEventsInterest)
1165 | {
1166 | return window.__adobe_cep__.registerKeyEventsInterest(keyEventsInterest);
1167 | };
1168 |
1169 | /**
1170 | * Set the title of the extension window.
1171 | * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver.
1172 | *
1173 | * Since 6.1.0
1174 | *
1175 | * @param title The window title.
1176 | */
1177 | CSInterface.prototype.setWindowTitle = function(title)
1178 | {
1179 | window.__adobe_cep__.invokeSync("setWindowTitle", title);
1180 | };
1181 |
1182 | /**
1183 | * Get the title of the extension window.
1184 | * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver.
1185 | *
1186 | * Since 6.1.0
1187 | *
1188 | * @return The window title.
1189 | */
1190 | CSInterface.prototype.getWindowTitle = function()
1191 | {
1192 | return window.__adobe_cep__.invokeSync("getWindowTitle", "");
1193 | };
1194 |
--------------------------------------------------------------------------------
/Extension Testing/js/main.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | 'use strict';
3 | var extPath;
4 | extPath = location.href;
5 | if(getOS() == "MAC") {
6 | extPath = extPath.substring(7, extPath.length - 11);
7 | }
8 | if(getOS() == "WIN") {
9 | extPath = extPath.substring(8, extPath.length - 11);
10 | }
11 |
12 | console.log("Start");
13 | console.log(extPath);
14 |
15 | }());
16 |
17 | function goIntoJSX() {
18 |
19 | }
20 |
21 | function getOS() {
22 | var userAgent = window.navigator.userAgent,
23 | platform = window.navigator.platform,
24 | macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
25 | windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'],
26 | os = null;
27 |
28 | if(macosPlatforms.indexOf(platform) != -1) {
29 | os = "MAC";
30 | } else if(windowsPlatforms.indexOf(platform) != -1) {
31 | os = "WIN";
32 | }
33 | return os;
34 | }
--------------------------------------------------------------------------------
/Extension Testing/jsx/aftereffects.jsx:
--------------------------------------------------------------------------------
1 | "object"!=typeof JSON&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(t){return t<10?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),"function"==typeof rep&&(i=rep.call(e,t,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;r