Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue #6 : enable/disable new messages button #8

Merged
merged 5 commits into from
This page is out of date. Refresh to see the latest.
View
4 index.html
@@ -68,6 +68,10 @@
<b class="dotstruct" title="Highlight hovered object members"><small>p</small></b>
<b class="preserve" title="Preserve input when sending commands">w</b>
+ <!--The div and the span wrapper around the text avoid that text changes are messing
+ with click event -->
+ <b class="running" title="Preserve input when sending commands"><div></div><span>0</span></b>
+
<a class="nosel constat"> <span class="eicon">W</span> <span class="msg">Disconnected</span></a>
View
2  package.json
@@ -3,7 +3,7 @@
"name": "node-codein",
"description": "NodeJS Console Object Debug Inspector",
"keywords": ["console","inspect","inspector","object","tree","outline","viewer","debug","debugger","webkit","runtime","eval"],
- "version": "1.0.3",
+ "version": "1.1.0",
"homepage": "https://github.com/ketamynx/node-codein",
"repository": {
"type": "git",
View
100 scripts/console.js
@@ -14,7 +14,11 @@ $(document).ready(function(){
var encd = function(v){ return $('<div />').text(v).html();};
var decd = function(v){ return $('<div />').html(v).text();};
- window.clearConsole = function(){ c.val(''); return vw.html('');};
+ window.clearConsole = function(){
+ resetSkippedResponses();
+ c.val('');
+ return vw.html('');
+ };
var treefiy_obj = function(o, n, c){
var r = { data:"<span class='fn' title='"+n+"'>"+n+"</span>", state:!!c ? 'open' : 'closed', children:[] };
@@ -41,21 +45,83 @@ $(document).ready(function(){
focusLastMessage();
};
+ var skippedResponses = [];
+
+ var skippedResponsesCount = function() {
+ return skippedResponses.length;
+ };
+
+ var addSkippedResponse = function(r) {
+ skippedResponses.push(r);
+ // maybe a check should be performed on the size of skipped response
+ // here if we want to limit its size
+ };
+
+ var resetSkippedResponses = function() {
+ if (skippedResponses.length > 0) {
+ skippedResponses = [];
+ resetSkippedBeforeNextAdd = false;
+ removeSkippedReplayIcon();
+ }
+ };
+
+ var displaySkippedResponses = function() {
+ for (var i = 0; i < skippedResponsesCount(); i++) {
+ showAServerResponse(skippedResponses[i]);
+ }
+ resetSkippedResponses();
+ };
+
+ var removeSkippedReplayIcon = function() {
+ $('.replay', vw).remove();
+ }
+
+ var showAServerResponse = function(r) {
+ var resp = $('<div class="output"></div>').appendTo(vw);
+ var tpo = typeof(r.cnt);
+ if(typeof(r.fnprefix)==='string') window.fnprefix = r.fnprefix;
+ if(r.cnt===null) tpo = 'null';
+
+ switch(tpo){
+ case 'object':
+ createTreeFromObj({'[object Object]':r.cnt}, $('.autoexpand').is('.sel')).appendTo(resp);
+ break;
+ default:
+ $(formatStaticValue(r.cnt,false)).appendTo(resp);
+ break;
+ };
+ focusLastMessage();
+ };
+
+ var showAHiddenServerResponse = function(r) {
+ addSkippedResponse(r);
+ var hiddenServerResponseClass = 'skipped',
+ lastMessage = vw.find('.output:last'),
+ text = 'Warning: message skipped ('+skippedResponsesCount()+')',
+ resp;
+ if (lastMessage.hasClass(hiddenServerResponseClass)) {
+ resp = lastMessage;
+ } else {
+ var replayIcon = $('<b class="replay eicon">*</b>');
+ var warningIcon = $('<span class="eicon">W</span>');
+ replayIcon.click(function() {
+ displaySkippedResponses();
+ });
+ resp = $('<div class="warning output '+hiddenServerResponseClass+'"><span class="text-container"></span</div>').appendTo(vw);
+ resp.append(replayIcon);
+ resp.prepend(warningIcon);
+ }
+ resp.find('.text-container').text(text);
+ };
+
window.showAResponse = function(r){
- var resp = $('<div class="output"></div>').appendTo(vw);
- var tpo = typeof(r.cnt);
- if(typeof(r.fnprefix)==='string') window.fnprefix = r.fnprefix;
- if(r.cnt===null) tpo = 'null';
-
- switch(tpo){
- case 'object':
- createTreeFromObj({'[object Object]':r.cnt}, $('.autoexpand').is('.sel')).appendTo(resp);
- break;
- default:
- $(formatStaticValue(r.cnt,false)).appendTo(resp);
- break;
- };
- focusLastMessage();
+ var running = $.cookie(NS+'running');
+ if (typeof(running) === 'undefined' || running === null || running === "yes") {
+ resetSkippedResponses();
+ showAServerResponse(r);
+ } else {
+ showAHiddenServerResponse(r);
+ }
};
var doRequestForm = function(){
@@ -103,8 +169,9 @@ $(document).ready(function(){
// RESIZING CONTAINER AREA
$('#formwrap').resizable({ handles:"n", minHeight:nsr_min, maxHeight:nsr_max }).resize(function(){
// $(this).css({cursor:'row-resize'});
- $('#output_wrappr').height( $('#wrap').height()-$(this).height() );
+ //$('#output_wrappr').height( $('#wrap').height()-$(this).height() );
$.cookie(NS+'sizearea', $(this).height(), {expires: 30});
+ window.doResizeWin();
}).on('resizestop', function(){
// $(this).css({cursor:'n-resize'});
});
@@ -117,6 +184,7 @@ $(document).ready(function(){
$('#formwrap').height(nsr);
$('#output_wrappr').height( $('#wrap').height()-nsr );
+
};
window.onresize = function(){ doResizeWin(); };
doResizeWin();
View
32 scripts/tools.js
@@ -4,6 +4,7 @@ $(document).ready(function(){
var autoexp = $('.autoexpand');
var dotstruct = $('.dotstruct');
var preserve = $('.preserve');
+ var running = $('.running');
var t_sw = $('.t_dark_ui, .t_light_ui');
var vw = $('#output_viewer');
@@ -13,13 +14,17 @@ $(document).ready(function(){
if(null==how || how.toString()!=='hidden'){
swa.addClass('sel');
- $('#formwrap').show().removeClass('h'); doResizeWin();
+ $('#formwrap').show().removeClass('h');
+ window.doResizeWin();
$('#command').focus();
-
}else{
swa.removeClass('sel');
- $('#formwrap').hide('fast', function(){ $(this).addClass('h'); doResizeWin(); });
+ $('#formwrap').hide('fast', function(){
+ $(this).addClass('h');
+ window.doResizeWin();
+ });
}
+
};
var actAutoExpand = function(){
@@ -40,6 +45,22 @@ $(document).ready(function(){
else{ preserve.addClass('sel').text('x');};
}
+ var actRunning = function(){
+ var how = $.cookie(NS+'running');
+ if(null==how || how.toString()!=='no'){running.addClass('sel'); }
+ else{ running.removeClass('sel')};
+ }
+
+ var animateRunning = function(){
+ var currentValue = parseInt(running.find('span').text()),
+ how = $.cookie(NS+'running');
+ if(null==how || how.toString()!=='no') {
+ var newValue = (currentValue + 1) % 8;
+ running.find('span').text(newValue);
+ }
+ setTimeout(animateRunning, 100);
+ }
+
var actTheme = function(){
t_sw.removeClass('sel');
var how = $.cookie(NS+'theme');
@@ -86,6 +107,11 @@ $(document).ready(function(){
actPreserve();
}); actPreserve();
+ running.click(function(){
+ $.cookie(NS+'running', $(this).is('.sel') ? 'no': 'yes', {expires:30});
+ actRunning();
+ }); actRunning(); animateRunning();
+
$('.expand-all').click(function(){
var acoll = vw.find('.arrow-collapsed');
while(acoll.length){
View
11 style.css
@@ -37,8 +37,12 @@ span.fn{ display:inline-block; width:180px; text-overflow:ellipsis; white-space:
.ui-resizable-n{ height:3px;position:absolute; top:0px;left:0px; width:100%; cursor:n-resize}
.ui-resizable-n:active, .ui-resizable-n:focus{ cursor:row-resize !important;}
-.tool b, .tool b *, .eicon{font-family:"symb","Lucida Sans Unicode", "Lucida Grande", sans-serif; text-decoration:none; }
-.tool b {float:left; display:block; line-height:30px; height:30px; width:30px; font-weight:normal; font-size:16px; text-align:center; cursor:pointer;}
+.tool b, .tool b *, .eicon {font-family:"symb","Lucida Sans Unicode", "Lucida Grande", sans-serif; text-decoration:none; }
+.tool b, .tool b * {float:left; display:block; line-height:30px; height:30px; width:30px; font-weight:normal; font-size:16px; text-align:center; cursor:pointer;}
+.eicon {margin-right: 5px; margin-left: 5px; line-height:20px; height:20px; width:20px; font-weight:normal; font-size:15px; text-align:center;}
+.skipped .eicon.replay {cursor:pointer;}
+.tool b div {position: absolute; height: 30px; width: 30px; cursor:pointer;}
+
.tool b.r{ float:right; }
.tool b small{ font-size:12px; }
@@ -53,10 +57,9 @@ span.fn{ display:inline-block; width:180px; text-overflow:ellipsis; white-space:
.tool > b{ position:relative;}
.tool > b > a{ position:absolute; display:block; top:0px; left:0px; right:0px; bottom:0px; }
-.eicon{ font-size:10px; }
.jstree-closed, .jstree-open, .jstree-closed *, .jstree-open *{ cursor:default;}
-.rc10, .tool a, .tool a.nosel .eicon{ -moz-border-radius:10px; -webkit-border-radius:10px; -khtml-border-radius:10px; border-radius:10px }
+.rc10, .tool a, .tool a.nosel .eicon{position: relative; -moz-border-radius:10px; -webkit-border-radius:10px; -khtml-border-radius:10px; border-radius:10px; top: -3px}
.suggestions, .rc4{-moz-border-radius:4px; -webkit-border-radius:4px; -khtml-border-radius:4px; border-radius:4px }
.suggestions{ position:absolute; display:block; max-height:100%; overflow:hidden; padding:0 5px; min-width:200px; margin:-5px 0 -1px 10px; z-index:1001;}
Something went wrong with that request. Please try again.