add:
* offline docs * tow-row input method enhance bar * long press hint to show function manual * docs drawer
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
171
app/src/main/assets/editor/codemirror/addon/autojs/autojs-hint.js
vendored
Normal file
171
app/src/main/assets/editor/codemirror/addon/autojs/autojs-hint.js
vendored
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<!-- 代码补全 -->
|
||||
<link rel="stylesheet" href="codemirror/addon/hint/show-hint.css">
|
||||
<script src="codemirror/addon/hint/javascript-hint.js"></script>
|
||||
<script src="codemirror/addon/autojs/autojs-hint.js"></script>
|
||||
<script src="codemirror/addon/hint/show-hint.js"></script>
|
||||
|
||||
<!-- 代码格式化 -->
|
||||
@@ -55,16 +55,6 @@
|
||||
<!-- Tern -->
|
||||
<script src="codemirror/addon/tern/tern.js"></script>
|
||||
<link rel="stylesheet" href="codemirror/addon/tern/tern.css">
|
||||
<script src="http://ternjs.net/node_modules/acorn/dist/acorn.js"></script>
|
||||
<script src="http://ternjs.net/node_modules/acorn/dist/acorn_loose.js"></script>
|
||||
<script src="http://ternjs.net/node_modules/acorn/dist/walk.js"></script>
|
||||
<script src="http://ternjs.net/doc/demo/polyfill.js"></script>
|
||||
<script src="http://ternjs.net/lib/signal.js"></script>
|
||||
<script src="http://ternjs.net/lib/tern.js"></script>
|
||||
<script src="http://ternjs.net/lib/def.js"></script>
|
||||
<script src="http://ternjs.net/lib/comment.js"></script>
|
||||
<script src="http://ternjs.net/lib/infer.js"></script>
|
||||
<script src="http://ternjs.net/plugin/doc_comment.js"></script>
|
||||
|
||||
<script src="index.js"></script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user