Copy func
parent
4ef7190a52
commit
482f2cb06c
|
@ -13,11 +13,6 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Focus
|
|
||||||
*:focus {
|
|
||||||
.box-shadow(0, 0, 10px, #46CD46);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mixins
|
// Mixins
|
||||||
.border-radius(@radius: 5px) {
|
.border-radius(@radius: 5px) {
|
||||||
-webkit-background-clip: padding-box;
|
-webkit-background-clip: padding-box;
|
||||||
|
@ -499,7 +494,7 @@ article.snipt {
|
||||||
padding: 7px 10px 7px 35px;
|
padding: 7px 10px 7px 35px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&:hover {
|
&:hover, &.hover {
|
||||||
background-color: rgba(128, 128, 128, .18);
|
background-color: rgba(128, 128, 128, .18);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -521,6 +516,10 @@ article.snipt {
|
||||||
}
|
}
|
||||||
&.copy {
|
&.copy {
|
||||||
background-image: url('/media/images/copy-icon.png');
|
background-image: url('/media/images/copy-icon.png');
|
||||||
|
|
||||||
|
span.done {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,10 +7,17 @@
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.model = new Snipt.SniptModel();
|
this.model = new Snipt.SniptModel();
|
||||||
this.model.view = this;
|
this.model.view = this;
|
||||||
|
|
||||||
this.$el = $(this.el);
|
this.$el = $(this.el);
|
||||||
this.$container = $('div.container', this.$el);
|
|
||||||
this.$aside = $('aside', this.$el);
|
this.$aside = $('aside', this.$el);
|
||||||
this.$expand_button = $('a.expand', this.$el);
|
this.$container = $('div.container', this.$el);
|
||||||
|
this.$copy_button = $('a.copy', this.$aside);
|
||||||
|
this.$copy_do = $('span.do', this.$copy_button);
|
||||||
|
this.$copy_done = $('span.done', this.$copy_button);
|
||||||
|
this.$expand_button = $('a.expand', this.$aside);
|
||||||
|
this.$raw = $('div.raw', this.$container);
|
||||||
|
|
||||||
|
this.setupCopy();
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'click a.expand': 'expand'
|
'click a.expand': 'expand'
|
||||||
|
@ -19,6 +26,23 @@
|
||||||
this.$container.toggleClass('expanded', 100);
|
this.$container.toggleClass('expanded', 100);
|
||||||
this.$aside.toggleClass('expanded');
|
this.$aside.toggleClass('expanded');
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
setupCopy: function() {
|
||||||
|
var copy_do = this.$copy_do;
|
||||||
|
var copy_done = this.$copy_done;
|
||||||
|
|
||||||
|
this.$copy_button.zclip({
|
||||||
|
afterCopy: function() {
|
||||||
|
copy_do.hide();
|
||||||
|
copy_done.fadeIn(500);
|
||||||
|
setTimeout(function() {
|
||||||
|
copy_done.hide();
|
||||||
|
copy_do.fadeIn(500);
|
||||||
|
}, 1500);
|
||||||
|
},
|
||||||
|
copy: this.$raw.text(),
|
||||||
|
path: '/media/swfs/zero-clipboard.swf'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -17,6 +17,7 @@
|
||||||
<span class="lines">({{ snipt.get_line_count }} lines)</span>
|
<span class="lines">({{ snipt.get_line_count }} lines)</span>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class="raw">{{ snipt.code }}</div>
|
||||||
</section>
|
</section>
|
||||||
<div class="ruler top-x"></div>
|
<div class="ruler top-x"></div>
|
||||||
<div class="ruler bottom-x"></div>
|
<div class="ruler bottom-x"></div>
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
<a class="embed" href="#">Embed</a>
|
<a class="embed" href="#">Embed</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="copy" href="#">Copy</a>
|
<a class="copy" href="#"><span class="do">Copy</span><span class="done">Copied!</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<section class="tags">
|
<section class="tags">
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}js/plugins/jquery.infieldlabel.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}js/plugins/jquery.infieldlabel.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}js/plugins/jquery.hotkeys.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}js/plugins/jquery.hotkeys.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}js/plugins/jquery.ui.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}js/plugins/jquery.ui.js"></script>
|
||||||
|
<script type="text/javascript" src="{{ STATIC_URL }}js/plugins/jquery.zclip.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}js/src/application.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}js/src/application.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}js/src/modules/site.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}js/src/modules/site.js"></script>
|
||||||
<script type="text/javascript" src="{{ STATIC_URL }}js/src/modules/snipt.js"></script>
|
<script type="text/javascript" src="{{ STATIC_URL }}js/src/modules/snipt.js"></script>
|
||||||
|
|
Loading…
Reference in New Issue