jQuery( document ).ready( function($){ $( '.shiftnav_instance_notice_close, .shiftnav_instance_close' ).on( 'click' , function(){ $( '.shiftnav_instance_wrap' ).fadeOut(); }); $( '.shiftnav_instance_wrap' ).on( 'click' , function(e){ if( $( e.target ).hasClass( 'shiftnav_instance_wrap' ) ){ $(this).fadeOut(); } }); $( '.shiftnav_instance_toggle' ).on( 'click' , function(){ $( '.shiftnav_instance_container_wrap' ).fadeIn(); $( '.shiftnav_instance_container_wrap .shiftnav_instance_input' ).focus(); }); $form = $( 'form.shiftnav_instance_form' ); $form.on( 'submit' , function(e){ e.preventDefault(); shiftnav_save_instance(); return false; }); $( '.shiftnav_instance_create_button' ).on( 'click' , function(e){ e.preventDefault(); shiftnav_save_instance(); return false; }); function shiftnav_save_instance(){ var data = { action: 'shiftnav_add_instance', shiftnav_data: $form.serialize(), shiftnav_nonce: $form.find( '#_wpnonce' ).val() }; // We can also pass the url value separately from ajaxurl for front end AJAX implementations jQuery.post( ajaxurl, data, function(response) { console.log( response ); if( response == -1 ){ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_notice_error' ).fadeIn(); $( '.shiftnav-error-message' ).text( 'Please try again.' ); return; } else if( response.error ){ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_notice_error' ).fadeIn(); $( '.shiftnav-error-message' ).text( response.error ); return; } else{ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_notice_success' ).fadeIn(); } }, 'json' ).fail( function(){ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_notice_error' ).fadeIn(); }); } $( '.shiftnav_instance_button_delete' ).on( 'click' , function( e ){ e.preventDefault(); if( confirm( 'Are you sure you want to delete this ShiftNav Instance?' ) ){ shiftnav_delete_instance( $(this) ); } return false; }); function shiftnav_delete_instance( $a ){ var data = { action: 'shiftnav_delete_instance', shiftnav_data: { 'shiftnav_instance_id' : $a.data( 'shiftnav-instance-id' ) }, shiftnav_nonce: $a.data( 'shiftnav-nonce' ) }; //console.log( data ); jQuery.post( ajaxurl, data, function(response) { console.log( response ); if( response == -1 ){ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_delete_notice_error' ).fadeIn(); $( '.shiftnav-delete-error-message' ).text( 'Please try again.' ); return; } else if( response.error ){ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_delete_notice_error' ).fadeIn(); $( '.shiftnav-delete-error-message' ).text( response.error ); return; } else{ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_delete_notice_success' ).fadeIn(); var id = response.id; $( '#shiftnav_'+id+', #shiftnav_'+id+'-tab' ).remove(); //delete tab and content $( '.nav-tab-wrapper > a' ).first().click(); //switch to first tab } }, 'json' ).fail( function(){ $( '.shiftnav_instance_container_wrap' ).fadeOut(); $( '.shiftnav_instance_delete_notice_error' ).fadeIn(); }); } function shift_selectText( element ) { var doc = document //, text = element //doc.getElementById(element) , range, selection ; if (doc.body.createTextRange) { //ms range = doc.body.createTextRange(); range.moveToElementText( element ); range.select(); } else if (window.getSelection) { //all others selection = window.getSelection(); range = doc.createRange(); range.selectNodeContents( element ); selection.removeAllRanges(); selection.addRange(range); } } $( '.shiftnav-highlight-code' ).on( 'click' , function(e){ shift_selectText( $(this)[0] ); }); //Open Hash Tab setTimeout( function(){ if( window.location.hash ){ //console.log( window.location.hash + '-tab ' + $( window.location.hash + '-tab' ).size() ); $( window.location.hash + '-tab' ).click(); } } , 500 ); }); https://www.tphcm.city/post-sitemap1.xml 2025-09-25T07:30:05+00:00 https://www.tphcm.city/post-sitemap2.xml 2025-09-25T02:55:26+00:00 https://www.tphcm.city/post-sitemap3.xml 2025-09-25T01:29:18+00:00 https://www.tphcm.city/post-sitemap4.xml 2025-09-25T00:42:28+00:00 https://www.tphcm.city/post-sitemap5.xml 2025-09-25T00:42:15+00:00 https://www.tphcm.city/post-sitemap6.xml 2025-09-24T20:40:55+00:00 https://www.tphcm.city/post-sitemap7.xml 2025-09-24T17:57:34+00:00 https://www.tphcm.city/post-sitemap8.xml 2025-09-24T06:42:07+00:00 https://www.tphcm.city/post-sitemap9.xml 2025-09-24T06:12:03+00:00 https://www.tphcm.city/post-sitemap10.xml 2025-09-24T02:23:39+00:00 https://www.tphcm.city/post-sitemap11.xml 2025-09-24T01:10:01+00:00 https://www.tphcm.city/post-sitemap12.xml 2025-09-24T01:09:05+00:00 https://www.tphcm.city/post-sitemap13.xml 2025-09-23T22:39:46+00:00 https://www.tphcm.city/post-sitemap14.xml 2025-09-23T18:55:13+00:00 https://www.tphcm.city/post-sitemap15.xml 2025-09-23T14:34:38+00:00 https://www.tphcm.city/post-sitemap16.xml 2025-09-23T01:24:08+00:00 https://www.tphcm.city/post-sitemap17.xml 2025-09-23T01:23:40+00:00 https://www.tphcm.city/post-sitemap18.xml 2025-09-23T00:15:57+00:00 https://www.tphcm.city/post-sitemap19.xml 2025-09-22T23:21:23+00:00 https://www.tphcm.city/post-sitemap20.xml 2025-09-22T19:13:38+00:00 https://www.tphcm.city/post-sitemap21.xml 2025-09-22T04:02:33+00:00 https://www.tphcm.city/post-sitemap22.xml 2025-09-22T02:52:17+00:00 https://www.tphcm.city/post-sitemap23.xml 2025-09-22T02:25:04+00:00 https://www.tphcm.city/post-sitemap24.xml 2025-09-21T20:46:29+00:00 https://www.tphcm.city/post-sitemap25.xml 2025-09-21T14:05:37+00:00 https://www.tphcm.city/post-sitemap26.xml 2025-09-21T06:18:57+00:00 https://www.tphcm.city/post-sitemap27.xml 2025-09-21T05:52:06+00:00 https://www.tphcm.city/post-sitemap28.xml 2025-09-21T04:13:46+00:00 https://www.tphcm.city/page-sitemap.xml 2021-05-30T07:06:11+00:00 https://www.tphcm.city/category-sitemap.xml 2025-09-25T07:30:05+00:00