🐛 Fix Chinese input method Enter
This commit is contained in:
45
src-tauri/src/inject/component.js
vendored
45
src-tauri/src/inject/component.js
vendored
@@ -96,18 +96,18 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const urlSubmit = document.getElementById('pakeUrlSubmit');
|
||||
const urlClose = document.getElementById('pakeUrlClose');
|
||||
|
||||
urlSubmit.onclick = function () {
|
||||
urlSubmit.onclick = function() {
|
||||
const url = urlInput.value;
|
||||
if (url) {
|
||||
window.location.href = url;
|
||||
}
|
||||
};
|
||||
|
||||
urlClose.onclick = function () {
|
||||
urlClose.onclick = function() {
|
||||
urlModal.style.display = 'none';
|
||||
};
|
||||
|
||||
urlInput.addEventListener('keydown', function (event) {
|
||||
urlInput.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
const url = urlInput.value;
|
||||
if (url) {
|
||||
@@ -116,13 +116,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function (event) {
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Escape' && urlModal.style.display === 'block') {
|
||||
urlModal.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
window.showUrlModal = function () {
|
||||
window.showUrlModal = function() {
|
||||
urlModal.style.display = 'block';
|
||||
urlInput.focus();
|
||||
};
|
||||
@@ -134,11 +134,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
m.style.cssText =
|
||||
'max-width:60%;min-width: 80px;padding:0 12px;height: 32px;color: rgb(255, 255, 255);line-height: 32px;text-align: center;border-radius: 8px;position: fixed; bottom:24px;right: 28px;z-index: 999999;background: rgba(0, 0, 0,.8);font-size: 13px;';
|
||||
document.body.appendChild(m);
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
const d = 0.5;
|
||||
m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
|
||||
m.style.opacity = '0';
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(m);
|
||||
}, d * 1000);
|
||||
}, 3000);
|
||||
@@ -146,35 +146,4 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
window.pakeToast = pakeToast;
|
||||
|
||||
// chatgpt supports unlimited times of GPT4-Mobile
|
||||
if (window.location.hostname === 'chat.openai.com') {
|
||||
const originFetch = fetch;
|
||||
window.fetch = (url, options) => {
|
||||
return originFetch(url, options).then(async response => {
|
||||
if (url.indexOf('/backend-api/models') === -1) {
|
||||
return response;
|
||||
}
|
||||
const responseClone = response.clone();
|
||||
let res = await responseClone.json();
|
||||
res.models = res.models.map(m => {
|
||||
m.tags = m.tags.filter(t => {
|
||||
return t !== 'mobile';
|
||||
});
|
||||
if (m.slug === 'gpt-4-mobile') {
|
||||
res.categories.push({
|
||||
browsing_model: null,
|
||||
category: 'gpt_4',
|
||||
code_interpreter_model: null,
|
||||
default_model: 'gpt-4-mobile',
|
||||
human_category_name: 'GPT-4-Mobile',
|
||||
plugins_model: null,
|
||||
subscription_level: 'plus',
|
||||
});
|
||||
}
|
||||
return m;
|
||||
});
|
||||
return new Response(JSON.stringify(res), response);
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user