Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions les3/MT3A/DecoratorTextfield/dev/CapitalizeTextDecorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="TextDecorator.ts" />

class CapitalizeTextDecorator extends TextDecorator {
public txt : Txt;

constructor(txt : Txt) {
super();
this.txt = txt;
}

public getText() : string {
let text : string = this.txt.getText();

return text.replace(/^\w|\.\s?\w/g, l => l.toUpperCase())
}
}
9 changes: 9 additions & 0 deletions les3/MT3A/DecoratorTextfield/dev/DefaultTxt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class DefaultTxt implements Txt
{
public getText() : string
{
let form = document.getElementById("the-form");

return form.search.value;
}
}
16 changes: 16 additions & 0 deletions les3/MT3A/DecoratorTextfield/dev/LowercaseTextDecorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="TextDecorator.ts" />

class LowercaseTextDecorator extends TextDecorator {
public txt : Txt;

constructor(txt : Txt) {
super();
this.txt = txt;
}

public getText() : string {
let text : string = this.txt.getText();

return text.toLowerCase();
}
}
57 changes: 57 additions & 0 deletions les3/MT3A/DecoratorTextfield/dev/NAVOTextDecorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/// <reference path="TextDecorator.ts" />

class NAVOTextDecorator extends TextDecorator {
public txt : Txt;

constructor(txt : Txt) {
super();
this.txt = txt;
}

public getText() : string {
let text : string = this.txt.getText();
text = text.toUpperCase();

let navoSpelling = {
"A" : "Alpha",
"B" : "Bravo",
"C" : "Charlie",
"D" : "Delta",
"E" : "Echo",
"F" : "Foxtrot",
"G" : "Golf",
"H" : "Hotel",
"I" : "India",
"J" : "Juliet",
"K" : "Kilo",
"L" : "Lima",
"M" : "Mike",
"N" : "November",
"O" : "Oscar",
"P" : "Papa",
"Q" : "Quebec",
"R" : "Romeo",
"S" : "Sierra",
"T" : "Tango",
"U" : "Uniform",
"V" : "Victor",
"W" : "Whiskey",
"X" : "Xray",
"Y" : "Yankee",
"Z" : "Zulu"
};

let newText : string = "";

for(let i = 0; i < text.length; i++) {
if(!navoSpelling.hasOwnProperty(text[i])) {
newText += text[i];
continue;
}

newText += text[i].replace(text[i], navoSpelling[text[i]]);
}

return newText;
}
}
16 changes: 16 additions & 0 deletions les3/MT3A/DecoratorTextfield/dev/ReverseTextDecorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="TextDecorator.ts" />

class ReverseTextDecorator extends TextDecorator {
public txt : Txt;

constructor(txt : Txt) {
super();
this.txt = txt;
}

public getText() : string {
let text : string = this.txt.getText();

return text.split("").reverse().join("");
}
}
16 changes: 16 additions & 0 deletions les3/MT3A/DecoratorTextfield/dev/SummarizeTextDecorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="TextDecorator.ts" />

class SummarizeTextDecorator extends TextDecorator {
public txt : Txt;

constructor(txt : Txt) {
super();
this.txt = txt;
}

public getText() : string {
let text : string = this.txt.getText();

return text.split(/\s+/).slice(0,10).join(" ");
}
}
4 changes: 4 additions & 0 deletions les3/MT3A/DecoratorTextfield/dev/TextDecorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
abstract class TextDecorator implements Txt {
abstract txt : Txt;
abstract getText() : string;
}
14 changes: 0 additions & 14 deletions les3/MT3A/DecoratorTextfield/dev/decorators/CapitalDecorator.ts

This file was deleted.

24 changes: 0 additions & 24 deletions les3/MT3A/DecoratorTextfield/dev/decorators/ConcreteDecorator.ts

This file was deleted.

27 changes: 0 additions & 27 deletions les3/MT3A/DecoratorTextfield/dev/decorators/EmojiDecorator.ts

This file was deleted.

15 changes: 0 additions & 15 deletions les3/MT3A/DecoratorTextfield/dev/decorators/LowercaseDecorator.ts

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions les3/MT3A/DecoratorTextfield/dev/decorators/SummeryDecorator.ts

This file was deleted.

Loading