Re-initialized the project with angular-cli and set it up as the build tool chain.
This commit is contained in:
		
							parent
							
								
									6dd65fd488
								
							
						
					
					
						commit
						17afa92bfe
					
				
					 80 changed files with 6584 additions and 621 deletions
				
			
		
							
								
								
									
										27
									
								
								src/app/app-routing.module.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/app/app-routing.module.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| "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; | ||||
							
								
								
									
										15
									
								
								src/app/app-routing.module.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/app/app-routing.module.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| import { NgModule } from '@angular/core'; | ||||
| import { Routes, RouterModule } from '@angular/router'; | ||||
| 
 | ||||
| const routes: Routes = [ | ||||
|   { | ||||
|     path: '', | ||||
|     children: [] | ||||
|   } | ||||
| ]; | ||||
| 
 | ||||
| @NgModule({ | ||||
|   imports: [RouterModule.forRoot(routes)], | ||||
|   exports: [RouterModule] | ||||
| }) | ||||
| export class AppRoutingModule { } | ||||
|  | @ -1,118 +0,0 @@ | |||
| .inputwrapper { | ||||
|     font-family: "ABeeZee", sans-serif; | ||||
|     margin: 0 1em 1em 1em; | ||||
| } | ||||
| 
 | ||||
| .textwrapper { | ||||
|     margin: 0 0 1em 0; | ||||
|     padding: 0 1em 0 0; | ||||
| } | ||||
| 
 | ||||
| .arrow_box { | ||||
|     position: relative; | ||||
|     background: #fff; | ||||
|     border: 1px solid #aaa; | ||||
| } | ||||
| 
 | ||||
| .arrow_box:focus { | ||||
|     border-color: #888; | ||||
| } | ||||
| 
 | ||||
| .arrow_box:hover { | ||||
|     border-color: #333; | ||||
| } | ||||
| 
 | ||||
| .arrow_box:after, .arrow_box:before { | ||||
|     top: 100%; | ||||
|     left: 50%; | ||||
|     border: solid transparent; | ||||
|     content: " "; | ||||
|     height: 0; | ||||
|     width: 0; | ||||
|     position: absolute; | ||||
|     pointer-events: none; | ||||
| } | ||||
| 
 | ||||
| .arrow_box:after { | ||||
|     border-color: rgba(255, 255, 255, 0); | ||||
|     border-top-color: #fff; | ||||
|     border-width: 1em; | ||||
|     margin-left: -1em; | ||||
| } | ||||
| 
 | ||||
| .arrow_box:before { | ||||
|     border-color: rgba(170, 170, 170, 0); | ||||
|     border-top-color: #aaa; | ||||
|     border-width: calc(1em + 1px); | ||||
|     margin-left: calc(-1em - 1px); | ||||
| } | ||||
| 
 | ||||
| .arrow_box:focus:before { | ||||
|     border-color: rgba(136, 136, 136, 0); | ||||
|     border-top-color: #888; | ||||
| } | ||||
| 
 | ||||
| .arrow_box:hover:before { | ||||
|     border-color: rgba(51, 51, 51, 0); | ||||
|     border-top-color: #333; | ||||
| } | ||||
| 
 | ||||
| .selectwrapper > .arrow_box { | ||||
|     display: inline-block; | ||||
| } | ||||
| 
 | ||||
| .textinput { | ||||
|     background-color: #fff; | ||||
|     border: none; | ||||
|     color: #000; | ||||
|     font-family: "Free Monospaced", monospace; | ||||
|     height: 10em; | ||||
|     margin: 0; | ||||
|     padding: 0.5em; | ||||
|     resize: vertical; | ||||
|     width: 100%; | ||||
| } | ||||
| 
 | ||||
| .textinput:focus { | ||||
|     border-color: #888; | ||||
| } | ||||
| 
 | ||||
| .textinput:hover { | ||||
|     border-color: #333; | ||||
| } | ||||
| 
 | ||||
| .selectwrapper { | ||||
|     margin: 0 0 1em 0; | ||||
|     padding: 0; | ||||
|     text-align: center; | ||||
| } | ||||
| 
 | ||||
| .select { | ||||
|     background-color: #fff; | ||||
|     border: none; | ||||
|     color: #000; | ||||
|     font-family: "ABeeZee", sans-serif; | ||||
|     margin: 0; | ||||
|     padding: 0.5em; | ||||
| } | ||||
| 
 | ||||
| .option { | ||||
|     /*    font-family: "ABeeZee", sans-serif;*/ | ||||
| } | ||||
| 
 | ||||
| .selectwrapper.error > .arrow_box { | ||||
|     border-color: red; | ||||
| } | ||||
| 
 | ||||
| .selectwrapper.error > .arrow_box:before { | ||||
|     border-top-color: red; | ||||
| } | ||||
| 
 | ||||
| .selectwrapper.error select { | ||||
|     color: red; | ||||
| } | ||||
| 
 | ||||
| .errormessage { | ||||
|     color: red; | ||||
|     text-align: center; | ||||
| } | ||||
|  | @ -1,16 +1,17 @@ | |||
| <div *ngFor="let step of steps" class="inputwrapper"> | ||||
|     <div class="textwrapper arrow_box"> | ||||
|   <div class="textwrapper arrow_box"> | ||||
|         <textarea class="textinput" (keyup)="update(step)" placeholder="Please enter your input ..." | ||||
|                   [(ngModel)]="step.content">{{step.content}}</textarea> | ||||
|   </div> | ||||
|   <div [ngClass]="{selectwrapper: true, error: step.error}"> | ||||
|     <div class="arrow_box"> | ||||
|       <select class="select" (change)="convert(step, $event)"> | ||||
|         <option id="undefined">Select conversion ...</option> | ||||
|         <option class="option" *ngFor="let c of converters" id="{{c.getId()}}">{{c.getDisplayname()}} | ||||
|         </option> | ||||
|       </select> | ||||
|     </div> | ||||
|     <div [ngClass]="{selectwrapper: true, error: step.error}"> | ||||
|         <div class="arrow_box"> | ||||
|             <select class="select" (change)="convert(step, $event)"> | ||||
|                 <option id="undefined">Select conversion ...</option> | ||||
|                 <option class="option" *ngFor="let c of converters" id="{{c.getId()}}">{{c.getDisplayname()}} | ||||
|                 </option> | ||||
|             </select> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="errormessage" *ngIf="step.error">{{step.message}}</div> | ||||
|   </div> | ||||
|   <div class="errormessage" *ngIf="step.error" [innerHTML]="step.message"></div> | ||||
| </div> | ||||
| <!--<router-outlet></router-outlet>--> | ||||
|  |  | |||
							
								
								
									
										65
									
								
								src/app/app.component.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								src/app/app.component.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,65 @@ | |||
| "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; | ||||
							
								
								
									
										107
									
								
								src/app/app.component.scss
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								src/app/app.component.scss
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,107 @@ | |||
| .inputwrapper { | ||||
|   font-family: "ABeeZee", sans-serif; | ||||
|   margin: 0 1em 1em 1em; | ||||
| } | ||||
| 
 | ||||
| .textwrapper { | ||||
|   margin: 0 0 1em 0; | ||||
|   padding: 0 1em 0 0; | ||||
| } | ||||
| 
 | ||||
| .arrow_box { | ||||
|   position: relative; | ||||
|   background: #fff; | ||||
|   border: 1px solid #aaa; | ||||
|   &:focus { | ||||
|     border-color: #888; | ||||
|   } | ||||
|   &:hover { | ||||
|     border-color: #333; | ||||
|   } | ||||
|   &:after, &:before { | ||||
|     top: 100%; | ||||
|     left: 50%; | ||||
|     border: solid transparent; | ||||
|     content: " "; | ||||
|     height: 0; | ||||
|     width: 0; | ||||
|     position: absolute; | ||||
|     pointer-events: none; | ||||
|   } | ||||
|   &:after { | ||||
|     border-color: rgba(255, 255, 255, 0); | ||||
|     border-top-color: #fff; | ||||
|     border-width: 1em; | ||||
|     margin-left: -1em; | ||||
|   } | ||||
|   &:before { | ||||
|     border-color: rgba(170, 170, 170, 0); | ||||
|     border-top-color: #aaa; | ||||
|     border-width: calc(1em + 1px); | ||||
|     margin-left: calc(-1em - 1px); | ||||
|   } | ||||
|   &:focus:before { | ||||
|     border-color: rgba(136, 136, 136, 0); | ||||
|     border-top-color: #888; | ||||
|   } | ||||
|   &:hover:before { | ||||
|     border-color: rgba(51, 51, 51, 0); | ||||
|     border-top-color: #333; | ||||
|   } | ||||
|   .selectwrapper > & { | ||||
|     display: inline-block; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| .textinput { | ||||
|   background-color: #fff; | ||||
|   border: none; | ||||
|   color: #000; | ||||
|   font-family: "Free Monospaced", monospace; | ||||
|   height: 10em; | ||||
|   margin: 0; | ||||
|   padding: 0.5em; | ||||
|   resize: vertical; | ||||
|   width: 100%; | ||||
|   &:focus { | ||||
|     border-color: #888; | ||||
|   } | ||||
|   &:hover { | ||||
|     border-color: #333; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| .selectwrapper { | ||||
|   margin: 0 0 1em 0; | ||||
|   padding: 0; | ||||
|   text-align: center; | ||||
|   &.error { | ||||
|     > .arrow_box { | ||||
|       border-color: red; | ||||
|       &:before { | ||||
|         border-top-color: red; | ||||
|       } | ||||
|     } | ||||
|     select { | ||||
|       color: red; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| .select { | ||||
|   background-color: #fff; | ||||
|   border: none; | ||||
|   color: #000; | ||||
|   font-family: "ABeeZee", sans-serif; | ||||
|   margin: 0; | ||||
|   padding: 0.5em; | ||||
| } | ||||
| 
 | ||||
| .option { | ||||
|   /*    font-family: "ABeeZee", sans-serif;*/ | ||||
| } | ||||
| 
 | ||||
| .errormessage { | ||||
|   color: red; | ||||
|   text-align: center; | ||||
| } | ||||
							
								
								
									
										21
									
								
								src/app/app.component.spec.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/app/app.component.spec.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | |||
| "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,16 +1,23 @@ | |||
| import {TestBed} from "@angular/core/testing"; | ||||
| import {AppComponent} from "./app.component"; | ||||
| import {FormsModule} from "@angular/forms"; | ||||
| import { TestBed, async } from '@angular/core/testing'; | ||||
| import { RouterTestingModule } from '@angular/router/testing'; | ||||
| 
 | ||||
| describe('App', () => { | ||||
|     beforeEach(() => { | ||||
|         TestBed.configureTestingModule({ | ||||
|             declarations: [AppComponent], | ||||
|             imports: [FormsModule] | ||||
|         }); | ||||
|     }); | ||||
|     it('should work', () => { | ||||
|         let fixture = TestBed.createComponent(AppComponent); | ||||
|         expect(fixture.componentInstance instanceof AppComponent).toBe(true, 'should create AppComponent'); | ||||
|     }); | ||||
| }); | ||||
| import { AppComponent } from './app.component'; | ||||
| 
 | ||||
| describe('AppComponent', () => { | ||||
|   beforeEach(async(() => { | ||||
|     TestBed.configureTestingModule({ | ||||
|       imports: [ | ||||
|         RouterTestingModule | ||||
|       ], | ||||
|       declarations: [ | ||||
|         AppComponent | ||||
|       ], | ||||
|     }).compileComponents(); | ||||
|   })); | ||||
| 
 | ||||
|   it('should create the app', async(() => { | ||||
|     const fixture = TestBed.createComponent(AppComponent); | ||||
|     const app = fixture.debugElement.componentInstance; | ||||
|     expect(app).toBeTruthy(); | ||||
|   })); | ||||
| }); | ||||
|  |  | |||
|  | @ -1,61 +1,59 @@ | |||
| import {Component, OnInit} from "@angular/core"; | ||||
| import {ConverterRegistryService} from "./converterregistry.service"; | ||||
| import {InputComponentManagerService} from "./inputcomponentmanager.service"; | ||||
| import {Converter} from "./converter/converter"; | ||||
| import {NativeLibraryWrapperService} from "./nativelibrarywrapper.service"; | ||||
| import {Step} from "./step"; | ||||
| import "../assets/css/style.css"; | ||||
| import {Converter} from "./converter/converter"; | ||||
| 
 | ||||
| @Component({ | ||||
|     selector: "den-app", | ||||
|     templateUrl: "./app.component.html", | ||||
|     styleUrls: ["./app.component.css"], | ||||
|     providers: [ConverterRegistryService, InputComponentManagerService, NativeLibraryWrapperService] | ||||
|   selector: 'app-root', | ||||
|   templateUrl: './app.component.html', | ||||
|   styleUrls: ['./app.component.scss'], | ||||
|   providers: [ConverterRegistryService, InputComponentManagerService, NativeLibraryWrapperService] | ||||
| }) | ||||
| export class AppComponent extends OnInit { | ||||
|     public steps:Step[] = []; | ||||
|     public converters:Converter[] = []; | ||||
| export class AppComponent implements OnInit { | ||||
|   public steps: Step[] = []; | ||||
|   public converters: Converter[] = []; | ||||
| 
 | ||||
|     constructor(private converterRegistryService:ConverterRegistryService, private inputComponentManagerService:InputComponentManagerService) { | ||||
|         super(); | ||||
|     } | ||||
|   constructor(private converterRegistryService: ConverterRegistryService, private inputComponentManagerService: InputComponentManagerService) { | ||||
|   } | ||||
| 
 | ||||
|     convert(step:Step, $event:any):void { | ||||
|         step.selectedConverter = this.converterRegistryService.getConverter($event.target.selectedOptions[0].id); | ||||
|         this.update(step); | ||||
|     } | ||||
|   convert(step: Step, $event: any): void { | ||||
|     step.selectedConverter = this.converterRegistryService.getConverter($event.target.selectedOptions[0].id); | ||||
|     this.update(step); | ||||
|   } | ||||
| 
 | ||||
|     update(step:Step):void { | ||||
|         let converter:Converter = step.selectedConverter; | ||||
|   update(step: Step): void { | ||||
|     let converter: Converter = step.selectedConverter; | ||||
| 
 | ||||
|         if (converter !== undefined) { | ||||
|             let content:string = step.content; | ||||
|             let result:string; | ||||
|             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 !== "") { | ||||
|                     let nextComponent:Step = this.inputComponentManagerService.getNext(step); | ||||
|                     nextComponent.content = result; | ||||
|                     this.update(nextComponent); | ||||
|                 } | ||||
|             } | ||||
|     if (converter !== undefined) { | ||||
|       let content: string = step.content; | ||||
|       let result: string; | ||||
|       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 !== "") { | ||||
|           let nextComponent: Step = this.inputComponentManagerService.getNext(step); | ||||
|           nextComponent.content = result; | ||||
|           this.update(nextComponent); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|     ngOnInit():void { | ||||
|         this.converters = this.converterRegistryService.getAllConverters(); | ||||
|         this.steps = this.inputComponentManagerService.getAllComponents(); | ||||
|         this.inputComponentManagerService.getFirst(); | ||||
|     } | ||||
|   ngOnInit(): void { | ||||
|     this.converters = this.converterRegistryService.getAllConverters(); | ||||
|     this.steps = this.inputComponentManagerService.getAllComponents(); | ||||
|     this.inputComponentManagerService.getFirst(); | ||||
|   } | ||||
| } | ||||
|  |  | |||
							
								
								
									
										34
									
								
								src/app/app.module.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/app/app.module.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| "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,17 +1,22 @@ | |||
| import {NgModule} from "@angular/core"; | ||||
| import {BrowserModule} from "@angular/platform-browser"; | ||||
| import {FormsModule} from "@angular/forms"; | ||||
| import {AppComponent} from "./app.component"; | ||||
| import { BrowserModule } from '@angular/platform-browser'; | ||||
| import { NgModule } from '@angular/core'; | ||||
| import { FormsModule } from '@angular/forms'; | ||||
| import { HttpModule } from '@angular/http'; | ||||
| 
 | ||||
| import { AppRoutingModule } from './app-routing.module'; | ||||
| import { AppComponent } from './app.component'; | ||||
| 
 | ||||
| @NgModule({ | ||||
|     imports: [ | ||||
|         BrowserModule, | ||||
|         FormsModule | ||||
|     ], | ||||
|     declarations: [ | ||||
|         AppComponent | ||||
|     ], | ||||
|     bootstrap: [AppComponent] | ||||
|   declarations: [ | ||||
|     AppComponent | ||||
|   ], | ||||
|   imports: [ | ||||
|     BrowserModule, | ||||
|     FormsModule, | ||||
|     HttpModule, | ||||
|     AppRoutingModule | ||||
|   ], | ||||
|   providers: [], | ||||
|   bootstrap: [AppComponent] | ||||
| }) | ||||
| export class AppModule { | ||||
| } | ||||
| export class AppModule { } | ||||
|  |  | |||
							
								
								
									
										21
									
								
								src/app/converter/base64decoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/app/converter/base64decoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | |||
| "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; | ||||
							
								
								
									
										22
									
								
								src/app/converter/base64encoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/app/converter/base64encoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| "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,19 +1,20 @@ | |||
| import {Converter} from "./converter"; | ||||
| 
 | ||||
| export class Base64Encoder implements Converter { | ||||
|     getDisplayname():string { | ||||
|         return "Encode Base 64"; | ||||
|     } | ||||
|   getDisplayname(): string { | ||||
|     return "Encode Base 64"; | ||||
|   } | ||||
| 
 | ||||
|     getId():string { | ||||
|         return "base64encode"; | ||||
|     } | ||||
|   getId(): string { | ||||
|     return "base64encode"; | ||||
|   } | ||||
| 
 | ||||
|     convert(input:string):string { | ||||
|         try { | ||||
|             return btoa(input); | ||||
|         } catch (exception) { | ||||
|             throw new Error("Could not encode base64 string. This should not happen, so why don't you just try again?"); | ||||
|         } | ||||
|   convert(input: string): string { | ||||
|     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?"); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  |  | |||
							
								
								
									
										20
									
								
								src/app/converter/bintodecconverter.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/app/converter/bintodecconverter.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| "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
									
								
								src/app/converter/converter.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/app/converter/converter.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| "use strict"; | ||||
							
								
								
									
										20
									
								
								src/app/converter/dectobinconverter.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/app/converter/dectobinconverter.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| "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; | ||||
							
								
								
									
										20
									
								
								src/app/converter/dectohexconverter.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/app/converter/dectohexconverter.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| "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; | ||||
							
								
								
									
										20
									
								
								src/app/converter/hextodecconverter.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/app/converter/hextodecconverter.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| "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; | ||||
							
								
								
									
										20
									
								
								src/app/converter/htmlentitiesdecoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/app/converter/htmlentitiesdecoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| "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; | ||||
							
								
								
									
										20
									
								
								src/app/converter/htmlentitiesencoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/app/converter/htmlentitiesencoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| "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; | ||||
							
								
								
									
										17
									
								
								src/app/converter/punycodedecoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/app/converter/punycodedecoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| "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; | ||||
							
								
								
									
										17
									
								
								src/app/converter/punycodeencoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/app/converter/punycodeencoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| "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; | ||||
							
								
								
									
										22
									
								
								src/app/converter/quotedprintabledecoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/app/converter/quotedprintabledecoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| "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; | ||||
							
								
								
									
										17
									
								
								src/app/converter/quotedprintableencoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/app/converter/quotedprintableencoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| "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; | ||||
							
								
								
									
										16
									
								
								src/app/converter/uricomponentdecoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/app/converter/uricomponentdecoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| "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; | ||||
							
								
								
									
										18
									
								
								src/app/converter/uricomponentencoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/app/converter/uricomponentencoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| "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; | ||||
							
								
								
									
										16
									
								
								src/app/converter/uridecoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/app/converter/uridecoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| "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; | ||||
							
								
								
									
										16
									
								
								src/app/converter/uriencoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/app/converter/uriencoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| "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; | ||||
							
								
								
									
										22
									
								
								src/app/converter/utf8decoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/app/converter/utf8decoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| "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; | ||||
							
								
								
									
										22
									
								
								src/app/converter/utf8encoder.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/app/converter/utf8encoder.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| "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; | ||||
							
								
								
									
										77
									
								
								src/app/converterregistry.service.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								src/app/converterregistry.service.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,77 @@ | |||
| "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; | ||||
							
								
								
									
										41
									
								
								src/app/inputcomponentmanager.service.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/app/inputcomponentmanager.service.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| "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; | ||||
							
								
								
									
										23
									
								
								src/app/nativelibrarywrapper.service.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/app/nativelibrarywrapper.service.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| "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; | ||||
|  | @ -2,16 +2,19 @@ import {Injectable} from "@angular/core"; | |||
| import {Punycode} from "./punycode"; | ||||
| import {Utf8} from "./utf8"; | ||||
| import {QuotedPrintable} from "./quotedprintable"; | ||||
| import * as NativeUtf8 from "utf8"; | ||||
| import * as NativeQuotedPrintable from "quoted-printable"; | ||||
| import * as NativePunycode from "punycode"; | ||||
| 
 | ||||
| @Injectable() | ||||
| export class NativeLibraryWrapperService { | ||||
|     public utf8:Utf8; | ||||
|     public quotedPrintable:QuotedPrintable; | ||||
|     public punycode:Punycode; | ||||
|   public utf8: Utf8; | ||||
|   public quotedPrintable: QuotedPrintable; | ||||
|   public punycode: Punycode; | ||||
| 
 | ||||
|     constructor() { | ||||
|         this.utf8 = require("utf8"); | ||||
|         this.quotedPrintable = require("quoted-printable"); | ||||
|         this.punycode = require("punycode"); | ||||
|     } | ||||
|   constructor() { | ||||
|     this.utf8 = NativeUtf8; | ||||
|     this.quotedPrintable = NativeQuotedPrintable; | ||||
|     this.punycode = NativePunycode; | ||||
|   } | ||||
| } | ||||
|  |  | |||
							
								
								
									
										1
									
								
								src/app/punycode.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/app/punycode.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| "use strict"; | ||||
							
								
								
									
										1
									
								
								src/app/quotedprintable.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/app/quotedprintable.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| "use strict"; | ||||
							
								
								
									
										12
									
								
								src/app/step.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/app/step.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| "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
									
								
								src/app/utf8.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/app/utf8.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| "use strict"; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue