| 1 |
(function( $ ) { |
| 2 |
'use strict'; |
| 3 |
/** |
| 4 |
* All of the code for your admin-facing JavaScript source |
| 5 |
* should reside in this file. |
| 6 |
* |
| 7 |
* Note: It has been assumed you will write jQuery code here, so the |
| 8 |
* $ function reference has been prepared for usage within the scope |
| 9 |
* of this function. |
| 10 |
* |
| 11 |
* This enables you to define handlers, for when the DOM is ready: |
| 12 |
* |
| 13 |
* $(function() { |
| 14 |
* |
| 15 |
* }); |
| 16 |
* |
| 17 |
* When the window is loaded: |
| 18 |
* |
| 19 |
* $( window ).load(function() { |
| 20 |
* |
| 21 |
* }); |
| 22 |
* |
| 23 |
* ...and/or other possibilities. |
| 24 |
* |
| 25 |
* Ideally, it is not considered best practise to attach more than a |
| 26 |
* single DOM-ready or window-load handler for a particular page. |
| 27 |
* Although scripts in the WordPress core, Plugins and Themes may be |
| 28 |
* practising this, we should strive to set a better example in our own work. |
| 29 |
*/ |
| 30 |
|
| 31 |
$(document).ready(function(){ |
| 32 |
|
| 33 |
$( '#wpvr-gopro-submenu' ).parent().attr( 'target', '_blank' ); |
| 34 |
|
| 35 |
$(".choose-tour input[type='radio']").on('click', function(){ |
| 36 |
var val = $(this).val(); |
| 37 |
$('#'+val).show(); |
| 38 |
$('#'+val).siblings().hide(); |
| 39 |
}); |
| 40 |
}); |
| 41 |
|
| 42 |
$(document).on("click","#wpvr-dismissible",function(e) { |
| 43 |
|
| 44 |
e.preventDefault(); |
| 45 |
var ajaxurl = wpvr_global_obj.ajaxurl; |
| 46 |
jQuery.ajax({ |
| 47 |
type: "POST", |
| 48 |
url: ajaxurl, |
| 49 |
data: { |
| 50 |
action: "wpvr_notice", |
| 51 |
nonce : wpvr_global_obj.ajax_nonce |
| 52 |
}, |
| 53 |
success: function( response ){ |
| 54 |
$('#wpvr-warning').hide(); |
| 55 |
} |
| 56 |
}); |
| 57 |
}); |
| 58 |
|
| 59 |
// video setup wizard__video |
| 60 |
$( document ).on( 'click', '.box-video', function() { |
| 61 |
$('iframe',this)[0].src += "?autoplay=1"; |
| 62 |
$(this).addClass('open'); |
| 63 |
}); |
| 64 |
|
| 65 |
$(document).on('click','.wpvr-halloween-notice .notice-dismiss',function (){ |
| 66 |
var ajaxurl = wpvr_global_obj.ajaxurl; |
| 67 |
jQuery.ajax({ |
| 68 |
type: "POST", |
| 69 |
url: ajaxurl, |
| 70 |
data: { |
| 71 |
action: "wpvr_notice", |
| 72 |
nonce : wpvr_global_obj.ajax_nonce |
| 73 |
}, |
| 74 |
}); |
| 75 |
}) |
| 76 |
|
| 77 |
$(document).on('click','#wpvr-copy-shortcode-listing',function() { |
| 78 |
var shortcode = $(this).parent().find('.wpvr-code').text(); // Get the shortcode text |
| 79 |
copyToClipboard(shortcode,$(this)); // Copy the shortcode to clipboard |
| 80 |
}); |
| 81 |
|
| 82 |
function copyToClipboard(text,current) { |
| 83 |
|
| 84 |
var tempInput = $("<input>"); |
| 85 |
$("body").append(tempInput); |
| 86 |
tempInput.val(text).select(); |
| 87 |
document.execCommand("copy"); |
| 88 |
tempInput.remove(); |
| 89 |
current.find('.copy-shortcode-text').show(); |
| 90 |
|
| 91 |
setTimeout(function(){ |
| 92 |
current.find(".copy-shortcode-text").hide(); |
| 93 |
}, 2000 ); |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
})( jQuery ); |
| 102 |
|
| 103 |
|