56 Commits

Author SHA1 Message Date
Zeno Rocha
9377659c9c Fixes discontiguous selection #17 2015-10-13 09:28:11 -07:00
Whit Jackson
6ca2ba514c replace 'an user' with 'a user' 2015-10-09 17:17:37 -07:00
Calvin Correli
c5b416b108 Fix for scrolling to top in unsupported firefox
My previous fix didn't actually work. Instead of scrolling to the bottom it would scroll to the top, because it turns out document.body.scrollTop always returns 0 in Firefox.

This should work in most browsers.

See here: http://help.dottoro.com/ljnvjiow.php
2015-10-05 11:54:20 -04:00
Zeno Rocha
8dc4e2e132 Adds destroy method for ClipboardAction too #24 2015-10-03 19:05:12 -07:00
Zeno Rocha
0c24503214 Source formatting and testing for #24 2015-10-03 19:04:37 -07:00
Zeno Rocha
cc9d562580 Renames "initialize" method to "onClick" #51 2015-10-03 16:44:47 -07:00
Zeno Rocha
c16137511c Source formatting #63 2015-10-03 16:25:20 -07:00
Vitor Cortez
15a66df290 Edit ´getAttributeValue´ to a function declaration
Favoring function declaration over a function expression in this case to follow style guidelines.
2015-10-03 16:25:20 -07:00
Vitor Cortez
ff4755fe4c Add helper method to dry default set functions 2015-10-03 16:25:20 -07:00
Calvin Correli
5c8af54b8a Prevent FF < 41 scrolling to bottom of page
In Firefox < 41, the selecting fakeElem.select() would cause the browser to scroll to the bottom of the page. 

By positioning fakeElem at the current scroll position, but still way out to the left, that no longer happens.
2015-10-02 09:32:16 -04:00
Maxim Lebedinets
e4f3fb226c Modified comments and changed element type for "ClipboardAction" class; 2015-09-30 20:52:48 +03:00
Zeno Rocha
a5e29bd420 Removes code from #constructor to separate functions 2015-09-29 22:14:26 -07:00
Zeno Rocha
3394f59691 Returns undefined instead of null if attributes does not exists #21 2015-09-29 18:24:33 -07:00
Jory Graham
d66aab1124 Default options for ClipboardAction too 2015-09-29 20:23:05 -04:00
Jory Graham
902c730a4d Use undefined for default parameters 2015-09-29 20:09:17 -04:00
rspecht
14baab7386 using default parameters instead the 'or' approach 2015-09-29 18:36:07 -03:00
Mauricio Soares
05a807e2fb Adds UMD support
Using the --standalone option from browserify it automatically wrap your code into a UMD module.
2015-09-29 11:09:28 -03:00
Zeno Rocha
194bf6aeb3 Source formatting 2015-09-28 23:54:34 -07:00
Zeno Rocha
1f61e16eb5 Fails silently in favor of speed 2015-09-28 21:59:18 -07:00
Zeno Rocha
775e4b898d Source formatting 2015-09-28 21:56:29 -07:00
Eduardo Lundgren
b842987292 Adds support to set action/target/text via function 2015-09-29 01:15:21 -03:00
Eduardo Lundgren
beab7bc087 Changes target to support selector instead of id 2015-09-28 23:37:58 -03:00
Mauricio Soares
157b0fb5a2 Rename data-attributes to prefix "clipboard"
This PR renames all the data-attributes for data-clipboard-X, this is due the possibility of conflict with projects that already uses these data-attributes.
2015-09-28 14:06:22 -03:00
Zeno Rocha
467684333f Moves from Node's require to ES6's import syntax 2015-09-26 17:31:18 -07:00
Zeno Rocha
abeee82bdc Throws error if either data-target or data-text were passed and throws error if neither data-target nor data-text were passed too 2015-09-26 09:25:15 -07:00
Zeno Rocha
bb60a866b2 Fixes tests 2015-09-26 07:32:27 -07:00
Zeno Rocha
e3f69de585 Renames host argument to emitter 2015-09-26 07:31:59 -07:00
Zeno Rocha
1ac258dea5 Moves to a better delegate library 2015-09-24 22:23:15 -07:00
Zeno Rocha
34c798851d Only removes the fake element after another click event, that way an user can hit Ctrl+C to copy because selection still exists 2015-09-24 21:25:37 -07:00
Zeno Rocha
076e3b8a64 Destroys the previous ClipboardAction instance whenever a new click is triggered 2015-09-24 21:24:21 -07:00
Zeno Rocha
3610bfa08c Emits event on base class instead of each element for better performance 2015-09-24 18:19:40 -07:00
Zeno Rocha
ced945f11a Replaces every single event listener in favor of event delegation 2015-09-24 17:02:33 -07:00
Zeno Rocha
540038e2ad Adds documentation for each block 2015-09-24 16:18:50 -07:00
Zeno Rocha
56dd1aac22 Handles attributes with getters/setters and breaks code into two classes 2015-09-24 15:11:11 -07:00
Zeno Rocha
e72ce02c87 Clears selection only if operation succeeded 2015-09-23 10:54:18 -07:00
Zeno Rocha
dedfbffe05 Fixes selection on non-editable elements 2015-09-22 23:32:04 -07:00
Zeno Rocha
fbb2a316bf Removes fake element from screen instead making it transparent 2015-09-22 09:59:15 -07:00
Zeno Rocha
b4a748f89f Uses template string instead of concat strings 2015-09-22 08:33:34 -07:00
Zeno Rocha
c92c4e545a Removes "no-support" event in favor of "error" and "copy/cut" in favor of "success" 2015-09-21 10:32:11 -07:00
Eduardo Lundgren
23b20d6006 Uses optimistic execCommand and removes redundant logic - Fixes #1 2015-09-21 09:39:41 -07:00
Zeno Rocha
f3c042a364 Only fire detailed events if copy was successful 2015-09-21 01:15:01 -07:00
Zeno Rocha
aebcbdf292 Updates headline and add default export 2015-09-21 00:37:02 -07:00
Zeno Rocha
52b444609e Improves error handling 2015-09-20 14:35:19 -07:00
Zeno Rocha
66c18fbcb4 Breaks code into two classes 2015-09-19 18:03:31 -07:00
Zeno Rocha
24f4bc77ed Handles browsers that do not support this API 2015-09-19 16:44:30 -07:00
Zeno Rocha
960d1a9dd9 Adds browserify and babelify for import transformation 2015-09-19 15:42:36 -07:00
Zeno Rocha
76ab07a186 Triggers a custom event after copying/cutting commands 2015-09-19 11:38:19 -07:00
Zeno Rocha
e1f8fe6cde Renames "data-value" to "data-text" 2015-09-19 02:25:46 -07:00
Zeno Rocha
6fcb7d5f87 Fetches attributes via "getAttributes" for better cross browser support 2015-09-19 02:03:45 -07:00
Zeno Rocha
6ecabeb38f Throws an error if selector is empty 2015-09-18 22:40:10 -07:00