Skip to content

Commit

Permalink
Format the Media Query rule so the copy / paste behaves in a way that…
Browse files Browse the repository at this point in the history
… is usable. Copy / paste function strips the media query rules.
  • Loading branch information
Chris Roberts committed Apr 29, 2012
1 parent bc8ca60 commit 46b5da6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 5 additions & 1 deletion css/stylesheet.css
Expand Up @@ -437,4 +437,8 @@ left: auto;
color:black; color:black;
} }
#save { color: white; #save { color: white;
border-color: white; } border-color: white; }

#mq {
top: -16px;
}
15 changes: 5 additions & 10 deletions index.html
Expand Up @@ -328,16 +328,11 @@ <h1>


<div id="media_query" class="rule_wrapper"> <div id="media_query" class="rule_wrapper">
<pre class="rule comment">/* <a class="cb">[to clipboard]</a><!-- <a class="off">[toggle rule off]</a>--> <span class="endcomment">*/</span></pre> <pre class="rule comment">/* <a class="cb">[to clipboard]</a><!-- <a class="off">[toggle rule off]</a>--> <span class="endcomment">*/</span></pre>
<pre class="rule"> <pre class="rule" id="mq"><span class="declaration-block">
@media screen and (max-width: 510px) { @media all and ( max-width: <b g="0">480px</b> ) {
#sandboxwrap { #sandboxwrap { position: static; left: 25px; }
position: static; #sandbox { width: 100%; }
left: 25px; }</span></pre>
}
#sandbox {
width: 100%;
}
}</pre>
<!-- <pre class="rule comment commentclose"><span class="comment">/* */</span></pre> --> <!-- <pre class="rule comment commentclose"><span class="comment">/* */</span></pre> -->
</div> </div>


Expand Down
7 changes: 4 additions & 3 deletions javascript/javascript.js
Expand Up @@ -379,10 +379,11 @@ function copypasta(){
zc.addEventListener( 'mouseDown', (function(){ zc.addEventListener( 'mouseDown', (function(){
return function(client) { return function(client) {
var text = elem.closest("pre") var text = elem.closest("pre")
.nextAll('pre.rule').eq(0).find('.declaration-block').text(); .nextAll('pre.rule').eq(0).find('.declaration-block').eq(0).text();
text = text.replace(/ \/\*.*?\*\//g,''); // strip comments text = text.replace(/ \/\*.*?\*\//g,''); // strip comments
zc.setText( text ); text = text.replace(/ \#sandbox.*?\}/g, '') // strip declarations from mq
$(elem).fadeOut(50).fadeIn(300) zc.setText( text );
$(elem).fadeOut(50).fadeIn(300)
} }
})()); })());
}); });
Expand Down

0 comments on commit 46b5da6

Please sign in to comment.