diff --git a/cropper/css/main.css b/cropper/css/main.css index 19063c4..5192a75 100644 --- a/cropper/css/main.css +++ b/cropper/css/main.css @@ -72,3 +72,45 @@ input { } +/** + Tooltip +*/ +.tooltip-wrap { + color: #555; + cursor: help; + font-family: "Gill Sans", Impact, sans-serif; + font-size: 12px; + display: inline-block; + position: relative; + text-align: center; + -webkit-transform: translateZ(0); /* webkit flicker fix */ + -webkit-font-smoothing: antialiased; /* webkit text rendering fix */ +} + +.tooltip-wrap .tooltip { + display: none; + position: absolute; + z-index: 1; + padding: 5px 8px; + top: 37px; + left: -50%; + background-color: #666; + color: white; + border-radius: 3px; +} + +/* CSS Triangle */ +.tooltip-wrap .tooltip:after { + width: 0; + height: 0; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-bottom: 8px solid #666; + top: -8px; + content: " "; + height: 0; + left: 50%; + margin-left: -15%; + position: absolute; + width: 0; +} diff --git a/cropper/index.html b/cropper/index.html index d72d634..4e9afd9 100644 --- a/cropper/index.html +++ b/cropper/index.html @@ -10,8 +10,10 @@ + + @@ -30,14 +32,12 @@

IIIF Image Cropper

- - +
+ +
Copied!
+
diff --git a/cropper/js/cropper.js b/cropper/js/cropper.js index 485afa7..8b2d35f 100644 --- a/cropper/js/cropper.js +++ b/cropper/js/cropper.js @@ -19,6 +19,9 @@ $(document).ready(function(){ // This is also a workaround for a jcrop issue whereby it does not properly handle changing images and box constraints. $('#target').removeAttr('style'); + // Clear output box + $('#output').val(''); + // Get input var url = document.getElementById("URL").value; // Display image @@ -95,5 +98,20 @@ $(document).ready(function(){ return {'x':x, 'y':y, 'w':w, 'h':h} } + /** CLIPBOARD **/ + + var clipboard = new Clipboard('.btn'); + + clipboard.on('success', function(e) { + console.log('Success'); + $('#copy-tip-text').text('Copied!'); + $('#copy-tip-text').fadeIn(300).delay(1000).fadeOut(300); + }); + + clipboard.on('error', function(e) { + $('#copy-tip-text').text('Ctrl+C to copy'); + $('#copy-tip-text').fadeIn(300).delay(1000).fadeOut(300); + }); + });