PageSourceSearch

https://dittmeieronline.de/plugins/jtl_search/frontend/js/jquery.dependClass.js?v=1.2.1

js dittmeieronline.de collected 2026-10-07 04:26:34 UTC 1,715 bytes, 55 lines download raw bytes

1/*
2 * Depend Class v0.1b : attach class based on first class in list of current element
3 * File: jquery.dependClass.js
4 * Copyright (c) 2009 Egor Hmelyoff, [email protected]
5 */
6
7(function ($) {
8    // Init plugin function
9    $.baseClass = function (obj) {
10        obj = $(obj);
11        return obj.get(0).className.match(/([^ ]+)/)[1];
12    };
13
14    $.fn.addDependClass = function (className, delimiter) {
15        var options = {
16            delimiter: delimiter ? delimiter : '-'
17        }
18        return this.each(function () {
19            var baseClass = $.baseClass(this);
20            if (baseClass) {
21                $(this).addClass(baseClass + options.delimiter + className);
22            }
23        });
24    };
25
26    $.fn.removeDependClass = function (className, delimiter) {
27        var options = {
28            delimiter: delimiter ? delimiter : '-'
29        }
30        return this.each(function () {
31            var baseClass = $.baseClass(this);
32            if (baseClass) {
33                $(this).removeClass(baseClass + options.delimiter + className);
34            }
35        });
36    };
37
38    $.fn.toggleDependClass = function (className, delimiter) {
39        var options = {
40            delimiter: delimiter ? delimiter : '-'
41        }
42        return this.each(function () {
43            var baseClass = $.baseClass(this);
44            if (baseClass) {
45                if ($(this).is("." + baseClass + options.delimiter + className)) {
46                    $(this).removeClass(baseClass + options.delimiter + className);
47                } else {
48                    $(this).addClass(baseClass + options.delimiter + className);
49                }
50            }
51        });
52    };
53
54    // end of closure
55})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.