reordered plugins: first list encodings, then decodings

This commit is contained in:
Manuel Friedli 2015-03-26 22:25:01 +01:00
parent feb7939488
commit 7d2cdac227

View file

@ -12,7 +12,7 @@
}, },
{ {
"id": "base64encode", "id": "base64encode",
"name": "Base64 encode", "name": "Encode Base64",
"convert": function (input) { "convert": function (input) {
return { return {
"status": "OK", "status": "OK",
@ -20,9 +20,45 @@
}; };
} }
}, },
{
"id": "encodeuri",
"name": "Encode URI",
"convert": function (input) {
return {
"status": "OK",
"content": encodeURI(input).replace(/%5B/g, '[').replace(/%5D/g, ']')
};
}
},
{
"id": "encodeuricomponent",
"name": "Encode URI component",
"convert": function (input) {
return {
"status": "OK",
"content": encodeURIComponent(input).replace(/[!'()*]/g, function(c) {
return '%' + c.charCodeAt(0).toString(16);
})
};
}
},
{
"id": "encodehtmlentities",
"name": "Encode HTML entities",
"convert": function (input) {
return {
"status": "OK",
"content": input
.replace(/\&/g, "&")
.replace(/\</g, "&lt;")
.replace(/\>/g, "&gt;")
.replace(/\"/g, "&quot;")
};
}
},
{ {
"id": "base64decode", "id": "base64decode",
"name": "Base64 decode", "name": "Decode Base64",
"convert": function (input) { "convert": function (input) {
try { try {
return { return {
@ -37,16 +73,6 @@
} }
} }
}, },
{
"id": "encodeuri",
"name": "Encode URI",
"convert": function (input) {
return {
"status": "OK",
"content": encodeURI(input).replace(/%5B/g, '[').replace(/%5D/g, ']')
};
}
},
{ {
"id": "decodeuri", "id": "decodeuri",
"name": "Decode URI", "name": "Decode URI",
@ -64,18 +90,6 @@
} }
} }
}, },
{
"id": "encodeuricomponent",
"name": "Encode URI component",
"convert": function (input) {
return {
"status": "OK",
"content": encodeURIComponent(input).replace(/[!'()*]/g, function(c) {
return '%' + c.charCodeAt(0).toString(16);
})
};
}
},
{ {
"id": "decodeuricomponent", "id": "decodeuricomponent",
"name": "Decode URI component", "name": "Decode URI component",
@ -93,20 +107,6 @@
} }
} }
}, },
{
"id": "encodehtmlentities",
"name": "Encode HTML entities",
"convert": function (input) {
return {
"status": "OK",
"content": input
.replace(/\&/g, "&amp;")
.replace(/\</g, "&lt;")
.replace(/\>/g, "&gt;")
.replace(/\"/g, "&quot;")
};
}
},
{ {
"id": "decodehtmlentities", "id": "decodehtmlentities",
"name": "Decode HTML entities", "name": "Decode HTML entities",