Commit dda89a47 authored by W.G.G.A. Supun Sameera's avatar W.G.G.A. Supun Sameera

Merge branch 'IT20146924' into 'master'

It20146924

See merge request !1
parents ce543541 e9b8d22f
...@@ -10,7 +10,7 @@ def index(): ...@@ -10,7 +10,7 @@ def index():
if request.method == 'POST': if request.method == 'POST':
input_text = request.form.get('input_text') input_text = request.form.get('input_text')
# Perform processing on input_text and set processed_result # Perform processing on input_text and set processed_result
processed_result = f"Processed: {input_text.upper()}" # Example processing processed_result = f"Processed: {input_text}" # Example processing
return render_template('index.html', processed_result=processed_result) return render_template('index.html', processed_result=processed_result)
...@@ -19,7 +19,7 @@ def index(): ...@@ -19,7 +19,7 @@ def index():
def process(): def process():
input_text = request.form.get('input_text') input_text = request.form.get('input_text')
# Perform processing on input_text and set processed_result # Perform processing on input_text and set processed_result
processed_result = f"Processed: {input_text.upper()}" # Example processing processed_result = f"{input_text}" # Example processing
return jsonify({'processed_result': processed_result}) return jsonify({'processed_result': processed_result})
......
const { app, BrowserWindow } = require('electron');
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
});
mainWindow.loadFile('templates/index.html');
mainWindow.on('closed', function () {
mainWindow = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function () {
if (mainWindow === null) {
createWindow();
}
});
This diff is collapsed.
{
"name": "sinlinguatoolkit",
"version": "1.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"electron": "^26.0.0",
"electron-packager": "^17.1.2"
}
}
...@@ -2,30 +2,53 @@ ...@@ -2,30 +2,53 @@
<html> <html>
<head> <head>
<title>Input Page</title> <title>Input Page</title>
<!-- Include Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head> </head>
<body> <body>
<form method="post" action="/"> <webview src="http://localhost:5000" style="width: 100%; height: 100%;"></webview>
<input type="text" name="input_text"> <div class="container mt-5">
<button type="submit">Submit</button> <div class="row">
</form> <div class="col-md-6">
<form id="inputForm">
<div id="processed-result"></div> <div class="form-group">
<label for="inputText">Enter Text:</label>
<textarea class="form-control" id="inputText" rows="5"></textarea>
</div>
<button type="submit" class="btn btn-primary">Process</button>
</form>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="processedResult">Processed Result:</label>
<textarea class="form-control" id="processedResult" rows="5" readonly></textarea>
</div>
<button id="copyButton" class="btn btn-secondary">Copy</button>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('form').submit(function (event) { $('#inputForm').submit(function (event) {
event.preventDefault(); event.preventDefault();
var inputText = $('input[name="input_text"]').val(); var inputText = $('#inputText').val();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/process', url: '/process',
data: { input_text: inputText }, data: { input_text: inputText },
success: function (response) { success: function (response) {
$('#processed-result').text(response.processed_result); $('#processedResult').val(response.processed_result);
} }
}); });
}); });
$('#copyButton').click(function () {
var copyText = $('#processedResult');
copyText.select();
document.execCommand('copy');
});
}); });
</script> </script>
</body> </body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment