1jQuery( document ).ready( function ( e ) { 2 LOG = vadpc3d_debug_js; 3 4 Number.prototype.Pc3dFormatNumber = function(decPlaces) { 5 var decSeparator = ','; 6 var thouSeparator = '.'; 7 8 var n = this, 9 decPlaces = isNaN(decPlaces = Math.abs(decPlaces)) ? 2 : decPlaces, 10 decSeparator = decSeparator == undefined ? "." : decSeparator, 11 thouSeparator = thouSeparator == undefined ? "," : thouSeparator, 12 sign = n < 0 ? "-" : "", 13 i = parseInt(n = Math.abs(+n || 0).toFixed(decPlaces)) + "", 14 j = (j = i.length) > 3 ? j % 3 : 0; 15 total = (j ? i.substr(0, j) + thouSeparator : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thouSeparator) + (decPlaces ? decSeparator + Math.abs(n - i).toFixed(decPlaces).slice(2) : ""); 16 return total; 17 }; 18 19 var customization = { 20 init: function () { 21 customization.displayData(); 22 }, 23 displayData: function () { 24 if (customization.hasData()) { 25 jQuery('.pc3d_customization').each(function () { 26 var data = jQuery(this); 27 var modal = data.closest('.customization-modal'); 28 var anchor = modal.prev().hide(); 29 data.insertBefore(anchor); 30 }); 31 } 32 }, 33 hasData: function () { 34 return jQuery('.pc3d_customization').size() > 0; 35 }, 36 37 }; 38 39 jQuery(customization.init); 40 41 if(typeof prestashop !== 'undefined') { 42 prestashop.on('updatedCart',function (event) { 43 LOG && console.log('UPDATE CART'); 44 //console.log(event); 45 jQuery(customization.init); 46 47 }); 48 } 49 50 51}); 52 53 54 55var _main_c; 56var _frm_c; 57var _form_c; 58var _data_c; 59var _div_c; 60var zoom_style = {}; 61 62_image_ = []; 63editor_available = false; 64editor_loading = false; 65editor_loaded = false; 66 67is_mobile = false; 68is_portrait = true; 69is_portrait_old = true; 70is_ios = false; 71is_mozilla = false; 72is_chrome = false; 73userAgent = ''; 74final_height = ''; 75ratio=1; 76 77SCR = {}; 78md5_upses = ''; 79 80function zoom_pc3d_lite_in(_main_c,_frm_c,_data_c, _div_c){ 81 82 83 main_pc3d = document.getElementById(_main_c); 84 85 zoom_style.width = main_pc3d.style.width; 86 zoom_style.height = main_pc3d.style.height; 87 zoom_style.position = main_pc3d.style.position; 88 zoom_style.top = main_pc3d.style.top; 89 zoom_style.left = main_pc3d.style.left; 90 zoom_style.zIndex = main_pc3d.style.zIndex; 91 zoom_style.boxShadow = main_pc3d.style.boxShadow; 92 93 //window.scrollTo(0,0); 94 jQuery('.pc3d-lite-overlay').fadeIn('slow'); 95 96 main_pc3d.style.position = 'absolute'; 97 //main_pc3d.style.margin = 0; 98 main_pc3d.style.top = 0; 99 main_pc3d.style.left = 0; 100 main_pc3d.style.zIndex = 1001; 101 main_pc3d.style.boxShadow = '-1px 1px 10px 0px #6c6c6c33'; 102 103 //main_pc3d.style.width = 0.8 * document.body.clientWidth + 'px'; 104 //main_pc3d.style.width = jQuery('#container_pc3d_self').width() + 'px'; 105 var lite_width = isNaN(jQuery('#pc3d_editor_lite').width()) ? 0 : parseInt(jQuery('#pc3d_editor_lite').width()); 106 var framing_width = isNaN(jQuery('#pc3d_editor_framing').width()) ? 0 : parseInt(jQuery('#pc3d_editor_framing').width()); 107 main_pc3d.style.width = lite_width + framing_width + jQuery('#main_pc3d_gallery').width() + 'px'; 108 109 110 main_pc3d.style.height = 0.9 * window.innerHeight + 'px'; 111 112 //zoom = true; 113 //zoom_in = true; 114 //zoom_out = false; 115 116 117 //main_pc3d.scrollIntoView(); 118 window.dispatchEvent(new Event('resize')); 119 main_pc3d.scrollIntoView(); 120 /*if (is_mobile == false){ 121 resize_pc3d(_main_c,_frm_c, _div_c); 122 }*/ 123 124} 125 126function zoom_pc3d_lite_out(_main_c,_frm_c, _data_c, _div_c){ 127 128 main_pc3d = document.getElementById(_main_c); 129 jQuery('.pc3d-lite-overlay').fadeOut('slow'); 130 131 main_pc3d.style.width = zoom_style.width; 132 main_pc3d.style.height = zoom_style.height; 133 main_pc3d.style.position = zoom_style.position; 134 main_pc3d.style.top = zoom_style.top; 135 main_pc3d.style.left = zoom_style.left; 136 main_pc3d.style.zIndex = zoom_style.zIndex; 137 main_pc3d.style.boxShadow = zoom_style.boxShadow; 138 139 140 window.dispatchEvent(new Event('resize')); 141 142 143 144} 145 146function search_image(data) { 147 var encontrado = false;
148 var id = 211; 149 if (data.aux_id){ 150 id = data.aux_id; 151 } 152 _image_.forEach(IMG => { 153 154 if (IMG.name == data.name && IMG.size == data.size && encontrado == false){ 155 encontrado = true; 156 var apiCOM = { 157 id: id, 158 image: IMG.image, 159 name: IMG.name, 160 size: IMG.size, 161 type: IMG.type, 162 replace: IMG.replace, 163 id_vis: IMG.id_vis, 164 id_pos: IMG.id_pos, 165 id_lay: data.id_lay, 166 }; 167 LOG && console.dir(apiCOM); 168 pc3d_send_apicom_ima(apiCOM); 169 170 return; 171 } 172 173 }); 174 175 176} 177 178function getCookie(cname) { 179 var name = cname + "="; 180 var decodedCookie = decodeURIComponent(document.cookie); 181 var ca = decodedCookie.split(';'); 182 for(var i = 0; i <ca.length; i++) { 183 var c = ca[i]; 184 while (c.charAt(0) == ' ') { 185 c = c.substring(1); 186 } 187 if (c.indexOf(name) == 0) { 188 return c.substring(name.length, c.length); 189 } 190 } 191 return ""; 192} 193 194function check_mobile(){ 195 /* 196 if (is_app == false){ 197 if (screen.width < 960) { 198 is_mobile=true; 199 } 200 }else{ 201 if (window.innerWidth < 960) { 202 is_mobile=true; 203 } 204 } 205 */ 206 is_mobile = SCR.is_mobile; 207} 208 209function check_browser(){ 210 211 userAgent = window.navigator.userAgent; 212 213 if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) { 214 is_ios=true; 215 } 216 if (userAgent.match(/FxiOS/i)) { 217 is_mozilla=true; 218 } 219 if (userAgent.match(/CriOS/i)) { 220 is_chrome=true; 221 } 222 223} 224 225 226function resize_pc3d(_main_c, _frm_c, _div_c) { 227 228 LOG && console.warn('RESIZE DESKTOP'); 229 230 231 div_pc3d = document.getElementById(_div_c); 232 frm_pc3d = document.getElementById(_frm_c); 233 234 if (_div_c=="div_pc3d"){ 235 div_pc3d.style.width = Math.max(document.body.offsetWidth, document.body.clientWidth) + 'px'; 236 div_pc3d.style.height = Math.max(document.body.offsetHeight, window.outerHeight) + 'px'; 237 frm_pc3d.style.width = document.body.clientWidth + 'px'; 238 frm_pc3d.style.height = window.innerHeight + 'px'; 239 }else{ 240 div_pc3d.style.width = div_pc3d.parentElement.offsetWidth + 'px'; 241 div_pc3d.style.height = div_pc3d.parentElement.offsetHeight + 'px'; 242 frm_pc3d.style.width =div_pc3d.style.width; 243 frm_pc3d.style.height = div_pc3d.style.height; 244 245 if (_div_c != "div_pc3d_gallery"){ 246 div_pc3d.scrollIntoView({block: "end", behavior: "auto"}); 247 window.scrollBy(0, 40); 248 } 249 } 250} 251 252function pc3d_change_viewport_mobile() { 253 254 ratio = window.devicePixelRatio || 1; 255 if (ratio > 2) {ratio=2;} 256 257 var w = screen.width * ratio; 258 var h = screen.height * ratio; 259 260 //if (_div_c != "div_pc3d_gallery"){ 261 262 switch(window.orientation) 263 { 264 case -90: 265 case 90: 266 267 var mvp = viewport = document.querySelector("meta[name=viewport]"); 268 //mvp.setAttribute('content','viewport-fit=cover, user-scalable=no, user-scalable=0, height=device-height, width='+Math.max(w,h)); 269 mvp.setAttribute('content','viewport-fit=cover, user-scalable=no, user-scalable=0, width='+Math.max(w,h)); 270 is_portrait=false; 271 272 break; 273 default: 274 var mvp = viewport = document.querySelector("meta[name=viewport]"); 275 //mvp.setAttribute('content','viewport-fit=cover, user-scalable=no, user-scalable=0, height=device-height, width='+Math.min(w,h)); 276 mvp.setAttribute('content','viewport-fit=cover, user-scalable=no, user-scalable=0, width='+Math.min(w,h)); 277 is_portrait=true; 278 279 break; 280 } 281 282} 283 284function resize_pc3d_mobile(_landscape_block, _frm_c, _div_c) { 285 LOG && console.warn('RESIZE MOBILE'); 286 LOG && console.warn('LANDSCAPE BLOCK:' + _landscape_block); 287 //window.scrollTo(0, 1); 288 289 if (_div_c != "div_pc3d_gallery"){ 290 var block_pc3d = document.getElementById('block_pc3d'); 291 var loading_pc3d = document.getElementById('loading_pc3d'); 292 293 ratio = window.devicePixelRatio || 1; 294 if (ratio > 2) {ratio=2;} 295 296 var w = screen.width * ratio;
297 var h = screen.height * ratio; 298 299 var div_pc3d = document.getElementById(_div_c); 300 div_pc3d.style.width = Math.max(document.body.offsetWidth, document.body.clientWidth) + 'px'; 301 302 303 var frm_pc3d = document.getElementById(_frm_c); 304 frm_pc3d.style.width = document.body.clientWidth + 'px'; 305 //frm_pc3d.style.height = aux_height + 'px'; 306 307 var aval_w = screen.availWidth * ratio; 308 var aval_h = screen.availHeight * ratio; 309 310 311 312 313 if (is_portrait==true){ 314 //PORTRAIT 315 div_pc3d.style.width=Math.min(w,h) + 'px'; 316 div_pc3d.style.height=Math.max(w,h) + 'px'; 317 frm_pc3d.style.width= Math.min(aval_w,aval_h) + 'px'; 318 319 var pos_top = document.getElementById("pc3d_pos_top"); 320 var pos_bottom = document.getElementById("pc3d_pos_bottom"); 321 322 frm_pc3d.style.height = (pos_bottom.offsetTop - pos_top.offsetTop) + 'px'; 323 324 325 LOG && console.warn('****'); 326 LOG && console.warn("POS TOP:" + pos_top.offsetTop); 327 LOG && console.warn("POS BOTTOM:" + pos_bottom.offsetTop); 328 LOG && console.warn("HEIGHT:" + frm_pc3d.style.height); 329 LOG && console.warn('****'); 330 331 block_pc3d.style.display = 'none'; 332 }else{ 333 //LANDSCAPE 334 335 if (_landscape_block==true) block_pc3d.style.display = 'block'; 336 337 //div_pc3d.style.width=Math.max(w,h) + 'px'; 338 div_pc3d.style.height=Math.min(w,h) + 'px'; 339 // frm_pc3d.style.width= Math.max(w,h) + 'px'; 340 frm_pc3d.style.height= Math.min(aval_w,aval_h) + 'px'; 341 342 } 343 344 div_pc3d.scrollIntoView(); 345 346 setTimeout(function () { 347 var win = document.getElementById('frm_pc3d').contentWindow; 348 var apiCOM = { id: 100, width: parseInt(frm_pc3d.style.width), height: parseInt(frm_pc3d.style.height)}; 349 win.postMessage(JSON.stringify(apiCOM), '*'); 350 }, 50); 351 352 if (is_portrait==true && is_portrait_old==true) { 353 final_height = frm_pc3d.style.height; 354 } 355 356 is_portrait_old = is_portrait; 357 358 if (VADPC3DAjax.is_app == 1 ){ 359 //alert('W:'+ frm_pc3d.style.width + 'H:'+frm_pc3d.style.height); 360 } 361 362 363 }else{//LITE 364 var gallery_width = 0; 365 var gallery_height = 0; 366 var offset = 0; 367 368 if (jQuery('.cover-image-ecommzoom').length >0){ 369 gallery_width = jQuery('.cover-image-ecommzoom').width(); 370 }else if (jQuery('.product-cover').length >0){ 371 gallery_width = jQuery('.product-cover').width(); 372 } 373 374 375 376 if (SCR.is_mobile == true && lite_opt.beta ==1 && window.scrollY <= 1){ 377 LOG && console.warn("RETURN SCROLL:" + window.scrollY); 378 return false; 379 } 380 381 if (SCR.is_mobile == true ){ 382 if (window.orientation == 0){//portrait 383 384 if (lite_opt.beta ==1){ 385 386 gallery_width = screen.width; 387 gallery_height = screen.height * VADPC3DField.preview_height; 388 offset = 0; 389 is_portrait=true; 390 391 }else{ 392 gallery_height = gallery_width; 393 offset = 160; 394 is_portrait=true; 395 396 } 397 398 }else{//landscape 399 gallery_height = screen.width; 400 gallery_width = jQuery('#content-wrapper').width(); 401 is_portrait = false; 402 } 403 404 }else{ 405 gallery_height = gallery_width; 406 offset = 160; 407 } 408 409 410 //LOG && console.warn("GALLERY WIDTH:" + gallery_width); 411 //LOG && console.warn("GALLERY HEIGHT:" + gallery_height); 412 413 var main_pc3d = document.getElementById('main_pc3d_gallery'); 414 main_pc3d.style.width = gallery_width +'px'; 415 main_pc3d.style.height = gallery_height + offset +'px'; 416 417 if (lite_opt.beta ==1){ 418 419 main_pc3d.style.position = 'fixed'; 420 main_pc3d.style.left = '0px'; 421 main_pc3d.style.top = '0px'; 422 main_pc3d.style.zIndex = '999'; 423 main_pc3d.style.marginLeft = '0px'; 424 main_pc3d.style.boxShadow = '#808080b3 0px 3px 3px -2px';//0 3px 2px -3px grey';//'rgb(0 0 0 / 20%) 0px 1px 3px'; 425 426 //main_pc3d.style.marginTop = '80px'; 427 428 if (VADPC3DAPICOM.platform == 3){ //woo 429 var page_content = document.getElementById('pc3d_editor_lite').parentElement; 430 var offset2 = 0; 431 } 432 433 if (VADPC3DAPICOM.platform == 4){ //presta 434 var page_content = document.getElementById('pc3d_editor_lite').parentElement.parentElement; 435 var offset2 = 0; 436 } 437 438 439 440 //var page_content = document.getElementsByClassName('col-product-info')[0]; 441 442 page_content.style.marginTop = gallery_height + offset2 +'px'; 443 444 setTimeout(function () { 445 window.onscroll = function(){ 446 447 //var bottom_offset = jQuery('.col-product-info').height(); 448 //var bottom_offset = jQuery('#pc3d_editor_lite').height(); 449 var bottom_offset = page_content.clientHeight; 450 var left_offset = main_pc3d.offsetLeft; 451 452 if ( window.scrollY < 200 || window.scrollY > bottom_offset){ 453 //LOG && console.warn("POSITION RELATIVE:" + window.scrollY); 454 455 main_pc3d.style.position = 'relative'; 456 main_pc3d.style.left = ''; 457 main_pc3d.style.top = ''; 458 main_pc3d.style.zIndex = '20'; 459 main_pc3d.style.boxShadow = '';
460 main_pc3d.style.marginLeft = '-' + VADPC3DField.offset_left + 'px'; 461 page_content.style.marginTop = '0px'; 462 463 //main_pc3d.style.marginTop = '0px'; 464 465 }else{ 466 //LOG && console.warn("POSITION FIXED:" + window.scrollY); 467 468 main_pc3d.style.position = 'fixed'; 469 main_pc3d.style.left = '0px'; 470 main_pc3d.style.top = '0px'; 471 main_pc3d.style.zIndex = '999'; 472 main_pc3d.style.marginLeft = '0px'; 473 main_pc3d.style.boxShadow = '#808080b3 0px 3px 3px -2px';//0 3px 2px -3px grey';//'rgb(0 0 0 / 20%) 0px 1px 3px'; 474 page_content.style.marginTop = gallery_height + offset2 +'px'; 475 476 //main_pc3d.style.marginTop = '80px'; 477 478 } 479 480 }; 481 482 }, 50); 483 484 } 485 486 var div_pc3d = document.getElementById(_div_c); 487 div_pc3d.style.width = main_pc3d.style.width; 488 div_pc3d.style.height = main_pc3d.style.height; 489 490 var frm_pc3d = document.getElementById(_frm_c); 491 frm_pc3d.style.width = main_pc3d.style.width; 492 frm_pc3d.style.height = main_pc3d.style.height; 493 494 setTimeout(function () { 495 var apiCOM = { id: 100, width: parseInt(frm_pc3d.style.width), height: parseInt( frm_pc3d.style.height)}; 496 Pc3dSendMessage(apiCOM, _frm_c); 497 }, 50); 498 //main_pc3d.style.display = 'block'; 499 500 } 501 502} 503 504 505function resize_pc3d_app(_landscape_block, _frm_c, _div_c, send = false) { 506 LOG && console.warn('RESIZE APP'); 507 LOG && console.warn('LANDSCAPE BLOCK:' + _landscape_block); 508 509 var block_pc3d = document.getElementById('block_pc3d'); 510 511 ratio = window.devicePixelRatio || 1; 512 if (ratio > 2) {ratio=2;} 513 var w = screen.width * ratio; 514 var h = screen.height * ratio; 515 516 var div_pc3d = document.getElementById(_div_c); 517 div_pc3d.style.width = Math.max(document.body.offsetWidth, document.body.clientWidth) + 'px'; 518 519 var frm_pc3d = document.getElementById(_frm_c); 520 frm_pc3d.style.width = document.body.clientWidth + 'px'; 521 //frm_pc3d.style.height = aux_height + 'px'; 522 523 var aval_w = screen.availWidth * ratio; 524 var aval_h = screen.availHeight * ratio; 525 526 527 528 529 if (is_portrait==true){ 530 //PORTRAIT 531 div_pc3d.style.width=Math.min(w,h) + 'px'; 532 div_pc3d.style.height=Math.max(w,h) + 'px'; 533 frm_pc3d.style.width= Math.min(aval_w,aval_h) + 'px'; 534 535 //Android Chrome (default) 536 537 if (is_ios==false && is_portrait_old==true) { frm_pc3d.style.height = window.innerHeight + 'px';} 538 539 if (is_ios==false && is_portrait_old==false) { 540 if (final_height>0) { 541 frm_pc3d.style.height= final_height; 542 }else{ 543 frm_pc3d.style.height= final_height; 544 } 545 } 546 547 //Safari Firefox 548 if (is_portrait_old==true && is_ios==true && is_mozilla==true) { 549 LOG && console.warn("HEIGHT MOZILLA IOS PORTRAIT_OLD=TRUE:" + Math.max(aval_w,aval_h)); 550 frm_pc3d.style.height= Math.max(aval_w,aval_h) + 'px'; 551 } 552 553 if (is_portrait_old==false && is_ios==true && is_mozilla==true) { 554 LOG && console.warn("HEIGHT SAFARI IOS PORTRAIT_OLD=FALSE:" + window.innerHeight); 555 frm_pc3d.style.height = window.innerHeight+'px'; 556 }//{ frm_pc3d.style.height= Math.max(aval_w,aval_h) + 'px';}//{frm_pc3d.style.height = window.innerHeight*ratio +'px';} 557 558 //Safari iOS 559 if (is_portrait_old==true && is_ios==true && is_mozilla==false) { 560 LOG && console.warn("HEIGHT SAFARI IOS PORTRAIT_OLD=TRUE:" + window.innerHeight*ratio); 561 frm_pc3d.style.height = window.innerHeight*ratio +'px'; 562 } 563 564 //Safari iOS con Barra 565 if (is_portrait_old==false && is_ios==true && is_mozilla==false) { 566 567 //frm_pc3d.style.height = window.innerHeight + 'px'; 568 frm_pc3d.style.height = aval_h - 230 + 'px'; 569 570 LOG && console.warn("APP HEIGHT SAFARI IOS PORTRAIT_OLD=FALSE:"
570+ frm_pc3d.style.height); 571 572 } 573 574 block_pc3d.style.display = 'none'; 575 }else{ 576 //LANDSCAPE 577 578 if (_landscape_block==true) block_pc3d.style.display = 'block'; 579 580 //div_pc3d.style.width=Math.max(w,h) + 'px'; 581 div_pc3d.style.height=Math.min(w,h) + 'px'; 582 // frm_pc3d.style.width= Math.max(w,h) + 'px'; 583 frm_pc3d.style.height= Math.min(aval_w,aval_h) + 'px'; 584 585 } 586 587 div_pc3d.scrollIntoView(); 588 589 setTimeout(function () { 590 591 /*var apiCOM = { id: 100, width: parseInt(frm_pc3d.style.width), height: parseInt(frm_pc3d.style.height)}; 592 593 //var win = document.getElementById(_frm_c).contentWindow; 594 //win.postMessage(JSON.stringify(apiCOM), '*'); 595 596 Pc3dSendMessage(apiCOM, _frm_c);*/ 597 598 var win = document.getElementById('frm_pc3d').contentWindow; 599 var apiCOM = { id: 100, width: parseInt(frm_pc3d.style.width), height: parseInt(frm_pc3d.style.height)}; 600 win.postMessage(JSON.stringify(apiCOM), '*'); 601 602 }, 50); 603 604 if (is_portrait==true && is_portrait_old==true) { 605 final_height = frm_pc3d.style.height; 606 } 607 608 is_portrait_old = is_portrait; 609 610 if (VADPC3DAjax.is_app == 1 ){ 611 //alert('W:'+ frm_pc3d.style.width + 'H:'+frm_pc3d.style.height); 612 } 613} 614 615function load_frame_pc3d(_src,_data, _background, _landscape_block, _main_c, _frm_c, _form_c, _data_c, _div_c) { 616 617 LOG && console.warn('IS MOBILE='+is_mobile); 618 619 check_browser(); 620 621 if (VADPC3DAjax.is_app == 1 && _div_c != "div_pc3d_gallery"){ 622 parent.postMessage("fullscreen-on","*"); 623 } 624 625 if (is_mobile == false && VADPC3DAjax.is_app == 0){ 626 627 var div_pc3d = document.getElementById(_div_c); 628 div_pc3d.style.backgroundColor = _background; 629 div_pc3d.style.display = 'block'; 630 631 resize_pc3d(_main_c, _frm_c, _div_c); 632 633 }else if (VADPC3DAjax.is_app == 1 && _div_c != "div_pc3d_gallery"){ 634 if (_div_c != "div_pc3d_gallery"){pc3d_change_viewport_mobile()}; 635 636 var div_pc3d = document.getElementById(_div_c); 637 div_pc3d.style.backgroundColor = VADPC3DAjax.background_lite;//_background_mobile; 638 div_pc3d.style.width = '100%'; 639 div_pc3d.style.height = '100%'; 640 div_pc3d.style.display = 'block'; 641 642 setTimeout(function () { 643 resize_pc3d_app(_landscape_block, _frm_c, _div_c, true); 644 }, 400); 645 } 646 else{ 647 if (_div_c != "div_pc3d_gallery"){pc3d_change_viewport_mobile()}; 648 649 var div_pc3d = document.getElementById(_div_c); 650 div_pc3d.style.backgroundColor = VADPC3DAjax.background_lite;//_background_mobile; 651 //div_pc3d.style.width = '100%'; 652 //div_pc3d.style.height = '100%'; 653 div_pc3d.style.display = 'block'; 654 655 setTimeout(function () { 656 resize_pc3d_mobile(_landscape_block, _frm_c, _div_c); 657 }, 200); 658 659 } 660 661 662 663 var frm_pc3d = document.getElementById(_frm_c); 664 665 var form_pc3d = document.getElementById(_form_c); 666 form_pc3d.action = _src + '?' + new Date().getTime(); 667 668 var data_pc3d = document.getElementById(_form_c).querySelector("#"+_data_c); 669 data_pc3d.value=_data; 670 form_pc3d.submit(); 671 672 if (is_mobile==false){ 673 window.onresize = function (e) { resize_pc3d(_main_c, _frm_c, _div_c); }; 674 }else{ 675 window.onresize = function (e) { 676 if (_div_c != "div_pc3d_gallery"){pc3d_change_viewport_mobile()}; 677 678 if ( (is_ios==true) && (is_portrait==true) ){ 679 //console.warn('WP IOS SACA BARRA'); 680 is_portrait_old = false; 681 682 if (VADPC3DAjax.is_app == 1 && _div_c != "div_pc3d_gallery"){ 683 setTimeout(function () { 684 resize_pc3d_app(_landscape_block, _frm_c, _div_c); 685 }, 600); 686 }else{ 687 setTimeout(function () { 688 resize_pc3d_mobile(_landscape_block, _frm_c, _div_c); 689 }, 300); 690 } 691 692 } 693 694 if ( (is_ios==false) && (is_portrait==true) && ( (parseInt(final_height)/1.5) < window.outerHeight*ratio < parseInt(final_height))){ 695 //console.warn('WP CHROME SACA BARRA'); 696 if (VADPC3DAjax.is_app == 1 && _div_c != "div_pc3d_gallery"){ 697 698 setTimeout(function () { 699 resize_pc3d_app(_landscape_block, _frm_c, _div_c); 700 }, 600); 701 702 }else{ 703 setTimeout(function () { 704 resize_pc3d_mobile(_landscape_block, _frm_c, _div_c); 705 }, 300); 706 } 707 708 } 709 }; 710 711 window.onorientationchange = function (e) { 712 console.warn('WP ORIENTATION CHANGE'); 713 714 if (_div_c != "div_pc3d_gallery"){pc3d_change_viewport_mobile()}; 715 716 if (VADPC3DAjax.is_app == 1 && _div_c != "div_pc3d_gallery"){ 717 718 setTimeout(function () { 719 resize_pc3d_app(_landscape_block, _frm_c, _div_c); 720 }, 400); 721 722 }else{ 723 setTimeout(function () { 724 resize_pc3d_mobile(_landscape_block, _frm_c, _div_c); 725 }, 100); 726 } 727 728 }; 729 } 730 731} 732 733pc3d_v=0; 734pc3d_r=0; 735pc3d_s=''; 736 737 738function get_opt_pc3d(_opt_id, _opt_arra, _child_id){ 739 740 if (_child_id==0){ 741 var name="group[" + _opt_id + "]"; 742 //var name=_opt_id; 743 744 var inputType = jQuery("[name='" + name + "']").attr("type"); 745 746 if (inputType == "radio"){ 747 //radio 748 var myid = jQuery('input[name="' + name + '"]:checked').attr('id'); 749 var pc3d_v_aux = jQuery('label[for='+ myid +']').text(); 750 pc3d_v = pc3d_v_aux.split(' ')[0]; 751 pc3d_r = jQuery('input[name="' + name + '"]:checked').val(); 752 753 }else{ 754 //select 755 var pc3d_v_aux = jQuery("select[name='" + name + "'] option:selected").text(); 756 pc3d_v = pc3d_v_aux.split(' ')[0]; 757 pc3d_r = jQuery("select[name='" + name + "'] option:selected").val(); 758 } 759 760 var obj = JSON.parse(decodeURIComponent(_opt_arra)); 761 762 for (var i = 0; i < obj.length; i++) { 763 if (obj[i].r == pc3d_r) { 764 pc3d_v=obj[i].v; 765 pc3d_p=obj[i].p; 766 pc3d_c=obj[i].child_id; 767 768 } 769 } 770 pc3d_s=0; 771 } 772 else{ 773 774 var obj = JSON.parse(decodeURIComponent(_opt_arra)); 775 776 for (var i = 0; i < obj.length; i++) { 777 if (obj[i].child_id == _child_id) { 778 pc3d_r=obj[i].r; 779 pc3d_v=obj[i].v; 780 pc3d_p=obj[i].p; 781 pc3d_c=obj[i].child_id; 782 } 783 } 784 pc3d_s=0; 785 786 } 787 788 789} 790 791function get_opt_price(_var_id,_opt_arra){ 792
793 //obtener precio de opcion seleccionada 794 var obj = JSON.parse(decodeURIComponent(_opt_arra)); 795 for (var i = 0; i < obj.length; i++) { 796 if (obj[i].child_id == _var_id) { 797 798 pc3d_p=obj[i].p; 799 } 800 } 801} 802 803function get_swatch_pc3d(_id_swatch, _opt_id,_opt_arra){ 804 805 pc3d_r = jQuery(_id_swatch).find( ".selected" ).attr('id').replace('option',''); 806 807 //obtener nombre de opcion seleccionada 808 var obj = JSON.parse(decodeURIComponent(_opt_arra)); 809 for (var i = 0; i < obj.length; i++) { 810 if (obj[i].r == pc3d_r) { 811 pc3d_v=obj[i].v; 812 } 813 } 814 pc3d_s=0; 815 816} 817 818function get_configurable_product_options(pc3d, data_EXT){ 819 820 if (pc3d._attr_id_mat !=0){ 821 LOG && console.warn('_attr_id_mat:'+pc3d._attr_id_mat); 822 823 get_opt_pc3d(pc3d._attr_id_mat,pc3d._arr_swatch_mat,pc3d._child_id); 824 825 sm11 = pc3d._attr_id_mat; 826 sv11 = pc3d_v; 827 sr11 = pc3d_r; 828 ss11 = pc3d_s; 829 sc11 = pc3d_c; 830 831 //m4 = pc3d_p; 832 /*if (sc11){ 833 get_opt_price(sc11,pc3d._arr_swatch_mat); 834 m4 = pc3d_p; 835 }*/ 836 837 838 data_EXT.sm11 = sm11; 839 data_EXT.sv11 = sv11; 840 data_EXT.sr11 = sr11; 841 data_EXT.ss11 = ss11; 842 data_EXT.sc11 = sc11; 843 844 845 } 846 847 if (pc3d._attr_id_col !=0){ 848 LOG && console.warn('_attr_id_col:'+pc3d._attr_id_col); 849 850 get_opt_pc3d(pc3d._attr_id_col,pc3d._arr_swatch_col,pc3d._child_id); 851 852 sm12 = pc3d._attr_id_col; 853 sv12 = pc3d_v; 854 sr12 = pc3d_r; 855 ss12 = pc3d_s; 856 857 sc12 = pc3d_c; 858 859 //m4 = pc3d_p; 860 /*if (sc12){ 861 get_opt_price(sc12, pc3d._arr_swatch_col); 862 m4 = pc3d_p; 863 }*/ 864 865 866 data_EXT.sm12 = sm12; 867 data_EXT.sv12 = sv12; 868 data_EXT.sr12 = sr12; 869 data_EXT.ss12 = ss12; 870 data_EXT.sc12 = sc12; 871 872 } 873 874 875 if (pc3d._attr_id_size !=0){ 876 LOG && console.warn('_attr_id_size:' + pc3d._attr_id_size); 877 878 get_opt_pc3d(pc3d._attr_id_size, pc3d._arr_swatch_size,pc3d._child_id); 879 880 sm13 = pc3d._attr_id_size; 881 sv13 = pc3d_v; 882 sr13 = pc3d_r; 883 ss13 = pc3d_s; 884 885 sc13 = pc3d_c; 886 887 //m4 = pc3d_p; 888 /*if (sc13){ 889 get_opt_price(sc13,pc3d._arr_swatch_size); 890 m4 = pc3d_p; 891 }*/ 892 893 data_EXT.sm13 = sm13; 894 data_EXT.sv13 = sv13; 895 data_EXT.sr13 = sr13; 896 data_EXT.ss13 = ss13; 897 data_EXT.sc13 = sc13; 898 899 } 900 901 if (pc3d._attr_id_view !=0){ 902 LOG && console.warn('_attr_id_view:'+ pc3d._attr_id_view); 903 904 get_opt_pc3d(pc3d._attr_id_view, pc3d._arr_swatch_view,pc3d._child_id); 905 906 sm14 = pc3d._attr_id_view; 907 sv14 = pc3d_v; 908 sr14 = pc3d_r; 909 ss14 = pc3d_s; 910 911 sc14 = pc3d_c; 912 913 //m4 = pc3d_p; 914 /*if (sc14){ 915 get_opt_price(sc14, pc3d._arr_swatch_view); 916 m4 = pc3d_p; 917 }*/ 918 919 data_EXT.sm14 = sm14; 920 data_EXT.sv14 = sv14; 921 data_EXT.sr14 = sr14; 922 data_EXT.ss14 = ss14; 923 data_EXT.sc14 = sc14; 924 925 } 926 927 if (pc3d._attr_id_product !=0){ 928 LOG && console.warn('_attr_id_product:'+ pc3d._attr_id_product); 929 930 get_opt_pc3d(pc3d._attr_id_product, pc3d._arr_swatch_product,pc3d._child_id); 931 932 sm15 = pc3d._attr_id_product; 933 sv15 = pc3d_v; 934 sr15 = pc3d_r; 935 ss15 = pc3d_s; 936 937 sc15 = pc3d_c; 938 939 //m4 = pc3d_p; 940 /*if (sc15){ 941 get_opt_price(sc15,pc3d._arr_swatch_product); 942 m4 = pc3d_p; 943 }*/ 944 945 //v22 = sr15; 946 v22 = sv15; 947 v2 = pc3d._prod_woo_sku; 948 LOG && console.warn("v2:"+v2+" v22:"+v22); 949 950 data_EXT.sm15 = sm15; 951 data_EXT.sv15 = sv15; 952 data_EXT.sr15 = sr15; 953 data_EXT.ss15 = ss15; 954 data_EXT.sc15 = sc15; 955 } 956 957 if (pc3d._attr_id_profiles !=0){ 958 LOG && console.warn('_attr_id_profiles:'+ pc3d._attr_id_profiles); 959 960 get_opt_pc3d(pc3d._attr_id_profiles, pc3d._arr_swatch_profiles, pc3d._child_id); 961 962 sm16 = pc3d._attr_id_profiles; 963 sv16 = pc3d_v; 964 sr16 = pc3d_r; 965 ss16 = pc3d_s; 966 sc16 = pc3d_c; 967 968 LOG && console.warn('sc16 variation id:'+sc16); 969 970 //m4 = pc3d_p; 971 /*if (sc16){ 972 get_opt_price(sc16, pc3d._arr_swatch_profiles); 973 m4 = pc3d_p; 974 }*/ 975 976 data_EXT.sm16 = sm16; 977 data_EXT.sv16 = sv16; 978 data_EXT.sr16 = sr16; 979 data_EXT.ss16 = ss16; 980 data_EXT.sc16 = sc16; 981 982 } 983 984 if (pc3d._attr_id_printing !=0){ 985 LOG && console.warn('_attr_id_printing:'+ pc3d._attr_id_printing); 986 987 get_opt_pc3d(pc3d._attr_id_printing, pc3d._arr_swatch_printing, pc3d._child_id); 988 989 sm17 = pc3d._attr_id_printing; 990 sv17 = pc3d_v; 991 sr17 = pc3d_r; 992 ss17 = pc3d_s; 993 sc17 = pc3d_c; 994 LOG && console.warn('sc17 variation id:'+sc17); 995 996 //m4 = pc3d_p; 997 /*if (sc17){ 998 get_opt_price(sc17, pc3d._arr_swatch_printing); 999 m4 = pc3d_p; 1000 }*/ 1001 1002 data_EXT.sm17 = sm17; 1003 data_EXT.sv17 = sv17; 1004 data_EXT.sr17 = sr17; 1005 data_EXT.ss17 = ss17; 1006 data_EXT.sc17 = sc17; 1007 1008 } 1009 1010 if (pc3d._attr_id_thickness !=0){ 1011 LOG && console.warn('_attr_id_thickness:'+ pc3d._attr_id_thickness); 1012 1013 get_opt_pc3d(pc3d._attr_id_thickness, pc3d._arr_swatch_thickness, pc3d._child_id); 1014 1015 sm18 = pc3d._attr_id_thickness; 1016 sv18 = pc3d_v; 1017 sr18 = pc3d_r; 1018 ss18 = pc3d_s; 1019 sc18 = pc3d_c; 1020 //sc14 = jQuery("input[name=variation_id]").val(); 1021 LOG && console.warn('sc18 variation id:'+sc18); 1022
1023 //m4 = pc3d_p; 1024 /*if (sc18){ 1025 get_opt_price(sc18, pc3d._arr_swatch_thickness); 1026 m4 = pc3d_p; 1027 }*/ 1028 1029 data_EXT.sm18 = sm18; 1030 data_EXT.sv18 = sv18; 1031 data_EXT.sr18 = sr18; 1032 data_EXT.ss18 = ss18; 1033 data_EXT.sc18 = sc18; 1034 1035 } 1036 1037 if (pc3d._attr_id_roll !=0){ 1038 LOG && console.warn('_attr_id_roll:'+ pc3d._attr_id_roll); 1039 1040 get_opt_pc3d(pc3d._attr_id_roll, pc3d._arr_swatch_roll, pc3d._child_id); 1041 1042 sm19 = pc3d._attr_id_roll; 1043 sv19 = pc3d_v; 1044 sr19 = pc3d_r; 1045 ss19 = pc3d_s; 1046 sc19 = pc3d_c; 1047 1048 LOG && console.warn('sc19 variation id:'+sc19); 1049 1050 //m4 = pc3d_p; 1051 /*if (sc19){ 1052 get_opt_price(sc19, pc3d._arr_swatch_roll); 1053 m4 = pc3d_p; 1054 }*/ 1055 1056 data_EXT.sm19 = sm19; 1057 data_EXT.sv19 = sv19; 1058 data_EXT.sr19 = sr19; 1059 data_EXT.ss19 = ss19; 1060 data_EXT.sc19 = sc19; 1061 1062 } 1063 1064 if (pc3d._attr_id_designs !=0){ 1065 LOG && console.warn('_attr_id_designs:'+ pc3d._attr_id_designs); 1066 1067 get_opt_pc3d(pc3d._attr_id_designs, pc3d._arr_swatch_designs, pc3d._child_id); 1068 1069 sm20 = pc3d._attr_id_designs; 1070 sv20 = pc3d_v; 1071 sr20 = pc3d_r; 1072 ss20 = pc3d_s; 1073 sc20 = pc3d_c; 1074 1075 LOG && console.warn('sc20 variation id:'+sc20); 1076 1077 //m4 = pc3d_p; 1078 /*if (sc20){ 1079 get_opt_price(sc20, pc3d._arr_swatch_designs); 1080 m4 = pc3d_p; 1081 }*/ 1082 1083 data_EXT.sm20 = sm20; 1084 data_EXT.sv20 = sv20; 1085 data_EXT.sr20 = sr20; 1086 data_EXT.ss20 = ss20; 1087 data_EXT.sc20 = sc20; 1088 1089 v3 = sr20; //md5 design 1090 1091 } 1092 1093 if (pc3d._attr_id_mouldings !=0){ 1094 LOG && console.warn('_attr_id_mouldings:'+ pc3d._attr_id_mouldings); 1095 1096 get_opt_pc3d(pc3d._attr_id_mouldings, pc3d._arr_swatch_mouldings, pc3d._child_id); 1097 1098 sm21 = pc3d._attr_id_mouldings; 1099 sv21 = pc3d_v; 1100 sr21 = pc3d_r; 1101 ss21 = pc3d_s; 1102 sc21 = pc3d_c; 1103 1104 LOG && console.warn('sc21 variation id:'+sc21); 1105 1106 //m4 = pc3d_p; 1107 /*if (sc21){ 1108 get_opt_price(sc21, pc3d._arr_swatch_mouldings); 1109 m4 = pc3d_p; 1110 }*/ 1111 1112 data_EXT.sm21 = sm21; 1113 data_EXT.sv21 = sv21; 1114 data_EXT.sr21 = sr21; 1115 data_EXT.ss21 = ss21; 1116 data_EXT.sc21 = sc21; 1117 1118 } 1119 1120 if (pc3d._attr_id_mats !=0){ 1121 LOG && console.warn('_attr_id_mats:'+ pc3d._attr_id_mats); 1122 1123 get_opt_pc3d(pc3d._attr_id_mats, pc3d._arr_swatch_mats, pc3d._child_id); 1124 1125 sm22 = pc3d._attr_id_mats; 1126 sv22 = pc3d_v; 1127 sr22 = pc3d_r; 1128 ss22 = pc3d_s; 1129 sc22 = pc3d_c; 1130 1131 LOG && console.warn('sc22 variation id:'+sc22); 1132 1133 //m4 = pc3d_p; 1134 /*if (sc22){ 1135 get_opt_price(sc22, pc3d._arr_swatch_mats); 1136 m4 = pc3d_p; 1137 }*/ 1138 1139 data_EXT.sm22 = sm22; 1140 data_EXT.sv22 = sv22; 1141 data_EXT.sr22 = sr22; 1142 data_EXT.ss22 = ss22; 1143 data_EXT.sc22 = sc22; 1144 1145 } 1146 1147 if (pc3d._attr_id_glasses !=0){ 1148 LOG && console.warn('_attr_id_glasses:'+ pc3d._attr_id_glasses); 1149 1150 get_opt_pc3d(pc3d._attr_id_glasses, pc3d._arr_swatch_glasses, pc3d._child_id); 1151 1152 sm23 = pc3d._attr_id_glasses; 1153 sv23 = pc3d_v; 1154 sr23 = pc3d_r; 1155 ss23 = pc3d_s; 1156 sc23 = pc3d_c; 1157 1158 LOG && console.warn('sc23 variation id:'+sc23); 1159 1160 //m4 = pc3d_p; 1161 /*if (sc23){ 1162 get_opt_price(sc23, pc3d._arr_swatch_glasses); 1163 m4 = pc3d_p; 1164 }*/ 1165 1166 data_EXT.sm23 = sm23; 1167 data_EXT.sv23 = sv23; 1168 data_EXT.sr23 = sr23; 1169 data_EXT.ss23 = ss23; 1170 data_EXT.sc23 = sc23; 1171 1172 } 1173 1174 if (pc3d._attr_id_tp_mod !=0){ 1175 LOG && console.warn('_attr_id_tp_mod:'+ pc3d._attr_id_tp_mod); 1176 1177 get_opt_pc3d(pc3d._attr_id_tp_mod, pc3d._arr_swatch_tp_mod, pc3d._child_id); 1178 1179 sm24 = pc3d._attr_id_tp_mod; 1180 sv24 = pc3d_v; 1181 sr24 = pc3d_r; 1182 ss24 = pc3d_s; 1183 sc24 = pc3d_c; 1184 1185 LOG && console.warn('sc24 variation id:'+sc24); 1186 1187 /*if (sc24){ 1188 get_opt_price(sc24, pc3d._arr_swatch_tp_mod); 1189 m4 = pc3d_p; 1190 }*/ 1191 1192 data_EXT.sm24 = sm24; 1193 data_EXT.sv24 = sv24; 1194 data_EXT.sr24 = sr24; 1195 data_EXT.ss24 = ss24; 1196 data_EXT.sc24 = sc24; 1197 1198 } 1199 1200 if (pc3d._attr_id_shape !=0){ 1201 LOG && console.warn('_attr_id_shape:'+ pc3d._attr_id_shape); 1202 1203 get_opt_pc3d(pc3d._attr_id_shape, pc3d._arr_swatch_shape, pc3d._child_id); 1204 1205 sm25 = pc3d._attr_id_shape; 1206 sv25 = pc3d_v; 1207 sr25 = pc3d_r; 1208 ss25 = pc3d_s; 1209 sc25 = pc3d_c; 1210 1211 LOG && console.warn('sc25 variation id:'+sc25); 1212 1213 /*if (sc25){ 1214 get_opt_price(sc25, pc3d._arr_swatch_shape); 1215 m4 = pc3d_p; 1216 }*/ 1217 1218 data_EXT.sm25 = sm25; 1219 data_EXT.sv25 = sv25; 1220 data_EXT.sr25 = sr25; 1221 data_EXT.ss25 = ss25; 1222 data_EXT.sc25 = sc25; 1223 1224 } 1225 1226 if (pc3d._attr_id_units !=0){ 1227 LOG && console.warn('_attr_id_units:'+ pc3d._attr_id_units); 1228 1229 get_opt_pc3d(pc3d._attr_id_units, pc3d._arr_swatch_units, pc3d._child_id); 1230 1231 sm26 = pc3d._attr_id_units; 1232 sv26 = pc3d_v; 1233 sr26 = pc3d_r; 1234 ss26 = pc3d_s; 1235 sc26 = pc3d_c; 1236 1237 LOG && console.warn('sc26 variation id:'+sc26); 1238 1239 /*if (sc26){ 1240 get_opt_price(sc26, pc3d._arr_swatch_units); 1241 m4 = pc3d_p; 1242 }*/ 1243 1244 data_EXT.sm26 = sm26; 1245 data_EXT.sv26 = sv26; 1246 data_EXT.sr26 = sr26; 1247 data_EXT.ss26 = ss26; 1248 data_EXT.sc26 = sc26; 1249 1250 } 1251 1252 if (pc3d._attr_id_aux_1 !=0){ 1253 LOG && console.warn('_attr_id_aux_1:'+ pc3d._attr_id_aux_1); 1254 1255 get_opt_pc3d(pc3d._attr_id_aux_1, pc3d._arr_swatch_aux_1, pc3d._child_id); 1256 1257 sm27 = pc3d._attr_id_aux_1; 1258 sv27 = pc3d_v; 1259 sr27 = pc3d_r; 1260 ss27 = pc3d_s; 1261 sc27 = pc3d_c; 1262 1263 LOG && console.warn('sc27 variation id:'+sc27); 1264 1265 /*if (sc27){ 1266 get_opt_price(sc27, pc3d._arr_swatch_aux_1); 1267 m4 = pc3d_p; 1268 }*/ 1269 1270 data_EXT.sm27 = sm27; 1271 data_EXT.sv27 = sv27; 1272 data_EXT.sr27 = sr27; 1273 data_EXT.ss27 = ss27; 1274 data_EXT.sc27 = sc27; 1275 1276 } 1277 1278 if (pc3d._attr_id_aux_2 !=0){ 1279 LOG && console.warn('_attr_id_aux_2:'+ pc3d._attr_id_aux_2); 1280 1281 get_opt_pc3d(pc3d._attr_id_aux_2, pc3d._arr_swatch_aux_2, pc3d._child_id); 1282 1283 sm28 = pc3d._attr_id_aux_2; 1284 sv28 = pc3d_v; 1285 sr28 = pc3d_r; 1286 ss28 = pc3d_s; 1287 sc28 = pc3d_c; 1288 1289 LOG && console.warn('sc28 variation id:'+sc28); 1290 1291 /*if (sc28){ 1292 get_opt_price(sc28, pc3d._arr_swatch_aux_2); 1293 m4 = pc3d_p; 1294 }*/ 1295 1296 data_EXT.sm28 = sm28; 1297 data_EXT.sv28 = sv28; 1298 data_EXT.sr28 = sr28; 1299 data_EXT.ss28 = ss28; 1300 data_EXT.sc28 = sc28; 1301 1302 } 1303 1304 if (pc3d._attr_id_aux_3 !=0){ 1305 LOG && console.warn('_attr_id_aux_3:'+ pc3d._attr_id_aux_3); 1306 1307 get_opt_pc3d(pc3d._attr_id_aux_3, pc3d._arr_swatch_aux_3, pc3d._child_id); 1308 1309 sm29 = pc3d._attr_id_aux_3; 1310 sv29 = pc3d_v; 1311 sr29 = pc3d_r; 1312 ss29 = pc3d_s; 1313 sc29 = pc3d_c; 1314 1315 LOG && console.warn('sc29 variation id:'+sc29); 1316 1317 /*if (sc29){ 1318 get_opt_price(sc29, pc3d._arr_swatch_aux_3); 1319 m4 = pc3d_p; 1320 }*/ 1321 1322 data_EXT.sm29 = sm29; 1323 data_EXT.sv29 = sv29; 1324 data_EXT.sr29 = sr29; 1325 data_EXT.ss29 = ss29; 1326 data_EXT.sc29 = sc29; 1327 1328 } 1329 1330}; 1331 1332function start_pc3d(_acc_type, _acc_mode, _md5_pro, _json_data_pc3d, _main_c_, _frm_c_, _form_c_, _data_c_, _div_c_) { 1333 1334 _main_c = _main_c_ || "main_pc3d"; 1335 _frm_c = _frm_c_ || "frm_pc3d"; 1336 _form_c = _form_c_ || "form_pc3d"; 1337 _data_c = _data_c_ || "data_pc3d"; 1338 _div_c = _div_c_ || "div_pc3d"; 1339 1340 LOG && console.warn('FRM:'+_frm_c); 1341 LOG && console.warn('FORM:'+_form_c); 1342 LOG && console.warn('DATA:'+_data_c); 1343 LOG && console.warn('DIV:'+_div_c); 1344 1345 var pc3d = _json_data_pc3d; 1346 1347 LOG && console.dir(pc3d); 1348 1349 /*var cookie_pc3d = getCookie('woo_vad_pc3d'); 1350 console.warn("PC3D COOKIE: " + cookie_pc3d);*/ 1351 1352 /*if (_div_c != "div_pc3d_gallery"){ 1353 check_mobile(); 1354 }else{ 1355 is_mobile = false;
1356 }*/ 1357 1358 check_mobile(); 1359 1360 function process_pc3d(){ 1361 1362 if (_div_c != "div_pc3d_gallery"){ 1363 window.scrollTo(0,0); 1364 } 1365 1366 _maximizar_0 = pc3d._maximize; 1367 _maximizar_1 = pc3d._maximize; 1368 1369 if (pc3d._id_cat != 0 && pc3d._pc3d_edit_cart==false && pc3d._pc3d_shared==false && pc3d._pc3d_reorder==false){ 1370 v1 = 4; 1371 }else{ 1372 v1 = _acc_type; 1373 } 1374 1375 1376 if (pc3d._id_cat != 0 && (pc3d._pc3d_edit_cart==true || pc3d._pc3d_shared==true || pc3d._pc3d_reorder==true)){ 1377 pc3d._info_cart = VADPC3DAjax.info_cart; 1378 } 1379 1380 v33 = 0; 1381 1382 if (_acc_type == 1) {//normal 1383 v2 = pc3d._prod_sku; 1384 v3 = pc3d._md5_pro; 1385 v4 = pc3d._store_url + pc3d._cart_url;//'photocenter3d';// URL ADD 1386 //v5 = pc3d._store_url + 'es/carrito?action=show';//URL CART 1387 v5 = pc3d._store_cart; 1388 v6 = pc3d._product_url; 1389 _maximizar = _maximizar_0; 1390 1391 } else if (_acc_type == 2) {//edit 1392 if (_acc_mode == 1) {//edit cart 1393 v2 = pc3d._prod_sku; 1394 v3 = _md5_pro; 1395 v4 = pc3d._store_url + pc3d._cart_url;// URL ADD 1396 //v5 = pc3d._store_url + 'es/carrito?action=show';//URL CART 1397 v5 = pc3d._store_cart; 1398 v6 = pc3d._product_url; 1399 _maximizar = _maximizar_0; 1400 1401 } else if(_acc_mode == 2){//edit wishlist 1402 v2 = pc3d._prod_sku; 1403 v3 = _md5_pro; 1404 v4 = pc3d._store_url + pc3d._wishlist_url;//'/my-lists/'; 1405 v5 = pc3d._store_url + pc3d._wishlist_url;//'/my-lists/'; 1406 v6 = pc3d._product_url; 1407 _maximizar = _maximizar_0; 1408 } 1409 } else if (_acc_type == 3) {//shared 1410 v2 = pc3d._prod_sku; 1411 v3 = _md5_pro; 1412 v4 = pc3d._store_url + pc3d._cart_url;// URL ADD 1413 //v5 = pc3d._store_url + 'es/carrito?action=show';//URL CART 1414 v5 = pc3d._store_cart; 1415 v6 = pc3d._product_url; 1416 1417 _maximizar = _maximizar_1; 1418 1419 } else if (_acc_type == 7) {//reorder 1420 v2 = pc3d._prod_sku; 1421 v3 = _md5_pro; 1422 v4 = pc3d._store_url + pc3d._cart_url;// URL ADD 1423 v5 = pc3d._reorder_url;//pc3d._store_url + 'es/carrito?action=show';//URL CART 1424 v6 = pc3d._reorder_url; 1425 1426 _maximizar = _maximizar_0; 1427 } 1428 1429 var url_store = pc3d._store_url; 1430 var url_apicom = pc3d._store_url; 1431 if (pc3d._is_app == 1){ 1432 //v4 = 'https://app.reskyt.com/webimpactotest?customapp=3&url=' + encodeURI(pc3d._store_url + pc3d._cart_url);// URL ADD 1433 v4 = VADPC3DAjax.app_url + encodeURIComponent(pc3d._store_url + pc3d._cart_url);// URL ADD 1434 url_store = VADPC3DAjax.app_url + encodeURIComponent(pc3d._store_url); 1435 } 1436 1437 if( pc3d._wlid > 0){//modo wishlist 1438 1439 v4 = pc3d._store_url + pc3d._wishlist_url;//'/my-lists/'; 1440 v5 = pc3d._store_url + pc3d._wishlist_url;//'/my-lists/'; 1441 1442 } 1443 1444 m1 = pc3d._prod_id; 1445 m2 = pc3d._prod_name; 1446 if (pc3d._qty==0){m3 = jQuery("input[name=qty]").val();} else {m3 = pc3d._qty;}; 1447 m31 = pc3d._hide_qty; 1448 m4 = pc3d._prod_price; 1449 m41 = pc3d._tax_percent; 1450 m5 = pc3d._option_id_info; 1451 m7 = pc3d._formkey; 1452 m7e = md5_upses; 1453 m8 = _acc_mode; 1454 m9 = '';//pc3d._option_id_md5; 1455 m10 = '';//pc3d._option_id_ima; 1456 rj1 = pc3d._option_id_pc3d; 1457 1458 1459 v22=''; 1460 1461 _data_iframe=''; 1462 var data_EXT = {}; 1463 1464 if (pc3d._is_config == 1){ 1465 get_configurable_product_options(pc3d, data_EXT); 1466 } 1467 1468 data_EXT.v0 = 4; 1469 data_EXT.v1 = v1; 1470 data_EXT.v2 = v2; 1471 data_EXT.v22 = v22; 1472 data_EXT.v23 = pc3d._is_pod; 1473 data_EXT.v3 = v3; 1474 data_EXT.v33 = v33; 1475 data_EXT.v4 = v4; 1476 data_EXT.v5 = v5; 1477 data_EXT.v6 = v6; 1478 data_EXT.v7 = pc3d._v7;//1-GET, 2-POST, 3-TEST 1479 data_EXT.v10 = pc3d._cart_images; 1480 data_EXT.m1 = m1; 1481 data_EXT.m2 = m2; 1482 data_EXT.m3 = m3; 1483 data_EXT.m31 = m31; 1484 data_EXT.m4 = m4; 1485 data_EXT.m41 = m41; 1486 data_EXT.m43 = pc3d._block_price; 1487 data_EXT.m5 = m5; 1488 data_EXT.m7 = m7; 1489 data_EXT.m7e = m7e; 1490 data_EXT.m8 = m8; 1491 data_EXT.m9 = m9; 1492 data_EXT.m10 = m10; 1493 data_EXT.rj1 = rj1; 1494 1495 data_EXT.c1 = pc3d._margin; 1496 data_EXT.c2 = encodeURIComponent(pc3d._shadow); 1497 data_EXT.c3 = encodeURIComponent(_maximizar); 1498 data_EXT.c5 = pc3d._background_lite; 1499 data_EXT.c6 = pc3d._border_color_viewer; 1500 data_EXT.d1 = pc3d._idi; 1501 data_EXT.d2 = pc3d._div; 1502 data_EXT.e1 = pc3d._e1; 1503 data_EXT.e2 = pc3d._e2; 1504 data_EXT.e3 = pc3d._e3; 1505 data_EXT.e4 = pc3d._e4; 1506 data_EXT.e5 = pc3d._e5; 1507 data_EXT.v44 = pc3d._cart_id; 1508 data_EXT.gpub = pc3d._pc3d_pub; 1509 data_EXT.ggru = pc3d._pc3d_gru; 1510 data_EXT.gtxt = pc3d._pc3d_txt; 1511 data_EXT.c4 = 1; 1512 data_EXT.v24 = pc3d._id_cat; 1513 data_EXT.v25 = pc3d._tipo_mod; 1514 data_EXT.wlid = pc3d._wlid; 1515 1516 data_EXT.v26 = '';//ean 1517 data_EXT.v27 = 0; 1518 data_EXT.v271 = 0; 1519 data_EXT.v28 = 0; 1520 data_EXT.v29 = pc3d._borders; //0= with borders, 1 = without borders 1521 data_EXT.cats = ''; 1522 data_EXT.extras = '';
1523 data_EXT.cross = ''; 1524 1525 data_EXT.a1 = VADPC3DAjax.api_host; 1526 data_EXT.a2 = VADPC3DAjax.api_post; 1527 data_EXT.a3 = VADPC3DAjax.api_get; 1528 1529 data_EXT.e10 = 1; 1530 data_EXT.e11 = 1; 1531 data_EXT.e12 = 0; 1532 data_EXT.e13 = url_store;//url close 1533 data_EXT.e25 = url_apicom;//url close 1534 data_EXT.e19 = 1; 1535 data_EXT.e20 = 0; 1536 data_EXT.e21 = 0; 1537 data_EXT.e22 = 0; 1538 1539 data_EXT.e14 = 0;//modo_ven 1540 data_EXT.u = pc3d._u; 1541 data_EXT.royalty_id = 0; 1542 data_EXT.group_id = 0; 1543 //data_EXT.views = 1;//pc3d._views; 1544 1545 data_EXT.enabled_pm = 0; 1546 data_EXT.default_pm = 0; 1547 data_EXT.info_cart = pc3d._info_cart; 1548 data_EXT.is_app = VADPC3DAjax.is_app; 1549 1550 data_EXT.c_view = pc3d._views; 1551 data_EXT.id_view = id_vis_active; 1552 1553 data_EXT.qty_id = pc3d._qty_id; 1554 1555 data_EXT.qty_min = 1; 1556 data_EXT.qty_step = 1; 1557 1558 if (Md5Lite !='') { 1559 data_EXT.v1 = 2; 1560 data_EXT.v3 = Md5Lite; 1561 } 1562 1563 if (jQuery('#pc3d_editor_framing').length > 0){ 1564 data_EXT.e3 = 1; 1565 data_EXT.e5 = 1; 1566 } 1567 1568 var EXT = {}; 1569 EXT = Pc3dGetAllLayers(); 1570 1571 if (typeof get_framing_options == 'function') { 1572 data_EXT.v27 = jQuery("input[name=type_frm]").val(); 1573 var aux_fra = get_framing_options(); 1574 if (aux_fra.length >0) EXT.fra = aux_fra; 1575 } 1576 1577 var aux_txt = get_text_options(); 1578 if (aux_txt.length >0) EXT.txt = aux_txt; 1579 1580 //diseños lite 1581 var id_dis = jQuery('.design-selected').attr("data-dis"); 1582 id_dis = id_dis ? id_dis : 0; 1583 data_EXT.v31 = id_dis; 1584 1585 1586 var SKN = {}; 1587 1588 if (parseInt(pc3d._id_skin)>0){ 1589 SKN.id = parseInt(pc3d._id_skin); 1590 } 1591 if (pc3d._json_skin != ''){ 1592 SKN.cfg = pc3d._json_skin; 1593 } 1594 1595 var POD = {}; 1596 if (typeof get_pod_options == 'function') { 1597 var aux_pod = get_pod_options(); 1598 if (aux_pod) { 1599 POD = aux_pod; 1600 } 1601 } 1602 1603 var SRV = {}; 1604 if (typeof get_srv_options == 'function') { 1605 var aux_srv = get_srv_options(); 1606 if (aux_srv) { 1607 SRV = aux_srv; 1608 } 1609 } 1610 1611 var CFG = {}; 1612 CFG = pc3d._cfg; 1613 delete pc3d._cfg; 1614 1615 var only_gallery = jQuery('#pc3d_only_gallery').val(); 1616 if (only_gallery == 'yes'){ 1617 if (Md5Lite =='') { 1618 if (CFG.GAL.ima != ''){ 1619 1620 if (!(pc3d._default_ima != 0 && pc3d._default_ima != CFG.GAL.ima)){ 1621 if (!jQuery('.gallery_slide[data-art='+ CFG.GAL.ima +']').hasClass('gallery-selected')){ 1622 jQuery('.gallery_slide[data-art='+ CFG.GAL.ima +']').click(); 1623 } 1624 } 1625 1626 jQuery('.gallery_slide').removeClass('gallery-preselected'); 1627 CFG.GAL.ima = ''; 1628 } 1629 } 1630 } 1631 1632 var MOD = {}; 1633 MOD = pc3d_tpmod_data; 1634 1635 var COM_COL = {}; 1636 if (jQuery('.pc3d-swatch-color-span.selected').length > 0){ 1637 COM_COL = jQuery('.pc3d-swatch-color-span.selected').data(); 1638 } 1639 1640 _data_iframe = "{\"vars\":" + JSON.stringify(data_EXT) 1641 + ",\"ext\":" + JSON.stringify(EXT) 1642 + ",\"skn\":" + JSON.stringify(SKN) 1643 + ",\"pod\":" + JSON.stringify(POD) 1644 + ",\"cfg\":" + JSON.stringify(CFG) 1645 + ",\"com\":" + JSON.stringify(COM_COL) 1646 + ",\"srv\":" + JSON.stringify(SRV) 1647 + ",\"mod\":" + JSON.stringify(MOD) 1648 + ",\"sa11\":" + decodeURIComponent(pc3d._arr_swatch_mat) 1649 + ",\"sa12\":" + decodeURIComponent(pc3d._arr_swatch_col) 1650 + ",\"sa13\":" + decodeURIComponent(pc3d._arr_swatch_size) 1651 + ",\"sa14\":" + decodeURIComponent(pc3d._arr_swatch_view) 1652 + ",\"sa15\":" + decodeURIComponent(pc3d._arr_swatch_product) 1653 + ",\"sa16\":" + decodeURIComponent(pc3d._arr_swatch_profiles) 1654 + ",\"sa17\":" + decodeURIComponent(pc3d._arr_swatch_printing) 1655 + ",\"sa18\":" + decodeURIComponent(pc3d._arr_swatch_thickness) 1656 + ",\"sa19\":" + decodeURIComponent(pc3d._arr_swatch_roll) 1657 + ",\"sa20\":" + decodeURIComponent(pc3d._arr_swatch_designs) 1658 + ",\"sa21\":" + decodeURIComponent(pc3d._arr_swatch_mouldings) 1659 + ",\"sa22\":" + decodeURIComponent(pc3d._arr_swatch_mats) 1660 + ",\"sa23\":" + decodeURIComponent(pc3d._arr_swatch_glasses) 1661 + ",\"sa24\":" + decodeURIComponent(pc3d._arr_swatch_tp_mod) 1662 + ",\"sa25\":" + decodeURIComponent(pc3d._arr_swatch_shape) 1663 + ",\"sa26\":" + decodeURIComponent(pc3d._arr_swatch_units) 1664 + ",\"sa27\":" + decodeURIComponent(pc3d._arr_swatch_aux_1) 1665 + ",\"sa28\":" + decodeURIComponent(pc3d._arr_swatch_aux_2) 1666 + ",\"sa29\":" + decodeURIComponent(pc3d._arr_swatch_aux_3) 1667 1668 + "}"; 1669 1670 LOG && console.warn("DATA IFRAME: " + _data_iframe); 1671 1672 _src = pc3d._editor_url; 1673
1674 LOG && console.warn("SRC:" + _src); 1675 1676 if (is_mobile==false){ 1677 if (v1 != 1) window.onload = function (e) { resize_pc3d(_main_c, _frm_c, _div_c); }; 1678 }; 1679 1680 load_frame_pc3d(_src, encodeURIComponent(_data_iframe), pc3d._background, pc3d._landscape_block,_main_c, _frm_c, _form_c, _data_c, _div_c); 1681 1682 } 1683 1684 1685 1686var _status; 1687var timeout ; 1688 1689 1690jQuery.ajax({ 1691cache: 'false', 1692dataType: 'text', 1693url: pc3d._editor_url + '/code/control_a/controla.ashx?index=99', 1694success: function (ret) { 1695 1696if(ret=='OK'){ 1697 _status = 1; 1698 process_pc3d(); 1699 1700}else{ 1701 _status = 0; 1702 alert('We are under maintenance...'); 1703 } 1704}, 1705 1706error: function (ret) { 1707 _status = 0; 1708 alert('We are under maintenance...'); 1709 1710 }, 1711 1712}); 1713 1714} 1715 1716/*var customization = { 1717 init: function () { 1718 customization.displayData(); 1719 }, 1720 displayData: function () { 1721 if (customization.hasData()) { 1722 jQuery('.pc3d_customization').each(function () { 1723 var data = jQuery(this); 1724 var modal = data.closest('.customization-modal'); 1725 var anchor = modal.prev().hide(); 1726 data.insertBefore(anchor); 1727 }); 1728 } 1729 }, 1730 hasData: function () { 1731 return jQuery('.pc3d_customization').size() > 0; 1732 }, 1733 1734}; 1735 1736jQuery(customization.init);*/
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.