1"use strict"; 2 3function dzsajx_get_query_arg(purl, key){ 4 //console.info(purl); 5 if(purl.indexOf(key+'=')>-1){ 6 //faconsole.log('testtt'); 7 var regexS = "[?&]"+key + "(.+?)(?=&|$)"; 8 var regex = new RegExp(regexS); 9 var regtest = regex.exec(purl); 10 11 12 // console.info(regex, regtest); 13 if(regtest != null){ 14 //var splitterS = regtest; 15 16 17 if(regtest[1]){ 18 var aux = regtest[1].replace( /=/g, ''); 19 return aux; 20 }else{ 21 return ''; 22 } 23 24 25 } 26 //$('.zoombox').eq 27 } 28} 29 30 31var readyList = []; 32var loadList = []; 33// var $ = jQuery.noConflict(); 34(function(){ 35 36// Store a reference to the original ready method. 37// var originalReadyMethod = jQuery.fn.ready; 38// 39// // Override jQuery.fn.ready 40// jQuery.fn.ready = function(){ 41// 42// try{ 43// if(arguments.length && arguments.length > 0 && typeof arguments[0] === 'function') { 44// readyList.push(arguments[0]); 45// } 46// 47// // Execute the original method. 48// originalReadyMethod.apply( this, arguments ); 49// 50// }catch(err){ 51// console.info(err); 52// } 53// // super(this,argument); 54// }; 55 56 57 58 // console.info(jQuery('body').hasClass('dzsajx-enable-reinit')); 59 // console.info(jQuery('body').attr('class')); 60 61 62 var scripts = document.getElementsByTagName( 'script' ); 63 var thisScriptTag = scripts[ scripts.length - 1 ]; 64 65 // console.info(thisScriptTag.src); 66 67
68 // -- let's see if scripts_reinit_document_ready is set to ON 69 if(String(thisScriptTag.src).indexOf('9.012')){ 70 var originalReady = jQuery.fn.ready; 71 var originalLoad = jQuery.fn.load; 72 jQuery.fn.extend({ 73 ready: function() { 74 if(arguments.length && arguments.length > 0 && typeof arguments[0] === 'function') { 75 readyList.push(arguments[0]); 76 } 77 // console.log('custom ready'); 78 return originalReady.apply(this, arguments); 79 } 80 ,load: function() { 81 if(arguments.length && arguments.length > 0 && typeof arguments[0] === 'function') { 82 loadList.push(arguments[0]); 83 } 84 // console.log('custom load', arguments[0]); 85 return originalLoad.apply(this, arguments); 86 } 87 }); 88 89// Used to trigger all ready events 90 jQuery.triggerReady = function() { 91 // window.$ = jQuery; 92 // window.$ = jQuery.noConflict(); 93 94 // console.info(readyList); 95 jQuery(document).add('*').off(); 96 97 98 jQuery(readyList).each(function(){this(jQuery);}); 99 }; 100 jQuery.triggerLoad = function() { 101 // window.$ = jQuery; 102 // window.$ = jQuery.noConflict(); 103 104 jQuery(loadList).each(function(){ 105 // console.info(this); 106 this(); 107 }); 108 }; 109 110 setTimeout(function(){ 111 // console.info(readyList, loadList); 112 },2000); 113 setTimeout(function(){ 114 // jQuery.triggerReady(); 115 },4000); 116 } 117 118 119})(); 120 121jQuery(document).ready(function($){ 122 123 // $.getReadyList = function() { 124 // if(this.readyList != null) { this.myreadylist = [].concat(this.readyList); } 125 // return this.myreadylist; 126 // }; 127 128 // setTimeout(function(){ 129 // console.info('jquery ready', $.getReadyList()); 130 // },2000); 131 // $ = jQuery; 132 133 134 // -- ajax vars 135 var new_page_html = ''; 136 var newclass_body = ''; 137 var currclass_body = ''; 138 139 var scripts_loaded_arr = []; 140 var scripts_tobeloaded = []; 141 var stylesheets_tobeloaded = []; 142 var stylesheets_tobeadded = []; 143 var scripts_tobeexecuted = []; 144 var pages_caches = []; 145 146 var state_curr_menu_items_links = []; 147 var extra_items = []; 148 var extra_items_tobeadded = []; 149 150 var busy_main_transition = false 151 ,new_page_not_loaded_yet = false // -- we use this to force load a page even if all scripts are not loaded 152 ,page_change_ind = 0 153 ,content_wrapper_transitioned_out = false 154 ,refresh_menu = false // -- we will need to refresh menu object if it is included in the content element 155 ; 156 157 var ___response = null; 158 159 160 var windowhref = '' 161 ,ajax_site_url = '' 162 ,curr_html = window.location.href 163 ,newtitle = '' 164 ,newbodyclass = '' 165 ,curr_html_with_clear_cache = false 166 ,history_first_pushed_state = false // -- check if the first history state has been pushed so we can back to a outer page before the first one 167 ,has_custom_outside_content_1= false // -- import custom content 168 ; 169 170 var _theActualNav = null 171 ,_content = null 172 ,_contentTransitioning = null 173 ,_contentContainer = null 174 ,_dzsajx_styles_con = null 175 ,_dzsajx_scripts_tbe_con = null 176 ,_dzsajx_caches_con = null 177 ,_preloader = null 178 ,content_selector = 'body' 179 ,old_href = '' 180 ,old_class_body = '' 181 ,scripts_execute_after_ajax_call = 'off' 182 ; 183 184 185 var ceva = 'ceva' 186 ,_html_for_classes = $('html').eq(0) 187 ,_body = $('body').eq(0) 188 189 // -- ajax vars END 190 191 192 if(window.dzsajx_settings) { 193 194 195 if (dzsajx_settings.site_url) { 196 197 ajax_site_url = dzsajx_settings.site_url; 198 } 199 if (dzsajx_settings.content_container_selector) { 200 201 _content = $(dzsajx_settings.content_container_selector).eq(0); 202 content_selector = dzsajx_settings.content_container_selector; 203 } 204 if (dzsajx_settings.menu_selector) { 205 206 _theActualNav = $(dzsajx_settings.menu_selector); 207 208 209 if(_content.find(dzsajx_settings.menu_selector).length>0){ 210 refresh_menu=true; 211 } 212 213 214 if (dzsajx_settings.menu_move_on_top_of_content && dzsajx_settings.menu_move_on_top_of_content=='on') { 215 216 if(_content){ 217 218 _content.before(_theActualNav); 219 } 220 } 221 } 222 if (dzsajx_settings.transition) { 223 224 225 _html_for_classes.addClass('dzsajx-transition-'+dzsajx_settings.transition); 226 _html_for_classes.addClass('dzsajx-preloader-'+dzsajx_settings.preloader); 227 } 228 if (dzsajx_settings.scripts_execute_after_ajax_call) { 229 230 231 scripts_execute_after_ajax_call = dzsajx_settings.scripts_execute_after_ajax_call; 232 } 233 234 235 236 237 if(dzsajx_settings.script_call_on_ready){ 238 try{ 239 eval(dzsajx_settings.script_call_on_ready) 240 }catch(err){ 241 console.info('eval ready error - ',err, err.stack); 242 } 243 } 244 245 246 } 247 248 // console.info(_theActualNav); 249 250 if(_content==null){ 251 _content = $('body'); 252 } 253 254 _content.addClass('dzsajx-content'); 255 // console.info(_content); 256 257 if(window.dzsajx_settings) { 258 if (dzsajx_settings.preloader=='bar' || dzsajx_settings.preloader=='bars' || dzsajx_settings.preloader=='custom') { 259 260 var aux ='<div class="dzsajx-preloader dzsajx-preloader-'+dzsajx_settings.preloader+'">'; 261 262 if(dzsajx_settings.preloader=='bar'){ 263 aux+='<div class="the-bar"></div>' 264 } 265 if(dzsajx_settings.preloader=='bars'){ 266 aux+='<div id="loading-center-absolute"> <div class="object"></div> <div class="object"></div> <div class="object"></div> <div class="object"></div> <div class="object"></div> <div class="object"></div> <div class="object"></div> <div class="object"></div> <div class="object"></div> <div class="object"></div> </div>' 267 } 268 if(dzsajx_settings.preloader=='custom'){ 269 aux+='<div id="loading-center-absolute"> '+dzsajx_settings.custom_preloader_html+' </div>' 270 } 271 272 273 aux+='</div>'; 274 if(_content.prev().hasClass('dzsajx-preloader')==false){ 275 276 _content.before(aux); 277 } 278 _preloader = $('.dzsajx-preloader').eq(0); 279 } 280 } 281 282 283 // console.info(ajax_site_url); 284 285 _body.append('<div class="dzsajx-styles-con"></div>'); 286 287 _dzsajx_styles_con = _body.children('.dzsajx-styles-con'); 288 289 if(scripts_execute_after_ajax_call=='on'){ 290 291 _body.append('<div class="dzsajx-scripts-con"></div>'); 292
293 _dzsajx_scripts_tbe_con = _body.children('.dzsajx-scripts-con'); 294 } 295 296 if(dzsajx_settings.cache_pages=='on'){ 297 298 _body.append('<div class="dzsajx-caches-con"></div>'); 299 300 _dzsajx_caches_con = _body.children('.dzsajx-caches-con'); 301 } 302 303 304 var selecta = 'a:not(.no-ajaxer,.bp-secondary-action,.bp-primary-action'; 305 306 307 if(dzsajx_settings.classes_to_ignore){ 308 309 selecta+=','+dzsajx_settings.classes_to_ignore; 310 } 311 312 selecta+=')'; 313 314 $(document).delegate(selecta, 'click', click_menu_anchor); 315 316 if(dzsajx_settings.comment_form_selector){ 317 $(document).delegate(dzsajx_settings.comment_form_selector, 'submit',handle_submit); 318 } 319 if(dzsajx_settings.search_form_selector){ 320 $(document).delegate(dzsajx_settings.search_form_selector, 'submit',handle_submit_search); 321 } 322 323 324 window.dzsajx_click_menu_anchor = click_menu_anchor; 325 326 327 if(window.addEventListener){ 328 329 window.addEventListener('popstate', handle_popstate); 330 } 331 332 333 334 335 $('script').each(function(){ 336 var _t = $(this); 337 338 339 if(_t.attr('src')){ 340 scripts_loaded_arr.push(_t.attr('src')); 341 } 342 //console.info(_t.attr('src')); 343 344 if(String(_t.attr('src')).indexOf('https://maps.googleapis.com/maps/api')==0){ 345 window.google_maps_loaded = true; 346 } 347 }); 348 349 350 $('link').each(function(){ 351 var _t = $(this); 352 353 //console.info(_t); 354 355 if(_t.attr('rel')=='stylesheet' && _t.attr('href')){ 356 var aux_href = _t.attr('href'); 357 if(aux_href.indexOf('./')==0){ 358 aux_href = aux_href.replace('./',''); 359 } 360 scripts_loaded_arr.push(aux_href); 361 } 362 }); 363 364 365 366 367 368 369 function handle_popstate(e){ 370 // console.log(e, e.state, e.state.href); 371 372 if(e.state && e.state.href){ 373 374 375 var args = { 376 'force_href': e.state.href 377 ,force_no_ajax:'on' 378 }; 379 380 if(dzsajx_settings.use_ajax_on_back_button=='on'){ 381 args.force_no_ajax = 'off'; 382 } 383 384 click_menu_anchor(null, args) 385 386 //console.info(e.state.curr_menu_items,Object(e.state.curr_menu_items).size,Object.size(e.state.curr_menu_items)); 387 388 //console.log(e.state.curr_menu_items, e.state, history); 389 390 if(Object.size && e.state.curr_menu_items && Object.size(e.state.curr_menu_items)>0){ 391 392 393 // console.info('my docs', _theActualNav.find('.current-menu-item')) 394 if(_theActualNav) { 395 _theActualNav.find('.current-menu-item').removeClass('current-menu-item'); 396 397 for (var i2 = 0; i2 < Object.size(e.state.curr_menu_items); i2++) { 398 _theActualNav.find('li').eq(e.state.curr_menu_items[i2]).addClass('current-menu-item'); 399 } 400 } 401 } 402 return false; 403 } 404 } 405 406 407 function convert_to_html(arg, pargs){ 408 409 410 var margs = { 411 412 'convert_script_tags' : "off" 413 }; 414 415 if(pargs){ 416 margs = $.extend(margs, pargs); 417 } 418 419 var fout = ''; 420 421 fout = String(arg).replace(/<\!DOCTYPE.*?>/gi, ''); 422 fout = String(fout).replace(/<html.*?>/gi, ''); 423 fout = String(fout).replace(/<\/html.*?>/gi, ''); 424 fout = String(fout).replace(/<head>([\s|\S]*?)<\/head>/igm, '<div id="html-head">$1</div>'); 425 fout = String(fout).replace(/<body.*?>([\s|\S]*?)<\/body>/igm, '<div id="html-body">$1</div>'); 426 427 if(margs.convert_script_tags=='on'){ 428 429 // console.warn(fout); 430 fout = String(fout).replace(/<script(.*?)>([\s|\S]*?)<\/script>/igm, '<!--start dzsajx-script-tag--><div class="dzsajx-script-tag" $1>$2</div><!--end dzsajx-script-tag-->'); 431 432 // console.warn(fout); 433 } 434 435 fout = '<div>'+fout+'</div>'; 436 437 return fout; 438 } 439 440 function handle_submit_search(e,pargs) { 441 442 443 var _t = $(this); 444 445 446 if (e.type == 'submit') { 447 448 449 // console.info(_t.find('*[name="s"]')); 450 451 var url = _t.attr('action')+'?s='+encodeURIComponent(_t.find('*[name="s"]').val()); 452 e.preventDefault(); 453 454 455 456 click_menu_anchor(null, { 457 force_href: url 458 }); 459 } 460 } 461 462 function handle_submit(e,pargs) { 463 464 465 var _t = $(this); 466 467 468 if(e.type=='submit'){ 469 470 471 var comments_post_url = _t.attr('action'); 472 console.info(_t); 473 474 e.preventDefault(); 475 476 477 478 console.warn(comments_post_url); 479 var req = $.ajax({ 480 url: comments_post_url, 481 type: "POST", 482 data: _t.serialize(), 483 beforeSend: function(xhr){ xhr.setRequestHeader('X-WPAC-REQUEST', '1'); }, 484 success: function (data,ts) { 485 486 var headers = req.getAllResponseHeaders(); 487 488 console.info("headers",headers); 489 // console.info(data); 490 491 console.info(req.getResponseHeader("X-WPAC-ERROR"), data.success, ts); 492 493 494 495 496 497 var response_html = convert_to_html(data); 498 499 500 var __response = $(response_html); 501 502 503 // console.info(response_html, __response); 504 505 506 console.info(__response.find('#html-body').html()); 507 508 if(__response.find('#html-body').html().indexOf('ERROR')<30 && __response.find('#html-body').html().indexOf('ERROR')>-1){ 509 510 511 console.warn("IS ERROR"); 512 513 $('.comment-feedbacker').html(__response.find('#html-body').html()); 514 $('.comment-feedbacker').fadeIn("fast"); 515 $('.comment-feedbacker').addClass('active is-error'); 516 517 setTimeout(function(){ 518 519 $('.comment-feedbacker').fadeOut("slow"); 520 $('.comment-feedbacker').removeClass('active'); 521 },3000) 522 523 return false; 524 } 525 526 if(dzsajx_settings.comment_list_selector && curr_html.indexOf('replytocom')==-1 && $(dzsajx_settings.comment_list_selector).eq(0).length>0){ 527 528 529 530 531 if(__response.find(dzsajx_settings.comment_list_selector).eq(0).length>0){ 532 $(dzsajx_settings.comment_list_selector).append(__response.find(dzsajx_settings.comment_list_selector).eq(0).children().last(
532)); 533 534 $(dzsajx_settings.comment_list_selector).children().last().css('opacity','0'); 535 $(dzsajx_settings.comment_list_selector).children().last().animate( 536 {'opacity':'1'} 537 ,{queue:false 538 ,complete: function(e){ 539 540 $(this).css('opacity',''); 541 }}); 542 } 543 544 console.info(__response, __response.find(dzsajx_settings.comment_list_selector).eq(0)); 545 }else{ 546 click_menu_anchor(null, { 547 force_href: curr_html 548 ,do_not_scroll: "on" 549 ,do_not_change_menu: "on" 550 }); 551 } 552 553 _t.find('textarea').val(''); 554 555 $('.comment-feedbacker').removeClass('is-error');; 556 $('.comment-feedbacker').html(dzsajx_settings.translate_comment_submitted); 557 $('.comment-feedbacker').fadeIn("fast"); 558 $('.comment-feedbacker').addClass('active');; 559 560 setTimeout(function(){ 561 562 $('.comment-feedbacker').fadeOut("slow"); 563 $('.comment-feedbacker').removeClass('active');; 564 },3000) 565 566 567 568 }, 569 error: function (jqXhr, textStatus, errorThrown) { 570 571 $('.comment-feedbacker').html("error "+errorThrown); 572 $('.comment-feedbacker').fadeIn("fast"); 573 $('.comment-feedbacker').addClass('active is-error'); 574 575 setTimeout(function(){ 576 577 $('.comment-feedbacker').fadeOut("slow"); 578 $('.comment-feedbacker').removeClass('active'); 579 },3000) 580 581 } 582 }); 583 } 584 585 } 586 587 function loadScript(src, callback){ 588 var s, 589 r, 590 t; 591 r = false; 592 s = document.createElement('script'); 593 s.type = 'text/javascript'; 594 s.src = src; 595 s.async = true; 596 s.onload = function() { 597 console.warn( this.readyState ); //uncomment this line to see which ready states are called. 598 if ( !r && (!this.readyState || this.readyState == 'complete') ){ 599 // if (this.readyState == 'complete'){ 600 r = true; 601 callback(s); 602 } 603 }; 604 605 if(_dzsajx_scripts_tbe_con){ 606 _dzsajx_scripts_tbe_con.get(0).appendChild(s); 607 }else{ 608 609 t = document.getElementsByTagName('script')[0]; 610 t.parentNode.insertBefore(s, t); 611 } 612 } 613 function click_menu_anchor(e,pargs) { 614 615 // console.info('click_menu_anchor()', pargs); 616 617 618 619 620 var _t = $(this); 621 var thehref = _t.attr('href'); 622 var isselectoption = false; 623 var sw_found_content = false; // -- set true if found content selector 624 625 626 627 628 629 630 631 632 var margs = { 633 _t: null 634 , force_href: '' 635 , force_no_ajax: 'off' 636 , from_zoombox: 'off' 637 , force_pushState: false 638 , do_not_scroll: "off" 639 , do_not_change_menu: "off" 640 }; 641 642 643 if (pargs) { 644 margs = $.extend(margs, pargs); 645 } 646 647 648 649 650 function onajaxcompleted(response,textStatus,jqXHR){ 651 652 console.info('onajaxcompleted()') 653 if (_t) { 654 //console.info(_t.parent().parent().parent()); 655 if (_t.parent().parent().parent().hasClass('menu-toggler-target')) { 656 _t.parent().parent().parent().removeClass('active'); 657 } 658 if (_t.parent().parent().parent().parent().parent().hasClass('menu-toggler-target')) { 659 _t.parent().parent().parent().parent().parent().removeClass('active'); 660 } 661 } 662 663 //console.info(_t); 664 665 if(jqXHR=='Not Found'){ 666 response = response.responseText; 667 } 668 669 var ___response_raw = $(response); 670 671 // console.warn(response); 672 // console.info(___response_raw); 673 674 675 response = String(response).replace(/<!--[\s|\S]*?-->/gim, ''); 676 677 678 if(dzsajx_settings.update_body_class=='on'){ 679 680 681 var regex_links = /<body.*?class=['|"](.*?)['|"]/gim; 682 683 var match; 684 685 if(match = regex_links.exec(response)) { 686 687 // console.info(match); 688 689 if(match[1]){ 690 newclass_body=match[1]; 691 692 // console.info(newclass_body); 693 } 694 695 } 696 697 698 // newclass_body = 699 } 700 701 702 703 var regex_scripts = /<script.*?src=['|"](.*?)['|"][\s|\S]*?\/script>/gim; 704 705 // 706 707 708 // console.info(scripts_loaded_arr, scripts_loaded_arr.length); 709 if(dzsajx_settings.scripts_to_reload){ 710 711 712 713 var aux_split = String(dzsajx_settings.scripts_to_reload).split(','); 714 715 716 for ( var i233 in aux_split){ 717 $('script').each(function(){ 718 var _t = $(this); 719 // console.info(_t); 720 721 if(_t.attr('src')){ 722 723 724 // && _t.attr('src').indexOf('ajaxer.js')==0 725 if(_t.attr('src').indexOf(aux_split[i233])>-1){ 726 727 console.info("REMOVING SCRIPT",_t); 728 _t.get(0).parentNode.removeChild(_t.get(0)); 729 } 730 } 731 }) 732 733 for(var i24 in scripts_loaded_arr){ 734 // console.info(scripts_loaded_arr[i24]); 735 736 737 if(scripts_loaded_arr[i24].indexOf(aux_split[i233])>-1){ 738 739 // console.warn(i24, scripts_loaded_arr[i24]) 740 scripts_loaded_arr.splice(i24,1); 741 } 742 } 743 } 744 745 746 } 747 748 749 var match; 750 while (match = regex_scripts.exec(response)) { 751 752 // console.info(match); 753 754 if (match[1]) { 755 756 757 var sw = false; 758 759 for (var j = 0; j < scripts_loaded_arr.length; j++) { 760 761 //console.info(_t4.src, scripts_loaded_arr[j], (qcreative_options.site_url + scripts_loaded_arr[j])); 762 763 // console.info(_t4.src, scripts_loaded_arr[j], ajax_site_url); 764 765 // var auxa = scripts_loaded_arr[j].explode('?'); 766 767 var aux = match[1]; 768 if (aux.indexOf('&') > -1) { 769 aux = aux.split('&')[0]; 770 } 771 772 if (match[1] == '' || scripts_loaded_arr[j] == match[1] || ajax_site_url + scripts_loaded_arr[j] == match[1]) { 773 sw = true; 774 } 775 } 776 777 // console.info(_t4.src); 778 779 if (sw == false && match[1]) { 780 781 scripts_tobeloaded.push(match[1]); 782 } 783 784 } 785 } 786 787 var regex_links = /(<!--\[if lt IE \d*\]>[\S|\s]{0,1})?<link.*?href=['|"](.*?)['|"][\s|\S]*?\/{0,1}>/gim; 788 789 790 while (match = regex_links.exec(response)) { 791 792 // console.info(match); 793 794 if (match[2]) { 795 796 797 var sw = false; 798 799 for (var j = 0; j < scripts_loaded_arr.length; j++) { 800 801 //console.info(_t4.src, scripts_loaded_arr[j], (qcreative_options.site_url + scripts_loaded_arr[j])); 802 803 // console.info(_t4.src, scripts_loaded_arr[j], ajax_site_url); 804 if (match[1] || match[2] == '' || scripts_loaded_arr[j] == match[2] || ajax_site_url + scripts_loaded_arr[j] == match[2] || String(match[0]).indexOf("stylesheet")==-1 ) { 805 sw = true; 806 } 807 } 808 809 // console.info(_t4.src); 810 811 if (sw == false && match[2]) { 812 813 stylesheets_tobeloaded.push(match[2]); 814 } 815 816 } 817 } 818 819 820 821 822 823 function load_script_cb(arg){ 824 console.info('script loaded',arg,nr_scripts_tobeloaded); 825 nr_scripts_tobeloaded--; 826 //console.info(nr_scripts_tobeloaded); 827 828 if (nr_scripts_tobeloaded <= 0) { 829 //console.info('loadnewpage'); 830 831 //console.info($.zfolio); 832 833 834 ajax_load_new_page(); 835 } 836 837 // console.info(arg,i4); 838 839 var aux = arg.src; 840 841 if (aux.indexOf('?') > -1) { 842 aux = aux.split('?')[0]; 843 } 844 845 //console.info(aux); 846 scripts_loaded_arr.push(aux); 847 } 848 849 for (var i2 = 0; i2 < ___response_raw.length; i2++) { 850 var _t4 = ___response_raw[i2]; 851 852 853 // console.info(_t3.nodeName); 854 if (_t4 && _t4.nodeName == 'TITLE') { 855 newtitle = _t4.innerHTML; 856 857 // console.info(newtitle); 858 } 859 860 861 862 863 864 865 if (_t4 && _t4.nodeName == 'STYLE') { 866 867 868 // -- stylesheets check 869 870 871 872 if(_t4.type && _t4.type=='text/css'){ 873 // console.info(_t4, _t4.outerHTML); 874 875 stylesheets_tobeadded.push(_t4.outerHTML); 876 } 877 878 879 } 880 881 882 // if (_t4 && _t4.nodeName == 'LINK') { 883 // 884 // 885 // // -- stylesheets check 886 // 887 // 888 // 889 // if (_t4.rel != 'stylesheet') { 890 // continue; 891 // } 892 // 893 // 894 // 895 // 896 // 897 // var sw = false; 898 // 899 // 900 // for (var j = 0; j < scripts_loaded_arr.length; j++) { 901 // 902 // 903 // //console.info(aux_href, scripts_loaded_arr[j],ajax_site_url, scripts_loaded_arr[j], (ajax_site_url + scripts_loaded_arr[j])); 904 // if (aux_href == '' || scripts_loaded_arr[j] == aux_href || ajax_site_url + scripts_loaded_arr[j] == aux_href) { 905 // sw = true; 906 // } 907 // } 908 // 909 // if (sw == false) { 910 // 911 // stylesheets_tobeloaded.push(_t4.href); 912 // } 913 // } 914 } 915 916 // console.info(scripts_tobeloaded, stylesheets_tobeloaded); 917 918 var args = { 919 920 }; 921 922 if(scripts_execute_after_ajax_call=='on'){ 923 args.convert_script_tags='on'; 924 } 925 926 // console.warn(response); 927 928 // console.info(jqXHR) 929 930 931 var response_html = convert_to_html(response,args); 932 933 // console.info( response_html, $(response_html), $(response_html).find('.dzsajx-script-tag')); 934 935 936 // console.warn(response_html); 937 938 939 940 941 if(scripts_execute_after_ajax_call=='on') { 942 var regex_script_tag = /<!--start dzsajx-script-tag--><div class="dzsajx-script-tag"(.*?)>([\s|\S]*?)<\/div><!--end dzsajx-script-tag-->/igm; 943 944 945 var match; 946 while (match = regex_script_tag.exec(response_html)) { 947 948 // console.info(match); 949 950 if (match[2]) { 951 952 var obj = { 953 attr:match[1] 954 ,content: match[2] 955 } 956 957 scripts_tobeexecuted.push(obj); 958 } 959 } 960 961 962 963 response_html = String(response_html).replace(/<!--start dzsajx-script-tag--><div class="dzsajx-script-tag">([\s|\S]*?)<\/div><!--end dzsajx-script-tag-->/igm, ''); 964 965 // console.warn(response_html); 966 } 967 968 969 970 971 972 // $(response_html).find('.dzsajx-script-tag').each(function(){ 973 // 974 // var _t24 = $(this); 975 // 976 // console.info(_t24.html()); 977 // 978 // if(_t24.html()){ 979 // 980 // scripts_tobeexecuted.push(_t24) ; 981 // } 982 // }) 983 984 985 ___response = $(response_html); 986 987 988 if (dzsajx_settings.menu_selector) { 989 if(dzsajx_settings.menu_move_on_top_of_content=='on'){ 990 991 ___response.find(dzsajx_settings.menu_selector).eq(0).remove(); 992 } 993 } 994 995 996 // console.info(___response); 997 998 999 var regex_bodyclass = /<body.*?class=".*?(page-.*?)[ |"]/g; 1000 1001 1002 var aux23 = regex_bodyclass.exec(response); 1003 1004 // newclass_body = ''; 1005 // if (aux23) { 1006 // if (aux23[1]) { 1007 // newclass_body = aux23[1]; 1008 // } 1009 // } 1010 1011 1012 // console.log(response, ___response, ___response.find(content_selector)); 1013 1014 new_page_html = ___response.find(content_selector).eq(0).html(); 1015 1016 // console.info(response, response_html, ___response, ___response.find(content_selector).length) 1017 1018 if(___response.find(content_selector).length>0){ 1019 1020 sw_found_content = true; 1021 }else{ 1022 1023 setTimeout(function () { 1024 args = {}; 1025 if (_t) { 1026 args._t = _t; 1027 args.force_href = thehref; 1028 args.force_no_ajax = "on"; 1029 } 1030 ; 1031 1032 click_menu_anchor(e, args); 1033 },50); 1034 } 1035 1036 if(dzsajx_settings.extra_items_to_be_recovered){ 1037 ___response.find(dzsajx_settings.extra_items_to_be_recovered).each(function(){ 1038 1039 1040 1041 var _t23 = $(this); 1042 1043 extra_items.push(_t23.html()); 1044 }) 1045 1046 1047 } 1048 if(dzsajx_settings.extra_items_to_be_added){ 1049 1050 // console.info(dzsajx_settings.extra_items_to_be_added, ___response.find(dzsajx_settings.extra_items_to_be_added), ___response.find(dzsajx_settings.extra_items_to_be_added).eq(0).html()); 1051 1052 var aux_split = String(dzsajx_settings.extra_items_to_be_added).split(','); 1053 1054 for ( var i233 in aux_split){ 1055 ___response.find(aux_split[i233]).each(function(){ 1056 1057 1058 1059 var _t234 = $(this); 1060 1061 1062 var obj = { 1063 'selector': aux_split[i233] 1064 ,'html': _t234.html() 1065 ,'outer_html': _t234.get(0).outerHTML 1066 } 1067 1068 extra_items_tobeadded.push(obj); 1069 1070 // console.info(_t234, extra_items_tobeadded, _t234.html()); 1071 }) 1072 } 1073 1074 1075 1076 1077 } 1078 1079 //console.log(scripts_loaded_arr); 1080 for (var i = 0; i < ___response.length; i++) { 1081 var _t3 = ___response[i]; 1082 1083 if (_t3.attr && _t3.attr('class') == 'mainoptions') { 1084 //continue; 1085 } 1086 1087 1088 var aux_href = ''; 1089 if (_t3.href) { 1090 aux_href = _t3.href; 1091 1092 if (aux_href.indexOf('./') == 0) { 1093 aux_href = aux_href.replace('./', ''); 1094 } 1095 } 1096 1097 //console.info(_t3); 1098 1099 1100 if (has_custom_outside_content_1) { 1101 //console.info(_t3, _t3.className); 1102 if (_t3.className == 'custom-outside-content-1') { 1103 $('.custom-outside-content-1').html(_t3.innerHTML); 1104 1105 //console.info(); 1106 } 1107 } 1108 1109 1110 1111 if (_t3.className == 'social-scripts') { 1112 //console.info(_t3); 1113 1114 1115 //if(social_scripts_loaded==false){ 1116 // 1117 // _body.append(_t3); 1118 // social_scripts_loaded=true; 1119 //} 1120 //social_scripts_reinit = true; 1121 1122 //console.info('social_scripts_reinit INIT', social_scripts_reinit) 1123 } 1124 1125 if (_t3.className == 'content-wrapper') { 1126 1127 1128 } 1129 1130 if (_t3.className == 'portfolio-fulscreen--items') { 1131 //console.info(_t3); 1132 1133 1134 _html_for_classes.append(_t3); 1135 1136 //console.info('social_scripts_reinit INIT', social_scripts_reinit) 1137 } 1138 1139 1140 1141 } 1142 1143 //console.info(scripts_loaded_arr); 1144 // console.info(scripts_tobeloaded, stylesheets_tobeloaded); 1145 1146 1147 //console.info($.zfolio); 1148 setTimeout(function () { 1149 var i = 0; 1150 nr_scripts_tobeloaded = scripts_tobeloaded.length; 1151 1152 // console.info(scripts_loaded_arr); 1153 // console.info(scripts_tobeloaded); 1154 1155 function loadFunc(e) { 1156 //console.info(e); 1157 } 1158 1159 1160 if(_contentContainer){ 1161 1162 }else{ 1163 1164 // console.warn("ADDING" ); 1165 // console.warn(new_page_html); 1166 _content.after(_content.clone()); 1167 // _content.next().hide(); 1168 _content.next().children().remove(); 1169 _content.next().append(new_page_html); 1170 1171 1172 // jQuery('.edd_downloads_list:not(".slick-slider,.has-slick")').each(function(){ 1173 // 1174 // var _t = jQuery(this); 1175 // console.info("LIST ", _t); 1176 // _t.attr('data-columns','3'); 1177 // 1178 // /* 1179 // if(_t.children('.col-md-4').length==0){ 1180 // _t.append('<div class="col-md-4"></div>'); 1181 // _t.append('<div class="col-md-4"></div>'); 1182 // _t.append('<div class="col-md-4"></div>'); 1183 // _t.children('.col-md-4').eq(0).append(_t.children('.edd_download:nth-child(3n+1)').clone()); 1184 // _t.children('.col-md-4').eq(1).append(_t.children('.edd_download:nth-child(3n+2)').clone()); 1185 // _t.children('.col-md-4').eq(2).append(_t.children('.edd_download:nth-child(3n+3)').clone()); 1186 // 1187 // _t.children('.edd_download').remove(); 1188 // } 1189 // */ 1190 // _t.attr('data-columns','4'); 1191 // 1192 // if(_t.children('.col-md-3').length==0){ 1193 // _t.append('<div class="col-md-3"></div>'); 1194 // _t.append('<div class="col-md-3"></div>'); 1195 // _t.append('<div class="col-md-3"></div>'); 1196 // _t.append('<div class="col-md-3"></div>'); 1197 // 1198 // _t.children('.edd_download:nth-child(4n+1)').attr('dzsaux','1'); 1199 // _t.children('.edd_download:nth-child(4n+2)').attr('dzsaux','2'); 1200 // _t.children('.edd_download:nth-child(4n+3)').attr('dzsaux','3'); 1201 // _t.children('.edd_download:nth-child(4n+4)').attr('dzsaux','4'); 1202 // 1203 // _t.children('.col-md-3').eq(0).append(_t.children('.edd_download[dzsaux=1]')); 1204 // _t.children('.col-md-3').eq(1).append(_t.children('.edd_download[dzsaux=2]')); 1205 // _t.children('.col-md-3').eq(2).append(_t.children('.edd_download[dzsaux=3]')); 1206 // _t.children('.col-md-3').eq(3).append(_t.children('.edd_download[dzsaux=4]')); 1207 // 1208 // _t.children('.edd_download').remove(); 1209 // } 1210 // 1211 // 1212 // }); 1213 } 1214 1215 if (nr_scripts_tobeloaded <= 0) { 1216 1217 1218 ajax_load_new_page(); 1219 return false; 1220 }else{ 1221 new_page_not_loaded_yet = true; 1222 1223 setTimeout(function(){ 1224 if(new_page_not_loaded_yet){ 1225 1226 ajax_load_new_page(); 1227 } 1228 },2000); 1229 } 1230 1231 1232 // console.info($('.featured-popular-slick')); 1233 // console.info('scripts to be loaded - ',scripts_tobeloaded,scripts_tobeloaded.length); 1234 1235 1236 var i4 = 0; 1237 for (i4 = 0; i4 < scripts_tobeloaded.length; i4++) { 1238 1239 // $.getScript(scripts_tobeloaded[i4], function (data, textStatus, jqxhr) { 1240 // //console.log( data ); // Data ret
1240urned 1241 // //console.log( textStatus ); // Success 1242 // //console.log( jqxhr.status ); // 200 1243 // //console.log( "Load was performed." ); 1244 // 1245 // 1246 // //eval(data); 1247 // 1248 // //console.log(this, data,textStatus, jqxhr); 1249 // 1250 // 1251 // if (String(this.url).indexOf('http://maps.googleapis.com/maps') > -1) { 1252 // 1253 // window.google_maps_loaded = true; 1254 // window.gooogle_maps_must_init = true; 1255 // } 1256 // 1257 // 1258 // nr_scripts_tobeloaded--; 1259 // //console.info(nr_scripts_tobeloaded); 1260 // 1261 // if (nr_scripts_tobeloaded <= 0) { 1262 // //console.info('loadnewpage'); 1263 // 1264 // //console.info($.zfolio); 1265 // 1266 // 1267 // ajax_load_new_page(); 1268 // } 1269 // 1270 // //console.info(this,i4); 1271 // 1272 // var aux = this.url; 1273 // 1274 // if (aux.indexOf('&') > -1) { 1275 // aux = aux.split('&')[0]; 1276 // } 1277 // 1278 // // console.info(aux, nr_scripts_tobeloaded); 1279 // scripts_loaded_arr.push(aux); 1280 // 1281 // }) 1282 1283 1284 var the_script = scripts_tobeloaded[i4]; 1285 1286 if(the_script.indexOf('?')>-1){ 1287 the_script = the_script+'&zoomit='+Math.random(); 1288 } 1289 1290 1291 1292 1293 1294 1295 1296 // 1297 // console.warn(the_script); 1298 // $.ajax({ 1299 // url: the_script, 1300 // dataType: 'script', 1301 // success: function (data, textStatus, jqxhr) { 1302 // // console.log( data ); // Data returned 1303 // //console.log( textStatus ); // Success 1304 // //console.log( jqxhr.status ); // 200 1305 // //console.log( "Load was performed." ); 1306 // 1307 // 1308 // //eval(data); 1309 // 1310 // //console.log(this, data,textStatus, jqxhr); 1311 // 1312 // 1313 // if (String(this.url).indexOf('http://maps.googleapis.com/maps') > -1) { 1314 // 1315 // window.google_maps_loaded = true; 1316 // window.gooogle_maps_must_init = true; 1317 // } 1318 // 1319 // 1320 // nr_scripts_tobeloaded--; 1321 // console.info(nr_scripts_tobeloaded); 1322 // 1323 // if (nr_scripts_tobeloaded <= 0) { 1324 // //console.info('loadnewpage'); 1325 // 1326 // //console.info($.zfolio); 1327 // 1328 // 1329 // ajax_load_new_page(); 1330 // } 1331 // 1332 // //console.info(this,i4); 1333 // 1334 // var aux = this.url; 1335 // 1336 // if (aux.indexOf('&') > -1) { 1337 // aux = aux.split('&')[0]; 1338 // } 1339 // 1340 // // console.info(aux, nr_scripts_tobeloaded); 1341 // scripts_loaded_arr.push(aux); 1342 // 1343 // }, 1344 // async: false 1345 // }); 1346 1347 1348 1349 1350 1351 1352 1353 setTimeout(function(i5){ 1354 var the_script = scripts_tobeloaded[i5]; 1355 1356 if(the_script.indexOf('?')>-1){ 1357 the_script = the_script+'&zoomit='+Math.random(); 1358 } 1359 loadScript(the_script,load_script_cb); 1360 },i4*10,i4); 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 // $.getScript(scripts_tobeloaded[i4], function (data, textStatus, jqxhr) { 1372 // //console.log( data ); // Data returned 1373 // //console.log( textStatus ); // Success 1374 // //console.log( jqxhr.status ); // 200 1375 // //console.log( "Load was performed." ); 1376 // 1377 // 1378 // //eval(data); 1379 // 1380 // //console.log(this, data,textStatus, jqxhr); 1381 // 1382 // 1383 // 1384 // 1385 1386 // }) 1387 // setTimeout(function(){ 1388 // },i4*3); 1389 // 1390 // ; 1391 } 1392 for (i4 = 0; i4 < stylesheets_tobeloaded.length; i4++) { 1393 1394 $('<link/>', { 1395 rel: 'stylesheet', 1396 type: 'text/css', 1397 href: stylesheets_tobeloaded[i4] 1398 }).appendTo('head'); 1399 1400 1401 // console.warn(stylesheets_tobeloaded[i4]); 1402 scripts_loaded_arr.push(stylesheets_tobeloaded[i4]); 1403 1404 1405 } 1406 1407 1408 setTimeout(function () { 1409 //console.info(window.dzsprx_init); 1410 //console.info($.zfolio,jQuery.zfolio); 1411 }, 1000) 1412 1413 1414// console.info(___response, ___response_scriptmo); 1415 }, 100); 1416 1417 1418 //console.info(thehref) 1419 1420 1421 //console.info('destroy zoombox'); 1422 1423
1424 // -- we destroy it but only if we init another one 1425 //if(window.api_destroy_zoombox){ 1426 // window.api_destroy_zoombox(); 1427 //} 1428 1429 //console.info() 1430 1431 //console.info('STATE CURR MENU ITEMS LINKS2',state_curr_menu_items_links); 1432 1433 1434 // console.info(" FOUND CONTENT ",sw_found_content); 1435 if ( ( _t.get(0) != window || margs.force_pushState ) && sw_found_content) { 1436 1437 1438 if (history_first_pushed_state == false) { 1439 1440 if (window.location.href.indexOf('file://') === -1) { 1441 1442 var aux = curr_html; 1443 if (aux == 'index.php') { 1444 aux = ''; 1445 } 1446 1447 var stateObj = {href: curr_html}; 1448 1449 history.pushState(stateObj, null, aux); 1450 } 1451 history_first_pushed_state = true; 1452 } 1453 1454 var aux_arr = state_curr_menu_items_links.slice(0); 1455 1456 var stateObj = {foo: page_change_ind, href: thehref, 'curr_menu_items': aux_arr}; 1457 1458 page_change_ind++; 1459 1460 old_href = window.location.href; 1461 old_class_body = _body.attr('class'); 1462 // console.info("OLD URL", window.location.href); 1463 //console.info('PUSH STATE', stateObj, thehref) 1464 history.pushState(stateObj, newtitle, thehref); 1465 if (newtitle) { 1466 document.title = newtitle; 1467 } 1468 1469 curr_html = thehref; 1470 // console.info('curr_html is - ', curr_html) 1471 } 1472 1473 1474 } 1475 1476 1477 1478 if (margs._t) { 1479 _t = margs._t; 1480 thehref = _t.attr('href'); 1481 } 1482 1483 //console.info(_html_for_classes.hasClass('page-playlistadd'), currclass_html_for_classes); 1484 if (_html_for_classes.hasClass('page-playlistadd')) { 1485 1486 var args = { 1487 _t: _t 1488 , 'from_zoombox': 'on' 1489 }; 1490 1491 if (parent && parent.click_menu_anchor) { 1492 parent.click_menu_anchor(e, args); 1493 } 1494 1495 1496 return false; 1497 } 1498 // console.info(margs.force_href, margs.force_no_ajax, thehref, curr_html); 1499 1500 1501 // console.info(_t.parent().hasClass('current-menu-item')); 1502 if (_t && _t.parent().hasClass('current-menu-item') && margs.force_no_ajax != 'on') { 1503 return false; 1504 } 1505 1506 if (margs.from_zoombox == 'on') { 1507 //console.info("CLOSE ZOOMBOS"); 1508 window.api_close_zoombox(); 1509 } 1510 1511 if (_t.hasClass && _t.hasClass('result-con')) { 1512 1513 $('.bigsearch-con').removeClass('activated'); 1514 _html_for_classes.removeClass('big-search-activated'); 1515 } 1516 1517 1518 if (_t && _t.get(0) && _t.get(0).nodeName == 'SELECT') { 1519 1520 isselectoption = true; 1521 thehref = _t.val(); 1522 //thehref = _t.find(':selected').attr('value'); 1523 1524 } 1525 1526 if (_t && _t.get(0) && _t.get(0).nodeName == 'OPTION') { 1527 1528 isselectoption = true; 1529 thehref = _t.val(); 1530 //thehref = _t.find(':selected').attr('value'); 1531 1532 } 1533 1534 //console.info(_t.hasClass('current-menu-item'), _t, _t.attr('class')); 1535 //if(_t&&_t.parent().hasClass('current-menu-item') && margs.force_no_ajax!='on'){ 1536 // 1537 // return false; 1538 //} 1539 1540 // console.log(thehref, curr_html); 1541 1542 if (thehref === curr_html && margs.force_no_ajax!='on') { 1543 return false; 1544 } 1545 1546 1547 if (window.dzsajx_settings.disable_ajax_on_touch_devices && window.dzsajx_settings.disable_ajax_on_touch_devices=='on' && is_touch_device()) { 1548 margs.force_no_ajax = 'on'; 1549 window.location.href = thehref; 1550 } 1551 //console.info(_t[0]==window, thehref, margs); 1552 //if(_t[0]==window){ 1553 // return false; 1554 //} 1555 1556 if (margs.force_href) { 1557 thehref = margs.force_href; 1558 1559 console.info(margs.force_no_ajax, thehref); 1560 1561 if (margs.force_no_ajax == 'on') { 1562 window.location.href = thehref; 1563 } 1564 } 1565 1566 1567 //console.info(busy_main_transition); 1568 if (busy_main_transition) { 1569 1570 setTimeout(function () { 1571 var args = {}; 1572 if (_t) { 1573 args._t = _t; 1574 args.force_href = thehref 1575 } 1576 ; 1577 1578 click_menu_anchor(e, args); 1579 }, 1000); 1580 1581 return false; 1582 } 1583 1584 1585 //console.info(_t,_t.val(), isselectoption,thehref); 1586 if (isselectoption) { 1587 //return false; 1588 } 1589// console.info(_t); 1590 1591 //==== well test if it's an outer link, if its an outside link we dont need any ajax. 1592 1593 1594 //console.info(ajax_site_url); return; 1595 //console.info(window.dzsap_settings.enable_ajax == 'on', window, margs.force_no_ajax) 1596 if (window.dzsajx_settings.enable_ajax == 'on' && window && margs.force_no_ajax != 'on') { 1597 1598 1599 //console.info(thehref); 1600 if (thehref.indexOf('#') == 0 || thehref.indexOf('javascript') == 0 || thehref.indexOf('.jpg')>thehref.length-5) { 1601 1602 } else { 1603 //console.info( window.location.href, thehref ) 1604 1605 // console.info(ajax_site_url, thehref.indexOf(ajax_site_url)); 1606 if (window.location.href.indexOf('file://') == 0 || ( (thehref.indexOf('http://') > -1||thehref.indexOf('https://') > -1) && thehref.indexOf(ajax_site_url) != 0) || (thehref.indexOf('admin.php')>-1) || (thehref.indexOf('wp-admin')>-1) ) { 1607 1608 1609 } else { 1610 //if indeed we are going to history api it 1611 1612 //console.info(scripts_loaded_arr); 1613 $('body').removeClass('loaded'); 1614 $('.toexecute-from-dzsajx').remove(); 1615 if (can_history_api()) { 1616 scripts_tobeloaded = []; 1617 stylesheets_tobeloaded = []; 1618 var nr_scripts_tobeloaded = 0; 1619 1620 1621 content_wrapper_transitioned_out = false; 1622 1623 if (_t.hasClass('ajax-link-user')) { 1624 1625 1626 } else { 1627 1628 _html_for_classes.addClass('dzsajx-ajax-transitioning-out '); 1629 _html_for_classes.addClass('dzsajx-ajax-loading '); 1630 1631 1632 if(margs.do_not_scroll!='on'){ 1633 $('html, body').animate({ 1634 scrollTop: 0 1635 }, 100); 1636 } 1637 1638 1639 if (dzsajx_settings.transition=='scaledown' || dzsajx_settings.transition=='slide') { 1640 _content.wrap('<div id="dzsajx-content-container"></div>'); 1641 1642 _contentContainer = _content.parent(); 1643 }else{ 1644 1645 } 1646 1647 _content.addClass('last-content'); 1648 1649 if(_preloader){ 1650 _preloader.addClass('active'); 1651 1652 if (dzsajx_settings.preloader=='bar') { 1653 1654 _preloader.find('.the-bar').css({ 1655 'width': '0' 1656 }) 1657 _preloader.find('.the-bar').animate({ 1658 'width': '60%' 1659 },{ 1660 queue:false 1661 ,duration: 1000 1662 1663 }) 1664 } 1665 } 1666 1667 1668 } 1669 1670 1671 setTimeout(function () { 1672 content_wrapper_transitioned_out = true; 1673 }, 300); 1674 1675 var sw = false; 1676 if(_dzsajx_caches_con){ 1677 1678 // for(var i25 in pages_caches){ 1679 _dzsajx_caches_con.children().each(function(){ 1680 1681 // var _t23 = pages_caches[i25]; 1682 var _t23 = $(this); 1683 1684 1685 console.warn(_t23.attr('the_href'), thehref); 1686 1687 if(_t23.attr('the_href')==thehref){ 1688 console.info("FOUND CONTENT"); 1689 newclass_body = _t23.attr('class_body'); 1690 sw=true; 1691 1692 1693 1694 if(_contentContainer){ 1695 1696 }else{ 1697 1698 // console.warn("ADDING" ); 1699 // console.warn(new_page_html); 1700 console.info("NEW CONTENT - ",_t23); 1701 _content.after(_t23); 1702 _content.next().removeClass('in-cache'); 1703 // _content.next().hide(); 1704 // _content.next().children().remove(); 1705 // _content.next().append(new_page_html); 1706 1707 1708 1709 1710 if ( ( _t.get(0) != window || margs.force_pushState ) ) { 1711 1712 1713 if (history_first_pushed_state == false) { 1714 1715 if (window.location.href.indexOf('file://') === -1) { 1716 1717 var aux = curr_html; 1718 if (aux == 'index.php') { 1719 aux = ''; 1720 } 1721 1722 var stateObj = {href: curr_html}; 1723 1724 history.pushState(stateObj, null, aux); 1725 } 1726 history_first_pushed_state = true; 1727 } 1728 1729 var aux_arr = state_curr_menu_items_links.slice(0); 1730 1731 var stateObj = {foo: page_change_ind, href: thehref, 'curr_menu_items': aux_arr}; 1732 1733 page_change_ind++; 1734 1735 old_href = window.location.href; 1736 old_class_body = _body.attr('class'); 1737 // console.info("OLD URL", window.location.href); 1738 //console.info('PUSH STATE', stateObj, thehref) 1739 history.pushState(stateObj, newtitle, thehref); 1740 if (newtitle) { 1741 document.title = newtitle; 1742 } 1743 1744 curr_html = thehref; 1745 // console.info('curr_html is - ', curr_html) 1746 } 1747 } 1748 1749 1750 1751 if(_theActualNav) { 1752 console.info('current menu items',_theActualNav.find('.current-menu-item')); 1753 _theActualNav.find('.current-menu-item').removeClass('current-menu-item current_page_item'); 1754 } 1755 ajax_load_new_page(); 1756 1757 1758 setTimeout(function(){ 1759 1760 $(window).trigger('resize'); 1761 },2000); 1762 1763 // break; 1764 } 1765 // } 1766 }) 1767 1768 1769 1770 }else{ 1771 1772 } 1773 1774 1775 if(sw==false){ 1776 $.ajax({
1777 url: thehref, 1778 context: document.body 1779 , success: function (response, textStatus, jqXHR) { 1780 1781 onajaxcompleted(response,textStatus,jqXHR); 1782 1783 // return false; 1784 } 1785 1786 ,error: function(response,textStatus, xhr){ 1787 // console.info('error - ',response,textStatus,xhr); 1788 onajaxcompleted(response,textStatus,xhr); 1789 } 1790 1791 //console.info(_t.parent()); 1792 1793 1794 //console.info(state_curr_menu_items_links); 1795 1796 //state_curr_menu_items_links = _theActualNav.find('.current-menu-item'); 1797 1798 1799 1800 // if(_t && _t.hasClass('ajax-link')){ 1801 // _theActualNav.find('li > a').each(function(){ 1802 // var _t3 = $(this); 1803 // 1804 // //console.log(_t3, _t3.attr('href'), thehref); 1805 // 1806 // if(_t3.attr('href')==thehref||_t3.attr('href')==ajax_site_url+thehref){ 1807 // _theActualNav.find('li').removeClass('current-menu-item'); 1808 // _t3.parent().addClass('current-menu-item'); 1809 // } 1810 // }) 1811 // } 1812 // 1813 // 1814 // return false; 1815 1816 }) 1817 } 1818 1819 1820 1821 if(_t.get(0)!=window && margs.do_not_change_menu!='on'){ 1822 1823 1824 1825 state_curr_menu_items_links = []; 1826 1827 if(_theActualNav) { 1828 _theActualNav.find('.current-menu-item').each(function () { 1829 var _t2 = $(this); 1830 1831 1832 // console.info(_t2); 1833 //console.log(_t,_theActualNav.find('*').index(_t)); 1834 1835 1836 state_curr_menu_items_links.push(_theActualNav.find('li').index(_t2)); 1837 }) 1838 } 1839 1840 //console.info('STATE CURR MENU ITEMS LINKS', state_curr_menu_items_links); 1841 1842 if(_theActualNav){ 1843 1844 // console.warn(_theActualNav.find('.current-menu-item')) 1845 _theActualNav.find('.current-menu-item').removeClass('current-menu-item current_page_item'); 1846 _theActualNav.find('.current-menu-ancestor').removeClass('current-menu-ancestor current-menu-parent current_page_ancestor'); 1847 } 1848 1849 if(_t.parent().get(0) && _t.parent().get(0).nodeName=="LI"){ 1850 _t.parent().addClass('current-menu-item'); 1851 } 1852 if(_t.parent().parent().parent().get(0) && _t.parent().parent().parent().get(0).nodeName=="LI"){ 1853 _t.parent().parent().parent().addClass('current-menu-ancestor'); 1854 } 1855 1856 //if(_t.parent().parent().parent().parent().hasClass('the-actual-nav')){ 1857 // _t.parent().parent().parent().parent().find('.current-menu-item').removeClass('current-menu-item'); 1858 // _t.parent().parent().parent().addClass('current-menu-item'); 1859 // _t.parent().addClass('current-menu-item'); 1860 //} 1861 } 1862 1863 1864 return false; 1865 1866 } 1867 1868 } 1869 } 1870 1871 } 1872 } 1873 1874 function ajax_load_new_page(){ 1875 1876 1877 // console.info('whaa'); 1878 // console.info('ajax_load_new_page()', new_page_html, content_wrapper_transitioned_out); 1879 1880 if(content_wrapper_transitioned_out==false){ 1881 setTimeout(ajax_load_new_page, 300); 1882 1883 return false; 1884 } 1885 1886 // destroy listeners for all objects hier 1887 1888 1889 // -- tbc 1890 1891 console.info(currclass_body, newclass_body); 1892 1893 1894 if(_dzsajx_caches_con){ 1895 1896 }else{ 1897 _content.find('.audioplayer').each(function(){ 1898 1899 var _t = $(this); 1900 1901 console.info("DESTROYING" , _t); 1902 1903 if(_t.get(0) && _t.get(0).api_destroy_listeners){ 1904 _t.get(0).api_destroy_listeners(); 1905 } 1906 }); 1907 } 1908 1909 1910 if(newclass_body){ 1911 _body.attr('class',newclass_body); 1912 } 1913 1914 1915 1916 var i23 = 0; 1917 if(dzsajx_settings.extra_items_to_be_recovered){ 1918 $(dzsajx_settings.extra_items_to_be_recovered).each(function(){ 1919 1920 // console.info(extra_items[i23]); 1921 1922 var _t23 = $(this); 1923 1924 if(extra_items[i23]){ 1925 _t23.html(extra_items[i23]); 1926 } 1927 1928 i23++; 1929 }) 1930 1931 extra_items = []; 1932 } 1933 1934 1935 1936 i23 = 0; 1937 1938 1939 1940 1941 if(dzsajx_settings.extra_items_to_be_added){ 1942 1943 1944 var aux_split = String(dzsajx_settings.extra_items_to_be_added).split(','); 1945 1946 for ( var i233 in aux_split){ 1947 1948 1949 // console.info(aux_split[i233], extra_items_tobeadded); 1950 1951 1952 1953 var sw = false; // -- if we find 1954 var k_found = null; 1955 1956 for(var i24 in extra_items_tobeadded){ 1957 1958 1959 // console.info(extra_items_tobeadded[i24]); 1960 1961 if(extra_items_tobeadded[i24].selector == aux_split[i233]){ 1962 sw = true; 1963 1964 // console.info("K FOUND"); 1965 k_found = i24; 1966 break; 1967 } 1968 1969 1970 1971 1972 1973 } 1974 1975 1976 if(sw){ 1977 var _c = extra_items_tobeadded[k_found]; 1978 if($(_c.selector).length>0){ 1979 1980 $(_c.selector).eq(0).html(_c.html); 1981 }else{ 1982 1983 1984 if(dzsajx_settings.extra_items_to_be_added_before_elements){ 1985 1986 $(dzsajx_settings.extra_items_to_be_added_before_elements).before(_c.outer_html); 1987 1988 }else{ 1989 1990 _body.append(_c.outer_html); 1991 } 1992 // _content.before(_c.outer_html) 1993 } 1994 }else{ 1995 1996 // -- if we do not find it in the new page we remove it from the current one
1997 if($(aux_split[i233]).length>0){ 1998 1999 $(aux_split[i233]).eq(0).remove();; 2000 } 2001 } 2002 2003 2004 2005 } 2006 extra_items_tobeadded = []; 2007 2008 2009 2010 2011 } 2012 2013 2014 // if(dzsajx_settings.extra_items_to_be_added){ 2015 // 2016 // // console.info(extra_items_tobeadded); 2017 // for(var i24 in extra_items_tobeadded){ 2018 // 2019 // 2020 // // console.info(extra_items_tobeadded[i24]); 2021 // 2022 // 2023 // var _c = extra_items_tobeadded[i24]; 2024 // 2025 // 2026 // if($(_c.selector).length>0){ 2027 // 2028 // $(_c.selector).eq(0).html(_c.html); 2029 // }else{ 2030 // _body.append(_c.outer_html); 2031 // } 2032 // } 2033 // extra_items_tobeadded = []; 2034 // } 2035 2036 2037 if(_preloader){ 2038 _preloader.find('.the-bar').animate({ 2039 'width': '100%' 2040 },{ 2041 queue:false 2042 ,duration: 300 2043 2044 }) 2045 _preloader.removeClass('active'); 2046 } 2047 2048 2049 _dzsajx_styles_con.children().remove(); 2050 2051 2052 for(var i3 = 0; i3<stylesheets_tobeadded.length;i3++){ 2053 _dzsajx_styles_con.append(stylesheets_tobeadded[i3]); 2054 } 2055 2056 2057 // -- here we add new page html 2058 if(_html_for_classes.hasClass('dzsajx-ajax-user-transitioning-out')){ 2059 2060 2061 2062 _content.find('.user-query').eq(0).after(new_page_html); 2063 _content.find('.user-query').eq(0).remove(); 2064 //_content.append(new_page_html); 2065 2066 }else{ 2067 2068 2069 2070 if(_contentContainer){ 2071 _contentContainer.append(_content.clone()); 2072 _contentContainer.children().last().removeClass('curr-content'); 2073 _contentContainer.children().last().addClass('transitioning-content'); 2074 _contentContainer.children().last().html(new_page_html); 2075 2076 2077 2078 2079 2080 2081 // console.info(_contentContainer.outerHeight()) 2082 // 2083 // _contentContainer.css({ 2084 // 'height': _contentContainer.outerHeight() 2085 // }) 2086 2087 2088 _contentTransitioning = _contentContainer.children('.transitioning-content').eq(0); 2089 2090 _contentTransitioning.css({ 2091 'height' : 'auto' 2092 ,'position':'relative' 2093 }) 2094 2095 var auxh = _contentTransitioning.outerHeight(); 2096 2097 2098 // console.info(auxh); 2099 2100 2101 _contentTransitioning.css({ 2102 'height' : '' 2103 ,'position':'' 2104 }) 2105 2106 2107 _contentContainer.animate({ 2108 'height': auxh 2109 },{ 2110 duration: 800 2111 ,complete: function(){ 2112 // console.info('ceva',this); 2113 } 2114 }) 2115 2116 2117 }else{ 2118 2119 _content=_content.next(); 2120 _content.removeClass('last-content'); 2121 _content.addClass('curr-content'); 2122 _content.show(); 2123 2124 // console.info("REMOVING CONTENT"); 2125 // -- removing content 2126 2127 if(_dzsajx_caches_con){ 2128 2129 _content.parent().find('.dzsajx-content.last-content:not(".in-cache")').attr('the_href',old_href); 2130 _content.parent().find('.dzsajx-content.last-content:not(".in-cache")').attr('class_body',old_class_body); 2131 2132 console.info("SAVED CLASS BODY",old_class_body); 2133 // console.info(old_href); 2134 2135 var sw = false; 2136 // for(var i25 in pages_caches){ 2137 _dzsajx_caches_con.children().each(function() { 2138 2139 // var _t23 = pages_caches[i25]; 2140 var _t23 = $(this); 2141 ; 2142 2143 // if (_t23.attr('the_href') == old_href) { 2144 // _t23 = $('.dzsajx-content.last-content'); 2145 // sw = true; 2146 // // break; 2147 // } 2148 // } 2149 }) 2150 2151 2152 if(sw==false){ 2153 2154 // pages_caches.push(_content.prev()); 2155 2156 console.info('last content - ', $('.dzsajx-content.last-content')); 2157 _dzsajx_caches_con.append($('.dzsajx-content.last-content')); 2158 _dzsajx_caches_con.children().addClass('in-cache'); 2159 _content.parent().find('.dzsajx-content.last-content:not(".in-cache")').remove() 2160 2161 } 2162 2163 2164 2165 }else{ 2166 2167 _content.prev().remove(); 2168 } 2169 2170 setTimeout(function(){ 2171 console.warn(pages_caches); 2172 },1000); 2173 execute_scripts_to_be_executed(); 2174 } 2175 setTimeout(function(){ 2176 2177 _html_for_classes.addClass('dzsajx-ajax-transitioning-in'); 2178 },50) 2179 2180 } 2181 2182 2183 reinit(); 2184 2185 _html_for_classes.removeClass('dzsajx-ajax-loading '); 2186 setTimeout(function(){ 2187 2188 _html_for_classes.removeClass('dzsajx-ajax-transitioning-out'); 2189 },500); 2190 2191 2192 2193 2194 2195 setTimeout(function(){ 2196 2197 2198 if(dzsajx_settings.scripts_reinit_document_ready=='on'){ 2199 2200 // console.info("TRIGGER READY"); 2201 jQuery.triggerReady(); 2202 2203 setTimeout(function(){ 2204 jQuery.triggerLoad(); 2205 },1000); 2206 } 2207 2208 2209 2210 if(dzsajx_settings.script_call_on_reinit){ 2211 try{ 2212 eval(dzsajx_settings.script_call_on_reinit) 2213 }catch(err){ 2214 console.warn(err); 2215 console.info('eval error - ',err, err.stack); 2216 } 2217 } 2218 2219 2220 // return; 2221 _html_for_classes.removeClass('dzsajx-ajax-transitioning-in'); 2222 _html_for_classes.removeClass('dzsajx-ajax-user-transitioning-out'); 2223 2224 if(_contentContainer){ 2225 2226 _contentContainer.children().first().remove();
2227 _contentContainer.children().last().removeClass('transitioning-content'); 2228 2229 _content = _contentContainer.children().last(); 2230 2231 _content.unwrap(); 2232 _contentContainer = null; 2233 // _contentContainer.children().last().removeClass('transitioning-content'); 2234 2235 execute_scripts_to_be_executed(); 2236 } 2237 2238 2239 2240 },1000); 2241 2242 2243 2244 // if(bg_transition=='fade'){ 2245 // //_mainBg.addClass('for-remove'); 2246 // // 2247 // //var aux9000 = _mainBg; 2248 // // 2249 // //setTimeout(function(){ 2250 // // 2251 // // if(aux9000.get(0) && aux9000.get(0).api_destroy){ 2252 // // 2253 // // aux9000.get(0).api_destroy(); 2254 // // } 2255 // //},300); 2256 // 2257 // 2258 // }else{ 2259 // 2260 // //if(_mainBg.get(0) && _mainBg.get(0).api_destroy){ 2261 // // 2262 // // _mainBg.get(0).api_destroy(); 2263 // //} 2264 // } 2265 2266 busy_main_transition=true; 2267 new_page_not_loaded_yet = false; 2268 } 2269 2270 2271 2272 2273 function execute_scripts_to_be_executed(){ 2274 if(scripts_tobeexecuted.length>0){ 2275 // if(scripts_tobeexecuted.each){ 2276 // 2277 // } 2278 for(var i in scripts_tobeexecuted){ 2279 var _t23 = scripts_tobeexecuted[i]; 2280 // var _t_html = _t23.html(); 2281 2282 if(_t23){ 2283 2284 // console.warn(_t23); 2285 2286 2287 try{ 2288 var sn = document.createElement('script'); 2289 2290 2291 2292 var aux = _t23.content; 2293 if(dzsajx_settings.remove_document_ready && dzsajx_settings.remove_document_ready=='on'){ 2294 // aux = aux.replace() 2295 2296 // console.info(aux); 2297 2298 if(aux.indexOf('jQuery(document).ready')>-1){ 2299 2300 aux = aux.replace(/jQuery\(document\).ready\(function.*?{/g, ''); 2301 2302 2303 var n = aux.lastIndexOf('})'); 2304 2305 window.$ = jQuery; 2306 2307 // console.info(n, '})'.length, aux.length); 2308 if (n >= 0 && n + '})'.length <= aux.length) { 2309 // console.info("ALCEVA"); 2310 aux = aux.substring(0, n) + ""; 2311 } 2312 // console.warn(aux); 2313 } 2314 } 2315 sn.appendChild(document.createTextNode(aux)); 2316 2317 2318 // type= 2319 2320 2321 var regexS = /['|"](.*?)['|"]/gim; 2322 var regtest = regexS.exec(_t23.attr); 2323 2324 2325 // console.info(regex, regtest); 2326 if(regtest != null){ 2327 //var splitterS = regtest; 2328 2329 2330 // console.info(regtest); 2331 if(regtest[1]){ 2332 $(sn).attr('type', regtest[1]); 2333 }else{ 2334 2335 } 2336 2337 2338 } 2339 // $(sn).attr('async', 'async'); 2340 2341 sn.async=true; 2342 2343 try{ 2344 _dzsajx_scripts_tbe_con.get(0).appendChild(sn); 2345 }catch(err){ 2346 console.info('err', err); 2347 } 2348 }catch(err){ 2349 // console.log(err); 2350 } 2351 2352 } 2353 } 2354 2355 scripts_tobeexecuted = []; 2356 } 2357 2358 setTimeout(function(){ 2359 2360 $(window).trigger('resize'); 2361 },1000); 2362 } 2363 2364 2365 2366 2367 function reinit(){ 2368 2369 console.log('reinit()'); 2370 2371 2372 $("html, body").animate({ scrollTop: 0 }, "fast"); 2373 2374 2375 2376 2377 2378 2379 2380 setTimeout(function(){ 2381 reinit_all_loaded(); 2382 },700); 2383 2384 2385 2386 } 2387 2388 2389 2390 function reinit_all_loaded(pargs){ 2391 2392 2393 var margs = { 2394 check_tracks_list: true 2395 ,animate_shortcode_user: true 2396 }; 2397 2398 if(pargs){ 2399 margs = $.extend(margs,pargs); 2400 } 2401 2402 _html_for_classes.addClass('reinited'); 2403 2404 //console.info($('.audioplayer')); 2405 2406 busy_main_transition=false; 2407 2408 if(refresh_menu){ 2409 2410 if(_theActualNav) { 2411 _theActualNav = $(dzsajx_settings.menu_selector); 2412 } 2413 } 2414 2415 //console.info($('.audioplayer')) 2416 2417 2418 } 2419 2420}); 2421 2422 2423 2424function is_touch_device() { 2425 //return true; 2426 return !!('ontouchstart' in window); 2427} 2428 2429 2430function can_history_api() { 2431 return !!(window.history && history.pushState); 2432} 2433 2434function is_android() { 2435 return true; 2436 var ua = navigator.userAgent.toLowerCase(); 2437 return (ua.indexOf("android") > -1); 2438} 2439 2440 2441
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.