babelacc

compare different implementations of the text alternative computation  https://p.ce9e.org/babelacc/
git clone https://git.ce9e.org/babelacc.git

commit
e7a4956a4a946fa8cf19ff757a4e568c08d077f2
parent
21b0a3e064bf18b7d8530857c203e28fd399549f
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-02-05 12:39
block execution on browsers that do not support CSP

Diffstat

M src/babel.js 22 +++++++++++++---------

1 files changed, 13 insertions, 9 deletions


diff --git a/src/babel.js b/src/babel.js

@@ -71,15 +71,6 @@ var run = function(html) {
   71    71 	}));
   72    72 };
   73    73 
   74    -1 location.search.substr(1).split('&').forEach(function(part) {
   75    -1 	var p = part.split('=');
   76    -1 	if (p[0] === 'input') {
   77    -1 		var html = decodeURIComponent(p[1].replace(/\+/g, ' '));
   78    -1 		form.input.value = html;
   79    -1 		run(html);
   80    -1 	}
   81    -1 });
   82    -1 
   83    74 // https://stackoverflow.com/questions/454202
   84    75 var resize = function(event) {
   85    76 	/* 0-timeout to get the already changed text */
@@ -90,3 +81,16 @@ var resize = function(event) {
   90    81 };
   91    82 form.input.addEventListener('keydown', resize);
   92    83 resize({target: form.input});
   -1    84 
   -1    85 try {
   -1    86 	eval('alert("This tools requires a browser that supports CSP. Please update!")');
   -1    87 } catch (error) {
   -1    88 	location.search.substr(1).split('&').forEach(function(part) {
   -1    89 		var p = part.split('=');
   -1    90 		if (p[0] === 'input') {
   -1    91 			var html = decodeURIComponent(p[1].replace(/\+/g, ' '));
   -1    92 			form.input.value = html;
   -1    93 			run(html);
   -1    94 		}
   -1    95 	});
   -1    96 }