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