| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { sys } from "cc";
- import { Config, nav_info } from "./NavInfo";
- export class Utils {
- public static copyToZone(str: string) {
- let input:any = document.createElement("input");
- let currentFocus:any = document.activeElement;
- document.body.appendChild(input);
- input.readOnly = 'readonly';
- input.value = str;
- input.focus();
- if (input.setSelectionRange)
- input.setSelectionRange(0, input.value.length);
- else
- input.select();
- let flag = true;
- try {
- document.execCommand("copy");
- }
- catch (eo) {
- flag = false;
- }
- input.blur();
- document.body.removeChild(input);
- currentFocus.focus();
- currentFocus.blur();
- return flag;
- }
- public static tryStartApp() {
- if(!sys.isMobile){
- // nav_info.scene.showTip("")
- return;
- }
- console.log("openSrc =", Config.scheme_prefix);
- window.location.href = Config.scheme_prefix;
- setTimeout(function () {
- if (!document.hidden) {
- let down_url = sys.platform == sys.Platform.IOS ? Config.download_ios_url : Config.downlaod_google_url;
- window.location.href = down_url;
- }
- }, 4000);
- }
- }
|