From 89ba802b23bf1fd22afbc5e9a4b3b732264e3c18 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 4 Nov 2014 15:57:23 +0000 Subject: Move webclient to a python module so that it can be installed --- syweb/webclient/js/elastic.js | 216 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 syweb/webclient/js/elastic.js (limited to 'syweb/webclient/js/elastic.js') diff --git a/syweb/webclient/js/elastic.js b/syweb/webclient/js/elastic.js new file mode 100644 index 0000000000..d585d81109 --- /dev/null +++ b/syweb/webclient/js/elastic.js @@ -0,0 +1,216 @@ +/* + * angular-elastic v2.4.0 + * (c) 2014 Monospaced http://monospaced.com + * License: MIT + */ + +angular.module('monospaced.elastic', []) + + .constant('msdElasticConfig', { + append: '' + }) + + .directive('msdElastic', [ + '$timeout', '$window', 'msdElasticConfig', + function($timeout, $window, config) { + 'use strict'; + + return { + require: 'ngModel', + restrict: 'A, C', + link: function(scope, element, attrs, ngModel) { + + // cache a reference to the DOM element + var ta = element[0], + $ta = element; + + // ensure the element is a textarea, and browser is capable + if (ta.nodeName !== 'TEXTAREA' || !$window.getComputedStyle) { + return; + } + + // set these properties before measuring dimensions + $ta.css({ + 'overflow': 'hidden', + 'overflow-y': 'hidden', + 'word-wrap': 'break-word' + }); + + // force text reflow + var text = ta.value; + ta.value = ''; + ta.value = text; + + var append = attrs.msdElastic ? attrs.msdElastic.replace(/\\n/g, '\n') : config.append, + $win = angular.element($window), + mirrorInitStyle = 'position: absolute; top: -999px; right: auto; bottom: auto;' + + 'left: 0; overflow: hidden; -webkit-box-sizing: content-box;' + + '-moz-box-sizing: content-box; box-sizing: content-box;' + + 'min-height: 0 !important; height: 0 !important; padding: 0;' + + 'word-wrap: break-word; border: 0;', + $mirror = angular.element('