summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/js/deluge-all/data/SortTypes.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:38:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:38:38 +0000
commit2e2851dc13d73352530dd4495c7e05603b2e520d (patch)
tree622b9cd8e5d32091c9aa9e4937b533975a40356c /deluge/ui/web/js/deluge-all/data/SortTypes.js
parentInitial commit. (diff)
downloaddeluge-upstream.tar.xz
deluge-upstream.zip
Adding upstream version 2.1.2~dev0+20240219.upstream/2.1.2_dev0+20240219upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'deluge/ui/web/js/deluge-all/data/SortTypes.js')
-rw-r--r--deluge/ui/web/js/deluge-all/data/SortTypes.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/deluge/ui/web/js/deluge-all/data/SortTypes.js b/deluge/ui/web/js/deluge-all/data/SortTypes.js
new file mode 100644
index 0000000..ac915d1
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/data/SortTypes.js
@@ -0,0 +1,37 @@
+/**
+ * Deluge.data.SortTypes.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.data');
+
+/**
+ * Common sort functions that can be used for data Stores.
+ *
+ * @author Damien Churchill <damoxc@gmail.com>
+ * @version 1.3
+ *
+ * @class Deluge.data.SortTypes
+ * @singleton
+ */
+Deluge.data.SortTypes = {
+ // prettier-ignore
+ asIPAddress: function(value) {
+ var d = value.match(
+ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/
+ );
+ return ((+d[1] * 256 + (+d[2])) * 256 + (+d[3])) * 256 + (+d[4]);
+ },
+
+ asQueuePosition: function (value) {
+ return value > -1 ? value : Number.MAX_VALUE;
+ },
+
+ asName: function (value) {
+ return String(value).toLowerCase();
+ },
+};