Browse Source

Generated stuff

Artur Paikin 9 years ago
parent
commit
1fd3d9eeb7

+ 3 - 3
website/_config.yml

@@ -5,9 +5,9 @@
 # Uppy versions, auto updated by update.js
 uppy_version: 0.0.1
 
-uppy_dev_size: "87.22"
-uppy_min_size: "87.22"
-uppy_gz_size: "87.22"
+uppy_dev_size: "87.41"
+uppy_min_size: "87.41"
+uppy_gz_size: "87.41"
 
 # Theme
 google_analytics: UA-63083-12

+ 3 - 3
website/private_modules/hexo-renderer-uppyexamples/index.js

@@ -39,8 +39,8 @@ function parseExamplesBrowserify (data, options, callback) {
 
       // @TODO remove this hack
       // once this is resolved: https://github.com/hexojs/hexo/issues/1663
-      bundledJS = bundledJS.replace(/</g, ' < ');
-      // bundledJS = bundledJS.replace(/<(?!=)/g, ' < ');
+      // bundledJS = bundledJS.replace(/</g, ' < ');
+      bundledJS = bundledJS.replace(/<(?!=)/g, ' < ');
 
       callback(null, bundledJS);
     });
@@ -48,4 +48,4 @@ function parseExamplesBrowserify (data, options, callback) {
 }
 
 
-// hexo.extend.renderer.register('es6', 'js', parseExamplesBrowserify);
+hexo.extend.renderer.register('es6', 'js', parseExamplesBrowserify);

+ 1 - 0
website/themes/uppy/source/uppy/locale/en_US.js

@@ -8,6 +8,7 @@ var en_US = {};
 
 en_US.strings = {
   'choose_file': 'Choose a file',
+  'you_have_chosen': 'You have chosen: %{file_name}',
   'or_drag_drop': 'or drag it here',
   'files_chosen': {
     0: '%{smart_count} file selected',

+ 4 - 5
website/themes/uppy/source/uppy/locale/ru.js

@@ -9,17 +9,16 @@ var ru = {};
 ru.strings = {
   'choose_file': 'Выберите файл',
   'or_drag_drop': 'или перенесите его сюда',
+  'you_have_chosen': 'Вы выбрали: %{file_name}',
   // 'files_chosen': 'выбран %{smart_count} файл |||| выбрано %{smart_count} файла |||| выбрано %{smart_count} файлов'
   'files_chosen': {
-    0: 'выбран %{smart_count} файл',
-    1: 'выбрано %{smart_count} файла',
-    2: 'выбрано %{smart_count} файлов'
+    0: 'Выбран %{smart_count} файл',
+    1: 'Выбрано %{smart_count} файла',
+    2: 'Выбрано %{smart_count} файлов'
   }
 };
 
 ru.pluralize = function (n) {
-  // return n % 10 === 1 && n % 100 !== 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
-
   if (n % 10 === 1 && n % 100 !== 11) {
     return 0;
   }

+ 261 - 247
website/themes/uppy/source/uppy/uppy.js

@@ -1,4 +1,195 @@
 (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Uppy = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+
+/**
+ * Expose `Emitter`.
+ */
+
+module.exports = Emitter;
+
+/**
+ * Initialize a new `Emitter`.
+ *
+ * @api public
+ */
+
+function Emitter(obj) {
+  if (obj) return mixin(obj);
+};
+
+/**
+ * Mixin the emitter properties.
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+function mixin(obj) {
+  for (var key in Emitter.prototype) {
+    obj[key] = Emitter.prototype[key];
+  }
+  return obj;
+}
+
+/**
+ * Listen on the given `event` with `fn`.
+ *
+ * @param {String} event
+ * @param {Function} fn
+ * @return {Emitter}
+ * @api public
+ */
+
+Emitter.prototype.on =
+Emitter.prototype.addEventListener = function(event, fn){
+  this._callbacks = this._callbacks || {};
+  (this._callbacks[event] = this._callbacks[event] || [])
+    .push(fn);
+  return this;
+};
+
+/**
+ * Adds an `event` listener that will be invoked a single
+ * time then automatically removed.
+ *
+ * @param {String} event
+ * @param {Function} fn
+ * @return {Emitter}
+ * @api public
+ */
+
+Emitter.prototype.once = function(event, fn){
+  var self = this;
+  this._callbacks = this._callbacks || {};
+
+  function on() {
+    self.off(event, on);
+    fn.apply(this, arguments);
+  }
+
+  on.fn = fn;
+  this.on(event, on);
+  return this;
+};
+
+/**
+ * Remove the given callback for `event` or all
+ * registered callbacks.
+ *
+ * @param {String} event
+ * @param {Function} fn
+ * @return {Emitter}
+ * @api public
+ */
+
+Emitter.prototype.off =
+Emitter.prototype.removeListener =
+Emitter.prototype.removeAllListeners =
+Emitter.prototype.removeEventListener = function(event, fn){
+  this._callbacks = this._callbacks || {};
+
+  // all
+  if (0 == arguments.length) {
+    this._callbacks = {};
+    return this;
+  }
+
+  // specific event
+  var callbacks = this._callbacks[event];
+  if (!callbacks) return this;
+
+  // remove all handlers
+  if (1 == arguments.length) {
+    delete this._callbacks[event];
+    return this;
+  }
+
+  // remove specific handler
+  var cb;
+  for (var i = 0; i < callbacks.length; i++) {
+    cb = callbacks[i];
+    if (cb === fn || cb.fn === fn) {
+      callbacks.splice(i, 1);
+      break;
+    }
+  }
+  return this;
+};
+
+/**
+ * Emit `event` with the given args.
+ *
+ * @param {String} event
+ * @param {Mixed} ...
+ * @return {Emitter}
+ */
+
+Emitter.prototype.emit = function(event){
+  this._callbacks = this._callbacks || {};
+  var args = [].slice.call(arguments, 1)
+    , callbacks = this._callbacks[event];
+
+  if (callbacks) {
+    callbacks = callbacks.slice(0);
+    for (var i = 0, len = callbacks.length; i < len; ++i) {
+      callbacks[i].apply(this, args);
+    }
+  }
+
+  return this;
+};
+
+/**
+ * Return array of callbacks for `event`.
+ *
+ * @param {String} event
+ * @return {Array}
+ * @api public
+ */
+
+Emitter.prototype.listeners = function(event){
+  this._callbacks = this._callbacks || {};
+  return this._callbacks[event] || [];
+};
+
+/**
+ * Check if this emitter has `event` handlers.
+ *
+ * @param {String} event
+ * @return {Boolean}
+ * @api public
+ */
+
+Emitter.prototype.hasListeners = function(event){
+  return !! this.listeners(event).length;
+};
+
+},{}],2:[function(require,module,exports){
+
+/**
+ * Reduce `arr` with `fn`.
+ *
+ * @param {Array} arr
+ * @param {Function} fn
+ * @param {Mixed} initial
+ *
+ * TODO: combatible error handling?
+ */
+
+module.exports = function(arr, fn, initial){  
+  var idx = 0;
+  var len = arr.length;
+  var curr = arguments.length == 3
+    ? initial
+    : arr[idx++];
+
+  while (idx < len) {
+    curr = fn.call(null, curr, arr[idx], ++idx, arr);
+  }
+  
+  return curr;
+};
+},{}],3:[function(require,module,exports){
 /**
  * Module dependencies.
  */
@@ -1181,198 +1372,7 @@ request.put = function(url, data, fn){
 
 module.exports = request;
 
-},{"emitter":2,"reduce":3}],2:[function(require,module,exports){
-
-/**
- * Expose `Emitter`.
- */
-
-module.exports = Emitter;
-
-/**
- * Initialize a new `Emitter`.
- *
- * @api public
- */
-
-function Emitter(obj) {
-  if (obj) return mixin(obj);
-};
-
-/**
- * Mixin the emitter properties.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
-
-function mixin(obj) {
-  for (var key in Emitter.prototype) {
-    obj[key] = Emitter.prototype[key];
-  }
-  return obj;
-}
-
-/**
- * Listen on the given `event` with `fn`.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
-
-Emitter.prototype.on =
-Emitter.prototype.addEventListener = function(event, fn){
-  this._callbacks = this._callbacks || {};
-  (this._callbacks[event] = this._callbacks[event] || [])
-    .push(fn);
-  return this;
-};
-
-/**
- * Adds an `event` listener that will be invoked a single
- * time then automatically removed.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
-
-Emitter.prototype.once = function(event, fn){
-  var self = this;
-  this._callbacks = this._callbacks || {};
-
-  function on() {
-    self.off(event, on);
-    fn.apply(this, arguments);
-  }
-
-  on.fn = fn;
-  this.on(event, on);
-  return this;
-};
-
-/**
- * Remove the given callback for `event` or all
- * registered callbacks.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
-
-Emitter.prototype.off =
-Emitter.prototype.removeListener =
-Emitter.prototype.removeAllListeners =
-Emitter.prototype.removeEventListener = function(event, fn){
-  this._callbacks = this._callbacks || {};
-
-  // all
-  if (0 == arguments.length) {
-    this._callbacks = {};
-    return this;
-  }
-
-  // specific event
-  var callbacks = this._callbacks[event];
-  if (!callbacks) return this;
-
-  // remove all handlers
-  if (1 == arguments.length) {
-    delete this._callbacks[event];
-    return this;
-  }
-
-  // remove specific handler
-  var cb;
-  for (var i = 0; i < callbacks.length; i++) {
-    cb = callbacks[i];
-    if (cb === fn || cb.fn === fn) {
-      callbacks.splice(i, 1);
-      break;
-    }
-  }
-  return this;
-};
-
-/**
- * Emit `event` with the given args.
- *
- * @param {String} event
- * @param {Mixed} ...
- * @return {Emitter}
- */
-
-Emitter.prototype.emit = function(event){
-  this._callbacks = this._callbacks || {};
-  var args = [].slice.call(arguments, 1)
-    , callbacks = this._callbacks[event];
-
-  if (callbacks) {
-    callbacks = callbacks.slice(0);
-    for (var i = 0, len = callbacks.length; i < len; ++i) {
-      callbacks[i].apply(this, args);
-    }
-  }
-
-  return this;
-};
-
-/**
- * Return array of callbacks for `event`.
- *
- * @param {String} event
- * @return {Array}
- * @api public
- */
-
-Emitter.prototype.listeners = function(event){
-  this._callbacks = this._callbacks || {};
-  return this._callbacks[event] || [];
-};
-
-/**
- * Check if this emitter has `event` handlers.
- *
- * @param {String} event
- * @return {Boolean}
- * @api public
- */
-
-Emitter.prototype.hasListeners = function(event){
-  return !! this.listeners(event).length;
-};
-
-},{}],3:[function(require,module,exports){
-
-/**
- * Reduce `arr` with `fn`.
- *
- * @param {Array} arr
- * @param {Function} fn
- * @param {Mixed} initial
- *
- * TODO: combatible error handling?
- */
-
-module.exports = function(arr, fn, initial){  
-  var idx = 0;
-  var len = arr.length;
-  var curr = arguments.length == 3
-    ? initial
-    : arr[idx++];
-
-  while (idx < len) {
-    curr = fn.call(null, curr, arr[idx], ++idx, arr);
-  }
-  
-  return curr;
-};
-},{}],4:[function(require,module,exports){
+},{"emitter":1,"reduce":2}],4:[function(require,module,exports){
 (function (global){
 (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.tus = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
 "use strict";
@@ -1902,8 +1902,6 @@ var _coreUtils = require('../core/Utils');
 
 var _coreUtils2 = _interopRequireDefault(_coreUtils);
 
-// import Polyglot from 'node-polyglot';
-
 var _coreTranslator = require('../core/Translator');
 
 var _coreTranslator2 = _interopRequireDefault(_coreTranslator);
@@ -1920,14 +1918,12 @@ var Core = (function () {
 
     // set default options
     var defaultOptions = {
-      // locale: 'en_US'
       // load English as the default locale
       locale: require('../locale/en_US.js')
     };
 
     // Merge default options with the ones set by user
-    this.opts = defaultOptions;
-    Object.assign(this.opts, opts);
+    this.opts = Object.assign({}, defaultOptions, opts);
 
     // Dictates in what order different plugin types are ran:
     this.types = ['presetter', 'selecter', 'uploader'];
@@ -1937,12 +1933,6 @@ var Core = (function () {
     // Container for different types of plugins
     this.plugins = {};
 
-    // trying out Polyglot
-    // this.polyglot = new Polyglot({locale: 'ru'});
-    // this.polyglot.extend(this.opts.locale);
-    // console.log(this.polyglot.t('files_chosen', {smart_count: 100}));
-
-    // rolling out custom translation
     this.translator = new _coreTranslator2['default']({ locale: this.opts.locale });
     console.log(this.translator.t('files_chosen', { smart_count: 3 }));
   }
@@ -1967,26 +1957,7 @@ var Core = (function () {
     }
 
     /**
-    * Translate a string into the selected language (this.locale).
-    * Return the original string if locale is undefined
-    *
-    * @param {string} string that needs translating
-    * @return {string} translated string
-    */
-    // translate(key, opts) {
-    //   const dictionary = this.opts.locale;
-    //
-    //   // if locale is unspecified, or the translation is missing,
-    //   // return the original string
-    //   if (!dictionary || !dictionary[string]) {
-    //     return string;
-    //   }
-    //
-    //   return dictionary[string];
-    // }
-
-    /**
-    * Sets plugin’s progress, for uploads for example
+    * Sets plugin’s progress, like for uploads
     *
     * @param {object} plugin that wants to set progress
     * @param {integer} percentage
@@ -2031,10 +2002,6 @@ var Core = (function () {
         method: 'run'
       });
 
-      // console.log(
-      //   `translation is all like: ${this.translate('number_of_files_chosen', {number: 5})}`
-      // );
-
       // First we select only plugins of current type,
       // then create an array of runType methods of this plugins
       var typeMethods = this.types.filter(function (type) {
@@ -2059,9 +2026,15 @@ module.exports = exports['default'];
 
 },{"../core/Translator":6,"../core/Utils":7,"../locale/en_US.js":10}],6:[function(require,module,exports){
 /**
-* Translates strings with interpolation & pluralization support. Extensible with custom dictionaries and pluralization functions.
-* Borrows heavily from and inspired by Polyglot https://github.com/airbnb/polyglot.js. Differences: pluralization functions are not hardcoded and can be easily added among with dictionaries.
-* Usage example: translator.t('files_chosen', {smart_count: 3})
+* Translates strings with interpolation & pluralization support.Extensible with custom dictionaries
+* and pluralization functions.
+*
+* Borrows heavily from and inspired by Polyglot https://github.com/airbnb/polyglot.js,
+* basically a stripped-down version of it. Differences: pluralization functions are not hardcoded
+* and can be easily added among with dictionaries, nested objects are used for pluralization
+* as opposed to `||||` delimeter
+*
+* Usage example: `translator.t('files_chosen', {smart_count: 3})`
 *
 * @param {opts}
 */
@@ -2079,29 +2052,25 @@ var Translator = (function () {
   function Translator(opts) {
     _classCallCheck(this, Translator);
 
-    var defaultOptions = {
-      // load English as the default locale
-      // locale: require('../locale/en_US.js')
-    };
-
-    this.opts = defaultOptions;
-    Object.assign(this.opts, opts);
-
-    // console.log('--> and the locale will be...');
-    // console.log(this.opts.locale);
+    var defaultOptions = {};
+    this.opts = Object.assign({}, defaultOptions, opts);
   }
 
   /**
-  * Takes a string with placeholder variables like '%{smart_count} file selected' and replaces it with values from options {smart_count: 5}
+  * Takes a string with placeholder variables like `%{smart_count} file selected`
+  * and replaces it with values from options `{smart_count: 5}`
   *
   * @param {string} phrase that needs interpolation, with placeholders
   * @param {object} options with values that will be used to replace placeholders
+  * @return {string} interpolated
   */
 
   _createClass(Translator, [{
     key: 'interpolate',
     value: function interpolate(phrase, options) {
       var replace = String.prototype.replace;
+      var dollarRegex = /\$/g;
+      var dollarBillsYall = '$$$$';
 
       for (var arg in options) {
         if (arg !== '_' && options.hasOwnProperty(arg)) {
@@ -2131,7 +2100,7 @@ var Translator = (function () {
   }, {
     key: 't',
     value: function t(key, options) {
-      if (options.smart_count) {
+      if (options && options.smart_count) {
         var plural = this.opts.locale.pluralize(options.smart_count);
         return this.interpolate(this.opts.locale.strings[key][plural], options);
       } else {
@@ -2147,6 +2116,14 @@ exports['default'] = Translator;
 module.exports = exports['default'];
 
 },{}],7:[function(require,module,exports){
+/**
+* Runs a waterfall of promises: calls each task, passing the result
+* from the previous one as an argument. The first task is run with an empty array.
+*
+* @param {Array} tasks an array of Promises to run waterfall on
+* @return {Promise} of the last task
+*/
+
 'use strict';
 
 Object.defineProperty(exports, '__esModule', {
@@ -2169,7 +2146,14 @@ function promiseWaterfall(_ref) {
   return finalTaskPromise;
 }
 
-// This is how we roll $('.element').toggleClass in non-jQuery world
+/**
+* Toggles a class on a DOM element
+* This is how we roll $('.element').toggleClass in a non-jQuery world
+*
+* @param {String} el selector
+* @param {String} className to toggle
+* @return {String}
+*/
 function toggleClass(el, className) {
   if (el.classList) {
     el.classList.toggle(className);
@@ -2186,6 +2170,13 @@ function toggleClass(el, className) {
   }
 }
 
+/**
+* Adds a class to a DOM element
+*
+* @param {String} el selector
+* @param {String} className to add
+* @return {String}
+*/
 function addClass(el, className) {
   if (el.classList) {
     el.classList.add(className);
@@ -2194,6 +2185,13 @@ function addClass(el, className) {
   }
 }
 
+/**
+* Removes a class to a DOM element
+*
+* @param {String} el selector
+* @param {String} className to remove
+* @return {String}
+*/
 function removeClass(el, className) {
   if (el.classList) {
     el.classList.remove(className);
@@ -2202,11 +2200,19 @@ function removeClass(el, className) {
   }
 }
 
-// $form.on('drag dragstart dragend dragover dragenter dragleave drop');
-function addListenerMulti(el, events, func) {
+/**
+* Adds multiple listeners to to a DOM element
+* Equvalent to jQuery’s `$form.on('drag dragstart dragend dragover dragenter dragleave drop')`.
+*
+* @param {String} el selector
+* @param {String} events to add, like `drag dragstart dragend dragover dragenter dragleave drop`
+* @param {requestCallback} cb
+* @return {String}
+*/
+function addListenerMulti(el, events, cb) {
   var eventsArray = events.split(' ');
   for (var _event in eventsArray) {
-    el.addEventListener(eventsArray[_event], func, false);
+    el.addEventListener(eventsArray[_event], cb, false);
   }
 }
 
@@ -2271,6 +2277,7 @@ var en_US = {};
 
 en_US.strings = {
   'choose_file': 'Choose a file',
+  'you_have_chosen': 'You have chosen: %{file_name}',
   'or_drag_drop': 'or drag it here',
   'files_chosen': {
     0: '%{smart_count} file selected',
@@ -2620,7 +2627,7 @@ var Dropbox = (function (_Plugin) {
 exports['default'] = Dropbox;
 module.exports = exports['default'];
 
-},{"../core/Utils":7,"./Plugin":15,"superagent":1}],13:[function(require,module,exports){
+},{"../core/Utils":7,"./Plugin":15,"superagent":3}],13:[function(require,module,exports){
 'use strict';
 
 Object.defineProperty(exports, '__esModule', {
@@ -2981,6 +2988,13 @@ var Tus10 = (function (_Plugin) {
     this.type = 'uploader';
   }
 
+  /**
+  * Add files to an array of `upload()` calles, passing the current and total file count numbers
+  *
+  * @param {array | object} results
+  * @returns {Promise} of parallel uploads `Promise.all(uploaders)`
+  */
+
   _createClass(Tus10, [{
     key: 'run',
     value: function run(results) {