Skip to content

Node.js based forum software built for the modern web

using unminified version of autosize

psychobunny6d4b658579f4
diff --git a/public/vendor/autosize.js b/public/vendor/autosize.js
new file mode 100644
index 0000000000..54fe82bb56
--- /dev/null
+++ b/public/vendor/autosize.js
@@ -0,0 +1,146 @@
+/*!
+ Autosize 2.0.0
+ license: MIT
+ http://www.jacklmoore.com/autosize
+*/
+(function (root, factory) {
+ 'use strict';
+
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define([], factory);
+ } else if (typeof exports === 'object') {
+ // Node. Does not work with strict CommonJS, but
+ // only CommonJS-like environments that support module.exports,
+ // like Node.
+ module.exports = factory();
+ } else {
+ // Browser globals (root is window)
+ root.autosize = factory();
+ }
+}(this, function () {
+ function main(ta) {
+ if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || ta.hasAttribute('data-autosize-on')) { return; }
+
+ var maxHeight;
+ var heightOffset;
+
+ function init() {
+ var style = window.getComputedStyle(ta, null);
+
+ if (style.resize === 'vertical') {
+ ta.style.resize = 'none';
+ } else if (style.resize === 'both') {
+ ta.style.resize = 'horizontal';
+ }
+
+ // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
+ ta.style.wordWrap = 'break-word';
+
+ // Chrome/Safari-specific fix:
+ // When the textarea y-overflow is hidden, Chrome/Safari doesn't reflow the text to account for the space
+ // made available by removing the scrollbar. This workaround will cause the text to reflow.
+ var width = ta.style.width;
+ ta.style.width = '0px';
+ // Force reflow:
+ /* jshint ignore:start */
+ ta.offsetWidth;
+ /* jshint ignore:end */
+ ta.style.width = width;
+
+ maxHeight = style.maxHeight !== 'none' ? parseFloat(style.maxHeight) : false;
+
+ if (style.boxSizing === 'content-box') {
+ heightOffset = -(parseFloat(style.paddingTop)+parseFloat(style.paddingBottom));
+ } else {
+ heightOffset = parseFloat(style.borderTopWidth)+parseFloat(style.borderBottomWidth);
+ }
+
+ adjust();
+ }
+
+ function adjust() {
+ var startHeight = ta.style.height;
+ var htmlTop = document.documentElement.scrollTop;
+ var bodyTop = document.body.scrollTop;
+
+ ta.style.height = 'auto';
+
+ var endHeight = ta.scrollHeight+heightOffset;
+
+ if (maxHeight !== false && maxHeight < endHeight) {
+ endHeight = maxHeight;
+ if (ta.style.overflowY !== 'scroll') {
+ ta.style.overflowY = 'scroll';
+ }
+ } else if (ta.style.overflowY !== 'hidden') {
+ ta.style.overflowY = 'hidden';
+ }
+
+ ta.style.height = endHeight+'px';
+
+ // prevents scroll-position jumping
+ document.documentElement.scrollTop = htmlTop;
+ document.body.scrollTop = bodyTop;
+
+ if (startHeight !== ta.style.height) {
+ var evt = document.createEvent('Event');
+ evt.initEvent('autosize.resized', true, false);
+ ta.dispatchEvent(evt);
+ }
+ }
+
+ // IE9 does not fire onpropertychange or oninput for deletions,
+ // so binding to onkeyup to catch most of those events.
+ // There is no way that I know of to detect something like 'cut' in IE9.
+ if ('onpropertychange' in ta && 'oninput' in ta) {
+ ta.addEventListener('keyup', adjust);
+ }
+
+ window.addEventListener('resize', adjust);
+ ta.addEventListener('input', adjust);
+
+ ta.addEventListener('autosize.update', adjust);
+
+ ta.addEventListener('autosize.destroy', function(style){
+ window.removeEventListener('resize', adjust);
+ ta.removeEventListener('input', adjust);
+ ta.removeEventListener('keyup', adjust);
+ ta.removeEventListener('autosize.destroy');
+
+ Object.keys(style).forEach(function(key){
+ ta.style[key] = style[key];
+ });
+
+ ta.removeAttribute('data-autosize-on');
+ }.bind(ta, {
+ height: ta.style.height,
+ overflow: ta.style.overflow,
+ overflowY: ta.style.overflowY,
+ wordWrap: ta.style.wordWrap,
+ resize: ta.style.resize
+ }));
+
+ ta.setAttribute('data-autosize-on', true);
+ ta.style.overflow = 'hidden';
+ ta.style.overflowY = 'hidden';
+
+ init();
+ }
+
+ // Do nothing in IE8 or lower
+ if (typeof window.getComputedStyle !== 'function') {
+ return function(elements) {
+ return elements;
+ };
+ } else {
+ return function(elements) {
+ if (elements && elements.length) {
+ Array.prototype.forEach.call(elements, main);
+ } else if (elements && elements.nodeName) {
+ main(elements);
+ }
+ return elements;
+ };
+ }
+}));
diff --git a/public/vendor/autosize/autosize.min.js b/public/vendor/autosize/autosize.min.js
deleted file mode 100644
index 217ff6eff4..0000000000
--- a/public/vendor/autosize/autosize.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*!
- Autosize 2.0.0
- license: MIT
- http://www.jacklmoore.com/autosize
-*/
-!function(e,t){"use strict";"function"==typeof define&&define.amd?define('autosize',t):"object"==typeof exports?module.exports=t():e.autosize=t()}(this,function(){function e(e){function t(){var t=window.getComputedStyle(e,null);"vertical"===t.resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),e.style.wordWrap="break-word";var i=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=i,n="none"!==t.maxHeight?parseFloat(t.maxHeight):!1,r="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),o()}function o(){var t=e.style.height,o=document.documentElement.scrollTop,i=document.body.scrollTop;e.style.height="auto";var s=e.scrollHeight+r;if(n!==!1&&s>n?(s=n,"scroll"!==e.style.overflowY&&(e.style.overflowY="scroll")):"hidden"!==e.style.overflowY&&(e.style.overflowY="hidden"),e.style.height=s+"px",document.documentElement.scrollTop=o,document.body.scrollTop=i,t!==e.style.height){var d=document.createEvent("Event");d.initEvent("autosize.resized",!0,!1),e.dispatchEvent(d)}}if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!e.hasAttribute("data-autosize-on")){var n,r;"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",o),window.addEventListener("resize",o),e.addEventListener("input",o),e.addEventListener("autosize.update",o),e.addEventListener("autosize.destroy",function(t){window.removeEventListener("resize",o),e.removeEventListener("input",o),e.removeEventListener("keyup",o),e.removeEventListener("autosize.destroy"),Object.keys(t).forEach(function(o){e.style[o]=t[o]}),e.removeAttribute("data-autosize-on")}.bind(e,{height:e.style.height,overflow:e.style.overflow,overflowY:e.style.overflowY,wordWrap:e.style.wordWrap,resize:e.style.resize})),e.setAttribute("data-autosize-on",!0),e.style.overflow="hidden",e.style.overflowY="hidden",t()}}return"function"!=typeof window.getComputedStyle?function(e){return e}:function(t){return t&&t.length?Array.prototype.forEach.call(t,e):t&&t.nodeName&&e(t),t}});
\ No newline at end of file
diff --git a/src/meta/js.js b/src/meta/js.js
index bb28642d7f..177d8b03c8 100644
--- a/src/meta/js.js
+++ b/src/meta/js.js
@@ -38,7 +38,7 @@ module.exports = function(Meta) {
'public/vendor/xregexp/unicode/unicode-base.js',
'public/vendor/buzz/buzz.min.js',
'public/vendor/mousetrap/mousetrap.js',
- 'public/vendor/autosize/autosize.min.js',
+ 'public/vendor/autosize.js',
'./node_modules/templates.js/lib/templates.js',
'public/src/utils.js',
'public/src/app.js',