Skip to content

Commit 70b3173

Browse files
save file
1 parent 16e3209 commit 70b3173

File tree

1 file changed

+51
-6
lines changed

1 file changed

+51
-6
lines changed

utils/editors/editor/editor.html

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@
6666
var output;
6767
var log;
6868

69-
69+
70+
var icon = {};
71+
72+
7073
//:
7174

7275

@@ -87,7 +90,7 @@
8790
mainmenu.initmod({ext,$,menu,editor,filemod});
8891
filemod.initmod({ext,$,menumod,menu,complete,focus,source,log});
8992
publish.initmod({ext,$,ui,menu,source,complete,log});
90-
editor.initmod({ext,$,menu});
93+
editor.initmod({ext,$,menu,on});
9194
log.initmod({ext,$});
9295

9396
await Promise.all([
@@ -99,6 +102,9 @@
99102
log.init(),
100103
]);
101104

105+
106+
icon.def = $('[rel*=icon]').href;
107+
console.log(icon.def);
102108

103109
window.onfocus = ()=>editor && editor.focus();
104110
keydown.add(kd);
@@ -196,10 +202,10 @@ <h1 slot=seo-hdr class=visually-hidden>editor</h1>
196202

197203
<div id=save-root>
198204
<button id=save>save</button>
205+
<checkbox-one id=autosave></checkbox-one>
199206
<div id=save-menu-root class=menu-root>
200207
<img id=save-menu-icon class=menu-icon>
201208
<div id=save-menu class=menu style='display:none'>
202-
<checkbox-one id=autosave></checkbox-one>
203209
</div>
204210
</div>
205211
</div>
@@ -239,6 +245,8 @@ <h1 slot=seo-hdr class=visually-hidden>editor</h1>
239245

240246
var ui = {};
241247
var btn = {};
248+
var on = {};
249+
var set = {};
242250

243251

244252
//:
@@ -249,7 +257,7 @@ <h1 slot=seo-hdr class=visually-hidden>editor</h1>
249257
root = rootnode;
250258

251259
keydown.initdom();
252-
//menu.add.style();
260+
menu.add.style();
253261

254262

255263
hdr.initdom(root);
@@ -266,7 +274,6 @@ <h1 slot=seo-hdr class=visually-hidden>editor</h1>
266274
$(root,'.menu-icon').onclick = menu.click(card,false,false);
267275

268276
autosave = $(root,'#autosave');
269-
autosave.checked = false;
270277

271278

272279

@@ -330,6 +337,24 @@ <h1 slot=seo-hdr class=visually-hidden>editor</h1>
330337
}//save
331338

332339

340+
//:
341+
342+
343+
on.change = function(){
344+
345+
set.favicon(icon.save);
346+
347+
}//change
348+
349+
350+
set.title = function(title){
351+
352+
document.title = title;
353+
set.favicon(icon.def);
354+
355+
}//title
356+
357+
333358
//:
334359

335360

@@ -348,7 +373,8 @@ <h1 slot=seo-hdr class=visually-hidden>editor</h1>
348373
editor.filename(file);
349374
editor.filename.save.hide();
350375
filemod.cur = file;
351-
document.title = file.name||file.filename;
376+
var title = file.name||file.filename;
377+
set.title(title);
352378
}
353379

354380
menu.close();
@@ -412,8 +438,27 @@ <h1 slot=seo-hdr class=visually-hidden>editor</h1>
412438
}//read
413439

414440

441+
//:
442+
443+
444+
set.favicon = function(dataUrl){
445+
446+
$.all('link[rel*="icon"]').forEach(node=>node.remove());
447+
var link = document.createElement('link');
448+
link.rel = 'icon';
449+
link.href = dataUrl;
450+
document.head.appendChild(link);
451+
452+
}//favicon
415453

454+
455+
//:
456+
416457

458+
icon.save = 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAKlBMVEX/pQD/////qhH/pAD/rhr/zHH/yGT/wlP//vz/8dn/tjD/+u//6MD/2ZUL9bZAAAAA30lEQVQoz2OQvuWihARUMgUFBRlamRkYlqXBQLoy10Sg4CUGBisgDQLSu3dLXGBeAxRczMBg3ggR3LZqaeMhBquDggzOCMFdxuZAQWYfQQYHuKDELgOQINA0JEFBqCDzSiwqGdiwqGRgYlDAVIksSIpKYyyC28E+ggoi/L5D8AJMkGFZKAyEKcAFjRGAAS6IBsCCzMbGKGpBgkwqLshAASzoOxMFHDEACjJXCKKANmyCYkNI0IEGgs7YBBdjCpowXGBejSq43YCVYSszV1ooEkgrMMhmkL6lhAIUlJZuBAAfSYTf2T2EkwAAAABJRU5ErkJggg==';
459+
460+
461+
417462

418463
</script>
419464

0 commit comments

Comments
 (0)