From 08d1188b339acb243770d6443a374d85ef135154 Mon Sep 17 00:00:00 2001
From: hyb1996 <946994919@qq.com>
Date: Wed, 25 Oct 2017 00:15:47 +0800
Subject: [PATCH] add: * offline docs * tow-row input method enhance bar * long
press hint to show function manual * docs drawer
---
app/src/main/AndroidManifest.xml | 4 +-
.../addon/autojs/autojs-global-scope.js | 634 +++++++++---------
.../codemirror/addon/autojs/autojs-hint.js | 171 +++++
.../editor/codemirror/addon/hint/show-hint.js | 3 +-
app/src/main/assets/editor/index.html | 12 +-
app/src/main/assets/help/catalogue.json | 310 ---------
.../help/developerguide/如何写自动操作脚本.md | 16 -
.../Android7.0以上点按与手势模拟.md | 79 ---
.../assets/help/documentation/shell命令.md | 385 -----------
.../assets/help/documentation/一般常用函数.md | 85 ---
.../documentation/事件与按键、触摸监听.md | 414 ------------
.../help/documentation/图片与图色处理.md | 179 -----
.../help/documentation/如何阅读本文档.md | 30 -
.../main/assets/help/documentation/定时器.md | 50 --
.../assets/help/documentation/常见问题.md | 50 --
.../main/assets/help/documentation/应用.md | 46 --
.../assets/help/documentation/控制台与输出.md | 56 --
.../assets/help/documentation/文件读写.md | 198 ------
.../help/documentation/模块与第三方jar.md | 23 -
.../assets/help/documentation/简介与说明.md | 3 -
.../assets/help/documentation/脚本引擎.md | 56 --
.../assets/help/documentation/自动操作函数.md | 95 ---
.../assets/help/documentation/调用Java API.md | 162 -----
.../main/assets/help/documentation/选择器.md | 573 ----------------
.../需要Root权限的自动操作函数.md | 176 -----
.../需要Root权限的触摸与多点触摸.md | 71 --
.../assets/help/w3c/Function 对象(类).html | 148 ----
.../main/assets/help/w3c/arguments 对象.html | 85 ---
.../help/w3c/break 和 continue 语句.html | 114 ----
app/src/main/assets/help/w3c/if 语句.html | 77 ---
app/src/main/assets/help/w3c/switch 语句.html | 98 ---
app/src/main/assets/help/w3c/with 语句.html | 41 --
app/src/main/assets/help/w3c/一元运算符.html | 215 ------
app/src/main/assets/help/w3c/乘性运算符.html | 88 ---
app/src/main/assets/help/w3c/位运算符.html | 357 ----------
app/src/main/assets/help/w3c/保留字.html | 70 --
app/src/main/assets/help/w3c/修改对象.html | 179 -----
app/src/main/assets/help/w3c/值.html | 56 --
app/src/main/assets/help/w3c/关系运算符.html | 91 ---
app/src/main/assets/help/w3c/关键字.html | 60 --
app/src/main/assets/help/w3c/函数概述.html | 121 ----
app/src/main/assets/help/w3c/加性运算符.html | 88 ---
app/src/main/assets/help/w3c/原始类型.html | 286 --------
app/src/main/assets/help/w3c/变量.html | 191 ------
.../main/assets/help/w3c/定义类或对象.html | 455 -------------
app/src/main/assets/help/w3c/对象作用域.html | 148 ----
app/src/main/assets/help/w3c/对象应用.html | 80 ---
app/src/main/assets/help/w3c/对象类型.html | 86 ---
app/src/main/assets/help/w3c/引用类型.html | 418 ------------
app/src/main/assets/help/w3c/条件运算符.html | 34 -
app/src/main/assets/help/w3c/标签语句.html | 34 -
app/src/main/assets/help/w3c/等性运算符.html | 145 ----
app/src/main/assets/help/w3c/类型转换.html | 282 --------
.../main/assets/help/w3c/继承机制实例.html | 34 -
.../main/assets/help/w3c/继承机制实现.html | 329 ---------
app/src/main/assets/help/w3c/语法.html | 105 ---
app/src/main/assets/help/w3c/赋值运算符.html | 55 --
app/src/main/assets/help/w3c/迭代语句.html | 108 ---
app/src/main/assets/help/w3c/逗号运算符.html | 30 -
app/src/main/assets/help/w3c/逻辑运算符.html | 294 --------
.../main/assets/help/w3c/闭包(closure).html | 68 --
.../main/assets/help/w3c/面向对象技术.html | 61 --
.../java/com/stardust/scriptdroid/Pref.java | 3 +
.../ui/doc/DocumentationActivity.java | 48 ++
.../scriptdroid/ui/doc/ManualDialog.java | 83 +++
.../ui/{main => }/doc/OnlineDocsFragment.java | 11 +-
.../scriptdroid/ui/edit/CodeMirrorEditor.java | 6 +-
.../scriptdroid/ui/edit/EditActivity.java | 4 +
.../scriptdroid/ui/edit/EditorView.java | 127 ++--
.../ui/edit/ViewSampleActivity.java | 3 +-
.../ui/edit/completion/CodeCompletionBar.java | 32 +-
.../ui/edit/completion/CodeCompletions.java | 14 +-
.../ui/edit/completion/Symbols.java | 4 +-
.../ui/help/DocumentationActivity.java | 105 ---
.../ui/help/HelpCatalogueActivity.java | 216 ------
.../ui/help/LocalWebViewActivity.java | 77 ---
.../scriptdroid/ui/main/MainActivity.java | 2 +-
.../java/com/stardust/widget/EWebView.java | 2 +-
app/src/main/res/drawable/ic_ali_close.png | Bin 0 -> 976 bytes
.../main/res/drawable/ic_ali_fullscreen.png | Bin 0 -> 1825 bytes
app/src/main/res/drawable/ic_ali_fx.png | Bin 0 -> 2691 bytes
.../main/res/drawable/ic_ali_pin_to_left.png | Bin 0 -> 1091 bytes
...ocument.xml => activity_documentation.xml} | 23 +-
app/src/main/res/layout/editor_view.xml | 80 ++-
.../res/layout/floating_manual_dialog.xml | 72 ++
85 files changed, 848 insertions(+), 9076 deletions(-)
create mode 100644 app/src/main/assets/editor/codemirror/addon/autojs/autojs-hint.js
delete mode 100644 app/src/main/assets/help/catalogue.json
delete mode 100644 app/src/main/assets/help/developerguide/如何写自动操作脚本.md
delete mode 100644 app/src/main/assets/help/documentation/Android7.0以上点按与手势模拟.md
delete mode 100644 app/src/main/assets/help/documentation/shell命令.md
delete mode 100644 app/src/main/assets/help/documentation/一般常用函数.md
delete mode 100644 app/src/main/assets/help/documentation/事件与按键、触摸监听.md
delete mode 100644 app/src/main/assets/help/documentation/图片与图色处理.md
delete mode 100644 app/src/main/assets/help/documentation/如何阅读本文档.md
delete mode 100644 app/src/main/assets/help/documentation/定时器.md
delete mode 100644 app/src/main/assets/help/documentation/常见问题.md
delete mode 100644 app/src/main/assets/help/documentation/应用.md
delete mode 100644 app/src/main/assets/help/documentation/控制台与输出.md
delete mode 100644 app/src/main/assets/help/documentation/文件读写.md
delete mode 100644 app/src/main/assets/help/documentation/模块与第三方jar.md
delete mode 100644 app/src/main/assets/help/documentation/简介与说明.md
delete mode 100644 app/src/main/assets/help/documentation/脚本引擎.md
delete mode 100644 app/src/main/assets/help/documentation/自动操作函数.md
delete mode 100644 app/src/main/assets/help/documentation/调用Java API.md
delete mode 100644 app/src/main/assets/help/documentation/选择器.md
delete mode 100644 app/src/main/assets/help/documentation/需要Root权限的自动操作函数.md
delete mode 100644 app/src/main/assets/help/documentation/需要Root权限的触摸与多点触摸.md
delete mode 100644 app/src/main/assets/help/w3c/Function 对象(类).html
delete mode 100644 app/src/main/assets/help/w3c/arguments 对象.html
delete mode 100644 app/src/main/assets/help/w3c/break 和 continue 语句.html
delete mode 100644 app/src/main/assets/help/w3c/if 语句.html
delete mode 100644 app/src/main/assets/help/w3c/switch 语句.html
delete mode 100644 app/src/main/assets/help/w3c/with 语句.html
delete mode 100644 app/src/main/assets/help/w3c/一元运算符.html
delete mode 100644 app/src/main/assets/help/w3c/乘性运算符.html
delete mode 100644 app/src/main/assets/help/w3c/位运算符.html
delete mode 100644 app/src/main/assets/help/w3c/保留字.html
delete mode 100644 app/src/main/assets/help/w3c/修改对象.html
delete mode 100644 app/src/main/assets/help/w3c/值.html
delete mode 100644 app/src/main/assets/help/w3c/关系运算符.html
delete mode 100644 app/src/main/assets/help/w3c/关键字.html
delete mode 100644 app/src/main/assets/help/w3c/函数概述.html
delete mode 100644 app/src/main/assets/help/w3c/加性运算符.html
delete mode 100644 app/src/main/assets/help/w3c/原始类型.html
delete mode 100644 app/src/main/assets/help/w3c/变量.html
delete mode 100644 app/src/main/assets/help/w3c/定义类或对象.html
delete mode 100644 app/src/main/assets/help/w3c/对象作用域.html
delete mode 100644 app/src/main/assets/help/w3c/对象应用.html
delete mode 100644 app/src/main/assets/help/w3c/对象类型.html
delete mode 100644 app/src/main/assets/help/w3c/引用类型.html
delete mode 100644 app/src/main/assets/help/w3c/条件运算符.html
delete mode 100644 app/src/main/assets/help/w3c/标签语句.html
delete mode 100644 app/src/main/assets/help/w3c/等性运算符.html
delete mode 100644 app/src/main/assets/help/w3c/类型转换.html
delete mode 100644 app/src/main/assets/help/w3c/继承机制实例.html
delete mode 100644 app/src/main/assets/help/w3c/继承机制实现.html
delete mode 100644 app/src/main/assets/help/w3c/语法.html
delete mode 100644 app/src/main/assets/help/w3c/赋值运算符.html
delete mode 100644 app/src/main/assets/help/w3c/迭代语句.html
delete mode 100644 app/src/main/assets/help/w3c/逗号运算符.html
delete mode 100644 app/src/main/assets/help/w3c/逻辑运算符.html
delete mode 100644 app/src/main/assets/help/w3c/闭包(closure).html
delete mode 100644 app/src/main/assets/help/w3c/面向对象技术.html
create mode 100644 app/src/main/java/com/stardust/scriptdroid/ui/doc/DocumentationActivity.java
create mode 100644 app/src/main/java/com/stardust/scriptdroid/ui/doc/ManualDialog.java
rename app/src/main/java/com/stardust/scriptdroid/ui/{main => }/doc/OnlineDocsFragment.java (83%)
delete mode 100644 app/src/main/java/com/stardust/scriptdroid/ui/help/DocumentationActivity.java
delete mode 100644 app/src/main/java/com/stardust/scriptdroid/ui/help/HelpCatalogueActivity.java
delete mode 100644 app/src/main/java/com/stardust/scriptdroid/ui/help/LocalWebViewActivity.java
create mode 100644 app/src/main/res/drawable/ic_ali_close.png
create mode 100644 app/src/main/res/drawable/ic_ali_fullscreen.png
create mode 100644 app/src/main/res/drawable/ic_ali_fx.png
create mode 100644 app/src/main/res/drawable/ic_ali_pin_to_left.png
rename app/src/main/res/layout/{activity_document.xml => activity_documentation.xml} (59%)
create mode 100644 app/src/main/res/layout/floating_manual_dialog.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f1983935..965a730e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -71,18 +71,16 @@
android:multiprocess="true">
-
-
-
+
diff --git a/app/src/main/assets/editor/codemirror/addon/autojs/autojs-global-scope.js b/app/src/main/assets/editor/codemirror/addon/autojs/autojs-global-scope.js
index 0e9606e1..647d2ad5 100644
--- a/app/src/main/assets/editor/codemirror/addon/autojs/autojs-global-scope.js
+++ b/app/src/main/assets/editor/codemirror/addon/autojs/autojs-global-scope.js
@@ -1,338 +1,306 @@
function autoJsGlobalScope(){
- var globals = {
- "modules": [
- "app",
- "automator",
- "console",
- "dialogs",
- "events",
- "images",
- "files",
- "timers",
- "ui",
- ],
- "app": [
- "launchPackage",
- "launch",
- "launchApp",
- "getPackageName",
- "openAppSetting"
- ],
- "automator": [
- "click",
- "longClick",
- "press",
- "swipe",
- "gesture",
- "gestures",
- "gestureAsync",
- "gesturesAsync",
- "scrollDown",
- "scrollUp",
- "input",
- "setText"
- ],
- "console": [
- "print",
- "log",
- "err",
- "openConsole",
- "clearConsole"
- ],
- "dialogs": [
- "rawInput",
- "input",
- "alert",
- "confirm",
- "prompt"
- ],
- "images": [
- "requestScreenCapture",
- "captureScreen",
- "findColor",
- "findColorInRegion",
- "findColorEquals"
- ],
- "files": [
- "open"
- ],
- "selector": [
- "id",
- "idContains",
- "idStartsWith",
- "idEndsWith",
- "idMatches",
- "text",
- "textContains",
- "textStartsWith",
- "textEndsWith",
- "textMatches",
- "desc",
- "descContains",
- "descStartsWith",
- "descEndsWith",
- "descMatches",
- "className",
- "classNameContains",
- "classNameStartsWith",
- "classNameEndsWith",
- "classNameMatches",
- "packageName",
- "packageNameContains",
- "packageNameStartsWith",
- "packageNameEndsWith",
- "packageNameMatches",
- "bounds",
- "boundsInside",
- "boundsContains",
- "drawingOrder",
- "checkable",
- "checked",
- "focusable",
- "focused",
- "visibleToUser",
- "accessibilityFocused",
- "selected",
- "clickable",
- "longClickable",
- "enabled",
- "password",
- "scrollable",
- "editable",
- "contentInvalid",
- "contextClickable",
- "multiLine",
- "dismissable",
- "checkable",
- "checked",
- "focusable",
- "focused",
- "visibleToUser",
- "accessibilityFocused",
- "selected",
- "clickable",
- "longClickable",
- "enabled",
- "password",
- "scrollable",
- "editable",
- "contentInvalid",
- "contextClickable",
- "multiLine",
- "dismissable"
- ],
- "shell": [
- "SetScreenMetrics",
- "Tap",
- "Swipe",
- "Screencap",
- "KeyCode",
- "Home",
- "Back",
- "Power",
- "Up",
- "Down",
- "Left",
- "Right",
- "OK",
- "VolumeUp",
- "VolumeDown",
- "Menu",
- "Camera",
- "Text"
- ],
- "timers": [
- "loop",
- "setTimeout",
- "clearTimeout",
- "setInterval",
- "clearInterval",
- "setImmediate",
- "clearImmediate"
- ],
- "web": [
- "newInjectableWebClient",
- "newInjectableWebView"
- ],
- "general": [
- "toast",
- "toastLog",
- "sleep",
- "isStopped",
- "notStopped",
- "exit",
- "setClip",
- "getClip",
- "currentPackage",
- "currentActivity",
- "waitForActivity",
- "waitForPackage",
- "setScreenMetrics"
- ],
- "variables": [
- "context",
- "activity"
- ]
- };
- var modules = {
- "app": [
- "uninstall",
- "viewFile",
- "editFile",
- "openUrl",
- "launchPackage",
- "launch",
- "launchApp",
- "getPackageName",
- "openAppSetting"
- ],
- "automator": [
- "click",
- "longClick",
- "press",
- "swipe",
- "gesture",
- "gestures",
- "gestureAsync",
- "gesturesAsync",
- "scrollDown",
- "scrollUp",
- "input",
- "setText"
- ],
- "console": [
- "show",
- "hide",
- "clear",
- "verbose",
- "print",
- "info",
- "log",
- "warn",
- "error",
- "assert"
- ],
- "dialogs": [
- "select",
- "singleChoice",
- "multiChoice",
- "rawInput",
- "input",
- "alert",
- "confirm",
- "prompt"
- ],
- "images": [
- "saveImage",
- "pixel",
- "read",
- "requestScreenCapture",
- "captureScreen",
- "findColor",
- "findColorInRegion",
- "findColorEquals"
- ],
- "colors": [
- "red",
- "green",
- "blue",
- "alpha",
- "toString",
- "rgb",
- "argb"
- ],
- "events": [
- "emitter",
- "observeKey",
- "observeTouch",
- "observeNotification",
- "onKeyDown",
- "onKeyUp",
- "onceKeyDown",
- "onceKeyUp",
- "onToast",
- "onNotification",
- "removeAllKeyDownListeners",
- "removeAllKeyUpListeners",
- "onTouch",
- "removeAllTouchListeners",
- "getTouchEventTimeout",
- "setTouchEventTimeout",
- "on",
- "once",
- "emit",
- "getListeners",
- "addListener",
- "eventNames",
- "listenerCount",
- "listeners",
- "prependListener",
- "prependOnceListener",
- "removeAllListeners",
- "removeAllListeners",
- "removeListener",
- "setMaxListeners",
- "getMaxListeners",
- "defaultMaxListeners"
- ],
- "files": [
- "open",
- "isFile",
- "isDir",
- "isEmptyDir",
- "join",
- "create",
- "createIfNotExists",
- "exists",
- "ensureDir",
- "read",
- "write",
- "copy",
- "rename",
- "renameWithoutExtension",
- "getName",
- "getExtension",
- "remove",
- "removeDir",
- "getSdcardPath",
- "listDir"
- ],
- "timers": [
- "loop",
- "setTimeout",
- "clearTimeout",
- "setInterval",
- "clearInterval",
- "setImmediate",
- "clearImmediate"
- ]
- };
- function for_each(obj, func){
- for(var key in obj){
- if(!obj.hasOwnProperty(key)){
- continue;
- }
- func(key, obj[key]);
+ function FUNCTION(url){
+ var f = function(){};
+ f.__url__ = url;
+ return f;
+ }
+ function VARIABLE(url){
+ return {
+ __url__: url
}
}
- var __global__ = {};
- for_each(modules, function(moduleName, moduleVariables){
- if(!__global__[moduleName]){
- __global__[moduleName] = {};
- }
- for(var i = 0; i < moduleVariables.length; i++){
- if(!__global__[moduleName][moduleVariables[i]]){
- __global__[moduleName][moduleVariables[i]] = '';
- }
- }
- });
- for_each(globals, function(moduleName, moduleVariables){
- for(var i = 0; i < moduleVariables.length; i++){
- if(!__global__[moduleVariables[i]]){
- __global__[moduleVariables[i]] = '';
- }
- }
- })
- return __global__;
+ var app = {
+ "uninstall": FUNCTION("app.html#app_app_uninstall_packagename"),
+ "viewFile": FUNCTION("app.html#app_app_viewfile_path"),
+ "editFile": FUNCTION("app.html#app_app_editfile_path"),
+ "openUrl": FUNCTION("app.html#app_app_openurl_url"),
+ "launchPackage": FUNCTION("app.html#app_app_takephoto_path"),
+ "launch": FUNCTION("globals.html#globals_launchpackage_packagename"),
+ "launchApp": FUNCTION("globals.html#globals_launchapp_appname"),
+ "getPackageName": FUNCTION("globals.html#globals_getpackagename_appname"),
+ "openAppSetting": FUNCTION("globals.html#globals_getappname_packagename"),
+ __url__: "app.html"
+ };
+ var automator = {
+ "click": FUNCTION("widgets-based-automation.html#widgets_based_automation_click_text_i"),
+ "longClick": FUNCTION("widgets-based-automation.html#widgets_based_automation_longclick_text_i"),
+ "press": FUNCTION(),
+ "swipe": FUNCTION(),
+ "gesture": FUNCTION(),
+ "gestures": FUNCTION(),
+ "gestureAsync": FUNCTION(),
+ "gesturesAsync": FUNCTION(),
+ "scrollDown": FUNCTION("widgets-based-automation.html#widgets_based_automation_scrollup_i"),
+ "scrollUp": FUNCTION("widgets-based-automation.html#widgets_based_automation_scrollup_i"),
+ "input": FUNCTION("widgets-based-automation.html#widgets_based_automation_input_i_text"),
+ "setText": FUNCTION("widgets-based-automation.html#widgets_based_automation_settext_i_text"),
+ __url__: "widgets-based-automation.html"
+ };
+ var console = {
+ "show": FUNCTION("console.html#console_console_show"),
+ "hide": FUNCTION(),
+ "clear": FUNCTION("console.html#console_console_clear"),
+ "verbose": FUNCTION("console.html#console_console_verbose_data_args"),
+ "info": FUNCTION("console.html#console_console_info_data_args"),
+ "log": FUNCTION("console.html#console_console_log_data_args"),
+ "warn": FUNCTION("console.html#console_console_warn_data_args"),
+ "error": FUNCTION("console.html#console_console_error_data_args"),
+ "assert": FUNCTION("console.html#console_console_assert_value_message"),
+ __url__: "console.html"
+ };
+ var dialogs = {
+ "select": FUNCTION(),
+ "singleChoice": FUNCTION(),
+ "multiChoice": FUNCTION(),
+ "rawInput": FUNCTION(),
+ "input": FUNCTION(),
+ "alert": FUNCTION(),
+ "confirm": FUNCTION(),
+ "prompt": FUNCTION()
+ };
+ var images = {
+ "saveImage": FUNCTION("images.html#images_images_saveimage_image_path"),
+ "pixel": FUNCTION("images.html#images_images_pixel_image_x_y"),
+ "read": FUNCTION(),
+ "requestScreenCapture": FUNCTION("images.html#images_requestscreencapture_width_height"),
+ "captureScreen": FUNCTION("images.html#images_capturescreen"),
+ "findColor": FUNCTION("images.html#images_images_findcolor_image_color_options"),
+ "findColorInRegion": FUNCTION("images.html#images_images_findcolorinregion_img_color_x_y_width_height_threads_algorithm_threshold"),
+ "findColorEquals": FUNCTION("images.html#images_images_findcolorequals_img_color_x_y_width_height_threads"),
+ __url__: "images.html"
+ };
+ var colors = {
+ "red": FUNCTION("images.html#images_colors_red_color"),
+ "green": FUNCTION("images.html#images_colors_green_color"),
+ "blue": FUNCTION("images.html#images_colors_blue_color"),
+ "alpha": FUNCTION("images.html#images_colors_alpha_color"),
+ "toString": FUNCTION("images.html#images_colors_tostring_color"),
+ "rgb": FUNCTION("images.html#images_colors_rgb_red_green_blue"),
+ "argb": FUNCTION("images.html#images_colors_argb_alpha_red_green_blue"),
+ __url__: "images.html#images_colors"
+ };
+ var events = {
+ "emitter": FUNCTION("events.html#events_events_emitter"),
+ "observeKey": FUNCTION("events.html#events_events_observekey"),
+ "observeTouch": FUNCTION("events.html#events_events_observetouch"),
+ "observeNotification": FUNCTION("events.html#events_obversenotification"),
+ "onKeyDown": FUNCTION("events.html#events_events_onkeydown_keyname_listener"),
+ "onKeyUp": FUNCTION("events.html#events_events_onkeyup_keyname_listener"),
+ "onceKeyDown": FUNCTION("events.html#events_events_oncekeydown_keyname_listener"),
+ "onceKeyUp": FUNCTION("events.html#events_events_oncekeyup_keyname_listener"),
+ "onToast": FUNCTION("events.html#events_toast"),
+ "onNotification": FUNCTION("events.html#events_notification"),
+ "removeAllKeyDownListeners": FUNCTION("events.html#events_events_removeallkeydownlisteners_keyname"),
+ "removeAllKeyUpListeners": FUNCTION("events.html#events_events_removeallkeyuplisteners_keyname"),
+ "onTouch": FUNCTION("events.html#events_events_ontouch_listener"),
+ "removeAllTouchListeners": FUNCTION("events.html#events_events_removealltouchlisteners"),
+ "getTouchEventTimeout": FUNCTION("events.html#events_events_gettoucheventtimeout"),
+ "setTouchEventTimeout": FUNCTION("events.html#events_events_settoucheventtimeout_timeout"),
+ "on": FUNCTION("events.html#events_eventemitter_on_eventname_listener"),
+ "once": FUNCTION("events.html#events_eventemitter_once_eventname_listener"),
+ "emit": FUNCTION("events.html#events_eventemitter_emit_eventname_args"),
+ "getListeners": FUNCTION(),
+ "addListener": FUNCTION("events.html#events_eventemitter_addlistener_eventname_listener"),
+ "eventNames": FUNCTION("events.html#events_eventemitter_eventnames"),
+ "listenerCount": FUNCTION("events.html#events_eventemitter_listenercount_eventname"),
+ "listeners": FUNCTION("events.html#events_eventemitter_listeners_eventname"),
+ "prependListener": FUNCTION("events.html#events_eventemitter_prependlistener_eventname_listener"),
+ "prependOnceListener": FUNCTION("events.html#events_eventemitter_prependoncelistener_eventname_listener"),
+ "removeAllListeners": FUNCTION("events.html#events_eventemitter_removealllisteners_eventname"),
+ "removeListener": FUNCTION("events.html#events_eventemitter_removelistener_eventname_listener"),
+ "setMaxListeners": FUNCTION("events.html#events_eventemitter_setmaxlisteners_n"),
+ "getMaxListeners": FUNCTION("events.html#events_eventemitter_getmaxlisteners"),
+ "defaultMaxListeners": FUNCTION("events.html#events_eventemitter_defaultmaxlisteners"),
+ __url__: "events.html"
+ };
+ var files = {
+ "open": FUNCTION(),
+ "isFile": FUNCTION("files.html#files_files_isfile_path"),
+ "isDir": FUNCTION("files.html#files_files_isdir_path"),
+ "isEmptyDir": FUNCTION("files.html#files_files_isemptydir_path"),
+ "join": FUNCTION("files.html#files_files_join_parent_child"),
+ "create": FUNCTION("files.html#files_files_create_path"),
+ "createIfNotExists": FUNCTION("files.html#files_files_createifnotexists_path"),
+ "exists": FUNCTION("files.html#files_files_exists_path"),
+ "ensureDir": FUNCTION("files.html#files_files_ensuredir_path"),
+ "read": FUNCTION("files.html#files_files_read_path_encoding_utf_8"),
+ "write": FUNCTION("files.html#files_files_write_path_text_encoding_utf_8"),
+ "copy": FUNCTION("files.html#files_files_copy_frompath_topath"),
+ "move": FUNCTION("files.html#files_files_move_frompath_topath"),
+ "rename": FUNCTION("files.html#files_files_rename_path_newname"),
+ "renameWithoutExtension": FUNCTION("files.html#files_files_renamewithoutextension_path_newname"),
+ "getName": FUNCTION("files.html#files_files_getname_path"),
+ "getExtension": FUNCTION("files.html#files_files_getextension_path"),
+ "getNameWithoutExtension": FUNCTION("files.html#files_files_getnamewithoutextension_path"),
+ "remove": FUNCTION("files.html#files_files_remove_path"),
+ "removeDir": FUNCTION("files.html#files_files_removedir_path"),
+ "getSdcardPath": FUNCTION("files.html#files_files_getsdcardpath"),
+ "listDir": FUNCTION("files.html#files_files_listdir_path_filter"),
+ __url__: "files.html"
+ };
+ var timers = {
+ "setTimeout": FUNCTION("timers.html#timers_settimeout_callback_delay_args"),
+ "clearTimeout": FUNCTION("timers.html#timers_cleartimeout_id"),
+ "setInterval": FUNCTION("timers.html#timers_setinterval_callback_delay_args"),
+ "clearInterval": FUNCTION("timers.html#timers_clearinterval_id"),
+ "setImmediate": FUNCTION("timers.html#timers_setimmediate_callback_args"),
+ "clearImmediate": FUNCTION("timers.html#timers_clearimmediate_id")
+ };
+ var globals = {
+ "app": app,
+ "automator": automator,
+ "console": console,
+ "dialogs": dialogs,
+ "events": events,
+ "images": images,
+ "files": files,
+ "timers": timers,
+ "ui": {},
+
+ "click": FUNCTION(),
+ "longClick": FUNCTION(),
+ "press": FUNCTION(),
+ "swipe": FUNCTION(),
+ "gesture": FUNCTION(),
+ "gestures": FUNCTION(),
+ "gestureAsync": FUNCTION(),
+ "gesturesAsync": FUNCTION(),
+ "scrollDown": FUNCTION(),
+ "scrollUp": FUNCTION(),
+ "input": FUNCTION(),
+ "setText": FUNCTION(),
+
+ "print": FUNCTION(),
+ "log": FUNCTION(),
+ "err": FUNCTION(),
+ "openConsole": FUNCTION(),
+ "clearConsole": FUNCTION(),
+
+ "rawInput": FUNCTION(),
+ "input": FUNCTION(),
+ "alert": FUNCTION(),
+ "confirm": FUNCTION(),
+ "prompt": FUNCTION(),
+
+ "requestScreenCapture": FUNCTION(),
+ "captureScreen": FUNCTION(),
+ "findColor": FUNCTION(),
+ "findColorInRegion": FUNCTION(),
+ "findColorEquals": FUNCTION(),
+
+ "open": FUNCTION(),
+
+ "id": FUNCTION(),
+ "idContains": FUNCTION(),
+ "idStartsWith": FUNCTION(),
+ "idEndsWith": FUNCTION(),
+ "idMatches": FUNCTION(),
+ "text": FUNCTION(),
+ "textContains": FUNCTION(),
+ "textStartsWith": FUNCTION(),
+ "textEndsWith": FUNCTION(),
+ "textMatches": FUNCTION(),
+ "desc": FUNCTION(),
+ "descContains": FUNCTION(),
+ "descStartsWith": FUNCTION(),
+ "descEndsWith": FUNCTION(),
+ "descMatches": FUNCTION(),
+ "className": FUNCTION(),
+ "classNameContains": FUNCTION(),
+ "classNameStartsWith": FUNCTION(),
+ "classNameEndsWith": FUNCTION(),
+ "classNameMatches": FUNCTION(),
+ "packageName": FUNCTION(),
+ "packageNameContains": FUNCTION(),
+ "packageNameStartsWith": FUNCTION(),
+ "packageNameEndsWith": FUNCTION(),
+ "packageNameMatches": FUNCTION(),
+ "bounds": FUNCTION(),
+ "boundsInside": FUNCTION(),
+ "boundsContains": FUNCTION(),
+ "drawingOrder": FUNCTION(),
+ "checkable": FUNCTION(),
+ "checked": FUNCTION(),
+ "focusable": FUNCTION(),
+ "focused": FUNCTION(),
+ "visibleToUser": FUNCTION(),
+ "accessibilityFocused": FUNCTION(),
+ "selected": FUNCTION(),
+ "clickable": FUNCTION(),
+ "longClickable": FUNCTION(),
+ "enabled": FUNCTION(),
+ "password": FUNCTION(),
+ "scrollable": FUNCTION(),
+ "editable": FUNCTION(),
+ "contentInvalid": FUNCTION(),
+ "contextClickable": FUNCTION(),
+ "multiLine": FUNCTION(),
+ "dismissable": FUNCTION(),
+ "checkable": FUNCTION(),
+ "checked": FUNCTION(),
+ "focusable": FUNCTION(),
+ "focused": FUNCTION(),
+ "visibleToUser": FUNCTION(),
+ "accessibilityFocused": FUNCTION(),
+ "selected": FUNCTION(),
+ "clickable": FUNCTION(),
+ "longClickable": FUNCTION(),
+ "enabled": FUNCTION(),
+ "password": FUNCTION(),
+ "scrollable": FUNCTION(),
+ "editable": FUNCTION(),
+ "contentInvalid": FUNCTION(),
+ "contextClickable": FUNCTION(),
+ "multiLine": FUNCTION(),
+ "dismissable": FUNCTION(),
+
+ "SetScreenMetrics": FUNCTION(),
+ "Tap": FUNCTION(),
+ "Swipe": FUNCTION(),
+ "Screencap": FUNCTION(),
+ "KeyCode": FUNCTION(),
+ "Home": FUNCTION(),
+ "Back": FUNCTION(),
+ "Power": FUNCTION(),
+ "Up": FUNCTION(),
+ "Down": FUNCTION(),
+ "Left": FUNCTION(),
+ "Right": FUNCTION(),
+ "OK": FUNCTION(),
+ "VolumeUp": FUNCTION(),
+ "VolumeDown": FUNCTION(),
+ "Menu": FUNCTION(),
+ "Camera": FUNCTION(),
+ "Text": FUNCTION(),
+
+ "loop": FUNCTION(),
+ "setTimeout": FUNCTION(),
+ "clearTimeout": FUNCTION(),
+ "setInterval": FUNCTION(),
+ "clearInterval": FUNCTION(),
+ "setImmediate": FUNCTION(),
+ "clearImmediate": FUNCTION(),
+
+ "newInjectableWebClient": FUNCTION(),
+ "newInjectableWebView": FUNCTION(),
+
+ "toast": FUNCTION(),
+ "toastLog": FUNCTION(),
+ "sleep": FUNCTION(),
+ "isStopped": FUNCTION(),
+ "notStopped": FUNCTION(),
+ "exit": FUNCTION(),
+ "setClip": FUNCTION(),
+ "getClip": FUNCTION(),
+ "currentPackage": FUNCTION(),
+ "currentActivity": FUNCTION(),
+ "waitForActivity": FUNCTION(),
+ "waitForPackage": FUNCTION(),
+ "setScreenMetrics": FUNCTION(),
+
+ "context": {},
+ "activity": {}
+ };
+ return globals;
}
diff --git a/app/src/main/assets/editor/codemirror/addon/autojs/autojs-hint.js b/app/src/main/assets/editor/codemirror/addon/autojs/autojs-hint.js
new file mode 100644
index 00000000..293db28b
--- /dev/null
+++ b/app/src/main/assets/editor/codemirror/addon/autojs/autojs-hint.js
@@ -0,0 +1,171 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ var Pos = CodeMirror.Pos;
+
+ function forEach(arr, f) {
+ for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
+ }
+
+ function arrayContains(arr, item) {
+ if (!Array.prototype.indexOf) {
+ var i = arr.length;
+ while (i--) {
+ if (arr[i] === item) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return arr.indexOf(item) != -1;
+ }
+
+ function scriptHint(editor, keywords, getToken, options) {
+ // Find the token at the cursor
+ var cur = editor.getCursor(), token = getToken(editor, cur);
+ if (/\b(?:string|comment)\b/.test(token.type)) return;
+ token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
+
+ // If it's not a 'word-style' token, ignore the token.
+ if (!/^[\w$_]*$/.test(token.string)) {
+ token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
+ type: token.string == "." ? "property" : null};
+ } else if (token.end > cur.ch) {
+ token.end = cur.ch;
+ token.string = token.string.slice(0, cur.ch - token.start);
+ }
+
+ var tprop = token;
+ // If it is a property, find out what it is a property of.
+ while (tprop.type == "property") {
+ tprop = getToken(editor, Pos(cur.line, tprop.start));
+ if (tprop.string != ".") return;
+ tprop = getToken(editor, Pos(cur.line, tprop.start));
+ if (!context) var context = [];
+ context.push(tprop);
+ }
+ var c = getCompletions(token, context, keywords, options);
+ return {list: c.list,
+ urls: c.urls,
+ from: Pos(cur.line, token.start),
+ to: Pos(cur.line, token.end)};
+ }
+
+ function javascriptHint(editor, options) {
+ return scriptHint(editor, javascriptKeywords,
+ function (e, cur) {return e.getTokenAt(cur);},
+ options);
+ };
+ CodeMirror.registerHelper("hint", "javascript", javascriptHint);
+
+ function getCoffeeScriptToken(editor, cur) {
+ // This getToken, it is for coffeescript, imitates the behavior of
+ // getTokenAt method in javascript.js, that is, returning "property"
+ // type and treat "." as indepenent token.
+ var token = editor.getTokenAt(cur);
+ if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
+ token.end = token.start;
+ token.string = '.';
+ token.type = "property";
+ }
+ else if (/^\.[\w$_]*$/.test(token.string)) {
+ token.type = "property";
+ token.start++;
+ token.string = token.string.replace(/\./, '');
+ }
+ return token;
+ }
+
+ function coffeescriptHint(editor, options) {
+ return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
+ }
+ CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
+
+ var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
+ "toUpperCase toLowerCase split concat match replace search").split(" ");
+ var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
+ "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
+ var funcProps = "prototype apply call bind".split(" ");
+ var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
+ "if in instanceof new null return switch throw true try typeof var void while with").split(" ");
+ var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
+ "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
+
+ function forAllProps(obj, callback) {
+ for (var name in obj) {
+ var value = obj[name];
+ callback(name, value.__url__);
+ }
+ return;
+ //unreachable
+ if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
+ for (var name in obj) callback(name)
+ } else {
+ for (var o = obj; o; o = Object.getPrototypeOf(o))
+ Object.getOwnPropertyNames(o).forEach(callback)
+ }
+ }
+
+ function getCompletions(token, context, keywords, options) {
+ var found = [], start = token.string, global = options && options.globalScope || window;
+ var urls = [];
+ function maybeAdd(str, url) {
+ if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) {
+ found.push(str);
+ urls.push(url);
+ }
+ }
+ function gatherCompletions(obj) {
+ if (typeof obj == "string") forEach(stringProps, maybeAdd);
+ else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
+ else if (obj instanceof Function) forEach(funcProps, maybeAdd);
+ forAllProps(obj, maybeAdd)
+ }
+
+ if (context && context.length) {
+ // If this is a property, see if it belongs to some object we can
+ // find in the current environment.
+ var obj = context.pop(), base;
+ if (obj.type && obj.type.indexOf("variable") === 0) {
+ if (options && options.additionalContext)
+ base = options.additionalContext[obj.string];
+ if (!options || options.useGlobalScope !== false)
+ base = base || global[obj.string];
+ } else if (obj.type == "string") {
+ base = "";
+ } else if (obj.type == "atom") {
+ base = 1;
+ } else if (obj.type == "function") {
+ if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
+ (typeof global.jQuery == 'function'))
+ base = global.jQuery();
+ else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
+ base = global._();
+ }
+ while (base != null && context.length)
+ base = base[context.pop().string];
+ if (base != null) gatherCompletions(base);
+ } else {
+ // If not, just look in the global object and any local scope
+ // (reading into JS mode internals to get at the local and global variables)
+ for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
+ for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
+ if (!options || options.useGlobalScope !== false)
+ gatherCompletions(global);
+ forEach(keywords, maybeAdd);
+ }
+ return {
+ list: found,
+ urls: urls
+ }
+ }
+
+});
diff --git a/app/src/main/assets/editor/codemirror/addon/hint/show-hint.js b/app/src/main/assets/editor/codemirror/addon/hint/show-hint.js
index afe67546..474aa833 100644
--- a/app/src/main/assets/editor/codemirror/addon/hint/show-hint.js
+++ b/app/src/main/assets/editor/codemirror/addon/hint/show-hint.js
@@ -128,9 +128,10 @@
if (picked && data.list.length == 1) {
this.pick(data, 0);
} else {
+ console.log("data:", data);
//Modified By Stardust
if(typeof __bridge__ != 'undefined'){
- __bridge__.updateCodeCompletion(data.from.line, data.from.ch, data.to.line, data.to.ch, data.list);
+ __bridge__.updateCodeCompletion(data.from.line, data.from.ch, data.to.line, data.to.ch, data.list, data.urls);
}else{
this.widget = new Widget(this, data);
}
diff --git a/app/src/main/assets/editor/index.html b/app/src/main/assets/editor/index.html
index 5a7e440f..76b23ba5 100644
--- a/app/src/main/assets/editor/index.html
+++ b/app/src/main/assets/editor/index.html
@@ -31,7 +31,7 @@
-
+
@@ -55,16 +55,6 @@
-
-
-
-
-
-
-
-
-
-