Skip to content

Commit

Permalink
Merge pull request #2066 from Preovaleo/master
Browse files Browse the repository at this point in the history
Change zeroclipboard to clipboardjs. Goodbye flash.

Fixes #2047
  • Loading branch information
ozh committed May 19, 2016
2 parents c830f72 + eb399a0 commit b38215e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ Desktop.ini


# Mac crap # Mac crap
.DS_Store .DS_Store

# NetBeans files
/nbproject/
3 changes: 1 addition & 2 deletions includes/functions-html.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function yourls_html_head( $context = 'index', $title = '' ) {
<?php if ( $share ) { ?> <?php if ( $share ) { ?>
<link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/share.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" /> <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/share.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
<script src="<?php yourls_site_url(); ?>/js/share.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> <script src="<?php yourls_site_url(); ?>/js/share.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
<script src="<?php yourls_site_url(); ?>/js/jquery.zclip.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script> <script src="<?php yourls_site_url(); ?>/js/clipboard.min.js?v=<?php echo YOURLS_VERSION; ?>" type="text/javascript"></script>
<?php } ?> <?php } ?>
<?php if ( $cal ) { ?> <?php if ( $cal ) { ?>
<link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/cal.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" /> <link rel="stylesheet" href="<?php yourls_site_url(); ?>/css/cal.css?v=<?php echo YOURLS_VERSION; ?>" type="text/css" media="screen" />
Expand All @@ -123,7 +123,6 @@ function yourls_html_head( $context = 'index', $title = '' ) {
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
var ajaxurl = '<?php echo yourls_admin_url( 'admin-ajax.php' ); ?>'; var ajaxurl = '<?php echo yourls_admin_url( 'admin-ajax.php' ); ?>';
var zclipurl = '<?php yourls_site_url(); ?>/js/ZeroClipboard.swf';
//]]> //]]>
</script> </script>
<?php yourls_do_action( 'html_head', $context ); ?> <?php yourls_do_action( 'html_head', $context ); ?>
Expand Down
Binary file removed js/ZeroClipboard.swf
Binary file not shown.
7 changes: 7 additions & 0 deletions js/clipboard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions js/jquery.zclip.min.js

This file was deleted.

24 changes: 11 additions & 13 deletions js/share.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@ function share(dest) {
} }


function init_clipboard() { function init_clipboard() {
$('#copylink').click(function(){ var clipboard = new Clipboard('#copylink', {
$(this).select(); text: function (trigger) {
}) return $(trigger).val();

}
$('#copylink').zclip({ });
path: zclipurl,
copy: $('#copylink').val(), clipboard.on('success', function () {
afterCopy:function(){ $('#copylink').select();
html_pulse( '#copybox h2, #copybox h3', 'Copied!' ); html_pulse('#copybox h2, #copybox h3', 'Copied!');
} });
}); };
};

2 changes: 1 addition & 1 deletion sample-public-front-page.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if ( isset( $_REQUEST['url'] ) && $_REQUEST['url'] != 'http://' ) {
// Include the Copy box and the Quick Share box // Include the Copy box and the Quick Share box
yourls_share_box( $url, $shorturl, $title, $text ); yourls_share_box( $url, $shorturl, $title, $text );


// Initialize clipboard -- requires js/share.js and js/jquery.zclip.min.js to be properly loaded in the <head> // Initialize clipboard -- requires js/share.js and js/clipboard.min.js to be properly loaded in the <head>
echo "<script>init_clipboard();</script>\n"; echo "<script>init_clipboard();</script>\n";
} }


Expand Down

0 comments on commit b38215e

Please sign in to comment.