From f91d65ec8378fa0abcf52ffaeb988457a4e297cf Mon Sep 17 00:00:00 2001 From: "artem.bukin" Date: Tue, 25 Jan 2022 14:16:42 +0300 Subject: [PATCH 1/2] Added Strip script --- Scripts/Strip.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Scripts/Strip.js diff --git a/Scripts/Strip.js b/Scripts/Strip.js new file mode 100644 index 00000000..91c6ff6e --- /dev/null +++ b/Scripts/Strip.js @@ -0,0 +1,16 @@ +/** + { + "api":1, + "name":"Strip", + "description":"Strip all whitespaces.", + "author":"Artem Bukin", + "icon":"scissors", + "tags":"strip,whitespace,empty,space", + } +**/ + +function main(state) { + + state.text = state.text.replace(/\s/g, ''); + +} From 620f3210eeb2403e76782be6bc17540800229e5e Mon Sep 17 00:00:00 2001 From: "artem.bukin" Date: Tue, 18 Jul 2023 15:36:58 +0300 Subject: [PATCH 2/2] ip 2 num scripts --- Scripts/ip2num.js | 21 +++++++++++++++++++++ Scripts/num2ip.js | 26 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Scripts/ip2num.js create mode 100644 Scripts/num2ip.js diff --git a/Scripts/ip2num.js b/Scripts/ip2num.js new file mode 100644 index 00000000..7395a11e --- /dev/null +++ b/Scripts/ip2num.js @@ -0,0 +1,21 @@ +/** + { + "api":1, + "name":"ip2num", + "description":"Convert ip to number", + "author":"Artem Bukin", + "icon":"scissors", + "tags":"convert,ip", + } +**/ + +function dot2num(dot) +{ + var d = dot.split('.'); + return ((((((+d[0])*256)+(+d[1]))*256)+(+d[2]))*256)+(+d[3]); +} + +function main(state) { + + state.text = dot2num(state.text); +} diff --git a/Scripts/num2ip.js b/Scripts/num2ip.js new file mode 100644 index 00000000..238d1c2f --- /dev/null +++ b/Scripts/num2ip.js @@ -0,0 +1,26 @@ +/** + { + "api":1, + "name":"num2ip", + "description":"Convert number to ip", + "author":"Artem Bukin", + "icon":"scissors", + "tags":"convert,ip", + } +**/ + +function num2dot(num) +{ + var d = num%256; + for (var i = 3; i > 0; i--) + { + num = Math.floor(num/256); + d = num%256 + '.' + d; + } + return d; +} + +function main(state) { + + state.text = num2dot(state.text); +}