1jQuery(document).ready(function ($) { 2 3 var skinContainerShowHideClass = 'hide-skin-chooser'; 4 jQuery('#show_hide_skin_chooser').click(function (e) { 5 e.preventDefault(); 6 7 var $skinContainer = $('#skin-chooser-container'); 8 if ($skinContainer.hasClass(skinContainerShowHideClass)) { 9 $skinContainer.removeClass(skinContainerShowHideClass); 10 } 11 else { 12 $skinContainer.addClass(skinContainerShowHideClass); 13 } 14 15 16 return false; 17 }); 18 19 20 /* Color Picker */ 21 var color_chooser_source =jQuery("#css-skin").html(), color_chooser_template = Handlebars.compile(color_chooser_source); 22 jQuery('.input-colorpicker').ColorPicker({ 23 onSubmit: function (hsb, hex, rgb, el) { 24 jQuery(el).val('#' + hex); 25 jQuery(el).ColorPickerHide(); 26 }, 27 onBeforeShow: function () { 28 jQuery(this).ColorPickerSetColor(this.value); 29 }, 30 onChange: function (hsb, hex, rgb, el) { 31 32 var $el = $(el), new_color = '#' + hex, source, template, elName = $el.attr('name'), htmlTemplate; 33 $el.next().css('background-color', '#' + hex); 34 35 el.value = new_color; 36 37 38 skins_data[$default_skin][elName] = new_color; 39 skins_data[$default_skin][elName + '_rgba'] = convertHex(new_color, 0.5); 40 htmlTemplate = color_chooser_template(skins_data[$default_skin]); 41 42 jQuery("#skin-chooser-css").remove(); 43 jQuery('<style type="text/css" id="skin-chooser-css">' + htmlTemplate + '</style>').appendTo('head'); 44 45 46 //data:text/css;base64, 47 $('#skin-save').attr('href', 'data:text/css;base64,' + $.base64Encode(htmlTemplate)); 48 // $("#skin-chooser-css")[0].cssText = htmlTemplate; 49 // $("#skin-chooser-css").html( htmlTemplate ); 50 } 51 }).bind('keyup', function () { 52 jQuery(this).ColorPickerSetColor(this.value); 53 }); 54 55 56 jQuery('.skin-chooser-label').click(function () { 57 jQuery(this).next().slideToggle(); 58 }); 59 60 /* Set default mode */ 61 if (jQuery('#wrapper').hasClass('boxed')) { 62 jQuery('#layout-mode option[value="boxed"]')[0].selected = true; 63 64 } 65 //change mod 66 $('#layout-mode').change(function () { 67 jQuery('#wrapper').attr('class', $('option:selected', this).val()); 68 jQuery('#masonry-elements,.portfolio-items').isotope('reLayout'); 69 jQuery(window).trigger('resize'); 70 }); 71 // change color skin of theme 72 /* jQuery(document).on('click', '.predefined-skins', function () { 73 jQuery("#skin-chooser-css").remove(); 74 var skin_name = jQuery(this).data('skinname'), $inputColorPicker, color; 75 $default_skin = skin_name; 76 77 for (var prop in default_skins_data[$default_skin]) { 78 $inputColorPicker = $('.input-colorpicker[name=' + prop + ']') 79 color = default_skins_data[$default_skin][prop]; 80 $inputColorPicker.val(color); 81 $inputColorPicker.next().css('background-color', color); 82 } 83 84 //jQuery('#skin-file-css').attr('href', '../../css/skins/' + skin_name + '.css'); 85 86 var oldlink = document.getElementById("skin-file-css"); 87 var newlink = document.createElement("link"); 88 newlink.setAttribute("id", "skin-file-css"); 89 newlink.setAttribute("rel", "stylesheet"); 90 newlink.setAttribute("type", "text/css"); 91 newlink.setAttribute("href", "http://localhost/wordpress-3.9/wp-content/themes/weblizar+shortcode/css/skins/"+ skin_name + '.css'); 92 document.getElementsByTagName("head").item(0).replaceChild(newlink, oldlink); 93 94 95 var header_div_type = default_skins_data[$default_skin]['header_type']; 96 jQuery('.top-header').attr('class', 'top-header ' + header_div_type); 97 jQuery('#divider-mode option:selected').removeAttr('selected'); 98 if( jQuery('#divider-mode option[value=' + header_div_type + ']')[0] ) 99 jQuery('#divider-mode option[value=' + header_div_type + ']')[0].selected = true; 100 }); */ 101 102 var last_class_used = ''; 103 jQuery('.pattern,.image-chooser').click(function () { 104 if (!isBoxed()) { 105 alert('Please choose boxed layout first :)'); 106 return false;
107 } 108 var pattern_class = $(this).data('body-class'); 109 jQuery('body').attr('class', pattern_class); 110 //$('body').addClass(pattern_class); 111 last_class_used = pattern_class; 112 }); 113 114 115 jQuery('#skin-save').click(function () { 116 if (jQuery(this).attr('href') == "") { 117 alert('The skin does not changed!'); 118 return false; 119 } 120 }); 121 122 jQuery('#divider-mode').change(function () { 123 var option = $('option:selected', this).val(); 124 jQuery('.top-header').attr('class', 'top-header ' + option); 125 }); 126}); 127 128function rgb_color(rgb, a) { 129 if (a) { 130 return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + a + ')'; 131 } 132 else { 133 return 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')'; 134 } 135} 136 137function isBoxed() { 138 return jQuery('#layout-mode option:selected').val() == 'boxed'; 139} 140 141function convertHex(hex, opacity) { 142 hex = hex.replace('#', ''); 143 r = parseInt(hex.substring(0, 2), 16); 144 g = parseInt(hex.substring(2, 4), 16); 145 b = parseInt(hex.substring(4, 6), 16); 146 147 result = 'rgba(' + r + ',' + g + ',' + b + ',' + opacity + ')'; 148 return result; 149}
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.