]> _ Git - Animations.git/commitdiff
wait #4135 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 11 Jan 2021 07:31:26 +0000 (08:31 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 11 Jan 2021 07:31:26 +0000 (08:31 +0100)
Discac/Discac.zip
Discac/index.html
Discac/jquery.multi-select.js

index 15beb02de8dc223b2d10ea10a236024fcead569d..2f28b243a448eb7dd4e2d13502ccbc7d8f7f22db 100644 (file)
Binary files a/Discac/Discac.zip and b/Discac/Discac.zip differ
index b6ceacc33b5638f4d148b8f34e39020689cb14a1..a8bb00ede04c2b5a5282f72156a962b6fac9cbaa 100644 (file)
@@ -81,7 +81,7 @@
         .multi-select-menu label {
             color: #464646;
             display: block;
-            padding: 2px 10px;
+            padding: 3px 10px;
             font-size: 16px;
         }
 
@@ -95,7 +95,7 @@
             display: block;
             color: #474747;
             font-size: 0.875em;
-            padding: 0.2em 0.6em;
+            padding: 0.2em 2em 0.2em 0.6em;
             white-space: nowrap;
             overflow: hidden;
             text-overflow: ellipsis;
             position: relative;
         }
 
+        .multi-select-button.active {
+            background-color: #66a11a;
+            color: #fff;
+        }
+
+        .multi-select-button.active:after{
+            border-color: #fff transparent transparent transparent;
+        }
+
+        .multi-select-container--open .multi-select-button.active::after{
+            border-color: transparent transparent #fff transparent
+        }
+
         .multi-select-button:after {
             content: "";
             display: inline-block;
             height: 0;
             border-style: solid;
             border-width: 0.4em 0.4em 0 0.4em;
-            border-color: #999 transparent transparent transparent;
+            border-color: #474747 transparent transparent transparent;
             margin-left: 0.4em;
             vertical-align: 0.1em;
             position: absolute;
             border-color: transparent transparent #999 transparent;
         }
 
-        #emptyres{
-            padding:0 25px;
+        .checkbox {
+            display: inline-block;
+            width: 19px;
+            height: 19px;
+            background-image: url("checkbox.png");
+            background-size: 19px auto;
+            background-repeat: no-repeat;
+            background-position: 0 100%;
+            margin-right: 5px;
+            vertical-align: top;
+            position: relative;
+            top: 1px;
+        }
+
+        .checkbox[checked] {
+            background-position: 0 0;
+        }
+
+        #emptyres {
+            padding: 0 25px;
         }
 
     </style>
             });
         });
 
+        updateCheckboxes();
+
+        function updateCheckboxes() {
+            $(":checkbox").checkbox();
+            $(":radio").checkbox();
+        }
+
         function updateChapters() {
-            var hasVisible=false;
+            var hasVisible = false;
             $('nav a').each(function () {
                 var hide = false;
                 var a = $(this);
                 if (hide) {
                     $(a).hide();
                 } else {
-                    hasVisible=true;
+                    hasVisible = true;
                     $(a).show();
                 }
+                updateCheckboxes();
             });
 
-            if(hasVisible){
+            if (hasVisible) {
                 $("#emptyres").hide();
-            }else{
+            } else {
                 $("#emptyres").show();
             }
 
         });
 
         updateChapters();
+
+
     });
+    (function ($) {
+        $.propHooks.checked = {
+            set: function (el, value) {
+                if (el.checked !== value) {
+                    el.checked = value;
+                    $(el).trigger('checkboxchange');
+                }
+            }
+        };
+
+        function JQcheckbox(element) {
+            this.element = element;
+            this.type = this.element.attr('type');
+            this.input = element;
+            this.substitute;
+            this.label = element.parents("label");
+            if (this.label.length == 0) {
+                this.label = $('label[for="' + element.attr('id') + '"]');
+            }
+            this.label.attr('data-value', element.attr('value'));
+            this.init();
+        }
+
+        JQcheckbox.prototype = {
+            init: function () {
+                var $this = this;
+                this.element.hide();
+                this.element.next(".checkbox").remove();
+                this.substitute = $('<div class="' + this.type + '"></div>');
+
+                var ignore = ['name', 'id', 'type', 'checked', 'style', 'value', 'class'];
+
+                $.each(this.element.attributes, function (k, v) {
+                    if (ignore == undefined || ignore.indexOf(k) == -1) {
+                        $this.substitute.attr(k, v);
+                    }
+                });
+                this.element.after(this.substitute);
+                this.initEvents();
+                this.initState();
+            },
+            initEvents: function () {
+                var $this = this;
+                this.substitute.off('click');
+                this.substitute.on('click', function () {
+                    $this.click();
+                    return false;
+                });
+
+                this.element.off('checkboxchange');
+                this.element.on('checkboxchange', function () {
+                    $this.initState();
+                });
+                this.label.off('click');
+                this.label.on('click', function (e) {
+                    if (e.target == this) {
+                        $this.click();
+                        return false;
+                    }
+                });
+
+            },
+            click: function () {
+                var change = false;
+                if (this.type == 'radio') {
+                    change = this.check();
+                } else {
+                    change = this.toggle();
+                }
+
+                if (change) {
+                    this.element.trigger('change');
+                }
+            },
+            initState: function () {
+                if (!this.element.prop('checked')) {
+                    this.uncheck();
+                } else {
+                    this.check();
+                }
+            },
+            toggle: function () {
+                this.element.trigger('change');
+                if (this.element.prop('checked')) {
+                    this.uncheck();
+                } else {
+                    this.check();
+                }
+                return true;
+            },
+            check: function () {
+                if (this.type == 'radio') {
+                    try {
+                        $(':radio[name="' + this.element.attr('name') + '"]').not(this.element).each(function () {
+                            $(this).data('checkbox').uncheck();
+                        });
+                    } catch (err) {
+
+                    }
+                }
+
+                if (this.substitute.attr('checked') != 'checked') {
+                    this.substitute.attr('checked', 'checked');
+                    this.element.prop('checked', true);
+                    this.label.attr('data-checked', 'checked');
+                    return true;
+                }
+                return false;
+            },
+            uncheck: function () {
+                this.label.attr('data-checked', null);
+                this.substitute.attr('checked', null);
+                this.element.prop('checked', false);
+            }
+
+
+        };
+
+        jQuery.fn.checkbox = function () {
+            return this.each(function () {
+                var $this = $(this);
+                if ($(this).data('checkbox') != undefined) {
+                    $(this).data('checkbox').initState();
+                    return;
+                }
+                $(this).data('checkbox', new JQcheckbox($this));
+            })
+        };
+    })(jQuery);
+
 </script>
 </body>
 </html>
\ No newline at end of file
index 7dca4708279eb2f811706a882a4e8b01bb535c60..8143f30ba78680528c73e9f9747fbf7dd08d5546 100644 (file)
             this.$button.empty();
 
             if (selected.length == 0) {
-                this.$button.text(this.settings['noneText']);
+                this.$button.removeClass('active').text(this.settings['noneText']);
             } else if ((selected.length === options.length) && this.settings['allText']) {
-                this.$button.text(this.settings['allText']);
+                this.$button.removeClass('active').text(this.settings['allText']);
             } else {
-                this.$button.text(this.settings['noneText'] + ' : ' + selected.join(', '));
+                this.$button.addClass('active').text(this.settings['noneText'] + ' : ' + selected.join(', '));
             }
         },