PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 8.5.36
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v8.5.36
9.1.3 9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 All 222 releases
wpvr / admin / js / wpvr-tour-guide.js

wpvr-tour-guide.js in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 8.5.36, at admin/js/wpvr-tour-guide.js

552 lines 19.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function( $ ) {
2 'use strict';
3
4 $(document).ready(function(){
5 var main_tour = new Shepherd.Tour();
6 var guide_tranlation = window.wpvr_tour_guide_obj.Tour_Guide_Translation
7 main_tour.options.defaults = {
8 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour shadow-md bg-purple-dark',
9 showCancelLink: true,
10 useModalOverlay: true,
11 scrollTo: true,
12 tetherOptions: {
13 constraints: [
14 {
15 to: 'scrollParent',
16 attachment: 'together',
17 pin: false
18 }
19 ]
20 }
21 };
22 var next_button_text = guide_tranlation.next_button_text;
23 var back_button_text = guide_tranlation.previous_button_text;
24
25 //Start Sences guide tour
26
27 main_tour.addStep('tour_title', {
28 title: guide_tranlation.tour_title.title,
29 text: guide_tranlation.tour_title.text,
30 attachTo: '#post-body-content bottom',
31 buttons: [
32 {
33 classes: 'udp-tour-end',
34 text: guide_tranlation.end_tour,
35 action: main_tour.cancel
36 },
37 {
38 classes: 'button button-primary',
39 text: next_button_text,
40 action: main_tour.next,
41 }
42 ],
43 when: {
44 show: function() {
45 scroll_to_popup();
46 }
47 }
48 })
49 main_tour.addStep('scene_section', {
50 title: guide_tranlation.scene_section.title,
51 text: guide_tranlation.scene_section.text,
52 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
53 attachTo: '.single-scene.rex-pano-tab.active .sceneid right',
54 buttons: [
55 {
56 classes: 'udp-tour-back',
57 text: back_button_text,
58 action: function() {
59 main_tour.back();
60 }
61 },
62 {
63 classes: 'button button-primary',
64 text: next_button_text,
65 action: main_tour.next
66 }
67 ],
68 when: {
69 show: function() {
70 scroll_to_popup();
71 }
72 }
73 });
74
75 main_tour.addStep('upload_image', {
76 title: guide_tranlation.upload_image.title,
77 text: guide_tranlation.upload_image.text,
78 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
79 attachTo: '.single-scene.rex-pano-tab.active .scene-upload right',
80 buttons: [
81 {
82 classes: 'udp-tour-back',
83 text: back_button_text,
84 action: function() {
85 main_tour.back();
86 }
87 },
88 {
89 classes: 'button button-primary',
90 text: next_button_text,
91 action: main_tour.next
92 }
93 ],
94 when: {
95 show: function() {
96 scroll_to_popup();
97 }
98 }
99 });
100
101 $('.single-scene.rex-pano-tab.active .scene-upload').on('click',function(event){
102 main_tour.hide()
103 if($(this).parent().find('.wpvr_continue_guide').length == 0 && !main_tour.canceled ){
104 $(this).parent().append('<span class="wpvr_continue_guide" >Continue to guide</span>');
105 }
106 })
107 $(document).on('click', "span.wpvr_continue_guide", function() {
108 $(this).remove();
109 main_tour.show("preview_tour_button")
110 $('body').addClass('shepherd-active')
111 });
112
113
114
115
116 main_tour.addStep('preview_tour_button', {
117 title: guide_tranlation.preview_tour_button.title,
118 text: guide_tranlation.preview_tour_button.text,
119 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
120 attachTo: '#panolenspreview left',
121 buttons: [
122 {
123 classes: 'udp-tour-back',
124 text: back_button_text,
125 action: function() {
126 main_tour.back();
127 }
128 },
129 {
130 classes: 'button button-primary',
131 text: next_button_text,
132 action: main_tour.next
133 }
134 ],
135 when: {
136 show: function() {
137 scroll_to_popup();
138 }
139 }
140 });
141 main_tour.addStep('preview_tour_section', {
142 title: guide_tranlation.preview_tour_section.title,
143 text: guide_tranlation.preview_tour_section.text,
144 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
145 attachTo: '#wpvr_item_builder__box left',
146
147 buttons: [
148 {
149 classes: 'udp-tour-back',
150 text: back_button_text,
151 action: function() {
152 main_tour.back();
153 }
154 },
155 {
156 classes: 'button button-primary',
157 text: next_button_text,
158 action: main_tour.next
159 }
160 ],
161 when: {
162 show: function() {
163 scroll_to_popup();
164 }
165 }
166 });
167 main_tour.addStep('publish_tour', {
168 title: guide_tranlation.publish_tour.title,
169 text: guide_tranlation.publish_tour.text,
170 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
171 attachTo: '#publishing-action left',
172 buttons: [
173 {
174 classes: 'udp-tour-back',
175 text: back_button_text,
176 action: function() {
177 main_tour.back();
178 }
179 },
180 {
181 classes: 'button button-primary',
182 text: next_button_text,
183 action: main_tour.next
184 }
185 ],
186 when: {
187 show: function() {
188 scroll_to_popup();
189 }
190 }
191 });
192 main_tour.addStep('sence_end', {
193 title: guide_tranlation.sence_end.title,
194 text: "Now your tour is ready to be published on your website.\n" +
195 "\n" +
196 "To learn how to publish it on your website,<a href='https://rextheme.com/docs/wp-vr-wpvr-shortcode-embed-virtual-tour/' target='_blank'> follow this detailed documentation.\n</a>" +
197 "\n" +
198 " To continue customizing this tour, click on Next.",
199 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
200 attachTo: '.rex-pano-tabs',
201 buttons: [
202 {
203 classes: 'udp-tour-back',
204 text: back_button_text,
205 action: function() {
206 main_tour.back();
207 }
208 },
209 {
210 classes: 'button button-primary',
211 text: "Start Customizing",
212 // action: main_tour.next
213 action: function() {
214 main_tour.next()
215 $(".rex-pano-nav-menu.main-nav ul li.hotspot span").trigger('click')
216 }
217 }
218 ],
219 when: {
220 show: function() {
221 scroll_to_popup();
222 }
223 }
224 });
225
226 // End scenes Tour Guide
227
228 // Start Hotspot
229 main_tour.addStep('hotspot_start', {
230 title: guide_tranlation.hotspot_start.title,
231 text: guide_tranlation.hotspot_start.text,
232 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
233 attachTo: '#wpvr-main-nav .hotspot right',
234 buttons: [
235 {
236 classes: 'udp-tour-back',
237 text: back_button_text,
238 action: function() {
239 main_tour.back();
240 $(".rex-pano-nav-menu.main-nav ul li.scene span").trigger('click')
241 }
242 },
243 {
244 classes: 'button button-primary',
245 text: next_button_text,
246 action: main_tour.next
247 }
248 ],
249 when: {
250 show: function() {
251 scroll_to_popup();
252 }
253 }
254 });
255 main_tour.addStep('hotspot_id', {
256 title: guide_tranlation.hotspot_id.title,
257 text: guide_tranlation.hotspot_id.text,
258 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
259 attachTo: '#scene-1-hotspot-1 .hotspot-setting right',
260 buttons: [
261 {
262 classes: 'udp-tour-back',
263 text: back_button_text,
264 action: function() {
265 main_tour.back();
266 }
267 },
268 {
269 classes: 'button button-primary',
270 text: next_button_text,
271 // action: main_tour.next
272 action: function() {
273 var post_ID = $("#post_ID").val();
274 $(".pnlm-ui.pnlm-grab").trigger('click');
275 main_tour.next()
276
277 }
278 }
279 ],
280 when: {
281 show: function() {
282 scroll_to_popup();
283 }
284 }
285 });
286 main_tour.addStep('choose_previwer', {
287 title: guide_tranlation.choose_previwer.title,
288 text: guide_tranlation.choose_previwer.text,
289 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
290 attachTo: '#wpvr_item_builder__box left',
291 buttons: [
292 {
293 classes: 'udp-tour-back',
294 text: back_button_text,
295 action: function() {
296 main_tour.back();
297 }
298 },
299 {
300 classes: 'button button-primary',
301 text: next_button_text,
302 action: main_tour.next
303 }
304 ],
305 when: {
306 show: function() {
307 scroll_to_popup();
308 }
309 }
310 });
311 main_tour.addStep('assigin_pitch_yaw', {
312 title: guide_tranlation.assigin_pitch_yaw.title,
313 text: guide_tranlation.assigin_pitch_yaw.text,
314 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
315 attachTo: '#panodata right',
316 buttons: [
317 {
318 classes: 'udp-tour-back',
319 text: back_button_text,
320 action: function() {
321 main_tour.back();
322 }
323 },
324 {
325 classes: 'button button-primary',
326 text: next_button_text,
327 action: main_tour.next
328 }
329 ],
330 when: {
331 show: function() {
332 scroll_to_popup();
333 }
334 }
335 });
336 main_tour.addStep('pitch_yaw_set', {
337 title: guide_tranlation.pitch_yaw_set.title,
338 text: guide_tranlation.pitch_yaw_set.text,
339 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
340 attachTo: '#scene-1-hotspot-1 .hotspot-pitch right',
341 buttons: [
342 {
343 classes: 'udp-tour-back',
344 text: back_button_text,
345 action: function() {
346 main_tour.back();
347 }
348 },
349 {
350 classes: 'button button-primary',
351 text: next_button_text,
352 action: main_tour.next
353 }
354 ],
355 when: {
356 show: function() {
357 scroll_to_popup();
358 }
359 }
360 });
361 main_tour.addStep('pitch_yaw_set_2', {
362 title: guide_tranlation.pitch_yaw_set_2.title,
363 text: guide_tranlation.pitch_yaw_set_2.text,
364 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
365 attachTo: '#scene-1-hotspot-1 .hotspot-yaw right',
366 buttons: [
367 {
368 classes: 'udp-tour-back',
369 text: back_button_text,
370 action: function() {
371 main_tour.back();
372 }
373 },
374 {
375 classes: 'button button-primary',
376 text: next_button_text,
377 action: main_tour.next
378 }
379 ],
380 when: {
381 show: function() {
382 scroll_to_popup();
383 }
384 }
385 });
386 main_tour.addStep('on_click_content_info', {
387 title: guide_tranlation.on_click_content_info.title,
388 text: guide_tranlation.on_click_content_info.text,
389 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
390 attachTo: '#scene-1-hotspot-1 .hotspot-type.hotspot-setting:not(.hotspot-hover) top',
391 buttons: [
392 {
393 classes: 'udp-tour-back',
394 text: back_button_text,
395 action: function() {
396 main_tour.back();
397 }
398 },
399 {
400 classes: 'button button-primary',
401 text: next_button_text,
402 action: main_tour.next
403 }
404 ],
405 when: {
406 show: function() {
407 scroll_to_popup();
408 }
409 }
410 });
411 main_tour.addStep('on_hover_info', {
412 title: guide_tranlation.on_hover_info.title,
413 text: guide_tranlation.on_hover_info.text,
414 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
415 attachTo: '#scene-1-hotspot-1 .hotspot-hover top',
416 buttons: [
417 {
418 classes: 'udp-tour-back',
419 text: back_button_text,
420 action: function() {
421 main_tour.back();
422 }
423 },
424 {
425 classes: 'button button-primary',
426 text: next_button_text,
427 action: main_tour.next
428 }
429 ],
430 when: {
431 show: function() {
432 scroll_to_popup();
433 }
434 }
435 });
436 main_tour.addStep('preview_on_hotspot', {
437 title: guide_tranlation.preview_on_hotspot.title,
438 text: guide_tranlation.preview_on_hotspot.text,
439 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
440 attachTo: '#panolenspreview right',
441 buttons: [
442 {
443 classes: 'udp-tour-back',
444 text: back_button_text,
445 action: function() {
446 main_tour.back();
447 }
448 },
449 {
450 classes: 'button button-primary',
451 text: next_button_text,
452 action: main_tour.next
453 }
454 ],
455 when: {
456 show: function() {
457 scroll_to_popup();
458 }
459 }
460 });
461 main_tour.addStep('save_process_hotspot', {
462 title: guide_tranlation.save_process_hotspot.title,
463 text: guide_tranlation.save_process_hotspot.text,
464 classes: 'shepherd-theme-arrows-plain-buttons shepherd-main-tour super-index',
465 attachTo: '#publish left',
466 buttons: [
467 {
468 classes: 'udp-tour-back',
469 text: back_button_text,
470 action: function() {
471 main_tour.back();
472 }
473 },
474 {
475 classes: 'button button-primary',
476 text: guide_tranlation.done_text,
477 action: main_tour.complete
478 }
479 ],
480 when: {
481 show: function() {
482 scroll_to_popup();
483 }
484 }
485 });
486 //End Hotspot
487 /**
488 * Scroll to Popup
489 *
490 * @param {Object} step
491 */
492 var scroll_to_popup = function(step) {
493 main_tour.going_somewhere = false;
494 if (!step) {
495 step = main_tour.getCurrentStep();
496 }
497 var popup = $(step.el);
498 var target = $(step.tether.target);
499 $('body, html').animate({
500 scrollTop: popup.offset().top - 50
501 }, 500, function() {
502 window.scrollTo(0, popup.offset().top - 50);
503 });
504
505 }
506 main_tour.start();
507 main_tour.on('cancel', cancel_tour);
508
509 /**
510 * Cancel tour
511 */
512 function cancel_tour() {
513 // The tour is either finished or [x] was clicked
514 main_tour.canceled = true;
515 var get_param = getParameterByName("wpvr-guide-tour");
516 if(get_param == "1"){
517 var newUrl = updateParam("wpvr-guide-tour",0);
518 if (window.history != 'undefined' && window.history.pushState != 'undefined') {
519 window.history.pushState({ path: newUrl }, '', newUrl);
520 }
521 }
522 };
523
524 /**
525 * Get URL parameter By name
526 */
527 function getParameterByName(name, url = window.location.href) {
528 name = name.replace(/[\[\]]/g, '\\$&');
529 var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
530 results = regex.exec(url);
531 if (!results) return null;
532 if (!results[2]) return '';
533 return decodeURIComponent(results[2].replace(/\+/g, ' '));
534 }
535 /**
536 * Delete parameter By name
537 */
538 function updateParam (name,value, url = window.location.href){
539 var url = new URL(url);
540 var search_params = url.searchParams;
541 search_params.delete(name);
542
543 url.search = search_params.toString();
544
545 var new_url = url.toString();
546
547 return new_url;
548 }
549
550 })
551
552 })( jQuery );