diff --git a/app/assets/javascripts/darkswarm/directives/obfuscatedEmail.js.coffee b/app/assets/javascripts/darkswarm/directives/obfuscatedEmail.js.coffee new file mode 100644 index 0000000000..99c5315a83 --- /dev/null +++ b/app/assets/javascripts/darkswarm/directives/obfuscatedEmail.js.coffee @@ -0,0 +1,7 @@ +angular.module('Darkswarm').directive "obfuscatedEmail", ()-> + restrict: 'C' + link: (scope, element, attrs)-> + element.on 'cut copy', (event)-> + event.preventDefault() + clipboardData = event.clipboardData || window.clipboardData || event.originalEvent.clipboardData + clipboardData.setData('text/plain', document.getSelection().toString().split('').reverse().join('')) diff --git a/app/assets/javascripts/templates/partials/contact.html.haml b/app/assets/javascripts/templates/partials/contact.html.haml index 9779dd0f3e..58c8c4a64d 100644 --- a/app/assets/javascripts/templates/partials/contact.html.haml +++ b/app/assets/javascripts/templates/partials/contact.html.haml @@ -5,7 +5,7 @@ %p{"ng-if" => "::enterprise.email_address"} %a{"ng-href" => "{{::enterprise.email_address | stripUrl}}", target: "_blank", mailto: true} - %span.email{"ng-bind" => "::enterprise.email_address | stripUrl"} + %span.obfuscatedEmail.email{"ng-bind" => "::enterprise.email_address | stripUrl"} %p{"ng-if" => "enterprise.website"} %a{"ng-href" => "http://{{::enterprise.website | stripUrl}}", target: "_blank", "ng-bind" => "::enterprise.website | stripUrl"} diff --git a/app/views/producers/_fat.html.haml b/app/views/producers/_fat.html.haml index 02c9bf6fef..fb2d1d8db7 100644 --- a/app/views/producers/_fat.html.haml +++ b/app/views/producers/_fat.html.haml @@ -40,7 +40,7 @@ %p.word-wrap{"ng-if" => "::producer.email_address"} %a{"ng-href" => "{{::producer.email_address | stripUrl}}", target: "_blank", mailto: true} - %span.email{"ng-bind" => "::producer.email_address | stripUrl"} + %span.obfuscatedEmail.email{"ng-bind" => "::producer.email_address | stripUrl"} %p.word-wrap{"ng-if" => "::producer.website"} %a{"ng-href" => "http://{{::producer.website | stripUrl}}", target: "_blank" } diff --git a/app/views/shopping_shared/tabs/_contact.html.haml b/app/views/shopping_shared/tabs/_contact.html.haml index df487609bd..cf8cf6da5f 100644 --- a/app/views/shopping_shared/tabs/_contact.html.haml +++ b/app/views/shopping_shared/tabs/_contact.html.haml @@ -32,7 +32,7 @@ %br - if current_distributor.email_address.present? %a{href: current_distributor.email_address.reverse, mailto: true} - %span.email + %span.obfuscatedEmail.email = current_distributor.email_address.reverse .small-12.large-4.columns