Permalink
Browse files

Use ZeroClipboard library to copy URL to clipboard when clicked

  • Loading branch information...
oliversong committed Oct 19, 2013
1 parent 8849d61 commit 1d95a9797726627185b46761a6d1168ae13a9176

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -126,9 +126,38 @@ h3 {
.space-below2 {
margin-bottom: 60px;
}
-.myUrl {
- width: 100%;
+#myUrl {
+ width: 60%;
height: 100%;
+ -webkit-border-radius: 4px 0 0 4px;
+ -moz-border-radius: 4px 0 0 4px;
+ border-radius: 4px 0 0 4px;
+}
+.copyUrl {
+ background-image: none !important;
+ box-shadow: none !important;
+ display: inline-block;
+ padding: 4px 6px;
+ margin-bottom: 10px;
+ line-height: 20px;
+ color: #333333;
+ text-align: center;
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
+ vertical-align: middle;
+ cursor: pointer;
+ background-color: #f5f5f5;
+ border: 1px solid #cccccc;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ -webkit-border-radius: 0 4px 4px 0;
+ -moz-border-radius: 0 4px 4px 0;
+ border-radius: 0 4px 4px 0;
+ margin-left: -9px;
+}
+.copyUrl.zeroclipboard-is-hover {
+ background-color: #FAFAFA !important;
+}
+.copyUrl.zeroclipboard-is-active {
+ background-color: #EEE !important;
}
.float-in {
opacity: 0;
@@ -123,9 +123,38 @@ h1, h2, h3{
.space-below2{
margin-bottom: 60px;
}
-.myUrl{
- width: 100%;
+#myUrl{
+ width: 60%;
height: 100%;
+ -webkit-border-radius: 4px 0 0 4px;
+ -moz-border-radius: 4px 0 0 4px;
+ border-radius: 4px 0 0 4px;
+}
+.copyUrl{
+ background-image: none !important;
+ box-shadow: none !important;
+ display: inline-block;
+ padding: 4px 6px;
+ margin-bottom: 10px;
+ line-height: 20px;
+ color: #333333;
+ text-align: center;
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
+ vertical-align: middle;
+ cursor: pointer;
+ background-color: #f5f5f5;
+ border: 1px solid #cccccc;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ -webkit-border-radius: 0 4px 4px 0;
+ -moz-border-radius: 0 4px 4px 0;
+ border-radius: 0 4px 4px 0;
+ margin-left: -9px;
+}
+.copyUrl.zeroclipboard-is-hover{
+ background-color: #FAFAFA !important;
+}
+.copyUrl.zeroclipboard-is-active{
+ background-color: #EEE !important;
}
.float-in{
opacity: 0;
@@ -29,8 +29,11 @@ Template.boxPage.events(
Template.boxPage.dropPaneSet = false
Template.boxPage.rendered = ()->
+ clip = new ZeroClipboard( $('.copyUrl'),
+ moviePath: "/ZeroClipboard.swf"
+ )
+
unless Template.boxPage.dropPaneSet
- debugger
filepicker.setKey(Template.boxPage.filepickerKey)
# create a drop pane
@@ -60,10 +63,9 @@ Template.boxPage.rendered = ()->
Meteor.call 'makeFile', file, (error, id)->
if error
Errors.throw(error.reason)
- $('.myUrl').val(document.URL)
+ $('#myUrl').val(document.URL)
$(".float-in").addClass('float')
-
onError: (type, message) ->
Errors.throw("(" + type + ") " + message)
@@ -20,7 +20,8 @@
</div>
<div class="row-fluid float-in space-above proxima text-center space-below">
<div class="span6 offset3">
- <input type="text" class="myUrl"></input>
+ <input type="text" id="myUrl"></input>
+ <button class="copyUrl" data-clipboard-target="myUrl"><i class="icon-paste"></i></button>
</div>
</div>
</template>
View
Binary file not shown.

0 comments on commit 1d95a97

Please sign in to comment.