Various updates
This commit is contained in:
parent
b7db6d14d3
commit
414c0588f7
40 changed files with 11 additions and 755 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"project": {
|
||||
"name": "conv.friedli.info"
|
||||
"name": "convertorizr"
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
|||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/src/**/*.js
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# conv.friedli.info - Convert whatever you want!
|
||||
# convertorizr - Convert whatever you want!
|
||||
|
||||
This is a short introduction to the awesome converter hosted at [https://conv.friedli.info/].
|
||||
This is a short introduction to the awesome Convertorizr hosted at [https://conv.friedli.info/].
|
||||
|
||||
Deployment is automated with Gitlab CI. Usage is self-explanatory. What else do you need to know?
|
||||
|
||||
Contact the author at manuel-conv.friedli.info|at|fritteli.ch.
|
||||
Contact the author at manuel-convertorizr|at|fritteli.ch.
|
||||
|
||||
Cheers!
|
||||
|
||||
# AngularCliTestproject
|
||||
# Technical stuff
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {ConvFriedliInfoPage} from "./app.po";
|
||||
import {ConvertorizrPage} from "./app.po";
|
||||
|
||||
describe('conv.friedli.info App', () => {
|
||||
let page: ConvFriedliInfoPage;
|
||||
describe('convertorizr App', () => {
|
||||
let page: ConvertorizrPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new ConvFriedliInfoPage();
|
||||
page = new ConvertorizrPage();
|
||||
});
|
||||
|
||||
it('should display message saying app works', () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {browser, by, element} from "protractor";
|
||||
|
||||
export class ConvFriedliInfoPage {
|
||||
export class ConvertorizrPage {
|
||||
navigateTo() {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var core_1 = require('@angular/core');
|
||||
var router_1 = require('@angular/router');
|
||||
var routes = [
|
||||
{
|
||||
path: '',
|
||||
children: []
|
||||
}
|
||||
];
|
||||
var AppRoutingModule = (function () {
|
||||
function AppRoutingModule() {
|
||||
}
|
||||
AppRoutingModule = __decorate([
|
||||
core_1.NgModule({
|
||||
imports: [router_1.RouterModule.forRoot(routes)],
|
||||
exports: [router_1.RouterModule]
|
||||
})
|
||||
], AppRoutingModule);
|
||||
return AppRoutingModule;
|
||||
}());
|
||||
exports.AppRoutingModule = AppRoutingModule;
|
|
@ -1,65 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var core_1 = require("@angular/core");
|
||||
var converterregistry_service_1 = require("./converterregistry.service");
|
||||
var inputcomponentmanager_service_1 = require("./inputcomponentmanager.service");
|
||||
var nativelibrarywrapper_service_1 = require("./nativelibrarywrapper.service");
|
||||
var AppComponent = (function () {
|
||||
function AppComponent(converterRegistryService, inputComponentManagerService) {
|
||||
this.converterRegistryService = converterRegistryService;
|
||||
this.inputComponentManagerService = inputComponentManagerService;
|
||||
this.steps = [];
|
||||
this.converters = [];
|
||||
}
|
||||
AppComponent.prototype.convert = function (step, $event) {
|
||||
step.selectedConverter = this.converterRegistryService.getConverter($event.target.selectedOptions[0].id);
|
||||
this.update(step);
|
||||
};
|
||||
AppComponent.prototype.update = function (step) {
|
||||
var converter = step.selectedConverter;
|
||||
if (converter !== undefined) {
|
||||
var content = step.content;
|
||||
var result = void 0;
|
||||
try {
|
||||
result = converter.convert(content);
|
||||
}
|
||||
catch (error) {
|
||||
if (typeof console === "object" && typeof console.log === "function") {
|
||||
console.log(error);
|
||||
}
|
||||
step.message = error.message;
|
||||
step.error = true;
|
||||
result = null;
|
||||
}
|
||||
if (result !== null) {
|
||||
step.message = "";
|
||||
step.error = false;
|
||||
if (result !== "") {
|
||||
var nextComponent = this.inputComponentManagerService.getNext(step);
|
||||
nextComponent.content = result;
|
||||
this.update(nextComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
AppComponent.prototype.ngOnInit = function () {
|
||||
this.converters = this.converterRegistryService.getAllConverters();
|
||||
this.steps = this.inputComponentManagerService.getAllComponents();
|
||||
this.inputComponentManagerService.getFirst();
|
||||
};
|
||||
AppComponent = __decorate([
|
||||
core_1.Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
providers: [converterregistry_service_1.ConverterRegistryService, inputcomponentmanager_service_1.InputComponentManagerService, nativelibrarywrapper_service_1.NativeLibraryWrapperService]
|
||||
})
|
||||
], AppComponent);
|
||||
return AppComponent;
|
||||
}());
|
||||
exports.AppComponent = AppComponent;
|
|
@ -1,21 +0,0 @@
|
|||
"use strict";
|
||||
var testing_1 = require('@angular/core/testing');
|
||||
var testing_2 = require('@angular/router/testing');
|
||||
var app_component_1 = require('./app.component');
|
||||
describe('AppComponent', function () {
|
||||
beforeEach(testing_1.async(function () {
|
||||
testing_1.TestBed.configureTestingModule({
|
||||
imports: [
|
||||
testing_2.RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
app_component_1.AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
it('should create the app', testing_1.async(function () {
|
||||
var fixture = testing_1.TestBed.createComponent(app_component_1.AppComponent);
|
||||
var app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
});
|
|
@ -1,34 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var platform_browser_1 = require('@angular/platform-browser');
|
||||
var core_1 = require('@angular/core');
|
||||
var forms_1 = require('@angular/forms');
|
||||
var http_1 = require('@angular/http');
|
||||
var app_routing_module_1 = require('./app-routing.module');
|
||||
var app_component_1 = require('./app.component');
|
||||
var AppModule = (function () {
|
||||
function AppModule() {
|
||||
}
|
||||
AppModule = __decorate([
|
||||
core_1.NgModule({
|
||||
declarations: [
|
||||
app_component_1.AppComponent
|
||||
],
|
||||
imports: [
|
||||
platform_browser_1.BrowserModule,
|
||||
forms_1.FormsModule,
|
||||
http_1.HttpModule,
|
||||
app_routing_module_1.AppRoutingModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [app_component_1.AppComponent]
|
||||
})
|
||||
], AppModule);
|
||||
return AppModule;
|
||||
}());
|
||||
exports.AppModule = AppModule;
|
|
@ -1,21 +0,0 @@
|
|||
"use strict";
|
||||
var Base64Decoder = (function () {
|
||||
function Base64Decoder() {
|
||||
}
|
||||
Base64Decoder.prototype.getDisplayname = function () {
|
||||
return "Decode Base 64";
|
||||
};
|
||||
Base64Decoder.prototype.getId = function () {
|
||||
return "base64decode";
|
||||
};
|
||||
Base64Decoder.prototype.convert = function (input) {
|
||||
try {
|
||||
return atob(input);
|
||||
}
|
||||
catch (exception) {
|
||||
throw new Error("Could not decode base64 string. Maybe corrupt input?");
|
||||
}
|
||||
};
|
||||
return Base64Decoder;
|
||||
}());
|
||||
exports.Base64Decoder = Base64Decoder;
|
|
@ -1,22 +0,0 @@
|
|||
"use strict";
|
||||
var Base64Encoder = (function () {
|
||||
function Base64Encoder() {
|
||||
}
|
||||
Base64Encoder.prototype.getDisplayname = function () {
|
||||
return "Encode Base 64";
|
||||
};
|
||||
Base64Encoder.prototype.getId = function () {
|
||||
return "base64encode";
|
||||
};
|
||||
Base64Encoder.prototype.convert = function (input) {
|
||||
try {
|
||||
return btoa(input);
|
||||
}
|
||||
catch (exception) {
|
||||
console.error(exception);
|
||||
throw new Error("Ouch! Looks like you've got a UTF-8 character there. Too bad, this is not supported yet. We're working on it and hope to be ready soon! Why don't you <a href=\"https://duckduckgo.com/?q=cute+kitties&iar=images\">enjoy some kittens</a> meanwhile?");
|
||||
}
|
||||
};
|
||||
return Base64Encoder;
|
||||
}());
|
||||
exports.Base64Encoder = Base64Encoder;
|
|
@ -1,20 +0,0 @@
|
|||
"use strict";
|
||||
var BinToDecConverter = (function () {
|
||||
function BinToDecConverter() {
|
||||
}
|
||||
BinToDecConverter.prototype.getDisplayname = function () {
|
||||
return "Convert binary to decimal";
|
||||
};
|
||||
BinToDecConverter.prototype.getId = function () {
|
||||
return "bintodec";
|
||||
};
|
||||
BinToDecConverter.prototype.convert = function (input) {
|
||||
var n = parseInt(input, 2);
|
||||
if (isNaN(n)) {
|
||||
throw new Error("The input seems not to be a valid binary number.");
|
||||
}
|
||||
return n.toString(10);
|
||||
};
|
||||
return BinToDecConverter;
|
||||
}());
|
||||
exports.BinToDecConverter = BinToDecConverter;
|
|
@ -1 +0,0 @@
|
|||
"use strict";
|
|
@ -1,20 +0,0 @@
|
|||
"use strict";
|
||||
var DecToBinConverter = (function () {
|
||||
function DecToBinConverter() {
|
||||
}
|
||||
DecToBinConverter.prototype.getDisplayname = function () {
|
||||
return "Convert decimal to binary";
|
||||
};
|
||||
DecToBinConverter.prototype.getId = function () {
|
||||
return "dectobin";
|
||||
};
|
||||
DecToBinConverter.prototype.convert = function (input) {
|
||||
var n = parseInt(input, 10);
|
||||
if (isNaN(n)) {
|
||||
throw new Error("The input seems not to be a valid integer.");
|
||||
}
|
||||
return n.toString(2);
|
||||
};
|
||||
return DecToBinConverter;
|
||||
}());
|
||||
exports.DecToBinConverter = DecToBinConverter;
|
|
@ -1,20 +0,0 @@
|
|||
"use strict";
|
||||
var DecToHexConverter = (function () {
|
||||
function DecToHexConverter() {
|
||||
}
|
||||
DecToHexConverter.prototype.getDisplayname = function () {
|
||||
return "Convert decimal to hexadecimal";
|
||||
};
|
||||
DecToHexConverter.prototype.getId = function () {
|
||||
return "dectohex";
|
||||
};
|
||||
DecToHexConverter.prototype.convert = function (input) {
|
||||
var n = parseInt(input, 10);
|
||||
if (isNaN(n)) {
|
||||
throw new Error("The input seems not to be a valid integer.");
|
||||
}
|
||||
return n.toString(16);
|
||||
};
|
||||
return DecToHexConverter;
|
||||
}());
|
||||
exports.DecToHexConverter = DecToHexConverter;
|
|
@ -1,20 +0,0 @@
|
|||
"use strict";
|
||||
var HexToDecConverter = (function () {
|
||||
function HexToDecConverter() {
|
||||
}
|
||||
HexToDecConverter.prototype.getDisplayname = function () {
|
||||
return "Convert hexadecimal to decimal";
|
||||
};
|
||||
HexToDecConverter.prototype.getId = function () {
|
||||
return "hextodec";
|
||||
};
|
||||
HexToDecConverter.prototype.convert = function (input) {
|
||||
var n = parseInt(input, 16);
|
||||
if (isNaN(n)) {
|
||||
throw new Error("The input seems not to be a valid hexadecimal number.");
|
||||
}
|
||||
return n.toString(10);
|
||||
};
|
||||
return HexToDecConverter;
|
||||
}());
|
||||
exports.HexToDecConverter = HexToDecConverter;
|
|
@ -1,20 +0,0 @@
|
|||
"use strict";
|
||||
var HTMLEntitiesDecoder = (function () {
|
||||
function HTMLEntitiesDecoder() {
|
||||
}
|
||||
HTMLEntitiesDecoder.prototype.getDisplayname = function () {
|
||||
return "Decode HTML entities";
|
||||
};
|
||||
HTMLEntitiesDecoder.prototype.getId = function () {
|
||||
return "decodehtmlentities";
|
||||
};
|
||||
HTMLEntitiesDecoder.prototype.convert = function (input) {
|
||||
return input
|
||||
.replace(/\"\;/g, "\"")
|
||||
.replace(/\>\;/g, ">")
|
||||
.replace(/\<\;/g, "<")
|
||||
.replace(/\&\;/g, "&");
|
||||
};
|
||||
return HTMLEntitiesDecoder;
|
||||
}());
|
||||
exports.HTMLEntitiesDecoder = HTMLEntitiesDecoder;
|
|
@ -1,20 +0,0 @@
|
|||
"use strict";
|
||||
var HTMLEntitiesEncoder = (function () {
|
||||
function HTMLEntitiesEncoder() {
|
||||
}
|
||||
HTMLEntitiesEncoder.prototype.getDisplayname = function () {
|
||||
return "Encode HTML entities";
|
||||
};
|
||||
HTMLEntitiesEncoder.prototype.getId = function () {
|
||||
return "encodehtmlentities";
|
||||
};
|
||||
HTMLEntitiesEncoder.prototype.convert = function (input) {
|
||||
return input
|
||||
.replace(/\&/g, "&")
|
||||
.replace(/\</g, "<")
|
||||
.replace(/\>/g, ">")
|
||||
.replace(/\"/g, """);
|
||||
};
|
||||
return HTMLEntitiesEncoder;
|
||||
}());
|
||||
exports.HTMLEntitiesEncoder = HTMLEntitiesEncoder;
|
|
@ -1,17 +0,0 @@
|
|||
"use strict";
|
||||
var PunycodeDecoder = (function () {
|
||||
function PunycodeDecoder(nativeLibraryWrapperService) {
|
||||
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
|
||||
}
|
||||
PunycodeDecoder.prototype.getDisplayname = function () {
|
||||
return "Decode from punycode";
|
||||
};
|
||||
PunycodeDecoder.prototype.getId = function () {
|
||||
return "decodepunycode";
|
||||
};
|
||||
PunycodeDecoder.prototype.convert = function (input) {
|
||||
return this.nativeLibraryWrapperService.punycode.decode(input);
|
||||
};
|
||||
return PunycodeDecoder;
|
||||
}());
|
||||
exports.PunycodeDecoder = PunycodeDecoder;
|
|
@ -1,17 +0,0 @@
|
|||
"use strict";
|
||||
var PunycodeEncoder = (function () {
|
||||
function PunycodeEncoder(nativeLibraryWrapperService) {
|
||||
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
|
||||
}
|
||||
PunycodeEncoder.prototype.getDisplayname = function () {
|
||||
return "Encode as punycode";
|
||||
};
|
||||
PunycodeEncoder.prototype.getId = function () {
|
||||
return "encodepunycode";
|
||||
};
|
||||
PunycodeEncoder.prototype.convert = function (input) {
|
||||
return this.nativeLibraryWrapperService.punycode.encode(input);
|
||||
};
|
||||
return PunycodeEncoder;
|
||||
}());
|
||||
exports.PunycodeEncoder = PunycodeEncoder;
|
|
@ -1,22 +0,0 @@
|
|||
"use strict";
|
||||
var QuotedPrintableDecoder = (function () {
|
||||
function QuotedPrintableDecoder(nativeLibraryWrapperService) {
|
||||
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
|
||||
}
|
||||
QuotedPrintableDecoder.prototype.getDisplayname = function () {
|
||||
return "Decode quoted printable";
|
||||
};
|
||||
QuotedPrintableDecoder.prototype.getId = function () {
|
||||
return "decodequotedprintable";
|
||||
};
|
||||
QuotedPrintableDecoder.prototype.convert = function (input) {
|
||||
try {
|
||||
return this.nativeLibraryWrapperService.quotedPrintable.decode(input);
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error("The input can not be interpreted as quoted-printable. May be corrupt?");
|
||||
}
|
||||
};
|
||||
return QuotedPrintableDecoder;
|
||||
}());
|
||||
exports.QuotedPrintableDecoder = QuotedPrintableDecoder;
|
|
@ -1,17 +0,0 @@
|
|||
"use strict";
|
||||
var QuotedPrintableEncoder = (function () {
|
||||
function QuotedPrintableEncoder(nativeLibraryWrapperService) {
|
||||
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
|
||||
}
|
||||
QuotedPrintableEncoder.prototype.getDisplayname = function () {
|
||||
return "Encode quoted printable";
|
||||
};
|
||||
QuotedPrintableEncoder.prototype.getId = function () {
|
||||
return "encodequotedprintable";
|
||||
};
|
||||
QuotedPrintableEncoder.prototype.convert = function (input) {
|
||||
return this.nativeLibraryWrapperService.quotedPrintable.encode(input);
|
||||
};
|
||||
return QuotedPrintableEncoder;
|
||||
}());
|
||||
exports.QuotedPrintableEncoder = QuotedPrintableEncoder;
|
|
@ -1,16 +0,0 @@
|
|||
"use strict";
|
||||
var URIComponentDecoder = (function () {
|
||||
function URIComponentDecoder() {
|
||||
}
|
||||
URIComponentDecoder.prototype.getDisplayname = function () {
|
||||
return "Decode URI component";
|
||||
};
|
||||
URIComponentDecoder.prototype.getId = function () {
|
||||
return "uricomponentdecode";
|
||||
};
|
||||
URIComponentDecoder.prototype.convert = function (input) {
|
||||
return decodeURIComponent(input);
|
||||
};
|
||||
return URIComponentDecoder;
|
||||
}());
|
||||
exports.URIComponentDecoder = URIComponentDecoder;
|
|
@ -1,18 +0,0 @@
|
|||
"use strict";
|
||||
var URIComponentEncoder = (function () {
|
||||
function URIComponentEncoder() {
|
||||
}
|
||||
URIComponentEncoder.prototype.getDisplayname = function () {
|
||||
return "Encode URI component";
|
||||
};
|
||||
URIComponentEncoder.prototype.getId = function () {
|
||||
return "uricomponentencode";
|
||||
};
|
||||
URIComponentEncoder.prototype.convert = function (input) {
|
||||
return encodeURIComponent(input).replace(/[!'()*]/g, function (c) {
|
||||
return '%' + c.charCodeAt(0).toString(16);
|
||||
});
|
||||
};
|
||||
return URIComponentEncoder;
|
||||
}());
|
||||
exports.URIComponentEncoder = URIComponentEncoder;
|
|
@ -1,16 +0,0 @@
|
|||
"use strict";
|
||||
var URIDecoder = (function () {
|
||||
function URIDecoder() {
|
||||
}
|
||||
URIDecoder.prototype.getDisplayname = function () {
|
||||
return "Decode URI";
|
||||
};
|
||||
URIDecoder.prototype.getId = function () {
|
||||
return "uridecode";
|
||||
};
|
||||
URIDecoder.prototype.convert = function (input) {
|
||||
return decodeURI(input);
|
||||
};
|
||||
return URIDecoder;
|
||||
}());
|
||||
exports.URIDecoder = URIDecoder;
|
|
@ -1,16 +0,0 @@
|
|||
"use strict";
|
||||
var URIEncoder = (function () {
|
||||
function URIEncoder() {
|
||||
}
|
||||
URIEncoder.prototype.getDisplayname = function () {
|
||||
return "Encode URI";
|
||||
};
|
||||
URIEncoder.prototype.getId = function () {
|
||||
return "uriencode";
|
||||
};
|
||||
URIEncoder.prototype.convert = function (input) {
|
||||
return encodeURI(input).replace(/%5B/g, '[').replace(/%5D/g, ']');
|
||||
};
|
||||
return URIEncoder;
|
||||
}());
|
||||
exports.URIEncoder = URIEncoder;
|
|
@ -1,22 +0,0 @@
|
|||
"use strict";
|
||||
var UTF8Decoder = (function () {
|
||||
function UTF8Decoder(nativeLibraryWrapperService) {
|
||||
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
|
||||
}
|
||||
UTF8Decoder.prototype.getDisplayname = function () {
|
||||
return "Decode UTF-8";
|
||||
};
|
||||
UTF8Decoder.prototype.getId = function () {
|
||||
return "decodeutf8";
|
||||
};
|
||||
UTF8Decoder.prototype.convert = function (input) {
|
||||
try {
|
||||
return this.nativeLibraryWrapperService.utf8.decode(input);
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error("The input can not be interpreted a valid UTF-8 encoded string. May be corrupt?");
|
||||
}
|
||||
};
|
||||
return UTF8Decoder;
|
||||
}());
|
||||
exports.UTF8Decoder = UTF8Decoder;
|
|
@ -1,22 +0,0 @@
|
|||
"use strict";
|
||||
var UTF8Encoder = (function () {
|
||||
function UTF8Encoder(nativeLibraryWrapperService) {
|
||||
this.nativeLibraryWrapperService = nativeLibraryWrapperService;
|
||||
}
|
||||
UTF8Encoder.prototype.getDisplayname = function () {
|
||||
return "Encode UTF-8";
|
||||
};
|
||||
UTF8Encoder.prototype.getId = function () {
|
||||
return "encodeutf8";
|
||||
};
|
||||
UTF8Encoder.prototype.convert = function (input) {
|
||||
try {
|
||||
return this.nativeLibraryWrapperService.utf8.encode(input);
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error("The input can not be encoded as UTF-8. May be corrupt?");
|
||||
}
|
||||
};
|
||||
return UTF8Encoder;
|
||||
}());
|
||||
exports.UTF8Encoder = UTF8Encoder;
|
|
@ -1,77 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var core_1 = require("@angular/core");
|
||||
var base64encoder_1 = require("./converter/base64encoder");
|
||||
var base64decoder_1 = require("./converter/base64decoder");
|
||||
var uriencoder_1 = require("./converter/uriencoder");
|
||||
var uridecoder_1 = require("./converter/uridecoder");
|
||||
var uricomponentencoder_1 = require("./converter/uricomponentencoder");
|
||||
var uricomponentdecoder_1 = require("./converter/uricomponentdecoder");
|
||||
var htmlentitiesencoder_1 = require("./converter/htmlentitiesencoder");
|
||||
var htmlentitiesdecoder_1 = require("./converter/htmlentitiesdecoder");
|
||||
var dectohexconverter_1 = require("./converter/dectohexconverter");
|
||||
var hextodecconverter_1 = require("./converter/hextodecconverter");
|
||||
var dectobinconverter_1 = require("./converter/dectobinconverter");
|
||||
var bintodecconverter_1 = require("./converter/bintodecconverter");
|
||||
var quotedprintabledecoder_1 = require("./converter/quotedprintabledecoder");
|
||||
var quotedprintableencoder_1 = require("./converter/quotedprintableencoder");
|
||||
var punycodeencoder_1 = require("./converter/punycodeencoder");
|
||||
var punycodedecoder_1 = require("./converter/punycodedecoder");
|
||||
var utf8encoder_1 = require("./converter/utf8encoder");
|
||||
var utf8decoder_1 = require("./converter/utf8decoder");
|
||||
var ConverterRegistryService = (function () {
|
||||
function ConverterRegistryService(wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
this.converters = [];
|
||||
this.init();
|
||||
}
|
||||
ConverterRegistryService.prototype.getAllConverters = function () {
|
||||
return this.converters;
|
||||
};
|
||||
ConverterRegistryService.prototype.getConverter = function (id) {
|
||||
for (var i = 0; i < this.converters.length; i++) {
|
||||
if (this.converters[i].getId() == id) {
|
||||
return this.converters[i];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
ConverterRegistryService.prototype.init = function () {
|
||||
this.registerConverter(new base64encoder_1.Base64Encoder());
|
||||
this.registerConverter(new base64decoder_1.Base64Decoder());
|
||||
this.registerConverter(new uriencoder_1.URIEncoder());
|
||||
this.registerConverter(new uridecoder_1.URIDecoder());
|
||||
this.registerConverter(new uricomponentencoder_1.URIComponentEncoder());
|
||||
this.registerConverter(new uricomponentdecoder_1.URIComponentDecoder());
|
||||
this.registerConverter(new htmlentitiesencoder_1.HTMLEntitiesEncoder());
|
||||
this.registerConverter(new htmlentitiesdecoder_1.HTMLEntitiesDecoder());
|
||||
this.registerConverter(new quotedprintableencoder_1.QuotedPrintableEncoder(this.wrapper));
|
||||
this.registerConverter(new quotedprintabledecoder_1.QuotedPrintableDecoder(this.wrapper));
|
||||
this.registerConverter(new dectohexconverter_1.DecToHexConverter());
|
||||
this.registerConverter(new hextodecconverter_1.HexToDecConverter());
|
||||
this.registerConverter(new dectobinconverter_1.DecToBinConverter());
|
||||
this.registerConverter(new bintodecconverter_1.BinToDecConverter());
|
||||
this.registerConverter(new punycodeencoder_1.PunycodeEncoder(this.wrapper));
|
||||
this.registerConverter(new punycodedecoder_1.PunycodeDecoder(this.wrapper));
|
||||
this.registerConverter(new utf8encoder_1.UTF8Encoder(this.wrapper));
|
||||
this.registerConverter(new utf8decoder_1.UTF8Decoder(this.wrapper));
|
||||
};
|
||||
ConverterRegistryService.prototype.registerConverter = function (converter) {
|
||||
this.converters.forEach(function (c) {
|
||||
if (c.getId() == converter.getId()) {
|
||||
throw new Error("Converter-ID " + converter.getId() + " is already registered!");
|
||||
}
|
||||
});
|
||||
this.converters.push(converter);
|
||||
};
|
||||
ConverterRegistryService = __decorate([
|
||||
core_1.Injectable()
|
||||
], ConverterRegistryService);
|
||||
return ConverterRegistryService;
|
||||
}());
|
||||
exports.ConverterRegistryService = ConverterRegistryService;
|
|
@ -1,41 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var core_1 = require("@angular/core");
|
||||
var step_1 = require("./step");
|
||||
var InputComponentManagerService = (function () {
|
||||
function InputComponentManagerService() {
|
||||
this.components = [];
|
||||
}
|
||||
InputComponentManagerService.prototype.register = function (component) {
|
||||
this.components.push(component);
|
||||
};
|
||||
InputComponentManagerService.prototype.getAllComponents = function () {
|
||||
return this.components;
|
||||
};
|
||||
InputComponentManagerService.prototype.getNext = function (component) {
|
||||
var index = component.index;
|
||||
if (index == this.components.length - 1) {
|
||||
this.addComponent();
|
||||
}
|
||||
return this.components[index + 1];
|
||||
};
|
||||
InputComponentManagerService.prototype.getFirst = function () {
|
||||
if (this.components.length == 0) {
|
||||
this.addComponent();
|
||||
}
|
||||
return this.components[0];
|
||||
};
|
||||
InputComponentManagerService.prototype.addComponent = function () {
|
||||
this.register(new step_1.Step(this.components.length));
|
||||
};
|
||||
InputComponentManagerService = __decorate([
|
||||
core_1.Injectable()
|
||||
], InputComponentManagerService);
|
||||
return InputComponentManagerService;
|
||||
}());
|
||||
exports.InputComponentManagerService = InputComponentManagerService;
|
|
@ -1,23 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var core_1 = require("@angular/core");
|
||||
var NativeUtf8 = require("utf8");
|
||||
var NativeQuotedPrintable = require("quoted-printable");
|
||||
var NativePunycode = require("punycode");
|
||||
var NativeLibraryWrapperService = (function () {
|
||||
function NativeLibraryWrapperService() {
|
||||
this.utf8 = NativeUtf8;
|
||||
this.quotedPrintable = NativeQuotedPrintable;
|
||||
this.punycode = NativePunycode;
|
||||
}
|
||||
NativeLibraryWrapperService = __decorate([
|
||||
core_1.Injectable()
|
||||
], NativeLibraryWrapperService);
|
||||
return NativeLibraryWrapperService;
|
||||
}());
|
||||
exports.NativeLibraryWrapperService = NativeLibraryWrapperService;
|
|
@ -1 +0,0 @@
|
|||
"use strict";
|
|
@ -1 +0,0 @@
|
|||
"use strict";
|
|
@ -1,12 +0,0 @@
|
|||
"use strict";
|
||||
var Step = (function () {
|
||||
function Step(index) {
|
||||
this.content = "";
|
||||
this.selectedConverter = undefined;
|
||||
this.error = false;
|
||||
this.message = "";
|
||||
this.index = index;
|
||||
}
|
||||
return Step;
|
||||
}());
|
||||
exports.Step = Step;
|
|
@ -1 +0,0 @@
|
|||
"use strict";
|
|
@ -1,8 +0,0 @@
|
|||
// The file contents for the current environment will overwrite these during build.
|
||||
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
"use strict";
|
||||
exports.environment = {
|
||||
production: false
|
||||
};
|
|
@ -1,4 +0,0 @@
|
|||
"use strict";
|
||||
exports.environment = {
|
||||
production: true
|
||||
};
|
|
@ -1,9 +0,0 @@
|
|||
"use strict";
|
||||
var core_1 = require('@angular/core');
|
||||
var platform_browser_dynamic_1 = require('@angular/platform-browser-dynamic');
|
||||
var app_module_1 = require('./app/app.module');
|
||||
var environment_1 = require('./environments/environment');
|
||||
if (environment_1.environment.production) {
|
||||
core_1.enableProdMode();
|
||||
}
|
||||
platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule);
|
|
@ -1,54 +0,0 @@
|
|||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
"use strict";
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/set';
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
/** IE10 and IE11 requires the following to support `@angular/animation`. */
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
/** Evergreen browsers require these. **/
|
||||
require('core-js/es6/reflect');
|
||||
require('core-js/es7/reflect');
|
||||
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by Angular itself.
|
||||
*/
|
||||
require('zone.js/dist/zone'); // Included with Angular CLI.
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
/**
|
||||
* Date, currency, decimal and percent pipes.
|
||||
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
||||
*/
|
||||
// import 'intl'; // Run `npm install --save intl`.
|
20
src/test.js
20
src/test.js
|
@ -1,20 +0,0 @@
|
|||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
"use strict";
|
||||
require('zone.js/dist/long-stack-trace-zone');
|
||||
require('zone.js/dist/proxy.js');
|
||||
require('zone.js/dist/sync-test');
|
||||
require('zone.js/dist/jasmine-patch');
|
||||
require('zone.js/dist/async-test');
|
||||
require('zone.js/dist/fake-async-test');
|
||||
var testing_1 = require('@angular/core/testing');
|
||||
var testing_2 = require('@angular/platform-browser-dynamic/testing');
|
||||
// Prevent Karma from running prematurely.
|
||||
__karma__.loaded = function () { };
|
||||
// First, initialize the Angular testing environment.
|
||||
testing_1.getTestBed().initTestEnvironment(testing_2.BrowserDynamicTestingModule, testing_2.platformBrowserDynamicTesting());
|
||||
// Then we find all the tests.
|
||||
var context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
// Finally, start Karma to run the tests.
|
||||
__karma__.start();
|
Loading…
Reference in a new issue