[Python-apps-commits] r14538 - in packages/sabnzbdplus/trunk (5 files)

jcfp-guest at users.alioth.debian.org jcfp-guest at users.alioth.debian.org
Tue Jan 2 21:22:51 UTC 2018


    Date: Tuesday, January 2, 2018 @ 21:22:49
  Author: jcfp-guest
Revision: 14538

copyright, missing-sources: add filesize.js

Added:
  packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize.js
  packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize_3.5.11.js
Modified:
  packages/sabnzbdplus/trunk/debian/changelog
  packages/sabnzbdplus/trunk/debian/copyright
  packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/README

Modified: packages/sabnzbdplus/trunk/debian/changelog
===================================================================
--- packages/sabnzbdplus/trunk/debian/changelog	2018-01-02 19:56:35 UTC (rev 14537)
+++ packages/sabnzbdplus/trunk/debian/changelog	2018-01-02 21:22:49 UTC (rev 14538)
@@ -9,10 +9,10 @@
   * Copyright:
     + bump packaging year to 2018.
     + update info for six, moment.js, bootstrap3-typeahead.
-    + add entries for jquery-qrcode.
+    + add entries for jquery-qrcode, filesize.js.
   * Missing-sources:
     + bump moment.js, bootstrap3-typeahead to match upstream.
-    + add source for jquery-qrcode.
+    + add sources for jquery-qrcode, filesize.js.
 
  -- JCF Ploemen (jcfp) <linux at jcf.pm>  Tue, 02 Jan 2018 18:51:08 +0000
 

Modified: packages/sabnzbdplus/trunk/debian/copyright
===================================================================
--- packages/sabnzbdplus/trunk/debian/copyright	2018-01-02 19:56:35 UTC (rev 14537)
+++ packages/sabnzbdplus/trunk/debian/copyright	2018-01-02 21:22:49 UTC (rev 14538)
@@ -292,6 +292,40 @@
 License: dual-licensed MIT, WTFPL
 
 
+* interfaces/Config/templates/staticcfg/js/filesize.min.js
+* interfaces/Config/templates/staticcfg/js/src/filesize_3.5.11.js
+	Copyright (C) 2017 Jason Mulligan <jason.mulligan at avoidwork.com>
+	Origin: https://github.com/avoidwork/filesize.js
+License:
+	Copyright (c) 2017, Jason Mulligan
+	All rights reserved.
+
+	Redistribution and use in source and binary forms, with or without
+	modification, are permitted provided that the following conditions are met:
+
+	* Redistributions of source code must retain the above copyright notice, this
+	  list of conditions and the following disclaimer.
+
+	* Redistributions in binary form must reproduce the above copyright notice,
+	  this list of conditions and the following disclaimer in the documentation
+	  and/or other materials provided with the distribution.
+
+	* Neither the name of filesize nor the names of its
+	  contributors may be used to endorse or promote products derived from
+	  this software without specific prior written permission.
+
+	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+	DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+	FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+	DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+	SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+	CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+	OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+	OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
 * interfaces/Glitter/templates/static/javascripts/date.min.js
 	Copyright (C) 2015 by Gregory Wild-Smith <gregory at wild-smith.com>
 	Origin: https://github.com/abritinthebay/datejs

Modified: packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/README
===================================================================
--- packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/README	2018-01-02 19:56:35 UTC (rev 14537)
+++ packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/README	2018-01-02 21:22:49 UTC (rev 14538)
@@ -1,8 +1,8 @@
 This directory holds sources for minified javascript files, for Debian
 policy compliance reasons.
 
-# interfaces/Config/templates/staticcfg/js/jquery-3.1.1.min.js
-jQuery 3.1.1
+# interfaces/Config/templates/staticcfg/js/jquery-3.2.1.min.js
+jQuery 3.2.1
 
 # interfaces/Config/templates/staticcfg/js/jquery-ui.min.js
 jquery-ui 1.12.1
@@ -17,3 +17,6 @@
 
 # interfaces/Config/templates/staticcfg/js/chartist.min.js
 chartist 0.11.0
+
+# interfaces/Config/templates/staticcfg/js/filesize.min.js
+filesize 3.5.11

Added: packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize.js
===================================================================
--- packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize.js	                        (rev 0)
+++ packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize.js	2018-01-02 21:22:49 UTC (rev 14538)
@@ -0,0 +1 @@
+link README
\ No newline at end of file


Property changes on: packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize.js
___________________________________________________________________
Added: svn:special
   + *

Added: packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize_3.5.11.js
===================================================================
--- packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize_3.5.11.js	                        (rev 0)
+++ packages/sabnzbdplus/trunk/missing-sources/interfaces/Config/templates/staticcfg/js/src/filesize_3.5.11.js	2018-01-02 21:22:49 UTC (rev 14538)
@@ -0,0 +1,110 @@
+	/**
+	 * filesize
+	 *
+	 * @method filesize
+	 * @param  {Mixed}   arg        String, Int or Float to transform
+	 * @param  {Object}  descriptor [Optional] Flags
+	 * @return {String}             Readable file size String
+	 */
+	function filesize (arg, descriptor = {}) {
+		let result = [],
+			val = 0,
+			e, base, bits, ceil, full, fullforms, neg, num, output, round, unix, spacer, standard, symbols;
+
+		if (isNaN(arg)) {
+			throw new Error("Invalid arguments");
+		}
+
+		bits = descriptor.bits === true;
+		unix = descriptor.unix === true;
+		base = descriptor.base || 2;
+		round = descriptor.round !== undefined ? descriptor.round : unix ? 1 : 2;
+		spacer = descriptor.spacer !== undefined ? descriptor.spacer : unix ? "" : " ";
+		symbols = descriptor.symbols || descriptor.suffixes || {};
+		standard = base === 2 ? descriptor.standard || "jedec" : "jedec";
+		output = descriptor.output || "string";
+		full = descriptor.fullform === true;
+		fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
+		e = descriptor.exponent !== undefined ? descriptor.exponent : -1;
+		num = Number(arg);
+		neg = num < 0;
+		ceil = base > 2 ? 1000 : 1024;
+
+		// Flipping a negative number to determine the size
+		if (neg) {
+			num = -num;
+		}
+
+		// Determining the exponent
+		if (e === -1 || isNaN(e)) {
+			e = Math.floor(Math.log(num) / Math.log(ceil));
+
+			if (e < 0) {
+				e = 0;
+			}
+		}
+
+		// Exceeding supported length, time to reduce & multiply
+		if (e > 8) {
+			e = 8;
+		}
+
+		// Zero is now a special case because bytes divide by 1
+		if (num === 0) {
+			result[0] = 0;
+			result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
+		} else {
+			val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
+
+			if (bits) {
+				val = val * 8;
+
+				if (val >= ceil && e < 8) {
+					val = val / ceil;
+					e++;
+				}
+			}
+
+			result[0] = Number(val.toFixed(e > 0 ? round : 0));
+			result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
+
+			if (unix) {
+				result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
+
+				if (b.test(result[1])) {
+					result[0] = Math.floor(result[0]);
+					result[1] = "";
+				}
+			}
+		}
+
+		// Decorating a 'diff'
+		if (neg) {
+			result[0] = -result[0];
+		}
+
+		// Applying custom symbol
+		result[1] = symbols[result[1]] || result[1];
+
+		// Returning Array, Object, or String (default)
+		if (output === "array") {
+			return result;
+		}
+
+		if (output === "exponent") {
+			return e;
+		}
+
+		if (output === "object") {
+			return {value: result[0], suffix: result[1], symbol: result[1]};
+		}
+
+		if (full) {
+			result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
+		}
+
+		return result.join(spacer);
+	}
+
+	// Partial application for functional programming
+	filesize.partial = opt => arg => filesize(arg, opt);




More information about the Python-apps-commits mailing list