-
Notifications
You must be signed in to change notification settings - Fork 22
Develop triangle spa #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Develop triangle spa #123
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
aff4fab
Triangle classifier SPA
mesfinassres 05df979
Triangle classifier SPA
mesfinassres 4ec3438
Triangle classifier SPA
mesfinassres 6446f87
Triangle classifier SPA updated
mesfinassres 662b1c5
Triangle classifier SPA updated for text input
mesfinassres 1749495
Triangle classifier SPA updated for text input
mesfinassres 254f58e
Triangle classifier SPA updated for text input converted Integer.pars…
mesfinassres 6e43d4b
Merge branch 'develop' of https://github.com/WebFuzzing/EMB into deve…
arcuri82 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,58 @@ | ||
| TODO replace me | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-parent</artifactId> | ||
| <version>3.4.3</version> | ||
| <relativePath/> <!-- lookup parent from repository --> | ||
| </parent> | ||
| <groupId>com.example</groupId> | ||
| <artifactId>trianglespa</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <name>TriangleSPA</name> | ||
| <description>TriangleSPA</description> | ||
| <url/> | ||
| <licenses> | ||
| <license/> | ||
| </licenses> | ||
| <developers> | ||
| <developer/> | ||
| </developers> | ||
| <scm> | ||
| <connection/> | ||
| <developerConnection/> | ||
| <tag/> | ||
| <url/> | ||
| </scm> | ||
| <properties> | ||
| <java.version>21</java.version> | ||
| </properties> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-thymeleaf</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-web</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-test</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> |
12 changes: 12 additions & 0 deletions
12
...ven/cs/web/triangle-spa/src/main/java/com/example/trianglespa/TriangleSPAApplication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.example.trianglespa; | ||
|
|
||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
|
||
| import static org.springframework.boot.SpringApplication.*; | ||
|
|
||
| @SpringBootApplication | ||
| public class TriangleSPAApplication { | ||
| public static void main(String[] args) { | ||
| run(TriangleSPAApplication.class, args); | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
jdk_21_maven/cs/web/triangle-spa/src/main/resources/static/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Triangle Classifier SPA</title> | ||
| <link rel="stylesheet" href="style.css"> | ||
| </head> | ||
| <body> | ||
| <h1>Triangle Classifier SPA</h1> | ||
|
|
||
| <div id="main-view"> | ||
| <form id="triangleForm"> | ||
| <label for="a">Side A:</label> | ||
| <input type="text" id="a" name="a" required><br> | ||
|
|
||
| <label for="b">Side B:</label> | ||
| <input type="text" id="b" name="b" required><br> | ||
|
|
||
| <label for="c">Side C:</label> | ||
| <input type="text" id="c" name="c" required><br> | ||
|
|
||
| <button type="submit">Classify</button> | ||
| </form> | ||
|
|
||
| <div id="result" class="hidden result"></div> | ||
| </div> | ||
|
|
||
| <script src="script.js"></script> | ||
| </body> | ||
| </html> |
44 changes: 44 additions & 0 deletions
44
jdk_21_maven/cs/web/triangle-spa/src/main/resources/static/script.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| function classifyTriangle(a, b, c) { | ||
| a = Number(a); | ||
| b = Number(b); | ||
| c = Number(c); | ||
|
|
||
| if (a <= 0 || b <= 0 || c <= 0 || a + b <= c || a + c <= b || b + c <= a) { | ||
| return "not-a-triangle"; | ||
| } else if (a === b && b === c) { | ||
| return "equilateral"; | ||
| } else if (a === b || b === c || a === c) { | ||
| return "isosceles"; | ||
| } else { | ||
| return "scalene"; | ||
| } | ||
| } | ||
|
|
||
| document.getElementById("triangleForm").addEventListener("submit", function (event) { | ||
| event.preventDefault(); | ||
|
|
||
| const a = document.getElementById("a").value; | ||
| const b = document.getElementById("b").value; | ||
| const c = document.getElementById("c").value; | ||
|
|
||
| const resultType = classifyTriangle(a, b, c); | ||
| const resultText = `Result: ${resultType.replace(/-/g, " ")}`; | ||
|
|
||
| // Update URL and show result | ||
| history.pushState({ a, b, c }, "", `/${resultType}`); | ||
| const resultEl = document.getElementById("result"); | ||
| resultEl.textContent = resultText; | ||
| resultEl.classList.remove("hidden"); | ||
| }); | ||
|
|
||
| // Handle back/forward navigation | ||
| window.onpopstate = function () { | ||
| const resultEl = document.getElementById("result"); | ||
| if (location.pathname === "/") { | ||
| resultEl.classList.add("hidden"); | ||
| } else { | ||
| const text = location.pathname.slice(1).replace(/-/g, " "); | ||
| resultEl.textContent = `Result: ${text}`; | ||
| resultEl.classList.remove("hidden"); | ||
| } | ||
| }; |
38 changes: 38 additions & 0 deletions
38
jdk_21_maven/cs/web/triangle-spa/src/main/resources/static/style.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| padding: 30px; | ||
| background-color: #f9f9f9; | ||
| } | ||
|
|
||
| h1 { | ||
| color: #333; | ||
| } | ||
|
|
||
| form { | ||
| margin-bottom: 20px; | ||
| } | ||
|
|
||
| label { | ||
| margin-right: 10px; | ||
| } | ||
|
|
||
| input { | ||
| margin-bottom: 10px; | ||
| padding: 5px; | ||
| width: 60px; | ||
| } | ||
|
|
||
| button { | ||
| padding: 6px 12px; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .result { | ||
| margin-top: 20px; | ||
| font-weight: bold; | ||
| color: #00529B; | ||
| } | ||
|
|
||
| .hidden { | ||
| display: none; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.