Răsfoiți Sursa

not save to server

meetqy 1 an în urmă
părinte
comite
69beb1ff7d
3 a modificat fișierele cu 12 adăugiri și 26 ștergeri
  1. 7 24
      src/UI/Settings/UIWindowSettings.js
  2. 4 2
      src/UI/UIDesktop.js
  3. 1 0
      src/globals.js

+ 7 - 24
src/UI/Settings/UIWindowSettings.js

@@ -360,30 +360,13 @@ async function UIWindowSettings(options){
         $(el_window).on('change', 'select.change-clock-visable', function(e){
             const $this = $(this);  
             const value = $this.val();
-            console.log(value);
-            // $.ajax({
-            //     url: api_origin + "/clock",
-            //     type: 'POST',
-            //     async: true,
-            //     headers: {
-            //         "Authorization": "Bearer "+auth_token
-            //     },
-            //     contentType: "application/json",
-            //     data: value,
-            //     // data: JSON.stringify({ 
-            //     //     old_pass: current_password, 
-            //     //     new_pass: new_password,
-            //     // }),				
-            //     success: function (data){
-            //         // $(el_window).find('.form-success-msg').html(i18n('password_changed'));
-            //         // $(el_window).find('.form-success-msg').fadeIn();
-            //         // $(el_window).find('input').val('');
-            //     },
-            //     error: function (err){
-            //         // $(el_window).find('.form-error-msg').html(err.responseText);
-            //         // $(el_window).find('.form-error-msg').fadeIn();
-            //     }
-            // });	
+
+            value === 'show' && $('#clock').show();
+            value === 'hide' && $('#clock').hide();
+
+            window.mutate_user_preferences({
+                clock_visable: value
+            });
         })
 
         resolve(el_window);

+ 4 - 2
src/UI/UIDesktop.js

@@ -505,6 +505,7 @@ async function UIDesktop(options){
     const user_preferences = {
         show_hidden_files: JSON.parse(await puter.kv.get('user_preferences.show_hidden_files')),
         language: await puter.kv.get('user_preferences.language'),
+        clock_visable: await puter.kv.get('user_preferences.clock_visable'),
     };
 
     // update default apps
@@ -1379,14 +1380,15 @@ document.addEventListener('fullscreenchange', (event) => {
     // document.fullscreenElement will point to the element that
     // is in fullscreen mode if there is one. If there isn't one,
     // the value of the property is null.
+
     if (document.fullscreenElement) {
         $('.fullscreen-btn').css('background-image', `url(${window.icons['shrink.svg']})`);
         $('.fullscreen-btn').attr('title', 'Exit Full Screen');
-        $('#clock').show();
+        window.user_preferences.clock_visable === 'auto' && $('#clock').show();
     } else {
         $('.fullscreen-btn').css('background-image', `url(${window.icons['fullscreen.svg']})`);
         $('.fullscreen-btn').attr('title', 'Enter Full Screen');
-        $('#clock').hide();
+        window.user_preferences.clock_visable === 'auto' && $('#clock').hide();
     }
 })
 

+ 1 - 0
src/globals.js

@@ -97,6 +97,7 @@ if (window.user_preferences === null) {
     window.user_preferences = {
         show_hidden_files: false,
         language: navigator.language.split("-")[0] || navigator.userLanguage || 'en',
+        clock_visable: 'auto',
     }
 }