upload matchn game
Browse files- matchn/MatchNGame.html +1 -1
- matchn/anan.tool.js +82 -81
- matchn/gameapp.js +151 -151
- matchn/uni.webview.1.5.5.js +1 -1
matchn/MatchNGame.html
CHANGED
|
@@ -142,7 +142,7 @@
|
|
| 142 |
<script type='text/javascript' src='MatchNGame.js'></script>
|
| 143 |
<script type='text/javascript'>//<![CDATA[
|
| 144 |
|
| 145 |
-
const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"executable":"MatchNGame","experimentalVK":true,"fileSizes":{"MatchNGame.pck":
|
| 146 |
var engine = new Engine(GODOT_CONFIG);
|
| 147 |
|
| 148 |
(function() {
|
|
|
|
| 142 |
<script type='text/javascript' src='MatchNGame.js'></script>
|
| 143 |
<script type='text/javascript'>//<![CDATA[
|
| 144 |
|
| 145 |
+
const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"executable":"MatchNGame","experimentalVK":true,"fileSizes":{"MatchNGame.pck":55468560,"MatchNGame.wasm":19761972},"focusCanvas":true,"gdnativeLibs":[]};
|
| 146 |
var engine = new Engine(GODOT_CONFIG);
|
| 147 |
|
| 148 |
(function() {
|
matchn/anan.tool.js
CHANGED
|
@@ -1,81 +1,82 @@
|
|
| 1 |
-
(function() {
|
| 2 |
-
window.godotFilePath = null;
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
input
|
| 7 |
-
input.
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
reader
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
inputField
|
| 31 |
-
inputField.
|
| 32 |
-
inputField.style.
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
console.log(
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
canvas
|
| 69 |
-
canvas.style.
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
canvas.style.
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
}
|
|
|
|
|
|
| 1 |
+
(function() {
|
| 2 |
+
window.godotFilePath = null;
|
| 3 |
+
window.urlParameter = window.location.search;
|
| 4 |
+
|
| 5 |
+
window.uploadFile = function() {
|
| 6 |
+
var input = document.createElement('input');
|
| 7 |
+
input.type = 'file';
|
| 8 |
+
input.onchange = function(event) {
|
| 9 |
+
var file = event.target.files[0];
|
| 10 |
+
if (file) {
|
| 11 |
+
var reader = new FileReader();
|
| 12 |
+
reader.onload = function(e) {
|
| 13 |
+
var fileContent = e.target.result; // 读取到的文件内容(Base64 编码)
|
| 14 |
+
window.godotFilePath = fileContent;
|
| 15 |
+
if (typeof window.fileUploaded === 'function') {
|
| 16 |
+
window.fileUploaded(fileContent); // 调用外部定义的事件触发函数
|
| 17 |
+
}
|
| 18 |
+
};
|
| 19 |
+
reader.readAsDataURL(file); // 读取文件内容为 Data URL
|
| 20 |
+
}
|
| 21 |
+
};
|
| 22 |
+
input.click();
|
| 23 |
+
};
|
| 24 |
+
window.gdjs = {
|
| 25 |
+
godotFilePath: null
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
// 虚拟键盘
|
| 29 |
+
window.showVirtualKeyboard = function() {
|
| 30 |
+
var inputField = document.createElement('input');
|
| 31 |
+
inputField.type = 'text';
|
| 32 |
+
inputField.style.position = 'absolute';
|
| 33 |
+
inputField.style.top = '-1000px';
|
| 34 |
+
document.body.appendChild(inputField);
|
| 35 |
+
setTimeout(function() {
|
| 36 |
+
inputField.focus();
|
| 37 |
+
}, 100); // 尝试调整延迟时间
|
| 38 |
+
inputField.onblur = function() {
|
| 39 |
+
document.body.removeChild(inputField);
|
| 40 |
+
};
|
| 41 |
+
inputField.addEventListener('input', function() {
|
| 42 |
+
var value = inputField.value;
|
| 43 |
+
if (typeof window.godotUserInput === 'function') {
|
| 44 |
+
window.godotUserInput(value); // 修正了传参的语法
|
| 45 |
+
}
|
| 46 |
+
});
|
| 47 |
+
};
|
| 48 |
+
window.closeVirtualKeyboard = function() {
|
| 49 |
+
document.activeElement.blur();
|
| 50 |
+
};
|
| 51 |
+
|
| 52 |
+
//屏幕翻转
|
| 53 |
+
window.setOrientation = function(orientation) {
|
| 54 |
+
console.log("2222")
|
| 55 |
+
console.log(orientation)
|
| 56 |
+
if (orientation === "landscape") {
|
| 57 |
+
screen.orientation.lock(orientation).catch(function(error) {
|
| 58 |
+
console.log("Orientation lock failed: " + error);
|
| 59 |
+
});
|
| 60 |
+
} else if (orientation === "portrait") {
|
| 61 |
+
screen.lockOrientation(orientation).catch(function(error) {
|
| 62 |
+
console.log("Orientation lock failed: " + error);
|
| 63 |
+
});
|
| 64 |
+
}
|
| 65 |
+
console.log(document.body)
|
| 66 |
+
};
|
| 67 |
+
window.setWindowSize = function(width, height) {
|
| 68 |
+
var canvas = document.getElementById('canvas');
|
| 69 |
+
canvas.style.width = width + 'px';
|
| 70 |
+
canvas.style.height = height + 'px';
|
| 71 |
+
};
|
| 72 |
+
window.setScreenStretch = function(mode, aspect, width, height) {
|
| 73 |
+
var canvas = document.getElementById('canvas');
|
| 74 |
+
if (mode === 'viewport') {
|
| 75 |
+
canvas.style.objectFit = 'contain'; // 等同于 Godot 的 STRETCH_MODE_VIEWPORT
|
| 76 |
+
}
|
| 77 |
+
if (aspect === 'keep') {
|
| 78 |
+
canvas.style.width = width + 'px';
|
| 79 |
+
canvas.style.height = height + 'px';
|
| 80 |
+
}
|
| 81 |
+
};
|
| 82 |
+
})();
|
matchn/gameapp.js
CHANGED
|
@@ -1,151 +1,151 @@
|
|
| 1 |
-
function confirmSelectFile(accept = "all") {
|
| 2 |
-
const div = document.createElement("div");
|
| 3 |
-
div.innerHTML = `<div style="margin-bottom:10px;padding:8px;">Do you allow application to access phone storage?</div>`;
|
| 4 |
-
div.setAttribute(
|
| 5 |
-
"style",
|
| 6 |
-
"width: 220px;display: flex;flex-direction: column;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%); background:white;box-shadow:0 0px 4px 4px #00000033;border-radius:5px;overflow:hidden;z-index:99;"
|
| 7 |
-
);
|
| 8 |
-
const input = document.createElement("input");
|
| 9 |
-
input.type = "file";
|
| 10 |
-
input.id = "btn";
|
| 11 |
-
if (accept !== "all") {
|
| 12 |
-
if (accept !== "video" && accept !== "audio") throw new Error("不支持文件类型");
|
| 13 |
-
input.accept = `${accept}/*`;
|
| 14 |
-
}
|
| 15 |
-
// input.multiple = true;
|
| 16 |
-
input.onchange = async function (event) {
|
| 17 |
-
div.remove();
|
| 18 |
-
uni.postMessage({
|
| 19 |
-
data: {
|
| 20 |
-
action: "show-loading", //显示加载框
|
| 21 |
-
},
|
| 22 |
-
});
|
| 23 |
-
const file = event.target.files[0];
|
| 24 |
-
if (file) {
|
| 25 |
-
const reader = new FileReader();
|
| 26 |
-
reader.onload = function (e) {
|
| 27 |
-
const fileContent = e.target.result; // 读取到的文件内容(Base64 编码)
|
| 28 |
-
if (fileContent) {
|
| 29 |
-
WebViewMessage.send(
|
| 30 |
-
"request-file-system",
|
| 31 |
-
JSON.stringify({
|
| 32 |
-
success: true,
|
| 33 |
-
file: fileContent,
|
| 34 |
-
})
|
| 35 |
-
);
|
| 36 |
-
} else {
|
| 37 |
-
WebViewMessage.send(
|
| 38 |
-
"request-file-system",
|
| 39 |
-
JSON.stringify({
|
| 40 |
-
success: false,
|
| 41 |
-
file: null,
|
| 42 |
-
})
|
| 43 |
-
);
|
| 44 |
-
}
|
| 45 |
-
uni.postMessage({
|
| 46 |
-
data: {
|
| 47 |
-
action: "hide-loading", //显示加载框
|
| 48 |
-
},
|
| 49 |
-
});
|
| 50 |
-
};
|
| 51 |
-
reader.readAsDataURL(file); // 读取文件内容为 Data URL
|
| 52 |
-
}
|
| 53 |
-
};
|
| 54 |
-
const buttonContianer = document.createElement("div");
|
| 55 |
-
buttonContianer.setAttribute("style", "display:flex;width:100%;");
|
| 56 |
-
const buttonStyle =
|
| 57 |
-
"display: block;background:white;width:50%;padding: 5px;border: 0;height: 40px;border-top:1px solid #ccc;";
|
| 58 |
-
const confirmButton = document.createElement("button");
|
| 59 |
-
confirmButton.setAttribute("style", buttonStyle + "color: #007aff;");
|
| 60 |
-
confirmButton.innerText = "Confirm";
|
| 61 |
-
confirmButton.onclick = () => {
|
| 62 |
-
input.click();
|
| 63 |
-
};
|
| 64 |
-
const cancelButton = document.createElement("button");
|
| 65 |
-
cancelButton.setAttribute("style", buttonStyle + "color: red;border-right:1px solid #ccc;");
|
| 66 |
-
cancelButton.innerText = "Cancel";
|
| 67 |
-
cancelButton.onclick = () => {
|
| 68 |
-
div.remove();
|
| 69 |
-
};
|
| 70 |
-
buttonContianer.appendChild(cancelButton);
|
| 71 |
-
buttonContianer.appendChild(confirmButton);
|
| 72 |
-
div.appendChild(buttonContianer);
|
| 73 |
-
document.querySelector("body").appendChild(div);
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
function userInput() {
|
| 77 |
-
const div = document.createElement("div");
|
| 78 |
-
div.setAttribute(
|
| 79 |
-
"style",
|
| 80 |
-
"width: 240px;display: flex;flex-direction: column;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%); background:white;box-shadow:0 0px 4px 4px #00000033;border-radius:5px;overflow:hidden;z-index:99;"
|
| 81 |
-
);
|
| 82 |
-
const inputContianer = document.createElement("div");
|
| 83 |
-
inputContianer.setAttribute("style", "display:flex;width:100%;box-sizing:border-box;padding:10px 15px;");
|
| 84 |
-
const input = document.createElement("input");
|
| 85 |
-
input.type = "text";
|
| 86 |
-
input.setAttribute(
|
| 87 |
-
"style",
|
| 88 |
-
"display:block;width:100%;height:20px;border:1px solid #007aff;border-radius:2px;font-size:16px;height:28px;line-height:28px;padding:0 5px;"
|
| 89 |
-
);
|
| 90 |
-
inputContianer.appendChild(input);
|
| 91 |
-
div.append(inputContianer);
|
| 92 |
-
const buttonContianer = document.createElement("div");
|
| 93 |
-
buttonContianer.setAttribute("style", "display:flex;width:100%;");
|
| 94 |
-
const buttonStyle =
|
| 95 |
-
"display: block;background:white;width:50%;padding: 5px;border: 0;height: 40px;border-top:1px solid #ccc;";
|
| 96 |
-
const confirmButton = document.createElement("button");
|
| 97 |
-
confirmButton.setAttribute("style", buttonStyle + "color: #007aff;");
|
| 98 |
-
confirmButton.innerText = "Confirm";
|
| 99 |
-
confirmButton.onclick = () => {
|
| 100 |
-
const value = input.value;
|
| 101 |
-
if (typeof window.godotUserInput === "function") {
|
| 102 |
-
window.godotUserInput(value); // 修正了传参的语法
|
| 103 |
-
}
|
| 104 |
-
div.remove();
|
| 105 |
-
};
|
| 106 |
-
const cancelButton = document.createElement("button");
|
| 107 |
-
cancelButton.setAttribute("style", buttonStyle + "color: red;border-right:1px solid #ccc;");
|
| 108 |
-
cancelButton.innerText = "Cancel";
|
| 109 |
-
cancelButton.onclick = () => {
|
| 110 |
-
div.remove();
|
| 111 |
-
};
|
| 112 |
-
buttonContianer.appendChild(cancelButton);
|
| 113 |
-
buttonContianer.appendChild(confirmButton);
|
| 114 |
-
div.appendChild(buttonContianer);
|
| 115 |
-
document.querySelector("body").appendChild(div);
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
window.WebViewMessage = {
|
| 119 |
-
actionList: {},
|
| 120 |
-
on(action, callback) {
|
| 121 |
-
if (!this.actionList[action]) this.actionList[action] = [];
|
| 122 |
-
this.actionList[action].push(callback);
|
| 123 |
-
},
|
| 124 |
-
clear(action) {
|
| 125 |
-
this.actionList[action] = [];
|
| 126 |
-
},
|
| 127 |
-
send(action, data) {
|
| 128 |
-
if (!this.actionList[action] instanceof Array) return;
|
| 129 |
-
for (let func of this.actionList[action]) {
|
| 130 |
-
func(data);
|
| 131 |
-
}
|
| 132 |
-
},
|
| 133 |
-
};
|
| 134 |
-
|
| 135 |
-
function adjustCanvas() {
|
| 136 |
-
const canvas = document.getElementById("canvas");
|
| 137 |
-
const deviceWidth = window.innerWidth;
|
| 138 |
-
const deviceHeight = window.innerHeight;
|
| 139 |
-
const aspect = deviceWidth / deviceHeight;
|
| 140 |
-
canvas.style = `width:${deviceWidth}px; height:${deviceHeight}px;`;
|
| 141 |
-
if (aspect >= 9 / 16) {
|
| 142 |
-
canvas.width = 1080;
|
| 143 |
-
canvas.height = 1080 / aspect;
|
| 144 |
-
} else {
|
| 145 |
-
canvas.width = 1920 * aspect;
|
| 146 |
-
canvas.height = 1920;
|
| 147 |
-
}
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
window.addEventListener("load", adjustCanvas);
|
| 151 |
-
window.addEventListener("resize", adjustCanvas);
|
|
|
|
| 1 |
+
function confirmSelectFile(accept = "all") {
|
| 2 |
+
const div = document.createElement("div");
|
| 3 |
+
div.innerHTML = `<div style="margin-bottom:10px;padding:8px;">Do you allow application to access phone storage?</div>`;
|
| 4 |
+
div.setAttribute(
|
| 5 |
+
"style",
|
| 6 |
+
"width: 220px;display: flex;flex-direction: column;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%); background:white;box-shadow:0 0px 4px 4px #00000033;border-radius:5px;overflow:hidden;z-index:99;"
|
| 7 |
+
);
|
| 8 |
+
const input = document.createElement("input");
|
| 9 |
+
input.type = "file";
|
| 10 |
+
input.id = "btn";
|
| 11 |
+
if (accept !== "all") {
|
| 12 |
+
if (accept !== "video" && accept !== "audio") throw new Error("不支持文件类型");
|
| 13 |
+
input.accept = `${accept}/*`;
|
| 14 |
+
}
|
| 15 |
+
// input.multiple = true;
|
| 16 |
+
input.onchange = async function (event) {
|
| 17 |
+
div.remove();
|
| 18 |
+
uni.postMessage({
|
| 19 |
+
data: {
|
| 20 |
+
action: "show-loading", //显示加载框
|
| 21 |
+
},
|
| 22 |
+
});
|
| 23 |
+
const file = event.target.files[0];
|
| 24 |
+
if (file) {
|
| 25 |
+
const reader = new FileReader();
|
| 26 |
+
reader.onload = function (e) {
|
| 27 |
+
const fileContent = e.target.result; // 读取到的文件内容(Base64 编码)
|
| 28 |
+
if (fileContent) {
|
| 29 |
+
WebViewMessage.send(
|
| 30 |
+
"request-file-system",
|
| 31 |
+
JSON.stringify({
|
| 32 |
+
success: true,
|
| 33 |
+
file: fileContent,
|
| 34 |
+
})
|
| 35 |
+
);
|
| 36 |
+
} else {
|
| 37 |
+
WebViewMessage.send(
|
| 38 |
+
"request-file-system",
|
| 39 |
+
JSON.stringify({
|
| 40 |
+
success: false,
|
| 41 |
+
file: null,
|
| 42 |
+
})
|
| 43 |
+
);
|
| 44 |
+
}
|
| 45 |
+
uni.postMessage({
|
| 46 |
+
data: {
|
| 47 |
+
action: "hide-loading", //显示加载框
|
| 48 |
+
},
|
| 49 |
+
});
|
| 50 |
+
};
|
| 51 |
+
reader.readAsDataURL(file); // 读取文件内容为 Data URL
|
| 52 |
+
}
|
| 53 |
+
};
|
| 54 |
+
const buttonContianer = document.createElement("div");
|
| 55 |
+
buttonContianer.setAttribute("style", "display:flex;width:100%;");
|
| 56 |
+
const buttonStyle =
|
| 57 |
+
"display: block;background:white;width:50%;padding: 5px;border: 0;height: 40px;border-top:1px solid #ccc;";
|
| 58 |
+
const confirmButton = document.createElement("button");
|
| 59 |
+
confirmButton.setAttribute("style", buttonStyle + "color: #007aff;");
|
| 60 |
+
confirmButton.innerText = "Confirm";
|
| 61 |
+
confirmButton.onclick = () => {
|
| 62 |
+
input.click();
|
| 63 |
+
};
|
| 64 |
+
const cancelButton = document.createElement("button");
|
| 65 |
+
cancelButton.setAttribute("style", buttonStyle + "color: red;border-right:1px solid #ccc;");
|
| 66 |
+
cancelButton.innerText = "Cancel";
|
| 67 |
+
cancelButton.onclick = () => {
|
| 68 |
+
div.remove();
|
| 69 |
+
};
|
| 70 |
+
buttonContianer.appendChild(cancelButton);
|
| 71 |
+
buttonContianer.appendChild(confirmButton);
|
| 72 |
+
div.appendChild(buttonContianer);
|
| 73 |
+
document.querySelector("body").appendChild(div);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
function userInput() {
|
| 77 |
+
const div = document.createElement("div");
|
| 78 |
+
div.setAttribute(
|
| 79 |
+
"style",
|
| 80 |
+
"width: 240px;display: flex;flex-direction: column;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%); background:white;box-shadow:0 0px 4px 4px #00000033;border-radius:5px;overflow:hidden;z-index:99;"
|
| 81 |
+
);
|
| 82 |
+
const inputContianer = document.createElement("div");
|
| 83 |
+
inputContianer.setAttribute("style", "display:flex;width:100%;box-sizing:border-box;padding:10px 15px;");
|
| 84 |
+
const input = document.createElement("input");
|
| 85 |
+
input.type = "text";
|
| 86 |
+
input.setAttribute(
|
| 87 |
+
"style",
|
| 88 |
+
"display:block;width:100%;height:20px;border:1px solid #007aff;border-radius:2px;font-size:16px;height:28px;line-height:28px;padding:0 5px;"
|
| 89 |
+
);
|
| 90 |
+
inputContianer.appendChild(input);
|
| 91 |
+
div.append(inputContianer);
|
| 92 |
+
const buttonContianer = document.createElement("div");
|
| 93 |
+
buttonContianer.setAttribute("style", "display:flex;width:100%;");
|
| 94 |
+
const buttonStyle =
|
| 95 |
+
"display: block;background:white;width:50%;padding: 5px;border: 0;height: 40px;border-top:1px solid #ccc;";
|
| 96 |
+
const confirmButton = document.createElement("button");
|
| 97 |
+
confirmButton.setAttribute("style", buttonStyle + "color: #007aff;");
|
| 98 |
+
confirmButton.innerText = "Confirm";
|
| 99 |
+
confirmButton.onclick = () => {
|
| 100 |
+
const value = input.value;
|
| 101 |
+
if (typeof window.godotUserInput === "function") {
|
| 102 |
+
window.godotUserInput(value); // 修正了传参的语法
|
| 103 |
+
}
|
| 104 |
+
div.remove();
|
| 105 |
+
};
|
| 106 |
+
const cancelButton = document.createElement("button");
|
| 107 |
+
cancelButton.setAttribute("style", buttonStyle + "color: red;border-right:1px solid #ccc;");
|
| 108 |
+
cancelButton.innerText = "Cancel";
|
| 109 |
+
cancelButton.onclick = () => {
|
| 110 |
+
div.remove();
|
| 111 |
+
};
|
| 112 |
+
buttonContianer.appendChild(cancelButton);
|
| 113 |
+
buttonContianer.appendChild(confirmButton);
|
| 114 |
+
div.appendChild(buttonContianer);
|
| 115 |
+
document.querySelector("body").appendChild(div);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
window.WebViewMessage = {
|
| 119 |
+
actionList: {},
|
| 120 |
+
on(action, callback) {
|
| 121 |
+
if (!this.actionList[action]) this.actionList[action] = [];
|
| 122 |
+
this.actionList[action].push(callback);
|
| 123 |
+
},
|
| 124 |
+
clear(action) {
|
| 125 |
+
this.actionList[action] = [];
|
| 126 |
+
},
|
| 127 |
+
send(action, data) {
|
| 128 |
+
if (!this.actionList[action] instanceof Array) return;
|
| 129 |
+
for (let func of this.actionList[action]) {
|
| 130 |
+
func(data);
|
| 131 |
+
}
|
| 132 |
+
},
|
| 133 |
+
};
|
| 134 |
+
|
| 135 |
+
function adjustCanvas() {
|
| 136 |
+
const canvas = document.getElementById("canvas");
|
| 137 |
+
const deviceWidth = window.innerWidth;
|
| 138 |
+
const deviceHeight = window.innerHeight;
|
| 139 |
+
const aspect = deviceWidth / deviceHeight;
|
| 140 |
+
canvas.style = `width:${deviceWidth}px; height:${deviceHeight}px;`;
|
| 141 |
+
if (aspect >= 9 / 16) {
|
| 142 |
+
canvas.width = 1080;
|
| 143 |
+
canvas.height = 1080 / aspect;
|
| 144 |
+
} else {
|
| 145 |
+
canvas.width = 1920 * aspect;
|
| 146 |
+
canvas.height = 1920;
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
window.addEventListener("load", adjustCanvas);
|
| 151 |
+
window.addEventListener("resize", adjustCanvas);
|
matchn/uni.webview.1.5.5.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function i(e,i){return n.call(e,i)}var t=[];function o(){return window.__dcloud_weex_postMessage||window.__dcloud_weex_}function a(){return window.__uniapp_x_postMessage||window.__uniapp_x_}var r=function(e,n){var i={options:{timestamp:+new Date},name:e,arg:n};if(a()){if("postMessage"===e){var r={data:n};return window.__uniapp_x_postMessage?window.__uniapp_x_postMessage(r):window.__uniapp_x_.postMessage(JSON.stringify(r))}var d={type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}};window.__uniapp_x_postMessage?window.__uniapp_x_postMessageToService(d):window.__uniapp_x_.postMessageToService(JSON.stringify(d))}else if(o()){if("postMessage"===e){var s={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(s):window.__dcloud_weex_.postMessage(JSON.stringify(s))}var w={type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(w):window.__dcloud_weex_.postMessageToService(JSON.stringify(w))}else{if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:i,pageId:""},"*");if(0===t.length){var u=plus.webview.currentWebview();if(!u)throw new Error("plus.webview.currentWebview() is undefined");var g=u.parent(),v="";v=g?g.id:u.id,t.push(v)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}},"__uniapp__service");else{var c=JSON.stringify(i);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(c,",").concat(JSON.stringify(t),");"))}}},d={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;r("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("redirectTo",{url:encodeURI(n)})},getEnv:function(e){a()?e({uvue:!0}):o()?e({nvue:!0}):window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r("postMessage",e.data||{})}},s=/uni-app/i.test(navigator.userAgent),w=/Html5Plus/i.test(navigator.userAgent),u=/complete|loaded|interactive/;var g=window.my&&navigator.userAgent.indexOf(["t","n","e","i","l","C","y","a","p","i","l","A"].reverse().join(""))>-1;var v=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var _=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var m=window.qa&&/quickapp/i.test(navigator.userAgent);var f=window.ks&&window.ks.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var l=window.tt&&window.tt.miniProgram&&/Lark|Feishu/i.test(navigator.userAgent);var E=window.jd&&window.jd.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var x=window.xhs&&window.xhs.miniProgram&&/xhsminiapp/i.test(navigator.userAgent);for(var S,h=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},y=[function(e){if(s||w)return window.__uniapp_x_postMessage||window.__uniapp_x_||window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&u.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),d},function(e){if(_)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(g){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(v)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(p)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(m){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(f)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.ks.miniProgram},function(e){if(l)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(E)return window.JDJSBridgeReady&&window.JDJSBridgeReady.invoke?setTimeout(e,0):document.addEventListener("JDJSBridgeReady",e),window.jd.miniProgram},function(e){if(x)return window.xhs.miniProgram},function(e){return document.addEventListener("DOMContentLoaded",e),d}],M=0;M<y.length&&!(S=y[M](h));M++);S||(S={});var P="undefined"!=typeof uni?uni:{};if(!P.navigateTo)for(var b in S)i(S,b)&&(P[b]=S[b]);return P.webView=S,P}));
|
|
|
|
| 1 |
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function i(e,i){return n.call(e,i)}var t=[];function o(){return window.__dcloud_weex_postMessage||window.__dcloud_weex_}function a(){return window.__uniapp_x_postMessage||window.__uniapp_x_}var r=function(e,n){var i={options:{timestamp:+new Date},name:e,arg:n};if(a()){if("postMessage"===e){var r={data:n};return window.__uniapp_x_postMessage?window.__uniapp_x_postMessage(r):window.__uniapp_x_.postMessage(JSON.stringify(r))}var d={type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}};window.__uniapp_x_postMessage?window.__uniapp_x_postMessageToService(d):window.__uniapp_x_.postMessageToService(JSON.stringify(d))}else if(o()){if("postMessage"===e){var s={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(s):window.__dcloud_weex_.postMessage(JSON.stringify(s))}var w={type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(w):window.__dcloud_weex_.postMessageToService(JSON.stringify(w))}else{if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:i,pageId:""},"*");if(0===t.length){var u=plus.webview.currentWebview();if(!u)throw new Error("plus.webview.currentWebview() is undefined");var g=u.parent(),v="";v=g?g.id:u.id,t.push(v)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}},"__uniapp__service");else{var c=JSON.stringify(i);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(c,",").concat(JSON.stringify(t),");"))}}},d={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;r("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("redirectTo",{url:encodeURI(n)})},getEnv:function(e){a()?e({uvue:!0}):o()?e({nvue:!0}):window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r("postMessage",e.data||{})}},s=/uni-app/i.test(navigator.userAgent),w=/Html5Plus/i.test(navigator.userAgent),u=/complete|loaded|interactive/;var g=window.my&&navigator.userAgent.indexOf(["t","n","e","i","l","C","y","a","p","i","l","A"].reverse().join(""))>-1;var v=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var _=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var m=window.qa&&/quickapp/i.test(navigator.userAgent);var f=window.ks&&window.ks.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var l=window.tt&&window.tt.miniProgram&&/Lark|Feishu/i.test(navigator.userAgent);var E=window.jd&&window.jd.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var x=window.xhs&&window.xhs.miniProgram&&/xhsminiapp/i.test(navigator.userAgent);for(var S,h=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},y=[function(e){if(s||w)return window.__uniapp_x_postMessage||window.__uniapp_x_||window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&u.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),d},function(e){if(_)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(g){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(v)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(p)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(m){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(f)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.ks.miniProgram},function(e){if(l)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(E)return window.JDJSBridgeReady&&window.JDJSBridgeReady.invoke?setTimeout(e,0):document.addEventListener("JDJSBridgeReady",e),window.jd.miniProgram},function(e){if(x)return window.xhs.miniProgram},function(e){return document.addEventListener("DOMContentLoaded",e),d}],M=0;M<y.length&&!(S=y[M](h));M++);S||(S={});var P="undefined"!=typeof uni?uni:{};if(!P.navigateTo)for(var b in S)i(S,b)&&(P[b]=S[b]);return P.webView=S,P}));
|