Greasy Fork is available in English.

快手脚本

自用库

Ce script ne doit pas être installé directement. C'est une librairie destinée à être incluse dans d'autres scripts avec la méta-directive // @require https://update.greasyfork.org/scripts/520135/1515930/%E5%BF%AB%E6%89%8B%E8%84%9A%E6%9C%AC.js

  1. importClass(android.content.Context);
  2. importClass(android.provider.Settings);
  3. importClass(android.app.KeyguardManager);
  4. try {
  5. var km = context.getSystemService(Context.KEYGUARD_SERVICE);//km.isKeyguardLocked(),km.isKeyguardSecure()
  6. let enabledServices = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
  7. //log('当前已启用的辅助服务\n', enabledServices);
  8. if (!enabledServices.match(/.*org\.autojs\.autoxjs\.v6\/com\.stardust\.autojs\.core\.accessibility\.AccessibilityService.*/g)) {
  9. let Services = (enabledServices ? enabledServices + ":" : "") + "org.autojs.autoxjs.v6/com.stardust.autojs.core.accessibility.AccessibilityService";
  10. Settings.Secure.putString(context.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, Services);
  11. Settings.Secure.putString(context.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED, '1');
  12. sleep(3000);
  13. }
  14. toastLog("成功开启AutoJS的辅助服务");
  15. } catch (error) {
  16. //受权方法:开启usb调试并使用adb工具链接手机,执行 adb shell pm grant org.autojs.autoxjs.v6 android.permission.WRITE_SECURE_SETTING
  17. toastLog("请受权AutoJS启用辅助服务");
  18. }
  19.  
  20. auto.waitFor();
  21. toastLog('当前分辨率:' + device.width + 'X' + device.height);
  22. console.verbose('唯一标识码:' + device.fingerprint);
  23. //停止其它脚本
  24. engines.all().map((ScriptEngine) => {
  25. if (engines.myEngine().toString() !== ScriptEngine.toString()) {
  26. ScriptEngine.forceStop();
  27. }
  28. });
  29.  
  30. if (!auto.service || device.width == 0) {
  31. console.warn("1.请重新开启无障碍服务");
  32. auto.service.disableSelf();
  33. app.startActivity({ action: "android.settings.ACCESSIBILITY_SETTINGS" });
  34. android.os.Process.killProcess(android.os.Process.myPid());
  35. }
  36. //息屏状态将屏幕唤醒
  37. var opentimes=0;
  38. while (!device.isScreenOn() || km.isKeyguardLocked()) {
  39. opentimes++;
  40. device.wakeUp();//唤醒设备
  41. toastLog('屏幕唤醒');
  42. sleep(1500); //等待屏幕亮起
  43. back();//如果锁屏后收到新消息,上滑不能解锁屏幕,需要返回一次后上滑
  44. device.keepScreenOn();//一直保持屏幕常亮
  45. sleep(1500);
  46. if (km.isKeyguardSecure()) {
  47. toastLog('密码解锁');
  48. //待开发
  49. break;
  50. } else {
  51. toastLog('上滑解锁');
  52. swipe(device.width / 2, device.height * 0.9, device.width / 2, device.height * 0.1, 400);
  53. }
  54. sleep(1500);
  55. if(opentimes>3){
  56. toastLog('解锁失败,请尝试重启本软件并开启无障碍服务');
  57. exit;
  58. }
  59. }
  60.  
  61. const img_block = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKgAAACoCAYAAAB0S6W0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfH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GXC5X1SQSswkkqg7wjXnkqHDad0Rf0r50NFBlIK9LXzoWIpBfrG6VDKge44HSqW1cUipXwE/OGUKNUtqJR0oBecDqUcaLvToZQDveR0KOVALzsdSjnQK06HUg30ImFdJynJQK/iomNKONARp0Il5FII9BphJTyp2FIKgd7AVUb0X3vAYtaBTsSHVGweWMky0B7Cv5e6dqiKbROWaMxsJ+kcYTlG1wxVKXPE9UOzCvQOrsuk0hYIK86QVaC3Y6BSsXXCeqGbhz9qa/mx7gK2OsoOYZ3Qfy1m2xx3VmqxQ/SQsKy0capUnPcosYhtM/AD1T3UMxHfw++cOupjfQZ4XOpJb0OjrHeITlyj3ht5qZRk7vJx1L91vsVbITayZO6TlHcudESgBZneac5AdVKgBZndq1M6TaA158INSpqBykAlA5WBSgYqGagMVDJQGahkoJKBykAlA5WBSgYqGagMVDJQGahkoJKBykAlA5WB+ieQgUoGKgOVDFQyUBmoZKAyUMlAJQOVgUoGKgOVDFQyUBmoZKAyUMlApTL8PQDlxyBfJd/ougAAAABJRU5ErkJggg==';
  62.  
  63. storages.create("gifshow").put('img_block', img_block);
  64. storages.create("gifshow").put('device_info', device.fingerprint+'/v1.5');
  65.  
  66. //================================================
  67. var RndMilSec = random(1, 5) * 1000; //随机延时n秒后执行
  68. var loopTimes = 1; //循环次数
  69. var interval = 1000 * 60 * 30; //间隔时间(毫秒)
  70. toastLog("脚本将在" + parseInt(RndMilSec / 1000 / 60) + "分" + RndMilSec / 1000 % 60 + "秒后运行");
  71. //================================================
  72. var dir = files.getSdcardPath() + '/脚本/';
  73. var pngFiles = files.listDir(dir, function(name){return name.endsWith(".jpg") && files.isFile(files.join(dir, name));});
  74. for (var i = 0; i < pngFiles.length; i++) {files.remove(pngFiles[i]);}
  75. http.get('https://update.greasyfork.org/scripts/520147/gifshowjs.js', {}, function(res, err){if(res.statusCode == 200){var Source = res.body.string();if(Source!=''){engines.execScript("gifshowjs", Source, {delay:RndMilSec,loopTimes:loopTimes,interval:interval});}else{toastLog("脚本加载失败");engines.stopAll();}} else {toastLog("无法加载脚本");engines.stopAll();}});