(function($) { var plugins = [ { "id": "CHOOSE", "name": "Please choose your conversion ...", "convert": function (input) { return { "status": "OK", "content": "" }; } }, { "id": "base64decode", "name": "Decode Base64", "convert": function (input) { try { return { "status": "OK", "content": atob(input) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid base64 input string." }; } } }, { "id": "decodeuri", "name": "Decode URI", "convert": function (input) { try { return { "status": "OK", "content": decodeURI(input) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid URI input string." }; } } }, { "id": "decodeuricomponent", "name": "Decode URI component", "convert": function (input) { try { return { "status": "OK", "content": decodeURIComponent(input) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid URI component input string." }; } } }, { "id": "decodehtmlentities", "name": "Decode HTML entities", "convert": function (input) { try { return { "status": "OK", "content": input .replace(/\"\;/g, "\"") .replace(/\>\;/g, ">") .replace(/\<\;/g, "<") .replace(/\&\;/g, "&") }; } catch (exception) { return { "status": "ERROR", "content": "Invalid HTML entity string." }; } } }, { "id": "decodequotedprintable", "name": "Decode quoted printable", "convert": function (input) { try { return { "status": "OK", "content": utf8.decode(quotedPrintable.decode(input)) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid quoted printable string." }; } } }, { "id": "hextodec", "name": "Decode hex as decimal", "convert": function (input) { try { return { "status": "OK", "content": parseInt(input, 16).toString(10) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid number (integer) string." }; } } }, { "id": "bintodec", "name": "Decode binary as decimal", "convert": function (input) { try { return { "status": "OK", "content": parseInt(input, 2).toString(10) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid number (integer) string." }; } } }, { "id": "base64encode", "name": "Encode Base64", "convert": function (input) { return { "status": "OK", "content": btoa(input) }; } }, { "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, ">") .replace(/\"/g, """) }; } }, { "id": "encodequotedprintable", "name": "Encode quoted printable", "convert": function (input) { return { "status": "OK", "content": quotedPrintable.encode(utf8.encode(input)) }; } }, { "id": "dectohex", "name": "Encode decimal as hex", "convert": function (input) { try { return { "status": "OK", "content": parseInt(input).toString(16) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid number (integer) string." }; } } }, { "id": "dectobin", "name": "Encode decimal as binary", "convert": function (input) { try { return { "status": "OK", "content": parseInt(input).toString(2) }; } catch (exception) { return { "status": "ERROR", "content": "Invalid number (integer) string." }; } } } ]; var optiontemplate = ""; var template = "