├── CC-EXT-SDK ├── templates │ ├── basic │ │ ├── css │ │ │ └── styles.css │ │ ├── js │ │ │ └── main.js │ │ ├── jsx │ │ │ └── hostscript.jsx │ │ ├── index.html │ │ ├── .debug │ │ └── CSXS │ │ │ └── manifest.xml │ ├── default │ │ ├── jsx │ │ │ └── hostscript.jsx │ │ ├── js │ │ │ ├── main.js │ │ │ ├── themeManager.js │ │ │ └── libs │ │ │ │ ├── CSInterface-4.0.0.js │ │ │ │ └── CSInterface.js │ │ ├── index.html │ │ ├── css │ │ │ ├── styles.css │ │ │ └── boilerplate.css │ │ ├── .debug │ │ └── CSXS │ │ │ └── manifest.xml │ ├── theme │ │ ├── jsx │ │ │ └── hostscript.jsx │ │ ├── js │ │ │ ├── main.js │ │ │ ├── themeManager.js │ │ │ └── libs │ │ │ │ └── CSInterface.js │ │ ├── css │ │ │ ├── styles.css │ │ │ └── boilerplate.css │ │ ├── index.html │ │ ├── .debug │ │ └── CSXS │ │ │ └── manifest.xml │ └── topcoat │ │ ├── jsx │ │ └── hostscript.jsx │ │ ├── js │ │ ├── main.js │ │ ├── themeManager.js │ │ └── libs │ │ │ └── CSInterface.js │ │ ├── index.html │ │ ├── css │ │ ├── styles.css │ │ └── boilerplate.css │ │ ├── .debug │ │ └── CSXS │ │ └── manifest.xml ├── disabledebugmode.sh ├── deployext.bat ├── createext.bat ├── setdebugmode.sh ├── setdebugmode.bat ├── NOTICE ├── deployext.sh ├── createext.sh ├── execextendscript.bat ├── execextendscript.sh ├── LICENCE └── README.md ├── CCExt.pyc ├── assets └── screenshot.png ├── AfterEffects-script.sublime-build ├── Photoshop-script.sublime-build ├── Illustrator-script.sublime-build ├── InDesign-script.sublime-build ├── NOTICE ├── .gitignore ├── Main.sublime-menu ├── LICENCE ├── CCExt.py └── README.md /CC-EXT-SDK/templates/basic/css/styles.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/basic/js/main.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | 5 | }()); 6 | 7 | -------------------------------------------------------------------------------- /CCExt.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidderaedt/CC-Extension-Builder-for-Sublime-Text/HEAD/CCExt.pyc -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/basic/jsx/hostscript.jsx: -------------------------------------------------------------------------------- 1 | function sayHello(){ 2 | alert("hello from ExtendScript"); 3 | } 4 | -------------------------------------------------------------------------------- /assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidderaedt/CC-Extension-Builder-for-Sublime-Text/HEAD/assets/screenshot.png -------------------------------------------------------------------------------- /CC-EXT-SDK/disabledebugmode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/libexec/PlistBuddy -c "Delete:PlayerDebugMode" ~/Library/Preferences/com.adobe.CSXS.5.plist 3 | -------------------------------------------------------------------------------- /CC-EXT-SDK/deployext.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set cepdir=CEP 3 | set dest=%APPDATA%\Adobe\%cepdir%\extensions\%2 4 | XCOPY "%1" %dest% /D /E /C /R /I /K /Y >nul 5 | echo %dest% -------------------------------------------------------------------------------- /CC-EXT-SDK/createext.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set sdk=%~dp0 3 | set cepdir=CEP 4 | set dest=%APPDATA%\Adobe\%cepdir%\extensions\%2 5 | XCOPY "%sdk%\templates\%1" %dest% /D /E /C /R /I /K /Y >nul 6 | echo %dest% -------------------------------------------------------------------------------- /AfterEffects-script.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.sh", "ae", "$file"], 3 | "windows": { 4 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.bat", "ae", "$file"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /CC-EXT-SDK/setdebugmode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | /usr/libexec/PlistBuddy -c "Add:PlayerDebugMode string 1" ~/Library/Preferences/com.adobe.CSXS.5.plist 3 | #must kill cfprefsd to take effect 4 | ps -ef | grep "cfprefsd" | awk '{print $2}' | xargs kill -------------------------------------------------------------------------------- /Photoshop-script.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.sh", "ps", "$file"], 3 | "windows": { 4 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.bat", "ps", "$file"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Illustrator-script.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.sh", "ai", "$file"], 3 | "windows": { 4 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.bat", "ps", "$file"] 5 | } 6 | 7 | } 8 | -------------------------------------------------------------------------------- /InDesign-script.sublime-build: -------------------------------------------------------------------------------- 1 | { 2 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.sh", "id", "$file"], 3 | "windows": { 4 | "cmd": ["$packages/CCExtensions/CC-EXT-SDK/execextendscript.bat", "id", "$file"] 5 | } 6 | 7 | } 8 | -------------------------------------------------------------------------------- /CC-EXT-SDK/setdebugmode.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | reg query HKEY_CURRENT_USER\Software\Adobe\CSXS.5 /v PlayerDebugMode 3 | if %errorlevel%==1 GOTO INSTALL 4 | :INSTALL 5 | reg add HKEY_CURRENT_USER\Software\Adobe\CSXS.5 /v PlayerDebugMode /t REG_SZ /d 1 6 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/jsx/hostscript.jsx: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global $, Folder*/ 3 | 4 | 5 | function sayHello(){ 6 | alert("hello from ExtendScript"); 7 | } 8 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/jsx/hostscript.jsx: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global $, Folder*/ 3 | 4 | 5 | function sayHello(){ 6 | alert("hello from ExtendScript"); 7 | } 8 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/jsx/hostscript.jsx: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global $, Folder*/ 3 | 4 | 5 | function sayHello(){ 6 | alert("hello from ExtendScript"); 7 | } 8 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Hello world

12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Adobe Systems Incorporated 2 | 3 | This Software is licensed under the MIT license (see LICENSE file). 4 | 5 | This software uses the following third party libraries that may have 6 | licenses differing from that of the software itself. You can find the 7 | libraries and their respective licenses below. 8 | 9 | (none) -------------------------------------------------------------------------------- /CC-EXT-SDK/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Adobe Systems Incorporated 2 | 3 | This Software is licensed under the MIT license (see LICENSE file). 4 | 5 | This software uses the following third party libraries that may have 6 | licenses differing from that of the software itself. You can find the 7 | libraries and their respective licenses below. 8 | 9 | (none) -------------------------------------------------------------------------------- /CC-EXT-SDK/deployext.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CEPDIR=CEP 4 | EXTDIR=~/Library/Application\ Support/Adobe/$CEPDIR/extensions 5 | 6 | #create extensions folder if does not exist 7 | mkdir -p "$EXTDIR" 8 | 9 | #copy source folder to destination with specified ID 10 | cp -r -X "$1" "$EXTDIR"/$2 11 | 12 | #return resulting path 13 | echo "$EXTDIR"/$2 -------------------------------------------------------------------------------- /CC-EXT-SDK/createext.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASEDIR=$(dirname "$0") 4 | CEPDIR=CEP 5 | EXTDIR=~/Library/Application\ Support/Adobe/$CEPDIR/extensions 6 | 7 | #create extensions folder if does not exist 8 | mkdir -p "$EXTDIR" 9 | 10 | #copy template specified in 1st arg to destination specified in 2nd arg 11 | cp -r "$BASEDIR/templates/$1/" "$EXTDIR/$2" 12 | 13 | #return resulting path 14 | echo "$EXTDIR/$2" -------------------------------------------------------------------------------- /CC-EXT-SDK/execextendscript.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | IF "%1"=="ps" ( 3 | "%PROGRAMFILES%\Adobe\Adobe Photoshop CC 2014\Photoshop.exe" %2 4 | ) ELSE IF "%1"=="ai" ( 5 | "%PROGRAMFILES%\Adobe\Adobe Illustrator CC 2014\Support Files\Contents\Windows\Illustrator.exe" %2 6 | ) ELSE IF "%1"=="ae" ( 7 | "%PROGRAMFILES%\Adobe\Adobe After Effects CC 2014\Support Files\AfterFx.exe" -r %2 8 | ) ELSE ( 9 | echo "Unrecognized adobe program" 10 | ) 11 | 12 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/js/main.js: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global $, window, location, CSInterface, SystemPath, themeManager*/ 3 | 4 | (function () { 5 | 'use strict'; 6 | 7 | var csInterface = new CSInterface(); 8 | 9 | 10 | function init() { 11 | 12 | themeManager.init(); 13 | 14 | $("#btn_test").click(function () { 15 | csInterface.evalScript('sayHello()'); 16 | }); 17 | } 18 | 19 | init(); 20 | 21 | }()); 22 | 23 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/js/main.js: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global $, window, location, CSInterface, SystemPath, themeManager*/ 3 | 4 | (function () { 5 | 'use strict'; 6 | 7 | var csInterface = new CSInterface(); 8 | 9 | 10 | function init() { 11 | 12 | themeManager.init(); 13 | 14 | $("#btn_test").click(function () { 15 | csInterface.evalScript('sayHello()'); 16 | }); 17 | } 18 | 19 | init(); 20 | 21 | }()); 22 | 23 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/js/main.js: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global $, window, location, CSInterface, SystemPath, themeManager*/ 3 | 4 | (function () { 5 | 'use strict'; 6 | 7 | var csInterface = new CSInterface(); 8 | 9 | 10 | function init() { 11 | 12 | themeManager.init(); 13 | 14 | $("#btn_test").click(function () { 15 | csInterface.evalScript('sayHello()'); 16 | }); 17 | } 18 | 19 | init(); 20 | 21 | }()); 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | Icon? 37 | ehthumbs.db 38 | Thumbs.db -------------------------------------------------------------------------------- /CC-EXT-SDK/execextendscript.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | appcode=$1 4 | 5 | if [ "$appcode" = "ps" ] 6 | then 7 | app="Adobe Photoshop CC 2014" 8 | command="do javascript \"#include '$2'\"" 9 | elif [ "$appcode" = "ai" ] 10 | then 11 | app="Adobe Illustrator" 12 | command="do javascript \"#include '$2'\"" 13 | elif [ "$appcode" = "id" ] 14 | then 15 | app="Adobe InDesign CC 2014" 16 | command="do script \"#include '$2'\" language javascript" 17 | elif [ "$appcode" = "ae" ] 18 | then 19 | app="Adobe After Effects CC 2014" 20 | command="DoScriptFile \"$2\"" 21 | fi 22 | 23 | osascript <<-AS 24 | tell application "$app" 25 | $command 26 | end tell 27 | AS 28 | -------------------------------------------------------------------------------- /Main.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "tools", 4 | "children": 5 | [ 6 | { 7 | "id": "ccext", 8 | "caption": "CC Extensions", 9 | "children": 10 | [ 11 | {"caption": "Create Extension", "command": "createext" }, 12 | {"caption": "Open Developer Tools", "command": "showdevtools" }, 13 | {"caption": "Browse Extension Folder", "command": "showextfolder" }, 14 | {"caption": "-", "id":"separator"}, 15 | {"caption": "Enable Debug Mode", "command": "enabledebug" }, 16 | {"caption": "-", "id":"separator"}, 17 | {"caption": "Fix Permissions", "command": "fixpermissions" } 18 | 19 | ] 20 | } 21 | ] 22 | } 23 | ] -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/css/styles.css: -------------------------------------------------------------------------------- 1 | /*Your styles*/ 2 | 3 | 4 | 5 | 6 | 7 | /* 8 | Those classes will be edited at runtime with values specified 9 | by the settings of the CC application 10 | */ 11 | .hostFontColor{} 12 | .hostFontFamily{} 13 | .hostFontSize{} 14 | 15 | /*font family, color and size*/ 16 | .hostFont{} 17 | /*background color*/ 18 | .hostBgd{} 19 | /*lighter background color*/ 20 | .hostBgdLight{} 21 | /*darker background color*/ 22 | .hostBgdDark{} 23 | /*background color and font*/ 24 | .hostElt{} 25 | 26 | 27 | .hostButton{ 28 | border:1px solid; 29 | border-radius:2px; 30 | height:20px; 31 | vertical-align:bottom; 32 | font-family:inherit; 33 | color:inherit; 34 | font-size:inherit; 35 | } -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |

Hello World!

15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/css/styles.css: -------------------------------------------------------------------------------- 1 | /*Your styles*/ 2 | 3 | body { 4 | margin: 10px; 5 | } 6 | 7 | 8 | #content { 9 | margin-right:auto; 10 | margin-left:auto; 11 | vertical-align:middle; 12 | width:100%; 13 | } 14 | 15 | 16 | #btn_test{ 17 | width: 100%; 18 | } 19 | 20 | 21 | 22 | 23 | /* 24 | Those classes will be edited at runtime with values specified 25 | by the settings of the CC application 26 | */ 27 | .hostFontColor{} 28 | .hostFontFamily{} 29 | .hostFontSize{} 30 | 31 | /*font family, color and size*/ 32 | .hostFont{} 33 | /*background color*/ 34 | .hostBgd{} 35 | /*lighter background color*/ 36 | .hostBgdLight{} 37 | /*darker background color*/ 38 | .hostBgdDark{} 39 | /*background color and font*/ 40 | .hostElt{} 41 | 42 | 43 | .hostButton{ 44 | border:1px solid; 45 | border-radius:2px; 46 | height:20px; 47 | vertical-align:bottom; 48 | font-family:inherit; 49 | color:inherit; 50 | font-size:inherit; 51 | } -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/css/styles.css: -------------------------------------------------------------------------------- 1 | /*Your styles*/ 2 | 3 | body { 4 | margin: 10px; 5 | } 6 | 7 | 8 | #content { 9 | margin-right:auto; 10 | margin-left:auto; 11 | vertical-align:middle; 12 | width:100%; 13 | } 14 | 15 | 16 | #btn_test{ 17 | width: 100%; 18 | } 19 | 20 | 21 | 22 | 23 | /* 24 | Those classes will be edited at runtime with values specified 25 | by the settings of the CC application 26 | */ 27 | .hostFontColor{} 28 | .hostFontFamily{} 29 | .hostFontSize{} 30 | 31 | /*font family, color and size*/ 32 | .hostFont{} 33 | /*background color*/ 34 | .hostBgd{} 35 | /*lighter background color*/ 36 | .hostBgdLight{} 37 | /*darker background color*/ 38 | .hostBgdDark{} 39 | /*background color and font*/ 40 | .hostElt{} 41 | 42 | 43 | .hostButton{ 44 | border:1px solid; 45 | border-radius:2px; 46 | height:20px; 47 | vertical-align:bottom; 48 | font-family:inherit; 49 | color:inherit; 50 | font-size:inherit; 51 | } -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/basic/.debug: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/.debug: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/.debug: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/.debug: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /CC-EXT-SDK/LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/basic/CSXS/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ./index.html 47 | ./jsx/hostscript.jsx 48 | 49 | 50 | true 51 | 52 | 53 | Panel 54 | Extension-Name 55 | 56 | 57 | 300 58 | 300 59 | 60 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /CCExt.py: -------------------------------------------------------------------------------- 1 | import sublime, sublime_plugin, os, subprocess, webbrowser 2 | from os.path import dirname, realpath 3 | 4 | extid = "com.example.ext" 5 | PLUGIN_PATH = dirname(realpath(__file__)) 6 | SDK_PATH = PLUGIN_PATH + "/cc-ext-sdk/" 7 | 8 | USER_DIR = os.path.expanduser("~") 9 | IS_WIN = (os.name == "nt") 10 | if IS_WIN: 11 | LIB_PATH = USER_DIR + "/AppData/Roaming/Adobe/" 12 | SC_EXT = "bat" 13 | else : 14 | LIB_PATH = USER_DIR + "/Library/Application Support/Adobe/" 15 | SC_EXT = "sh" 16 | # CC 2014 apps 17 | CEP_FOLDER = "CEP/" 18 | # CC 2014 apps 19 | #CEP_FOLDER = "CEP/" 20 | CEP_PATH = LIB_PATH + CEP_FOLDER 21 | CEP_EXT_PATH = CEP_PATH + "extensions/" 22 | 23 | 24 | class CreateextCommand(sublime_plugin.TextCommand): 25 | 26 | def run(self, edit): 27 | self.view.window().show_input_panel("Extension ID:", extid, self.on_done, None, None) 28 | pass 29 | 30 | def on_done(self, text): 31 | global extid 32 | extid = text 33 | self.view.window().run_command("exec", {"cmd": [SDK_PATH + "createext." + SC_EXT, "default", text]}); 34 | #ugly timeout until I understand how to deal with async file creation 35 | sublime.set_timeout(self.openDebugFile, 300); 36 | 37 | def openDebugFile(self): 38 | debugview = self.view.window().open_file(CEP_EXT_PATH + extid + "/.debug"); 39 | #ugly timeout until I understand how to deal with async file creation 40 | sublime.set_timeout(lambda:self.replaceDebugId(debugview), 300); 41 | 42 | def replaceDebugId(self, v): 43 | v.window().run_command("replaceid") 44 | v.window().run_command("save") 45 | manifview = v.window().open_file(CEP_EXT_PATH + extid + "/CSXS/manifest.xml"); 46 | #ugly timeout until I understand how to deal with async file creation 47 | sublime.set_timeout(lambda:self.replaceId(manifview), 300); 48 | 49 | def replaceId(self, v): 50 | v.window().run_command("replaceid") 51 | v.window().run_command("save") 52 | 53 | 54 | class EnabledebugCommand(sublime_plugin.TextCommand): 55 | 56 | def run(self, edit): 57 | self.view.window().run_command("exec", {"cmd":[SDK_PATH + "setdebugmode." + SC_EXT]}); 58 | 59 | 60 | 61 | class FixpermissionsCommand(sublime_plugin.TextCommand): 62 | 63 | def run(self, edit): 64 | subprocess.call(["chmod", "-R", "755", SDK_PATH ]); 65 | 66 | 67 | 68 | class ShowdevtoolsCommand(sublime_plugin.TextCommand): 69 | 70 | def run(self, edit): 71 | # Warning: Static debugging port 72 | webbrowser.open_new_tab("http://localhost:8088" ); 73 | 74 | 75 | 76 | class ReplaceidCommand(sublime_plugin.TextCommand): 77 | 78 | def run(self, edit): 79 | matches = reversed(self.view.find_all("com.example.ext")) 80 | for region in matches: 81 | self.view.replace(edit, region, extid) 82 | 83 | 84 | 85 | class ShowextfolderCommand(sublime_plugin.TextCommand): 86 | 87 | def run(self, edit): 88 | self.view.window().run_command("open_dir", {"dir": CEP_EXT_PATH}); 89 | 90 | 91 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/CSXS/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | ./index.html 39 | ./jsx/hostscript.jsx 40 | 41 | 42 | true 43 | 44 | 45 | Panel 46 | Extension-Name 47 | 48 | 49 | 300 50 | 300 51 | 52 | 60 | 61 | 62 | 63 | ./icons/iconNormal.png 64 | ./icons/iconRollover.png 65 | ./icons/iconDisabled.png 66 | ./icons/iconDarkNormal.png 67 | ./icons/iconDarkRollover.png 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/CSXS/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | ./index.html 41 | ./jsx/hostscript.jsx 42 | 43 | 44 | true 45 | 46 | 47 | Panel 48 | Extension-Name 49 | 50 | 51 | 300 52 | 300 53 | 54 | 62 | 63 | 64 | 65 | ./icons/iconNormal.png 66 | ./icons/iconRollover.png 67 | ./icons/iconDisabled.png 68 | ./icons/iconDarkNormal.png 69 | ./icons/iconDarkRollover.png 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/CSXS/manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | ./index.html 41 | ./jsx/hostscript.jsx 42 | 43 | 44 | true 45 | 46 | 47 | Panel 48 | Extension-Name 49 | 50 | 51 | 300 52 | 300 53 | 54 | 62 | 63 | 64 | 65 | ./icons/iconNormal.png 66 | ./icons/iconRollover.png 67 | ./icons/iconDisabled.png 68 | ./icons/iconDarkNormal.png 69 | ./icons/iconDarkRollover.png 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #CC Extension Builder for Sublime Text 2 | 3 | This Sublime Text 2 package lets you create HTML/CSS/JS based extension panels for Adobe Creative Cloud applications such as Photoshop, Illustrator, InDesign, or After Effects. It is meant for the current CEP4.2 architecture (compatible with the current "CC" version of those apps). 4 | 5 | 6 | ![image](assets/screenshot.png) 7 | 8 | 9 | ##Installation 10 | 11 | 12 | 1. [Download the ZIP of this repository](https://github.com/davidderaedt/CC-Extension-Builder-for-Sublime-Text/archive/master.zip), 13 | 2. Unzip and copy the folder to the `Packages` directory (which you can find under Sublime's `Preferences > Browse Packages` menu) 14 | 3. Relaunch Sublime 15 | 16 | You should now find a new `CC Extensions` menu under the `Tools` menu. 17 | 18 | Support for *Package control* will come later. 19 | 20 | 21 | ##Usage 22 | 23 | If you're new to HTML extension development for CC apps, you must first configure your system to allow custom extension debugging. To do so, choose `Tools > CC Extensions > Enable Debug Mode`. You only have to do this once. 24 | 25 | ###Creating a new extension 26 | 27 | Then, go to `Tools > CC Extensions > Create Extension`. When prompted, choose your extension unique ID, and hit enter. It will generate a pre-deployed extension panel and open the corresponding `manifest.xml` file, which you must edit according to your needs (starting with the "host" list, which determines which CC app this extension applies to, and is set to Photoshop by default). 28 | 29 | At this stage, you should be able to open your CC application (say, Photoshop) and choose `Window > extensions > Extension-Name`, which should open a new panel containing a simple button. 30 | 31 | ###Developing your extension 32 | 33 | First, you should select `Project > Add Folder To Project` and choose the created `com.example.extension` folder to get access to your panel's HTML, CSS and javascript files in your sublime project. 34 | 35 | To know more about HTML panel development, please refer to the [official documentation](http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/cs-extension-builder/pdfs/CC_Extension_SDK.pdf). 36 | 37 | It is a good practice to have your business logic in separated JSX (extendscript) files. To test those files directly, new build systems are added with this package. For example the build system `Photoshop script` will execute the extendScript file directly in Photoshop, without having to reload your panel. Note that only Photoshop, Illustrator and InDesign are supported at this stage. 38 | 39 | 40 | ##Troubleshooting 41 | 42 | If nothing seems to happen, chances are you there was a permission issue with the plugin. To fix this, choose `Tools > CC Extensions > Fix Permissions`. 43 | 44 | If an extension folder was indeed created, but your CC apps prompts you with an "Unable to load extension" error (or something similar), you should make sure you correctly enabled debug mode on your system. 45 | 46 | 47 | ##About 48 | 49 | This plugin was developped on top of the unofficial [Creative Cloud Extension SDK](https://github.com/davidderaedt/CC-EXT-SDK). 50 | -------------------------------------------------------------------------------- /CC-EXT-SDK/README.md: -------------------------------------------------------------------------------- 1 | #Creative Cloud Extension SDK 2 | 3 | 4 | Unofficial SDK for building HTML based extensions for Adobe Creative Cloud applications. As of now, it consists of some command line tools, scripts and some templates. 5 | 6 | *If you're looking for an easier way to build HTML extensions, check out the [Sublime Text plugin](https://github.com/davidderaedt/CC-Extension-Builder-for-Sublime-Text) or the [Brackets extension](https://github.com/davidderaedt/CC-Extension-Builder-for-Brackets), both built on top of this SDK.* 7 | 8 | ###createext 9 | 10 | Creates an extension panel from a given template and deploys it. 11 | 12 | Usage: 13 | 14 | * osx: `createext.sh ` 15 | * win: `createext.bat ` 16 | 17 | Parameters: 18 | 19 | * `templatename` the name of the template folder you wish to use as a source 20 | * `extid` a unique id for your extension 21 | 22 | Returns: the path of the created extension folder. 23 | 24 | Example: 25 | 26 | `createext.sh default com.example.ext` 27 | 28 | ... will create the extension *com.example.ext* from the `default` template located in the `templates/default` folder. The extension panel should be ready to use from the corresponding Adobe application as long as you've enable debugging on the system (see the `debugmode` commands below). 29 | 30 | You can of course add your own templates to the `templates` folder. Just make sure the extension ID used in the manifest is `com.example.ext`. 31 | 32 | For additional extension samples, check out the [official samples repository](https://github.com/Adobe-CEP/Samples). 33 | 34 | 35 | 36 | ###deployext 37 | 38 | Copies an existing extension folder to the appropriate location for it to be executed. 39 | 40 | Usage: 41 | 42 | * osx : `deployext.sh ` 43 | * win : `deployext.bat ` 44 | 45 | Parameters: 46 | 47 | * `extfolder` the location of the extension folder you wish to deploy 48 | * `extid` the extension unique id (ie `com.example.my_ext`) 49 | 50 | Returns: the path of the created folder. 51 | 52 | 53 | Example: To deploy an extension located at `~/my-awesome-ext/` with the ID `com.example.awesome-ext`, run: 54 | 55 | `deployext.sh ~/my-awesome-ext/ com.example.awesome-ext` 56 | 57 | For a sample extension to start with, check out the [official samples repository](https://github.com/Adobe-CEP/Samples). 58 | 59 | 60 | ###setdebugmode and disabledebugmode 61 | 62 | For extensions to run, you should first run `setdebugmode.sh` (mac) or `setdebugmode.bat` (win) once to properly configure your system for extension development. Otherwise, extensions will refuse to launch. 63 | `disabledebugmode.sh` reverts to the default behavior. Windows users should update the CEP registry key manually. 64 | 65 | 66 | ###execextendscript 67 | 68 | This script executes an ExtendScript (jsx) file via command line in Photoshop, Illustrator, InDesign, or After Effects. Unfortunately, InDesign scripts are not supported on Windows for now. 69 | 70 | * osx: `execextendscript.sh ` 71 | * win: `execextendscript.bat ` 72 | 73 | Parameters: 74 | 75 | * `appID`: *ps* (Photoshop CC), *ai* (Illustrator CC), *id* (InDesign CC), or *ae* (After Effects CC) 76 | * `filepath`: file path of the JSX file to be executed. 77 | 78 | Example: to execute `test.jsx` in Photoshop from the command line on the mac, use: 79 | 80 | `execextendscript.sh ps "~/Desktop/test.jsx"` 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/js/themeManager.js: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global window, document, CSInterface*/ 3 | 4 | 5 | /* 6 | 7 | Responsible for overwriting CSS at runtime according to CC app 8 | settings as defined by the end user. 9 | 10 | */ 11 | 12 | var themeManager = (function () { 13 | 'use strict'; 14 | 15 | /** 16 | * Convert the Color object to string in hexadecimal format; 17 | */ 18 | function toHex(color, delta) { 19 | 20 | function computeValue(value, delta) { 21 | var computedValue = !isNaN(delta) ? value + delta : value; 22 | if (computedValue < 0) { 23 | computedValue = 0; 24 | } else if (computedValue > 255) { 25 | computedValue = 255; 26 | } 27 | 28 | computedValue = Math.floor(computedValue); 29 | 30 | computedValue = computedValue.toString(16); 31 | return computedValue.length === 1 ? "0" + computedValue : computedValue; 32 | } 33 | 34 | var hex = ""; 35 | if (color) { 36 | hex = computeValue(color.red, delta) + computeValue(color.green, delta) + computeValue(color.blue, delta); 37 | } 38 | return hex; 39 | } 40 | 41 | 42 | function reverseColor(color, delta) { 43 | return toHex({ 44 | red: Math.abs(255 - color.red), 45 | green: Math.abs(255 - color.green), 46 | blue: Math.abs(255 - color.blue) 47 | }, 48 | delta); 49 | } 50 | 51 | 52 | function addRule(stylesheetId, selector, rule) { 53 | var stylesheet = document.getElementById(stylesheetId); 54 | 55 | if (stylesheet) { 56 | stylesheet = stylesheet.sheet; 57 | if (stylesheet.addRule) { 58 | stylesheet.addRule(selector, rule); 59 | } else if (stylesheet.insertRule) { 60 | stylesheet.insertRule(selector + ' { ' + rule + ' }', stylesheet.cssRules.length); 61 | } 62 | } 63 | } 64 | 65 | 66 | 67 | /** 68 | * Update the theme with the AppSkinInfo retrieved from the host product. 69 | */ 70 | function updateThemeWithAppSkinInfo(appSkinInfo) { 71 | 72 | var panelBgColor = appSkinInfo.panelBackgroundColor.color; 73 | var bgdColor = toHex(panelBgColor); 74 | 75 | var darkBgdColor = toHex(panelBgColor, 20); 76 | 77 | var fontColor = "F0F0F0"; 78 | if (panelBgColor.red > 122) { 79 | fontColor = "000000"; 80 | } 81 | var lightBgdColor = toHex(panelBgColor, -100); 82 | 83 | var styleId = "hostStyle"; 84 | 85 | addRule(styleId, ".hostElt", "background-color:" + "#" + bgdColor); 86 | addRule(styleId, ".hostElt", "font-size:" + appSkinInfo.baseFontSize + "px;"); 87 | addRule(styleId, ".hostElt", "font-family:" + appSkinInfo.baseFontFamily); 88 | addRule(styleId, ".hostElt", "color:" + "#" + fontColor); 89 | 90 | addRule(styleId, ".hostBgd", "background-color:" + "#" + bgdColor); 91 | addRule(styleId, ".hostBgdDark", "background-color: " + "#" + darkBgdColor); 92 | addRule(styleId, ".hostBgdLight", "background-color: " + "#" + lightBgdColor); 93 | addRule(styleId, ".hostFontSize", "font-size:" + appSkinInfo.baseFontSize + "px;"); 94 | addRule(styleId, ".hostFontFamily", "font-family:" + appSkinInfo.baseFontFamily); 95 | addRule(styleId, ".hostFontColor", "color:" + "#" + fontColor); 96 | 97 | addRule(styleId, ".hostFont", "font-size:" + appSkinInfo.baseFontSize + "px;"); 98 | addRule(styleId, ".hostFont", "font-family:" + appSkinInfo.baseFontFamily); 99 | addRule(styleId, ".hostFont", "color:" + "#" + fontColor); 100 | 101 | addRule(styleId, ".hostButton", "background-color:" + "#" + darkBgdColor); 102 | addRule(styleId, ".hostButton:hover", "background-color:" + "#" + bgdColor); 103 | addRule(styleId, ".hostButton:active", "background-color:" + "#" + darkBgdColor); 104 | addRule(styleId, ".hostButton", "border-color: " + "#" + lightBgdColor); 105 | 106 | } 107 | 108 | 109 | function onAppThemeColorChanged(event) { 110 | var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; 111 | updateThemeWithAppSkinInfo(skinInfo); 112 | } 113 | 114 | 115 | function init() { 116 | 117 | var csInterface = new CSInterface(); 118 | 119 | updateThemeWithAppSkinInfo(csInterface.hostEnvironment.appSkinInfo); 120 | 121 | csInterface.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT, onAppThemeColorChanged); 122 | } 123 | 124 | return { 125 | init: init 126 | }; 127 | 128 | }()); 129 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/js/themeManager.js: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global window, document, CSInterface*/ 3 | 4 | 5 | /* 6 | 7 | Responsible for overwriting CSS at runtime according to CC app 8 | settings as defined by the end user. 9 | 10 | */ 11 | 12 | var themeManager = (function () { 13 | 'use strict'; 14 | 15 | /** 16 | * Convert the Color object to string in hexadecimal format; 17 | */ 18 | function toHex(color, delta) { 19 | 20 | function computeValue(value, delta) { 21 | var computedValue = !isNaN(delta) ? value + delta : value; 22 | if (computedValue < 0) { 23 | computedValue = 0; 24 | } else if (computedValue > 255) { 25 | computedValue = 255; 26 | } 27 | 28 | computedValue = Math.floor(computedValue); 29 | 30 | computedValue = computedValue.toString(16); 31 | return computedValue.length === 1 ? "0" + computedValue : computedValue; 32 | } 33 | 34 | var hex = ""; 35 | if (color) { 36 | hex = computeValue(color.red, delta) + computeValue(color.green, delta) + computeValue(color.blue, delta); 37 | } 38 | return hex; 39 | } 40 | 41 | 42 | function reverseColor(color, delta) { 43 | return toHex({ 44 | red: Math.abs(255 - color.red), 45 | green: Math.abs(255 - color.green), 46 | blue: Math.abs(255 - color.blue) 47 | }, 48 | delta); 49 | } 50 | 51 | 52 | function addRule(stylesheetId, selector, rule) { 53 | var stylesheet = document.getElementById(stylesheetId); 54 | 55 | if (stylesheet) { 56 | stylesheet = stylesheet.sheet; 57 | if (stylesheet.addRule) { 58 | stylesheet.addRule(selector, rule); 59 | } else if (stylesheet.insertRule) { 60 | stylesheet.insertRule(selector + ' { ' + rule + ' }', stylesheet.cssRules.length); 61 | } 62 | } 63 | } 64 | 65 | 66 | 67 | /** 68 | * Update the theme with the AppSkinInfo retrieved from the host product. 69 | */ 70 | function updateThemeWithAppSkinInfo(appSkinInfo) { 71 | 72 | var panelBgColor = appSkinInfo.panelBackgroundColor.color; 73 | var bgdColor = toHex(panelBgColor); 74 | 75 | var darkBgdColor = toHex(panelBgColor, 20); 76 | 77 | var fontColor = "F0F0F0"; 78 | if (panelBgColor.red > 122) { 79 | fontColor = "000000"; 80 | } 81 | var lightBgdColor = toHex(panelBgColor, -100); 82 | 83 | var styleId = "hostStyle"; 84 | 85 | addRule(styleId, ".hostElt", "background-color:" + "#" + bgdColor); 86 | addRule(styleId, ".hostElt", "font-size:" + appSkinInfo.baseFontSize + "px;"); 87 | addRule(styleId, ".hostElt", "font-family:" + appSkinInfo.baseFontFamily); 88 | addRule(styleId, ".hostElt", "color:" + "#" + fontColor); 89 | 90 | addRule(styleId, ".hostBgd", "background-color:" + "#" + bgdColor); 91 | addRule(styleId, ".hostBgdDark", "background-color: " + "#" + darkBgdColor); 92 | addRule(styleId, ".hostBgdLight", "background-color: " + "#" + lightBgdColor); 93 | addRule(styleId, ".hostFontSize", "font-size:" + appSkinInfo.baseFontSize + "px;"); 94 | addRule(styleId, ".hostFontFamily", "font-family:" + appSkinInfo.baseFontFamily); 95 | addRule(styleId, ".hostFontColor", "color:" + "#" + fontColor); 96 | 97 | addRule(styleId, ".hostFont", "font-size:" + appSkinInfo.baseFontSize + "px;"); 98 | addRule(styleId, ".hostFont", "font-family:" + appSkinInfo.baseFontFamily); 99 | addRule(styleId, ".hostFont", "color:" + "#" + fontColor); 100 | 101 | addRule(styleId, ".hostButton", "background-color:" + "#" + darkBgdColor); 102 | addRule(styleId, ".hostButton:hover", "background-color:" + "#" + bgdColor); 103 | addRule(styleId, ".hostButton:active", "background-color:" + "#" + darkBgdColor); 104 | addRule(styleId, ".hostButton", "border-color: " + "#" + lightBgdColor); 105 | 106 | } 107 | 108 | 109 | function onAppThemeColorChanged(event) { 110 | var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; 111 | updateThemeWithAppSkinInfo(skinInfo); 112 | } 113 | 114 | 115 | function init() { 116 | 117 | var csInterface = new CSInterface(); 118 | 119 | updateThemeWithAppSkinInfo(csInterface.hostEnvironment.appSkinInfo); 120 | 121 | csInterface.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT, onAppThemeColorChanged); 122 | } 123 | 124 | return { 125 | init: init 126 | }; 127 | 128 | }()); 129 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/js/themeManager.js: -------------------------------------------------------------------------------- 1 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */ 2 | /*global window, document, CSInterface*/ 3 | 4 | 5 | /* 6 | 7 | Responsible for overwriting CSS at runtime according to CC app 8 | settings as defined by the end user. 9 | 10 | */ 11 | 12 | var themeManager = (function () { 13 | 'use strict'; 14 | 15 | /** 16 | * Convert the Color object to string in hexadecimal format; 17 | */ 18 | function toHex(color, delta) { 19 | 20 | function computeValue(value, delta) { 21 | var computedValue = !isNaN(delta) ? value + delta : value; 22 | if (computedValue < 0) { 23 | computedValue = 0; 24 | } else if (computedValue > 255) { 25 | computedValue = 255; 26 | } 27 | 28 | computedValue = Math.floor(computedValue); 29 | 30 | computedValue = computedValue.toString(16); 31 | return computedValue.length === 1 ? "0" + computedValue : computedValue; 32 | } 33 | 34 | var hex = ""; 35 | if (color) { 36 | hex = computeValue(color.red, delta) + computeValue(color.green, delta) + computeValue(color.blue, delta); 37 | } 38 | return hex; 39 | } 40 | 41 | 42 | function reverseColor(color, delta) { 43 | return toHex({ 44 | red: Math.abs(255 - color.red), 45 | green: Math.abs(255 - color.green), 46 | blue: Math.abs(255 - color.blue) 47 | }, 48 | delta); 49 | } 50 | 51 | 52 | function addRule(stylesheetId, selector, rule) { 53 | var stylesheet = document.getElementById(stylesheetId); 54 | 55 | if (stylesheet) { 56 | stylesheet = stylesheet.sheet; 57 | if (stylesheet.addRule) { 58 | stylesheet.addRule(selector, rule); 59 | } else if (stylesheet.insertRule) { 60 | stylesheet.insertRule(selector + ' { ' + rule + ' }', stylesheet.cssRules.length); 61 | } 62 | } 63 | } 64 | 65 | 66 | 67 | /** 68 | * Update the theme with the AppSkinInfo retrieved from the host product. 69 | */ 70 | function updateThemeWithAppSkinInfo(appSkinInfo) { 71 | 72 | var panelBgColor = appSkinInfo.panelBackgroundColor.color; 73 | var bgdColor = toHex(panelBgColor); 74 | 75 | var darkBgdColor = toHex(panelBgColor, 20); 76 | 77 | var fontColor = "F0F0F0"; 78 | if (panelBgColor.red > 122) { 79 | fontColor = "000000"; 80 | } 81 | var lightBgdColor = toHex(panelBgColor, -100); 82 | 83 | var styleId = "hostStyle"; 84 | 85 | addRule(styleId, ".hostElt", "background-color:" + "#" + bgdColor); 86 | addRule(styleId, ".hostElt", "font-size:" + appSkinInfo.baseFontSize + "px;"); 87 | addRule(styleId, ".hostElt", "font-family:" + appSkinInfo.baseFontFamily); 88 | addRule(styleId, ".hostElt", "color:" + "#" + fontColor); 89 | 90 | addRule(styleId, ".hostBgd", "background-color:" + "#" + bgdColor); 91 | addRule(styleId, ".hostBgdDark", "background-color: " + "#" + darkBgdColor); 92 | addRule(styleId, ".hostBgdLight", "background-color: " + "#" + lightBgdColor); 93 | addRule(styleId, ".hostFontSize", "font-size:" + appSkinInfo.baseFontSize + "px;"); 94 | addRule(styleId, ".hostFontFamily", "font-family:" + appSkinInfo.baseFontFamily); 95 | addRule(styleId, ".hostFontColor", "color:" + "#" + fontColor); 96 | 97 | addRule(styleId, ".hostFont", "font-size:" + appSkinInfo.baseFontSize + "px;"); 98 | addRule(styleId, ".hostFont", "font-family:" + appSkinInfo.baseFontFamily); 99 | addRule(styleId, ".hostFont", "color:" + "#" + fontColor); 100 | 101 | addRule(styleId, ".hostButton", "background-color:" + "#" + darkBgdColor); 102 | addRule(styleId, ".hostButton:hover", "background-color:" + "#" + bgdColor); 103 | addRule(styleId, ".hostButton:active", "background-color:" + "#" + darkBgdColor); 104 | addRule(styleId, ".hostButton", "border-color: " + "#" + lightBgdColor); 105 | 106 | } 107 | 108 | 109 | function onAppThemeColorChanged(event) { 110 | var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; 111 | updateThemeWithAppSkinInfo(skinInfo); 112 | } 113 | 114 | 115 | function init() { 116 | 117 | var csInterface = new CSInterface(); 118 | 119 | updateThemeWithAppSkinInfo(csInterface.hostEnvironment.appSkinInfo); 120 | 121 | csInterface.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT, onAppThemeColorChanged); 122 | } 123 | 124 | return { 125 | init: init 126 | }; 127 | 128 | }()); 129 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/css/boilerplate.css: -------------------------------------------------------------------------------- 1 | /* 2 | * HTML5 ✰ Boilerplate 3 | * 4 | * What follows is the result of much research on cross-browser styling. 5 | * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, 6 | * Kroc Camen, and the H5BP dev community and team. 7 | * 8 | * Detailed information about this CSS: h5bp.com/css 9 | * 10 | * ==|== normalize ========================================================== 11 | */ 12 | 13 | 14 | /* ============================================================================= 15 | HTML5 display definitions 16 | ========================================================================== */ 17 | 18 | article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } 19 | audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } 20 | audio:not([controls]) { display: none; } 21 | [hidden] { display: none; } 22 | 23 | 24 | /* ============================================================================= 25 | Base 26 | ========================================================================== */ 27 | 28 | /* 29 | * 1. Correct text resizing oddly in IE6/7 when body font-size is set using em units 30 | * 2. Force vertical scrollbar in non-IE 31 | * 3. Prevent iOS text size adjust on device orientation change, without disabling user zoom: h5bp.com/g 32 | */ 33 | 34 | html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } 35 | 36 | body { margin: 0; font-size: 100%; line-height: 1.231; } 37 | 38 | body, button, input, select, textarea { font-family: helvetica, arial,"lucida grande", verdana, "メイリオ", "MS Pゴシック", sans-serif; color: #222; } 39 | /* 40 | * Remove text-shadow in selection highlight: h5bp.com/i 41 | * These selection declarations have to be separate 42 | * Also: hot pink! (or customize the background color to match your design) 43 | */ 44 | 45 | ::selection { text-shadow: none; background-color: highlight; color: highlighttext; } 46 | 47 | 48 | /* ============================================================================= 49 | Links 50 | ========================================================================== */ 51 | 52 | a { color: #00e; } 53 | a:visited { color: #551a8b; } 54 | a:hover { color: #06e; } 55 | a:focus { outline: thin dotted; } 56 | 57 | /* Improve readability when focused and hovered in all browsers: h5bp.com/h */ 58 | a:hover, a:active { outline: 0; } 59 | 60 | 61 | /* ============================================================================= 62 | Typography 63 | ========================================================================== */ 64 | 65 | abbr[title] { border-bottom: 1px dotted; } 66 | 67 | b, strong { font-weight: bold; } 68 | 69 | blockquote { margin: 1em 40px; } 70 | 71 | dfn { font-style: italic; } 72 | 73 | hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } 74 | 75 | ins { background: #ff9; color: #000; text-decoration: none; } 76 | 77 | mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; } 78 | 79 | /* Redeclare monospace font family: h5bp.com/j */ 80 | pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; } 81 | 82 | /* Improve readability of pre-formatted text in all browsers */ 83 | pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; } 84 | 85 | q { quotes: none; } 86 | q:before, q:after { content: ""; content: none; } 87 | 88 | small { font-size: 85%; } 89 | 90 | /* Position subscript and superscript content without affecting line-height: h5bp.com/k */ 91 | sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } 92 | sup { top: -0.5em; } 93 | sub { bottom: -0.25em; } 94 | 95 | 96 | /* ============================================================================= 97 | Lists 98 | ========================================================================== */ 99 | 100 | ul, ol { margin: 1em 0; padding: 0 0 0 40px; } 101 | dd { margin: 0 0 0 40px; } 102 | nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; } 103 | 104 | 105 | /* ============================================================================= 106 | Embedded content 107 | ========================================================================== */ 108 | 109 | /* 110 | * 1. Improve image quality when scaled in IE7: h5bp.com/d 111 | * 2. Remove the gap between images and borders on image containers: h5bp.com/e 112 | */ 113 | 114 | img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; } 115 | 116 | /* 117 | * Correct overflow not hidden in IE9 118 | */ 119 | 120 | svg:not(:root) { overflow: hidden; } 121 | 122 | 123 | /* ============================================================================= 124 | Figures 125 | ========================================================================== */ 126 | 127 | figure { margin: 0; } 128 | 129 | 130 | /* ============================================================================= 131 | Forms 132 | ========================================================================== */ 133 | 134 | form { margin: 0; } 135 | fieldset { border: 0; margin: 0; padding: 0; } 136 | 137 | /* Indicate that 'label' will shift focus to the associated form element */ 138 | label { cursor: pointer; } 139 | 140 | /* 141 | * 1. Correct color not inheriting in IE6/7/8/9 142 | * 2. Correct alignment displayed oddly in IE6/7 143 | */ 144 | 145 | legend { border: 0; *margin-left: -7px; padding: 0; } 146 | 147 | /* 148 | * 1. Correct font-size not inheriting in all browsers 149 | * 2. Remove margins in FF3/4 S5 Chrome 150 | * 3. Define consistent vertical alignment display in all browsers 151 | */ 152 | 153 | button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; } 154 | 155 | /* 156 | * 1. Define line-height as normal to match FF3/4 (set using !important in the UA stylesheet) 157 | */ 158 | 159 | button, input { line-height: normal; } 160 | 161 | /* 162 | * 1. Display hand cursor for clickable form elements 163 | * 2. Allow styling of clickable form elements in iOS 164 | * 3. Correct inner spacing displayed oddly in IE7 (doesn't effect IE6) 165 | */ 166 | 167 | button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; *overflow: visible; } 168 | 169 | /* 170 | * Consistent box sizing and appearance 171 | */ 172 | 173 | input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; } 174 | input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; } 175 | input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } 176 | 177 | /* 178 | * Remove inner padding and border in FF3/4: h5bp.com/l 179 | */ 180 | 181 | button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } 182 | 183 | /* 184 | * 1. Remove default vertical scrollbar in IE6/7/8/9 185 | * 2. Allow only vertical resizing 186 | */ 187 | 188 | textarea { overflow: auto; vertical-align: top; resize: vertical; } 189 | 190 | /* Colors for form validity */ 191 | input:valid, textarea:valid { } 192 | input:invalid, textarea:invalid { background-color: #f0dddd; } 193 | 194 | 195 | /* ============================================================================= 196 | Tables 197 | ========================================================================== */ 198 | 199 | table { border-collapse: collapse; border-spacing: 0; } 200 | td { vertical-align: top; } 201 | 202 | 203 | /* ==|== primary styles ===================================================== 204 | Author: 205 | ========================================================================== */ 206 | 207 | /* ==|== media queries ====================================================== 208 | PLACEHOLDER Media Queries for Responsive Design. 209 | These override the primary ('mobile first') styles 210 | Modify as content requires. 211 | ========================================================================== */ 212 | 213 | @media only screen and (min-width: 480px) { 214 | /* Style adjustments for viewports 480px and over go here */ 215 | 216 | } 217 | 218 | @media only screen and (min-width: 768px) { 219 | /* Style adjustments for viewports 768px and over go here */ 220 | 221 | } 222 | 223 | 224 | 225 | /* ==|== non-semantic helper classes ======================================== 226 | Please define your styles before this section. 227 | ========================================================================== */ 228 | 229 | /* For image replacement */ 230 | .ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; } 231 | .ir br { display: none; } 232 | 233 | /* Hide from both screenreaders and browsers: h5bp.com/u */ 234 | .hidden { display: none !important; visibility: hidden; } 235 | 236 | /* Hide only visually, but have it available for screenreaders: h5bp.com/v */ 237 | .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } 238 | 239 | /* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */ 240 | .visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; } 241 | 242 | /* Hide visually and from screenreaders, but maintain layout */ 243 | .invisible { visibility: hidden; } 244 | 245 | /* Contain floats: h5bp.com/q */ 246 | .clearfix:before, .clearfix:after { content: ""; display: table; } 247 | .clearfix:after { clear: both; } 248 | .clearfix { *zoom: 1; } 249 | 250 | 251 | 252 | /* ==|== print styles ======================================================= 253 | Print styles. 254 | Inlined to avoid required HTTP connection: h5bp.com/r 255 | ========================================================================== */ 256 | 257 | @media print { 258 | * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */ 259 | a, a:visited { text-decoration: underline; } 260 | a[href]:after { content: " (" attr(href) ")"; } 261 | abbr[title]:after { content: " (" attr(title) ")"; } 262 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */ 263 | pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } 264 | table { display: table-header-group; } /* h5bp.com/t */ 265 | tr, img { page-break-inside: avoid; } 266 | img { max-width: 100% !important; } 267 | @page { margin: 0.5cm; } 268 | p, h2, h3 { orphans: 3; widows: 3; } 269 | h2, h3 { page-break-after: avoid; } 270 | } 271 | 272 | /* reflow reset for -webkit-margin-before: 1em */ 273 | p { margin: 0; } 274 | 275 | html { 276 | overflow-y: auto; 277 | background-color: transparent; 278 | height: 100%; 279 | } 280 | 281 | body { 282 | background: #fff; 283 | font: normal 100%; 284 | position: relative; 285 | height: 100%; 286 | } 287 | 288 | body, div, img, p, button, input, select, textarea { 289 | box-sizing: border-box; 290 | } 291 | 292 | .image { 293 | display: block; 294 | } 295 | 296 | input { 297 | cursor: default; 298 | display: block; 299 | } 300 | 301 | input[type=button] { 302 | background-color: #e5e9e8; 303 | border: 1px solid #9daca9; 304 | border-radius: 4px; 305 | box-shadow: inset 0 1px #fff; 306 | font: inherit; 307 | letter-spacing: inherit; 308 | text-indent: inherit; 309 | color: inherit; 310 | } 311 | 312 | input[type=button]:hover { 313 | background-color: #eff1f1; 314 | } 315 | 316 | input[type=button]:active { 317 | background-color: #d2d6d6; 318 | border: 1px solid #9daca9; 319 | box-shadow: inset 0 1px rgba(0,0,0,0.1); 320 | } 321 | 322 | /* Reset anchor styles to an unstyled default to be in parity with design surface. It 323 | is presumed that most link styles in real-world designs are custom (non-default). */ 324 | a, a:visited, a:hover, a:active { 325 | color: inherit; 326 | text-decoration: inherit; 327 | } -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/css/boilerplate.css: -------------------------------------------------------------------------------- 1 | /* 2 | * HTML5 ✰ Boilerplate 3 | * 4 | * What follows is the result of much research on cross-browser styling. 5 | * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, 6 | * Kroc Camen, and the H5BP dev community and team. 7 | * 8 | * Detailed information about this CSS: h5bp.com/css 9 | * 10 | * ==|== normalize ========================================================== 11 | */ 12 | 13 | 14 | /* ============================================================================= 15 | HTML5 display definitions 16 | ========================================================================== */ 17 | 18 | article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } 19 | audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } 20 | audio:not([controls]) { display: none; } 21 | [hidden] { display: none; } 22 | 23 | 24 | /* ============================================================================= 25 | Base 26 | ========================================================================== */ 27 | 28 | /* 29 | * 1. Correct text resizing oddly in IE6/7 when body font-size is set using em units 30 | * 2. Force vertical scrollbar in non-IE 31 | * 3. Prevent iOS text size adjust on device orientation change, without disabling user zoom: h5bp.com/g 32 | */ 33 | 34 | html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } 35 | 36 | body { margin: 0; font-size: 100%; line-height: 1.231; } 37 | 38 | body, button, input, select, textarea { font-family: helvetica, arial,"lucida grande", verdana, "メイリオ", "MS Pゴシック", sans-serif; color: #222; } 39 | /* 40 | * Remove text-shadow in selection highlight: h5bp.com/i 41 | * These selection declarations have to be separate 42 | * Also: hot pink! (or customize the background color to match your design) 43 | */ 44 | 45 | ::selection { text-shadow: none; background-color: highlight; color: highlighttext; } 46 | 47 | 48 | /* ============================================================================= 49 | Links 50 | ========================================================================== */ 51 | 52 | a { color: #00e; } 53 | a:visited { color: #551a8b; } 54 | a:hover { color: #06e; } 55 | a:focus { outline: thin dotted; } 56 | 57 | /* Improve readability when focused and hovered in all browsers: h5bp.com/h */ 58 | a:hover, a:active { outline: 0; } 59 | 60 | 61 | /* ============================================================================= 62 | Typography 63 | ========================================================================== */ 64 | 65 | abbr[title] { border-bottom: 1px dotted; } 66 | 67 | b, strong { font-weight: bold; } 68 | 69 | blockquote { margin: 1em 40px; } 70 | 71 | dfn { font-style: italic; } 72 | 73 | hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } 74 | 75 | ins { background: #ff9; color: #000; text-decoration: none; } 76 | 77 | mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; } 78 | 79 | /* Redeclare monospace font family: h5bp.com/j */ 80 | pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; } 81 | 82 | /* Improve readability of pre-formatted text in all browsers */ 83 | pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; } 84 | 85 | q { quotes: none; } 86 | q:before, q:after { content: ""; content: none; } 87 | 88 | small { font-size: 85%; } 89 | 90 | /* Position subscript and superscript content without affecting line-height: h5bp.com/k */ 91 | sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } 92 | sup { top: -0.5em; } 93 | sub { bottom: -0.25em; } 94 | 95 | 96 | /* ============================================================================= 97 | Lists 98 | ========================================================================== */ 99 | 100 | ul, ol { margin: 1em 0; padding: 0 0 0 40px; } 101 | dd { margin: 0 0 0 40px; } 102 | nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; } 103 | 104 | 105 | /* ============================================================================= 106 | Embedded content 107 | ========================================================================== */ 108 | 109 | /* 110 | * 1. Improve image quality when scaled in IE7: h5bp.com/d 111 | * 2. Remove the gap between images and borders on image containers: h5bp.com/e 112 | */ 113 | 114 | img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; } 115 | 116 | /* 117 | * Correct overflow not hidden in IE9 118 | */ 119 | 120 | svg:not(:root) { overflow: hidden; } 121 | 122 | 123 | /* ============================================================================= 124 | Figures 125 | ========================================================================== */ 126 | 127 | figure { margin: 0; } 128 | 129 | 130 | /* ============================================================================= 131 | Forms 132 | ========================================================================== */ 133 | 134 | form { margin: 0; } 135 | fieldset { border: 0; margin: 0; padding: 0; } 136 | 137 | /* Indicate that 'label' will shift focus to the associated form element */ 138 | label { cursor: pointer; } 139 | 140 | /* 141 | * 1. Correct color not inheriting in IE6/7/8/9 142 | * 2. Correct alignment displayed oddly in IE6/7 143 | */ 144 | 145 | legend { border: 0; *margin-left: -7px; padding: 0; } 146 | 147 | /* 148 | * 1. Correct font-size not inheriting in all browsers 149 | * 2. Remove margins in FF3/4 S5 Chrome 150 | * 3. Define consistent vertical alignment display in all browsers 151 | */ 152 | 153 | button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; } 154 | 155 | /* 156 | * 1. Define line-height as normal to match FF3/4 (set using !important in the UA stylesheet) 157 | */ 158 | 159 | button, input { line-height: normal; } 160 | 161 | /* 162 | * 1. Display hand cursor for clickable form elements 163 | * 2. Allow styling of clickable form elements in iOS 164 | * 3. Correct inner spacing displayed oddly in IE7 (doesn't effect IE6) 165 | */ 166 | 167 | button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; *overflow: visible; } 168 | 169 | /* 170 | * Consistent box sizing and appearance 171 | */ 172 | 173 | input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; } 174 | input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; } 175 | input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } 176 | 177 | /* 178 | * Remove inner padding and border in FF3/4: h5bp.com/l 179 | */ 180 | 181 | button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } 182 | 183 | /* 184 | * 1. Remove default vertical scrollbar in IE6/7/8/9 185 | * 2. Allow only vertical resizing 186 | */ 187 | 188 | textarea { overflow: auto; vertical-align: top; resize: vertical; } 189 | 190 | /* Colors for form validity */ 191 | input:valid, textarea:valid { } 192 | input:invalid, textarea:invalid { background-color: #f0dddd; } 193 | 194 | 195 | /* ============================================================================= 196 | Tables 197 | ========================================================================== */ 198 | 199 | table { border-collapse: collapse; border-spacing: 0; } 200 | td { vertical-align: top; } 201 | 202 | 203 | /* ==|== primary styles ===================================================== 204 | Author: 205 | ========================================================================== */ 206 | 207 | /* ==|== media queries ====================================================== 208 | PLACEHOLDER Media Queries for Responsive Design. 209 | These override the primary ('mobile first') styles 210 | Modify as content requires. 211 | ========================================================================== */ 212 | 213 | @media only screen and (min-width: 480px) { 214 | /* Style adjustments for viewports 480px and over go here */ 215 | 216 | } 217 | 218 | @media only screen and (min-width: 768px) { 219 | /* Style adjustments for viewports 768px and over go here */ 220 | 221 | } 222 | 223 | 224 | 225 | /* ==|== non-semantic helper classes ======================================== 226 | Please define your styles before this section. 227 | ========================================================================== */ 228 | 229 | /* For image replacement */ 230 | .ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; } 231 | .ir br { display: none; } 232 | 233 | /* Hide from both screenreaders and browsers: h5bp.com/u */ 234 | .hidden { display: none !important; visibility: hidden; } 235 | 236 | /* Hide only visually, but have it available for screenreaders: h5bp.com/v */ 237 | .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } 238 | 239 | /* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */ 240 | .visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; } 241 | 242 | /* Hide visually and from screenreaders, but maintain layout */ 243 | .invisible { visibility: hidden; } 244 | 245 | /* Contain floats: h5bp.com/q */ 246 | .clearfix:before, .clearfix:after { content: ""; display: table; } 247 | .clearfix:after { clear: both; } 248 | .clearfix { *zoom: 1; } 249 | 250 | 251 | 252 | /* ==|== print styles ======================================================= 253 | Print styles. 254 | Inlined to avoid required HTTP connection: h5bp.com/r 255 | ========================================================================== */ 256 | 257 | @media print { 258 | * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */ 259 | a, a:visited { text-decoration: underline; } 260 | a[href]:after { content: " (" attr(href) ")"; } 261 | abbr[title]:after { content: " (" attr(title) ")"; } 262 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */ 263 | pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } 264 | table { display: table-header-group; } /* h5bp.com/t */ 265 | tr, img { page-break-inside: avoid; } 266 | img { max-width: 100% !important; } 267 | @page { margin: 0.5cm; } 268 | p, h2, h3 { orphans: 3; widows: 3; } 269 | h2, h3 { page-break-after: avoid; } 270 | } 271 | 272 | /* reflow reset for -webkit-margin-before: 1em */ 273 | p { margin: 0; } 274 | 275 | html { 276 | overflow-y: auto; 277 | background-color: transparent; 278 | height: 100%; 279 | } 280 | 281 | body { 282 | background: #fff; 283 | font: normal 100%; 284 | position: relative; 285 | height: 100%; 286 | } 287 | 288 | body, div, img, p, button, input, select, textarea { 289 | box-sizing: border-box; 290 | } 291 | 292 | .image { 293 | display: block; 294 | } 295 | 296 | input { 297 | cursor: default; 298 | display: block; 299 | } 300 | 301 | input[type=button] { 302 | background-color: #e5e9e8; 303 | border: 1px solid #9daca9; 304 | border-radius: 4px; 305 | box-shadow: inset 0 1px #fff; 306 | font: inherit; 307 | letter-spacing: inherit; 308 | text-indent: inherit; 309 | color: inherit; 310 | } 311 | 312 | input[type=button]:hover { 313 | background-color: #eff1f1; 314 | } 315 | 316 | input[type=button]:active { 317 | background-color: #d2d6d6; 318 | border: 1px solid #9daca9; 319 | box-shadow: inset 0 1px rgba(0,0,0,0.1); 320 | } 321 | 322 | /* Reset anchor styles to an unstyled default to be in parity with design surface. It 323 | is presumed that most link styles in real-world designs are custom (non-default). */ 324 | a, a:visited, a:hover, a:active { 325 | color: inherit; 326 | text-decoration: inherit; 327 | } -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/css/boilerplate.css: -------------------------------------------------------------------------------- 1 | /* 2 | * HTML5 ✰ Boilerplate 3 | * 4 | * What follows is the result of much research on cross-browser styling. 5 | * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, 6 | * Kroc Camen, and the H5BP dev community and team. 7 | * 8 | * Detailed information about this CSS: h5bp.com/css 9 | * 10 | * ==|== normalize ========================================================== 11 | */ 12 | 13 | 14 | /* ============================================================================= 15 | HTML5 display definitions 16 | ========================================================================== */ 17 | 18 | article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } 19 | audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } 20 | audio:not([controls]) { display: none; } 21 | [hidden] { display: none; } 22 | 23 | 24 | /* ============================================================================= 25 | Base 26 | ========================================================================== */ 27 | 28 | /* 29 | * 1. Correct text resizing oddly in IE6/7 when body font-size is set using em units 30 | * 2. Force vertical scrollbar in non-IE 31 | * 3. Prevent iOS text size adjust on device orientation change, without disabling user zoom: h5bp.com/g 32 | */ 33 | 34 | html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } 35 | 36 | body { margin: 0; font-size: 100%; line-height: 1.231; } 37 | 38 | body, button, input, select, textarea { font-family: helvetica, arial,"lucida grande", verdana, "メイリオ", "MS Pゴシック", sans-serif; color: #222; } 39 | /* 40 | * Remove text-shadow in selection highlight: h5bp.com/i 41 | * These selection declarations have to be separate 42 | * Also: hot pink! (or customize the background color to match your design) 43 | */ 44 | 45 | ::selection { text-shadow: none; background-color: highlight; color: highlighttext; } 46 | 47 | 48 | /* ============================================================================= 49 | Links 50 | ========================================================================== */ 51 | 52 | a { color: #00e; } 53 | a:visited { color: #551a8b; } 54 | a:hover { color: #06e; } 55 | a:focus { outline: thin dotted; } 56 | 57 | /* Improve readability when focused and hovered in all browsers: h5bp.com/h */ 58 | a:hover, a:active { outline: 0; } 59 | 60 | 61 | /* ============================================================================= 62 | Typography 63 | ========================================================================== */ 64 | 65 | abbr[title] { border-bottom: 1px dotted; } 66 | 67 | b, strong { font-weight: bold; } 68 | 69 | blockquote { margin: 1em 40px; } 70 | 71 | dfn { font-style: italic; } 72 | 73 | hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } 74 | 75 | ins { background: #ff9; color: #000; text-decoration: none; } 76 | 77 | mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; } 78 | 79 | /* Redeclare monospace font family: h5bp.com/j */ 80 | pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; } 81 | 82 | /* Improve readability of pre-formatted text in all browsers */ 83 | pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; } 84 | 85 | q { quotes: none; } 86 | q:before, q:after { content: ""; content: none; } 87 | 88 | small { font-size: 85%; } 89 | 90 | /* Position subscript and superscript content without affecting line-height: h5bp.com/k */ 91 | sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } 92 | sup { top: -0.5em; } 93 | sub { bottom: -0.25em; } 94 | 95 | 96 | /* ============================================================================= 97 | Lists 98 | ========================================================================== */ 99 | 100 | ul, ol { margin: 1em 0; padding: 0 0 0 40px; } 101 | dd { margin: 0 0 0 40px; } 102 | nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; } 103 | 104 | 105 | /* ============================================================================= 106 | Embedded content 107 | ========================================================================== */ 108 | 109 | /* 110 | * 1. Improve image quality when scaled in IE7: h5bp.com/d 111 | * 2. Remove the gap between images and borders on image containers: h5bp.com/e 112 | */ 113 | 114 | img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; } 115 | 116 | /* 117 | * Correct overflow not hidden in IE9 118 | */ 119 | 120 | svg:not(:root) { overflow: hidden; } 121 | 122 | 123 | /* ============================================================================= 124 | Figures 125 | ========================================================================== */ 126 | 127 | figure { margin: 0; } 128 | 129 | 130 | /* ============================================================================= 131 | Forms 132 | ========================================================================== */ 133 | 134 | form { margin: 0; } 135 | fieldset { border: 0; margin: 0; padding: 0; } 136 | 137 | /* Indicate that 'label' will shift focus to the associated form element */ 138 | label { cursor: pointer; } 139 | 140 | /* 141 | * 1. Correct color not inheriting in IE6/7/8/9 142 | * 2. Correct alignment displayed oddly in IE6/7 143 | */ 144 | 145 | legend { border: 0; *margin-left: -7px; padding: 0; } 146 | 147 | /* 148 | * 1. Correct font-size not inheriting in all browsers 149 | * 2. Remove margins in FF3/4 S5 Chrome 150 | * 3. Define consistent vertical alignment display in all browsers 151 | */ 152 | 153 | button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; } 154 | 155 | /* 156 | * 1. Define line-height as normal to match FF3/4 (set using !important in the UA stylesheet) 157 | */ 158 | 159 | button, input { line-height: normal; } 160 | 161 | /* 162 | * 1. Display hand cursor for clickable form elements 163 | * 2. Allow styling of clickable form elements in iOS 164 | * 3. Correct inner spacing displayed oddly in IE7 (doesn't effect IE6) 165 | */ 166 | 167 | button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; *overflow: visible; } 168 | 169 | /* 170 | * Consistent box sizing and appearance 171 | */ 172 | 173 | input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; } 174 | input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; } 175 | input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } 176 | 177 | /* 178 | * Remove inner padding and border in FF3/4: h5bp.com/l 179 | */ 180 | 181 | button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } 182 | 183 | /* 184 | * 1. Remove default vertical scrollbar in IE6/7/8/9 185 | * 2. Allow only vertical resizing 186 | */ 187 | 188 | textarea { overflow: auto; vertical-align: top; resize: vertical; } 189 | 190 | /* Colors for form validity */ 191 | input:valid, textarea:valid { } 192 | input:invalid, textarea:invalid { background-color: #f0dddd; } 193 | 194 | 195 | /* ============================================================================= 196 | Tables 197 | ========================================================================== */ 198 | 199 | table { border-collapse: collapse; border-spacing: 0; } 200 | td { vertical-align: top; } 201 | 202 | 203 | /* ==|== primary styles ===================================================== 204 | Author: 205 | ========================================================================== */ 206 | 207 | /* ==|== media queries ====================================================== 208 | PLACEHOLDER Media Queries for Responsive Design. 209 | These override the primary ('mobile first') styles 210 | Modify as content requires. 211 | ========================================================================== */ 212 | 213 | @media only screen and (min-width: 480px) { 214 | /* Style adjustments for viewports 480px and over go here */ 215 | 216 | } 217 | 218 | @media only screen and (min-width: 768px) { 219 | /* Style adjustments for viewports 768px and over go here */ 220 | 221 | } 222 | 223 | 224 | 225 | /* ==|== non-semantic helper classes ======================================== 226 | Please define your styles before this section. 227 | ========================================================================== */ 228 | 229 | /* For image replacement */ 230 | .ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; } 231 | .ir br { display: none; } 232 | 233 | /* Hide from both screenreaders and browsers: h5bp.com/u */ 234 | .hidden { display: none !important; visibility: hidden; } 235 | 236 | /* Hide only visually, but have it available for screenreaders: h5bp.com/v */ 237 | .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } 238 | 239 | /* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */ 240 | .visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; } 241 | 242 | /* Hide visually and from screenreaders, but maintain layout */ 243 | .invisible { visibility: hidden; } 244 | 245 | /* Contain floats: h5bp.com/q */ 246 | .clearfix:before, .clearfix:after { content: ""; display: table; } 247 | .clearfix:after { clear: both; } 248 | .clearfix { *zoom: 1; } 249 | 250 | 251 | 252 | /* ==|== print styles ======================================================= 253 | Print styles. 254 | Inlined to avoid required HTTP connection: h5bp.com/r 255 | ========================================================================== */ 256 | 257 | @media print { 258 | * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */ 259 | a, a:visited { text-decoration: underline; } 260 | a[href]:after { content: " (" attr(href) ")"; } 261 | abbr[title]:after { content: " (" attr(title) ")"; } 262 | .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */ 263 | pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } 264 | table { display: table-header-group; } /* h5bp.com/t */ 265 | tr, img { page-break-inside: avoid; } 266 | img { max-width: 100% !important; } 267 | @page { margin: 0.5cm; } 268 | p, h2, h3 { orphans: 3; widows: 3; } 269 | h2, h3 { page-break-after: avoid; } 270 | } 271 | 272 | /* reflow reset for -webkit-margin-before: 1em */ 273 | p { margin: 0; } 274 | 275 | html { 276 | overflow-y: auto; 277 | background-color: transparent; 278 | height: 100%; 279 | } 280 | 281 | body { 282 | background: #fff; 283 | font: normal 100%; 284 | position: relative; 285 | height: 100%; 286 | } 287 | 288 | body, div, img, p, button, input, select, textarea { 289 | box-sizing: border-box; 290 | } 291 | 292 | .image { 293 | display: block; 294 | } 295 | 296 | input { 297 | cursor: default; 298 | display: block; 299 | } 300 | 301 | input[type=button] { 302 | background-color: #e5e9e8; 303 | border: 1px solid #9daca9; 304 | border-radius: 4px; 305 | box-shadow: inset 0 1px #fff; 306 | font: inherit; 307 | letter-spacing: inherit; 308 | text-indent: inherit; 309 | color: inherit; 310 | } 311 | 312 | input[type=button]:hover { 313 | background-color: #eff1f1; 314 | } 315 | 316 | input[type=button]:active { 317 | background-color: #d2d6d6; 318 | border: 1px solid #9daca9; 319 | box-shadow: inset 0 1px rgba(0,0,0,0.1); 320 | } 321 | 322 | /* Reset anchor styles to an unstyled default to be in parity with design surface. It 323 | is presumed that most link styles in real-world designs are custom (non-default). */ 324 | a, a:visited, a:hover, a:active { 325 | color: inherit; 326 | text-decoration: inherit; 327 | } -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/js/libs/CSInterface-4.0.0.js: -------------------------------------------------------------------------------- 1 | /* 2 | ADOBE SYSTEMS INCORPORATED 3 | Copyright 2013 Adobe Systems Incorporated. All Rights Reserved. 4 | 5 | NOTICE: Adobe permits you to use, modify, and distribute this file in 6 | accordance with the terms of the Adobe license agreement accompanying it. 7 | If you have received this file from a source other than Adobe, then your 8 | use, modification, or distribution of it requires the prior written 9 | permission of Adobe. 10 | */ 11 | 12 | /** 13 | * Stores constants for the window types supported by the CSXS infrastructure. 14 | */ 15 | function CSXSWindowType() 16 | { 17 | }; 18 | 19 | /** Constant for the CSXS window type Panel. **/ 20 | CSXSWindowType._PANEL = "Panel"; 21 | 22 | /** Constant for the CSXS window type Modeless. **/ 23 | CSXSWindowType._MODELESS = "Modeless"; 24 | 25 | /** Constant for the CSXS window type ModalDialog. **/ 26 | CSXSWindowType._MODAL_DIALOG = "ModalDialog"; 27 | 28 | /** EvalScript error message**/ 29 | EvalScript_ErrMessage = "EvalScript error."; 30 | 31 | /** 32 | * Class Version 33 | * Defines a version number with major, minor, micro, and special 34 | * components. The major, minor and micro values are numeric; the special 35 | * value can be any string. 36 | * 37 | * @param major The major version component, a positive integer up to nine digits long. 38 | * @param minor The minor version component, a positive integer up to nine digits long. 39 | * @param micro The micro version component, a positive integer up to nine digits long. 40 | * @param special The special version component, an arbitrary string. 41 | * 42 | * @return A Version object. 43 | */ 44 | function Version(major, minor, micro, special) 45 | { 46 | this.major = major; 47 | this.minor = minor; 48 | this.micro = micro; 49 | this.special = special; 50 | }; 51 | 52 | /** 53 | * The maximum value allowed for a Numeric version component. 54 | * This reflects the maximum value allowed in PlugPlug and the manifest schema. 55 | */ 56 | Version.MAX_NUM = 999999999; 57 | 58 | /** 59 | * Class VersionBound 60 | * Defines a boundary for a version range, which associates a Version object with a flag for whether it is an inclusive 61 | * or exclusive boundary. 62 | * 63 | * @param version The Version object. 64 | * @see Version class. 65 | * @param inclusive True if this boundary is inclusive, false if it is exclusive. 66 | * 67 | * @return A VersionBound object. 68 | */ 69 | function VersionBound(version, inclusive) 70 | { 71 | this.version = version; 72 | this.inclusive = inclusive; 73 | }; 74 | 75 | /** 76 | * Class VersionRange. 77 | * Defines a range of versions using a lower boundary and optional upper boundary. 78 | * 79 | * @param lowerBound The VersionBound object. @see VersionBound. 80 | * @param upperBound The VersionBound object, or null for a range with no upper boundary. @see VersionBound. 81 | * 82 | * @return A VersionRange object. 83 | */ 84 | function VersionRange(lowerBound, upperBound) 85 | { 86 | this.lowerBound = lowerBound; 87 | this.upperBound = upperBound; 88 | }; 89 | 90 | /** 91 | * Class Runtime. 92 | * Represents a runtime related to the CSXS infrastructure. Extensions can declare dependencies on particular 93 | * CSXS runtime versions in the extension manifest. 94 | * 95 | * @param name The runtime name. 96 | * @param version The VersionRange object. @see VersionRange. 97 | * 98 | * @return A Runtime object. 99 | */ 100 | function Runtime(name, versionRange) 101 | { 102 | this.name = name; 103 | this.versionRange = versionRange; 104 | }; 105 | 106 | /** 107 | * Class Extension. 108 | * Contains the classes that define data types for the CEP libraries. 109 | * 110 | * @param id The unique identifier of this extension. 111 | * @param name The localizable display name of this extension. 112 | * @param mainPath The path of the "index.html" file. 113 | * @param basePath The base path of this extension. 114 | * @param windowType The window type of the main window of this extension. Valid values are defined by CSXSWindowType. @see CSXSWindowType. 115 | * @param width The default width in pixels of the main window of this extension. 116 | * @param height The default height in pixels of the main window of this extension. 117 | * @param minWidth The minimum width in pixels of the main window of this extension. 118 | * @param minHeight The minimum height in pixels of the main window of this extension. 119 | * @param maxWidth The maximum width in pixels of the main window of this extension. 120 | * @param maxHeight The maximum height in pixels of the main window of this extension. 121 | * @param defaultExtensionDataXml The extension data contained in the default ExtensionDispatchInfo section of the extension manifest. 122 | * @param specialExtensionDataXml The extension data contained in the application-specific ExtensionDispatchInfo section of the extension manifest. 123 | * @param requiredRuntimeList An array of Runtime objects for runtimes required by this extension. @see VersionRange. 124 | * @param isAutoVisible True if this extension is visible on loading. 125 | * @param isPluginExtension True if this extension has been deployed in the Plugins folder of the host application. 126 | * 127 | * @return An Extension object. 128 | */ 129 | function Extension(id, name, mainPath, basePath, windowType, width, height, minWidth, minHeight, maxWidth, maxHeight, 130 | defaultExtensionDataXml, specialExtensionDataXml, requiredRuntimeList, isAutoVisible, isPluginExtension) 131 | { 132 | this.id = id; 133 | this.name = name; 134 | this.mainPath = mainPath; 135 | this.basePath = basePath; 136 | this.windowType = windowType; 137 | this.width = width; 138 | this.height = height; 139 | this.minWidth = minWidth; 140 | this.minHeight = minHeight; 141 | this.maxWidth = maxWidth; 142 | this.maxHeight = maxHeight; 143 | this.defaultExtensionDataXml = defaultExtensionDataXml; 144 | this.specialExtensionDataXml = specialExtensionDataXml; 145 | this.requiredRuntimeList = requiredRuntimeList; 146 | this.isAutoVisible = isAutoVisible; 147 | this.isPluginExtension = isPluginExtension; 148 | }; 149 | 150 | /** 151 | * Class CSEvent. 152 | * You can use it to dispatch a standard Javascript event. 153 | * 154 | * @param type Event type. 155 | * @param scope The scope of event, can be "GLOBAL" or "APPLICATION". 156 | * @param appId The unique identifier of the application that generated the event. 157 | * @param extensionId The unique identifier of the extension that generated the event. 158 | * 159 | * @return CSEvent object 160 | */ 161 | function CSEvent(type, scope, appId, extensionId) 162 | { 163 | this.type = type; 164 | this.scope = scope; 165 | this.appId = appId; 166 | this.extensionId = extensionId; 167 | }; 168 | 169 | /** The event specific data. **/ 170 | CSEvent.prototype.data = ""; 171 | 172 | /** 173 | * Class SystemPath 174 | * Stores operating-system-specific location constants for use getSystemPath method. 175 | */ 176 | function SystemPath() 177 | { 178 | }; 179 | 180 | /** Identifies the path to user data. */ 181 | SystemPath.USER_DATA = "userData"; 182 | 183 | /** Identifies the path to common files for Adobe applications. */ 184 | SystemPath.COMMON_FILES = "commonFiles"; 185 | 186 | /** Identifies the path to the user's default document folder. */ 187 | SystemPath.MY_DOCUMENTS = "myDocuments"; 188 | 189 | /** Identifies the path to current extension. */ 190 | /** DEPRECATED, PLEASE USE EXTENSION INSTEAD. */ 191 | SystemPath.APPLICATION = "application"; 192 | 193 | /** Identifies the path to current extension. */ 194 | SystemPath.EXTENSION = "extension"; 195 | 196 | /** Identifies the path to hosting application's executable. */ 197 | SystemPath.HOST_APPLICATION = "hostApplication"; 198 | 199 | /** 200 | * Class ColorType 201 | * Stores the color-type constants. 202 | */ 203 | function ColorType() 204 | { 205 | }; 206 | 207 | /** rgb type. */ 208 | ColorType.RGB = "rgb"; 209 | 210 | /** gradient type. */ 211 | ColorType.GRADIENT = "gradient"; 212 | 213 | /** none type. */ 214 | ColorType.NONE = "none"; 215 | 216 | /** 217 | * Class RGBColor 218 | * Stores an RGB color with red, green, blue, and alpha values. All values are in the range 219 | * [0.0 to 255.0]. Invalid numeric values are converted to numbers within this range. 220 | * 221 | * @param red The red value, in the range [0.0 to 255.0]. 222 | * @param green The green value, in the range [0.0 to 255.0]. 223 | * @param blue The blue value, in the range [0.0 to 255.0]. 224 | * @param alpha The alpha (transparency) value, in the range [0.0 to 255.0]. 225 | * The default (255.0) means that the color is fully opaque. 226 | * 227 | * @return RGBColor object. 228 | */ 229 | function RGBColor(red, green, blue, alpha) 230 | { 231 | this.red = red; 232 | this.green = green; 233 | this.blue = blue; 234 | this.alpha = alpha; 235 | }; 236 | 237 | /** 238 | * Class Direction 239 | * Stores a point information. 240 | * 241 | * @param x X axis position. 242 | * @param y Y axis position. 243 | * 244 | * @return Direction object. 245 | */ 246 | function Direction(x, y) 247 | { 248 | this.x = x; 249 | this.y = y; 250 | }; 251 | 252 | /** 253 | * Class GradientStop 254 | * Stores gradient stop information. 255 | * 256 | * @param offset The offset of the gradient stop, in the range [0.0 to 1.0]. 257 | * @param rgbColor The RGBColor object. @see RGBColor. 258 | * 259 | * @return GradientStop object. 260 | */ 261 | function GradientStop(offset, rgbColor) 262 | { 263 | this.offset = offset; 264 | this.rgbColor = rgbColor; 265 | }; 266 | 267 | /** 268 | * Class GradientColor 269 | * Stores gradient color information. 270 | * 271 | * @param type The gradient type, the only valid value is "linear". 272 | * @param direction A vector describing the direction of the gradient. 273 | * A point value, in which the y component is 0 and the x component 274 | * is positive or negative for a right or left direction, 275 | * or the x component is 0 and the y component is positive or negative for 276 | * an up or down direction. @see Direction. 277 | * @param numStops The number of stops. 278 | * @param gradientStopList An array of GradientStop objects. @see GradientStop. 279 | * 280 | * @return GradientColor object. 281 | */ 282 | function GradientColor(type, direction, numStops, arrGradientStop) 283 | { 284 | this.type = type; 285 | this.direction = direction; 286 | this.numStops = numStops; 287 | this.arrGradientStop = arrGradientStop; 288 | }; 289 | 290 | /** 291 | * Class UIColor 292 | * Stores color information, including the type, anti-alias level, and specific color 293 | * values in a color object of an appropriate type. 294 | * 295 | * @param type The color type constant, 1 for "rgb" and 2 for "gradient". 296 | * @param antialiasLevel The anti-alias level constant. 297 | * @param color A GradientColor object or a RGBColor containing specific color information. 298 | * The type of color object depends on type parameter. @see GradientColor and RGBColor. 299 | * 300 | * @return UIColor object. 301 | */ 302 | function UIColor(type, antialiasLevel, color) 303 | { 304 | this.type = type; 305 | this.antialiasLevel = antialiasLevel; 306 | this.color = color; 307 | }; 308 | 309 | /** 310 | * Class AppSkinInfo 311 | * Stores window-skin properties, such as color and font. All parameters' type are UIColor. @see UIColor. 312 | * 313 | * @param baseFontFamily The base font family of the application. 314 | * @param baseFontSize The base font size of the application. 315 | * @param appBarBackgroundColor The application bar background color. 316 | * @param panelBackgroundColor The background color of the extension panel. 317 | * @param appBarBackgroundColorSRGB The application bar background color, as sRGB. 318 | * @param panelBackgroundColorSRGB The background color of the extension panel, as sRGB. 319 | * @param systemHighlightColor The operating-system highlight color, as sRGB. 320 | * 321 | * @return AppSkinInfo object. 322 | */ 323 | function AppSkinInfo(baseFontFamily, baseFontSize, appBarBackgroundColor, panelBackgroundColor, appBarBackgroundColorSRGB, panelBackgroundColorSRGB, systemHighlightColor) 324 | { 325 | this.baseFontFamily = baseFontFamily; 326 | this.baseFontSize = baseFontSize; 327 | this.appBarBackgroundColor = appBarBackgroundColor; 328 | this.panelBackgroundColor = panelBackgroundColor; 329 | this.appBarBackgroundColorSRGB = appBarBackgroundColorSRGB; 330 | this.panelBackgroundColorSRGB = panelBackgroundColorSRGB; 331 | this.systemHighlightColor = systemHighlightColor; 332 | }; 333 | 334 | /** 335 | * Class HostEnvironment 336 | * Stores information about the environment in which the extension is loaded. 337 | * 338 | * @param appName The application's name. 339 | * @param appVersion The application's version. 340 | * @param appLocale The application's current license locale. 341 | * @param appId The application's unique identifier. 342 | * @param isAppOffline True if the application is currently offline. 343 | * @param appSkinInfo A skin-information object containing the application's default color and font styles. @see AppSkinInfo. 344 | * @param appUILocale The application's current UI locale. 345 | * 346 | * @return HostEnvironment object. 347 | */ 348 | function HostEnvironment(appName, appVersion, appLocale, appUILocale, appId, isAppOffline, appSkinInfo) 349 | { 350 | this.appName = appName; 351 | this.appVersion = appVersion; 352 | this.appLocale = appLocale; 353 | this.appUILocale = appUILocale; 354 | this.appId = appId; 355 | this.isAppOffline = isAppOffline; 356 | this.appSkinInfo = appSkinInfo; 357 | }; 358 | 359 | /***********************************************************************************/ 360 | /** 361 | * Class CSInterface. 362 | * You can use it to communicate with native application. 363 | * 364 | * @return CSInterface object 365 | */ 366 | function CSInterface() 367 | { 368 | }; 369 | 370 | /** 371 | * User can add this event listener to handle native application theme color changes. 372 | * Callback function gives extensions ability to fine-tune their theme color after the 373 | * global theme color has been changed. 374 | * The callback function should be like below: 375 | * 376 | * @example 377 | * // event is a CSEvent object, but user can ignore it. 378 | * function OnAppThemeColorChanged(event) 379 | * { 380 | * // Should get a latest HostEnvironment object from application. 381 | * var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; 382 | * // Gets the style information such as color info from the skinInfo, 383 | * // and redraw all UI controls of your extension according to the style info. 384 | * } 385 | */ 386 | CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged"; 387 | 388 | /** The host environment data object **/ 389 | CSInterface.prototype.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); 390 | 391 | /** Close the current extension **/ 392 | CSInterface.prototype.closeExtension = function() 393 | { 394 | window.__adobe_cep__.closeExtension(); 395 | }; 396 | 397 | /** 398 | * Get system path. 399 | * 400 | * @param pathType A string containing a path-type constant defined in the SystemPath class, 401 | * such as SystemPath.USER_DATA. 402 | * @return path string 403 | */ 404 | CSInterface.prototype.getSystemPath = function(pathType) 405 | { 406 | var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType)); 407 | var OSVersion = this.getOSInformation(); 408 | if (OSVersion.indexOf("Windows") >= 0) 409 | { 410 | path = path.replace("file:///", ""); 411 | } 412 | else if (OSVersion.indexOf("Mac") >= 0) 413 | { 414 | path = path.replace("file://", ""); 415 | } 416 | return path; 417 | }; 418 | 419 | /** 420 | * Eval scripts. You can use it to operate the DOM of native application. 421 | * 422 | * @param script The raw JavaScript. 423 | * @param callback The callback function that receives the execution result of the script. This parameter is optional. 424 | * If it fails to execute the script, the callback function will receive the error message EvalScript_ErrMessage. 425 | */ 426 | CSInterface.prototype.evalScript = function(script, callback) 427 | { 428 | if(callback == null || callback == undefined) 429 | { 430 | callback = function(result){}; 431 | } 432 | window.__adobe_cep__.evalScript(script, callback); 433 | }; 434 | 435 | /** 436 | * Get the identifier of the host application. 437 | * 438 | * @return a string identifier of the host application 439 | */ 440 | CSInterface.prototype.getApplicationID = function() 441 | { 442 | var appId = this.hostEnvironment.appId; 443 | return appId; 444 | }; 445 | 446 | /** 447 | * Get host capability information about the host application. 448 | * 449 | * @return an object that contains host capability information 450 | */ 451 | CSInterface.prototype.getHostCapabilities = function() 452 | { 453 | var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() ); 454 | return hostCapabilities; 455 | }; 456 | 457 | /** 458 | * Triggering a CS Event programmatically. You can use it to dispatch a CSEvent. 459 | * 460 | * @param event a CS Event 461 | */ 462 | CSInterface.prototype.dispatchEvent = function(event) 463 | { 464 | if (typeof event.data == "object") 465 | { 466 | event.data = JSON.stringify(event.data); 467 | } 468 | 469 | window.__adobe_cep__.dispatchEvent(event); 470 | }; 471 | 472 | /** 473 | * Register a CS Event listener. You can use it to listen a CSEvent. 474 | * 475 | * @param type The Event type 476 | * @param listener The JavaScript function that receives a notification when 477 | * a CS event of the specified type occurs. 478 | * @param obj The object that listener belongs to. Use it when listener is a method 479 | * of an object. This parameter is optional and its default value is null. 480 | */ 481 | CSInterface.prototype.addEventListener = function(type, listener, obj) 482 | { 483 | window.__adobe_cep__.addEventListener(type, listener, obj); 484 | }; 485 | 486 | /** 487 | * Remove the CS Event listener. 488 | * 489 | * @param type event type 490 | * @param listener The JavaScript function that receives a notification when 491 | * a CS event of the specified type occurs. 492 | * @param obj The object that listener belongs to. Use it when listener is a method 493 | * of an object. This parameter is optional and its default value is null. 494 | */ 495 | CSInterface.prototype.removeEventListener = function(type, listener, obj) 496 | { 497 | window.__adobe_cep__.removeEventListener(type, listener, obj); 498 | }; 499 | 500 | /** 501 | * Loads and launches another extension. If the target extension is already loaded, it is activated. 502 | * 503 | * @param extensionId The extension's unique identifier. 504 | * @param startupParams Startup parameters to be passed to the loaded extension. 505 | * Specify key-value pairs as a GET URL parameter list; for example: "key1=value1&key2=value2". 506 | * Currently this parameter is not supported by CEP, so it will always be "" for now. 507 | * 508 | * @example 509 | * To launch the extension "help" with ID "HLP" from this extension, call: 510 | * requestOpenExtension("HLP", ""); 511 | * 512 | */ 513 | CSInterface.prototype.requestOpenExtension = function(extensionId, params) 514 | { 515 | window.__adobe_cep__.requestOpenExtension(extensionId, params); 516 | }; 517 | 518 | /** 519 | * Retrieves the list of extensions currently loaded in the current host application. 520 | * The extension list is initialized once, and remains the same during the lifetime of the CSXS session. 521 | * 522 | * @param extensionIds An array of unique identifiers for extensions of interest. 523 | * If omitted, retrieves data for all extensions. 524 | * 525 | * @return An Extension object. 526 | */ 527 | CSInterface.prototype.getExtensions = function(extensionIds) 528 | { 529 | var extensionIdsStr = JSON.stringify(extensionIds); 530 | var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr); 531 | 532 | var extensions = JSON.parse(extensionsStr); 533 | return extensions; 534 | }; 535 | 536 | /** 537 | * Retrieves network-related preferences. 538 | * 539 | * @return A NetworkPreferences object. 540 | */ 541 | CSInterface.prototype.getNetworkPreferences = function() 542 | { 543 | var result = window.__adobe_cep__.getNetworkPreferences(); 544 | var networkPre = JSON.parse(result); 545 | 546 | return networkPre; 547 | }; 548 | 549 | /** 550 | * Initializes the resource bundle for this extension with property values for the current application and locale. 551 | * If user wants to support multi-locale to the extension, they should define a property file. An example of the property file content is: 552 | * 553 | * key1=value1 554 | * key2=value2 555 | * key3.value=value3 556 | * 557 | * The property file should be placed in its corresponding locale folder. For example for en_US, the property file would be placed in YourExtension/locale/en_US/messages.properties. 558 | * Users can define a default property file, placed in "YourExtension/locale/" which will be used when the corresponding locale file is not defined. 559 | * Users should initialize locale strings during the loading of the extension. The locale loaded should match the current UI locale of the host application. 560 | * 'data-locale' is the custom HTML element attribute and you can added it to each HTML element that you want to localize. 561 | * 562 | * For example: 563 | * 564 | * 565 | * 573 | * 574 | * @return An object containing the resource bundle information. 575 | */ 576 | CSInterface.prototype.initResourceBundle = function() 577 | { 578 | var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle()); 579 | var resElms = document.querySelectorAll('[data-locale]'); 580 | for (var n = 0; n < resElms.length; n++) 581 | { 582 | var resEl = resElms[n]; 583 | // Get the resource key from the element. 584 | var resKey = resEl.getAttribute('data-locale'); 585 | if (resKey) 586 | { 587 | // Get all the resources that start with the key. 588 | for (var key in resourceBundle) 589 | { 590 | if (key.indexOf(resKey) == 0) 591 | { 592 | var resValue = resourceBundle[key]; 593 | if (key.indexOf('.') == -1) 594 | { 595 | // No dot notation in resource key, 596 | // assign the resource value to the element's 597 | // innerHTML. 598 | resEl.innerHTML = resValue; 599 | } 600 | else 601 | { 602 | // Dot notation in resource key, assign the 603 | // resource value to the element's property 604 | // whose name corresponds to the substring 605 | // after the dot. 606 | var attrKey = key.substring(key.indexOf('.') + 1); 607 | resEl[attrKey] = resValue; 608 | } 609 | } 610 | } 611 | } 612 | } 613 | return resourceBundle; 614 | }; 615 | 616 | /** 617 | * Writes installation information to a file. 618 | * 619 | * @return The dump info file path. 620 | */ 621 | CSInterface.prototype.dumpInstallationInfo = function() 622 | { 623 | return window.__adobe_cep__.dumpInstallationInfo(); 624 | }; 625 | 626 | /** 627 | * Get current Operating System information including version and 32-bit/64-bit. 628 | * Refer to http://www.useragentstring.com/pages/Chrome/ for all of the navigator.userAgent values retrieved by Chrome. 629 | * 630 | * @return The OS version in string or "unknown Operation System". 631 | */ 632 | CSInterface.prototype.getOSInformation = function() 633 | { 634 | var userAgent = navigator.userAgent; 635 | 636 | if ((navigator.platform == "Win32") || (navigator.platform == "Windows")) 637 | { 638 | var winVersion = "Windows platform"; 639 | if (userAgent.indexOf("Windows NT 5.0") > -1) 640 | { 641 | winVersion = "Windows 2000"; 642 | } 643 | else if (userAgent.indexOf("Windows NT 5.1") > -1) 644 | { 645 | winVersion = "Windows XP"; 646 | } 647 | else if (userAgent.indexOf("Windows NT 5.2") > -1) 648 | { 649 | winVersion = "Windows Server 2003"; 650 | } 651 | else if (userAgent.indexOf("Windows NT 6.0") > -1) 652 | { 653 | winVersion = "Windows Vista"; 654 | } 655 | else if (userAgent.indexOf("Windows NT 6.1") > -1) 656 | { 657 | winVersion = "Windows 7"; 658 | } 659 | else if (userAgent.indexOf("Windows NT 6.2") > -1) 660 | { 661 | winVersion = "Windows 8"; 662 | } 663 | 664 | var winBit = "32-bit"; 665 | if (userAgent.indexOf("WOW64") > -1) 666 | { 667 | winBit = "64-bit"; 668 | } 669 | 670 | return winVersion + " " + winBit; 671 | } 672 | else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh")) 673 | { 674 | var agentStr = new String(); 675 | agentStr = userAgent; 676 | var verLength = agentStr.indexOf(")") - agentStr.indexOf("Mac OS X"); 677 | var verStr = agentStr.substr(agentStr.indexOf("Mac OS X"), verLength); 678 | var result = verStr.replace("_", "."); 679 | result = result.replace("_", "."); 680 | return result; 681 | } 682 | 683 | return "Unknown Operation System"; 684 | }; 685 | -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/default/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 - v5.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 | //------------------------------ CSInterface ---------------------------------- 407 | 408 | /** 409 | * @class CSInterface 410 | * This is the entry point to the CEP extensibility infrastructure. 411 | * Instantiate this object and use it to: 412 | *
    413 | *
  • Access information about the host application in which an extension is running
  • 414 | *
  • Launch an extension
  • 415 | *
  • Register interest in event notifications, and dispatch events
  • 416 | *
417 | * 418 | * @return A new \c CSInterface object 419 | */ 420 | function CSInterface() 421 | { 422 | }; 423 | 424 | /** 425 | * User can add this event listener to handle native application theme color changes. 426 | * Callback function gives extensions ability to fine-tune their theme color after the 427 | * global theme color has been changed. 428 | * The callback function should be like below: 429 | * 430 | * @example 431 | * // event is a CSEvent object, but user can ignore it. 432 | * function OnAppThemeColorChanged(event) 433 | * { 434 | * // Should get a latest HostEnvironment object from application. 435 | * var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; 436 | * // Gets the style information such as color info from the skinInfo, 437 | * // and redraw all UI controls of your extension according to the style info. 438 | * } 439 | */ 440 | CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged"; 441 | 442 | /** The host environment data object. */ 443 | CSInterface.prototype.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); 444 | 445 | /** Retrieves information about the host environment in which the 446 | * extension is currently running. 447 | * 448 | * @return A \c #HostEnvironment object. 449 | */ 450 | CSInterface.prototype.getHostEnvironment = function() 451 | { 452 | this.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); 453 | return this.hostEnvironment; 454 | }; 455 | 456 | /** Closes this extension. */ 457 | CSInterface.prototype.closeExtension = function() 458 | { 459 | window.__adobe_cep__.closeExtension(); 460 | }; 461 | 462 | /** 463 | * Retrieves a path for which a constant is defined in the system. 464 | * 465 | * @param pathType The path-type constant defined in \c #SystemPath , 466 | * 467 | * @return The platform-specific system path string. 468 | */ 469 | CSInterface.prototype.getSystemPath = function(pathType) 470 | { 471 | var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType)); 472 | var OSVersion = this.getOSInformation(); 473 | if (OSVersion.indexOf("Windows") >= 0) 474 | { 475 | path = path.replace("file:///", ""); 476 | } 477 | else if (OSVersion.indexOf("Mac") >= 0) 478 | { 479 | path = path.replace("file://", ""); 480 | } 481 | return path; 482 | }; 483 | 484 | /** 485 | * Evaluates a JavaScript script, which can use the JavaScript DOM 486 | * of the host application. 487 | * 488 | * @param script The JavaScript script. 489 | * @param callback Optional. A callback function that receives the result of execution. 490 | * If execution fails, the callback function receives the error message \c EvalScript_ErrMessage. 491 | */ 492 | CSInterface.prototype.evalScript = function(script, callback) 493 | { 494 | if(callback == null || callback == undefined) 495 | { 496 | callback = function(result){}; 497 | } 498 | window.__adobe_cep__.evalScript(script, callback); 499 | }; 500 | 501 | /** 502 | * Retrieves the unique identifier of the application. 503 | * in which the extension is currently running. 504 | * 505 | * @return The unique ID string. 506 | */ 507 | CSInterface.prototype.getApplicationID = function() 508 | { 509 | var appId = this.hostEnvironment.appId; 510 | return appId; 511 | }; 512 | 513 | /** 514 | * Retrieves host capability information for the application 515 | * in which the extension is currently running. 516 | * 517 | * @return A \c #HostCapabilities object. 518 | */ 519 | CSInterface.prototype.getHostCapabilities = function() 520 | { 521 | var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() ); 522 | return hostCapabilities; 523 | }; 524 | 525 | /** 526 | * Triggers a CEP event programmatically. Yoy can use it to dispatch 527 | * an event of a predefined type, or of a type you have defined. 528 | * 529 | * @param event A \c CSEvent object. 530 | */ 531 | CSInterface.prototype.dispatchEvent = function(event) 532 | { 533 | if (typeof event.data == "object") 534 | { 535 | event.data = JSON.stringify(event.data); 536 | } 537 | 538 | window.__adobe_cep__.dispatchEvent(event); 539 | }; 540 | 541 | /** 542 | * Registers an interest in a CEP event of a particular type, and 543 | * assigns an event handler. 544 | * The event infrastructure notifies your extension when events of this type occur, 545 | * passing the event object to the registered handler function. 546 | * 547 | * @param type The name of the event type of interest. 548 | * @param listener The JavaScript handler function or method. 549 | * @param obj Optional, the object containing the handler method, if any. 550 | * Default is null. 551 | */ 552 | CSInterface.prototype.addEventListener = function(type, listener, obj) 553 | { 554 | window.__adobe_cep__.addEventListener(type, listener, obj); 555 | }; 556 | 557 | /** 558 | * Removes a registered event listener. 559 | * 560 | * @param type The name of the event type of interest. 561 | * @param listener The JavaScript handler function or method that was registered. 562 | * @param obj Optional, the object containing the handler method, if any. 563 | * Default is null. 564 | */ 565 | CSInterface.prototype.removeEventListener = function(type, listener, obj) 566 | { 567 | window.__adobe_cep__.removeEventListener(type, listener, obj); 568 | }; 569 | 570 | /** 571 | * Loads and launches another extension, or activates the extension if it is already loaded. 572 | * 573 | * @param extensionId The extension's unique identifier. 574 | * @param startupParams Not currently used, pass "". 575 | * 576 | * @example 577 | * To launch the extension "help" with ID "HLP" from this extension, call: 578 | * requestOpenExtension("HLP", ""); 579 | * 580 | */ 581 | CSInterface.prototype.requestOpenExtension = function(extensionId, params) 582 | { 583 | window.__adobe_cep__.requestOpenExtension(extensionId, params); 584 | }; 585 | 586 | /** 587 | * Retrieves the list of extensions currently loaded in the current host application. 588 | * The extension list is initialized once, and remains the same during the lifetime 589 | * of the CEP session. 590 | * 591 | * @param extensionIds Optional, an array of unique identifiers for extensions of interest. 592 | * If omitted, retrieves data for all extensions. 593 | * 594 | * @return Zero or more \c #Extension objects. 595 | */ 596 | CSInterface.prototype.getExtensions = function(extensionIds) 597 | { 598 | var extensionIdsStr = JSON.stringify(extensionIds); 599 | var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr); 600 | 601 | var extensions = JSON.parse(extensionsStr); 602 | return extensions; 603 | }; 604 | 605 | /** 606 | * Retrieves network-related preferences. 607 | * 608 | * @return A JavaScript object containing network preferences. 609 | */ 610 | CSInterface.prototype.getNetworkPreferences = function() 611 | { 612 | var result = window.__adobe_cep__.getNetworkPreferences(); 613 | var networkPre = JSON.parse(result); 614 | 615 | return networkPre; 616 | }; 617 | 618 | /** 619 | * Initializes the resource bundle for this extension with property values 620 | * for the current application and locale. 621 | * To support multiple locales, you must define a property file for each locale, 622 | * containing keyed display-string values for that locale. 623 | * See localization documentation for Extension Builder and related products. 624 | * 625 | * Keys can be in the 626 | * form key.value="localized string", for use in HTML text elements. 627 | * For example, in this input element, the localized \c key.value string is displayed 628 | * instead of the empty \c value string: 629 | * 630 | * 631 | * 632 | * @return An object containing the resource bundle information. 633 | */ 634 | CSInterface.prototype.initResourceBundle = function() 635 | { 636 | var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle()); 637 | var resElms = document.querySelectorAll('[data-locale]'); 638 | for (var n = 0; n < resElms.length; n++) 639 | { 640 | var resEl = resElms[n]; 641 | // Get the resource key from the element. 642 | var resKey = resEl.getAttribute('data-locale'); 643 | if (resKey) 644 | { 645 | // Get all the resources that start with the key. 646 | for (var key in resourceBundle) 647 | { 648 | if (key.indexOf(resKey) == 0) 649 | { 650 | var resValue = resourceBundle[key]; 651 | if (key.indexOf('.') == -1) 652 | { 653 | // No dot notation in resource key, 654 | // assign the resource value to the element's 655 | // innerHTML. 656 | resEl.innerHTML = resValue; 657 | } 658 | else 659 | { 660 | // Dot notation in resource key, assign the 661 | // resource value to the element's property 662 | // whose name corresponds to the substring 663 | // after the dot. 664 | var attrKey = key.substring(key.indexOf('.') + 1); 665 | resEl[attrKey] = resValue; 666 | } 667 | } 668 | } 669 | } 670 | } 671 | return resourceBundle; 672 | }; 673 | 674 | /** 675 | * Writes installation information to a file. 676 | * 677 | * @return The file path. 678 | */ 679 | CSInterface.prototype.dumpInstallationInfo = function() 680 | { 681 | return window.__adobe_cep__.dumpInstallationInfo(); 682 | }; 683 | 684 | /** 685 | * Retrieves version information for the current Operating System, 686 | * See http://www.useragentstring.com/pages/Chrome/ for Chrome \c navigator.userAgent values. 687 | * 688 | * @return A string containing the OS version, or "unknown Operation System". 689 | */ 690 | CSInterface.prototype.getOSInformation = function() 691 | { 692 | var userAgent = navigator.userAgent; 693 | 694 | if ((navigator.platform == "Win32") || (navigator.platform == "Windows")) 695 | { 696 | var winVersion = "Windows platform"; 697 | if (userAgent.indexOf("Windows NT 5.0") > -1) 698 | { 699 | winVersion = "Windows 2000"; 700 | } 701 | else if (userAgent.indexOf("Windows NT 5.1") > -1) 702 | { 703 | winVersion = "Windows XP"; 704 | } 705 | else if (userAgent.indexOf("Windows NT 5.2") > -1) 706 | { 707 | winVersion = "Windows Server 2003"; 708 | } 709 | else if (userAgent.indexOf("Windows NT 6.0") > -1) 710 | { 711 | winVersion = "Windows Vista"; 712 | } 713 | else if (userAgent.indexOf("Windows NT 6.1") > -1) 714 | { 715 | winVersion = "Windows 7"; 716 | } 717 | else if (userAgent.indexOf("Windows NT 6.2") > -1) 718 | { 719 | winVersion = "Windows 8"; 720 | } 721 | 722 | var winBit = "32-bit"; 723 | if (userAgent.indexOf("WOW64") > -1) 724 | { 725 | winBit = "64-bit"; 726 | } 727 | 728 | return winVersion + " " + winBit; 729 | } 730 | else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh")) 731 | { 732 | var agentStr = new String(); 733 | agentStr = userAgent; 734 | var verLength = agentStr.indexOf(")") - agentStr.indexOf("Mac OS X"); 735 | var verStr = agentStr.substr(agentStr.indexOf("Mac OS X"), verLength); 736 | var result = verStr.replace("_", "."); 737 | result = result.replace("_", "."); 738 | return result; 739 | } 740 | 741 | return "Unknown Operation System"; 742 | }; 743 | 744 | /** 745 | * Opens a page in the default system browser. 746 | * 747 | * Since 4.2.0 748 | * 749 | * @param url The URL of the page to open. Must use HTTP or HTTPS protocol. 750 | * 751 | * @return One of these error codes:\n 752 | *
    \n 753 | *
  • NO_ERROR - 0
  • \n 754 | *
  • ERR_UNKNOWN - 1
  • \n 755 | *
  • ERR_INVALID_PARAMS - 2
  • \n 756 | *
  • ERR_INVALID_URL - 201
  • \n 757 | *
\n 758 | */ 759 | CSInterface.prototype.openURLInDefaultBrowser = function(url) 760 | { 761 | return cep.util.openURLInDefaultBrowser(url); 762 | }; 763 | 764 | /** 765 | * Retrieves extension ID. 766 | * 767 | * Since 4.2.0 768 | * 769 | * @return extension ID. 770 | */ 771 | CSInterface.prototype.getExtensionID = function() 772 | { 773 | return window.__adobe_cep__.getExtensionId(); 774 | }; 775 | 776 | /** 777 | * Retrieves scale factor of screen. This only works on Mac. 778 | * 779 | * Since 4.2.0 780 | * 781 | * @return One of the following integer. 782 | *
    \n 783 | *
  • -1 means fail to get scale factor or this API has not been available on Windows yet
  • \n 784 | *
  • 1 means normal screen
  • \n 785 | *
  • 2 means HiDPI screen
  • \n 786 | *
\n 787 | */ 788 | CSInterface.prototype.getScaleFactor = function() 789 | { 790 | return window.__adobe_cep__.getScaleFactor(); 791 | }; 792 | 793 | /** 794 | * Set a handler to detect any changes of scale factor. This only works on Mac. 795 | * 796 | * Since 4.2.0 797 | * 798 | * @param handler The function to be called when scale factor is changed. 799 | * 800 | */ 801 | CSInterface.prototype.setScaleFactorChangedHandler = function(handler) 802 | { 803 | window.__adobe_cep__.setScaleFactorChangedHandler(handler); 804 | }; 805 | 806 | /** 807 | * Retrieves current API version. 808 | * 809 | * Since 4.2.0 810 | * 811 | * @return ApiVersion object. 812 | * 813 | */ 814 | CSInterface.prototype.getCurrentApiVersion = function() 815 | { 816 | var apiVersion = JSON.parse(window.__adobe_cep__.getCurrentApiVersion()); 817 | return apiVersion; 818 | }; -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/theme/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 - v5.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 | //------------------------------ CSInterface ---------------------------------- 407 | 408 | /** 409 | * @class CSInterface 410 | * This is the entry point to the CEP extensibility infrastructure. 411 | * Instantiate this object and use it to: 412 | *
    413 | *
  • Access information about the host application in which an extension is running
  • 414 | *
  • Launch an extension
  • 415 | *
  • Register interest in event notifications, and dispatch events
  • 416 | *
417 | * 418 | * @return A new \c CSInterface object 419 | */ 420 | function CSInterface() 421 | { 422 | }; 423 | 424 | /** 425 | * User can add this event listener to handle native application theme color changes. 426 | * Callback function gives extensions ability to fine-tune their theme color after the 427 | * global theme color has been changed. 428 | * The callback function should be like below: 429 | * 430 | * @example 431 | * // event is a CSEvent object, but user can ignore it. 432 | * function OnAppThemeColorChanged(event) 433 | * { 434 | * // Should get a latest HostEnvironment object from application. 435 | * var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; 436 | * // Gets the style information such as color info from the skinInfo, 437 | * // and redraw all UI controls of your extension according to the style info. 438 | * } 439 | */ 440 | CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged"; 441 | 442 | /** The host environment data object. */ 443 | CSInterface.prototype.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); 444 | 445 | /** Retrieves information about the host environment in which the 446 | * extension is currently running. 447 | * 448 | * @return A \c #HostEnvironment object. 449 | */ 450 | CSInterface.prototype.getHostEnvironment = function() 451 | { 452 | this.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); 453 | return this.hostEnvironment; 454 | }; 455 | 456 | /** Closes this extension. */ 457 | CSInterface.prototype.closeExtension = function() 458 | { 459 | window.__adobe_cep__.closeExtension(); 460 | }; 461 | 462 | /** 463 | * Retrieves a path for which a constant is defined in the system. 464 | * 465 | * @param pathType The path-type constant defined in \c #SystemPath , 466 | * 467 | * @return The platform-specific system path string. 468 | */ 469 | CSInterface.prototype.getSystemPath = function(pathType) 470 | { 471 | var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType)); 472 | var OSVersion = this.getOSInformation(); 473 | if (OSVersion.indexOf("Windows") >= 0) 474 | { 475 | path = path.replace("file:///", ""); 476 | } 477 | else if (OSVersion.indexOf("Mac") >= 0) 478 | { 479 | path = path.replace("file://", ""); 480 | } 481 | return path; 482 | }; 483 | 484 | /** 485 | * Evaluates a JavaScript script, which can use the JavaScript DOM 486 | * of the host application. 487 | * 488 | * @param script The JavaScript script. 489 | * @param callback Optional. A callback function that receives the result of execution. 490 | * If execution fails, the callback function receives the error message \c EvalScript_ErrMessage. 491 | */ 492 | CSInterface.prototype.evalScript = function(script, callback) 493 | { 494 | if(callback == null || callback == undefined) 495 | { 496 | callback = function(result){}; 497 | } 498 | window.__adobe_cep__.evalScript(script, callback); 499 | }; 500 | 501 | /** 502 | * Retrieves the unique identifier of the application. 503 | * in which the extension is currently running. 504 | * 505 | * @return The unique ID string. 506 | */ 507 | CSInterface.prototype.getApplicationID = function() 508 | { 509 | var appId = this.hostEnvironment.appId; 510 | return appId; 511 | }; 512 | 513 | /** 514 | * Retrieves host capability information for the application 515 | * in which the extension is currently running. 516 | * 517 | * @return A \c #HostCapabilities object. 518 | */ 519 | CSInterface.prototype.getHostCapabilities = function() 520 | { 521 | var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() ); 522 | return hostCapabilities; 523 | }; 524 | 525 | /** 526 | * Triggers a CEP event programmatically. Yoy can use it to dispatch 527 | * an event of a predefined type, or of a type you have defined. 528 | * 529 | * @param event A \c CSEvent object. 530 | */ 531 | CSInterface.prototype.dispatchEvent = function(event) 532 | { 533 | if (typeof event.data == "object") 534 | { 535 | event.data = JSON.stringify(event.data); 536 | } 537 | 538 | window.__adobe_cep__.dispatchEvent(event); 539 | }; 540 | 541 | /** 542 | * Registers an interest in a CEP event of a particular type, and 543 | * assigns an event handler. 544 | * The event infrastructure notifies your extension when events of this type occur, 545 | * passing the event object to the registered handler function. 546 | * 547 | * @param type The name of the event type of interest. 548 | * @param listener The JavaScript handler function or method. 549 | * @param obj Optional, the object containing the handler method, if any. 550 | * Default is null. 551 | */ 552 | CSInterface.prototype.addEventListener = function(type, listener, obj) 553 | { 554 | window.__adobe_cep__.addEventListener(type, listener, obj); 555 | }; 556 | 557 | /** 558 | * Removes a registered event listener. 559 | * 560 | * @param type The name of the event type of interest. 561 | * @param listener The JavaScript handler function or method that was registered. 562 | * @param obj Optional, the object containing the handler method, if any. 563 | * Default is null. 564 | */ 565 | CSInterface.prototype.removeEventListener = function(type, listener, obj) 566 | { 567 | window.__adobe_cep__.removeEventListener(type, listener, obj); 568 | }; 569 | 570 | /** 571 | * Loads and launches another extension, or activates the extension if it is already loaded. 572 | * 573 | * @param extensionId The extension's unique identifier. 574 | * @param startupParams Not currently used, pass "". 575 | * 576 | * @example 577 | * To launch the extension "help" with ID "HLP" from this extension, call: 578 | * requestOpenExtension("HLP", ""); 579 | * 580 | */ 581 | CSInterface.prototype.requestOpenExtension = function(extensionId, params) 582 | { 583 | window.__adobe_cep__.requestOpenExtension(extensionId, params); 584 | }; 585 | 586 | /** 587 | * Retrieves the list of extensions currently loaded in the current host application. 588 | * The extension list is initialized once, and remains the same during the lifetime 589 | * of the CEP session. 590 | * 591 | * @param extensionIds Optional, an array of unique identifiers for extensions of interest. 592 | * If omitted, retrieves data for all extensions. 593 | * 594 | * @return Zero or more \c #Extension objects. 595 | */ 596 | CSInterface.prototype.getExtensions = function(extensionIds) 597 | { 598 | var extensionIdsStr = JSON.stringify(extensionIds); 599 | var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr); 600 | 601 | var extensions = JSON.parse(extensionsStr); 602 | return extensions; 603 | }; 604 | 605 | /** 606 | * Retrieves network-related preferences. 607 | * 608 | * @return A JavaScript object containing network preferences. 609 | */ 610 | CSInterface.prototype.getNetworkPreferences = function() 611 | { 612 | var result = window.__adobe_cep__.getNetworkPreferences(); 613 | var networkPre = JSON.parse(result); 614 | 615 | return networkPre; 616 | }; 617 | 618 | /** 619 | * Initializes the resource bundle for this extension with property values 620 | * for the current application and locale. 621 | * To support multiple locales, you must define a property file for each locale, 622 | * containing keyed display-string values for that locale. 623 | * See localization documentation for Extension Builder and related products. 624 | * 625 | * Keys can be in the 626 | * form key.value="localized string", for use in HTML text elements. 627 | * For example, in this input element, the localized \c key.value string is displayed 628 | * instead of the empty \c value string: 629 | * 630 | * 631 | * 632 | * @return An object containing the resource bundle information. 633 | */ 634 | CSInterface.prototype.initResourceBundle = function() 635 | { 636 | var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle()); 637 | var resElms = document.querySelectorAll('[data-locale]'); 638 | for (var n = 0; n < resElms.length; n++) 639 | { 640 | var resEl = resElms[n]; 641 | // Get the resource key from the element. 642 | var resKey = resEl.getAttribute('data-locale'); 643 | if (resKey) 644 | { 645 | // Get all the resources that start with the key. 646 | for (var key in resourceBundle) 647 | { 648 | if (key.indexOf(resKey) == 0) 649 | { 650 | var resValue = resourceBundle[key]; 651 | if (key.indexOf('.') == -1) 652 | { 653 | // No dot notation in resource key, 654 | // assign the resource value to the element's 655 | // innerHTML. 656 | resEl.innerHTML = resValue; 657 | } 658 | else 659 | { 660 | // Dot notation in resource key, assign the 661 | // resource value to the element's property 662 | // whose name corresponds to the substring 663 | // after the dot. 664 | var attrKey = key.substring(key.indexOf('.') + 1); 665 | resEl[attrKey] = resValue; 666 | } 667 | } 668 | } 669 | } 670 | } 671 | return resourceBundle; 672 | }; 673 | 674 | /** 675 | * Writes installation information to a file. 676 | * 677 | * @return The file path. 678 | */ 679 | CSInterface.prototype.dumpInstallationInfo = function() 680 | { 681 | return window.__adobe_cep__.dumpInstallationInfo(); 682 | }; 683 | 684 | /** 685 | * Retrieves version information for the current Operating System, 686 | * See http://www.useragentstring.com/pages/Chrome/ for Chrome \c navigator.userAgent values. 687 | * 688 | * @return A string containing the OS version, or "unknown Operation System". 689 | */ 690 | CSInterface.prototype.getOSInformation = function() 691 | { 692 | var userAgent = navigator.userAgent; 693 | 694 | if ((navigator.platform == "Win32") || (navigator.platform == "Windows")) 695 | { 696 | var winVersion = "Windows platform"; 697 | if (userAgent.indexOf("Windows NT 5.0") > -1) 698 | { 699 | winVersion = "Windows 2000"; 700 | } 701 | else if (userAgent.indexOf("Windows NT 5.1") > -1) 702 | { 703 | winVersion = "Windows XP"; 704 | } 705 | else if (userAgent.indexOf("Windows NT 5.2") > -1) 706 | { 707 | winVersion = "Windows Server 2003"; 708 | } 709 | else if (userAgent.indexOf("Windows NT 6.0") > -1) 710 | { 711 | winVersion = "Windows Vista"; 712 | } 713 | else if (userAgent.indexOf("Windows NT 6.1") > -1) 714 | { 715 | winVersion = "Windows 7"; 716 | } 717 | else if (userAgent.indexOf("Windows NT 6.2") > -1) 718 | { 719 | winVersion = "Windows 8"; 720 | } 721 | 722 | var winBit = "32-bit"; 723 | if (userAgent.indexOf("WOW64") > -1) 724 | { 725 | winBit = "64-bit"; 726 | } 727 | 728 | return winVersion + " " + winBit; 729 | } 730 | else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh")) 731 | { 732 | var agentStr = new String(); 733 | agentStr = userAgent; 734 | var verLength = agentStr.indexOf(")") - agentStr.indexOf("Mac OS X"); 735 | var verStr = agentStr.substr(agentStr.indexOf("Mac OS X"), verLength); 736 | var result = verStr.replace("_", "."); 737 | result = result.replace("_", "."); 738 | return result; 739 | } 740 | 741 | return "Unknown Operation System"; 742 | }; 743 | 744 | /** 745 | * Opens a page in the default system browser. 746 | * 747 | * Since 4.2.0 748 | * 749 | * @param url The URL of the page to open. Must use HTTP or HTTPS protocol. 750 | * 751 | * @return One of these error codes:\n 752 | *
    \n 753 | *
  • NO_ERROR - 0
  • \n 754 | *
  • ERR_UNKNOWN - 1
  • \n 755 | *
  • ERR_INVALID_PARAMS - 2
  • \n 756 | *
  • ERR_INVALID_URL - 201
  • \n 757 | *
\n 758 | */ 759 | CSInterface.prototype.openURLInDefaultBrowser = function(url) 760 | { 761 | return cep.util.openURLInDefaultBrowser(url); 762 | }; 763 | 764 | /** 765 | * Retrieves extension ID. 766 | * 767 | * Since 4.2.0 768 | * 769 | * @return extension ID. 770 | */ 771 | CSInterface.prototype.getExtensionID = function() 772 | { 773 | return window.__adobe_cep__.getExtensionId(); 774 | }; 775 | 776 | /** 777 | * Retrieves scale factor of screen. This only works on Mac. 778 | * 779 | * Since 4.2.0 780 | * 781 | * @return One of the following integer. 782 | *
    \n 783 | *
  • -1 means fail to get scale factor or this API has not been available on Windows yet
  • \n 784 | *
  • 1 means normal screen
  • \n 785 | *
  • 2 means HiDPI screen
  • \n 786 | *
\n 787 | */ 788 | CSInterface.prototype.getScaleFactor = function() 789 | { 790 | return window.__adobe_cep__.getScaleFactor(); 791 | }; 792 | 793 | /** 794 | * Set a handler to detect any changes of scale factor. This only works on Mac. 795 | * 796 | * Since 4.2.0 797 | * 798 | * @param handler The function to be called when scale factor is changed. 799 | * 800 | */ 801 | CSInterface.prototype.setScaleFactorChangedHandler = function(handler) 802 | { 803 | window.__adobe_cep__.setScaleFactorChangedHandler(handler); 804 | }; 805 | 806 | /** 807 | * Retrieves current API version. 808 | * 809 | * Since 4.2.0 810 | * 811 | * @return ApiVersion object. 812 | * 813 | */ 814 | CSInterface.prototype.getCurrentApiVersion = function() 815 | { 816 | var apiVersion = JSON.parse(window.__adobe_cep__.getCurrentApiVersion()); 817 | return apiVersion; 818 | }; -------------------------------------------------------------------------------- /CC-EXT-SDK/templates/topcoat/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 - v5.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 | //------------------------------ CSInterface ---------------------------------- 407 | 408 | /** 409 | * @class CSInterface 410 | * This is the entry point to the CEP extensibility infrastructure. 411 | * Instantiate this object and use it to: 412 | *
    413 | *
  • Access information about the host application in which an extension is running
  • 414 | *
  • Launch an extension
  • 415 | *
  • Register interest in event notifications, and dispatch events
  • 416 | *
417 | * 418 | * @return A new \c CSInterface object 419 | */ 420 | function CSInterface() 421 | { 422 | }; 423 | 424 | /** 425 | * User can add this event listener to handle native application theme color changes. 426 | * Callback function gives extensions ability to fine-tune their theme color after the 427 | * global theme color has been changed. 428 | * The callback function should be like below: 429 | * 430 | * @example 431 | * // event is a CSEvent object, but user can ignore it. 432 | * function OnAppThemeColorChanged(event) 433 | * { 434 | * // Should get a latest HostEnvironment object from application. 435 | * var skinInfo = JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo; 436 | * // Gets the style information such as color info from the skinInfo, 437 | * // and redraw all UI controls of your extension according to the style info. 438 | * } 439 | */ 440 | CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged"; 441 | 442 | /** The host environment data object. */ 443 | CSInterface.prototype.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); 444 | 445 | /** Retrieves information about the host environment in which the 446 | * extension is currently running. 447 | * 448 | * @return A \c #HostEnvironment object. 449 | */ 450 | CSInterface.prototype.getHostEnvironment = function() 451 | { 452 | this.hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); 453 | return this.hostEnvironment; 454 | }; 455 | 456 | /** Closes this extension. */ 457 | CSInterface.prototype.closeExtension = function() 458 | { 459 | window.__adobe_cep__.closeExtension(); 460 | }; 461 | 462 | /** 463 | * Retrieves a path for which a constant is defined in the system. 464 | * 465 | * @param pathType The path-type constant defined in \c #SystemPath , 466 | * 467 | * @return The platform-specific system path string. 468 | */ 469 | CSInterface.prototype.getSystemPath = function(pathType) 470 | { 471 | var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType)); 472 | var OSVersion = this.getOSInformation(); 473 | if (OSVersion.indexOf("Windows") >= 0) 474 | { 475 | path = path.replace("file:///", ""); 476 | } 477 | else if (OSVersion.indexOf("Mac") >= 0) 478 | { 479 | path = path.replace("file://", ""); 480 | } 481 | return path; 482 | }; 483 | 484 | /** 485 | * Evaluates a JavaScript script, which can use the JavaScript DOM 486 | * of the host application. 487 | * 488 | * @param script The JavaScript script. 489 | * @param callback Optional. A callback function that receives the result of execution. 490 | * If execution fails, the callback function receives the error message \c EvalScript_ErrMessage. 491 | */ 492 | CSInterface.prototype.evalScript = function(script, callback) 493 | { 494 | if(callback == null || callback == undefined) 495 | { 496 | callback = function(result){}; 497 | } 498 | window.__adobe_cep__.evalScript(script, callback); 499 | }; 500 | 501 | /** 502 | * Retrieves the unique identifier of the application. 503 | * in which the extension is currently running. 504 | * 505 | * @return The unique ID string. 506 | */ 507 | CSInterface.prototype.getApplicationID = function() 508 | { 509 | var appId = this.hostEnvironment.appId; 510 | return appId; 511 | }; 512 | 513 | /** 514 | * Retrieves host capability information for the application 515 | * in which the extension is currently running. 516 | * 517 | * @return A \c #HostCapabilities object. 518 | */ 519 | CSInterface.prototype.getHostCapabilities = function() 520 | { 521 | var hostCapabilities = JSON.parse(window.__adobe_cep__.getHostCapabilities() ); 522 | return hostCapabilities; 523 | }; 524 | 525 | /** 526 | * Triggers a CEP event programmatically. Yoy can use it to dispatch 527 | * an event of a predefined type, or of a type you have defined. 528 | * 529 | * @param event A \c CSEvent object. 530 | */ 531 | CSInterface.prototype.dispatchEvent = function(event) 532 | { 533 | if (typeof event.data == "object") 534 | { 535 | event.data = JSON.stringify(event.data); 536 | } 537 | 538 | window.__adobe_cep__.dispatchEvent(event); 539 | }; 540 | 541 | /** 542 | * Registers an interest in a CEP event of a particular type, and 543 | * assigns an event handler. 544 | * The event infrastructure notifies your extension when events of this type occur, 545 | * passing the event object to the registered handler function. 546 | * 547 | * @param type The name of the event type of interest. 548 | * @param listener The JavaScript handler function or method. 549 | * @param obj Optional, the object containing the handler method, if any. 550 | * Default is null. 551 | */ 552 | CSInterface.prototype.addEventListener = function(type, listener, obj) 553 | { 554 | window.__adobe_cep__.addEventListener(type, listener, obj); 555 | }; 556 | 557 | /** 558 | * Removes a registered event listener. 559 | * 560 | * @param type The name of the event type of interest. 561 | * @param listener The JavaScript handler function or method that was registered. 562 | * @param obj Optional, the object containing the handler method, if any. 563 | * Default is null. 564 | */ 565 | CSInterface.prototype.removeEventListener = function(type, listener, obj) 566 | { 567 | window.__adobe_cep__.removeEventListener(type, listener, obj); 568 | }; 569 | 570 | /** 571 | * Loads and launches another extension, or activates the extension if it is already loaded. 572 | * 573 | * @param extensionId The extension's unique identifier. 574 | * @param startupParams Not currently used, pass "". 575 | * 576 | * @example 577 | * To launch the extension "help" with ID "HLP" from this extension, call: 578 | * requestOpenExtension("HLP", ""); 579 | * 580 | */ 581 | CSInterface.prototype.requestOpenExtension = function(extensionId, params) 582 | { 583 | window.__adobe_cep__.requestOpenExtension(extensionId, params); 584 | }; 585 | 586 | /** 587 | * Retrieves the list of extensions currently loaded in the current host application. 588 | * The extension list is initialized once, and remains the same during the lifetime 589 | * of the CEP session. 590 | * 591 | * @param extensionIds Optional, an array of unique identifiers for extensions of interest. 592 | * If omitted, retrieves data for all extensions. 593 | * 594 | * @return Zero or more \c #Extension objects. 595 | */ 596 | CSInterface.prototype.getExtensions = function(extensionIds) 597 | { 598 | var extensionIdsStr = JSON.stringify(extensionIds); 599 | var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr); 600 | 601 | var extensions = JSON.parse(extensionsStr); 602 | return extensions; 603 | }; 604 | 605 | /** 606 | * Retrieves network-related preferences. 607 | * 608 | * @return A JavaScript object containing network preferences. 609 | */ 610 | CSInterface.prototype.getNetworkPreferences = function() 611 | { 612 | var result = window.__adobe_cep__.getNetworkPreferences(); 613 | var networkPre = JSON.parse(result); 614 | 615 | return networkPre; 616 | }; 617 | 618 | /** 619 | * Initializes the resource bundle for this extension with property values 620 | * for the current application and locale. 621 | * To support multiple locales, you must define a property file for each locale, 622 | * containing keyed display-string values for that locale. 623 | * See localization documentation for Extension Builder and related products. 624 | * 625 | * Keys can be in the 626 | * form key.value="localized string", for use in HTML text elements. 627 | * For example, in this input element, the localized \c key.value string is displayed 628 | * instead of the empty \c value string: 629 | * 630 | * 631 | * 632 | * @return An object containing the resource bundle information. 633 | */ 634 | CSInterface.prototype.initResourceBundle = function() 635 | { 636 | var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle()); 637 | var resElms = document.querySelectorAll('[data-locale]'); 638 | for (var n = 0; n < resElms.length; n++) 639 | { 640 | var resEl = resElms[n]; 641 | // Get the resource key from the element. 642 | var resKey = resEl.getAttribute('data-locale'); 643 | if (resKey) 644 | { 645 | // Get all the resources that start with the key. 646 | for (var key in resourceBundle) 647 | { 648 | if (key.indexOf(resKey) == 0) 649 | { 650 | var resValue = resourceBundle[key]; 651 | if (key.indexOf('.') == -1) 652 | { 653 | // No dot notation in resource key, 654 | // assign the resource value to the element's 655 | // innerHTML. 656 | resEl.innerHTML = resValue; 657 | } 658 | else 659 | { 660 | // Dot notation in resource key, assign the 661 | // resource value to the element's property 662 | // whose name corresponds to the substring 663 | // after the dot. 664 | var attrKey = key.substring(key.indexOf('.') + 1); 665 | resEl[attrKey] = resValue; 666 | } 667 | } 668 | } 669 | } 670 | } 671 | return resourceBundle; 672 | }; 673 | 674 | /** 675 | * Writes installation information to a file. 676 | * 677 | * @return The file path. 678 | */ 679 | CSInterface.prototype.dumpInstallationInfo = function() 680 | { 681 | return window.__adobe_cep__.dumpInstallationInfo(); 682 | }; 683 | 684 | /** 685 | * Retrieves version information for the current Operating System, 686 | * See http://www.useragentstring.com/pages/Chrome/ for Chrome \c navigator.userAgent values. 687 | * 688 | * @return A string containing the OS version, or "unknown Operation System". 689 | */ 690 | CSInterface.prototype.getOSInformation = function() 691 | { 692 | var userAgent = navigator.userAgent; 693 | 694 | if ((navigator.platform == "Win32") || (navigator.platform == "Windows")) 695 | { 696 | var winVersion = "Windows platform"; 697 | if (userAgent.indexOf("Windows NT 5.0") > -1) 698 | { 699 | winVersion = "Windows 2000"; 700 | } 701 | else if (userAgent.indexOf("Windows NT 5.1") > -1) 702 | { 703 | winVersion = "Windows XP"; 704 | } 705 | else if (userAgent.indexOf("Windows NT 5.2") > -1) 706 | { 707 | winVersion = "Windows Server 2003"; 708 | } 709 | else if (userAgent.indexOf("Windows NT 6.0") > -1) 710 | { 711 | winVersion = "Windows Vista"; 712 | } 713 | else if (userAgent.indexOf("Windows NT 6.1") > -1) 714 | { 715 | winVersion = "Windows 7"; 716 | } 717 | else if (userAgent.indexOf("Windows NT 6.2") > -1) 718 | { 719 | winVersion = "Windows 8"; 720 | } 721 | 722 | var winBit = "32-bit"; 723 | if (userAgent.indexOf("WOW64") > -1) 724 | { 725 | winBit = "64-bit"; 726 | } 727 | 728 | return winVersion + " " + winBit; 729 | } 730 | else if ((navigator.platform == "MacIntel") || (navigator.platform == "Macintosh")) 731 | { 732 | var agentStr = new String(); 733 | agentStr = userAgent; 734 | var verLength = agentStr.indexOf(")") - agentStr.indexOf("Mac OS X"); 735 | var verStr = agentStr.substr(agentStr.indexOf("Mac OS X"), verLength); 736 | var result = verStr.replace("_", "."); 737 | result = result.replace("_", "."); 738 | return result; 739 | } 740 | 741 | return "Unknown Operation System"; 742 | }; 743 | 744 | /** 745 | * Opens a page in the default system browser. 746 | * 747 | * Since 4.2.0 748 | * 749 | * @param url The URL of the page to open. Must use HTTP or HTTPS protocol. 750 | * 751 | * @return One of these error codes:\n 752 | *
    \n 753 | *
  • NO_ERROR - 0
  • \n 754 | *
  • ERR_UNKNOWN - 1
  • \n 755 | *
  • ERR_INVALID_PARAMS - 2
  • \n 756 | *
  • ERR_INVALID_URL - 201
  • \n 757 | *
\n 758 | */ 759 | CSInterface.prototype.openURLInDefaultBrowser = function(url) 760 | { 761 | return cep.util.openURLInDefaultBrowser(url); 762 | }; 763 | 764 | /** 765 | * Retrieves extension ID. 766 | * 767 | * Since 4.2.0 768 | * 769 | * @return extension ID. 770 | */ 771 | CSInterface.prototype.getExtensionID = function() 772 | { 773 | return window.__adobe_cep__.getExtensionId(); 774 | }; 775 | 776 | /** 777 | * Retrieves scale factor of screen. This only works on Mac. 778 | * 779 | * Since 4.2.0 780 | * 781 | * @return One of the following integer. 782 | *
    \n 783 | *
  • -1 means fail to get scale factor or this API has not been available on Windows yet
  • \n 784 | *
  • 1 means normal screen
  • \n 785 | *
  • 2 means HiDPI screen
  • \n 786 | *
\n 787 | */ 788 | CSInterface.prototype.getScaleFactor = function() 789 | { 790 | return window.__adobe_cep__.getScaleFactor(); 791 | }; 792 | 793 | /** 794 | * Set a handler to detect any changes of scale factor. This only works on Mac. 795 | * 796 | * Since 4.2.0 797 | * 798 | * @param handler The function to be called when scale factor is changed. 799 | * 800 | */ 801 | CSInterface.prototype.setScaleFactorChangedHandler = function(handler) 802 | { 803 | window.__adobe_cep__.setScaleFactorChangedHandler(handler); 804 | }; 805 | 806 | /** 807 | * Retrieves current API version. 808 | * 809 | * Since 4.2.0 810 | * 811 | * @return ApiVersion object. 812 | * 813 | */ 814 | CSInterface.prototype.getCurrentApiVersion = function() 815 | { 816 | var apiVersion = JSON.parse(window.__adobe_cep__.getCurrentApiVersion()); 817 | return apiVersion; 818 | }; --------------------------------------------------------------------------------