Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

Hi! I cleaned up your code for you! #11

Merged
merged 1 commit into from
Oct 31, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Logs and databases #
######################
*.log

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
18 changes: 9 additions & 9 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Options available:
top. Currently disabled.

charInsertTrigger function Predicate for whether to allow
character insertion.
character insertion.
charInsertTrigger(char,line) is called.

cancelHandle function Handle a user-signaled interrupt.
Expand All @@ -59,14 +59,14 @@ are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.


16 changes: 8 additions & 8 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@
<style type="text/css" media="screen">
/* First console */
div.console1 { font-size: 14px }
div.console1 div.jquery-console-inner
div.console1 div.jquery-console-inner
{ width:900px; height:200px; background:#333; padding:0.5em;
overflow:auto }
div.console1 div.jquery-console-prompt-box
{ color:#fff; font-family:monospace; }
div.console1 div.jquery-console-focus span.jquery-console-cursor
div.console1 div.jquery-console-focus span.jquery-console-cursor
{ background:#fefefe; color:#333; font-weight:bold }
div.console1 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
Expand All @@ -126,12 +126,12 @@
div.console1 span.jquery-console-prompt-label { font-weight:bold }
/* Second console */
div.console2 { font-size: 14px; margin-top:1em }
div.console2 div.jquery-console-inner
div.console2 div.jquery-console-inner
{ width:900px; height:200px; background:#efefef; padding:0.5em;
overflow:auto }
div.console2 div.jquery-console-prompt-box
{ color:#444; font-family:monospace; }
div.console2 div.jquery-console-focus span.jquery-console-cursor
div.console2 div.jquery-console-focus span.jquery-console-cursor
{ background:#333; color:#eee; font-weight:bold }
div.console2 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
Expand All @@ -142,12 +142,12 @@
div.console2 span.jquery-console-prompt-label { font-weight:bold }
/* Third console */
div.console3 { font-size: 14px; margin-top:1em }
div.console3 div.jquery-console-inner
div.console3 div.jquery-console-inner
{ width:900px; height:200px; background:#efefef; padding:0.5em;
overflow:auto }
div.console3 div.jquery-console-prompt-box
{ color:#444; font-family:monospace; }
div.console3 div.jquery-console-focus span.jquery-console-cursor
div.console3 div.jquery-console-focus span.jquery-console-cursor
{ background:#333; color:#eee; font-weight:bold }
div.console3 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
Expand All @@ -159,12 +159,12 @@
font-weight:bold }
/* Fourth console */
div.console4 { font-size: 14px; margin-top:1em }
div.console4 div.jquery-console-inner
div.console4 div.jquery-console-inner
{ width:900px; height:200px; background:#efefef; padding:0.5em;
overflow:auto }
div.console4 div.jquery-console-prompt-box
{ color:#444; font-family:monospace; }
div.console4 div.jquery-console-focus span.jquery-console-cursor
div.console4 div.jquery-console-focus span.jquery-console-cursor
{ background:#444; color:#eee; font-weight:bold }
div.console4 div.jquery-console-message-error
{ color:#ef0505; font-family:sans-serif; font-weight:bold;
Expand Down
32 changes: 16 additions & 16 deletions jquery.console.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

// TESTED ON
Expand Down Expand Up @@ -187,7 +187,7 @@
n.remove();
});
},4000);
else if (style=='prompt') {
else if (style=='prompt') {
var a = $('<br/><div class="action"><a href="javascript:">OK</a><div class="clear"></div></div>');
n.append(a);
focused = false;
Expand Down Expand Up @@ -236,7 +236,7 @@
inner.removeClass('jquery-console-focus');
inner.addClass('jquery-console-nofocus');
});

////////////////////////////////////////////////////////////////////////
// Bind to the paste event of the input box so we know when we
// get pasted data
Expand All @@ -250,7 +250,7 @@
typer.val("");
}, 0);
});

////////////////////////////////////////////////////////////////////////
// Handle key hit before translation
// For picking up control characters like up/left/down/right
Expand Down Expand Up @@ -280,7 +280,7 @@
}
}
});

////////////////////////////////////////////////////////////////////////
// Handle key press
typer.keypress(function(e){
Expand Down Expand Up @@ -364,7 +364,7 @@
updatePromptDisplay();
}
};

function forwardDelete() {
if (deleteCharAtPos())
updatePromptDisplay();
Expand Down Expand Up @@ -509,7 +509,7 @@
restoreText = promptText;
updatePromptDisplay();
};

////////////////////////////////////////////////////////////////////////
// Move to another column relative to this one
// Negative means go back, positive means go forward.
Expand Down Expand Up @@ -609,7 +609,7 @@
var before = line.substring(0, column);
var current = line.substring(column,column+1);
if (current){
current =
current =
'<span class="jquery-console-cursor">' +
htmlEncode(current) +
'</span>';
Expand All @@ -620,7 +620,7 @@
prompt.html(html);
scrollToBottom();
};

// Simple HTML encoding
// Simply replace '<', '>' and '&'
// TODO: Use jQuery's .html() trick, or grab a proper, fast
Expand Down