Permalink
Browse files

comment stripping

  • Loading branch information...
1 parent 35d3a99 commit 27ba919ba35c33402f54774c2e1b02c9b5b9c97f Andrew Ray committed Aug 31, 2011
Showing with 30 additions and 6 deletions.
  1. +1 −0 builder.css
  2. +21 −4 builder.js
  3. +8 −2 index.html
View
@@ -192,6 +192,7 @@ transition:all 0.52s ease-out;}
.options .group {padding:2px 0; margin:4px 0 0; float:left; clear:both;}
.group label {cursor:pointer; color:#444; padding:0 0 0 2px;}
.group label:hover {color:#000;}
+.group.general .header {float:none; background:#eee; border-radius:20px; padding:3px 12px; display:block; margin:12px 0;}
.config.characters {width:250px;}
.config.characters input {font-family:monospace; float:left; width:25px; text-align:center;}
.config.characters label {margin-left:1px; display:block; float:left; padding:8px 10px 4px; }
View
@@ -146,6 +146,11 @@
keyup: updateNoBranchText
});
+ $('comments').addEvents({
+ click: toggleComments,
+ change: toggleComments
+ });
+
$$('input[type="checkbox"]').addEvents({
mouseover: updateDescription.bindWithEvent(this),
'fun-change': function(evt) {
@@ -165,7 +170,14 @@
updateLink();
}
- }).set('checked', 'checked').funForm();
+ }).each(function($cb) {
+ if($cb.id == 'comments') {
+ $cb.set('checked', false);
+ } else {
+ $cb.set('checked', 'checked')
+ }
+ $cb.funForm();
+ });
$$('input[type="text"]').addEvent('mouseover', updateDescription.bindWithEvent(this));
$$('.config label').addEvent('mouseover', updateDescription.bindWithEvent(this));
@@ -192,9 +204,10 @@
.replace(/([a-zA-Z_]+)=/, '<span class="line-def">$1</span><span class="operator">=</span>')
.replace(/\b(if|then|fi)\b/g, '<span class="keyword">$1</span>')
.replace(/(\$[a-zA-Z_]+)/g, '<span class="variable">$1</span>')
- .replace(/(#(.+|$))/, '<span class="comment">$1</span>')
- .replace(/#([a-zA-Z_0-9]+)#/, '<span id="$1"></span>'))
- + '<br />';
+ .replace(/(#(.+|$))/, '<span class="comment">$1<br /></span>')
+ .replace(/#([a-zA-Z_0-9]+)#/, '<span id="$1"></span>'));
+
+ newLine += (newLine.indexOf('class="comment"') == -1 ? '<br />' : '');
if(current && !current.indexOf('option-')) {
newLine = newLine.replace(/>(['"])([^'"]+)(['"]?)<br/, '>$1<span class="configurable ' + current + '">$2</span>$3<br');
@@ -311,6 +324,10 @@
$('auto_url').set('text', getLink());
}
+ function toggleComments() {
+ $$('.comment')[this.checked ? 'hide' : 'show']();
+ }
+
function deselect() {
if (document.selection) {
document.selection.empty();
View
@@ -81,7 +81,7 @@ <h2 id="nav-options">Options </h2>
</div>
</div>
- <div class="config config-git">
+ <div class="config config-hg">
<div class="group">
<input type="checkbox" value="hg" id="hg" data-toggle="hg-patches hg-prefix hg-revno hg-modified hg-conflicted hg-bisect" checked="checked" />
<label for="hg">Mercurial</label>
@@ -120,7 +120,7 @@ <h2 id="nav-options">Options </h2>
</div>
</div>
- <div class="config config-git">
+ <div class="config config-svn">
<div class="group">
<input type="checkbox" value="svn" id="svn" data-toggle="svn-revno svn-modified" checked="checked" />
<label for="svn">Subversion</label>
@@ -137,6 +137,12 @@ <h2 id="nav-options">Options </h2>
<label for="svn-revno">Revision ID<label>
</div>
</div>
+
+ <div class="group general">
+ <label class="header">General Options</label>
+ <input type="checkbox" value="comments" id="comments" />
+ <label for="comments">Strip all comments</label>
+ </div>
</div>
<div class="config characters">

0 comments on commit 27ba919

Please sign in to comment.