Release 2.0.1Beta
This commit is contained in:
190
app/src/main/assets/sample/JavaScript/E4X.js
Normal file
190
app/src/main/assets/sample/JavaScript/E4X.js
Normal file
@@ -0,0 +1,190 @@
|
||||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
// Use the XML constructor to parse an string into an XML object
|
||||
var John = "<employee><name>John</name><age>25</age></employee>";
|
||||
var Sue ="<employee><name>Sue</name><age>32</age></employee>";
|
||||
var tagName = "employees";
|
||||
var employees = new XML("<" + tagName +">" + John + Sue + "</" + tagName +">");
|
||||
print("The employees XML object constructed from a string is:\n" + employees);
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
// Use an XML literal to create an XML object
|
||||
var order = <order>
|
||||
<customer>
|
||||
<firstname>John</firstname>
|
||||
<lastname>Doe</lastname>
|
||||
</customer>
|
||||
<item>
|
||||
<description>Big Screen Television</description>
|
||||
<price>1299.99</price>
|
||||
<quantity>1</quantity>
|
||||
</item>
|
||||
</order>
|
||||
|
||||
// Construct the full customer name
|
||||
var name = order.customer.firstname + " " + order.customer.lastname;
|
||||
|
||||
// Calculate the total price
|
||||
var total = order.item.price * order.item.quantity;
|
||||
|
||||
print("The order XML object constructed using a literal is:\n" + order);
|
||||
print("The total price of " + name + "'s order is " + total);
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
// construct a new XML object using expando and super-expando properties
|
||||
var order = <order/>;
|
||||
order.customer.name = "Fred Jones";
|
||||
order.customer.address.street = "123 Long Lang";
|
||||
order.customer.address.city = "Underwood";
|
||||
order.customer.address.state = "CA";
|
||||
order.item[0] = "";
|
||||
order.item[0].description = "Small Rodents";
|
||||
order.item[0].quantity = 10;
|
||||
order.item[0].price = 6.95;
|
||||
|
||||
print("The order custructed using expandos and super-expandos is:\n" + order);
|
||||
|
||||
// append a new item to the order
|
||||
order.item += <item><description>Catapult</description><price>139.95</price></item>;
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
print("The order after appending a new item is:\n" + order);
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
// dynamically construct an XML element using embedded expressions
|
||||
var tagname = "name";
|
||||
var attributename = "id";
|
||||
var attributevalue = 5;
|
||||
var content = "Fred";
|
||||
|
||||
var x = <{tagname} {attributename}={attributevalue}>{content}</{tagname}>;
|
||||
|
||||
print("The dynamically computed element value is:\n" + x.toXMLString());
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
// Create a SOAP message
|
||||
var message = <soap:Envelope
|
||||
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<soap:Body>
|
||||
<m:GetLastTradePrice xmlns:m="http://mycompany.com/stocks">
|
||||
<symbol>DIS</symbol>
|
||||
</m:GetLastTradePrice>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
||||
|
||||
// declare the SOAP and stocks namespaces
|
||||
var soap = new Namespace("http://schemas.xmlsoap.org/soap/envelope/");
|
||||
var stock = new Namespace ("http://mycompany.com/stocks");
|
||||
|
||||
// extract the soap encoding style and body from the soap message
|
||||
var encodingStyle = message.@soap::encodingStyle;
|
||||
|
||||
print("The encoding style of the soap message is specified by:\n" + encodingStyle);
|
||||
|
||||
// change the stock symbol
|
||||
message.soap::Body.stock::GetLastTradePrice.symbol = "MYCO";
|
||||
|
||||
var body = message.soap::Body;
|
||||
|
||||
print("The body of the soap message is:\n" + body);
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
// create an manipulate an XML object using the default xml namespace
|
||||
|
||||
default xml namespace = "http://default.namespace.com";
|
||||
var x = <x/>;
|
||||
x.a = "one";
|
||||
x.b = "two";
|
||||
x.c = <c xmlns="http://some.other.namespace.com">three</c>;
|
||||
|
||||
print("XML object constructed using the default xml namespace:\n" + x);
|
||||
|
||||
default xml namespace="";
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
var order = <order id = "123456" timestamp="Mon Mar 10 2003 16:03:25 GMT-0800 (PST)">
|
||||
<customer>
|
||||
<firstname>John</firstname>
|
||||
<lastname>Doe</lastname>
|
||||
</customer>
|
||||
<item id="3456">
|
||||
<description>Big Screen Television</description>
|
||||
<price>1299.99</price>
|
||||
<quantity>1</quantity>
|
||||
</item>
|
||||
<item id = "56789">
|
||||
<description>DVD Player</description>
|
||||
<price>399.99</price>
|
||||
<quantity>1</quantity>
|
||||
</item>
|
||||
</order>;
|
||||
|
||||
|
||||
// get the customer element from the orderprint("The customer is:\n" + order.customer);
|
||||
|
||||
// get the id attribute from the order
|
||||
print("The order id is:" + order.@id);
|
||||
|
||||
// get all the child elements from the order element
|
||||
print("The children of the order are:\n" + order.*);
|
||||
|
||||
// get the list of all item descriptions
|
||||
print("The order descriptions are:\n" + order.item.description);
|
||||
|
||||
|
||||
// get second item by numeric index
|
||||
print("The second item is:\n" + order.item[1]);
|
||||
|
||||
// get the list of all child elements in all item elements
|
||||
print("The children of the items are:\n" + order.item.*);
|
||||
|
||||
// get the second child element from the order by index
|
||||
print("The second child of the order is:\n" + order.*[1]);
|
||||
|
||||
// calculate the total price of the order
|
||||
var totalprice = 0;
|
||||
for each (i in order.item) {
|
||||
totalprice += i.price * i.quantity;
|
||||
}
|
||||
print("The total price of the order is: " + totalprice);
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
var e = <employees>
|
||||
<employee id="1"><name>Joe</name><age>20</age></employee>
|
||||
<employee id="2"><name>Sue</name><age>30</age></employee>
|
||||
</employees>;
|
||||
|
||||
// get all the names in e
|
||||
print("All the employee names are:\n" + e..name);
|
||||
|
||||
// employees with name Joe
|
||||
print("The employee named Joe is:\n" + e.employee.(name == "Joe"));
|
||||
|
||||
// employees with id's 1 & 2
|
||||
print("Employees with ids 1 & 2:\n" + e.employee.(@id == 1 || @id == 2));
|
||||
|
||||
// name of employee with id 1
|
||||
print("Name of the the employee with ID=1: " + e.employee.(@id == 1).name);
|
||||
|
||||
print("----------------------------------------");
|
||||
|
||||
openConsole();
|
||||
|
||||
|
||||
|
||||
|
||||
1
app/src/main/assets/sample/Shell命令/冻结网易云音乐.js
Normal file
1
app/src/main/assets/sample/Shell命令/冻结网易云音乐.js
Normal file
@@ -0,0 +1 @@
|
||||
shell("pm disable com.netease.cloudmusic", true);
|
||||
1
app/src/main/assets/sample/Shell命令/微信扫一扫(Root).js
Normal file
1
app/src/main/assets/sample/Shell命令/微信扫一扫(Root).js
Normal file
@@ -0,0 +1 @@
|
||||
shell("am start -n com.tencent.mm/com.tencent.mm.plugin.scanner.ui.BaseScanUI", true);
|
||||
1
app/src/main/assets/sample/Shell命令/支付宝扫一扫(Root).js
Normal file
1
app/src/main/assets/sample/Shell命令/支付宝扫一扫(Root).js
Normal file
@@ -0,0 +1 @@
|
||||
shell("am start -n com.eg.android.AlipayGphone/com.alipay.mobile.scan.as.main.MainCaptureActivity", true);
|
||||
1
app/src/main/assets/sample/Shell命令/结束所有后台进程.js
Normal file
1
app/src/main/assets/sample/Shell命令/结束所有后台进程.js
Normal file
@@ -0,0 +1 @@
|
||||
shell("am kill-all", true);
|
||||
2
app/src/main/assets/sample/Shell命令/解冻并打开网易云音乐.js
Normal file
2
app/src/main/assets/sample/Shell命令/解冻并打开网易云音乐.js
Normal file
@@ -0,0 +1,2 @@
|
||||
shell("pm enable com.netease.cloudmusic", true);
|
||||
launchApp("网易云音乐");
|
||||
2
app/src/main/assets/sample/Shell命令/锁屏.js
Normal file
2
app/src/main/assets/sample/Shell命令/锁屏.js
Normal file
@@ -0,0 +1,2 @@
|
||||
KeyCode("KEYCODE_POWER");
|
||||
//或者 KeyCode(26);
|
||||
@@ -1,10 +1,10 @@
|
||||
"ui";
|
||||
|
||||
importClass("android.widget.EditText");
|
||||
importClass("android.widget.Button");
|
||||
importClass("android.widget.LinearLayout");
|
||||
importClass("android.content.Intent");
|
||||
importClass("android.net.Uri");
|
||||
importClass(android.widget.EditText);
|
||||
importClass(android.widget.Button);
|
||||
importClass(android.widget.LinearLayout);
|
||||
importClass(android.content.Intent);
|
||||
importClass(android.net.Uri);
|
||||
|
||||
var qq = new EditText(activity);
|
||||
qq.setHint("请输入QQ号");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"ui";
|
||||
|
||||
importClass("com.afollestad.materialdialogs.MaterialDialog");
|
||||
importClass(com.afollestad.materialdialogs.MaterialDialog);
|
||||
|
||||
new MaterialDialog.Builder(activity)
|
||||
.title("简单计算器")
|
||||
|
||||
@@ -4,7 +4,7 @@ toast("出现红包时将会自动拆开并关闭");
|
||||
while(!isStopped()){
|
||||
if(click("点击拆开")){
|
||||
//拆开红包后尝试10次关闭红包页面
|
||||
for(var i = 0; i < 10; i++){
|
||||
for(let i = 0; i < 10; i++){
|
||||
sleep(300);
|
||||
if(click("关闭"))
|
||||
break;
|
||||
|
||||
16
app/src/main/assets/sample/自动操作/屏蔽QQ通知.js
Normal file
16
app/src/main/assets/sample/自动操作/屏蔽QQ通知.js
Normal file
@@ -0,0 +1,16 @@
|
||||
importClass(android.content.Intent);
|
||||
importClass(android.net.Uri);
|
||||
importClass(android.provider.Settings);
|
||||
|
||||
function 打开App设置(packageName){
|
||||
var intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
var uri = Uri.fromParts("package", packageName, null);
|
||||
intent.setData(uri);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
打开App设置("com.tencent.mobileqq");
|
||||
while(!currentPackage().equals("com.android.settings"));
|
||||
while(!click("通知"));
|
||||
while(!click("全部阻止"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
function openRunningServices(){
|
||||
function 打开正在运行的服务(){
|
||||
launch("com.android.settings");
|
||||
var i = 0;
|
||||
while(!click("开发者选项")){
|
||||
@@ -14,10 +14,10 @@ function openRunningServices(){
|
||||
}
|
||||
|
||||
|
||||
importClass("android.os.Build");
|
||||
importClass(android.os.Build);
|
||||
|
||||
if(Build.VERSION.SDK_INT < 23){
|
||||
toast("本代码只适用于Android6.0以上");
|
||||
}else{
|
||||
openRunningServices();
|
||||
打开正在运行的服务();
|
||||
}
|
||||
26
app/src/main/assets/sample/调用Java API/liveConnect.js
Normal file
26
app/src/main/assets/sample/调用Java API/liveConnect.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* liveConnect.js: a simple demonstration of JavaScript-to-Java connectivity
|
||||
*/
|
||||
|
||||
// Create a new StringBuffer. Note that the class name must be fully qualified
|
||||
// by its package. Packages other than "java" must start with "Packages", i.e.,
|
||||
// "Packages.javax.servlet...".
|
||||
var sb = new java.lang.StringBuffer();
|
||||
|
||||
// Now add some stuff to the buffer.
|
||||
sb.append("hi, mom");
|
||||
sb.append(3); // this will add "3.0" to the buffer since all JS numbers
|
||||
// are doubles by default
|
||||
sb.append(true);
|
||||
|
||||
// Now print it out. (The toString() method of sb is automatically called
|
||||
// to convert the buffer to a string.)
|
||||
// Should print "hi, mom3.0true".
|
||||
print(sb);
|
||||
openConsole();
|
||||
22
app/src/main/assets/sample/选择器/QQ互赞脚本.js
Normal file
22
app/src/main/assets/sample/选择器/QQ互赞脚本.js
Normal file
@@ -0,0 +1,22 @@
|
||||
function 下滑(){
|
||||
className("AbsListView").scrollable().scrollForward();
|
||||
}
|
||||
|
||||
function 赞(){
|
||||
className("ImageView").desc("赞").click();
|
||||
}
|
||||
|
||||
function 显示更多(){
|
||||
for(let i = 0; i < 2;i++){
|
||||
click("显示更多");
|
||||
}
|
||||
}
|
||||
|
||||
toast("请打开点赞自己的人的界面");
|
||||
while(notStopped()){
|
||||
for(let i = 0; i < 10; i++){
|
||||
赞();
|
||||
}
|
||||
显示更多();
|
||||
下滑();
|
||||
}
|
||||
6
app/src/main/assets/sample/选择器/微信一键已读.js
Normal file
6
app/src/main/assets/sample/选择器/微信一键已读.js
Normal file
@@ -0,0 +1,6 @@
|
||||
while(true){
|
||||
if(id("i4").untilFindOne().parent().parent().click()){
|
||||
sleep(700);
|
||||
id("gf").click();
|
||||
}
|
||||
}
|
||||
3
app/src/main/assets/sample/选择器/网易云音乐签到.js
Normal file
3
app/src/main/assets/sample/选择器/网易云音乐签到.js
Normal file
@@ -0,0 +1,3 @@
|
||||
launchApp("网易云音乐");
|
||||
id("kp").click();
|
||||
text("签到").className("TextView").click();
|
||||
Reference in New Issue
Block a user