Skip to content

Commit 7ef7352

Browse files
author
crypt
committed
introduced new code formatting
1 parent d9fbb0e commit 7ef7352

File tree

1 file changed

+54
-39
lines changed

1 file changed

+54
-39
lines changed

jquery.webcam.js

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,73 @@
1212

1313
(function ($) {
1414

15-
var webcam = {
15+
var webcam = {
1616

17-
width: 320,
18-
height: 240,
17+
width: 320,
18+
height: 240,
1919

20-
mode: "callback", // callback | save | stream
20+
mode: "callback", // callback | save | stream
2121

22-
swffile: "jscam.swf",
23-
quality: 85,
22+
swffile: "jscam.swf",
23+
quality: 85,
2424

25-
debug: function(type, string) {},
25+
debug: function () {},
26+
onCapture: function () {},
27+
onTick: function () {},
28+
onSave: function () {},
29+
onLoad: function () {}
30+
};
2631

27-
onCapture: function () {},
28-
onTick: function (count) {},
29-
onSave: function () {},
30-
onLoad: function () {}
31-
};
32+
window.webcam = webcam;
3233

33-
window.webcam = webcam;
34+
$.fn.webcam = function(options) {
3435

35-
$.fn.webcam = function(options) {
36-
37-
if (typeof options === "object") {
38-
for (var ndx in webcam) {
39-
if (typeof options[ndx] !== "undefined") {
40-
webcam[ndx] = options[ndx];
41-
}
42-
}
36+
if (typeof options === "object") {
37+
for (var ndx in webcam) {
38+
if (typeof options[ndx] !== "undefined") {
39+
webcam[ndx] = options[ndx];
4340
}
41+
}
42+
}
4443

45-
this.append('<object id="webcam-object" type="application/x-shockwave-flash" data="'+webcam.swffile+'" width="'+webcam.width+'" height="'+webcam.height+'"><param name="movie" value="'+webcam.swffile+'" /><param name="FlashVars" value="mode='+webcam.mode+'&amp;quality='+webcam.quality+'" /></object>');
44+
this.append('<object id="webcam-object" type="application/x-shockwave-flash" data="'+webcam.swffile+'" width="'+webcam.width+'" height="'+webcam.height+'"><param name="movie" value="'+webcam.swffile+'" /><param name="FlashVars" value="mode='+webcam.mode+'&amp;quality='+webcam.quality+'" /></object>');
4645

47-
(_register = function(run) {
46+
(_register = function(run) {
4847

49-
var cam = document.getElementById('webcam-object');
48+
var cam = document.getElementById('webcam-object');
5049

51-
if (typeof cam.capture !== "undefined") {
50+
if (typeof cam.capture !== "undefined") {
5251

53-
/* Simple callback methods are not allowed :-/ */
54-
webcam.capture = function(x) { try {return cam.capture(x);} catch(e) {} };
55-
webcam.save = function(x) { try {return cam.save(x);} catch(e) {} };
56-
webcam.setCamera = function(x) { try {return cam.setCamera(x);} catch(e) {} };
57-
webcam.getCameraList = function( ) { try {return cam.getCameraList();} catch(e) {} };
52+
/* Simple callback methods are not allowed :-/ */
53+
webcam.capture = function(x) {
54+
try {
55+
return cam.capture(x);
56+
} catch(e) {}
57+
}
58+
webcam.save = function(x) {
59+
try {
60+
return cam.save(x);
61+
} catch(e) {}
62+
}
63+
webcam.setCamera = function(x) {
64+
try {
65+
return cam.setCamera(x);
66+
} catch(e) {}
67+
}
68+
webcam.getCameraList = function() {
69+
try {
70+
return cam.getCameraList();
71+
} catch(e) {}
72+
}
5873

59-
webcam.onLoad();
60-
} else if (0 == run) {
61-
webcam.debug("error", "Flash movie not yet registered!");
62-
} else {
63-
/* Flash interface not ready yet */
64-
window.setTimeout(_register, 1000 * (4 - run), run - 1);
65-
}
66-
})(3);
67-
}
74+
webcam.onLoad();
75+
} else if (0 == run) {
76+
webcam.debug("error", "Flash movie not yet registered!");
77+
} else {
78+
/* Flash interface not ready yet */
79+
window.setTimeout(_register, 1000 * (4 - run), run - 1);
80+
}
81+
})(3);
82+
}
6883

6984
})(jQuery);

0 commit comments

Comments
 (0)