if( !localStorage.getItem( "kit-appdir" ) ) localStorage.setItem( "kit-appdir", "./app/" );
S.appdir = localStorage.getItem( "kit-appdir" );
- if( localStorage.getItem( "kit-installed" ) ) System.installed = JSON.parse( localStorage.getItem( "kit-installed" ) );
+ if( localStorage.getItem('kit-installed') ) System.installed = JSON.parse( localStorage.getItem('kit-installed') );
+
+ if( localStorage.getItem('kit-screentime') ) KWS.screenTime = JSON.parse( localStorage.getItem('kit-screentime') );
if( localStorage["kit-userarea"] ) System.userarea = JSON.parse(localStorage["kit-userarea"]);
if( localStorage["kit-recycle"] ) System.recycle = JSON.parse(localStorage["kit-recycle"]);
else clockmove = setInterval( System.clock, 10 );
if ( localStorage.getItem("kit-shutted-down") == "false" ) {
- Notification.push( "お知らせ", "kitは前回終了時、正しくシャットダウンされませんでした。", "system" );
+ Notification.push("お知らせ", "kitは前回終了時、正しくシャットダウンされませんでした。", "system");
}
localStorage.setItem("kit-shutted-down", false);
- Notification.push( "kitへようこそ", localStorage["kit-username"] + "さん、こんにちは。", "system", null, null, 'documents/icon.png', [
+ Notification.push("kitへようこそ", localStorage["kit-username"] + "さん、こんにちは。", "system", null, null, 'documents/icon.png', [
{
label: 'kitについて',
- func: () => launch( 'settings', {'view': 'about'} )
+ func: () => System.launch( 'settings', {'view': 'about'} )
}
]);
Notification.push( "セーフブート", "現在、kitをセーフモードで起動しています。", "system" );
System.alert( "セーフブート", "現在、kitをセーフモードで起動しています。<br><a class='kit-hyperlink' onclick='System.reboot()'>通常モードで再起動</a>", "system" );
}
- else for( let i of System.startup ) if( i != "" ) launch( i );
+ else for( let i of System.startup ) if( i != "" ) System.launch(i);
$("#kit-header-fullscreen").hide();
$(".desktop-icons").append("<div class='desktop-icon' data-launch='" + i + "'><img src='" + data[i].icon + "'>" + data[i].name + "</div>");
}
$(".desktop-icon").on("click", function(){
- launch( $(this).attr("data-launch") );
+ System.launch( $(this).attr("data-launch") );
});
}).fail( function() {
Notification.push( "読み込みに失敗", "デスクトップ(config/desktop.json)の読み込みに失敗しました。", "system" );
</div>
<div class='--open fa fa-arrow-right'></div>
</div>`).appendTo('#kit-sightre-results').on('click', () => {
- launch('kish', { 'rc': [ _cmd ] });
+ System.launch('kish', { 'rc': [ _cmd ] });
});
}
}
</div>
<div class='--open fa fa-arrow-right'></div>
</div>`).appendTo('#kit-sightre-results').on('click', () => {
- launch( localStorage.getItem( "kit-default-browser" ), { "url" : _word } );
+ System.launch( localStorage.getItem('kit-default-browser'), { "url" : _word } );
});
}
else {
catch(error) {
Notification.push("引数の解釈に失敗", error, "system");
}
- launch( _word.split(",")[0], _args );
+ System.launch( _word.split(",")[0], _args );
});
}
for( let i in System.apps ){
</div>
<div class='--open fa fa-arrow-right'></div>
</div>`).appendTo('#kit-sightre-results').on('click', () => {
- launch(i);
+ System.launch(i);
$('#kit-sightre-results').html('');
$('#kit-sightre').fadeOut(300);
});
</div>
<div class='--open fa fa-arrow-right'></div>
</div>`).appendTo('#kit-sightre-results').on('click', () => {
- launch( 'browser', { 'url' : 'https://www.bing.com/search?q=' + _word } );
+ System.launch( 'browser', { 'url' : 'https://www.bing.com/search?q=' + _word } );
$('#kit-sightre-results').html('');
$('#kit-sightre').fadeOut(300);
});
</div>
<div class='--open fa fa-arrow-right'></div>
</div>`).appendTo('#kit-sightre-results').on('click', () => {
- launch( 'browser', { 'url' : 'https://ja.wikipedia.org/wiki/' + _word } );
+ System.launch( 'browser', { 'url' : 'https://ja.wikipedia.org/wiki/' + _word } );
$('#kit-sightre-results').html('');
$('#kit-sightre').fadeOut(300);
});
}
});
- $("#kit-header-user").on("click", ()=>{
- launch("user");
- });
+ $('#kit-header-user').on('click', () => System.launch('user') );
$(":root section:not(#desktop-l)").on("contextmenu", function() {
let _ptelem = $( document.elementFromPoint(S.mouseX, S.mouseY) );
});
$( "#kit-context-search" ).on("click", function(){
$("#kit-context").fadeOut(300);
- launch( "browser", { "url" : "https://www.bing.com/search?q=" + $( "#kit-context-input" ).val() } );
+ System.launch( 'browser', {'url': `https://www.bing.com/search?q=${$('#kit-context-input').val()}`} );
});
$( "#kit-context-input" ).keypress( function( e ) {
if( e.which == 13 ) $( "#kit-context-search" ).click();
$("#kit-context").fadeOut(300);
})
- $( document ).delegate( "a", "click", function() {
+ $( document ).delegate('a', 'click', function() {
if( this.href ) {
- launch( localStorage.getItem( "kit-default-browser" ), { "url" : this.href } );
+ System.launch( localStorage.getItem( "kit-default-browser" ), { "url" : this.href } );
return false;
}
- } ).on("mousemove", function(event){
- System.mouseX = event.clientX;
- System.mouseY = event.clientY;
- }).delegate( ".textbox", "keypress", function( e ) {
+ } ).on("mousemove", function(e){
+ System.mouseX = e.clientX;
+ System.mouseY = e.clientY;
+ }).delegate('.textbox', 'keypress', function(e) {
if( e.which == 13 && this.id ){
if( $("#" + this.id + " + .kit-button").length ){
Notification.push("debug", this.id, "system");
let _pid = pid;
System.args[_pid] = args;
- System.launchpath[_pid] = dir || System.appdir + str;
+ let _path = dir || System.appdir + str;
+ System.launchpath[_pid] = _path;
- if( System.appCache[str] ) {
+ if( System.appCache[_path] ) {
if( KWS.fullscreen.pid ) KWS.unmax(KWS.fullscreen.pid);
- appData( System.appCache[str] );
+ appData( System.appCache[_path] );
}
else {
try{
preventclose: false,
title: data.name
};
- System.appCache[data.id] = data;
+ System.appCache[System.launchpath[pid]] = data;
app = new App(_pid);
let _taskAppend = `<span id='t${_pid}'>`;
if( data.icon && data.icon != "none" ) _taskAppend += `<img src='${S.launchpath[_pid]}/${data.icon}'>`;
}
this.save = function(data, type){
- launch("fivr", { "save" : data, "type" : type });
+ System.launch("fivr", { "save" : data, "type" : type });
}
this.open = function(filename){
- launch("fivr", { "open" : filename });
+ System.launch("fivr", { "open" : filename });
}
this.preventClose = function( _pid ){
$( "#kit-power-back" ).click();
for( let i in process ) {
if( process[i].preventclose == true ){
- S.dialog( "シャットダウンの中断", "pid" + System.appCache[process[i].id].name + "がシャットダウンを妨げています。<br>強制終了してシャットダウンを続行する場合は[OK]を押下してください。", () => {
+ S.dialog( "シャットダウンの中断", "pid" + System.appCache[System.launchpath[i]].name + "がシャットダウンを妨げています。<br>強制終了してシャットダウンを続行する場合は[OK]を押下してください。", () => {
process[i].preventclose = false;
System.shutdown();
} );
else $( "#lock-password" ).hide();
}
- this.alert = function( title, content, winname ) {
- launch( "alert", [title, content, winname] );
+ this.alert = function( title, content, wtitle ) {
+ System.launch("alert", [title, content, wtitle]);
}
this.dialog = function( title, content, func ){
- launch("dialog", {
+ System.launch("dialog", {
"title": title,
"content": content,
"func": func
- })
+ });
}
this.appInfo = function( _pid ){
let _title = "", _content = "";
- let ac = System.appCache[process[_pid].id];
+ let ac = System.appCache[S.launchpath[_pid]];
let _lp = System.launchpath[_pid];
if( ac ){
_title = ac.name + " " + ac.version;
$("#launcher-apps").html("");
System.apps = data;
for( let i in data ){
- $("#launcher-apps").append("<div class='launcher-app' data-launch='" + i + "'><img src='" + data[i].icon + "'>" + data[i].name + "</div>");
+ $('#launcher-apps').append(`<div class='launcher-app' data-launch='${i}'><img src='${data[i].icon}'>${data[i].name}</div>`);
}
- if( !System.bootopt.get("safe") ){
+ if( !System.bootopt.get('safe') ){
for( let i of System.installed ){
- $("#launcher-apps").append("<div class='launcher-app' data-define-path='" + i.path + "' data-define-id='" + i.id + "'><img src='" + i.icon + "'>" + i.name + "</div>");
+ $('#launcher-apps').append(`<div class='launcher-app' data-launch='${i.path}' data-define-id='${i.id}'><img src='${i.icon}'>${i.name}</div>`);
}
}
- $(".launcher-app").on("click", function(){
- $("#launch").click();
- if( $(this).attr("data-launch") ) launch( $(this).attr("data-launch") );
- else if( $(this).attr("data-define-path") ){
- launch( $(this).attr("data-define-id"), null, $(this).attr("data-define-path") );
- };
+ $('.launcher-app').on('click', function(){
+ $('#launch').click();
+ System.launch( $(this).attr('data-launch') );
});
}
+ this.launch = async function(path, args) {
+ while(this.launchLock) await this.ajaxWait();
+ this.launchLock = true;
+
+ let _pid = pid;
+ System.args[_pid] = args;
+ let _path = path;
+ if(_path.lastIndexOf('/') == _path.length - 1) {
+ _path = _path.substring(0, _path.length - 1);
+ }
+ else if(_path.indexOf('/') == -1) {
+ _path = System.appdir + _path;
+ }
+
+ System.launchpath[_pid] = _path;
+
+ if( System.appCache[_path] ) {
+ if( KWS.fullscreen.pid ) KWS.unmax(KWS.fullscreen.pid);
+ appData( System.appCache[_path] );
+ }
+ else {
+ try{
+ $.getJSON( _path + '/define.json', appData ).fail( () => {
+ Notification.push('kitアプリをロードできません。', `${_path}を展開できませんでした。`, 'system');
+ } );
+ }
+ catch(error){
+ Notification.push( "System Error", error, "system" );
+ }
+ }
+ }
+
this.clip = new function(){
this.content = null;
this.history = new Array();
}
const KWS = new function(){
- this.version = "3.2.2";
+ this.version = "3.2.3";
this.active = null;
this.darkmode = false;
}
this.max = function( _pid ){
- if( KWS.fullscreen.pid ){
- Notification.push("最大化に失敗", "最大化しているウィンドウがあります。");
+ let _appcache = System.appCache[System.launchpath[_pid]];
+ if( KWS.fullscreen.pid || _appcache.support.fullscreen != true ){
+ Notification.push('最大化に失敗', 'ウィンドウの最大化に失敗しました。', 'system');
return;
}
+ KWS.fullscreen.prevWidth = $("#winc"+_pid).outerWidth();
+ KWS.fullscreen.prevHeight = $("#winc"+_pid).outerHeight();
+ KWS.fullscreen.prevTop = $("#w"+_pid).offset().top;
+ KWS.fullscreen.prevLeft = $("#w"+_pid).offset().left;
+ KWS.fullscreen.pid = _pid;
$( "#wt"+_pid ).addClass("wtmaximize");
$( "#w"+_pid ).css({
"top": "0px",
.addClass("windowmaximize")
.css("z-index", KWS.windowIndex + 1);
KWS.refreshWindowIndex();
-
- KWS.fullscreen.prevWidth = $("#winc"+_pid).outerWidth();
- KWS.fullscreen.prevHeight = $("#winc"+_pid).outerHeight();
- KWS.fullscreen.prevTop = $("#w"+_pid).offset().top;
- KWS.fullscreen.prevLeft = $("#w"+_pid).offset().left;
-
KWS.resize( _pid, System.display.width, System.display.height - 30 );
$("footer").hide();
- $("#kit-header-fullscreen").show().on("click", () => {
- KWS.unmax( _pid );
- });
- KWS.fullscreen.pid = _pid;
+ $("#kit-header-fullscreen").show().on('click', () => KWS.unmax( _pid ));
}
this.unmax = function( _pid ){
Notification.push("最大化解除に失敗", "対象がフルスクリーンウィンドウではありません。");
return;
}
- $( "#wt"+_pid ).removeClass("wtmaximize");
- $( "#w"+_pid ).css({
+ $('#wt'+_pid).removeClass("wtmaximize");
+ $('#w'+_pid).css({
"top": KWS.fullscreen.prevTop,
"left": KWS.fullscreen.prevLeft
})
KWS.fullscreen.prevHeight = null;
KWS.fullscreen.prevTop = null;
KWS.fullscreen.prevLeft = null;
+
+ if( !System.appCache[System.launchpath[_pid]].size.height ) {
+ System.qs(_pid)[0].style.height = "auto";
+ }
}
this.vacuum = function( _left, _top ){
} );
for( let i in array ){
document.getElementById(array[i].id).style.zIndex = i;
+ let _pid = String(array[i].id).substring(1);
if( i == num-1 ){
$("#"+array[i].id).addClass("windowactive");
- $("#t"+String(array[i].id).substring(1)).addClass("t-active");
- KWS.active = String(array[i].id).substring(1);
- process[array[i].id.substring(1)].isactive = true;
+ $("#t"+_pid).addClass("t-active");
+ KWS.active = _pid;
+ process[_pid].isactive = true;
+ KWS.screenPrevSwitched = new Date();
+ localStorage.setItem('kit-screentime', JSON.stringify(KWS.screenTime));
}
else{
+ console.log(_pid + '外れました');
$("#"+array[i].id).removeClass("windowactive");
- $("#t"+String(array[i].id).substring(1)).removeClass("t-active");
- process[array[i].id.substring(1)].isactive = false;
+ $("#t"+_pid).removeClass("t-active");
+ process[_pid].isactive = false;
+ if( KWS.active == _pid ){
+ let _diff = (new Date() - KWS.screenPrevSwitched);
+ let _appid = process[_pid].id
+ if( !KWS.screenTime[_appid] ) KWS.screenTime[_appid] = new Number();
+ KWS.screenTime[_appid] += _diff;
+ }
}
}
KWS.windowIndex = num;
if( _height ) $("#winc"+_pid).css("height", _height);
}
+ this.setTheme = function(_name){
+ localStorage.setItem('kit-theme', _name);
+ if(_name != 'none') $('#kit-theme-file').attr('href', `./system/theme/${localStorage.getItem('kit-theme')}`);
+ else $('#kit-theme-file').attr('href', '');
+ System.moveDesktop(currentDesktop);
+ }
+
+ this.screenTime = new Object();
+
+ this.screenPrevSwitched = new Date();
+
this.fusen = new function(){
this.fid = 0;
this.list = new Object();
}
})
$(".kit-fusen-textarea").off().on("change",function(){
- Notification.push($(this).attr("data-fid"), $(this).val(), "debug");
KWS.fusen.list[$(this).attr("data-fid")] = $(this).val();
localStorage.setItem("kit-fusen", JSON.stringify( KWS.fusen.list ));
});
},
img: _img
};
- if( _pid && System.appCache[_app] ){
- _app = `<img src='${System.launchpath[_pid]}/${System.appCache[_app].icon}'>${_app}`;
+ if( _pid && System.appCache[System.launchpath[_pid]] ){
+ _app = `<img src='${System.launchpath[_pid]}/${System.appCache[System.launchpath[_pid]].icon}'>${System.appCache[System.launchpath[_pid]].name}`;
}
if( !this.goodnight ){
if( this.sound ) System.audio.play( "n" + this.nid, this.sound );
App.d[_pid] = new Object();
this.process = process[_pid];
- this.info = System.appCache[process[_pid].id];
+ this.cache = System.appCache[System.launchpath[_pid]];
this.args = System.args[_pid];
this.close = () => System.close(_pid);
static event( _pid, _name, _event ) {
if( !App.e[_pid] ) App.e[_pid] = new Object();
- App.e[_pid][_name] = _event;
+ if( !_event && App.e[_pid][_name] ) App.e[_pid][_name].call();
+ else App.e[_pid][_name] = _event;
return App;
}
static getPath( _pid, _path ) {
+ if( String(_path)[0] != '/' ) _path = '/' + _path;
return System.launchpath[_pid] + _path;
}
$(i).attr("src", `${System.launchpath[_pid]}/${i.getAttribute("kit-src")}` );
}
if( i.hasAttribute("kit-alert") ){
- $(i).on("click", ()=> System.alert( System.appCache[ process[_pid].id ].name, i.getAttribute("kit-alert") ) );
+ $(i).on("click", ()=> System.alert( System.appCache[System.launchpath[_pid]].name, i.getAttribute("kit-alert") ) );
}
if( i.hasAttribute("kit-launch") ){
- $(i).on("click", ()=> launch( i.getAttribute("kit-launch") ) );
+ $(i).on("click", ()=> System.launch( i.getAttribute("kit-launch") ) );
}
if( i.hasAttribute("kit-close") ){
$(i).on("click", ()=> System.close( i.getAttribute("kit-close") || _pid ) );
}
static load( _pid, _path ) {
- S.dom(_pid).load( System.launchpath[_pid] +"/"+ _path, () => {
+ if( String(_path)[0] != '/' ) _path = '/' + _path;
+ _path = System.launchpath[_pid] + _path;
+ S.dom(_pid).load( _path, () => {
App.kaf(_pid);
+ let _appcache = System.appCache[System.launchpath[_pid]];
+ if( !KWS.fullscreen.pid && !_appcache.size.height ) {
+ System.qs(_pid)[0].style.height = "auto";
+ }
} );
return App;
}