Permalink
Browse files

Implemented help popup and command confirmation

  • Loading branch information...
1 parent 49cdaa7 commit 851f5fcb104cdc0693ef56a116dff372d53d3ad5 @mitotic committed Sep 14, 2012
Showing with 24 additions and 4 deletions.
  1. +2 −2 graphterm/www/graphterm.css
  2. +16 −2 graphterm/www/graphterm.js
  3. +6 −0 graphterm/www/index.html
@@ -268,7 +268,7 @@ img.gterm-blockimg {
display: none;
}
-span.gterm-link, a.gterm-link, span.gterm-blockseqlink {
+span.gterm-link, a.gterm-link, span.gterm-help-link, span.gterm-blockseqlink {
color: blue;
cursor: pointer;
text-decoration: none;
@@ -399,7 +399,7 @@ input.gterm-input-arg[type=text] {
.gterm-popupshrink {
max-width: 90%;
width: auto;
- background-color: #eeeeee;
+ background-color: #ffffff;
moz-box-shadow: 0 0 10px rgba(0,0,0,.4);
webkit-box-shadow: 0 0 10px rgba(0,0,0,.4);
-box-shadow: 0 0 10px rgba(0,0,0,.4);
View
@@ -871,7 +871,7 @@ GTWebSocket.prototype.onmessage = function(evt) {
if (response_params.form_input) {
newElem.find(".gterm-form-button").bindclick(GTFormSubmit);
- newElem.find(".gterm-form-label").bind("hover", GTFormHelp);
+ newElem.find(".gterm-help-link").bindclick(GTHelpLink);
}
if (response_params.autosize)
@@ -1545,6 +1545,13 @@ function gtermLinkClickHandler(event) {
}
function gtermPageletClickHandler(event) {
+ var confirm = $(this).attr("data-gtermconfirm");
+ if (confirm) {
+ if (!window.confirm(confirm)) {
+ return false;
+ }
+ }
+
var contextMenu = gControlActive;
GTReceivedUserInput("click");
var text = $(this).text();
@@ -1560,6 +1567,7 @@ function gtermPageletClickHandler(event) {
options.command = $(this).attr("data-gtermcmd");
var cd_command = (options.command.indexOf("cd ") == 0);
options.clear_last = (pagelet.length && cd_command) ? pagelet.attr("data-gtermpromptindex") : "0";
+
gtermClickPaste("", file_url, options);
//console.log("gtermPageletClickHandler", file_url, options);
return false;
@@ -2173,8 +2181,14 @@ function GTEndForm(text, cancel) {
gFormIndex = null;
}
-function GTFormHelp(evt) {
+function GTHelpLink(evt) {
var helpStr = $(this).attr("data-gtermhelp");
+ if (helpStr) {
+ var html = '<div class="gterm-help gterm-prewrap">'+GTPreserveLinebreaks(GTEscape(helpStr))+'</div>';
+ $("#gterm-helparea-content").html(html);
+ popupShow("#gterm-helparea", null, null, "help");
+ }
+ return false;
}
function GTFormSubmit(evt) {
View
@@ -206,6 +206,12 @@ <h3 class="gtermsplashalt">GraphTerm was developed as part of the Mindmeldr proj
<div name="gterm-alertarea-content" id="gterm-alertarea-content"></div>
</div> <!-- gterm-alertarea -->
+<div id="gterm-helparea" class="gterm-popup gterm-popupshrink">
+ <span class="gterm-popupclose">&#215;</span>
+ <p>
+ <div name="gterm-helparea-content" id="gterm-helparea-content"></div>
+</div> <!-- gterm-helparea -->
+
<div id="gterm-pastearea" class="gterm-popup">
<button class="gterm-popupbutton" name="paste_text">Paste text</button>
<button class="gterm-popupbutton" name="cancel">Cancel</button>

0 comments on commit 851f5fc

Please sign in to comment.