browser_app_base 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,70 +10,67 @@
10
10
  <!-- jQuery UI -->
11
11
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
12
12
  <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
13
-
14
13
  <script src="js/main.js"></script>
15
- <link rel="stylesheet" href="css/index.css" type="text/css">
14
+ <link rel="stylesheet" href="../css/index.css" type="text/css">
16
15
  </head>
17
16
 
18
17
  <body>
19
- <div id="msg_dialog" style="display:none;">
18
+ <div id="msg_dialog" class="dialog" style="display:none;">
20
19
  <div id="msg_text">message</div>
21
20
  </div>
22
- <h4>RubyAppBase</h4>
23
- <hr>
24
- <!-- menu -->
25
- <div id="setting_dialog" style="display:none;">
26
- <dl id="wrap"></dl>
27
- </div>
28
- <div>
29
- <ul class="menu">
30
- <Li><a href="#" id="exec" name="exec">実行</a></li>
31
- <li><a href="#" id="stop" name="stop">停止</a></li>
32
- <li>
21
+ <div class="main-title-row">
22
+ <h2 class="main-title">RubyAppBase</h2>
23
+ <div class="main-title-actions">
24
+ <a href="#" id="exec" name="exec" class="btn primary">実行</a>
25
+ <a href="#" id="stop" name="stop" class="btn danger">停止</a>
26
+ <div class="btn primary menu-title" style="position:relative;">
33
27
  設定
34
- <ul class="menuSub">
28
+ <ul class="menuSub" style="right:0; left:auto; min-width:120px;">
35
29
  <li><a href="#" id="setting">設定</a></li>
36
30
  <li><a href="#" id="save_setting">設定保存</a></li>
37
31
  <li><a href="#" id="load_setting">設定読み込み</a></li>
38
32
  </ul>
39
- </li>
40
- <!--
41
- <li>
42
- menu3
43
- <ul class="menuSub">
44
- <li><a href="#">menu3-1</a></li>
45
- <li><a href="#">menu3-2</a></li>
46
- </ul>
47
- </li>
48
- -->
49
- </ul>
33
+ </div>
34
+ </div>
50
35
  </div>
51
-
52
- <div id="dialog1" style="display:none;">
53
- <input class="inarea" type="search" name="search_str" id="search_str">
36
+ <hr>
37
+ <div id="setting_dialog" class="dialog" style="display:none;">
38
+ <dl id="wrap"></dl>
54
39
  </div>
55
- <table>
56
- <tr>
57
- <td class="long"><input class="inarea" type="search" id="upFile" name="upFile"></td>
58
- <td><input type="button" id="select_file" value="ファイル選択" /></td>
59
- </tr>
60
- </table>
61
40
 
62
- <div id="dialog2" style="display:none;">
63
- <input class="inarea" type="search" name="search_str2" id="search_str2">
64
- </div>
65
- <table>
66
- <tr>
67
- <td class="long"><input class="inarea" type="search" id="upDir" name="upDir"></td>
68
- <td><input type="button" id="select_dir" value="フォルダ選択" /></td>
69
- </tr>
70
- </table>
41
+ <section class="input-section">
42
+ <div id="dialog1" class="dialog" style="display:none;">
43
+ <input class="inarea" type="search" name="search_str" id="search_str">
44
+ </div>
45
+ <table>
46
+ <tr>
47
+ <td class="long">
48
+ <input class="inarea" type="search" id="upFile" name="upFile" placeholder="ファイルを選択...">
49
+ </td>
50
+ <td>
51
+ <input type="button" id="select_file" value="ファイル選択" class="btn secondary" />
52
+ </td>
53
+ </tr>
54
+ </table>
71
55
 
72
- <div class="outarea">
73
- <ul name="log" id="log" class="log">
74
- </ul>
75
- </div>
56
+ <div id="dialog2" class="dialog" style="display:none;">
57
+ <input class="inarea" type="search" name="search_str2" id="search_str2">
58
+ </div>
59
+ <table>
60
+ <tr>
61
+ <td class="long">
62
+ <input class="inarea" type="search" id="upDir" name="upDir" placeholder="フォルダを選択...">
63
+ </td>
64
+ <td>
65
+ <input type="button" id="select_dir" value="フォルダ選択" class="btn secondary" />
66
+ </td>
67
+ </tr>
68
+ </table>
69
+ </section>
76
70
 
71
+ <section class="outarea">
72
+ <ul name="log" id="log" class="log"></ul>
73
+ </section>
77
74
  </body>
78
75
 
79
76
  </html>
@@ -78,7 +78,10 @@ function server_connect(url) {
78
78
  open_dialog("<font color='red'>エラーが発生しました</font>");
79
79
  }
80
80
  else if (evt.data.match(/^popup:/)) {
81
- open_dialog(evt.data.replace(/^popup:/, ""), 3000);
81
+ console.log("str=" + evt.data);
82
+ const timeout_str = evt.data.match(/:(\d+):/);
83
+ console.log("timeout_str=" + timeout_str[1]);
84
+ open_dialog(evt.data.replace(/^popup:(\d+):/, ""), Number(timeout_str[1]));
82
85
  } else {
83
86
  var log = "<li>" + evt.data + "</li>";
84
87
  $('#log').append(log);
@@ -177,21 +180,30 @@ function select_file_dialog(search_id, file_kind, dialog_id, select_file, file_n
177
180
  $("#" + search_id).val($("#" + file_name).val());
178
181
  $("#" + dialog_id).dialog({
179
182
  modal: true
180
- , show: "slide" //表示時のアニメーション
181
- , hide: "explode" //閉じた時のアニメーション
182
- , title: "Select File" //ダイアログのタイトル
183
- , width: 580 //ダイアログの横幅
184
- , height: 400 //ダイアログの高さ
185
- , resizable: true //リサイズ可
186
- , closeOnEscape: false //[ESC]キーで閉じられなくする
187
- , draggable: true //ダイアログの移動を可に
183
+ , show: "slide"
184
+ , hide: "explode"
185
+ , title: "Select File"
186
+ , width: 580
187
+ , height: 400
188
+ , resizable: true
189
+ , closeOnEscape: false
190
+ , draggable: true
191
+ , open: function (event, ui) {
192
+ // ダイアログの高さを取得
193
+ var dialogHeight = $("#" + dialog_id).height();
194
+ // オートコンプリートリストの高さをダイアログに合わせる
195
+ $(".ui-autocomplete").css({
196
+ "max-height": dialogHeight + "px",
197
+ "overflow-y": "auto"
198
+ });
199
+ }
188
200
  , buttons: {
189
- "OK": function () { //OKボタン
201
+ "OK": function () {
190
202
  $("#" + file_name).val($("#" + search_id).val());
191
203
  $(this).dialog("close");
192
204
  $("#" + search_id).autocomplete("destroy");
193
205
  },
194
- "Cancel": function () { //Cancelボタン
206
+ "Cancel": function () {
195
207
  $(this).dialog("close");
196
208
  $("#" + search_id).autocomplete("destroy");
197
209
  }
@@ -202,6 +214,8 @@ function select_file_dialog(search_id, file_kind, dialog_id, select_file, file_n
202
214
 
203
215
  function setting_dialog(open_id, dialog_id, json_file) {
204
216
  var version;
217
+ var is_error = false;
218
+
205
219
  $("#" + open_id).click(function () {
206
220
  $("#" + dialog_id).val = $(function () {
207
221
  $("dl#wrap").empty();
@@ -214,6 +228,14 @@ function setting_dialog(open_id, dialog_id, json_file) {
214
228
  + "<td><input class='setting_value' type='text' " + "id=" + s["setting_list"][i].name + "_value " + "value=" + "'" + s["setting_list"][i].value + "'" + ">"
215
229
  + "</td></tr></table>"
216
230
  $("dl#wrap").append(h);
231
+ } else if (s["setting_list"][i].type == "textarea") {
232
+ var h = "<table><tr>"
233
+ + "<td class='setting_name'>" + s["setting_list"][i].description + "</td>"
234
+ + "<td><textarea class='setting_value' rows='5' " + "id=" + s["setting_list"][i].name + "_value " + "value=" + ">"
235
+ + "" + JSON.stringify(s["setting_list"][i].value, null, 2)
236
+ + "</textarea>"
237
+ + "</td></tr></table>"
238
+ $("dl#wrap").append(h);
217
239
  } else if (s["setting_list"][i].type == "checkbox") {
218
240
  var h = "<table><tr>";
219
241
  h += "<td class='setting_name'>" + s["setting_list"][i].description + "</td>";
@@ -249,8 +271,8 @@ function setting_dialog(open_id, dialog_id, json_file) {
249
271
  , show: "slide" //表示時のアニメーション
250
272
  , hide: "explode" //閉じた時のアニメーション
251
273
  , title: "Setting" //ダイアログのタイトル
252
- , width: 580 //ダイアログの横幅
253
- , height: 400 //ダイアログの高さ
274
+ , width: 650 //ダイアログの横幅
275
+ , height: 600 //ダイアログの高さ
254
276
  , resizable: true //リサイズ可
255
277
  , closeOnEscape: false //[ESC]キーで閉じられなくする
256
278
  , draggable: true //ダイアログの移動を可に
@@ -258,6 +280,7 @@ function setting_dialog(open_id, dialog_id, json_file) {
258
280
  "OK": function () { //OKボタン
259
281
  var json_obj = {};
260
282
  var json_data = [];
283
+ is_error = false;
261
284
  $.getJSON(json_file, function (s) {
262
285
  json_obj["version"] = s["version"];
263
286
  for (var i in s["setting_list"]) {
@@ -271,6 +294,20 @@ function setting_dialog(open_id, dialog_id, json_file) {
271
294
  data["description"] = s["setting_list"][i].description;
272
295
  json_data.push(data);
273
296
  }
297
+ else if (s["setting_list"][i].type == "textarea") {
298
+ var data = {};
299
+ data["name"] = s["setting_list"][i].name;
300
+ try {
301
+ data["value"] = JSON.parse($("#" + s["setting_list"][i].name + "_value").val());
302
+ } catch (e) {
303
+ is_error = true;
304
+ alert("JavaScript error:" + e.message + "\n" + $("#" + s["setting_list"][i].name + "_value").val());
305
+ }
306
+ data["type"] = s["setting_list"][i].type;
307
+ data["select"] = s["setting_list"][i].select;
308
+ data["description"] = s["setting_list"][i].description;
309
+ json_data.push(data);
310
+ }
274
311
  else if (s["setting_list"][i].type == "checkbox") {
275
312
  var data = {};
276
313
  data["name"] = s["setting_list"][i].name;
@@ -295,6 +332,7 @@ function setting_dialog(open_id, dialog_id, json_file) {
295
332
  //console.log("type=" + s["setting_list"][i].type);
296
333
  }
297
334
  }
335
+ console.log("OK Button " + is_error);
298
336
  // Jsonデータをサーバに送信
299
337
  json_obj["setting_list"] = json_data;
300
338
  $ws.send("setting:" + JSON.stringify(json_obj));
@@ -302,6 +340,7 @@ function setting_dialog(open_id, dialog_id, json_file) {
302
340
  $(this).dialog("close");
303
341
  },
304
342
  "Cancel": function () { //Cancelボタン
343
+ console.log("Cancel Button");
305
344
  $(this).dialog("close");
306
345
  }
307
346
  }
@@ -381,10 +420,10 @@ function openFile(file) {
381
420
  $(document).ready(function () {
382
421
 
383
422
  // サーバに接続
384
- server_connect("ws://localhost:35983/wsserver")
423
+ server_connect("ws://localhost:34921/wsserver")
385
424
  window.onload = function (e) {
386
425
  // サーバに接続
387
- //server_connect("ws://localhost:35983/wsserver")
426
+ //server_connect("ws://localhost:34921/wsserver")
388
427
  }
389
428
 
390
429
  // menu
@@ -405,14 +444,14 @@ $(document).ready(function () {
405
444
  var width = 800;
406
445
  var height = 600;
407
446
  $(window).resize(function () {
408
- $(".outarea").height($(window).height() - 220);
447
+ //$(".outarea").height($(window).height() - 220);
409
448
  });
410
449
  // ウインドウの位置
411
450
  $(function () {
412
- window.resizeTo(width, height);
413
- window.moveTo((window.screen.width / 2) - (width / 2), (screen.height / 2) - (height / 2));
414
- //window.moveTo(0,0);
415
- $(".outarea").height($(window).height() - 220);
451
+ // window.resizeTo(width, height);
452
+ // window.moveTo((window.screen.width / 2) - (width / 2), (screen.height / 2) - (height / 2));
453
+ // //window.moveTo(0,0);
454
+ // $(".outarea").height($(window).height() - 220);
416
455
  });
417
456
 
418
457
  $('.outarea').scroll(function () {
@@ -53,6 +53,16 @@ class Search < Sinatra::Base
53
53
  data["value"] = File.expand_path(file)
54
54
  res.push data
55
55
  end
56
+ if 0 == res.select { |dir| dir["label"] == "../" }.size
57
+ data = {}
58
+ pp = Pathname(File.expand_path("#{dir}/#{file}"))
59
+ data["label"] = "../"
60
+ data["label"] += "/" if pp.parent == "/"
61
+ data["value"] = pp.parent.to_s
62
+ data["value"] = "/" if data["value"] =~ /^[\/]+$/
63
+ #puts "value = #{pp.parent.to_s}"
64
+ res.push data
65
+ end
56
66
  JSON.generate res.sort { |a, b| a["value"] <=> b["value"] }
57
67
  end
58
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser_app_base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - masataka kuwayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-11 00:00:00.000000000 Z
11
+ date: 2025-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra