change zeroclipboard to clipboardjs #2066

Merged
merged 7 commits into from May 19, 2016

Projects

None yet

3 participants

@Preovaleo
Contributor

solve #2047

Preovaleo added some commits Mar 22, 2016
@Preovaleo Preovaleo Delete my ide files fe18186
@Preovaleo Preovaleo change zeroclipboard to clipboardjs 1003a6c
@Preovaleo Preovaleo chnage random comments
f6dbe05
@Preovaleo
Contributor

i make a mistake i fix it

@Preovaleo Preovaleo Fix i make it quick
5260f9e
@Preovaleo Preovaleo commented on an outdated diff Mar 22, 2016
clipboard.on('success', function (e) {
+ $('#copylink').select();
@Preovaleo
Preovaleo Mar 22, 2016 Contributor

I add this to keep the input content selected when we release the left button.
This is cosmetic but I put it to mimic the functioning of github

@LeoColomb LeoColomb and 1 other commented on an outdated diff Mar 22, 2016
@@ -50,3 +50,4 @@ Desktop.ini
# Mac crap
.DS_Store
+/nbproject/
@LeoColomb
LeoColomb Mar 22, 2016 Member

Could you explain this addition?

@Preovaleo
Preovaleo Mar 22, 2016 Contributor

sure this is some of my IDE config files (NetBeans)

@LeoColomb LeoColomb and 1 other commented on an outdated diff Mar 22, 2016
- $('#copylink').zclip({
- path: zclipurl,
- copy: $('#copylink').val(),
- afterCopy:function(){
- html_pulse( '#copybox h2, #copybox h3', 'Copied!' );
- }
- });
-};
-
+ var clipboard = new Clipboard('#copylink', {
+ text: function (trigger) {
+ return $(trigger).val();
+ }
+ });
+
+ clipboard.on('success', function (e) {
@LeoColomb
LeoColomb Mar 22, 2016 Member

e isn't used.

@Preovaleo
Preovaleo Mar 22, 2016 Contributor

from https://clipboardjs.com/

var clipboard = new Clipboard('.btn');

clipboard.on('success', function(e) {
    console.info('Action:', e.action);
    console.info('Text:', e.text);
    console.info('Trigger:', e.trigger);

    e.clearSelection();
});

clipboard.on('error', function(e) {
    console.error('Action:', e.action);
    console.error('Trigger:', e.trigger);
});

(e) could contain some info but do you want to log the success?

@LeoColomb
LeoColomb Mar 22, 2016 Member

As you want. That said, console logging is not recommended.
If not, you should not add the e parameter.

Preovaleo added some commits Mar 22, 2016
@Preovaleo Preovaleo Add a comment in gitignore for netbeans 048fa3c
@Preovaleo Preovaleo remove the unused e parameter
0a9be73
@LeoColomb LeoColomb commented on the diff Mar 22, 2016
.gitignore
@@ -50,3 +50,6 @@ Desktop.ini
# Mac crap
.DS_Store
+
+# NetBeans files
@LeoColomb
LeoColomb Mar 22, 2016 Member

👍 👌

@LeoColomb LeoColomb commented on an outdated diff Mar 22, 2016
@@ -42,7 +42,7 @@ function init_clipboard() {
}
});
- clipboard.on('success', function (e) {
+ clipboard.on('success', function () {
@ozh
Member
ozh commented Mar 28, 2016

(for the record, still havent got time to test this, but this is not forgotten ;)

@Preovaleo Preovaleo bump clipboardjs 1.5.10
eb399a0
@Preovaleo
Contributor

up ?

@ozh
Member
ozh commented May 19, 2016

Sorry about the lack of reply, still havent got time to properly test and merge this...

@ozh
Member
ozh commented May 19, 2016

Actually took time to give this PR the attention it deserves, I thought there would be more edge cases to test but the changes are pretty straightforward and everything seems to work flawlessly (FF, Chrome, IE). Thanks a bunch !! 🙇

@ozh ozh merged commit b38215e into YOURLS:master May 19, 2016

2 checks passed

Scrutinizer 351 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment