PageSourceSearch

https://presentybox.com/wp-content/plugins/woocommerce-products-fi…/color/js/html_types/color.js?ver=3.3.8.1

js presentybox.com collected 2026-10-06 05:02:54 UTC 3,272 bytes, 107 lines download raw bytes

1"use strict";
2function woof_init_colors() {
3    //http://jsfiddle.net/jtbowden/xP2Ns/
4    jQuery('.woof_color_term').each(function () {
5
6        var color = jQuery(this).data('color');
7        var img = jQuery(this).data('img');
8
9        var bg = '';
10        if (img && img.length > 0) {
11            bg = 'background: url(' + img + ')';
12        } else {
13            bg = 'background:' + color + ' !important';
14        }
15
16        var span = jQuery('<span style="' + bg + '" class="' + jQuery(this).attr('type') + ' ' + jQuery(this).attr('class') + '" title=""></span>').on('click', woof_color_do_check).mousedown(woof_color_do_down).mouseup(woof_color_do_up);
17        if (jQuery(this).is(':checked')) {
18            span.addClass('checked');
19        }
20        jQuery(this).wrap(span).hide();
21        jQuery(this).after('<span class="woof_color_checked"></span>');//for checking
22    });
23
24    function woof_color_do_check() {
25        var is_checked = false;
26        var radio=false;
27        if(jQuery(this).parents(".woof_list_color").data("type")=="radio"){
28            radio=true;
29        }
30        if(radio){
31            var elements=jQuery(this).parents(".woof_list_color").find(".woof_color_term");
32            jQuery(elements).removeClass('checked');
33            jQuery(elements).children().prop("checked", false);
34        }	
35	
36        if (jQuery(this).hasClass('checked')) {
37            jQuery(this).removeClass('checked');
38            jQuery(this).children().prop("checked", false);
39        } else {
40            jQuery(this).addClass('checked');
41            jQuery(this).children().prop("checked", true);
42            is_checked = true;
43        }
44
45        woof_color_process_data(this, is_checked,radio);
46    }
47
48    function woof_color_do_down() {
49        jQuery(this).addClass('clicked');
50    }
51
52    function woof_color_do_up() {
53        jQuery(this).removeClass('clicked');
54    }
55}
56
57function woof_color_process_data(_this, is_checked, radio) {
58    var tax = jQuery(_this).find('input[type=checkbox]').data('tax');
59    var name = jQuery(_this).find('input[type=checkbox]').attr('name');
60    var term_id = jQuery(_this).find('input[type=checkbox]').data('term-id');
61    woof_color_direct_search(term_id, name, tax, is_checked, radio);
62}
63
64function woof_color_direct_search(term_id, name, tax, is_checked, radio) {
65
66    var values = '';
67    var checked = true;
68    if (is_checked) {
69	if(!radio){
70	    if (tax in woof_current_values) {
71		woof_current_values[tax] = woof_current_values[tax] + ',' + name;
72	    } else {
73		woof_current_values[tax] = name;
74	    }
75	}else{
76	    woof_current_values[tax] = name;
77	}
78        checked = true;
79    } else {
80	if(!radio){
81	    values = woof_current_values[tax];
82	    values = values.split(',');
83	    var tmp = [];
84	    jQuery.each(values, function (index, value) {
85		if (value != name) {
86		    tmp.push(value);
87		}
88	    });
89	    values = tmp;
90	    if (values.length) {
91		woof_current_values[tax] = values.join(',');
92	    } else {
93		delete woof_current_values[tax];
94	    }
95	}else{
96	    delete woof_current_values[tax];
97	}
98        checked = false;
99    }
100    jQuery('.woof_color_term_' + term_id).attr('checked', checked);
101    woof_ajax_page_num = 1;
102    if (woof_autosubmit) {
103        woof_submit_link(woof_get_submit_link());
104    }
105}
106
107

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.