Fri, 03 May 2024 15:12:25 +0200
Some javascript fixes and cleanup
710
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * Copyright (C) 2019 |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of ThermFerm |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * ThermFerm is distributed in the hope that it will be useful, but |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | var phi = 0, flipped = 0, mirrored = 0; |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | function setXformClass () { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | $('.xform').each(function(idx,el) { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | el.className = "xform x" +(flipped ? "-flipped":"") + (mirrored ? "-mirrored" : "") + "-rotated-" + phi; |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | } |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | $(document).ready(function () { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | // set rotation angle phi and toggle rotate class |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | $("#rotate").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-rotate-right.png" }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | $('#rotate').click(function() { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | phi = (phi + 90) % 360; |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | setXformClass(); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | if (phi % 180) { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | $('.xform-p').addClass('rotated'); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | } else { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | $('.xform-p').removeClass('rotated'); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | } |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | // toggle mirror class component |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | $("#mirror").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-flip-horizontal.png" }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | $('#mirror').click(function() { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | mirrored = ! mirrored; |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | setXformClass(); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | // toggle flip class componen |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | $("#flip").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-flip-vertical.png" }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | $('#flip').click(function() { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | flipped = ! flipped; |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | setXformClass(); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | $("#Close").jqxButton({ template: "success", width: 125, theme: theme }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | $("#Close").click(function () { |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | window.close(); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | }); |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
abe60578d695
Moved webcam scripts over to this www directory. Upgraded jquery to 2.1.1 (still old).
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | }); |