Upload via GUI (33 Dateien)

This commit is contained in:
2026-09-22 18:59:48 +00:00
parent 55b47e8b08
commit 3f83c8b32a
3 changed files with 237 additions and 27 deletions
+36 -6
View File
@@ -39,7 +39,7 @@ const aboutBody =
'const o=y("p");o.innerHTML=`Git: ${a.link().outerHTML}`,' +
'e.appendChild(y("div",[y("div|class:version",[_t.render(),' +
'y("div|class:version-details",[y("h1:MyStart|class:version-app-name"),' +
'y("p:Version 1.0.3|class:version-number")])]),y("hr"),s,o,y("div|id:mystart-autostart-row,class:mystart-autostart-row")]))';
'y("p:Version 1.0.4|class:version-number")])]),y("hr"),s,o,y("div|id:mystart-autostart-row,class:mystart-autostart-row")]))';
mainJs = mainJs.slice(0, i) + aboutBody + mainJs.slice(j + aEndMarker.length);
// --- 2) Rename branding (visible text + storage keys) consistently ---
@@ -247,13 +247,13 @@ const windowControlsJs = `(function(){
}
document.addEventListener('mousemove',function(ev){
if(ev.buttons)return; // an active drag (e.g. scrollbar) is in progress -> leave it alone
var onCtrls=ev.target.closest&&ev.target.closest('#mystart-winctrls,#mystart-profiles');
var onCtrls=ev.target.closest&&ev.target.closest('#mystart-winctrls,#mystart-profiles,#mystart-sync-toast');
var edge=onCtrls?null:edgeAt(ev.clientX,ev.clientY);
document.documentElement.style.cursor=edge?CURSOR[edge]:'';
},true);
document.addEventListener('mousedown',function(ev){
if(ev.button!==0)return;
if(ev.target.closest&&ev.target.closest('#mystart-winctrls,#mystart-profiles'))return;
if(ev.target.closest&&ev.target.closest('#mystart-winctrls,#mystart-profiles,#mystart-sync-toast'))return;
var edge=edgeAt(ev.clientX,ev.clientY);
if(edge){ev.preventDefault();send2('window-resize',{edge:edge});}
},true);
@@ -426,8 +426,9 @@ const profilesJs = `(function(){
// Sync is opt-in: no dot at all until it's switched on (Einstellungen -> MyStart).
if(!lastSync||lastSync.enabled===false){syncDot.style.display='none';return;}
syncDot.style.display='';
syncDot.style.background=lastSync.ok?'#2ea043':'#e8b923';
syncDot.title=lastSync.ok?('OneDrive-Sync: '+lastSync.message):('OneDrive-Sync-Problem: '+lastSync.message);
syncDot.style.background=lastSync.conflict?'#a371f7':(lastSync.ok?'#2ea043':'#e8b923');
var prefix=lastSync.conflict?'OneDrive-Sync (Konflikt): ':(lastSync.ok?'OneDrive-Sync: ':'OneDrive-Sync-Problem: ');
syncDot.title=prefix+lastSync.message;
}
function mkSyncDot(){
var d=document.createElement('div');
@@ -436,12 +437,37 @@ const profilesJs = `(function(){
paintSyncDot();
return d;
}
// Short-lived banner for a sync conflict -- a colour-only dot is too easy to
// miss for "you might have lost an edit just now".
var conflictToast=null,conflictToastTimer=null;
function showConflictToast(msg){
if(!conflictToast){
conflictToast=document.createElement('div');
conflictToast.id='mystart-sync-toast';
conflictToast.style.cssText='position:fixed;top:44px;left:6px;max-width:360px;padding:8px 12px;'+
'border-radius:8px;background:rgba(60,30,90,.92);color:#f0e6ff;font-size:12px;line-height:1.4;'+
'box-shadow:0 2px 10px rgba(0,0,0,.4);z-index:2147483647;cursor:pointer;';
conflictToast.title='Zum Ausblenden klicken';
conflictToast.addEventListener('click',hideConflictToast);
document.body.appendChild(conflictToast);
}
conflictToast.textContent='⚠ '+msg;
conflictToast.style.display='';
if(conflictToastTimer)clearTimeout(conflictToastTimer);
conflictToastTimer=setTimeout(hideConflictToast,10000);
}
function hideConflictToast(){
if(conflictToast)conflictToast.style.display='none';
if(conflictToastTimer){clearTimeout(conflictToastTimer);conflictToastTimer=null;}
}
if(window.chrome&&window.chrome.webview){
window.chrome.webview.addEventListener('message',function(ev){
var d=ev.data;
if(!d||d.type!=='sync-status')return;
var wasConflict=lastSync&&lastSync.conflict;
lastSync=d;
paintSyncDot();
if(d.conflict&&!wasConflict)showConflictToast('Gleichzeitige Änderung erkannt — dein Stand wurde trotzdem gespeichert: '+d.message);
});
}
var bar;
@@ -503,7 +529,11 @@ const profilesJs = `(function(){
new MutationObserver(function(){if(!document.getElementById('mystart-profiles'))add();}).observe(document.documentElement,{childList:true,subtree:true});
})();`;
mainJs = trInfra + autostartJs + windowControlsJs + profilesJs + mainJs;
// Local images/videos from this PC in the image/video URL fields (kept as its
// own file: it is full of backslash regexes that are painful inside a template string).
const localFilesJs = fs.readFileSync(path.join(__dirname, 'inject', 'local-files.js'), 'utf8');
mainJs = trInfra + autostartJs + windowControlsJs + profilesJs + localFilesJs + mainJs;
const trPatches = [
// panel header (top-level AND sub, both go through element.header)