Skip to content

Commit

Permalink
Allow call-time override for the movie path
Browse files Browse the repository at this point in the history
  • Loading branch information
bobthecow committed May 31, 2011
1 parent 384c0e5 commit 0cb83f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions jquery.copyonclick.js
Expand Up @@ -21,7 +21,11 @@
*/
;(function($){

$.fn.copyOnClick = function(txt) {
$.fn.copyOnClick = function(txt, o) {

if (typeof o !== 'undefined' && typeof o.moviePath !== 'undefined') {
ZeroClipboard.setMoviePath(o.moviePath);
}

return this.each(function() {
var $$ = $(this);
Expand Down Expand Up @@ -61,7 +65,9 @@ $.fn.copyOnClick = function(txt) {
});
};

var base = $('script[src*=jquery.copyonclick]').attr('src').replace(/jquery\.copyonclick(\.min)?\.js.*$/, '');
ZeroClipboard.setMoviePath(base + 'ZeroClipboard.swf');
var src = $('script[src*="jquery.copyonclick"]').attr('src');
if (typeof src !== 'undefined') {
ZeroClipboard.setMoviePath(src.replace(/jquery\.copyonclick(\.min)?\.js.*$/, 'ZeroClipboard.swf'));
}

})(jQuery);
5 changes: 3 additions & 2 deletions jquery.copyonclick.min.js

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

0 comments on commit 0cb83f6

Please sign in to comment.