1$(document).ready(function () { 2 //BACK-END custom settings panel behavior (START) 3 b2.set.stylingType = function (val) { 4 $('.theme-demos').each(function () { 5 var _ = $(this); 6 if (_.hasClass(val)) { 7 _.show(); 8 } else { 9 _.hide(); 10 } 11 }); 12 13 var activeThemeName = $('.theme-demo.active').data('theme'); 14 activeThemeName = activeThemeName.replace(/-\w+/i, '-' + val); 15 if ($('.' + activeThemeName).length) { 16 $('.' + activeThemeName).click(); 17 } 18 else { 19 $('.theme-demos.' + val).find('li.theme-demo:first').click(); 20 } 21 if (activeThemeName.match(/\-flat$/)) { 22 $('body').removeClass('more_bold'); 23 } else { 24 $('body').addClass('more_bold'); 25 } 26 }; 27 b2.rel.stores.push({ 28 selector: '#settings_show-stock', 29 states: { 30 true: [{ 31 action: 'prop', 32 arguments: ['disabled', true] 33 }], 34 false: [{ 35 action: 'prop', 36 arguments: ['disabled', false] 37 }] 38 } 39 }); 40 b2.rel.stores_mobile = [{ 41 selector: '#settings_show-stock_MOBILE', 42 states: { 43 true: [{ 44 action: 'prop', 45 arguments: ['disabled', true] 46 }], 47 false: [{ 48 action: 'prop', 49 arguments: ['disabled', false] 50 }] 51 } 52 }]; 53 //BACK-END custom settings panel behavior (END) 54 55 // color-theme switch 56 $('.theme-demo').on('click', function () { 57 if (!$(this).hasClass('active')) { 58 $('.theme-demo.active').removeClass('active'); 59 $(this).addClass('active'); 60 61 var newTheme = $(this).attr('data-theme'); 62 63 $('input#theme-demo').val(newTheme); 64 65 if (newTheme.match(/\-flat$/)) { 66 $('body').removeClass('more_bold'); 67 } else { 68 $('body').addClass('more_bold'); 69 } 70 } else return; 71 }); 72 73 var $setPanel = $('#settings-panel-cblocks'); 74 var $setPanelSubmit = $('#settings-panel-submit'); 75 76 $.fn.serializeAssoc = function () { 77 var obj = { 78 result: {}, 79 add: function (name, value) { 80 var tmp = name.match(/^(.*)\[([^\]]*)\]$/); 81 if (tmp) { 82 var v = {}; 83 if (tmp[2]) 84 v[tmp[2]] = value; 85 else 86 v[$.count(v)] = value; 87 this.add(tmp[1], v); 88 } else if (typeof value == 'object') { 89 if (typeof this.result[name] != 'object') { 90 this.result[name] = {}; 91 } 92 this.result[name] = $.extend(this.result[name], value); 93 } else { 94 this.result[name] = value; 95 } 96 } 97 }; 98 var ar = this.serializeArray(); 99 for (var i = 0; i < ar.length; i++) { 100 obj.add(ar[i].name, ar[i].value); 101 } 102 return obj.result; 103 }; 104 var setCookie = function(name, value, prefix) { 105 var date = new Date(); 106 date.setFullYear(date.getFullYear() + 1); 107 document.cookie = prefix + name + '=' + value + ';domain=.'+ window.location.hostname + '; path=/; expires=' + date.toUTCString(); 108 }; 109 var fillBSSettings = function(object, prefix) { 110 for (var key in object) { 111 switch (typeof object[key]) { 112 case "object": 113 fillBSSettings(object[key], prefix + key + '_'); 114 break; 115 case "function": 116 break; 117 default: 118 $(prefix + key).val(object[key]); 119 break; 120 } 121 } 122 } 123 $setPanelSubmit.on('click', function (e) { 124 fillBSSettings(bs.defaults, '#settings_bs_'); 125 if ("DEMO" in RZB2 && RZB2.DEMO) { 126 var arSettings = $setPanel.serializeAssoc(); 127 $.ajax({ 128 type: 'POST', 129 url: SITE_DIR + 'ajax/composite.php', 130 data: arSettings, 131 dataType: 'json', 132 success: function(obj) { 133 $setPanel.submit(); 134 } 135 }); 136 } else { 137 $setPanel.submit(); 138 } 139 }); 140 $setPanel.on('click', '.set-color li', function (e) { 141 var $this = $(this), 142 $parent = $this.closest('.set-color'), 143 $tar = $parent.data('target'); 144 if (!$tar) { 145 $tar = $('#settings_'+ $parent.data('name')); 146 $parent.data('target', $tar); 147 } 148 $tar.val($this.data('value')).trigger('change'); 149 }); 150 $setPanel.on('change', '.minicolors', function (e) { 151 var $this = $(this), 152 $tar = $this.data('target'); 153 if (!$tar) { 154 $tar = $('#settings_'+ $this.data('name')); 155 $this.data('target', $tar); 156 } 157 $tar.val($this.val()).trigger('change'); 158 }); 159 $setPanel.on('change', '.color-setting', function (e) { 160 var $this = $(this), 161 obj = $this.data('obj'); 162 if (!obj) { 163 obj = $($this.data('selector')); 164 $this.data('obj', obj); 165 } 166 if ($this.data('selector')) { 167 obj.css($this.data('property'), $this.val()); 168 } 169 }); 170 $setPanel.on('change', '.type-choose', function (e) { 171 var $this = $(this), 172 $parent = $this.closest('.setting-content'); 173 $parent.find('.data-type').hide(); 174 var $curElem = $parent.find('.data-type.type-' + $this.val()); 175 $curElem.show(); 176 $curElem.find('.set-color').trigger('change'); 177 }); 178 $setPanel.on('show.bs.collapse hide.bs.collapse', '.collapse', function(e){
179 $(this).closest('fieldset').toggleClass('no-border'); 180 }); 181 $('#cancel-settings').hover( 182 function(){ 183 b2.el.$settingsForm.data('reset', true); 184 }, 185 function(){ 186 b2.el.$settingsForm.data('reset', false); 187 } 188 ); 189 190 /********** PRESETS **********/ 191 $('#settings_blocks label.checkbox-styled').on('click', function(){ 192 $('input.statebox[data-name="preset"]').prop('checked', false); 193 }); 194 var presets = { 195 // commons 196 'currency-switcher': {easy: false, medium: false, hard: true}, 197 'block_main-menu-elem': {easy: false, medium: false, hard: true}, 198 'menu-show-icons': {easy: false, medium: true, hard: true}, 199 'menu-show-icons_MOBILE': {easy: false, medium: false, hard: true}, 200 'block_pricelist': {easy: false, medium: false, hard: true}, 201 'quick-view': {easy: false, medium: true, hard: true}, 202 'quick-view-chars': {easy: false, medium: true, hard: true}, 203 'backnav_enabled': {easy: false, medium: false, hard: true}, 204 'show_discount_percent': {easy: false, medium: false, hard: true}, 205 'stores': {easy: false, medium: false, hard: true}, 206 'show-stock': {easy: false, medium: false, hard: true}, 207 'block_show_stars': {easy: false, medium: true, hard: true}, 208 'block_show_geoip': {easy: false, medium: true, hard: true}, 209 'block_show_compare': {easy: true, medium: true, hard: true}, 210 'block_show_favorite': {easy: true, medium: true, hard: true}, 211 'block_show_oneclick': {easy: false, medium: true, hard: true}, 212 'block_show_article': {easy: false, medium: true, hard: true}, 213 'block_show_comment_count': {easy: false, medium: false, hard: true}, 214 'block_show_gallery_thumb': {easy: false, medium: false, hard: true}, 215 'block_show_ad_banners': {easy: false, medium: false, hard: true}, 216 'block_worktime': {easy: false, medium: true, hard: true}, 217 'block_search_category': {easy: false, medium: false, hard: true}, 218 'block_menu_count': {easy: false, medium: false, hard: true}, 219 'block-buy_button_MOBILE': {easy: false, medium: false, hard: true}, 220 // index 221 'block_home-main-slider': {easy: true, medium: true, hard: true}, 222 'block_home-rubric': {easy: false, medium: false, hard: true}, 223 'block_home-cool-slider': {easy: false, medium: true, hard: true}, 224 'cool_slider_show_names': {easy: false, medium: false, hard: true}, 225 'block_home-specials': {easy: true, medium: true, hard: true}, 226 'block_home-specials_icons': {easy: false, medium: false, hard: true}, 227 'block_home-specials_count': {easy: false, medium: false, hard: true}, 228 'block_home-our-adv': {easy: false, medium: true, hard: true}, 229 'block_home-feedback': {easy: true, medium: true, hard: true}, 230 'block_home-catchbuy': {easy: false, medium: false, hard: true}, 231 'block_home-news': {easy: true, medium: true, hard: true}, 232 'block_home-voting': {easy: false, medium: false, hard: true}, 233 'block_home-brands': {easy: false, medium: true, hard: true}, 234 'coolslider_show_stickers': {easy: false, medium: false, hard: true}, 235 'catchbuy_color_heading': {easy: false, medium: false, hard: true}, 236 // detail 237 'block_detail-addtoorder': {easy: false, medium: true, hard: true}, 238 'block_detail-similar': {easy: false, medium: false, hard: true}, 239 'block_detail-similar-view': {easy: false, medium: false, hard: true}, 240 'block_detail-similar-price': {easy: false, medium: false, hard: true}, 241 'block_detail-recommended': {easy: false, medium: false, hard: true}, 242 'block_detail-viewed': {easy: false, medium: true, hard: true}, 243 'block_detail-delivery': {easy: false, medium: true, hard: true}, 244 'block_detail-view3d': {easy: false, medium: false, hard: true}, 245 'block_detail-gift-products': {easy: false, medium: true, hard: true}, 246 'block_detail-gift-main-products': {easy: false, medium: true, hard: true}, 247 'detail_catchbuy_slider': {easy: false, medium: false, hard: true}, 248 'block_detail_print': {easy: false, medium: false, hard: true}, 249 'block_detail_price_updated': {easy: false, medium: true, hard: true}, 250 'block_detail_review': {easy: false, medium: true, hard: true}, 251 'block_detail_short_info_under_image': {easy: false, medium: true, hard: true}, 252 'block_detail_feedback': {easy: false, medium: false, hard: true}, 253 'block_detail_socials': {easy: false, medium: false, hard: true}, 254 'block_detail_gamification': {easy: false, medium: false, hard: true}, 255 // section
256 'catalog_catchbuy_slider': {easy: false, medium: false, hard: true}, 257 'block_list-view-block': {easy: true, medium: true, hard: true}, 258 'block_list-view-list': {easy: false, medium: true, hard: true}, 259 'block_list-view-table': {easy: true, medium: true, hard: true}, 260 'block_list-sort-name': {easy: true, medium: true, hard: true}, 261 'block_list-sort-new': {easy: true, medium: true, hard: true}, 262 'block_list-sort-views': {easy: true, medium: true, hard: true}, 263 'block_list-sort-rating': {easy: false, medium: true, hard: true}, 264 'block_list-sort-price': {easy: false, medium: true, hard: true}, 265 'block_list-sub-sections': {easy: false, medium: true, hard: true}, 266 'block_list-section-desc': {easy: false, medium: true, hard: true}, 267 'block_list-hits': {easy: false, medium: false, hard: true}, 268 'table-units-col': {easy: false, medium: false, hard: true}, 269 // basket 270 'block_basket-gift-products': {easy: false, medium: true, hard: true}, 271 // search 272 'block_search-viewed': {easy: false, medium: true, hard: true}, 273 'block_search-bestseller': {easy: false, medium: false, hard: true}, 274 'block_search-recommend': {easy: false, medium: false, hard: true}, 275 // 404 276 'block_404-viewed': {easy: false, medium: true, hard: true}, 277 'block_404-bestseller': {easy: false, medium: false, hard: true}, 278 'block_404-recommend': {easy: false, medium: false, hard: true}, 279 }; 280 b2.rel.preset = []; 281 for (var key in presets) { 282 var relObj = { 283 selector: '#settings_' + key, 284 states: {} 285 }; 286 if ($(relObj.selector).is(':disabled')) continue; 287 288 for (var stateKey in presets[key]) { 289 relObj.states[stateKey] = [{ 290 action: 'prop', 291 arguments: ['checked', presets[key][stateKey]] 292 }]; 293 } 294 b2.rel.preset.push(relObj); 295 296 if (typeof presets[key + '_MOBILE'] != "undefined") continue; 297 298 var relObjMobile = { 299 selector: relObj.selector + '_MOBILE', 300 states: relObj.states 301 }; 302 if ($(relObjMobile.selector).is(':disabled')) continue; 303 304 b2.rel.preset.push(relObjMobile); 305 } 306 /********** PRESETS **********/ 307}); 308 309$(window).on('modalSettingsInited', function(){ 310 b2.el.$settingsForm.data('reset', false); 311 b2.el.$settingsModal.on('shown.bs.modal', function(){ 312 b2.el.$settingsForm.data('reset', false); 313 }); 314 b2.el.inputSliderWidth = $('input[data-name="big-slider-width"]'); 315 316 //need to trigger according b2.set.~ and b2.rel.~ methods 317 $('input[data-name="catalog-placement"]:checked').change(); 318 $('input[data-name="container-width"]:checked').change(); 319 $('#settings_stores:checked').change(); 320 $('#settings_stores_MOBILE:checked').change(); 321});
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.