From 9e9579721124c86db9d84a3a3341e833d062e0ab Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Tue, 20 Sep 2016 22:10:32 +0200 Subject: [PATCH] simplified quoted printable stuff --- app/converter/quotedprintabledecoder.ts | 29 +++---------------------- app/converter/quotedprintableencoder.ts | 5 +++-- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/app/converter/quotedprintabledecoder.ts b/app/converter/quotedprintabledecoder.ts index 834b048..e34c238 100644 --- a/app/converter/quotedprintabledecoder.ts +++ b/app/converter/quotedprintabledecoder.ts @@ -1,12 +1,10 @@ import {Converter} from "./converter"; -declare var window:any; +declare var utf8:any; +declare var quotedPrintable:any; export class QuotedPrintableDecoder implements Converter { - private utf8:any = window.utf8; - private quotedPrintable:any = window.quotedPrintable; - getDisplayname():string { return "Decode quoted printable"; } @@ -16,27 +14,6 @@ export class QuotedPrintableDecoder implements Converter { } convert(input:string):string { - return this.utf8.decode(this.quotedPrintable.decode(input)); + return utf8.decode(quotedPrintable.decode(input)); } } - -/* - { - "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." - }; - } - } - }, - - */ \ No newline at end of file diff --git a/app/converter/quotedprintableencoder.ts b/app/converter/quotedprintableencoder.ts index 9276161..8f87109 100644 --- a/app/converter/quotedprintableencoder.ts +++ b/app/converter/quotedprintableencoder.ts @@ -1,6 +1,7 @@ import {Converter} from "./converter"; -declare var window:any; +declare var utf8:any; +declare var quotedPrintable:any; export class QuotedPrintableEncoder implements Converter { @@ -13,6 +14,6 @@ export class QuotedPrintableEncoder implements Converter { } convert(input:string):string { - return window.quotedPrintable.encode(window.utf8.encode(input)); + return quotedPrintable.encode(utf8.encode(input)); } }