Upgrading to new ZeroClipboard, removing jQuery dependency.

This commit is contained in:
Tom Slominski
2015-03-07 01:12:23 +00:00
parent cee5a1e4b8
commit 0f2d3383a2
7 changed files with 38 additions and 35 deletions

View File

@@ -14,5 +14,21 @@
</div>
</div>
</div>
<?php if (!empty(ISQ::$general['clipboard'])) { ?>
<script type="text/javascript" src="public/ZeroClipboard/ZeroClipboard.min.js"></script>
<script>
ZeroClipboard.config({
swfPath: "public/ZeroClipboard/ZeroClipboard.swf"
});
var clipboardClient = new ZeroClipboard( document.getElementsByClassName("copy-button") );
clipboardClient.on( 'aftercopy', function(event) {
event.target.innerHTML = "Copied!";
} );
</script>
<?php } ?>
</body>
</html>

View File

@@ -27,41 +27,12 @@ isq_load_textdomain();
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold,bolditalic"><!-- Ubuntu from Google Web Fonts -->
<link rel="stylesheet" href="<?php echo YOURLS_SITE; ?>/public/style.css" /><!-- Theme CSS -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!-- jQuery -->
<?php if ( ISQ::$social['plus'] ) { ?>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{lang: "en-GB"}
</script>
<?php } ?>
<script src='https://www.google.com/recaptcha/api.js'></script><!-- reCAPTCHA -->
<?php if (!empty(ISQ::$general['clipboard'])) { ?>
<script type="text/javascript" src="js/jquery.zclip.min.js"></script>
<script>
$(document).ready(function(){
$('button#long-copy').zclip({
path:'js/ZeroClipboard.swf',
copy:function(){return $('input#long-copy').val();},
afterCopy: function() {
$("button#long-copy").html('<?php yourls_e( 'Copied!', 'isq_translation'); ?>');
}
});
$('button#short-copy').zclip({
path:'js/ZeroClipboard.swf',
copy:function(){return $('input#short-copy').val();},
afterCopy: function() {
$("button#short-copy").html('<?php yourls_e( 'Copied!', 'isq_translation'); ?>');
}
});
$('button#stats-copy').zclip({
path:'js/ZeroClipboard.swf',
copy:function(){return $('input#stats-copy').val();},
afterCopy: function() {
$("button#stats-copy").html('<?php yourls_e( 'Copied!', 'isq_translation'); ?>');
}
});
});
</script>
<?php } ?>
<!-- App icons generated using http://realfavicongenerator.net -->
<link rel="apple-touch-icon" sizes="57x57" href="public/images/app-icons/apple-touch-icon-57x57.png">

10
public/ZeroClipboard/ZeroClipboard.min.js vendored Executable file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -190,6 +190,11 @@ input[type=submit] {
text-align: center;
}
.copy-button {
margin-top: 2px;
margin-left: 0;
}
.social-sharer {
display: inline-block;
padding: 0 2px;

View File

@@ -45,22 +45,22 @@ if ( ISQ::$general['qr'] ) {
<div class="output">
<div class="form-item full-width">
<label for="longurl" class="primary"><?php yourls_e( 'Original URL', 'isq_translation'); ?></label>
<input type="text" name="longurl" onclick="this.select();" onload="this.select();" value="<?php echo $url; ?>" id="long-copy">
<?php if (!empty(ISQ::$general['clipboard'])) { echo '<button id="long-copy" data-clipboard-target="long-copy" class="desktop-only">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?>
<input type="text" name="longurl" id="longurl" onclick="this.select();" onload="this.select();" value="<?php echo $url; ?>">
<?php if (!empty(ISQ::$general['clipboard'])) { echo '<button data-clipboard-target="longurl" class="desktop-only copy-button button">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?>
</div>
<div class="halves">
<div class="form-item half-width left">
<label for="shorturl" class="primary"><?php yourls_e( 'Short URL', 'isq_translation'); ?></label>
<input type="text" name="shorturl" onclick="this.select();" value="<?php echo $shorturl; ?>" id="short-copy">
<?php if (!empty(ISQ::$general['clipboard'])) { echo '<button id="short-copy" data-clipboard-target="short-copy" class="desktop-only">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?>
<input type="text" name="shorturl" id="shorturl" onclick="this.select();" value="<?php echo $shorturl; ?>">
<?php if (!empty(ISQ::$general['clipboard'])) { echo '<button data-clipboard-target="shorturl" class="desktop-only copy-button button">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?>
</div>
<div class="form-item half-width right">
<label for="stats" class="primary"><?php /* translators: This is short for statistics */ yourls_e( 'Stats', 'isq_translation'); ?></label>
<input type="text" name="stats" onclick="this.select();" value="<?php echo $shorturl . '+'; ?>" id="stats-copy">
<?php if (!empty(ISQ::$general['clipboard'])) { echo '<button id="stats-copy" data-clipboard-target="stats-copy" class="desktop-only">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?>
<input type="text" name="stats" id="stats" onclick="this.select();" value="<?php echo $shorturl . '+'; ?>" id="stats-copy">
<?php if (!empty(ISQ::$general['clipboard'])) { echo '<button data-clipboard-target="stats" class="desktop-only copy-button button">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?>
</div>
</div>