From fb4beec6457e50e5257ba9e3af21cd245a43f1eb Mon Sep 17 00:00:00 2001 From: Dimitris Zafeiris <118735106+ssoc2dzafeiris@users.noreply.github.com> Date: Fri, 20 Jan 2023 08:37:09 +0200 Subject: [PATCH 1/6] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3e8a5a2 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# converterApp +Converter Application AngularJS From 4102a4eea56b224287133c3efd999f14792ca4e8 Mon Sep 17 00:00:00 2001 From: Dimitris Zafeiris Date: Wed, 25 Jan 2023 13:04:29 +0200 Subject: [PATCH 2/6] =?UTF-8?q?=CE=A0=CF=81=CE=BF=CF=83=CE=B8=CE=AE=CE=BA?= =?UTF-8?q?=CE=B7=20=CE=BC=CE=B5=CF=84=CE=B1=CF=84=CF=81=CE=BF=CF=80=CF=8E?= =?UTF-8?q?=CE=BD=20=CE=B1=CF=80=CE=BF=20=CE=BA=CE=B1=CE=B9=20=CF=83=CE=B5?= =?UTF-8?q?=20=CE=BC=CE=AD=CF=84=CF=81=CE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Προσθήκη όλων των μεθόδων για τις μετατροπές στο services. - Εισαγώγη link για routing για τις μετατροπές απο και σε μετρα. -Δημιουργία αρχείου reference για τις χρησιμοποιούμενες μεθόδους. --- doc/ToMeters.txt | 91 ++++++++++++ index.html | 141 ++++++++++-------- scripts/controllers.js | 64 +++++---- scripts/services.js | 285 ++++++++++++++++++++++--------------- templates/fromMeterTo.html | 26 ++++ templates/toMeters.html | 24 ++++ 6 files changed, 432 insertions(+), 199 deletions(-) create mode 100644 doc/ToMeters.txt create mode 100644 templates/fromMeterTo.html create mode 100644 templates/toMeters.html diff --git a/doc/ToMeters.txt b/doc/ToMeters.txt new file mode 100644 index 0000000..d0f3f05 --- /dev/null +++ b/doc/ToMeters.txt @@ -0,0 +1,91 @@ +[Αναφορά στην λειτουργία των συναρτήσεων] +[Author] Zafeiris Dimitrios + +[Γενική Περιγραφή] + +Μετατροπές μεγεθών (mm, cm, km, πόδια, ιντσες) σε μέτρα + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +MmToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε χιλιοστά του μέτρου. + +[Περιγραφή] + Μετατροπή χιλιοστών σε μέτρα + +[Παράδειγμα] + +let input = 100; +let output = input * 0.001; +Αποτέλεσμα: output = 0.01 μέτρα + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +CmToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε εκατοστά του μέτρου. + +[Περιγραφή] + Μετατροπή εκατοστών σε μέτρα + +[Παράδειγμα] + +let input = 1000; +let output = input * 0.01; +Αποτέλεσμα: output = 10 μέτρα + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +KmToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε χιλιόμετρα . + +[Περιγραφή] + Μετατροπή χιλιομέτρων σε μέτρα + +[Παράδειγμα] + +let input = 1; +let output = input * 1000; +Αποτέλεσμα: output = 1000 μέτρα + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +YardsToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε γιάρδες . + +[Περιγραφή] + Μετατροπή γιάρδων σε μέτρα + +[Παράδειγμα] + +let input = 5; +let output = input * 0.9144; +Αποτέλεσμα: output = 4.572 μέτρα + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +FeetToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε πόδια . + +[Περιγραφή] + Μετατροπή ποδιών σε μέτρα + +[Παράδειγμα] + +let input = 5; +let output = input * 0.0254; +Αποτέλεσμα: output = 1.524 μέτρα diff --git a/index.html b/index.html index bc79c3b..112209d 100644 --- a/index.html +++ b/index.html @@ -1,79 +1,106 @@ - - - - + + + + - - + + - - + + - + Converter App - - - + +
- -
-
- +
+
+
-
-
- -
+
+ - - - \ No newline at end of file + + diff --git a/scripts/controllers.js b/scripts/controllers.js index 6c13263..3783aae 100644 --- a/scripts/controllers.js +++ b/scripts/controllers.js @@ -1,36 +1,50 @@ -app.controller('converterController',['$scope','Converter',function($scope,Conveter){ - $scope.conv = new Conveter(); +app.controller ('converterController', [ + '$scope', + 'Converter', + function ($scope, Conveter) { + $scope.conv = new Conveter (); $scope.c = 0; - $scope.k = 0; -}]); + $scope.k = 0; + }, +]); -app.controller('calculationController',['$scope','Calculator','Converter',function($scope,Calculator,Conveter){ +app.controller ('calculationController', [ + '$scope', + 'Calculator', + 'Converter', + function ($scope, Calculator, Conveter) { + $scope.calc = new Calculator (); + $scope.conv = new Converter (); - $scope.calc = new Calculator(); - $scope.conv = new Converter(); - $scope.OhmsR = 1; $scope.OhmsV = 1; $scope.OhmsI = 1; + }, +]); -}]); - - -app.config(function($routeProvider){ - $routeProvider - .when("/", { - templateUrl: 'templates/main.html' +app.config (function ($routeProvider) { + $routeProvider + .when ('/', { + templateUrl: 'templates/main.html', + }) + .when ('/templates/temperature', { + templateUrl: 'templates/temperature.html', + controller: 'converterController', }) - .when("/templates/temperature", { - templateUrl: 'templates/temperature.html', - controller: 'converterController' + .when ('/templates/area', { + templateUrl: 'templates/area.html', + controller: 'calculationController', }) - .when("/templates/area", { - templateUrl: 'templates/area.html', - controller: 'calculationController' + .when ('/templates/ohmslaw', { + templateUrl: 'templates/ohmslaw.html', + controller: 'calculationController', }) - .when("/templates/ohmslaw", { - templateUrl: 'templates/ohmslaw.html', - controller: 'calculationController' + .when ('/templates/toMeters', { + templateUrl: 'templates/toMeters.html', + controller: 'converterController', }) -}); \ No newline at end of file + .when ('/templates/fromMeters', { + templateUrl: 'templates/fromMeterTo.html', + controller: 'converterController', + }); +}); diff --git a/scripts/services.js b/scripts/services.js index 4731b74..c530ebf 100644 --- a/scripts/services.js +++ b/scripts/services.js @@ -1,148 +1,199 @@ -app.factory('Calculator',function(){ - - // constructor - function Calculator() { - } - - // συνάρτηση υπολογισμού του ρεύματος με γνωστά την αντίσταση και την τάση -Calculator.prototype.Ohms_I=function(R,V,units) { +app.factory ('Calculator', function () { + // constructor + function Calculator () {} + + // συνάρτηση υπολογισμού του ρεύματος με γνωστά την αντίσταση και την τάση + Calculator.prototype.Ohms_I = function (R, V, units) { // δήλωσε μία μεταβλητή που θα κρατά το ρεύμα και αρχικοποίησέ τη σε 0 let I = 0; // στην περίπτωση που η παράμετρος R δεν είναι 0 τότε - if (R != 0) - I = V/R; // υπολόγισε την τιμή του ρεύματος + if (R != 0) I = V / R; // υπολόγισε την τιμή του ρεύματος // άν πρέπει να εμφανίσουμε μονάδες μέτρησης στο αποτέλεσμα - if (units == true) - I = I + " Α"; // μορφοποίησε το αποτέλεσμα σε μορφή συμβολοσειράς με μονάδα μέτρησης - - return I; // επέστρεψε την τιμή του ρεύματος -} -// συνάρτηση υπολογισμού της τάσης με γνωστά την αντίσταση και το ρεύμα -Calculator.prototype.Ohms_V=function(R,I,units) { + if (units == true) I = I + ' Α'; // μορφοποίησε το αποτέλεσμα σε μορφή συμβολοσειράς με μονάδα μέτρησης + return I; // επέστρεψε την τιμή του ρεύματος + }; + // συνάρτηση υπολογισμού της τάσης με γνωστά την αντίσταση και το ρεύμα + Calculator.prototype.Ohms_V = function (R, I, units) { // δήλωσε μια μεταβλητή που θα κρατά το αποτέλεσμα - let V = R * I; // υπολόγισε το αποτέλεσμα της τάσης + let V = R * I; // υπολόγισε το αποτέλεσμα της τάσης - // άν πρέπει να εμφανίσουμε μονάδες μέτρησης στο αποτέλεσμα - if (units == true) - V = V + " V"; // μορφοποίησε το αποτέλεσμα σε μορφή συμβολοσειράς με μονάδα μέτρησης + // άν πρέπει να εμφανίσουμε μονάδες μέτρησης στο αποτέλεσμα + if (units == true) V = V + ' V'; // μορφοποίησε το αποτέλεσμα σε μορφή συμβολοσειράς με μονάδα μέτρησης - return V; // επέστρεψε το αποτέλεσμα -} -// συνάρτηση υπολογισμού της αντίστασης με γνωστά την τάση και το ρεύμα -Calculator.prototype.Ohms_R=function(V,I,units) { + return V; // επέστρεψε το αποτέλεσμα + }; + // συνάρτηση υπολογισμού της αντίστασης με γνωστά την τάση και το ρεύμα + Calculator.prototype.Ohms_R = function (V, I, units) { // δήλωσε μία μεταβλητή που θα κρατά την τιμή της αντίστασης let R = 0; // άν η παράμετρος I δέν έχει την τιμή 0 - if (I != 0) - R = V/I; // υπολόγισε την αντίσταση απο τις παραμέτρους - - // άν πρέπει να εμφανίσουμε μονάδες μέτρησης στο αποτέλεσμα - if (units == true) - R = R + " Ω"; // μορφοποίησε το αποτέλεσμα σε μορφή συμβολοσειράς με μονάδα μέτρησης - - return R; // επέστρεψε την τιμή της αντίστασης -} - -// συνάρτηση εμβαδού τριγώνου -Calculator.prototype.triangle_area=function(a,h,units) { + if (I != 0) R = V / I; // υπολόγισε την αντίσταση απο τις παραμέτρους + + // άν πρέπει να εμφανίσουμε μονάδες μέτρησης στο αποτέλεσμα + if (units == true) R = R + ' Ω'; // μορφοποίησε το αποτέλεσμα σε μορφή συμβολοσειράς με μονάδα μέτρησης + + return R; // επέστρεψε την τιμή της αντίστασης + }; + + // συνάρτηση εμβαδού τριγώνου + Calculator.prototype.triangle_area = function (a, h, units) { // δήλωση εμβαδού let E = 0; - - E = a * h/2; // υπολογισμός + + E = a * h / 2; // υπολογισμός // εμφάνιση μονάδας - if (units == true) - E = E + " cm^2"; + if (units == true) E = E + ' cm^2'; - return E; // επιστροφή τιμής εμβαδού -} + return E; // επιστροφή τιμής εμβαδού + }; -// συνάρτηση υπολογισμού ύψους τριγώνου -Calculator.prototype.triangle_height=function(a,E,units) { + // συνάρτηση υπολογισμού ύψους τριγώνου + Calculator.prototype.triangle_height = function (a, E, units) { // δήλωση ύψους - let h = 0; - // η βάση δεν πρέπει να είναι =0 - if (a != 0) - h = 2*E/a; // υπολογισμός - - // εμφάνιση μονάδας - if (units == true) - h = h + " cm"; - - return h; // επιστροφή τιμής - } + let h = 0; + // η βάση δεν πρέπει να είναι =0 + if (a != 0) h = 2 * E / a; // υπολογισμός + + // εμφάνιση μονάδας + if (units == true) h = h + ' cm'; + + return h; // επιστροφή τιμής + }; // συνάρτηση υπολογισμού βάσης τριγώνου - Calculator.prototype.triangle_base=function(h,E,units) { + Calculator.prototype.triangle_base = function (h, E, units) { // δήλωση βάσης let a = 0; - // το ύψος δεν πρέπει να είναι =0 - if (h != 0) - a = 2*E/h; // υπολογισμός + // το ύψος δεν πρέπει να είναι =0 + if (h != 0) a = 2 * E / h; // υπολογισμός // εμφάνιση μονάδας - if (units == true) - a = a + " cm"; - - return a; // επιστροφή τιμής -} - - return Calculator; - }); - - - - app.factory('Converter',function(){ - - // constructor - function Converter() { - } - - Converter.prototype.celsiusToFahrenheit=function(C, accuracy) { - let F = (parseFloat(C) * 9) / 5 + 32; - F = F.toFixed(accuracy); - + if (units == true) a = a + ' cm'; + + return a; // επιστροφή τιμής + }; + + return Calculator; +}); + +app.factory ('Converter', function () { + // constructor + function Converter () {} + + Converter.prototype.celsiusToFahrenheit = function (C, accuracy) { + let F = parseFloat (C) * 9 / 5 + 32; + F = F.toFixed (accuracy); + return F; - } - - Converter.prototype.celsiusToKelvin=function(C, accuracy) { - let K = parseFloat(C) + 273.15; - K = K.toFixed(accuracy); - + }; + + Converter.prototype.celsiusToKelvin = function (C, accuracy) { + let K = parseFloat (C) + 273.15; + K = K.toFixed (accuracy); + return K; - } - - Converter.prototype.kelvinToCelsius=function(K, accuracy) { - let C = parseFloat(K) - 273.15; - C = C.toFixed(accuracy); - + }; + + Converter.prototype.kelvinToCelsius = function (K, accuracy) { + let C = parseFloat (K) - 273.15; + C = C.toFixed (accuracy); + return C; - } - - Converter.prototype.kelvinToFahrenheit=function(K, accuracy) { - let F = (parseFloat(K) * 9) / 5 - 459.67; - F = F.toFixed(accuracy); - + }; + + Converter.prototype.kelvinToFahrenheit = function (K, accuracy) { + let F = parseFloat (K) * 9 / 5 - 459.67; + F = F.toFixed (accuracy); + return F; - } - -Converter.prototype.fahrenheitToCelsius=function(F, accuracy) { - let C = ((parseFloat(F) - 32) * 5) / 9; - C = C.toFixed(accuracy); - + }; + + Converter.prototype.fahrenheitToCelsius = function (F, accuracy) { + let C = (parseFloat (F) - 32) * 5 / 9; + C = C.toFixed (accuracy); + return C; - } - - Converter.prototype.fahrenheitToKelvin=function(F, accuracy) { - let K = ((parseFloat(F) + 459.67) * 5) / 9; - K = K.toFixed(accuracy); - - return K; - } - + }; + + Converter.prototype.fahrenheitToKelvin = function (F, accuracy) { + let K = (parseFloat (F) + 459.67) * 5 / 9; + K = K.toFixed (accuracy); - - return Converter; - }); \ No newline at end of file + return K; + }; + + // converter mm to meters + Converter.prototype.MmToMeters = function (input) { + let output = input * 0.001; + return output; + }; + // converter cm to meters + Converter.prototype.CmToMeters = function (input) { + let output = input * 0.01; + return output; + }; + // converter kilometres to meters + Converter.prototype.KmToMeters = function (input) { + let output = input * 1000; + return output; + }; + + // converter yards to meters + Converter.prototype.YardsToMeters = function (input) { + let output = input * 0.9144; + return output; + }; + + // converter feet to meters + Converter.prototype.FeetToMeters = function (input) { + let output = input * 0.3048; + return output; + }; + + // converter inches to meters + Converter.prototype.InchesToMeters = function (input) { + let output = input * 0.0254; + return output; + }; + + // converter meters to mm + Converter.prototype.MetersToMM = function (input) { + let output = input * 1000; + return output; + }; + + // converter meters to mm + Converter.prototype.MetersToCm = function (input) { + let output = input * 100; + return output; + }; + + // converter meters to km + Converter.prototype.MetersToKm = function (input) { + let output = input * 0.001; + return output; + }; + + // converter meters to yards + Converter.prototype.MetersToKm = function (input) { + let output = input * 1.09361; + return output; + }; + + // converter meters to feet + Converter.prototype.MetersToFeet = function (input) { + let output = input * 3.28084; + return output; + }; + + // converter meters to inches + Converter.prototype.MetersToFeet = function (input) { + let output = input * 39.3701; + return output; + }; + + return Converter; +}); diff --git a/templates/fromMeterTo.html b/templates/fromMeterTo.html new file mode 100644 index 0000000..74c627c --- /dev/null +++ b/templates/fromMeterTo.html @@ -0,0 +1,26 @@ +

Μετατροπή μέτρων σε άλλα μεγέθη

+
+
+ +
+
+
Looks good!
+ Σε mm :
+ Σε cm :
+ Σε km :
+ Σε yd :
+ Σε in :
+ Σε ft :
+
diff --git a/templates/toMeters.html b/templates/toMeters.html new file mode 100644 index 0000000..d893e29 --- /dev/null +++ b/templates/toMeters.html @@ -0,0 +1,24 @@ +

Μετατροπή μεγεθών σε μετρα

+
+ + + +
From f4143f90e283fd9241cdd99df074abfbb38fa1bc Mon Sep 17 00:00:00 2001 From: Dimitris Zafeiris Date: Wed, 25 Jan 2023 13:34:09 +0200 Subject: [PATCH 3/6] =?UTF-8?q?References=20=CE=B1=CF=81=CF=87=CE=B5=CE=AF?= =?UTF-8?q?=CE=B1=20=CE=B3=CE=B9=CE=B1=20=CE=BC=CE=B5=CF=84=CE=B1=CF=84?= =?UTF-8?q?=CF=81=CE=BF=CF=80=CE=B5=CF=82=20=CE=BC=CE=AD=CF=84=CF=81=CF=89?= =?UTF-8?q?=CE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ολοκλήρωση των reference αρχείων των μετατροπών από / σε μέτρα. - Δημιουργία 2 αρχείων. -- fromMeterTo_doc.txt : μετατροπές από μετρα σε άλλα μεγέθη -- ToMeters.txt : μετατροπές από διάφορα μεγέθη σε μέτρα : --- doc/{ToMeters.txt => ToMeters_doc.txt} | 20 ++++- doc/fromMeterTo_doc.txt | 109 +++++++++++++++++++++++++ scripts/services.js | 2 +- 3 files changed, 129 insertions(+), 2 deletions(-) rename doc/{ToMeters.txt => ToMeters_doc.txt} (83%) create mode 100644 doc/fromMeterTo_doc.txt diff --git a/doc/ToMeters.txt b/doc/ToMeters_doc.txt similarity index 83% rename from doc/ToMeters.txt rename to doc/ToMeters_doc.txt index d0f3f05..b61fa9e 100644 --- a/doc/ToMeters.txt +++ b/doc/ToMeters_doc.txt @@ -3,7 +3,7 @@ [Γενική Περιγραφή] -Μετατροπές μεγεθών (mm, cm, km, πόδια, ιντσες) σε μέτρα +Μετατροπές μεγεθών (mm, cm, km, πόδια, ιντσες) σε μέτρα ---------------------------------------------------------------------------------------------------------------------------------- @@ -89,3 +89,21 @@ FeetToMeters let input = 5; let output = input * 0.0254; Αποτέλεσμα: output = 1.524 μέτρα + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +InchesToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε ίντσες . + +[Περιγραφή] + Μετατροπή ιντσών σε μέτρα + +[Παράδειγμα] + +let input = 5; +let output = input * 0.0254; +Αποτέλεσμα: output = 1.524 μέτρα + diff --git a/doc/fromMeterTo_doc.txt b/doc/fromMeterTo_doc.txt new file mode 100644 index 0000000..e757e3e --- /dev/null +++ b/doc/fromMeterTo_doc.txt @@ -0,0 +1,109 @@ +[Αναφορά στην λειτουργία των συναρτήσεων] +[Author] Zafeiris Dimitrios + +[Γενική Περιγραφή] + +Μετατροπές μέτρων σε διάφορα μεγέθη(mm, cm, km, πόδια, ιντσες) + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +MetersToMM + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε μέτρα. + +[Περιγραφή] + Μετατροπή μέτρων σε χιλιοστά + +[Παράδειγμα] + +let input = 1; +let output = input * 1000; +Αποτέλεσμα: output = 1000 mm + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +CmToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε μέτρα. + +[Περιγραφή] + Μετατροπή μέτρων σε εκατοστά + +[Παράδειγμα] + +let input = 1; +let output = input * 100; +Αποτέλεσμα: output = 100 εκατοστά + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +MetersToKm + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε μέτρα. + +[Περιγραφή] + Μετατροπή μέτρων σε χιλιόμετρα + +[Παράδειγμα] + +let input = 5000; +let output = input * 0.001; +Αποτέλεσμα: output = 5 χιλιόμετρα + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +MetersToYd + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε μέτρα. + +[Περιγραφή] + Μετατροπή μέτρων σε γιάρδες + +[Παράδειγμα] + +let input = 5; +let output = input * 3.28084; +Αποτέλεσμα: output = 5.46807 γιάρδες + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +MetersToFeet + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε μέτρα. + +[Περιγραφή] + Μετατροπή μέτρων σε πόδια + +[Παράδειγμα] + +let input = 5; +let output = input * 3.28084; +Αποτέλεσμα: output = 16.4042 πόδια + +---------------------------------------------------------------------------------------------------------------------------------- + +[Όνομα συνάρτησης] +InchesToMeters + +[Παράμετροι] +- input: Είναι η εισαγόμενη τιμή σε μέτρα. + +[Περιγραφή] + Μετατροπή μέτρων σε ιντσες + +[Παράδειγμα] + +let input = 32; +let output = input * 39.3701; +Αποτέλεσμα: output = 1259.84 ιντσες + diff --git a/scripts/services.js b/scripts/services.js index c530ebf..128e490 100644 --- a/scripts/services.js +++ b/scripts/services.js @@ -178,7 +178,7 @@ app.factory ('Converter', function () { }; // converter meters to yards - Converter.prototype.MetersToKm = function (input) { + Converter.prototype.MetersToYd = function (input) { let output = input * 1.09361; return output; }; From 1ac2aba4dfd93a2fa8ff3345f416c429170cbfb3 Mon Sep 17 00:00:00 2001 From: Dimitris Zafeiris Date: Wed, 25 Jan 2023 16:16:17 +0200 Subject: [PATCH 4/6] =?UTF-8?q?=CE=95=CF=80=CE=B5=CE=BE=CE=B5=CF=81=CE=B3?= =?UTF-8?q?=CE=B1=CF=83=CE=B9=CE=B1=20=CF=84=CE=BF=CF=85=20html=20template?= =?UTF-8?q?=20fromMeterTo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/controllers.js | 15 +++++-- scripts/services.js | 24 +++++------ templates/fromMeterTo.html | 82 +++++++++++++++++++++++++++----------- templates/toMeters.html | 1 - 4 files changed, 83 insertions(+), 39 deletions(-) diff --git a/scripts/controllers.js b/scripts/controllers.js index 3783aae..6b5ed2c 100644 --- a/scripts/controllers.js +++ b/scripts/controllers.js @@ -1,10 +1,19 @@ app.controller ('converterController', [ '$scope', 'Converter', - function ($scope, Conveter) { - $scope.conv = new Conveter (); + function ($scope, Converter) { + $scope.conv = new Converter (); $scope.c = 0; $scope.k = 0; + + // Initialize the variables for converter from meters to + $scope.inputM = 0; + $scope.outputMM = 0; + $scope.outputCM = 0; + $scope.outputKM = 0; + $scope.outputYD = 0; + $scope.outputIN = 0; + $scope.outputFT = 0; }, ]); @@ -12,7 +21,7 @@ app.controller ('calculationController', [ '$scope', 'Calculator', 'Converter', - function ($scope, Calculator, Conveter) { + function ($scope, Calculator, Converter) { $scope.calc = new Calculator (); $scope.conv = new Converter (); diff --git a/scripts/services.js b/scripts/services.js index 128e490..6eabc68 100644 --- a/scripts/services.js +++ b/scripts/services.js @@ -128,71 +128,71 @@ app.factory ('Converter', function () { // converter mm to meters Converter.prototype.MmToMeters = function (input) { let output = input * 0.001; - return output; + return output.toFixed (2); }; // converter cm to meters Converter.prototype.CmToMeters = function (input) { let output = input * 0.01; - return output; + return output.toFixed (2); }; // converter kilometres to meters Converter.prototype.KmToMeters = function (input) { let output = input * 1000; - return output; + return output.toFixed (2); }; // converter yards to meters Converter.prototype.YardsToMeters = function (input) { let output = input * 0.9144; - return output; + return output.toFixed (2); }; // converter feet to meters Converter.prototype.FeetToMeters = function (input) { let output = input * 0.3048; - return output; + return output.toFixed (2); }; // converter inches to meters Converter.prototype.InchesToMeters = function (input) { let output = input * 0.0254; - return output; + return output.toFixed (2); }; // converter meters to mm Converter.prototype.MetersToMM = function (input) { let output = input * 1000; - return output; + return output.toFixed (2); }; // converter meters to mm Converter.prototype.MetersToCm = function (input) { let output = input * 100; - return output; + return output.toFixed (2); }; // converter meters to km Converter.prototype.MetersToKm = function (input) { let output = input * 0.001; - return output; + return output.toFixed (3); }; // converter meters to yards Converter.prototype.MetersToYd = function (input) { let output = input * 1.09361; - return output; + return output.toFixed (2); }; // converter meters to feet Converter.prototype.MetersToFeet = function (input) { let output = input * 3.28084; - return output; + return output.toFixed (2); }; // converter meters to inches Converter.prototype.MetersToFeet = function (input) { let output = input * 39.3701; - return output; + return output.toFixed (2); }; return Converter; diff --git a/templates/fromMeterTo.html b/templates/fromMeterTo.html index 74c627c..ccb426b 100644 --- a/templates/fromMeterTo.html +++ b/templates/fromMeterTo.html @@ -1,26 +1,62 @@ -

Μετατροπή μέτρων σε άλλα μεγέθη

-
-
- +
+

Μετατροπή μέτρων σε άλλα μεγέθη

+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ΜέγεθοςΤιμή
Χιλιοστά (mm){{conv.MetersToMM(inputM)}}
Εκατοστά (cm){{conv.MetersToCm(inputM)}}
Χιλιόμετρα (km){{conv.MetersToKm(inputM)}}
Γιάρδες (yd){{conv.MetersToYd(inputM)}}
Ποδια (ft){{conv.MetersToFeet(inputM)}}
Ίντσες (in){{conv.MetersToFeet(inputM)}}
+
+ + +
-
Looks good!
- Σε mm :
- Σε cm :
- Σε km :
- Σε yd :
- Σε in :
- Σε ft :
+
+ diff --git a/templates/toMeters.html b/templates/toMeters.html index d893e29..f8bb50d 100644 --- a/templates/toMeters.html +++ b/templates/toMeters.html @@ -17,7 +17,6 @@

Μετατροπή μεγεθών σε μετρα

class="form-control" id="input" name="input" - value="1" required placeholder="πχ 4.5" /> From 9f312a86f54e6a65e51b89bfa60df9797f2228dd Mon Sep 17 00:00:00 2001 From: Dimitris Zafeiris Date: Thu, 26 Jan 2023 12:24:34 +0200 Subject: [PATCH 5/6] =?UTF-8?q?=CE=94=CE=B9=CE=B1=CE=BC=CF=8C=CF=81=CF=86?= =?UTF-8?q?=CF=89=CF=83=CE=B7=20template=20ToMeters.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Αισθητική οριστικοποιήση του template - Δεν είναι λειτουργικό ακόμη --- scripts/controllers.js | 9 +++++++ scripts/services.js | 2 +- templates/toMeters.html | 60 +++++++++++++++++++++++++++-------------- 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/scripts/controllers.js b/scripts/controllers.js index 6b5ed2c..e36a616 100644 --- a/scripts/controllers.js +++ b/scripts/controllers.js @@ -8,12 +8,21 @@ app.controller ('converterController', [ // Initialize the variables for converter from meters to $scope.inputM = 0; + $scope.outputM = 0; $scope.outputMM = 0; $scope.outputCM = 0; $scope.outputKM = 0; $scope.outputYD = 0; $scope.outputIN = 0; $scope.outputFT = 0; + $scope.choices = [ + {value: 'mm', displayName: 'Χιλιοστά'}, + {value: 'cm', displayName: 'Εκατοστά'}, + {value: 'km', displayName: 'Χιλιόμετρα'}, + {value: 'yd', displayName: 'Γιάρδες'}, + {value: 'ft', displayName: 'Πόδια'}, + {value: 'inc', displayName: 'Ίντσες'}, + ]; }, ]); diff --git a/scripts/services.js b/scripts/services.js index 6eabc68..254f3e2 100644 --- a/scripts/services.js +++ b/scripts/services.js @@ -128,7 +128,7 @@ app.factory ('Converter', function () { // converter mm to meters Converter.prototype.MmToMeters = function (input) { let output = input * 0.001; - return output.toFixed (2); + return output.toFixed (3); }; // converter cm to meters Converter.prototype.CmToMeters = function (input) { diff --git a/templates/toMeters.html b/templates/toMeters.html index f8bb50d..d318f1c 100644 --- a/templates/toMeters.html +++ b/templates/toMeters.html @@ -1,23 +1,43 @@ -

Μετατροπή μεγεθών σε μετρα

+

Μετατροπή μεγεθών σε μετρα

+
- - +
+
+ +
+
+ + +
+
+
+
+
- + {{conv.MmToMeters(inputM)}} μέτρα +
From 0b7d769240076e6935c1542daa914eb11b90b959 Mon Sep 17 00:00:00 2001 From: Dimitris Zafeiris Date: Sat, 28 Jan 2023 21:09:17 +0200 Subject: [PATCH 6/6] =?UTF-8?q?=CE=9B=CE=B5=CE=B9=CF=84=CE=BF=CF=85=CF=81?= =?UTF-8?q?=CE=B3=CE=AF=CE=B1=20=CE=B4=CE=B9=CE=B1=CF=86=CE=BF=CF=81=CE=B1?= =?UTF-8?q?=20=CE=BC=CE=B5=CE=B3=CE=B5=CE=B8=CE=B7=20=CF=83=CE=B5=20=CE=BC?= =?UTF-8?q?=CE=B5=CF=84=CF=81=CE=B1=20=CE=BF=CE=BB=CE=BF=CE=BA=CE=BB=CE=B7?= =?UTF-8?q?=CF=81=CF=8E=CE=B8=CE=B7=CE=BA=CE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ολοκληρώθηκε επιτυχώς το template ToMeters.html. - Προστέθηκε το library icons του Bootstrap 5 στην index.html - Ολοκληρώθηκε και η μορφοποιήση του FromMeterTo.html --- index.html | 5 +++ scripts/controllers.js | 7 +-- templates/fromMeterTo.html | 91 ++++++++++++++++++++------------------ templates/toMeters.html | 48 +++++++++++++++----- 4 files changed, 92 insertions(+), 59 deletions(-) diff --git a/index.html b/index.html index 112209d..2e583cb 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,11 @@ href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" /> + + diff --git a/scripts/controllers.js b/scripts/controllers.js index e36a616..824f824 100644 --- a/scripts/controllers.js +++ b/scripts/controllers.js @@ -9,12 +9,7 @@ app.controller ('converterController', [ // Initialize the variables for converter from meters to $scope.inputM = 0; $scope.outputM = 0; - $scope.outputMM = 0; - $scope.outputCM = 0; - $scope.outputKM = 0; - $scope.outputYD = 0; - $scope.outputIN = 0; - $scope.outputFT = 0; + $scope.selectedChoice = 0; $scope.choices = [ {value: 'mm', displayName: 'Χιλιοστά'}, {value: 'cm', displayName: 'Εκατοστά'}, diff --git a/templates/fromMeterTo.html b/templates/fromMeterTo.html index ccb426b..ea6b9aa 100644 --- a/templates/fromMeterTo.html +++ b/templates/fromMeterTo.html @@ -1,11 +1,11 @@ -
-

Μετατροπή μέτρων σε άλλα μεγέθη

-
-
-
- Μετατροπή μέτρων σε άλλα μεγέθη +
+
+
+
+ Μετατροπή μέτρων σε άλλα μεγέ min="0" />
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ΜέγεθοςΤιμή
Χιλιοστά (mm){{conv.MetersToMM(inputM)}}
Εκατοστά (cm){{conv.MetersToCm(inputM)}}
Χιλιόμετρα (km){{conv.MetersToKm(inputM)}}
Γιάρδες (yd){{conv.MetersToYd(inputM)}}
Ποδια (ft){{conv.MetersToFeet(inputM)}}
Ίντσες (in){{conv.MetersToFeet(inputM)}}
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ΜέγεθοςΤιμή
Χιλιοστά (mm){{conv.MetersToMM(inputM)}}
Εκατοστά (cm){{conv.MetersToCm(inputM)}}
Χιλιόμετρα (km){{conv.MetersToKm(inputM)}}
Γιάρδες (yd){{conv.MetersToYd(inputM)}}
Ποδια (ft){{conv.MetersToFeet(inputM)}}
Ίντσες (in){{conv.MetersToFeet(inputM)}}
+
+
+
Μετατροπή μεγεθών σε μετρα +

Μετατροπή διάφορων μεγεθών σε μέτρα


-
+
-
-
-
+
+
- {{conv.MmToMeters(inputM)}} μέτρα +
+
+ {{conv.MmToMeters(inputM)}} μέτρα +
+
+ {{conv.CmToMeters(inputM)}} μέτρα +
+
+ {{conv.KmToMeters(inputM)}} μέτρα +
+
+ {{conv.YardsToMeters(inputM)}} μέτρα +
+
+ {{conv.FeetToMeters(inputM)}} μέτρα +
+
+ {{conv.InchesToMeters(inputM)}} μέτρα +
+
+
+

+ {{selectedChoice}} m

+

+