lib/template/js/main.js in browser_app_base-0.0.9 vs lib/template/js/main.js in browser_app_base-0.1.0
- old
+ new
@@ -1,30 +1,39 @@
// main.js
var $ws = null;
var $auto_scroll = true;
var dialog = null;
+var dialog_timeout = null;
-function open_dialog(msg) {
+function open_dialog(msg, timeout = 0) {
console.log("msg=" + msg);
$("#msg_text").html(msg);
- $("#msg_dialog").dialog({
+ d = $("#msg_dialog").dialog({
modal: true
, show: "slide" //表示時のアニメーション
, hide: "slide" //閉じた時のアニメーション
, title: "Message" //ダイアログのタイトル
- , width: 400 //ダイアログの横幅
- , height: 200 //ダイアログの高さ
+ , width: 500 //ダイアログの横幅
+ , height: 300 //ダイアログの高さ
, resizable: true //リサイズ可
, closeOnEscape: false //[ESC]キーで閉じられなくする
, draggable: true //ダイアログの移動を可に
, buttons: {
"OK": function () { //Cancelボタン
+ if (dialog_timeout != null) {
+ clearTimeout(dialog_timeout);
+ }
$(this).dialog("close");
}
}
});
+ if (timeout != 0) {
+ dialog_timeout = setTimeout(function () {
+ d.dialog("close");
+ }, timeout);
+ }
}
function open_dialog_org(msg) {
var top = window.screenTop + 10;
var left = window.screenLeft + 10;
@@ -60,15 +69,18 @@
file_name = evt.data.replace(/^startup:/, "");
}
else if (evt.data.match(/^app_end:normal/)) {
open_dialog("終了しました");
}
+ else if (evt.data.match(/^app_end:stop/)) {
+ open_dialog("中止しました");
+ }
else if (evt.data.match(/^app_end:error/)) {
open_dialog("<font color='red'>エラーが発生しました</font>");
}
else if (evt.data.match(/^popup:/)) {
- open_dialog(evt.data.replace(/^popup:/, ""));
+ open_dialog(evt.data.replace(/^popup:/, ""), 3000);
} else {
var log = "<li>" + evt.data + "</li>";
$('#log').append(log);
if ($auto_scroll) {
$('.outarea').scrollTop($('.outarea').get(0).scrollHeight);
@@ -101,11 +113,11 @@
//jQuery(this).autocomplete("search", "");
$(this).keydown();
},
source: function (req, resp) {
$.ajax({
- url: "http://localhost:61047/search?path=" + $("#" + id).val() + "&kind=" + file_kind,
+ url: "http://localhost:36809/search?path=" + $("#" + id).val() + "&kind=" + file_kind,
type: "GET",
cache: false,
dataType: "json",
data: {
param1: req.term
@@ -134,11 +146,11 @@
jQuery("#" + id).val(ui.item.value);
$(this).keydown();
},
source: function (req, resp) {
$.ajax({
- url: "http://localhost:61047/history/" + file_name,
+ url: "http://localhost:36809/history/" + file_name,
type: "POST",
cache: false,
dataType: "json",
data: {
param1: req.term
@@ -195,11 +207,11 @@
$.getJSON(json_file, function (s) {
for (var i in s) {
if (s[i].type == "input") {
var h = "<table><tr>"
+ "<td class='setting_name'>" + s[i].description + "</td>"
- + "<td><input class='setting_value' type='text' " + "id=" + s[i].name + "_value " + "value=" + s[i].value + ">"
+ + "<td><input class='setting_value' type='text' " + "id=" + s[i].name + "_value " + "value=" + "'" + s[i].value + "'" + ">"
+ "</td></tr></table>"
$("dl#wrap").append(h);
} else if (s[i].type == "checkbox") {
var h = "<table><tr>";
h += "<td class='setting_name'>" + s[i].description + "</td>";
@@ -312,10 +324,10 @@
$(document).ready(function () {
window.onload = function (e) {
console.log("onload");
// サーバに接続
- server_connect("ws://localhost:61047/wsserver")
+ server_connect("ws://localhost:36809/wsserver")
}
// ウインドウサイズ
var width = 800;
var height = 600;