(x1: number, x2: number, y: number, enigmaAnswer: EnigmaAnswer, callbackCollection: CallbackCollection, otherClass: string, wrongClass: string = null, wrongMessage: string = "Wrong")
| 77 | } |
| 78 | |
| 79 | public addEnigma(x1: number, x2: number, y: number, enigmaAnswer: EnigmaAnswer, callbackCollection: CallbackCollection, otherClass: string, wrongClass: string = null, wrongMessage: string = "Wrong"): void{ |
| 80 | this.addTag(new RenderTag(x1, "<span class=\"aroundTextInput\"><input type=\"text\" class=\"asciiTextInput noHotkeys " + otherClass + "\" style=\"width:" + (x2 - x1).toString() + "ex\"></span>"), y); |
| 81 | |
| 82 | // If there should be a wrong message |
| 83 | if(wrongClass != null){ |
| 84 | // We add the wrong message |
| 85 | this.drawString(wrongMessage, x1, y+2); |
| 86 | this.addTwoTags(x1, x1+wrongMessage.length, y+2, "<span class=\"enigmaWrongMessage " + wrongClass + "\">", "</span>"); |
| 87 | // We add the link input which will also display the wrong message if needed |
| 88 | this.addLinkInput("." + otherClass, enigmaAnswer, callbackCollection, new CallbackCollection( |
| 89 | function(){ |
| 90 | // We make the element visible |
| 91 | $("." + wrongClass).css("visibility", "visible"); |
| 92 | // We add a timeout to hide it soon |
| 93 | window.setTimeout( |
| 94 | function(){ |
| 95 | $("." + wrongClass).css("visibility", "hidden"); |
| 96 | }, |
| 97 | 1000 |
| 98 | ); |
| 99 | } |
| 100 | )); |
| 101 | } |
| 102 | // Else, no wrong message |
| 103 | else{ |
| 104 | // We add a simple link input |
| 105 | this.addLinkInput("." + otherClass, enigmaAnswer, callbackCollection, new CallbackCollection()); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | public addFullComment(x: number, y: number, english: string, translated: string, otherClass: string): boolean{ |
| 110 | if(this.addComment(Algo.correctIfUnderZero(x - (english.length/2)), y, english, otherClass) == false) |
nothing calls this directly
no test coverage detected