9 // THIS IS THE KIT KERNEL AND KIT WINDOW SYSTEM
10 // http://web.kitit.ml/
11 // https://github.com/mtsgi/kit
14 $( document ).ready( kit );
19 if( localStorage.getItem( "kit-pid" ) ) pid = localStorage.getItem( "kit-pid" );
21 if( !localStorage.getItem( "kit-username" ) ) localStorage.setItem( "kit-username", "ユーザー" );
22 $( "#kit-header-username" ).text( localStorage.getItem( "kit-username" ) );
24 if( localStorage.getItem( "kit-lock" ) == null ) localStorage.setItem( "kit-lock", "false" );
26 if( System.bootopt.get("safe") ) $( "#kit-wallpaper" ).css( "background","#404040" );
27 else if( localStorage.getItem( "kit-wallpaper" ) ) $( "#kit-wallpaper" ).css( "background", localStorage.getItem( "kit-wallpaper" ) ).css( "background-size", "cover" ).css( "background-position", "center" );
29 if( !localStorage.getItem( "kit-default-browser" ) ) localStorage.setItem( "kit-default-browser", "browser" );
31 if( localStorage.getItem("kit-fusen") ){
32 this.list = JSON.parse(localStorage.getItem("kit-fusen"));
33 for( let i in this.list ){
34 KWS.fusen.add(this.list[i]);
38 if( localStorage.getItem("kit-darkmode") == "true" ){
40 $("#kit-darkmode").attr("href", "system/theme/kit-darkmode.css");
41 $(".winc-darkmode").addClass("kit-darkmode");
44 if( System.bootopt.get("safe") ){
45 $("#kit-theme-file").attr("href", "./system/theme/theme-light.css" );
48 if( !localStorage.getItem( "kit-theme" ) ) localStorage.setItem( "kit-theme", "theme-default.css" );
49 $("#kit-theme-file").attr("href", "./system/theme/" + localStorage.getItem("kit-theme") );
52 if( !localStorage.getItem( "kit-appdir" ) ) localStorage.setItem( "kit-appdir", "./app/" );
53 S.appdir = localStorage.getItem( "kit-appdir" );
55 if( localStorage.getItem( "kit-installed" ) ) System.installed = JSON.parse( localStorage.getItem( "kit-installed" ) );
57 if( localStorage["kit-userarea"] ) System.userarea = JSON.parse(localStorage["kit-userarea"]);
58 if( localStorage["kit-recycle"] ) System.recycle = JSON.parse(localStorage["kit-recycle"]);
60 System.moveDesktop( "1" );
63 if( System.bootopt.get("safe") ) clockmove = setInterval( System.clock, 1000 );
64 else clockmove = setInterval( System.clock, 10 );
66 Notification.push( "kitへようこそ", localStorage["kit-username"] + "さん、こんにちは。", "system" );
68 if( localStorage.getItem( "kit-startup" ) == undefined ) {
69 localStorage.setItem( "kit-startup", new Array( "welcome" ) );
71 System.startup = localStorage.getItem( "kit-startup" ).split( "," );
72 if( System.bootopt.get("safe") ){
73 Notification.push( "セーフブート", "現在、kitをセーフモードで起動しています。", "system" );
74 System.alert( "セーフブート", "現在、kitをセーフモードで起動しています。<br><a class='kit-hyperlink' onclick='System.reboot()'>通常モードで再起動</a>", "system" );
76 else for( let i of System.startup ) if( i != "" ) launch( i );
78 $("#kit-header-fullscreen").hide();
81 $( "#desktops" ).click( function() {
82 $( "#desktop-" + currentDesktop ).toggleClass( "selected-section" );
83 } ).mousedown( function() {
84 $( ".window" ).css( "opacity", "0.6" );
85 } ).mouseup( function() {
86 $( ".window" ).css( "opacity", "1.0" );
89 $( "#footer-tasks" ).click( function() {
90 if( $( "#kit-tasks" ).is( ":visible" ) ) {
91 $( "#kit-tasks" ).html( "" ).fadeOut( 300 );
94 $( "#task-ctx" ).fadeOut( 200 );
95 $( "#kit-tasks" ).html( $( "#tasks" ).html() ).fadeIn( 300 ).css( "z-index", "9997" );
99 $.getJSON("config/desktop.json", (data) => {
100 for( let i in data ){
101 $(".desktop-icons").append("<div class='desktop-icon' data-launch='" + i + "'><img src='" + data[i].icon + "'>" + data[i].name + "</div>");
103 $(".desktop-icon").on("click", function(){
104 launch( $(this).attr("data-launch") );
106 }).fail( function() {
107 Notification.push( "読み込みに失敗", "デスクトップ(config/desktop.json)の読み込みに失敗しました。", "system" );
110 $.getJSON("config/apps.json", System.initLauncher).fail( function() {
111 Notification.push( "ランチャー初期化失敗", "アプリケーション一覧(config/apps.json)の読み込みに失敗しました。", "system" );
113 $( "#kit-tasks" ).delegate( ".task", "click", function() {
114 System.close( this.id.slice( 1 ) );
118 $( "#footer-noti" ).click( function() {
119 $( "#last-notification" ).hide( "drop", {direction: "right"}, 300 );
120 if( $( "#notifications" ).is( ":visible" ) ) {
121 $( "#notifications" ).hide( "drop", {direction: "right"}, 300 );
124 $( "#notifications" ).show( "drop", {direction: "right"}, 300 );
127 $( "#last-notification-close" ).click( function() {
128 $( "#last-notification" ).hide( "drop", {direction: "right"}, 300 );
130 $("#notifications-dnp").prop("checked", false).on("change", ()=>{
131 if( $("#notifications-dnp").is(":checked") ){
132 Notification.goodnight = true;
134 else Notification.goodnight = false;
137 $( ".power-button" ).click( function() {
138 $( "#notifications" ).hide( "drop", {direction: "right"}, 300 );
139 $( "#last-notification" ).hide( "drop", {direction: "right"}, 300 );
140 $( "#kit-wallpaper" ).css( "filter", "blur(5px)" );
141 $( "footer, header, #launcher, #task-ctx, #kit-sightre, .dropdown, #desktop-" + currentDesktop ).hide();
142 $( "#kit-power" ).show();
144 $( "#kit-power-back" ).click( function() {
145 $( "section, header, footer, #kit-wallpaper, .dropdown" ).css( "filter", "none" );
146 $( "footer, header, #desktop-" + currentDesktop ).show();
147 $( "#kit-power" ).hide();
149 $( "#kit-power-shutdown" ).click( function() {
152 $( "#kit-power-reboot" ).click( function() {
155 $( "#kit-power-suspend" ).click( function() {
157 $( "section, header, footer, #kit-wallpaper" ).css( "filter", "none" );
158 $( "#kit-power" ).fadeOut( 300 );
159 System.alert("サスペンド機能", "サスペンド機能はこのバージョンのkitではサポートされていません。");
161 $( "#kit-power-lock" ).click( function() {
164 $( "#lock-password" ).on( 'keypress', function( e ) {
165 if( e.which == 13 ) $( "#lock-unl" ).click();
167 $( "#lock-unl" ).on( 'click', function() {
168 if( !localStorage.getItem( "kit-password" ) || $( "#lock-password" ).val() == localStorage.getItem( "kit-password" ) ) {
169 $( "header, footer" ).show();
170 $( "section, header, footer, #kit-wallpaper" ).css( "filter", "none" );
171 $( "#lock-password" ).val( "" );
172 System.moveDesktop(1);
174 else $( "#lock-password" ).effect( "bounce", {distance: 12, times: 4}, 500 );
175 } ).hover( function() {
176 $( "#lock-unl span" ).removeClass( "fa-lock" ).addClass( "fa-lock-open" );
178 $( "#lock-unl span" ).removeClass( "fa-lock-open" ).addClass( "fa-lock" );
181 $( "#launch" ).click( function() {
182 $( "#notifications" ).hide( "drop", {direction: "right"}, 300 );
183 if( $( "#launcher" ).is( ":visible" ) ) {
184 $( "#kit-wallpaper" ).css( "filter", "none" );
185 $( "#desktop-" + currentDesktop ).show();
186 $( "#launcher" ).hide();
189 $( "#kit-wallpaper" ).css( "filter", "blur(5px)" )
190 $( "section, #task-ctx" ).hide();
191 $( "#launcher" ).show();
196 $('#kit-header-sightre').on('click', () => {
197 if($('#kit-sightre').is( ":visible" )) {
198 $('#kit-sightre').fadeOut(300);
201 $('#kit-sightre-results').html('');
202 $('#kit-sightre').show();
203 $('#kit-sightre-form').val('').focus();
206 let sightrePrevWord = '';
207 $('#kit-sightre-form').on('keypress', (e) => {
208 let _word = $('#kit-sightre-form').val();
209 if( e.which == 13 && _word ) {
210 if( _word == "kit" ){
211 S.alert("", "<div style='text-align:left;'> _ _ _ <br>| | _(_) |_ <br>| |/ / | __|<br>| 〈| | |_ <br>|_|\_ \ _\__|</div><hr>", S.version);
214 $('.kit-sightre-result.-first').click();
215 sightrePrevWord = '';
216 $('#kit-sightre-form').val('');
217 $('#kit-sightre-results').html('');
218 $('#kit-sightre').fadeOut(300);
220 }).on('keydown keyup change', (e) => {
221 let _word = $('#kit-sightre-form').val();
222 if( e.which == 27 ) $('#kit-sightre').fadeOut(300);
224 if( _word == sightrePrevWord ) return;
225 $('#kit-sightre-results').html('');
227 sightrePrevWord = _word;
228 if( _word.indexOf('kish ') == 0 || _word.indexOf('🥧 ') == 0 ){
229 let _cmd = _word.substring( _word.indexOf(" ") + 1 );
231 $(`<div class='kit-sightre-result -first'>
232 <img class='--icon' src='app/kish/icon.png'/>
234 <div class='--name'>${_cmd}</div>
235 <div class='--desc'>kishでコマンドを実行</div>
237 <div class='--open fa fa-arrow-right'></div>
238 </div>`).appendTo('#kit-sightre-results').on('click', () => {
239 launch('kish', { 'rc': [ _cmd ] });
243 else if( _word.indexOf('http://') == 0 || _word.indexOf('https://') == 0 || _word.indexOf('localhost') == 0 ){
244 $(`<div class='kit-sightre-result -first'>
245 <img class='--icon' src='app/browser/icon.png'/>
247 <div class='--name'>${_word}</div>
248 <div class='--desc'>ブラウザでURLを開く</div>
250 <div class='--open fa fa-arrow-right'></div>
251 </div>`).appendTo('#kit-sightre-results').on('click', () => {
252 launch( localStorage.getItem( "kit-default-browser" ), { "url" : _word } );
256 $(`<div class='kit-sightre-result -first'>
257 <img class='--icon' src='system/icons/q.png'/>
259 <div class='--name'>${_word}</div>
260 <div class='--desc'>アプリを起動する</div>
262 <div class='--open fa fa-arrow-right'></div>
263 </div>`).appendTo('#kit-sightre-results').on('click', () => {
266 if( _word.split(",")[1] ) _args = JSON.parse( _word.split(",").slice(1).join().trim() );
269 Notification.push("引数の解釈に失敗", error, "system");
271 launch( _word.split(",")[0], _args );
274 for( let i in System.apps ){
275 if( i.indexOf(_word) == 0 || S.apps[i].name.indexOf(_word) == 0 ){
276 $(`<div class='kit-sightre-result -app'>
277 <img class='--icon' src='${S.apps[i].icon}'/>
279 <div class='--name'>${S.apps[i].name}</div>
280 <div class='--desc'>kitアプリケーション - ${i}</div>
282 <div class='--open fa fa-arrow-right'></div>
283 </div>`).appendTo('#kit-sightre-results').on('click', () => {
285 $('#kit-sightre-results').html('');
286 $('#kit-sightre').fadeOut(300);
290 for( let i in System.userarea ){
291 if( i.indexOf(_word) == 0 || i.indexOf(_word) == 0 ){
292 $(`<div class='kit-sightre-result -file'>
293 <i class="fa fa-file --icon"></i>
295 <div class='--name'>${i}</div>
296 <div class='--desc'>ファイル - 種類:${S.userarea[i].type} - ユーザー:${System.username}</div>
298 <div class='--open fa fa-arrow-right'></div>
299 </div>`).appendTo('#kit-sightre-results').on('click', () => {
301 $('#kit-sightre-results').html('');
302 $('#kit-sightre').fadeOut(300);
306 $(`<div class='kit-sightre-result -link'>
307 <i class="fa fa-search --icon"></i>
309 <div class='--name'>${_word}</div>
310 <div class='--desc'>をWebで検索</div>
312 <div class='--open fa fa-arrow-right'></div>
313 </div>`).appendTo('#kit-sightre-results').on('click', () => {
314 launch( 'browser', { 'url' : 'https://www.bing.com/search?q=' + _word } );
315 $('#kit-sightre-results').html('');
316 $('#kit-sightre').fadeOut(300);
318 $(`<div class='kit-sightre-result -link'>
319 <i class="fab fa-wikipedia-w --icon"></i>
321 <div class='--name'>${_word}</div>
322 <div class='--desc'>wikipediaの記事を表示</div>
324 <div class='--open fa fa-arrow-right'></div>
325 </div>`).appendTo('#kit-sightre-results').on('click', () => {
326 launch( 'browser', { 'url' : 'https://ja.wikipedia.org/wiki/' + _word } );
327 $('#kit-sightre-results').html('');
328 $('#kit-sightre').fadeOut(300);
334 $("#dropdown-sound-slider").slider({
335 min: 0, max: 100, step: 1, value: 100,
337 System.audio.level = ui.value;
338 $("#dropdown-sound-level").text(ui.value);
339 localStorage.setItem("kit-audio-level", ui.value);
340 for( let i in System.audio.list ){
341 System.audio.list[i].volume = System.audio.level / 100;
343 if( ui.value == 0 ) $("#kit-header-sound-icon").removeClass("fa-volume-up").addClass("fa-volume-mute");
344 else $("#kit-header-sound-icon").removeClass("fa-volume-mute").addClass("fa-volume-up");
347 if( localStorage["kit-audio-level"] ) System.audio.volume( localStorage["kit-audio-level"] );
349 $("#dropdown-sound-silent").prop("checked", false).on("change", ()=>{
350 if( $("#dropdown-sound-silent").is(":checked") ){
351 System.audio.silent = true;
352 $("#kit-header-sound-icon").removeClass("fa-volume-up").addClass("fa-volume-mute");
355 System.audio.silent = false;
356 $("#kit-header-sound-icon").removeClass("fa-volume-mute").addClass("fa-volume-up");
360 $("#kit-header-user").on("click", ()=>{
365 $(":root section:not(#desktop-l)").on("contextmenu", function() {
366 let _ptelem = $( document.elementFromPoint(S.mouseX, S.mouseY) );
367 S.selectedElement = _ptelem;
368 S.selectedText = window.getSelection();
369 $( "#kit-context-input" ).val( S.selectedText );
370 if( $( "#kit-context-input" ).val() == "" ) $("#kit-contextgroup-text").hide();
371 else $("#kit-contextgroup-text").show();
372 if( _ptelem[0].id == "desktop-" + currentDesktop ){
373 $("#kit-contextgroup-desktop").show();
374 $("#kit-contextgroup-elem").hide();
377 $("#kit-contextgroup-desktop").hide();
378 $("#kit-contextgroup-elem").show();
380 $( "#kit-context-elem" ).text( _ptelem.prop("tagName").toLowerCase() + "要素" );
381 $("#kit-contextgroup-custom").hide();
383 let _ctxid = _ptelem.attr("data-kit-contextid") || _ptelem.attr("kit-context");
385 $("#kit-contextgroup-custom").show().html('<div id="kit-context-custom"></div>');
386 let _ctxname = KWS.context[_ctxid].name || _ctxid;
387 $("#kit-context-custom").text( _ctxname );
388 for( let i in KWS.context[_ctxid]){
389 if( i == "name" ) continue;
390 $("#kit-contextgroup-custom").append("<a id='kit-context-" + _ctxid + "-" + i + "'><span class='fa " + KWS.context[_ctxid][i].icon + "'></span> " + KWS.context[_ctxid][i].label +"</a>");
391 $("#kit-context-" + _ctxid + "-" + i).on("click", () => {
392 KWS.context[_ctxid][i].function();
393 $("#kit-context").fadeOut(300);
397 if( _ptelem[0].id ) $( "#kit-context-elem" ).append( "#" + _ptelem[0].id );
398 $( "#kit-context-size" ).text( _ptelem[0].clientWidth + "✕" + _ptelem[0].clientHeight );
399 $("#kit-context").toggle().css("left", S.mouseX).css("top", S.mouseY);
402 $("#kit-context-open").on("click", function(){
403 S.alert("要素", S.selectedElement.clone());
405 $("#kit-context-save").on("click", function(){
406 S.obj2img( S.selectedElement , true );
408 $( "#kit-context-search" ).on("click", function(){
409 $("#kit-context").fadeOut(300);
410 launch( "browser", { "url" : "https://www.bing.com/search?q=" + $( "#kit-context-input" ).val() } );
412 $( "#kit-context-input" ).keypress( function( e ) {
413 if( e.which == 13 ) $( "#kit-context-search" ).click();
415 $("#kit-context a").on("click", function(){
416 $("#kit-context").fadeOut(300);
418 $("#kit-context-vacuum").on("click", function(){
419 for( let i in process ){
420 KWS.vacuum( S.mouseX, S.mouseY );
423 $(".window").css("transition", "none");
426 $("#kit-context-fusen").on("click", function(){
431 $("section").on("click", function(){
432 $("#kit-context").fadeOut(300);
435 $( document ).delegate( "a", "click", function() {
437 launch( localStorage.getItem( "kit-default-browser" ), { "url" : this.href } );
440 } ).on("mousemove", function(event){
441 System.mouseX = event.clientX;
442 System.mouseY = event.clientY;
443 }).delegate( ".textbox", "keypress", function( e ) {
444 if( e.which == 13 && this.id ){
445 if( $("#" + this.id + " + .kit-button").length ){
446 Notification.push("debug", this.id, "system");
447 $("#" + this.id + " + .kit-button").click();
449 else if( $("#" + this.id + " + kit-button").length ){
450 Notification.push("debug", this.id, "system");
451 $("#" + this.id + " + kit-button").click();
456 window.onresize = () => {
457 System.display.width = window.innerWidth;
458 System.display.height = window.innerWidth;
460 if( KWS.fullscreen.pid ){
461 KWS.resize( KWS.fullscreen.pid, System.display.width, System.display.height - 30 );
465 if( localStorage.getItem( "kit-lock" ) == "true" ){
467 setTimeout(() => System.lock(), 100);
471 function launch( str, args, dir ) {
473 System.args[_pid] = args;
474 System.launchpath[_pid] = dir || System.appdir + str;
476 if( System.appCache[str] ) {
477 if( KWS.fullscreen.pid ) KWS.unmax(KWS.fullscreen.pid);
478 appData( System.appCache[str] );
482 $.getJSON( S.launchpath[_pid] + "/define.json", appData ).fail( function() {
483 Notification.push("kitアプリをロードできません", str + "を展開できませんでした。アプリが存在しないか、クロスオリジン要求がブロックされている可能性があります。詳細:https://kitdev.home.blog/", "system");
487 Notification.push( "System Error", error, "system" );
492 function appData( data ) {
495 process[String( _pid )] = {
497 time: System.time.obj.toLocaleString(),
502 System.appCache[data.id] = data;
503 let _taskAppend = `<span id='t${_pid}'>`;
504 if( data.icon && data.icon != "none" ) _taskAppend += `<img src='${S.launchpath[_pid]}/${data.icon}'>`;
505 _taskAppend += `<span id='tname${_pid}'>${data.name}<span></span>`;
506 $( "#tasks" ).append( _taskAppend );
507 $( "#t" + _pid ).addClass( "task" ).on({
509 if( $(this).hasClass("t-active") || $(this).hasClass("task-min") ) KWS.min( _pid );
511 $("#w"+_pid).css("z-index", KWS.windowIndex + 1);
512 KWS.refreshWindowIndex();
515 mouseenter: function() {
516 $( "#task-ctx-name" ).text( data.name );
517 if( data.icon && data.icon != "none" ) $( "#task-ctx-img" ).attr( "src", System.launchpath[_pid] + "/" + data.icon );
518 else $( "#task-ctx-img" ).hide();
519 $( "#task-ctx-ver" ).text( data.version + "/pid:" + _pid );
520 $( "#task-ctx-info" ).off().on( "click", function() { System.appInfo( _pid )} );
521 $( "#task-ctx-sshot" ).off().on( "click", function() { S.screenshot(_pid, true) } );
522 $( "#task-ctx-min" ).off().on( "click", function() { KWS.min( String(_pid) ) } );
523 if( $(this).hasClass("t-active") ) $( "#task-ctx-front" ).hide();
524 else $( "#task-ctx-front" ).show();
525 $( "#task-ctx-front" ).off().on( "click", function() {
526 $("#w"+_pid).css("z-index", KWS.windowIndex + 1);
527 KWS.refreshWindowIndex();
529 $( "#task-ctx-close" ).off().on("click", () => System.close(_pid));
530 $( "#task-ctx-kill" ).off().on("click", () => System.kill( data.id));
531 const _ctxleft = $(this).offset().left, _ctxtop = window.innerHeight - $(this).offset().top;
532 if( _ctxleft != $( "#task-ctx" ).offset().left ) $( "#task-ctx" ).hide();
533 $( "#task-ctx" ).css( "left", _ctxleft ).css( "bottom", _ctxtop ).show();
536 $( "section, #kit-tasks" ).on( "mouseenter", function() {
537 $( "#task-ctx" ).fadeOut( 200 );
539 $( "#t" + _pid ).on({
541 prevWindowIndex = $( "#w" + _pid ).css( "z-index" );
542 $( "#w" + _pid ).addClass( "win-highlight" );
544 mouseleave: () => $( "#w" + _pid ).removeClass( "win-highlight" )
547 let _windowAppend = "<div id='w" + _pid + "'><div id='wt" + _pid + "' class='wt'><i class='wmzx'><span id='wm" + _pid + "'></span>";
548 if( data.support && data.support['fullscreen'] == true ) _windowAppend += "<span id='wz" + _pid + "'></span>";
549 _windowAppend += "<span id='wx" + _pid + "'></span></i>";
550 if( data.icon && data.icon != "none" ) _windowAppend += "<img src='" + S.launchpath[_pid] + "/" + data.icon + "'>";
551 _windowAppend += "<span id='wtname" + _pid + "'>" + data.name + "</span></div><div class='winc winc-" + data.id + "' id='winc" + _pid + "'></div></div>";
552 $( "#desktop-" + currentDesktop ).append( _windowAppend );
554 if( data.support && data.support['darkmode'] == true ) $("#winc"+_pid).addClass("winc-darkmode");
555 if( KWS.darkmode ) $("#winc"+_pid).addClass("kit-darkmode");
558 $("#winc"+_pid).css("width", data.size.width).css("height", data.size.height);
561 let _minwidth = 200, _minheight = 40;
562 if( data.resize.minWidth ) _minwidth = data.resize.minWidth;
563 if( data.resize.minHeight ) _minheight = data.resize.minHeight;
564 $("#winc"+_pid).windowResizable({
566 minHeight: _minheight
570 let windowPos = 50 + ( _pid % 10 ) * 20;
572 $( "#w"+_pid ).addClass( "window" ).pep({
573 elementsWithInteraction: ".winc, .ui-resizable-handle",
574 useCSSTranslation: false,
575 disableSelect: false,
577 initiate: function(){
578 $(this.el).addClass("ui-draggable-dragging");
580 this.el.style.zIndex = KWS.windowIndex;
581 KWS.refreshWindowIndex();
584 this.el.style.transition = "none";
585 $(this.el).removeClass("ui-draggable-dragging");
587 }).on( "mousedown", function(){
588 $(".window").css( "transition", "none" );
589 $(this).css("z-index", KWS.windowIndex + 1);
590 KWS.refreshWindowIndex();
591 } ).css( "left", windowPos + "px" ).css( "top", windowPos + "px" ).css( "z-index", KWS.windowIndex );
592 KWS.refreshWindowIndex();
593 $( `#wm${_pid}` ).addClass( "wm fa fa-window-minimize" ).on("click", () => KWS.min( _pid ) );
594 $( `#wz${_pid}` ).addClass( "wz fas fa-square" ).on("click", () => KWS.max( _pid ) );
595 $( `#wx${_pid}` ).addClass( "wx fa fa-times" ).on("click", () => System.close( _pid ) );
596 $( "#winc" + _pid ).resizable( {
598 } ).load( System.launchpath[_pid] + "/" + data.view, (r, s, x) => {
600 Notification.push("起動に失敗:" + x.status, x.statusText);
603 if( !data.script || data.script != "none" ) $.getScript( System.launchpath[_pid] + "/" + data.script, () => {
604 if( !data.support || data.support['kaf'] != false ) App.kaf(_pid);
610 else if( !data.support || data.support['kaf'] != false ){
615 if( data.css != "none" && $("#kit-style-"+data.id).length == 0 ){
616 $( "head" ).append( '<link href="' + System.launchpath[_pid] + '/' + data.css + '" rel="stylesheet" id="kit-style-' + data.id + '"></link>' );
618 localStorage.setItem( "kit-pid", pid );
622 const System = new function() {
623 this.version = "0.2.1";
624 this.username = localStorage.getItem("kit-username");
625 this.appdir = localStorage.getItem("kit-appdir");
626 this.loc = { ...location };
628 this.bootopt = new URLSearchParams(location.search);
634 "width": window.innerWidth,
635 "height": window.innerHeight
638 this.selectedElement = null;
639 this.selectedText = null;
641 this.dom = function(_pid, ..._elems) {
643 if( !_elems.length ) q = ",#winc" + _pid;
644 else for( let i of _elems ){
645 q += ",#winc" + _pid + " " + i;
647 return $( q.substring(1) );
650 this.qs = ( _pid, ..._elems ) => {
652 if( !_elems.length ) q = ",#winc" + _pid;
653 else for( let i of _elems ) q += ",#winc" + _pid + " " + i;
654 return document.querySelectorAll( q.substring(1) )
657 this.userarea = new Object();
658 this.recycle = new Object();
664 this.launchpath = {};
666 this.support = $.support;
667 this.debugmode = false;
671 this.log = new Array();
674 this.setBattery = function(){
675 if( navigator.getBattery ) navigator.getBattery().then((e)=>{
676 let _lv = e.level * 100;
677 System.battery = _lv;
682 this.screenshot = function( _pid, _popup ){
683 let _elem = document.querySelector("body");
684 if( _pid ) _elem = document.querySelector("#w"+_pid);
685 html2canvas( _elem ).then(canvas => {
687 canvas.style.border = "1px solid #909090";
688 S.save( canvas.toDataURL("image/png"), "image" );
694 this.obj2img = function( _obj, _popup ){
696 html2canvas( _elem ).then(canvas => {
698 canvas.style.border = "1px solid #909090";
699 S.save( canvas.toDataURL("image/png"), "image" );
705 this.save = function(data, type){
706 launch("fivr", { "save" : data, "type" : type });
709 this.open = function(filename){
710 launch("fivr", { "open" : filename });
713 this.preventClose = function( _pid ){
714 if( !process[_pid] ) return false;
715 process[_pid].preventclose = true;
719 this.shutdown = function(_opt) {
720 $( "#last-notification-close" ).click();
721 $( "#kit-power-back" ).click();
722 for( let i in process ) {
723 if( process[i].preventclose == true ){
724 S.dialog( "シャットダウンの中断", "pid" + System.appCache[process[i].id].name + "がシャットダウンを妨げています。<br>強制終了してシャットダウンを続行する場合は[OK]を押下してください。", () => {
725 process[i].preventclose = false;
730 else System.close( i );
732 $( "section" ).hide();
733 $( "body" ).css( "background-color", "black" );
734 $( "header, footer" ).fadeOut( 300 );
735 $( "#kit-wallpaper" ).fadeOut( 1500 );
736 if( _opt == "reboot" ) location.href = "autorun.html";
739 this.reboot = function() {
740 System.shutdown("reboot");
743 this.lock = function(){
744 System.moveDesktop( "l" );
746 $( "#lock-user-icon" ).css( "background", localStorage.getItem( "kit-user-color" ) );
747 $( "section, header, footer" ).css( "filter", "none" );
748 $( "#kit-wallpaper" ).css( "filter", "blur(20px)" );
749 $( "header, footer, #kit-power" ).hide();
751 $( "#lock-username" ).text( localStorage.getItem( "kit-username" ) );
752 if( localStorage.getItem( "kit-password" ) ) $( "#lock-password" ).show();
753 else $( "#lock-password" ).hide();
756 this.alert = function( title, content, winname ) {
757 launch( "alert", [title, content, winname] );
760 this.dialog = function( title, content, func ){
768 this.appInfo = function( _pid ){
769 let _title = "", _content = "";
770 let ac = System.appCache[process[_pid].id];
771 let _lp = System.launchpath[_pid];
773 _title = ac.name + " " + ac.version;
774 if( ac.icon && ac.icon != "none" ) _content = "<img style='height: 96px' src='" + _lp + "/" + ac.icon + "'><br>";
776 if( typeof ac[i] != "object" ) _content += "<div><span style='font-weight: 100'>" + i + " </span>" + ac[i] + "</div>";
778 _content += "<br><span style='font-weight: 100'>起動パス " + _lp + "</span><br><br>"
780 else _title = "取得に失敗しました";
781 System.alert( _title, _content );
784 this.apps = new Object();
785 this.installed = new Array();
787 this.close = function( _str ) {
788 let _pid = String( _str );
789 $( "#w" + _pid ).remove();
790 $( "#t" + _pid ).remove();
791 $( "#task-ctx" ).hide();
792 delete process[_pid];
793 KWS.refreshWindowIndex();
796 this.kill = function( _str ){
797 for( let _pid in process ) {
798 if( process[_pid] && process[_pid].id == _str ) System.close( _pid );
802 this.vacuum = function( _left, _top ){
803 KWS.vacuum( _left, _top ); //非推奨です(削除予定)。
817 this.clock = function() {
820 let Year = DD.getFullYear();
821 S.time.day = DD.getDay();
823 let Month = ( "00" + Number(DD.getMonth()+1) ).slice( -2 );
825 let DateN = ( "00" + DD.getDate() ).slice( -2 );
827 let Hour = ( "00" + DD.getHours() ).slice( -2 );
829 let Min = ( "00" + DD.getMinutes() ).slice( -2 );
831 let Sec = ( "00" + DD.getSeconds() ).slice( -2 );
833 $( ".os-time" ).text( Hour + ":" + Min + ":" + Sec );
834 let MS = DD.getMilliseconds();
837 outer: { radius: .9, color: "transparent" },
838 inner: { radius: .85, color: "transparent" }
841 long: { from: .8, to: .7, width: 2, color: "#303030" },
842 short: { from: .8, to: .75, width: 1, color: "#a0a0a0" }
845 hour: { length: .4, width: 3, cap: "butt", color: "#303030", ratio: .2 },
846 minute: { length: .67, width: 2, cap: "butt", color: "#303030", ratio: .2 },
847 second: { length: .67, width: 1, cap: "butt", color: "dodgerblue", ratio: .2 }
849 let canvas = $(".dropdown-clock-canvas")[0];
850 canvas.width = "200", canvas.height = "200";
851 let context = canvas.getContext("2d");
852 let center = { x: Math.floor(canvas.width / 2), y: Math.floor(canvas.height / 2) };
853 let radius = Math.min(center.x, center.y), angle, len;
854 context.beginPath();context.fillStyle = circle.outer.color;
855 context.arc(center.x, center.y, radius * circle.outer.radius, 0, Math.PI * 2, false);
856 context.fill();context.beginPath();context.fillStyle = circle.inner.color;
857 context.arc(center.x, center.y, radius * circle.inner.radius, 0, Math.PI * 2, false);
859 for( let i=0; i<60; i++ ){
860 angle = Math.PI * i / 30;
862 let line = ( i%5 == 0 ) ? lines.long : lines.short;
863 context.lineWidth = line.width, context.strokeStyle = line.color;
864 context.moveTo(center.x + Math.sin(angle) * radius * line.from, center.y - Math.cos(angle) * radius * line.from)
865 context.lineTo(center.x + Math.sin(angle) * radius * line.to, center.y - Math.cos(angle) * radius * line.to);
868 angle = Math.PI * ( Number(Hour)+Number(Min)/60 ) / 6, len = radius * hands.hour.length;
869 context.beginPath(), context.lineWidth = hands.hour.width;
870 context.lineCap = hands.hour.cap, context.strokeStyle = hands.hour.color;
871 context.moveTo(center.x - Math.sin(angle) * len * hands.hour.ratio, center.y + Math.cos(angle) * len * hands.hour.ratio);
872 context.lineTo(center.x + Math.sin(angle) * len, center.y - Math.cos(angle) * len), context.stroke();
873 angle = Math.PI * ( Number(Min)+Number(Sec) / 60) / 30, len = radius * hands.minute.length;
874 context.beginPath(), context.lineWidth = hands.minute.width;
875 context.lineCap = hands.minute.cap, context.strokeStyle = hands.minute.color;
876 context.moveTo(center.x - Math.sin(angle) * len * hands.minute.ratio, center.y + Math.cos(angle) * len * hands.minute.ratio);
877 context.lineTo(center.x + Math.sin(angle) * len, center.y - Math.cos(angle) * len), context.stroke();
878 angle = Math.PI * Number(Sec) / 30, len = radius * hands.second.length;
879 context.beginPath(), context.lineWidth = hands.second.width;
880 context.lineCap = hands.second.cap, context.strokeStyle = hands.second.color;
881 context.moveTo(center.x - Math.sin(angle) * len * hands.second.ratio, center.y + Math.cos(angle) * len * hands.second.ratio);
882 context.lineTo(center.x + Math.sin(angle) * len, center.y - Math.cos(angle) * len), context.stroke();
885 this.changeWallpaper = function( str ) {
886 $( "#kit-wallpaper" ).css( "background", str ).css( "background-size", "cover" );
887 localStorage.setItem( "kit-wallpaper", str )
890 this.moveDesktop = function( str ) {
892 $( "section" ).hide();
893 $( "#desktop-" + str ).show();
894 $( "#desktops" ).html( "<span class='far fa-clone'></span>Desktop" + str );
895 currentDesktop = str;
898 this.avoidMultiple = function( _pid, _alert ) {
899 let _id = process[_pid].id;
901 for( let i in process ) {
902 if( process[i].id == _id ) _cnt += 1;
904 Notification.push( "debug", _cnt );
906 System.close( _pid );
908 System.alert( "多重起動", "アプリケーション" + _id + "が既に起動しています。このアプリケーションの多重起動は許可されていません。" );
914 this.resizable = function( _pid, _elem, _width, _height ){
916 if( _elem ) E = String( _elem );
917 if( !_width ) _width = null;
918 if( !_height ) _height = "100";
919 $("#w" + _pid).resizable({
920 alsoResize: "#w" + _pid + " " + E,
926 this.initLauncher = function(data){
927 $("#launcher-apps").html("");
929 for( let i in data ){
930 $("#launcher-apps").append("<div class='launcher-app' data-launch='" + i + "'><img src='" + data[i].icon + "'>" + data[i].name + "</div>");
932 if( !System.bootopt.get("safe") ){
933 for( let i of System.installed ){
934 $("#launcher-apps").append("<div class='launcher-app' data-define-path='" + i.path + "' data-define-id='" + i.id + "'><img src='" + i.icon + "'>" + i.name + "</div>");
937 $(".launcher-app").on("click", function(){
938 $("#launch").click();
939 if( $(this).attr("data-launch") ) launch( $(this).attr("data-launch") );
940 else if( $(this).attr("data-define-path") ){
941 launch( $(this).attr("data-define-id"), null, $(this).attr("data-define-path") );
946 this.clip = new function(){
948 this.history = new Array();
950 this.set = function( content ){
951 this.content = content;
952 this.history.push(content);
955 this.get = ()=>{ return this.content }
958 this.config = new function(){
959 this.apps = new Object();
962 this.audio = new function(){
963 this.level = localStorage["kit-audio-level"] || 100;
966 this.list = new Array();
968 this.volume = function( _level ){
969 $("#dropdown-sound-slider").slider("value", _level);
972 this.play = function( _audioid, _src ){
973 if( !System.audio.list[_audioid] ){
974 System.audio.list[_audioid] = new Audio(_src);
975 System.audio.list[_audioid].volume = System.audio.level / 100;
977 System.audio.list[_audioid].play();
980 this.get = function( _audioid ){
981 return System.audio.list[_audioid];
984 this.pause = function( _audioid ){
985 System.audio.list[_audioid].pause();
988 this.stop = function( _audioid ){
989 System.audio.list[_audioid].pause();
990 System.audio.list[_audioid] = null;
993 this.seek = function( _audioid, _time ){
994 System.audio.list[_audioid].fastSeek(_time);
997 this.mute = function( _audioid, _bool ){
998 System.audio.list[_audioid].muted = _bool;
1003 const KWS = new function(){
1004 this.version = "3.2.2";
1007 this.darkmode = false;
1009 this.changeWindowTitle = function( _pid, _str ){
1010 $("#tname"+_pid).text( _str );
1011 $("#wtname"+_pid).text( _str );
1014 this.min = function( _str ) {
1015 let _pid = String( _str );
1016 if( $( "#w" + _pid ).is( ":visible" ) ) {
1017 $( "#w" + _pid ).css("transition", "none").hide( "drop", {direction: "down"}, 300 );
1018 $( "#task-ctx" ).effect( "bounce", {distance: 12, times: 1}, 400 );
1019 $( "#t" + _pid ).addClass( "task-min" );
1022 $( "#w" + _pid ).show( "drop", {direction: "down"}, 300 );
1023 $( "#task-ctx" ).effect( "bounce", {distance: 12, times: 1}, 400 );
1024 $( "#t" + _pid ).removeClass( "task-min" );
1036 this.max = function( _pid ){
1037 if( KWS.fullscreen.pid ){
1038 Notification.push("最大化に失敗", "最大化しているウィンドウがあります。");
1041 $( "#wt"+_pid ).addClass("wtmaximize");
1042 $( "#w"+_pid ).css({
1046 .addClass("windowmaximize")
1047 .css("z-index", KWS.windowIndex + 1);
1048 KWS.refreshWindowIndex();
1050 KWS.fullscreen.prevWidth = $("#winc"+_pid).outerWidth();
1051 KWS.fullscreen.prevHeight = $("#winc"+_pid).outerHeight();
1052 KWS.fullscreen.prevTop = $("#w"+_pid).offset().top;
1053 KWS.fullscreen.prevLeft = $("#w"+_pid).offset().left;
1055 KWS.resize( _pid, System.display.width, System.display.height - 30 );
1057 $("#kit-header-fullscreen").show().on("click", () => {
1060 KWS.fullscreen.pid = _pid;
1063 this.unmax = function( _pid ){
1064 if( _pid != KWS.fullscreen.pid ){
1065 Notification.push("最大化解除に失敗", "対象がフルスクリーンウィンドウではありません。");
1068 $( "#wt"+_pid ).removeClass("wtmaximize");
1069 $( "#w"+_pid ).css({
1070 "top": KWS.fullscreen.prevTop,
1071 "left": KWS.fullscreen.prevLeft
1073 .removeClass("windowmaximize");
1075 $("#kit-header-fullscreen").hide().off();
1076 KWS.resize( _pid, KWS.fullscreen.prevWidth, KWS.fullscreen.prevHeight );
1077 KWS.fullscreen.pid = null;
1078 KWS.fullscreen.prevWidth = null;
1079 KWS.fullscreen.prevHeight = null;
1080 KWS.fullscreen.prevTop = null;
1081 KWS.fullscreen.prevLeft = null;
1084 this.vacuum = function( _left, _top ){
1085 for( let i in process ){
1086 $("#w"+i).css("transition", ".5s all ease").css("left", _left ).css("top", _top );
1089 $(".window").css("transition", "none");
1094 this.windowIndex = 1;
1096 this.refreshWindowIndex = function(){
1097 let num = $(".window").length;
1098 let array = new Array();
1099 let obj = new Object();
1100 for( let i = 0; i < num; i++ ){
1101 obj = { id: $(".window")[i].id, zindex: $(".window")[i].style.zIndex };
1104 array.sort( (a,b) => {
1105 return Number(a.zindex - b.zindex);
1107 for( let i in array ){
1108 document.getElementById(array[i].id).style.zIndex = i;
1110 $("#"+array[i].id).addClass("windowactive");
1111 $("#t"+String(array[i].id).substring(1)).addClass("t-active");
1112 KWS.active = String(array[i].id).substring(1);
1113 process[array[i].id.substring(1)].isactive = true;
1116 $("#"+array[i].id).removeClass("windowactive");
1117 $("#t"+String(array[i].id).substring(1)).removeClass("t-active");
1118 process[array[i].id.substring(1)].isactive = false;
1121 KWS.windowIndex = num;
1124 this.resize = function( _pid, _width, _height ){
1125 if( _width ) $("#winc"+_pid).css("width", _width)
1126 if( _height ) $("#winc"+_pid).css("height", _height);
1129 this.fusen = new function(){
1131 this.list = new Object();
1133 this.add = function(_text){
1134 KWS.fusen.list[KWS.fusen.fid] = String(_text);
1135 $("#desktop-"+currentDesktop).append("<div class='kit-fusen' id='kit-f"+KWS.fusen.fid+"'><i class='fa fa-quote-left'></i><textarea class='kit-fusen-textarea kit-selectable' data-fid='"+KWS.fusen.fid+"' kit-context='fusen'>"+_text+"</textarea></div>");
1136 $("#kit-f"+KWS.fusen.fid).css({
1137 "left": Number(KWS.fusen.fid)*40 + 20,
1138 "top": Number(KWS.fusen.fid)*10 + 100,
1140 elementsWithInteraction: ".kit-fusen-textarea",
1141 useCSSTranslation: false,
1142 disableSelect: false,
1144 initiate: function(){
1145 $(this.el).css("ui-opacity", "0.7");
1148 this.el.style.transition = "none";
1149 $(this.el).css("ui-opacity", "1.0");
1152 $(".kit-fusen-textarea").off().on("change",function(){
1153 Notification.push($(this).attr("data-fid"), $(this).val(), "debug");
1154 KWS.fusen.list[$(this).attr("data-fid")] = $(this).val();
1155 localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list ));
1157 localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list ));
1161 this.remove = function(_fid){
1162 delete KWS.fusen.list[_fid];
1163 localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list ));
1164 $("#kit-f"+_fid).remove();
1168 this.addCustomContext = function( _elem, _contextid, _obj ){
1169 KWS.context[_contextid] = _obj;
1177 "icon" : "fa-trash-alt",
1178 "function" : function(){
1179 KWS.fusen.remove( S.selectedElement.attr("data-fid") );
1185 "function" : function(){
1186 KWS.fusen.add( KWS.fusen.list[S.selectedElement.attr("data-fid")] );
1193 const Notification = new function() {
1195 this.list = new Object();
1197 this.goodnight = false;
1200 this.push = function( _title, _content, _app ) {
1201 if( !System.debugmode && ( _title == "debug" || _app == "debug" ) ){
1204 this.list[this.nid] = {
1206 "content" : _content,
1208 "time" : System.time.obj.toLocaleString()
1210 if( !this.goodnight ){
1211 if( this.sound ) System.audio.play( "n" + this.nid, this.sound );
1212 $( "#last-notification-title" ).text("").text( _title );
1213 $( "#last-notification-content" ).text("").text( _content );
1214 $( "#last-notification-app" ).text("").text( _app );
1215 $( "#last-notification" ).hide().show( "drop", {direction: "right"}, 300 );
1217 $( "#notifications" ).append( "<div class='notis' id='nt" + this.nid + "'><span class='notis_close' id='nc" + this.nid + "'></span><span><span class='fas fa-comment-alt'></span>" + _title + "</span>" + _content + "<div class='notis_time'>" + System.time.obj.toLocaleString() + "</div></div>" );
1218 $("#nc" + this.nid).on("click", function(){
1219 let _nid = this.id.slice(2);
1220 $("#nt" + _nid).fadeOut(300);
1223 $("#nt" + this.nid).on("click", function(){
1224 let _nid = this.id.slice(2);
1225 if( Notification.list[ _nid ].app != "system" ){
1226 launch(Notification.list[ _nid ].app);
1230 return (this.nid - 1);
1236 App.e[_pid] = new Object();
1237 App.d[_pid] = new Object();
1239 this.args = System.args[_pid];
1240 this.close = () => System.close(_pid);
1241 this.d = () => App.d[_pid];
1242 this.dom = (..._args) => System.dom(_pid, ..._args);
1243 this.qs = (...args) => System.qs(_pid, ...args);
1244 this.e = App.e[_pid];
1246 this.changeWindowTitle = _t => App.changeWindowTitle( _pid, _t );
1247 this.data = (_name, _value) => App.data(_pid, _name, _value);
1248 this.event = (_name, _event) => App.event(_pid, _name, _event);
1249 this.getPath = _path => App.getPath(_pid, _path);
1250 this.kaf = () => App.kaf(_pid);
1251 this.load = _path => App.load(_pid, _path);
1252 this.preventClose = _bool => App.preventClose(_pid, _bool);
1255 static changeWindowTitle( _pid, _t ) {
1256 $( "#tname"+_pid ).text( _t );
1257 $( "#wtname"+_pid ).text( _t );
1258 process[_pid].title = _t;
1262 static context( _cid, _obj ) {
1263 KWS.context[ _cid ] = _obj;
1267 static data( _pid, _name, _value ) {
1268 if( _value !== undefined ) {
1269 S.dom(_pid, `[kit\\:bind=${_name}]`).val( _value );
1270 S.dom(_pid, `[kit\\:observe=${_name}]`).text( _value );
1271 if( _value ) S.dom(_pid, `[kit\\:if=${_name}]`).show();
1272 else S.dom(_pid, `[kit\\:if=${_name}]`).hide();
1273 return App.d[_pid][_name] = _value;
1275 else if( _name ) return App.d[_pid][_name];
1276 else return App.d[_pid];
1279 static event( _pid, _name, _event ) {
1280 if( !App.e[_pid] ) App.e[_pid] = new Object();
1281 App.e[_pid][_name] = _event;
1285 static getPath( _pid, _path ) {
1286 return System.launchpath[_pid] + _path;
1289 static kaf( _pid ) {
1308 const DATA = App.data(_pid);
1309 const ARGS = System.args[_pid];
1310 for( let i of S.qs(_pid, ...attrs) ){
1311 if( i.hasAttribute("kit-ref") ){
1312 $(i).on("click", () => App.load(_pid, i.getAttribute("kit-ref")) );
1314 if( i.hasAttribute("kit-e") ){
1315 let _eqs = i.getAttribute("kit-e").split(",");
1316 for( let k of _eqs ){
1317 let _eq = k.split(" ");
1318 $(i).on( _eq[1]||"click", App.e[_pid][_eq[0]] );
1321 if( i.hasAttribute("kit-src") ){
1322 $(i).attr("src", `${System.launchpath[_pid]}/${i.getAttribute("kit-src")}` );
1324 if( i.hasAttribute("kit-alert") ){
1325 $(i).on("click", ()=> System.alert( System.appCache[ process[_pid].id ].name, i.getAttribute("kit-alert") ) );
1327 if( i.hasAttribute("kit-launch") ){
1328 $(i).on("click", ()=> launch( i.getAttribute("kit-launch") ) );
1330 if( i.hasAttribute("kit-close") ){
1331 $(i).on("click", ()=> System.close( i.getAttribute("kit-close") || _pid ) );
1333 if( i.hasAttribute("kit-text") ){
1334 $(i).text( eval(i.getAttribute("kit-text")) );
1336 if( i.hasAttribute("kit-html") ){
1337 $(i).html( eval(i.getAttribute("kit-html")) );
1339 if( i.hasAttribute("kit:bind") ){
1340 if( App.d[_pid] == undefined ) App.d[_pid] = new Object();
1341 $(i).on('keydown keyup keypress change', () => {
1342 let _name = i.getAttribute("kit:bind");
1343 App.d[_pid][_name] = i.value;
1344 S.dom(_pid, `[kit\\:observe=${_name}]`).text( i.value );
1345 if( i.value ) S.dom(_pid, `[kit\\:if=${_name}]`).show();
1346 else S.dom(_pid, `[kit\\:if=${_name}]`).hide();
1349 if( i.hasAttribute("kit:observe") ){
1350 $(i).text( App.d[_pid][i.getAttribute("kit:observe")] );
1352 if( i.hasAttribute("kit:value") ){
1353 $(i).val( App.d[_pid][i.getAttribute("kit:value")] );
1355 if( i.hasAttribute("kit-value") ){
1356 $(i).val( eval(i.getAttribute("kit-value")) );
1358 if( i.hasAttribute("kit-color") ){
1359 $(i).css('color', i.getAttribute("kit-color"));
1361 if( i.hasAttribute("kit:if") ){
1362 if( App.d[_pid][i.getAttribute("kit:if")] ){
1367 if( i.hasAttribute("kit-if") ){
1368 if( eval( i.getAttribute("kit-if")) ){
1376 static load( _pid, _path ) {
1377 S.dom(_pid).load( System.launchpath[_pid] +"/"+ _path, () => {
1383 static preventClose( _pid, _bool ) {
1384 process[_pid].preventclose = _bool || true;
1389 App.d = new Object();
1390 App.e = new Object();
1392 var process = {}, pid = 0, app, currentDesktop = 1, currentCTX = "", prevWindowIndex, S;