diff --git a/src/js/app.js b/src/js/app.js index e37b86c..89f6246 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -17,6 +17,7 @@ requirejs([ 'js/controller/write', 'js/controller/navigation', 'cryptoLib/util', + 'angularSanitize', 'angularRoute', 'angularTouch' ], function( @@ -43,6 +44,7 @@ requirejs([ // init main angular module including dependencies var app = angular.module('mail', [ + 'ngSanitize', 'ngRoute', 'ngTouch', 'navigation', diff --git a/src/js/controller/mail-list.js b/src/js/controller/mail-list.js index af34d63..de7083c 100644 --- a/src/js/controller/mail-list.js +++ b/src/js/controller/mail-list.js @@ -377,7 +377,7 @@ define(function(require) { this.html = html; this.sentDate = new Date('Thu Sep 19 2013 20:41:23 GMT+0200 (CEST)'); this.subject = 'Getting started'; // Subject line - this.body = 'Here are a few pointers to help you get started with Whiteout Mail.\n\n# Write encrypted message\n- You can compose a message by clicking on the compose button on the upper right (keyboard shortcut is "n" for a new message or "r" to reply).\n- When typing the recipient\'s email address, secure recipients are marked with a blue label and insecure recipients are red.\n- When sending an email to insecure recipients, the default behavior for Whiteout Mail is to invite them to the service and only send the message content in an encrypted form, once they have joined.\n\n# Advanced features\n- To verify a recipient\'s PGP key, you can hover over the blue label containing their email address and their key fingerprint will be displayed.\n- To view your own key fingerprint, open the account view in the navigation bar on the left. You can compare these with your correspondants over a second channel such as a phonecall.\n\nWe hope this helped you to get started with Whiteout Mail.\n\nYour Whiteout Networks team'; // plaintext body + this.body = 'Here are a few pointers to help you get started with Whiteout Mail.\n\nhttp://www.example.com\n\n# Write encrypted message\n- You can compose a message by clicking on the compose button on the upper right (keyboard shortcut is "n" for a new message or "r" to reply).\n- When typing the recipient\'s email address, secure recipients are marked with a blue label and insecure recipients are red.\n- When sending an email to insecure recipients, the default behavior for Whiteout Mail is to invite them to the service and only send the message content in an encrypted form, once they have joined.\n\n# Advanced features\n- To verify a recipient\'s PGP key, you can hover over the blue label containing their email address and their key fingerprint will be displayed.\n- To view your own key fingerprint, open the account view in the navigation bar on the left. You can compare these with your correspondants over a second channel such as a phonecall.\n\nWe hope this helped you to get started with Whiteout Mail.\n\nYour Whiteout Networks team'; // plaintext body this.encrypted = true; this.decrypted = true; }; diff --git a/src/js/controller/read.js b/src/js/controller/read.js index 599809f..d6d872d 100644 --- a/src/js/controller/read.js +++ b/src/js/controller/read.js @@ -163,6 +163,7 @@ define(function(require) { // var ngModule = angular.module('read', []); + ngModule.directive('frameLoad', function() { return function(scope, elm) { elm.bind('load', function() { @@ -172,5 +173,14 @@ define(function(require) { }; }); + ngModule.filter('createAnchors', function($sce) { + return function(str) { + // replace all urls with anchors + return $sce.trustAsHtml(str.replace(/(https?:\/\/[^\s]+)/g, function(url) { + return '' + url + ''; + })); + }; + }); + return ReadCtrl; }); \ No newline at end of file diff --git a/src/lib/angular/angular-sanitize.min.js b/src/lib/angular/angular-sanitize.min.js new file mode 100755 index 0000000..5bff6ba --- /dev/null +++ b/src/lib/angular/angular-sanitize.min.js @@ -0,0 +1,14 @@ +/* + AngularJS v1.2.13 + (c) 2010-2014 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(p,h,q){'use strict';function E(a){var e=[];s(e,h.noop).chars(a);return e.join("")}function k(a){var e={};a=a.split(",");var d;for(d=0;d=c;d--)e.end&&e.end(f[d]);f.length=c}}var b,g,f=[],l=a;for(f.last=function(){return f[f.length-1]};a;){g=!0;if(f.last()&&x[f.last()])a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+f.last()+"[^>]*>","i"),function(b,a){a=a.replace(H,"$1").replace(I,"$1");e.chars&&e.chars(r(a));return""}),c("",f.last());else{if(0===a.indexOf("\x3c!--"))b=a.indexOf("--",4),0<=b&&a.lastIndexOf("--\x3e",b)===b&&(e.comment&&e.comment(a.substring(4,b)),a=a.substring(b+3),g=!1);else if(y.test(a)){if(b=a.match(y))a= +a.replace(b[0],""),g=!1}else if(J.test(a)){if(b=a.match(z))a=a.substring(b[0].length),b[0].replace(z,c),g=!1}else K.test(a)&&(b=a.match(A))&&(a=a.substring(b[0].length),b[0].replace(A,d),g=!1);g&&(b=a.indexOf("<"),g=0>b?a:a.substring(0,b),a=0>b?"":a.substring(b),e.chars&&e.chars(r(g)))}if(a==l)throw L("badparse",a);l=a}c()}function r(a){if(!a)return"";var e=M.exec(a);a=e[1];var d=e[3];if(e=e[2])n.innerHTML=e.replace(//g,">")}function s(a,e){var d=!1,c=h.bind(a,a.push);return{start:function(a,g,f){a=h.lowercase(a);!d&&x[a]&&(d=a);d||!0!==C[a]||(c("<"),c(a),h.forEach(g,function(d,f){var g=h.lowercase(f),k="img"===a&&"src"===g||"background"===g;!0!==O[g]||!0===D[g]&&!e(d,k)||(c(" "),c(f),c('="'),c(B(d)),c('"'))}),c(f?"/>":">"))},end:function(a){a=h.lowercase(a);d||!0!==C[a]||(c(""));a==d&&(d=!1)},chars:function(a){d|| +c(B(a))}}}var L=h.$$minErr("$sanitize"),A=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,z=/^<\s*\/\s*([\w:-]+)[^>]*>/,G=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,K=/^]*?)>/i,I=/]/,d=/^mailto:/;return function(c,b){function g(a){a&&m.push(E(a))}function f(a,c){m.push("');g(c);m.push("")}if(!c)return c;for(var l,k=c,m=[],n,p;l=k.match(e);)n=l[0],l[2]==l[3]&&(n="mailto:"+n),p=l.index,g(k.substr(0,p)),f(n,l[0].replace(d,"")),k=k.substring(p+l[0].length);g(k);return a(m.join(""))}}])})(window,window.angular); +//# sourceMappingURL=angular-sanitize.min.js.map diff --git a/src/require-config.js b/src/require-config.js index 1429524..313d17a 100644 --- a/src/require-config.js +++ b/src/require-config.js @@ -17,6 +17,7 @@ angular: 'angular/angular.min', angularRoute: 'angular/angular-route.min', angularTouch: 'angular/angular-touch.min', + angularSanitize: 'angular/angular-sanitize.min', uuid: 'uuid/uuid', openpgp: 'openpgp/openpgp.min', iscroll: 'iscroll/iscroll-min' @@ -25,6 +26,10 @@ angular: { exports: 'angular' }, + angularSanitize: { + exports: 'angular', + deps: ['angular'] + }, angularRoute: { exports: 'angular', deps: ['angular'] diff --git a/src/sass/views/_read.scss b/src/sass/views/_read.scss index 8956f14..f4ce050 100644 --- a/src/sass/views/_read.scss +++ b/src/sass/views/_read.scss @@ -125,6 +125,10 @@ .line { word-wrap: break-word; + a { + color: $color-blue; + } + &.empty-line { line-height: 1em; } diff --git a/src/tpl/read.html b/src/tpl/read.html index d982af1..2269267 100644 --- a/src/tpl/read.html +++ b/src/tpl/read.html @@ -38,7 +38,10 @@
-
{{line}}
+
+ +
+