-
Notifications
You must be signed in to change notification settings - Fork 410
/
app-index.html
694 lines (650 loc) · 29.1 KB
/
app-index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
<!DOCTYPE html>
<html lang="en">
<head>
<title>Rodeo</title>
<link id="rodeo-theme" href="css/styles.css" rel="stylesheet"/>
<script type="text/javascript">
window.$ = window.jQuery = require('jquery');
jQuery.fn.outerHTML = function() {
return jQuery('<div />').append(this.eq(0).clone()).html();
};
Handlebars = require("handlebars");
Handlebars.registerHelper('compare', function (lvalue, operator, rvalue, options) {
var operators, result;
if (arguments.length < 3) {
throw new Error("Handlerbars Helper 'compare' needs 2 parameters");
}
if (options === undefined) {
options = rvalue;
rvalue = operator;
operator = "===";
}
operators = {
'==': function (l, r) { return l == r; },
'===': function (l, r) { return l === r; },
'!=': function (l, r) { return l != r; },
'!==': function (l, r) { return l !== r; },
'<': function (l, r) { return l < r; },
'>': function (l, r) { return l > r; },
'<=': function (l, r) { return l <= r; },
'>=': function (l, r) { return l >= r; },
'typeof': function (l, r) { return typeof l == r; }
};
if (!operators[operator]) {
throw new Error("Handlerbars Helper 'compare' doesn't know the operator " + operator);
}
result = operators[operator](lvalue, rvalue);
if (result) {
return options.fn(this);
} else {
return options.inverse(this);
}
});
</script>
<script src="js/ace.min.js"></script>
<script src="js/main.js"></script>
<script type="text/javascript">
// Load in Handlebars templates
var preferences_template = Handlebars.templates["preferences.hbs"];
var editor_tab_template = Handlebars.templates["editor-tab.hbs"];
var editor_template = Handlebars.templates["editor.hbs"];
var active_variables_row_template = Handlebars.templates["active-variable.hbs"];
var history_row_template = Handlebars.templates["history-row.hbs"];
var package_row_template = Handlebars.templates["package-row.hbs"];
var file_template = Handlebars.templates["file-item.hbs"];
var file_search_item_template = Handlebars.templates["file-search-item.hbs"];
var wd_template = Handlebars.templates["wd.hbs"];
var shortcuts_template = Handlebars.templates["shortcuts.hbs"];
</script>
</head>
<body>
<!-- main section -->
<div id="pane-container">
<div id="left-column">
<!-- TOP LEFT -->
<div id="top-left">
<!-- editors -->
<div class="row">
<div class="col-sm-11" style="padding: 0px; margin: 0px; padding-left: 5px;">
<ul id="editorsTab" class="nav nav-tabs">
<li>
<a href="#" onclick="shell.openExternal('http://yhat.com/');">
<img src="img/rodeo-logo.png" title="Yee Haw!" style="height: 19px; padding-left: 5px;"/>
</a>
</li>
<!-- editor tabs go here -->
<li><a title="Create new file" href="#" id="add-tab"><i class="fa fa-plus-square-o"></i></a></li>
</ul>
</div>
<div class="col-sm-1" style="padding: 0px; margin: 0px;">
<ul class="nav nav-tabs">
<li><a title="Run script" id="run-button" href="#"><i class="fa fa-play-circle"></i></a></li>
</ul>
</div>
</div>
<div id="editors" class="tab-content">
</div>
<!-- end editors -->
</div>
<!-- END TOP LEFT -->
<!-- BOTTOM LEFT -->
<div id="bottom-left">
<ul id="consoleTab" class="nav nav-tabs">
<li><a><i class="fa fa-terminal"></i> Console</a></li>
</ul>
<div id="consoleTabContainer" class="tab-content">
<div class="tab-pane active in top-right" id="console-tab" style="height: 100%; overflow: hidden;">
<div id="console" style="height: 100%;"></div>
</div>
</div>
</div>
<!-- END BOTTOM LEFT -->
</div>
<div id="right-column">
<!-- TOP RIGHT -->
<div id="top-right">
<ul class="nav nav-tabs">
<li class="active"><a href="#environment" data-toggle="tab"><i class="fa fa-table"></i> Environment</a></li>
<li><a href="#history" data-toggle="tab"><i class="fa fa-history"></i> History</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane active in top-right" id="environment">
<table class="table table-bordered" style="margin-bottom: 0px;">
<thead>
<tr id="vars-header">
<th>Variable</th>
<th>Type
<a data-toggle="tooltip" data-placement="bottom" title="<p class='small'>Currently supported data types:</p><ul class='small text-left'><li>dict</li><li>list</li><li>array (numpy)</li><li>DataFrame (pandas)</li><li>Series (pandas)</li></ul>" data-html="true"><i class="fa fa-question-circle"></i></a>
</th>
<th></th>
<th></th>
</tr>
</thead>
</table>
<div id="vars-container" style="max-height: 400px; overflow: auto;">
<table class="table table-bordered">
<tbody id="vars">
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="history">
<div class="row">
<div class="col-sm-5 col-sm-offset-7">
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-search"></i></div>
<input type="text" class="form-control input-sm" id="history-search" placeholder="filter..." />
</div>
</div>
</div>
<div class="top-right history container" id="history-trail"></div>
</div>
</div>
</div>
<!-- END TOP RIGHT -->
<!-- BOTTOM RIGHT -->
<div id="bottom-right">
<ul class="nav nav-tabs">
<li class="active"><a href="#files" data-toggle="tab"><i class="fa fa-file-text-o"></i> Files</a></li>
<li><a href="#plot-window" data-toggle="tab"><i class="fa fa-bar-chart"></i> Plots</a></li>
<li><a href="#packages" data-toggle="tab"><i class="fa fa-archive"></i> Packages</a></li>
<li><a href="#help" data-toggle="tab"><i class="fa fa-life-ring"></i> Help</a></li>
<li><a href="#preferences" data-toggle="tab"><i class="fa fa-cogs"></i> Preferences</a></li>
</ul>
<div id="bottomRightTabContent" class="tab-content">
<!-- File Nav -->
<div id="files" class="tab-pane active in" style="height: 100%;">
<div id="working-directory" class="list-group" style="margin-bottom: 0px;"></div>
<div id="file-list" class="list-group" style="max-height: 100%; overflow: scroll; margin-bottom: 0px;">
</div>
</div>
<!-- End File Nav -->
<!-- Plot viewer -->
<div class="tab-pane" id="plot-window">
<a title="View previous plot" onclick="previousPlot();" class="label label-primary" title="Prevous Plot"><i class="fa fa-undo"></i></a>
<a title="View next plot" onclick="nextPlot()" class="label label-primary" title="Next Plot"><i class="fa fa-repeat"></i></a>
<a title="Open plot in new window" onclick="showPlot();" class="label label-primary" title="Zoom In"><i class="fa fa-arrows-alt"></i></a>
<a title="Save current plot to file" onclick="savePlot();" class="label label-primary" title="Export Plot" download><i class="fa fa-floppy-o"></i></a>
<a title="Delete current plot" onclick="deletePlot();" class="label label-primary" title="Delete Plot"><i class="fa fa-trash-o"></i></a>
<div clas="row">
<div class="col-sm-10" id="plots">
</div>
<div class="col-sm-2 pull-right" id="plots-minimap" style="overflow: scroll;">
</div>
</div>
</div>
<!-- End Plot viewer -->
<!-- Packages Viewer -->
<div class="tab-pane" id="packages">
<div class="row">
<div class="col-sm-4">
<button id="package-install-button" style="margin-left: 5px; margin-top: 5px;" class="btn btn-primary btn-xs" title="">
<i class="fa fa-download"></i> Install Package
</button>
</div>
<div class="col-sm-5 col-sm-offset-3">
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-search"></i></div>
<input type="text" class="form-control input-sm" id="pkg-search" placeholder="(i.e. pandas, Flask)" />
</div>
</div>
</div>
<table class="table table-bordered" style="table-layout: fixed; margin-bottom: 0px;">
<thead>
<tr>
<th>package</th>
<th>version</th>
</tr>
</thead>
</table>
<div id="packages-container" style="max-height: 400px; overflow: auto;">
<table class="table table-bordered" style="table-layout: fixed;">
<tbody id="packages-rows">
</tbody>
</table>
</div>
</div>
<!-- Packages Viewer -->
<!-- Help -->
<div class="tab-pane" id="help">
<pre style="font-size: 10px; overflow: auto;" id="help-content"><i>run help(...) for more info</i></pre>
</div>
<!-- End Help -->
<!-- Preferences -->
<div class="tab-pane" id="preferences">
</div>
<!-- End Preferences -->
</div>
</div>
</div>
<!-- END BOTTOM RIGHT -->
</div>
<!-- END main section -->
<!-- File Search Modal -->
<div id="file-search-modal" class="modal">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-body">
<div id="file-search-list">
<form id="file-search-form">
<input id="file-search-input" class="search form-control" />
<button type="submit" class="hide"></button>
</form>
<ul class="list list-group" style="list-style-type: none; max-height: 250px; overflow: scroll;"></ul>
</div>
</div>
</div>
</div>
</div>
<!-- File Search Modal -->
<!-- Package Install Modal -->
<div id="package-install-modal" class="modal">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-body">
<form class="form-inline">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><a data-toggle="tooltip" data-placement="right" title="<p class='small'>Packages are installed using <code>pip</code>. You can specify specific versions using the <code>==</code> syntax.</p>" data-html="true"><i class="fa fa-question-circle"></i></a> Package Name</div>
<input style="width: 350px;" id="package-to-install" type="text" class="form-control" placeholder="pandas, ggplot, requests, bashplotlib==0.5.2" required/>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right">install</button>
</form>
</div>
</div>
</div>
</div>
<!-- File Search Modal -->
<!-- Shortcut Display Modal -->
<div id="shortcut-display-modal" class="modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="col-sm-4 pull-right">
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-search"></i></div>
<input type="text" class="form-control input-sm" id="shortcut-search" placeholder="i.e. System, run cmd, etc." />
</div>
</div>
</div>
<div id="shortcuts" class="row">
</div>
</div>
</div>
</div>
</div>
<!-- Shortcut Display Modal -->
<!-- Tour Display Modal -->
<div id="tour-modal" class="modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<div id="tour" class="owl-carousel">
<div class="text-center">
<h3 class="text-primary">Welcome to Rodeo!</h3>
<img src="img/rodeo-logo.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">An IDE for Data Science</p>
</div>
<div class="text-center">
<h3 class="text-primary">Autocomplete Your Code</h3>
<img src="img/tour/first/autocomplete.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">Use <kbd>tab</kbd> to autocomplete code from withing the editor and the console.</p>
</div>
<div class="text-center">
<h3 class="text-primary">Plot and Analyze</h3>
<img src="img/tour/first/plots.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">View plots without leaving Rodeo. Plots can be exported to your computer or saved for later.</p>
</div>
<div class="text-center">
<h3 class="text-primary">View Datasets</h3>
<div class="row">
<div class="col-sm-6">
<img src="img/tour/first/viewer.png" style="max-width: 100%; max-height: 250px;" />
</div>
<div class="col-sm-6">
<img src="img/tour/first/viewer2.png" style="max-width: 100%; max-height: 250px;" />
</div>
</div>
<br /><br />
<p class="lead">Inspect your data using the <strong>Environment</strong> tab.</p>
</div>
<div class="text-center">
<h3 class="text-primary">Customize Your Rodeo Preferences</h3>
<img src="img/tour/first/preferences.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">Check out the <strong>Preferences</strong> tab to trick our your Rodeo. Adjust the font size, change your syntax highlighting theme, setup your default working directory, and more!</p>
</div>
<div class="text-center">
<h3 class="text-primary">Bring your vim or emacs keyboard to Rodeo</h3>
<div class="row">
<div class="col-sm-6">
<img src="img/tour/first/vim-and-emacs-1.png" style="max-width: 100%; max-height: 250px;" />
</div>
<div class="col-sm-6">
<img src="img/tour/first/vim-and-emacs-2.png" style="max-width: 100%; max-height: 250px;" />
</div>
</div>
<br /><br />
<p class="lead">Use your favorite <strong>vim or emacs</strong> shortcuts. To setup vim/emacs, visit <strong>Preferences > Editor</strong>.</p>
</div>
<div class="text-center">
<h3 class="text-primary">Setup Your Default Environment</h3>
<img src="img/tour/first/rodeo-profile.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">Create a <code>.rodeoprofile</code> to automatically load common libraries, functions, or datasets. Click <strong>CONFIGURE</strong> in the <strong>Preferences > General > Default Variables</strong> to access your <code>.rodeoprofile</code>.</p>
</div>
<div class="text-center">
<h3 class="text-primary">Pick from One of Rodeo's Themes</h3>
<img src="img/tour/first/themes.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">Select the theme that speaks to you.</p>
</div>
<div class="text-center">
<h3 class="text-primary">Loaded with Shortcuts</h3>
<img src="img/tour/first/keyboard-shortcuts.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">Shortcuts for everyting! Try <kbd>⌘</kbd> + <kbd>enter</kbd> to run code in the editor. Can't find a shortcut? No worries, visit <strong>Help > View Shortcuts</strong> to see them all!</p>
</div>
<div class="text-center">
<h3 class="text-primary">Find Files Quickly</h3>
<img src="img/tour/first/find-files.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">Looking for a particular file? Try <kbd>⌘</kbd> + <kbd>t</kbd> to search your working directory.</p>
</div>
<div class="text-center">
<h3 class="text-primary">Let's Rodeo!</h3>
<img src="img/tour/first/rodeo-celebration.png" style="max-width: 100%; max-height: 250px;" />
<br /><br />
<p class="lead">Ok looks like you're ready to go! For more help visit <a onclick="shell.openExternal('http://yhat.github.io/rodeo-docs/docs/');">the docs</a> or email <a>info@yhathq.com</a>.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Tour Display Modal -->
<script type="text/javascript" src="../src/rodeohelpers.js"></script>
<script type="text/javascript">
function track(cat, action, label, value) {
var data = { cat: cat, action: action, label: label, value: value };
ipc.send('metric', data);
}
</script>
<script type="text/javascript" src="../src/editors.js"></script>
<script type="text/javascript" src="../src/plots.js"></script>
<script type="text/javascript" src="../src/console.js"></script>
<script type="text/javascript" src="../src/metrics.js"></script>
<script type="text/javascript" src="../src/script.js"></script>
<script type="text/javascript" src="../src/preferences.js"></script>
<script type="text/javascript" src="../src/menu.js"></script>
<!-- end main section -->
<script type="text/javascript">
var fileList;
function indexFiles() {
$("#file-search-list .list li").removeClass("selected");
$("#file-search-list .list li").first().addClass("selected");
var options = { valueNames: [ 'filename' ] };
fileList = new List('file-search-list', options);
$("#file-search-form").unbind();
$("#file-search-form").submit(function(e) {
e.preventDefault();
var filename = $("#file-search-list .selected").attr("data-filename");
openFile(filename);
$("#file-search-input").val("");
$("#file-search-modal").modal("hide");
$("#file-search-list .list li").removeClass("selected");
return false;
});
}
// resizeable panes
$("#pane-container").height($(window).height());
var rc = getRC();
$("#pane-container").split({
orientation: 'vertical',
limit: 100,
position: rc.paneVertical || '50%'
});
$("#right-column").split({
orientation: 'horizontal',
limit: 100,
position: rc.paneHorizontalRight || '50%'
});
$("#left-column").split({
orientation: 'horizontal',
limit: 100,
position: rc.paneHorizontalLeft || '50%'
});
// on resize w/ gray bars, recalibrate
$(document.documentElement).bind('mouseup.splitter touchend.splitter touchleave.splitter touchcancel.spliter', function(e) {
saveWindowCalibration();
calibratePanes();
});
window.onresize = function(evt) {
calibratePanes();
};
function calibratePanes() {
$("#pane-container").height($(window).height());
// Top Left
var topLeftHeight = $("#top-left").height();
var offset = $("#top-left #editorsTab").height() + 2;
$("#top-left #editors").height(topLeftHeight - offset);
// Bottom Left
var bottomLeftHeight = $("#bottom-left").height();
var offset = $("#bottom-left #consoleTab").height() + 1;
$("#consoleTabContainer").height(bottomLeftHeight - offset);
// TODO: this is getting called constantly
// setConsoleWidth($("#console").width());
// Top Right
var offset = $("#top-right ul").height() + 1;
$("#environment").height($("#top-right").height() - offset);
$("#history").height($("#top-right").height() - offset);
// $("#vars").height($("#top-right").height()*.7);
$("#vars-container").height($("#environment").height() - offset);
// Bottom Right
var tabOffset = $("#bottom-right .nav-tabs").height() + 1;
$("#bottomRightTabContent").height($("#bottom-right").height() - tabOffset);
// files
$("#file-list").height($("#bottomRightTabContent").height() - $("#working-directory").height());
// packages
$("#packages").height($("#bottom-right").height() - tabOffset);
var offset = 42 + 30 + 1; // $("#packages table").first().height() + $("#packages .row").first().height() + 1;
$("#packages-container").height($("#packages").height() - offset);
// plots
$("#plot-window").height($("#bottom-right").height() - tabOffset);
var offset = offset + 25 + 5; //13;
$("#plots img").css("max-height", $("#bottom-right").height() - offset);
$("#plots-minimap").css("max-height", $("#bottom-right").height() - offset);
// help
$("#help-content").parent().height($("#bottom-right").height() - tabOffset);
$("#help-content").height($("#bottom-right").height() - tabOffset);
// preferences
$("#preferences").height($("#bottom-right").height() - tabOffset);
// $("#preferences .panel-body").height($("#bottom-right").height() - tabOffset);
$("#preferences").parent().height($("#bottom-right").height() - tabOffset);
$("#preferences").height($("#bottom-right").height() - tabOffset);
// scrolling fixes...
// removes stupid scroll bars on windows/linux
$("[style*=height]").css("overflow", "hidden");
// things we actually want to scroll
// top right
$("#vars-container").css("overflow-y", "scroll");
$("#history").css("overflow-y", "scroll");
// bottom right
$("#file-list").css("overflow-y", "scroll");
$("#plots-minimap").css("overflow-y", "scroll");
$("#packages-container").css("overflow-y", "scroll");
$("#help-content").css("overflow-y", "scroll");
$("#preferences").css("overflow-y", "scroll");
}
// Tab stuff
$("#add-tab").click(function(e) {
e.preventDefault();
var id;
if ($("#editors .editor").length) {
id = parseInt($("#editors .editor").last().attr("id").split("-")[1]) + 1;
} else {
id = 1;
}
var editor_tab_html = editor_tab_template({ n: id, name: "Untitled-" + id + ".py", isFirst: id==0});
var editor_html = editor_template({ n: id });
$(editor_tab_html).insertBefore($("#add-tab").parent());
$("#editors").append(editor_html);
createEditor("editor-" + id);
// set to the active tab
$("#editor-tab-" + id + " .editor-tab-a").click();
if (id!="preferences") {
ace.edit("editor-" + id).focus();
}
return false;
});
$("#run-button").click(function(e) {
e.preventDefault();
var id = $("#editors .active .editor").attr("id");
var editor = ace.edit(id);
var code = editor.getSelectedText();
// if nothing was selected, then we'll run the entire file
if (! code) {
code = editor.session.getValue();
}
jqconsole.Write(">>> " + code + '\n', 'jqconsole-old-input');
sendCommand(code);
return false;
});
function closeActiveTab(n) {
if (! $("#editor-tab-" + n + " .unsaved").hasClass("hide")) {
remote.require('dialog').showMessageBox({
type: "warning",
buttons: ["Save", "Don't Save", "Cancel"],
message: "Do you want to save the changes you've made to this file?",
detail: "Your changes will be discarded otherwise."
}, function(reply) {
if (reply==0) {
// save
saveEditor(ace.edit("editor-" + n), null, function() {
$("#editorsTab .editor-tab-a").first().click();
$("#editor-tab-" + n).remove();
$("#editor-tab-pane-" + n).remove();
});
} else if (reply==1) {
// don't save
$("#editorsTab .editor-tab-a").first().click();
$("#editor-tab-" + n).remove();
$("#editor-tab-pane-" + n).remove();
} else {
// do nothing
return;
}
});
} else {
var prevTab = $("#editor-tab-" + n).prev();
$("#editor-tab-" + n).remove();
$("#editor-tab-pane-" + n).remove();
if (prevTab && $("a", prevTab).attr("href")!="#") {
$("a", prevTab).click();
}
}
}
// basic search for history
$('#pkg-search').on('input', function() {
var query = $(this).val().toLowerCase();
if (query=="") {
$("#packages-rows tr").removeClass("hide");
} else {
$("#packages-rows tr").each(function(i, pkg) {
var packageName = $("td", pkg).first().text().toLowerCase();
if (packageName.indexOf(query) >= 0) {
$(this).removeClass("hide");
} else {
$(this).addClass("hide");
}
});
}
});
// basic search for packages
$('#history-search').on('input', function() {
var query = $(this).val().toLowerCase();
if (query=="") {
$("#history-trail p").removeClass("hide");
} else {
$("#history-trail p").each(function(i, cmd) {
var cmdText = $(cmd).text().toLowerCase();
if (cmdText.indexOf(query) >= 0) {
$(this).removeClass("hide");
} else {
$(this).addClass("hide");
}
});
}
});
$("#package-install-button").click(function(e) {
$("#package-install-modal").modal('show');
$("#package-install-modal input").focus();
});
$("#package-install-modal form").submit(function(e) {
e.preventDefault();
var command = "! pip install " + $("#package-to-install").val();
jqconsole.ClearPromptText();
jqconsole.Write(">>> " + command + '\n', 'jqconsole-old-input');
jqconsole.SetHistory(jqconsole.GetHistory().concat([command]));
sendCommand(command);
return false;
});
// setup the shortcut display modal here. we're using a handlebars
// template here are a partial (the shortcuts table is really big).
// this keeps this file a lot cleaner.
$("#shortcut-display-modal #shortcuts").append(shortcuts_template())
$("#shortcut-search").on('input', function() {
var query = $(this).val().toLowerCase();
if (query=="") {
$("#shortcuts tr .hide").removeClass("hide");
} else {
$("#shortcut-rows tr").each(function(i, shortcut) {
var text = [];
$("td", shortcut).map(function(i, el) {
text.push($(el).text());
});
text = text.join("-").toLowerCase();
if (text.indexOf(query) > -1) {
$(this).removeClass("hide");
} else {
$(this).addClass("hide");
}
});
}
});
// add preferences
var rc = getRC();
rc.keyBindings = rc.keyBindings || "default";
rc.defaultWd = rc.defaultWd || USER_HOME;
if (rc.trackingOn!=false) {
rc.trackingOn = true;
}
var preferences_html = preferences_template(rc);
$("#preferences").append(preferences_html);
$("#tour").owlCarousel({ singleItem: true });
</script>
<script type="text/javascript">
track('application', 'open');
// initialize all tooltips
$('[data-toggle="tooltip"]').tooltip();
// not sure why but this needs to happen last AND after everything else happens
setTimeout(function() { $("#add-tab").click(); }, 600);
setTimeout(calibratePanes, 500);
// tell server if we're online or offline
var ipc = require('ipc');
var updateOnlineStatus = function() {
ipc.send('online-status-changed', navigator.onLine ? 'online' : 'offline');
};
// send initial status
ipc.send('online-status-changed', navigator.onLine ? 'online' : 'offline');
// send subsequent changes to status
window.addEventListener('online', updateOnlineStatus);
window.addEventListener('offline', updateOnlineStatus);
</script>
</body>
</html>