Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new scripts #370

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Scripts/Strip.js
Original file line number Diff line number Diff line change
@@ -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, '');

}
21 changes: 21 additions & 0 deletions Scripts/ip2num.js
Original file line number Diff line number Diff line change
@@ -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);
}
26 changes: 26 additions & 0 deletions Scripts/num2ip.js
Original file line number Diff line number Diff line change
@@ -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);
}