Fix Driving/NightMode; remove 'use strict'.
[profile/ivi/cowhide.git] / src / javascripts / cowhide-checkbox-input.js
1 /*
2  * Copyright (c) 2012, Intel Corporation.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9
10 (function($, undefined) {
11     var ChCheckboxInput = function(element, options) {
12         $.fn.ch_widget.Constructor(element, options);
13         this.$element = $(element);
14         this.options = $.extend(
15             {},
16             $.fn.ch_widget.defaults,
17             {
18                 disableWhenDriving: true
19             });
20     };
21
22     ChCheckboxInput.prototype = $.extend(
23         {},
24         $.fn.ch_widget.Constructor.prototype,
25         {
26             constructor: ChCheckboxInput
27         }
28     );
29
30
31     /* CHCHECKBOXINPUT PLUGIN DEFINITION
32      * ================================= */
33
34     var old = $.fn.ch_checkbox_input;
35
36     $.fn.ch_checkbox_input = function(option) {
37         return this.each(function() {
38             var $this = $(this),
39                 data = $this.data('ch_checkbox_input'),
40                 options = typeof option == 'object' && option;
41
42             if (!data) {
43                 $this.data('ch_checkbox_input', (data = new ChCheckboxInput(this, options)));
44                 data.register();
45             }
46         });
47     };
48
49     $.fn.ch_checkbox_input.Constructor = ChCheckboxInput;
50
51
52     /* CHCHECKBOXINPUT NO CONFLICT
53      * =========================== */
54
55     $.fn.ch_checkbox_input.noConflict = function() {
56         $.fn.ch_checkbox_input = old;
57         return this;
58     };
59
60
61     /* CHCHECKBOXINPUT DATA-API
62      * ================= */
63
64     $(function() {
65         $('input[type=checkbox]').ch_checkbox_input();
66     })
67 })(window.jQuery);