9 // THIS IS THE KIT KERNEL, KIT APPS FRAMEWORK 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 if ( localStorage.getItem("kit-shutted-down") == "false" ) {
67 Notification.push( "お知らせ", "kitは前回終了時、正しくシャットダウンされませんでした。", "system" );
69 localStorage.setItem("kit-shutted-down", false);
71 Notification.push( "kitへようこそ", localStorage["kit-username"] + "さん、こんにちは。", "system", null, null, 'documents/icon.png', [
74 func: () => launch( 'settings', {'view': 'about'} )
78 if( localStorage.getItem( "kit-startup" ) == undefined ) {
79 localStorage.setItem( "kit-startup", new Array( "welcome" ) );
81 System.startup = localStorage.getItem( "kit-startup" ).split( "," );
82 if( System.bootopt.get("safe") ){
83 Notification.push( "セーフブート", "現在、kitをセーフモードで起動しています。", "system" );
84 System.alert( "セーフブート", "現在、kitをセーフモードで起動しています。<br><a class='kit-hyperlink' onclick='System.reboot()'>通常モードで再起動</a>", "system" );
86 else for( let i of System.startup ) if( i != "" ) launch( i );
88 $("#kit-header-fullscreen").hide();
91 $( "#desktops" ).click( function() {
92 $( "#desktop-" + currentDesktop ).toggleClass( "selected-section" );
93 } ).mousedown( function() {
94 $( ".window" ).css( "opacity", "0.6" );
95 } ).mouseup( function() {
96 $( ".window" ).css( "opacity", "1.0" );
99 $( "#footer-tasks" ).click( function() {
100 if( $( "#kit-tasks" ).is( ":visible" ) ) {
101 $( "#kit-tasks" ).html( "" ).fadeOut( 300 );
104 $( "#task-ctx" ).fadeOut( 200 );
105 $( "#kit-tasks" ).html( $( "#tasks" ).html() ).fadeIn( 300 ).css( "z-index", "9997" );
108 $.getJSON("system/testload.json").fail( () => {
109 $('#body').append(`<div id='wcors' class="window windowactive" style="top: 70px; left: 50px; width: calc(100% - 100px)">
110 <div class="wt">問題が発生しました</div>
111 <div class="winc">JSONデータ読み込みに失敗しました。<br>
112 クロスオリジン制約によりkitアプリケーションの動作が制限されている場合があります。<br>
113 詳細は<a class="kit-hyperlink" onclick="location.href = 'https://mtsgi.github.io/kitdocs/#/cors'">こちらの記事</a>をご確認ください。</div>
115 $('<kit-button-alt class="kit-block kit-text-c m">閉じる</kit-button-alt>').appendTo('#wcors .winc').on('click', ()=>{
116 $('#wcors').remove();
120 $.getJSON("config/desktop.json", (data) => {
121 for( let i in data ){
122 $(".desktop-icons").append("<div class='desktop-icon' data-launch='" + i + "'><img src='" + data[i].icon + "'>" + data[i].name + "</div>");
124 $(".desktop-icon").on("click", function(){
125 launch( $(this).attr("data-launch") );
127 }).fail( function() {
128 Notification.push( "読み込みに失敗", "デスクトップ(config/desktop.json)の読み込みに失敗しました。", "system" );
131 $.getJSON("config/apps.json", System.initLauncher).fail( function() {
132 Notification.push( "ランチャー初期化失敗", "アプリケーション一覧(config/apps.json)の読み込みに失敗しました。", "system" );
134 $( "#kit-tasks" ).delegate( ".task", "click", function() {
135 System.close( this.id.slice( 1 ) );
139 $( "#footer-noti" ).click( function() {
140 $( "#last-notification" ).hide( "drop", {direction: "right"}, 300 );
141 if( $( "#notifications" ).is( ":visible" ) ) {
142 $( "#notifications" ).hide( "drop", {direction: "right"}, 300 );
145 $( "#notifications" ).show( "drop", {direction: "right"}, 300 );
148 $( "#last-notification-close" ).click( function() {
149 $( "#last-notification" ).hide( "drop", {direction: "right"}, 300 );
151 $("#notifications-dnp").prop("checked", false).on("change", ()=>{
152 if( $("#notifications-dnp").is(":checked") ){
153 Notification.goodnight = true;
155 else Notification.goodnight = false;
158 $( ".power-button" ).click( function() {
159 $( "#notifications" ).hide( "drop", {direction: "right"}, 300 );
160 $( "#last-notification" ).hide( "drop", {direction: "right"}, 300 );
161 $( "#kit-wallpaper" ).css( "filter", "blur(5px)" );
162 $( "footer, header, #launcher, #task-ctx, #kit-sightre, .dropdown, #desktop-" + currentDesktop ).hide();
163 $( "#kit-power" ).show();
165 $( "#kit-power-back" ).click( function() {
166 $( "section, header, footer, #kit-wallpaper, .dropdown" ).css( "filter", "none" );
167 $( "footer, header, #desktop-" + currentDesktop ).show();
168 $( "#kit-power" ).hide();
170 $( "#kit-power-shutdown" ).click( function() {
173 $( "#kit-power-reboot" ).click( function() {
176 $( "#kit-power-suspend" ).click( function() {
178 $( "section, header, footer, #kit-wallpaper" ).css( "filter", "none" );
179 $( "#kit-power" ).fadeOut( 300 );
180 System.alert("サスペンド機能", "サスペンド機能はこのバージョンのkitではサポートされていません。");
182 $( "#kit-power-lock" ).click( function() {
185 $( "#lock-password" ).on( 'keypress', function( e ) {
186 if( e.which == 13 ) $( "#lock-unl" ).click();
188 $( "#lock-unl" ).on( 'click', function() {
189 if( !localStorage.getItem( "kit-password" ) || $( "#lock-password" ).val() == localStorage.getItem( "kit-password" ) ) {
190 $( "header, footer" ).show();
191 $( "section, header, footer, #kit-wallpaper" ).css( "filter", "none" );
192 $( "#lock-password" ).val( "" );
193 System.moveDesktop(1);
195 else $( "#lock-password" ).effect( "bounce", {distance: 12, times: 4}, 500 );
196 } ).hover( function() {
197 $( "#lock-unl span" ).removeClass( "fa-lock" ).addClass( "fa-lock-open" );
199 $( "#lock-unl span" ).removeClass( "fa-lock-open" ).addClass( "fa-lock" );
202 $( "#launch" ).click( function() {
203 $( "#notifications" ).hide( "drop", {direction: "right"}, 300 );
204 if( $( "#launcher" ).is( ":visible" ) ) {
205 $( "#kit-wallpaper" ).css( "filter", "none" );
206 $( "#desktop-" + currentDesktop ).show();
207 $( "#launcher" ).hide();
210 $( "#kit-wallpaper" ).css( "filter", "blur(5px)" )
211 $( "section, #task-ctx" ).hide();
212 $( "#launcher" ).show();
217 $('#kit-header-sightre').on('click', () => {
218 if($('#kit-sightre').is( ":visible" )) {
219 $('#kit-sightre').fadeOut(300);
222 $('#kit-sightre-results').html('');
223 $('#kit-sightre').show();
224 $('#kit-sightre-form').val('').focus();
227 let sightrePrevWord = '';
228 $('#kit-sightre-form').on('keypress', (e) => {
229 let _word = $('#kit-sightre-form').val();
230 if( e.which == 13 && _word ) {
231 if( _word == "kit" ){
232 S.alert("", "<div style='text-align:left;'> _ _ _ <br>| | _(_) |_ <br>| |/ / | __|<br>| 〈| | |_ <br>|_|\_ \ _\__|</div><hr>", S.version);
237 if( _word.split(",")[1] ) _args = JSON.parse( _word.split(",").slice(1).join().trim() );
240 Notification.push("引数の解釈に失敗", error, "system");
242 launch( _word.split(",")[0], _args );
243 sightrePrevWord = '';
244 $('#kit-sightre-form').val('');
245 $('#kit-sightre-results').html('');
246 $('#kit-sightre').fadeOut(300);
248 }).on('keydown keyup change', (e) => {
249 let _word = $('#kit-sightre-form').val();
250 if( e.which == 27 ) $('#kit-sightre').fadeOut(300);
252 if( _word == sightrePrevWord ) return;
253 $('#kit-sightre-results').html('');
255 sightrePrevWord = _word;
256 for( let i in System.apps ){
257 if( i.indexOf(_word) == 0 || S.apps[i].name.indexOf(_word) == 0 ){
258 $(`<div class='kit-sightre-result -app'>
259 <img class='--icon' src='${S.apps[i].icon}'/>
261 <div class='--name'>${S.apps[i].name}</div>
262 <div class='--desc'>kitアプリケーション - ${i}</div>
264 <div class='--open fa fa-arrow-right'></div>
265 </div>`).appendTo('#kit-sightre-results').on('click', () => {
267 $('#kit-sightre-results').html('');
268 $('#kit-sightre').fadeOut(300);
272 for( let i in System.userarea ){
273 if( i.indexOf(_word) == 0 || i.indexOf(_word) == 0 ){
274 $(`<div class='kit-sightre-result -file'>
275 <i class="fa fa-file --icon"></i>
277 <div class='--name'>${i}</div>
278 <div class='--desc'>ファイル - 種類:${S.userarea[i].type} - ユーザー:${System.username}</div>
280 <div class='--open fa fa-arrow-right'></div>
281 </div>`).appendTo('#kit-sightre-results').on('click', () => {
283 $('#kit-sightre-results').html('');
284 $('#kit-sightre').fadeOut(300);
288 $(`<div class='kit-sightre-result -link'>
289 <i class="fa fa-search --icon"></i>
291 <div class='--name'>${_word}</div>
292 <div class='--desc'>をWebで検索</div>
294 <div class='--open fa fa-arrow-right'></div>
295 </div>`).appendTo('#kit-sightre-results').on('click', () => {
296 launch( 'browser', { 'url' : 'https://www.bing.com/search?q=' + _word } );
297 $('#kit-sightre-results').html('');
298 $('#kit-sightre').fadeOut(300);
300 $(`<div class='kit-sightre-result -link'>
301 <i class="fab fa-wikipedia-w --icon"></i>
303 <div class='--name'>${_word}</div>
304 <div class='--desc'>wikipediaの記事を表示</div>
306 <div class='--open fa fa-arrow-right'></div>
307 </div>`).appendTo('#kit-sightre-results').on('click', () => {
308 launch( 'browser', { 'url' : 'https://ja.wikipedia.org/wiki/' + _word } );
309 $('#kit-sightre-results').html('');
310 $('#kit-sightre').fadeOut(300);
315 $("#dropdown-sound-slider").slider({
316 min: 0, max: 100, step: 1, value: 100,
318 System.audio.level = ui.value;
319 $("#dropdown-sound-level").text(ui.value);
320 localStorage.setItem("kit-audio-level", ui.value);
321 for( let i in System.audio.list ){
322 System.audio.list[i].volume = System.audio.level / 100;
324 if( ui.value == 0 ) $("#kit-header-sound-icon").removeClass("fa-volume-up").addClass("fa-volume-mute");
325 else $("#kit-header-sound-icon").removeClass("fa-volume-mute").addClass("fa-volume-up");
328 if( localStorage["kit-audio-level"] ) System.audio.volume( localStorage["kit-audio-level"] );
330 $("#dropdown-sound-silent").prop("checked", false).on("change", ()=>{
331 if( $("#dropdown-sound-silent").is(":checked") ){
332 System.audio.silent = true;
333 $("#kit-header-sound-icon").removeClass("fa-volume-up").addClass("fa-volume-mute");
336 System.audio.silent = false;
337 $("#kit-header-sound-icon").removeClass("fa-volume-mute").addClass("fa-volume-up");
341 $("#kit-header-user").on("click", ()=>{
345 $(":root section:not(#desktop-l)").on("contextmenu", function() {
346 let _ptelem = $( document.elementFromPoint(S.mouseX, S.mouseY) );
347 S.selectedElement = _ptelem;
348 S.selectedText = window.getSelection();
349 $( "#kit-context-input" ).val( S.selectedText );
350 if( $( "#kit-context-input" ).val() == "" ) $("#kit-contextgroup-text").hide();
351 else $("#kit-contextgroup-text").show();
352 if( _ptelem[0].id == "desktop-" + currentDesktop ){
353 $("#kit-contextgroup-desktop").show();
354 $("#kit-contextgroup-elem").hide();
357 $("#kit-contextgroup-desktop").hide();
358 $("#kit-contextgroup-elem").show();
360 $( "#kit-context-elem" ).text( _ptelem.prop("tagName").toLowerCase() + "要素" );
361 $("#kit-contextgroup-custom").hide();
363 let _ctxid = _ptelem.attr("data-kit-contextid") || _ptelem.attr("kit-context");
365 $("#kit-contextgroup-custom").show().html('<div id="kit-context-custom"></div>');
366 let _ctxname = KWS.context[_ctxid].name || _ctxid;
367 $("#kit-context-custom").text( _ctxname );
368 for( let i in KWS.context[_ctxid]){
369 if( i == "name" ) continue;
370 $("#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>");
371 $("#kit-context-" + _ctxid + "-" + i).on("click", () => {
372 KWS.context[_ctxid][i].function();
373 $("#kit-context").fadeOut(300);
377 if( _ptelem[0].id ) $( "#kit-context-elem" ).append( "#" + _ptelem[0].id );
378 $( "#kit-context-size" ).text( _ptelem[0].clientWidth + "✕" + _ptelem[0].clientHeight );
379 $("#kit-context").toggle().css("left", S.mouseX).css("top", S.mouseY);
382 $("#kit-context-open").on("click", function(){
383 S.alert("要素", S.selectedElement.clone());
385 $("#kit-context-save").on("click", function(){
386 S.obj2img( S.selectedElement , true );
388 $( "#kit-context-search" ).on("click", function(){
389 $("#kit-context").fadeOut(300);
390 launch( "browser", { "url" : "https://www.bing.com/search?q=" + $( "#kit-context-input" ).val() } );
392 $( "#kit-context-input" ).keypress( function( e ) {
393 if( e.which == 13 ) $( "#kit-context-search" ).click();
395 $("#kit-context a").on("click", function(){
396 $("#kit-context").fadeOut(300);
398 $("#kit-context-vacuum").on("click", function(){
399 for( let i in process ){
400 KWS.vacuum( S.mouseX, S.mouseY );
403 $(".window").css("transition", "none");
406 $("#kit-context-fusen").on("click", function(){
411 $("section").on("click", function(){
412 $("#kit-context").fadeOut(300);
415 $( document ).delegate( "a", "click", function() {
417 launch( localStorage.getItem( "kit-default-browser" ), { "url" : this.href } );
420 } ).on("mousemove", function(event){
421 System.mouseX = event.clientX;
422 System.mouseY = event.clientY;
423 }).delegate( ".textbox", "keypress", function( e ) {
424 if( e.which == 13 && this.id ){
425 if( $("#" + this.id + " + .kit-button").length ){
426 Notification.push("debug", this.id, "system");
427 $("#" + this.id + " + .kit-button").click();
429 else if( $("#" + this.id + " + kit-button").length ){
430 Notification.push("debug", this.id, "system");
431 $("#" + this.id + " + kit-button").click();
436 window.onresize = () => {
437 System.display.width = window.innerWidth;
438 System.display.height = window.innerWidth;
440 if( KWS.fullscreen.pid ){
441 KWS.resize( KWS.fullscreen.pid, System.display.width, System.display.height - 30 );
445 if( localStorage.getItem( "kit-lock" ) == "true" ){
447 setTimeout(() => System.lock(), 100);
451 function launch( str, args, dir ) {
453 System.args[_pid] = args;
454 System.launchpath[_pid] = dir || System.appdir + str;
456 if( System.appCache[str] ) {
457 if( KWS.fullscreen.pid ) KWS.unmax(KWS.fullscreen.pid);
458 appData( System.appCache[str] );
462 $.getJSON( S.launchpath[_pid] + '/define.json', appData ).fail( () => {
463 Notification.push('kitアプリをロードできません。', `${str}を展開できませんでした。`, 'system');
467 Notification.push( "System Error", error, "system" );
472 function appData( data ) {
474 process[String( _pid )] = {
476 time: System.time.obj.toLocaleString(),
481 System.appCache[data.id] = data;
483 let _taskAppend = `<span id='t${_pid}'>`;
484 if( data.icon && data.icon != "none" ) _taskAppend += `<img src='${S.launchpath[_pid]}/${data.icon}'>`;
485 _taskAppend += `<span id='tname${_pid}'>${data.name}<span></span>`;
486 $( "#tasks" ).append( _taskAppend );
487 $( "#t" + _pid ).addClass( "task" ).on({
489 if( $(this).hasClass("t-active") || $(this).hasClass("task-min") ) KWS.min( _pid );
491 $("#w"+_pid).css("z-index", KWS.windowIndex + 1);
492 KWS.refreshWindowIndex();
495 mouseenter: function() {
496 $( "#task-ctx-name" ).text( data.name );
497 if( data.icon && data.icon != "none" ) $( "#task-ctx-img" ).attr( "src", System.launchpath[_pid] + "/" + data.icon );
498 else $( "#task-ctx-img" ).hide();
499 $( "#task-ctx-ver" ).text( data.version + "/pid:" + _pid );
500 $( "#task-ctx-info" ).off().on( "click", function() { System.appInfo( _pid )} );
501 $( "#task-ctx-sshot" ).off().on( "click", function() { S.screenshot(_pid, true) } );
502 $( "#task-ctx-min" ).off().on( "click", function() { KWS.min( String(_pid) ) } );
503 if( $(this).hasClass("t-active") ) $( "#task-ctx-front" ).hide();
504 else $( "#task-ctx-front" ).show();
505 $( "#task-ctx-front" ).off().on( "click", function() {
506 $("#w"+_pid).css("z-index", KWS.windowIndex + 1);
507 KWS.refreshWindowIndex();
509 $( "#task-ctx-close" ).off().on("click", () => System.close(_pid));
510 $( "#task-ctx-kill" ).off().on("click", () => System.kill( data.id));
511 const _ctxleft = $(this).offset().left, _ctxtop = window.innerHeight - $(this).offset().top;
512 if( _ctxleft != $( "#task-ctx" ).offset().left ) $( "#task-ctx" ).hide();
513 $( "#task-ctx" ).css( "left", _ctxleft ).css( "bottom", _ctxtop ).show();
516 $( "section, #kit-tasks" ).on( "mouseenter", function() {
517 $( "#task-ctx" ).fadeOut( 200 );
519 $( "#t" + _pid ).on({
521 prevWindowIndex = $( "#w" + _pid ).css( "z-index" );
522 $( "#w" + _pid ).addClass( "win-highlight" );
524 mouseleave: () => $( "#w" + _pid ).removeClass( "win-highlight" )
527 let _windowAppend = "<div id='w" + _pid + "'><div id='wt" + _pid + "' class='wt'><i class='wmzx'><span id='wm" + _pid + "'></span>";
528 if( data.support && data.support['fullscreen'] == true ) _windowAppend += "<span id='wz" + _pid + "'></span>";
529 _windowAppend += "<span id='wx" + _pid + "'></span></i>";
530 if( data.icon && data.icon != "none" ) _windowAppend += "<img src='" + S.launchpath[_pid] + "/" + data.icon + "'>";
531 _windowAppend += "<span id='wtname" + _pid + "'>" + data.name + "</span></div><div class='winc winc-" + data.id + "' id='winc" + _pid + "'></div></div>";
532 $( "#desktop-" + currentDesktop ).append( _windowAppend );
534 if( data.support && data.support['darkmode'] == true ) $("#winc"+_pid).addClass("winc-darkmode");
535 if( KWS.darkmode ) $("#winc"+_pid).addClass("kit-darkmode");
538 $("#winc"+_pid).css("width", data.size.width).css("height", data.size.height);
541 let _minwidth = 200, _minheight = 40;
542 if( data.resize.minWidth ) _minwidth = data.resize.minWidth;
543 if( data.resize.minHeight ) _minheight = data.resize.minHeight;
544 $("#winc"+_pid).windowResizable({
546 minHeight: _minheight
550 let windowPos = 50 + ( _pid % 10 ) * 20;
552 $( "#w"+_pid ).addClass( "window" ).pep({
553 elementsWithInteraction: ".winc, .ui-resizable-handle",
554 useCSSTranslation: false,
555 disableSelect: false,
557 initiate: function(){
558 $(this.el).addClass("ui-draggable-dragging");
560 this.el.style.zIndex = KWS.windowIndex;
561 KWS.refreshWindowIndex();
564 this.el.style.transition = "none";
565 $(this.el).removeClass("ui-draggable-dragging");
567 }).on( "mousedown", function(){
568 $(".window").css( "transition", "none" );
569 $(this).css("z-index", KWS.windowIndex + 1);
570 KWS.refreshWindowIndex();
571 } ).css( "left", windowPos + "px" ).css( "top", windowPos + "px" ).css( "z-index", KWS.windowIndex );
572 KWS.refreshWindowIndex();
573 $( `#wm${_pid}` ).addClass( "wm fa fa-window-minimize" ).on("click", () => KWS.min( _pid ) );
574 $( `#wz${_pid}` ).addClass( "wz fas fa-square" ).on("click", () => KWS.max( _pid ) );
575 $( `#wx${_pid}` ).addClass( "wx fa fa-times" ).on("click", () => System.close( _pid ) );
576 $( "#winc" + _pid ).resizable( {
578 } ).load( System.launchpath[_pid] + "/" + data.view, (r, s, x) => {
580 Notification.push("起動に失敗:" + x.status, x.statusText);
583 if( !data.script || data.script != "none" ) $.getScript( System.launchpath[_pid] + "/" + data.script, () => {
584 if( !data.support || data.support['kaf'] != false ) App.kaf(_pid);
590 else if( !data.support || data.support['kaf'] != false ){
595 if( data.css != "none" && $("#kit-style-"+data.id).length == 0 ){
596 $( "head" ).append( '<link href="' + System.launchpath[_pid] + '/' + data.css + '" rel="stylesheet" id="kit-style-' + data.id + '"></link>' );
598 localStorage.setItem( "kit-pid", pid );
602 const System = new function() {
603 this.version = "0.2.1";
604 this.username = localStorage.getItem("kit-username");
605 this.appdir = localStorage.getItem("kit-appdir");
606 this.loc = { ...location };
608 this.bootopt = new URLSearchParams(location.search);
614 "width": window.innerWidth,
615 "height": window.innerHeight
618 this.selectedElement = null;
619 this.selectedText = null;
621 this.dom = function(_pid, ..._elems) {
623 if( !_elems.length ) q = ",#winc" + _pid;
624 else for( let i of _elems ){
625 q += ",#winc" + _pid + " " + i;
627 return $( q.substring(1) );
630 this.qs = ( _pid, ..._elems ) => {
632 if( !_elems.length ) q = ",#winc" + _pid;
633 else for( let i of _elems ) q += ",#winc" + _pid + " " + i;
634 return document.querySelectorAll( q.substring(1) )
637 this.userarea = new Object();
638 this.recycle = new Object();
644 this.launchpath = {};
646 this.support = $.support;
647 this.debugmode = false;
651 this.log = new Array();
654 this.setBattery = function(){
655 if( navigator.getBattery ) navigator.getBattery().then((e)=>{
656 let _lv = e.level * 100;
657 System.battery = _lv;
662 this.screenshot = function( _pid, _popup ){
663 let _elem = document.querySelector("body");
664 if( _pid ) _elem = document.querySelector("#w"+_pid);
665 html2canvas( _elem ).then(canvas => {
667 canvas.style.border = "1px solid #909090";
668 S.save( canvas.toDataURL("image/png"), "image" );
674 this.obj2img = function( _obj, _popup ){
676 html2canvas( _elem ).then(canvas => {
678 canvas.style.border = "1px solid #909090";
679 S.save( canvas.toDataURL("image/png"), "image" );
685 this.save = function(data, type){
686 launch("fivr", { "save" : data, "type" : type });
689 this.open = function(filename){
690 launch("fivr", { "open" : filename });
693 this.preventClose = function( _pid ){
694 if( !process[_pid] ) return false;
695 process[_pid].preventclose = true;
699 this.shutdown = function(_opt) {
700 $( "#last-notification-close" ).click();
701 $( "#kit-power-back" ).click();
702 for( let i in process ) {
703 if( process[i].preventclose == true ){
704 S.dialog( "シャットダウンの中断", "pid" + System.appCache[process[i].id].name + "がシャットダウンを妨げています。<br>強制終了してシャットダウンを続行する場合は[OK]を押下してください。", () => {
705 process[i].preventclose = false;
710 else System.close( i );
712 $( "section" ).hide();
713 $( "body" ).css( "background-color", "black" );
714 $( "header, footer" ).fadeOut( 300 );
715 $( "#kit-wallpaper" ).fadeOut( 1500 );
716 if( _opt == "reboot" ) location.href = "autorun.html";
717 localStorage.setItem("kit-shutted-down", true);
720 this.reboot = function() {
721 System.shutdown("reboot");
724 this.lock = function(){
725 System.moveDesktop( "l" );
727 $( "#lock-user-icon" ).css( "background", localStorage.getItem( "kit-user-color" ) );
728 $( "section, header, footer" ).css( "filter", "none" );
729 $( "#kit-wallpaper" ).css( "filter", "blur(20px)" );
730 $( "header, footer, #kit-power" ).hide();
732 $( "#lock-username" ).text( localStorage.getItem( "kit-username" ) );
733 if( localStorage.getItem( "kit-password" ) ) $( "#lock-password" ).show();
734 else $( "#lock-password" ).hide();
737 this.alert = function( title, content, winname ) {
738 launch( "alert", [title, content, winname] );
741 this.dialog = function( title, content, func ){
749 this.appInfo = function( _pid ){
750 let _title = "", _content = "";
751 let ac = System.appCache[process[_pid].id];
752 let _lp = System.launchpath[_pid];
754 _title = ac.name + " " + ac.version;
755 if( ac.icon && ac.icon != "none" ) _content = "<img style='height: 96px' src='" + _lp + "/" + ac.icon + "'><br>";
757 if( typeof ac[i] != "object" ) _content += "<div><span style='font-weight: 100'>" + i + " </span>" + ac[i] + "</div>";
759 _content += "<br><span style='font-weight: 100'>起動パス " + _lp + "</span><br><br>"
761 else _title = "取得に失敗しました";
762 System.alert( _title, _content );
765 this.apps = new Object();
766 this.installed = new Array();
768 this.close = function( _str ) {
769 let _pid = String( _str );
770 $( "#w" + _pid ).remove();
771 $( "#t" + _pid ).remove();
772 $( "#task-ctx" ).hide();
773 delete process[_pid];
774 KWS.refreshWindowIndex();
777 this.kill = function( _str ){
778 for( let _pid in process ) {
779 if( process[_pid] && process[_pid].id == _str ) System.close( _pid );
783 this.vacuum = function( _left, _top ){
784 KWS.vacuum( _left, _top ); //非推奨です(削除予定)。
798 this.clock = function() {
801 let Year = DD.getFullYear();
802 S.time.day = DD.getDay();
804 let Month = ( "00" + Number(DD.getMonth()+1) ).slice( -2 );
806 let DateN = ( "00" + DD.getDate() ).slice( -2 );
808 let Hour = ( "00" + DD.getHours() ).slice( -2 );
810 let Min = ( "00" + DD.getMinutes() ).slice( -2 );
812 let Sec = ( "00" + DD.getSeconds() ).slice( -2 );
814 $( ".os-time" ).text( Hour + ":" + Min + ":" + Sec );
815 let MS = DD.getMilliseconds();
818 outer: { radius: .9, color: "transparent" },
819 inner: { radius: .85, color: "transparent" }
822 long: { from: .8, to: .7, width: 2, color: "#303030" },
823 short: { from: .8, to: .75, width: 1, color: "#a0a0a0" }
826 hour: { length: .4, width: 3, cap: "butt", color: "#303030", ratio: .2 },
827 minute: { length: .67, width: 2, cap: "butt", color: "#303030", ratio: .2 },
828 second: { length: .67, width: 1, cap: "butt", color: "dodgerblue", ratio: .2 }
830 let canvas = $(".dropdown-clock-canvas")[0];
831 canvas.width = "200", canvas.height = "200";
832 let context = canvas.getContext("2d");
833 let center = { x: Math.floor(canvas.width / 2), y: Math.floor(canvas.height / 2) };
834 let radius = Math.min(center.x, center.y), angle, len;
835 context.beginPath();context.fillStyle = circle.outer.color;
836 context.arc(center.x, center.y, radius * circle.outer.radius, 0, Math.PI * 2, false);
837 context.fill();context.beginPath();context.fillStyle = circle.inner.color;
838 context.arc(center.x, center.y, radius * circle.inner.radius, 0, Math.PI * 2, false);
840 for( let i=0; i<60; i++ ){
841 angle = Math.PI * i / 30;
843 let line = ( i%5 == 0 ) ? lines.long : lines.short;
844 context.lineWidth = line.width, context.strokeStyle = line.color;
845 context.moveTo(center.x + Math.sin(angle) * radius * line.from, center.y - Math.cos(angle) * radius * line.from)
846 context.lineTo(center.x + Math.sin(angle) * radius * line.to, center.y - Math.cos(angle) * radius * line.to);
849 angle = Math.PI * ( Number(Hour)+Number(Min)/60 ) / 6, len = radius * hands.hour.length;
850 context.beginPath(), context.lineWidth = hands.hour.width;
851 context.lineCap = hands.hour.cap, context.strokeStyle = hands.hour.color;
852 context.moveTo(center.x - Math.sin(angle) * len * hands.hour.ratio, center.y + Math.cos(angle) * len * hands.hour.ratio);
853 context.lineTo(center.x + Math.sin(angle) * len, center.y - Math.cos(angle) * len), context.stroke();
854 angle = Math.PI * ( Number(Min)+Number(Sec) / 60) / 30, len = radius * hands.minute.length;
855 context.beginPath(), context.lineWidth = hands.minute.width;
856 context.lineCap = hands.minute.cap, context.strokeStyle = hands.minute.color;
857 context.moveTo(center.x - Math.sin(angle) * len * hands.minute.ratio, center.y + Math.cos(angle) * len * hands.minute.ratio);
858 context.lineTo(center.x + Math.sin(angle) * len, center.y - Math.cos(angle) * len), context.stroke();
859 angle = Math.PI * Number(Sec) / 30, len = radius * hands.second.length;
860 context.beginPath(), context.lineWidth = hands.second.width;
861 context.lineCap = hands.second.cap, context.strokeStyle = hands.second.color;
862 context.moveTo(center.x - Math.sin(angle) * len * hands.second.ratio, center.y + Math.cos(angle) * len * hands.second.ratio);
863 context.lineTo(center.x + Math.sin(angle) * len, center.y - Math.cos(angle) * len), context.stroke();
866 this.changeWallpaper = function( str ) {
867 $( "#kit-wallpaper" ).css( "background", str ).css( "background-size", "cover" );
868 localStorage.setItem( "kit-wallpaper", str )
871 this.moveDesktop = function( str ) {
873 $( "section" ).hide();
874 $( "#desktop-" + str ).show();
875 $( "#desktops" ).html( "<span class='far fa-clone'></span>Desktop" + str );
876 currentDesktop = str;
879 this.avoidMultiple = function( _pid, _alert ) {
880 let _id = process[_pid].id;
882 for( let i in process ) {
883 if( process[i].id == _id ) _cnt += 1;
885 Notification.push( "debug", _cnt );
887 System.close( _pid );
889 System.alert( "多重起動", "アプリケーション" + _id + "が既に起動しています。このアプリケーションの多重起動は許可されていません。" );
895 this.resizable = function( _pid, _elem, _width, _height ){
897 if( _elem ) E = String( _elem );
898 if( !_width ) _width = null;
899 if( !_height ) _height = "100";
900 $("#w" + _pid).resizable({
901 alsoResize: "#w" + _pid + " " + E,
907 this.initLauncher = function(data){
908 $("#launcher-apps").html("");
910 for( let i in data ){
911 $("#launcher-apps").append("<div class='launcher-app' data-launch='" + i + "'><img src='" + data[i].icon + "'>" + data[i].name + "</div>");
913 if( !System.bootopt.get("safe") ){
914 for( let i of System.installed ){
915 $("#launcher-apps").append("<div class='launcher-app' data-define-path='" + i.path + "' data-define-id='" + i.id + "'><img src='" + i.icon + "'>" + i.name + "</div>");
918 $(".launcher-app").on("click", function(){
919 $("#launch").click();
920 if( $(this).attr("data-launch") ) launch( $(this).attr("data-launch") );
921 else if( $(this).attr("data-define-path") ){
922 launch( $(this).attr("data-define-id"), null, $(this).attr("data-define-path") );
927 this.clip = new function(){
929 this.history = new Array();
931 this.set = function( content ){
932 this.content = content;
933 this.history.push(content);
936 this.get = ()=>{ return this.content }
939 this.config = new function(){
940 this.apps = new Object();
943 this.audio = new function(){
944 this.level = localStorage["kit-audio-level"] || 100;
947 this.list = new Array();
949 this.volume = function( _level ){
950 $("#dropdown-sound-slider").slider("value", _level);
953 this.play = function( _audioid, _src ){
954 if( !System.audio.list[_audioid] ){
955 System.audio.list[_audioid] = new Audio(_src);
956 System.audio.list[_audioid].volume = System.audio.level / 100;
958 System.audio.list[_audioid].play();
961 this.get = function( _audioid ){
962 return System.audio.list[_audioid];
965 this.pause = function( _audioid ){
966 System.audio.list[_audioid].pause();
969 this.stop = function( _audioid ){
970 System.audio.list[_audioid].pause();
971 System.audio.list[_audioid] = null;
974 this.seek = function( _audioid, _time ){
975 System.audio.list[_audioid].fastSeek(_time);
978 this.mute = function( _audioid, _bool ){
979 System.audio.list[_audioid].muted = _bool;
984 const KWS = new function(){
985 this.version = "3.2.2";
988 this.darkmode = false;
990 this.changeWindowTitle = function( _pid, _str ){
991 $("#tname"+_pid).text( _str );
992 $("#wtname"+_pid).text( _str );
995 this.min = function( _str ) {
996 let _pid = String( _str );
997 if( $( "#w" + _pid ).is( ":visible" ) ) {
998 $( "#w" + _pid ).css("transition", "none").hide( "drop", {direction: "down"}, 300 );
999 $( "#task-ctx" ).effect( "bounce", {distance: 12, times: 1}, 400 );
1000 $( "#t" + _pid ).addClass( "task-min" );
1003 $( "#w" + _pid ).show( "drop", {direction: "down"}, 300 );
1004 $( "#task-ctx" ).effect( "bounce", {distance: 12, times: 1}, 400 );
1005 $( "#t" + _pid ).removeClass( "task-min" );
1017 this.max = function( _pid ){
1018 if( KWS.fullscreen.pid ){
1019 Notification.push("最大化に失敗", "最大化しているウィンドウがあります。");
1022 $( "#wt"+_pid ).addClass("wtmaximize");
1023 $( "#w"+_pid ).css({
1027 .addClass("windowmaximize")
1028 .css("z-index", KWS.windowIndex + 1);
1029 KWS.refreshWindowIndex();
1031 KWS.fullscreen.prevWidth = $("#winc"+_pid).outerWidth();
1032 KWS.fullscreen.prevHeight = $("#winc"+_pid).outerHeight();
1033 KWS.fullscreen.prevTop = $("#w"+_pid).offset().top;
1034 KWS.fullscreen.prevLeft = $("#w"+_pid).offset().left;
1036 KWS.resize( _pid, System.display.width, System.display.height - 30 );
1038 $("#kit-header-fullscreen").show().on("click", () => {
1041 KWS.fullscreen.pid = _pid;
1044 this.unmax = function( _pid ){
1045 if( _pid != KWS.fullscreen.pid ){
1046 Notification.push("最大化解除に失敗", "対象がフルスクリーンウィンドウではありません。");
1049 $( "#wt"+_pid ).removeClass("wtmaximize");
1050 $( "#w"+_pid ).css({
1051 "top": KWS.fullscreen.prevTop,
1052 "left": KWS.fullscreen.prevLeft
1054 .removeClass("windowmaximize");
1056 $("#kit-header-fullscreen").hide().off();
1057 KWS.resize( _pid, KWS.fullscreen.prevWidth, KWS.fullscreen.prevHeight );
1058 KWS.fullscreen.pid = null;
1059 KWS.fullscreen.prevWidth = null;
1060 KWS.fullscreen.prevHeight = null;
1061 KWS.fullscreen.prevTop = null;
1062 KWS.fullscreen.prevLeft = null;
1065 this.vacuum = function( _left, _top ){
1066 for( let i in process ){
1067 $("#w"+i).css("transition", ".5s all ease").css("left", _left ).css("top", _top );
1070 $(".window").css("transition", "none");
1075 this.windowIndex = 1;
1077 this.refreshWindowIndex = function(){
1078 let num = $(".window").length;
1079 let array = new Array();
1080 let obj = new Object();
1081 for( let i = 0; i < num; i++ ){
1082 obj = { id: $(".window")[i].id, zindex: $(".window")[i].style.zIndex };
1085 array.sort( (a,b) => {
1086 return Number(a.zindex - b.zindex);
1088 for( let i in array ){
1089 document.getElementById(array[i].id).style.zIndex = i;
1091 $("#"+array[i].id).addClass("windowactive");
1092 $("#t"+String(array[i].id).substring(1)).addClass("t-active");
1093 KWS.active = String(array[i].id).substring(1);
1094 process[array[i].id.substring(1)].isactive = true;
1097 $("#"+array[i].id).removeClass("windowactive");
1098 $("#t"+String(array[i].id).substring(1)).removeClass("t-active");
1099 process[array[i].id.substring(1)].isactive = false;
1102 KWS.windowIndex = num;
1105 this.front = function( _pid ) {
1106 $(`#w${_pid}`).css("z-index", KWS.windowIndex + 1);
1107 KWS.refreshWindowIndex();
1110 this.resize = function( _pid, _width, _height ){
1111 if( _width ) $("#winc"+_pid).css("width", _width)
1112 if( _height ) $("#winc"+_pid).css("height", _height);
1115 this.fusen = new function(){
1117 this.list = new Object();
1119 this.add = function(_text){
1120 KWS.fusen.list[KWS.fusen.fid] = String(_text);
1121 $("#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>");
1122 $("#kit-f"+KWS.fusen.fid).css({
1123 "left": Number(KWS.fusen.fid)*40 + 20,
1124 "top": Number(KWS.fusen.fid)*10 + 100,
1126 elementsWithInteraction: ".kit-fusen-textarea",
1127 useCSSTranslation: false,
1128 disableSelect: false,
1130 initiate: function(){
1131 $(this.el).css("ui-opacity", "0.7");
1134 this.el.style.transition = "none";
1135 $(this.el).css("ui-opacity", "1.0");
1138 $(".kit-fusen-textarea").off().on("change",function(){
1139 Notification.push($(this).attr("data-fid"), $(this).val(), "debug");
1140 KWS.fusen.list[$(this).attr("data-fid")] = $(this).val();
1141 localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list ));
1143 localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list ));
1147 this.remove = function(_fid){
1148 delete KWS.fusen.list[_fid];
1149 localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list ));
1150 $("#kit-f"+_fid).remove();
1154 this.addCustomContext = function( _elem, _contextid, _obj ){
1155 KWS.context[_contextid] = _obj;
1163 "icon" : "fa-trash-alt",
1164 "function" : function(){
1165 KWS.fusen.remove( S.selectedElement.attr("data-fid") );
1171 "function" : function(){
1172 KWS.fusen.add( KWS.fusen.list[S.selectedElement.attr("data-fid")] );
1179 const Notification = new function() {
1181 this.list = new Object();
1183 this.goodnight = false;
1186 this.push = function( _title, _content, _app, _pid, _action, _img, _buttons ) {
1187 let _nid = this.nid;
1188 if( !System.debugmode && ( _title == "debug" || _app == "debug" ) ){
1191 Notification.list[_nid] = {
1195 time: System.time.obj.toLocaleString(),
1198 if( typeof _action == 'function' ) _action();
1199 else if( _pid ) KWS.front(_pid);
1200 $('#notifications').hide('drop', {direction: 'right'}, 300);
1204 if( _pid && System.appCache[_app] ){
1205 _app = `<img src='${System.launchpath[_pid]}/${System.appCache[_app].icon}'>${_app}`;
1207 if( !this.goodnight ){
1208 if( this.sound ) System.audio.play( "n" + this.nid, this.sound );
1209 $('#last-notification-title').text('').text( _title );
1210 $('#last-notification-content').text('').text( _content );
1211 $('#last-notification-app').text('').html( _app );
1212 $('#last-notification').hide().show('drop', {direction: "right"}, 300).off().on('click', Notification.list[this.nid].action);
1213 if( _img ) $('#last-notification-img').attr('src', _img).show();
1214 else $('#last-notification-img').attr('src', '').hide();
1217 if( _img ) imgtag = `<img src='${_img }' alt='' class='notis_img'>`;
1218 $(`<div class='notis' id='nt${_nid}'>
1220 <span class='notis_close' id='nc${_nid}'></span>
1221 <div class='notis_app'>${_app}</div>
1222 <span>${_title}</span>
1224 <div class='notis_buttons'></div>
1225 <div class='notis_time'>${System.time.obj.toTimeString()}</div>
1226 </div>`).appendTo('#notifications').on('click', Notification.list[this.nid].action);
1227 $(`#nc${_nid}`).on('click', (e) => {
1228 e.stopPropagation();
1229 $(`#nt${_nid}`).fadeOut(300);
1231 $('#last-notification-buttons').html('');
1233 for( let b of _buttons ){
1234 $(`<a>${b.label}</a>`).appendTo('#last-notification-buttons').on('click', (e) => {
1235 e.stopPropagation();
1238 $(`<a>${b.label}</a>`).appendTo(`#nt${_nid} .notis_buttons`).on('click', (e) => {
1239 e.stopPropagation();
1245 return (this.nid - 1);
1251 App.e[_pid] = new Object();
1252 App.d[_pid] = new Object();
1254 this.process = process[_pid];
1255 this.info = System.appCache[process[_pid].id];
1257 this.args = System.args[_pid];
1258 this.close = () => System.close(_pid);
1259 this.d = App.d[_pid];
1260 this.dom = (..._args) => System.dom(_pid, ..._args);
1261 this.e = App.e[_pid];
1262 this.ntf = (_title, _content, _action, _img, _buttons) => Notification.push(_title, _content, this.info.id, _pid, _action, _img, _buttons);
1263 this.qs = (...args) => System.qs(_pid, ...args);
1264 this.front = () => KWS.front(_pid);
1266 this.changeWindowTitle = _t => App.changeWindowTitle( _pid, _t );
1267 this.data = (_name, _value) => App.data(_pid, _name, _value);
1268 this.event = (_name, _event) => App.event(_pid, _name, _event);
1269 this.getPath = _path => App.getPath(_pid, _path);
1270 this.kaf = () => App.kaf(_pid);
1271 this.load = _path => App.load(_pid, _path);
1272 this.preventClose = _bool => App.preventClose(_pid, _bool);
1275 static changeWindowTitle( _pid, _t ) {
1276 $( "#tname"+_pid ).text( _t );
1277 $( "#wtname"+_pid ).text( _t );
1278 process[_pid].title = _t;
1282 static context( _cid, _obj ) {
1283 KWS.context[ _cid ] = _obj;
1287 static data( _pid, _name, _value ) {
1288 if( _value !== undefined ) {
1289 S.dom(_pid, `[kit\\:bind=${_name}]`).val( _value );
1290 S.dom(_pid, `[kit\\:observe=${_name}]`).text( _value );
1291 if( _value ) S.dom(_pid, `[kit\\:if=${_name}]`).show();
1292 else S.dom(_pid, `[kit\\:if=${_name}]`).hide();
1293 return App.d[_pid][_name] = _value;
1295 else if( _name ) return App.d[_pid][_name];
1296 else return App.d[_pid];
1299 static event( _pid, _name, _event ) {
1300 if( !App.e[_pid] ) App.e[_pid] = new Object();
1301 App.e[_pid][_name] = _event;
1305 static getPath( _pid, _path ) {
1306 return System.launchpath[_pid] + _path;
1309 static kaf( _pid ) {
1328 const DATA = App.data(_pid);
1329 const ARGS = System.args[_pid];
1330 for( let i of S.qs(_pid, ...attrs) ){
1331 if( i.hasAttribute("kit-ref") ){
1332 $(i).on("click", () => App.load(_pid, i.getAttribute("kit-ref")) );
1334 if( i.hasAttribute("kit-e") ){
1335 let _eqs = i.getAttribute("kit-e").split(",");
1336 for( let k of _eqs ){
1337 let _eq = k.split(" ");
1338 $(i).on( _eq[1]||"click", App.e[_pid][_eq[0]] );
1341 if( i.hasAttribute("kit-src") ){
1342 $(i).attr("src", `${System.launchpath[_pid]}/${i.getAttribute("kit-src")}` );
1344 if( i.hasAttribute("kit-alert") ){
1345 $(i).on("click", ()=> System.alert( System.appCache[ process[_pid].id ].name, i.getAttribute("kit-alert") ) );
1347 if( i.hasAttribute("kit-launch") ){
1348 $(i).on("click", ()=> launch( i.getAttribute("kit-launch") ) );
1350 if( i.hasAttribute("kit-close") ){
1351 $(i).on("click", ()=> System.close( i.getAttribute("kit-close") || _pid ) );
1353 if( i.hasAttribute("kit-text") ){
1354 $(i).text( eval(i.getAttribute("kit-text")) );
1356 if( i.hasAttribute("kit-html") ){
1357 $(i).html( eval(i.getAttribute("kit-html")) );
1359 if( i.hasAttribute("kit:bind") ){
1360 if( App.d[_pid] == undefined ) App.d[_pid] = new Object();
1361 $(i).on('keydown keyup keypress change', () => {
1362 let _name = i.getAttribute("kit:bind");
1363 App.d[_pid][_name] = i.value;
1364 S.dom(_pid, `[kit\\:observe=${_name}]`).text( i.value );
1365 if( i.value ) S.dom(_pid, `[kit\\:if=${_name}]`).show();
1366 else S.dom(_pid, `[kit\\:if=${_name}]`).hide();
1369 if( i.hasAttribute("kit:observe") ){
1370 $(i).text( App.d[_pid][i.getAttribute("kit:observe")] );
1372 if( i.hasAttribute("kit:value") ){
1373 $(i).val( App.d[_pid][i.getAttribute("kit:value")] );
1375 if( i.hasAttribute("kit-value") ){
1376 $(i).val( eval(i.getAttribute("kit-value")) );
1378 if( i.hasAttribute("kit-color") ){
1379 $(i).css('color', i.getAttribute("kit-color"));
1381 if( i.hasAttribute("kit:if") ){
1382 if( App.d[_pid][i.getAttribute("kit:if")] ){
1387 if( i.hasAttribute("kit-if") ){
1388 if( eval( i.getAttribute("kit-if")) ){
1396 static load( _pid, _path ) {
1397 S.dom(_pid).load( System.launchpath[_pid] +"/"+ _path, () => {
1403 static preventClose( _pid, _bool = true ) {
1404 process[_pid].preventclose = _bool || true;
1409 App.d = new Object();
1410 App.e = new Object();
1411 App.version = "2.1.1";
1413 var process = {}, pid = 0, app, currentDesktop = 1, currentCTX = "", prevWindowIndex, S;