mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
chore: appease linter so it stops ruining my index
This commit is contained in:
parent
d38bf63f8e
commit
dfdf1dd973
142
src/initgui.js
142
src/initgui.js
@ -7,12 +7,12 @@
|
|||||||
* it under the terms of the GNU Affero General Public License as published
|
* it under the terms of the GNU Affero General Public License as published
|
||||||
* by the Free Software Foundation, either version 3 of the License, or
|
* by the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -106,10 +106,10 @@ const launch_services = async function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// This code snippet addresses the issue flagged by Lighthouse regarding the use of
|
// This code snippet addresses the issue flagged by Lighthouse regarding the use of
|
||||||
// passive event listeners to enhance scrolling performance. It provides custom
|
// passive event listeners to enhance scrolling performance. It provides custom
|
||||||
// implementations for touchstart, touchmove, wheel, and mousewheel events in jQuery.
|
// implementations for touchstart, touchmove, wheel, and mousewheel events in jQuery.
|
||||||
// By setting the 'passive' option appropriately, it ensures that default browser
|
// By setting the 'passive' option appropriately, it ensures that default browser
|
||||||
// behavior is prevented when necessary, thereby improving page scroll performance.
|
// behavior is prevented when necessary, thereby improving page scroll performance.
|
||||||
// More info: https://stackoverflow.com/a/62177358
|
// More info: https://stackoverflow.com/a/62177358
|
||||||
if(jQuery){
|
if(jQuery){
|
||||||
@ -132,7 +132,7 @@ if(jQuery){
|
|||||||
setup: function( _, ns, handle ){
|
setup: function( _, ns, handle ){
|
||||||
this.addEventListener("mousewheel", handle, { passive: true });
|
this.addEventListener("mousewheel", handle, { passive: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
window.initgui = async function(){
|
window.initgui = async function(){
|
||||||
@ -151,7 +151,7 @@ window.initgui = async function(){
|
|||||||
// Print the version to the console
|
// Print the version to the console
|
||||||
puter.os.version()
|
puter.os.version()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const deployed_date = new Date(res.deploy_timestamp);
|
const deployed_date = new Date(res.deploy_timestamp);
|
||||||
console.log(`Your Puter information:\n• Version: ${(res.version)}\n• Server: ${(res.location)}\n• Deployed: ${(deployed_date)}`);
|
console.log(`Your Puter information:\n• Version: ${(res.version)}\n• Server: ${(res.location)}\n• Deployed: ${(deployed_date)}`);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -159,7 +159,7 @@ window.initgui = async function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Checks the type of device the user is on (phone, tablet, or desktop).
|
// Checks the type of device the user is on (phone, tablet, or desktop).
|
||||||
// Depending on the device type, it sets a class attribute on the body tag
|
// Depending on the device type, it sets a class attribute on the body tag
|
||||||
// to style or script the page differently for each device type.
|
// to style or script the page differently for each device type.
|
||||||
if(isMobile.phone)
|
if(isMobile.phone)
|
||||||
$('body').attr('class', 'device-phone');
|
$('body').attr('class', 'device-phone');
|
||||||
@ -172,7 +172,7 @@ window.initgui = async function(){
|
|||||||
// This ensures that special characters and symbols display correctly across various platforms and browsers.
|
// This ensures that special characters and symbols display correctly across various platforms and browsers.
|
||||||
$('head').append(`<meta charset="utf-8">`);
|
$('head').append(`<meta charset="utf-8">`);
|
||||||
|
|
||||||
// Appends a viewport meta tag to the head of the document, ensuring optimal display on mobile devices.
|
// Appends a viewport meta tag to the head of the document, ensuring optimal display on mobile devices.
|
||||||
// This tag sets the width of the viewport to the device width, and locks the zoom level to 1 (prevents user scaling).
|
// This tag sets the width of the viewport to the device width, and locks the zoom level to 1 (prevents user scaling).
|
||||||
$('head').append(`<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">`);
|
$('head').append(`<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">`);
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ window.initgui = async function(){
|
|||||||
if(window.url_query_params.has('r')){
|
if(window.url_query_params.has('r')){
|
||||||
window.referral_code = window.url_query_params.get('r');
|
window.referral_code = window.url_query_params.get('r');
|
||||||
// remove 'r' from URL
|
// remove 'r' from URL
|
||||||
window.history.pushState(null, document.title, '/');
|
window.history.pushState(null, document.title, '/');
|
||||||
// show referral notice, this will be used later if Desktop is loaded
|
// show referral notice, this will be used later if Desktop is loaded
|
||||||
if(window.first_visit_ever)
|
if(window.first_visit_ever)
|
||||||
window.show_referral_notice = true;
|
window.show_referral_notice = true;
|
||||||
@ -304,7 +304,7 @@ window.initgui = async function(){
|
|||||||
|
|
||||||
let messageTarget = window.embedded_in_popup ? window.opener : window.parent;
|
let messageTarget = window.embedded_in_popup ? window.opener : window.parent;
|
||||||
messageTarget.postMessage({
|
messageTarget.postMessage({
|
||||||
msg: "permissionGranted",
|
msg: "permissionGranted",
|
||||||
granted: granted,
|
granted: granted,
|
||||||
}, origin);
|
}, origin);
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ window.initgui = async function(){
|
|||||||
if(action === 'show-open-file-picker' || action === 'show-save-file-picker' || action === 'show-directory-picker'){
|
if(action === 'show-open-file-picker' || action === 'show-save-file-picker' || action === 'show-directory-picker'){
|
||||||
if(!window.userAppToken){
|
if(!window.userAppToken){
|
||||||
let is_confirmed = await PuterDialog();
|
let is_confirmed = await PuterDialog();
|
||||||
|
|
||||||
if(is_confirmed === false){
|
if(is_confirmed === false){
|
||||||
if(!window.is_auth()){
|
if(!window.is_auth()){
|
||||||
window.first_visit_ever = false;
|
window.first_visit_ever = false;
|
||||||
@ -393,7 +393,7 @@ window.initgui = async function(){
|
|||||||
let is_verified;
|
let is_verified;
|
||||||
do{
|
do{
|
||||||
is_verified = await UIWindowEmailConfirmationRequired({
|
is_verified = await UIWindowEmailConfirmationRequired({
|
||||||
stay_on_top: true,
|
stay_on_top: true,
|
||||||
has_head: false
|
has_head: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ window.initgui = async function(){
|
|||||||
let is_verified;
|
let is_verified;
|
||||||
do{
|
do{
|
||||||
is_verified = await UIWindowEmailConfirmationRequired({
|
is_verified = await UIWindowEmailConfirmationRequired({
|
||||||
stay_on_top: true,
|
stay_on_top: true,
|
||||||
has_head: false
|
has_head: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -511,12 +511,12 @@ window.initgui = async function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
let app_uid;
|
let app_uid;
|
||||||
|
|
||||||
if(window.openerOrigin){
|
if(window.openerOrigin){
|
||||||
app_uid = await window.getAppUIDFromOrigin(window.openerOrigin);
|
app_uid = await window.getAppUIDFromOrigin(window.openerOrigin);
|
||||||
window.host_app_uid = app_uid;
|
window.host_app_uid = app_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(action === 'show-open-file-picker'){
|
if(action === 'show-open-file-picker'){
|
||||||
let options = window.url_query_params.get('options');
|
let options = window.url_query_params.get('options');
|
||||||
options = JSON.parse(options ?? '{}');
|
options = JSON.parse(options ?? '{}');
|
||||||
@ -542,8 +542,8 @@ window.initgui = async function(){
|
|||||||
initiating_app_uuid: app_uid,
|
initiating_app_uuid: app_uid,
|
||||||
on_close: function(){
|
on_close: function(){
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "fileOpenCanceled",
|
msg: "fileOpenCanceled",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
}, '*');
|
}, '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -572,8 +572,8 @@ window.initgui = async function(){
|
|||||||
initiating_app_uuid: app_uid,
|
initiating_app_uuid: app_uid,
|
||||||
on_close: function(){
|
on_close: function(){
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "directoryOpenCanceled",
|
msg: "directoryOpenCanceled",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
}, '*');
|
}, '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -588,7 +588,7 @@ window.initgui = async function(){
|
|||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: 'sendMeFileData',
|
msg: 'sendMeFileData',
|
||||||
}, '*');
|
}, '*');
|
||||||
|
|
||||||
// listen for 'showSaveFilePickerPopup' event from parent
|
// listen for 'showSaveFilePickerPopup' event from parent
|
||||||
window.addEventListener('message', async (event) => {
|
window.addEventListener('message', async (event) => {
|
||||||
if(event.data.msg !== 'showSaveFilePickerPopup')
|
if(event.data.msg !== 'showSaveFilePickerPopup')
|
||||||
@ -614,8 +614,8 @@ window.initgui = async function(){
|
|||||||
initiating_app_uuid: app_uid,
|
initiating_app_uuid: app_uid,
|
||||||
on_close: function(){
|
on_close: function(){
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "fileSaveCanceled",
|
msg: "fileSaveCanceled",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
}, '*');
|
}, '*');
|
||||||
},
|
},
|
||||||
onSaveFileDialogSave: async function(target_path, el_filedialog_window){
|
onSaveFileDialogSave: async function(target_path, el_filedialog_window){
|
||||||
@ -633,8 +633,8 @@ window.initgui = async function(){
|
|||||||
try{
|
try{
|
||||||
const res = await puter.fs.write(
|
const res = await puter.fs.write(
|
||||||
target_path,
|
target_path,
|
||||||
file_to_upload,
|
file_to_upload,
|
||||||
{
|
{
|
||||||
dedupeName: false,
|
dedupeName: false,
|
||||||
overwrite: overwrite
|
overwrite: overwrite
|
||||||
}
|
}
|
||||||
@ -645,8 +645,8 @@ window.initgui = async function(){
|
|||||||
|
|
||||||
item_with_same_name_already_exists = false;
|
item_with_same_name_already_exists = false;
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "fileSaved",
|
msg: "fileSaved",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
filename: res.name,
|
filename: res.name,
|
||||||
saved_file: {
|
saved_file: {
|
||||||
name: file_signature.fsentry_name,
|
name: file_signature.fsentry_name,
|
||||||
@ -705,11 +705,11 @@ window.initgui = async function(){
|
|||||||
// done
|
// done
|
||||||
let busy_duration = (Date.now() - busy_init_ts);
|
let busy_duration = (Date.now() - busy_init_ts);
|
||||||
if( busy_duration >= window.busy_indicator_hide_delay){
|
if( busy_duration >= window.busy_indicator_hide_delay){
|
||||||
$(el_filedialog_window).close();
|
$(el_filedialog_window).close();
|
||||||
}else{
|
}else{
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// close this dialog
|
// close this dialog
|
||||||
$(el_filedialog_window).close();
|
$(el_filedialog_window).close();
|
||||||
}, Math.abs(window.busy_indicator_hide_delay - busy_duration));
|
}, Math.abs(window.busy_indicator_hide_delay - busy_duration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -722,11 +722,11 @@ window.initgui = async function(){
|
|||||||
// Get user's sites
|
// Get user's sites
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
window.update_sites_cache();
|
window.update_sites_cache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
// Desktop Background
|
// Desktop Background
|
||||||
// If we're in fullpage/emebedded/Auth Popup mode, we don't want to load the custom background
|
// If we're in fullpage/emebedded/Auth Popup mode, we don't want to load the custom background
|
||||||
// because it's not visible anyway and it's a waste of bandwidth
|
// because it's not visible anyway and it's a waste of bandwidth
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
if(!window.is_fullpage_mode && !window.embedded_in_popup){
|
if(!window.is_fullpage_mode && !window.embedded_in_popup){
|
||||||
@ -773,7 +773,7 @@ window.initgui = async function(){
|
|||||||
referrer += '?ref=' + html_encode(window.url_query_params.get('ref'));
|
referrer += '?ref=' + html_encode(window.url_query_params.get('ref'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let headers = {};
|
let headers = {};
|
||||||
if(window.custom_headers)
|
if(window.custom_headers)
|
||||||
headers = window.custom_headers;
|
headers = window.custom_headers;
|
||||||
@ -783,14 +783,14 @@ window.initgui = async function(){
|
|||||||
async: true,
|
async: true,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
referrer: referrer,
|
referrer: referrer,
|
||||||
referral_code: window.referral_code,
|
referral_code: window.referral_code,
|
||||||
is_temp: true,
|
is_temp: true,
|
||||||
}),
|
}),
|
||||||
success: async function (data){
|
success: async function (data){
|
||||||
window.update_auth_data(data.token, data.user);
|
window.update_auth_data(data.token, data.user);
|
||||||
document.dispatchEvent(new Event("login", { bubbles: true}));
|
document.dispatchEvent(new Event("login", { bubbles: true}));
|
||||||
},
|
},
|
||||||
error: function (err){
|
error: function (err){
|
||||||
$('#signup-error-msg').html(html_encode(err.responseText));
|
$('#signup-error-msg').html(html_encode(err.responseText));
|
||||||
@ -897,8 +897,8 @@ window.initgui = async function(){
|
|||||||
initiating_app_uuid: app_uid,
|
initiating_app_uuid: app_uid,
|
||||||
on_close: function(){
|
on_close: function(){
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "fileOpenCanceled",
|
msg: "fileOpenCanceled",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
}, '*');
|
}, '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -927,8 +927,8 @@ window.initgui = async function(){
|
|||||||
initiating_app_uuid: app_uid,
|
initiating_app_uuid: app_uid,
|
||||||
on_close: function(){
|
on_close: function(){
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "directoryOpenCanceled",
|
msg: "directoryOpenCanceled",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
}, '*');
|
}, '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -944,7 +944,7 @@ window.initgui = async function(){
|
|||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: 'sendMeFileData',
|
msg: 'sendMeFileData',
|
||||||
}, '*');
|
}, '*');
|
||||||
|
|
||||||
// listen for 'showSaveFilePickerPopup' event from parent
|
// listen for 'showSaveFilePickerPopup' event from parent
|
||||||
window.addEventListener('message', async (event) => {
|
window.addEventListener('message', async (event) => {
|
||||||
if(event.data.msg !== 'showSaveFilePickerPopup')
|
if(event.data.msg !== 'showSaveFilePickerPopup')
|
||||||
@ -970,8 +970,8 @@ window.initgui = async function(){
|
|||||||
initiating_app_uuid: app_uid,
|
initiating_app_uuid: app_uid,
|
||||||
on_close: function(){
|
on_close: function(){
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "fileSaveCanceled",
|
msg: "fileSaveCanceled",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
}, '*');
|
}, '*');
|
||||||
},
|
},
|
||||||
onSaveFileDialogSave: async function(target_path, el_filedialog_window){
|
onSaveFileDialogSave: async function(target_path, el_filedialog_window){
|
||||||
@ -989,8 +989,8 @@ window.initgui = async function(){
|
|||||||
try{
|
try{
|
||||||
const res = await puter.fs.write(
|
const res = await puter.fs.write(
|
||||||
target_path,
|
target_path,
|
||||||
file_to_upload,
|
file_to_upload,
|
||||||
{
|
{
|
||||||
dedupeName: false,
|
dedupeName: false,
|
||||||
overwrite: overwrite
|
overwrite: overwrite
|
||||||
}
|
}
|
||||||
@ -1001,8 +1001,8 @@ window.initgui = async function(){
|
|||||||
|
|
||||||
item_with_same_name_already_exists = false;
|
item_with_same_name_already_exists = false;
|
||||||
window.opener.postMessage({
|
window.opener.postMessage({
|
||||||
msg: "fileSaved",
|
msg: "fileSaved",
|
||||||
original_msg_id: msg_id,
|
original_msg_id: msg_id,
|
||||||
filename: res.name,
|
filename: res.name,
|
||||||
saved_file: {
|
saved_file: {
|
||||||
name: file_signature.fsentry_name,
|
name: file_signature.fsentry_name,
|
||||||
@ -1062,11 +1062,11 @@ window.initgui = async function(){
|
|||||||
// done
|
// done
|
||||||
let busy_duration = (Date.now() - busy_init_ts);
|
let busy_duration = (Date.now() - busy_init_ts);
|
||||||
if( busy_duration >= window.busy_indicator_hide_delay){
|
if( busy_duration >= window.busy_indicator_hide_delay){
|
||||||
$(el_filedialog_window).close();
|
$(el_filedialog_window).close();
|
||||||
}else{
|
}else{
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// close this dialog
|
// close this dialog
|
||||||
$(el_filedialog_window).close();
|
$(el_filedialog_window).close();
|
||||||
}, Math.abs(window.busy_indicator_hide_delay - busy_duration));
|
}, Math.abs(window.busy_indicator_hide_delay - busy_duration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1107,10 +1107,10 @@ window.initgui = async function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// click on anything will close all popovers, but there are some exceptions
|
// click on anything will close all popovers, but there are some exceptions
|
||||||
if(!$(e.target).hasClass('start-app')
|
if(!$(e.target).hasClass('start-app')
|
||||||
&& !$(e.target).hasClass('launch-search')
|
&& !$(e.target).hasClass('launch-search')
|
||||||
&& !$(e.target).hasClass('launch-search-clear')
|
&& !$(e.target).hasClass('launch-search-clear')
|
||||||
&& $(e.target).closest('.start-app').length === 0
|
&& $(e.target).closest('.start-app').length === 0
|
||||||
&& !isMobile.phone && !isMobile.tablet
|
&& !isMobile.phone && !isMobile.tablet
|
||||||
&& !$(e.target).hasClass('popover')
|
&& !$(e.target).hasClass('popover')
|
||||||
&& $(e.target).parents('.popover').length === 0){
|
&& $(e.target).parents('.popover').length === 0){
|
||||||
@ -1152,7 +1152,7 @@ window.initgui = async function(){
|
|||||||
const focused_el = document.activeElement;
|
const focused_el = document.activeElement;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// ← ↑ → ↓: an arrow key is pressed
|
// ← ↑ → ↓: an arrow key is pressed
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
if((e.which === 37 || e.which === 38 || e.which === 39 || e.which === 40)){
|
if((e.which === 37 || e.which === 38 || e.which === 39 || e.which === 40)){
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
@ -1182,7 +1182,7 @@ window.initgui = async function(){
|
|||||||
let new_selected_item_row = selected_item_row;
|
let new_selected_item_row = selected_item_row;
|
||||||
let new_selected_item_col = selected_item_col;
|
let new_selected_item_col = selected_item_col;
|
||||||
let new_selected_item;
|
let new_selected_item;
|
||||||
|
|
||||||
// if up arrow is pressed
|
// if up arrow is pressed
|
||||||
if(e.which === 38){
|
if(e.which === 38){
|
||||||
// if this item is in the first row, up arrow should bring the focus back to the search input
|
// if this item is in the first row, up arrow should bring the focus back to the search input
|
||||||
@ -1351,7 +1351,7 @@ window.initgui = async function(){
|
|||||||
else{
|
else{
|
||||||
selected_item = $(window.active_element).hasClass('item') ? window.active_element : $(window.active_element).closest('.item').get(0);
|
selected_item = $(window.active_element).hasClass('item') ? window.active_element : $(window.active_element).closest('.item').get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// override the default behavior of ctrl/meta key
|
// override the default behavior of ctrl/meta key
|
||||||
// in some browsers ctrl/meta key + arrow keys will scroll the page or go back/forward in history
|
// in some browsers ctrl/meta key + arrow keys will scroll the page or go back/forward in history
|
||||||
if(e.ctrlKey || e.metaKey){
|
if(e.ctrlKey || e.metaKey){
|
||||||
@ -1402,7 +1402,7 @@ window.initgui = async function(){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(next_item){
|
if(next_item){
|
||||||
selected_item = next_item;
|
selected_item = next_item;
|
||||||
window.active_element = next_item;
|
window.active_element = next_item;
|
||||||
@ -1423,7 +1423,7 @@ window.initgui = async function(){
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
else if(
|
else if(
|
||||||
// escape key code
|
// escape key code
|
||||||
e.which === 27 &&
|
e.which === 27 &&
|
||||||
// active window must be a FileDialog or Alert
|
// active window must be a FileDialog or Alert
|
||||||
($('.window-active').hasClass('window-filedialog') || $('.window-active').hasClass('window-alert')) &&
|
($('.window-active').hasClass('window-filedialog') || $('.window-active').hasClass('window-alert')) &&
|
||||||
// either don't close if an input is focused or if the input is the filename input
|
// either don't close if an input is focused or if the input is the filename input
|
||||||
@ -1453,7 +1453,7 @@ window.initgui = async function(){
|
|||||||
// close the Launch Popover if it's open
|
// close the Launch Popover if it's open
|
||||||
$(".launch-popover").closest('.popover').fadeOut(200, function(){
|
$(".launch-popover").closest('.popover').fadeOut(200, function(){
|
||||||
$(".launch-popover").closest('.popover').remove();
|
$(".launch-popover").closest('.popover').remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1483,7 +1483,7 @@ window.initgui = async function(){
|
|||||||
const element = $selected_items[index];
|
const element = $selected_items[index];
|
||||||
await window.delete_item(element);
|
await window.delete_item(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1511,7 +1511,7 @@ window.initgui = async function(){
|
|||||||
for (let index = 0; index < $selected_items.length; index++) {
|
for (let index = 0; index < $selected_items.length; index++) {
|
||||||
const element = $selected_items[index];
|
const element = $selected_items[index];
|
||||||
await window.delete_item(element);
|
await window.delete_item(element);
|
||||||
}
|
}
|
||||||
const trash = await puter.fs.stat(window.trash_path);
|
const trash = await puter.fs.stat(window.trash_path);
|
||||||
if(window.socket){
|
if(window.socket){
|
||||||
window.socket.emit('trash.is_empty', {is_empty: trash.is_empty});
|
window.socket.emit('trash.is_empty', {is_empty: trash.is_empty});
|
||||||
@ -1522,7 +1522,7 @@ window.initgui = async function(){
|
|||||||
$(`.item[data-path="${html_encode(window.trash_path)}" i]`).find('.item-icon > img').attr('src', window.icons['trash.svg']);
|
$(`.item[data-path="${html_encode(window.trash_path)}" i]`).find('.item-icon > img').attr('src', window.icons['trash.svg']);
|
||||||
$(`.window[data-path="${html_encode(window.trash_path)}"]`).find('.window-head-icon').attr('src', window.icons['trash.svg']);
|
$(`.window[data-path="${html_encode(window.trash_path)}"]`).find('.window-head-icon').attr('src', window.icons['trash.svg']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// regular delete?
|
// regular delete?
|
||||||
else{
|
else{
|
||||||
@ -1543,7 +1543,7 @@ window.initgui = async function(){
|
|||||||
if(!e.ctrlKey && !e.metaKey && !$(focused_el).is('input') && !$(focused_el).is('textarea') && $('.context-menu').length === 0){
|
if(!e.ctrlKey && !e.metaKey && !$(focused_el).is('input') && !$(focused_el).is('textarea') && $('.context-menu').length === 0){
|
||||||
if(window.keypress_item_seach_term !== '')
|
if(window.keypress_item_seach_term !== '')
|
||||||
clearTimeout(window.keypress_item_seach_buffer_timeout);
|
clearTimeout(window.keypress_item_seach_buffer_timeout);
|
||||||
|
|
||||||
window.keypress_item_seach_buffer_timeout = setTimeout(()=>{
|
window.keypress_item_seach_buffer_timeout = setTimeout(()=>{
|
||||||
window.keypress_item_seach_term = '';
|
window.keypress_item_seach_term = '';
|
||||||
}, 700);
|
}, 700);
|
||||||
@ -1594,7 +1594,7 @@ window.initgui = async function(){
|
|||||||
else if(!e.ctrlKey && !e.metaKey && !$(focused_el).is('input') && !$(focused_el).is('textarea') && $('.context-menu').length > 0){
|
else if(!e.ctrlKey && !e.metaKey && !$(focused_el).is('input') && !$(focused_el).is('textarea') && $('.context-menu').length > 0){
|
||||||
if(window.keypress_item_seach_term !== '')
|
if(window.keypress_item_seach_term !== '')
|
||||||
clearTimeout(window.keypress_item_seach_buffer_timeout);
|
clearTimeout(window.keypress_item_seach_buffer_timeout);
|
||||||
|
|
||||||
window.keypress_item_seach_buffer_timeout = setTimeout(()=>{
|
window.keypress_item_seach_buffer_timeout = setTimeout(()=>{
|
||||||
window.keypress_item_seach_term = '';
|
window.keypress_item_seach_term = '';
|
||||||
}, 700);
|
}, 700);
|
||||||
@ -1688,10 +1688,10 @@ window.initgui = async function(){
|
|||||||
// Copy
|
// Copy
|
||||||
// ctrl/command + c, will copy selected items on the active element to the clipboard
|
// ctrl/command + c, will copy selected items on the active element to the clipboard
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
if((e.ctrlKey || e.metaKey) && e.which === 67 &&
|
if((e.ctrlKey || e.metaKey) && e.which === 67 &&
|
||||||
$(window.mouseover_window).attr('data-is_dir') !== 'false' &&
|
$(window.mouseover_window).attr('data-is_dir') !== 'false' &&
|
||||||
$(window.mouseover_window).attr('data-path') !== window.trash_path &&
|
$(window.mouseover_window).attr('data-path') !== window.trash_path &&
|
||||||
!$(focused_el).is('input') &&
|
!$(focused_el).is('input') &&
|
||||||
!$(focused_el).is('textarea')){
|
!$(focused_el).is('textarea')){
|
||||||
let $selected_items;
|
let $selected_items;
|
||||||
|
|
||||||
@ -1749,7 +1749,7 @@ window.initgui = async function(){
|
|||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
// if this is a selected Launch menu item, open it
|
// if this is a selected Launch menu item, open it
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
@ -1758,7 +1758,7 @@ window.initgui = async function(){
|
|||||||
$(".launch-popover").fadeOut(200, function(){
|
$(".launch-popover").fadeOut(200, function(){
|
||||||
window.launch_app({
|
window.launch_app({
|
||||||
name: $('.launch-app-selected').attr('data-name'),
|
name: $('.launch-app-selected').attr('data-name'),
|
||||||
})
|
})
|
||||||
$(".launch-popover").remove();
|
$(".launch-popover").remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1792,14 +1792,14 @@ window.initgui = async function(){
|
|||||||
if($selected_items.length > 0){
|
if($selected_items.length > 0){
|
||||||
$selected_items.each(function() {
|
$selected_items.each(function() {
|
||||||
window.open_item({
|
window.open_item({
|
||||||
item: this,
|
item: this,
|
||||||
new_window: e.metaKey || e.ctrlKey,
|
new_window: e.metaKey || e.ctrlKey,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
@ -2007,7 +2007,7 @@ window.initgui = async function(){
|
|||||||
window.onbeforeunload = null;
|
window.onbeforeunload = null;
|
||||||
// go to home page
|
// go to home page
|
||||||
window.location.replace("/");
|
window.location.replace("/");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestOpenerOrigin() {
|
function requestOpenerOrigin() {
|
||||||
|
Loading…
Reference in New Issue
Block a user