| @@ -114,16 +114,28 @@ | ||
| 114 | 114 | <?php $this->render_default_repeater_item(); ?> |
| 115 | 115 | </div> |
| 116 | 116 | <!-- Empty repeater end --> |
| 117 | 117 | |
| 118 | - <?php $s = 1; $firstvalue = reset($postdata['panodata']["scene-list"]); | |
| 119 | - foreach ($postdata['panodata']["scene-list"] as $pano_scene) { ?> | |
| 118 | + <?php | |
| 119 | + if ( ! empty( $postdata['panodata']["scene-list"] ) && is_array( $postdata['panodata']["scene-list"] ) ) { | |
| 120 | + $s = 1; $firstvalue = reset($postdata['panodata']["scene-list"]); | |
| 121 | + $default_scene = $postdata['defaultscene'] ?? ($firstvalue['scene-id'] ?? ''); | |
| 122 | + foreach ($postdata['panodata']["scene-list"] as $pano_scene) { | |
| 123 | + if ( ! is_array( $pano_scene ) ) { | |
| 124 | + continue; | |
| 125 | + } | |
| 126 | + if ( ! isset( $pano_scene['dscene'] ) ) { | |
| 127 | + $pano_scene['dscene'] = ( ! empty( $default_scene ) && ( $pano_scene['scene-id'] ?? '' ) === $default_scene ) ? 'on' : 'off'; | |
| 128 | + } | |
| 129 | + $is_active = ( ( $pano_scene['scene-id'] ?? '' ) === ( $firstvalue['scene-id'] ?? '' ) ); | |
| 130 | + ?> | |
| 120 | 131 | |
| 121 | - <div data-repeater-item class="single-scene rex-pano-tab <?php if($pano_scene['scene-id'] == $firstvalue['scene-id']) { echo esc_attr('active'); }; ?>" data-title="1" id="scene-<?php echo esc_attr( $s ); ?>"> | |
| 132 | + <div data-repeater-item class="single-scene rex-pano-tab <?php if($is_active) { echo esc_attr('active'); }; ?>" data-title="1" id="scene-<?php echo esc_attr( $s ); ?>"> | |
| 122 | 133 | <?php $this->render_repeater_item_with_panodata($pano_scene, $s); ?> |
| 123 | 134 | </div> |
| 124 | 135 | |
| 125 | - <?php $s++; } ?> | |
| 136 | + <?php $s++; } | |
| 137 | + } ?> | |
| 126 | 138 | </div> |
| 127 | 139 | <?php |
| 128 | 140 | // ob_end_flush(); |
| 129 | 141 | } |
| @@ -141,18 +153,26 @@ | ||
| 141 | 153 | { |
| 142 | 154 | ob_start(); |
| 143 | 155 | ?> |
| 144 | 156 | <ul> |
| 145 | - <?php $i = 1; $firstvalue = reset($postdata['panodata']["scene-list"]); | |
| 146 | - foreach ($postdata['panodata']["scene-list"] as $pano_scene) { ?> | |
| 157 | + <?php | |
| 158 | + if ( ! empty( $postdata['panodata']["scene-list"] ) && is_array( $postdata['panodata']["scene-list"] ) ) { | |
| 159 | + $i = 1; $firstvalue = reset($postdata['panodata']["scene-list"]); | |
| 160 | + foreach ($postdata['panodata']["scene-list"] as $pano_scene) { | |
| 161 | + if ( ! is_array( $pano_scene ) ) { | |
| 162 | + continue; | |
| 163 | + } | |
| 164 | + $is_active = ( ( $pano_scene['scene-id'] ?? '' ) === ( $firstvalue['scene-id'] ?? '' ) ); | |
| 165 | + ?> | |
| 147 | 166 | |
| 148 | - <li class="<?php if ($pano_scene['scene-id'] == $firstvalue['scene-id']) {echo 'active';};?>"> | |
| 167 | + <li class="<?php if ($is_active) {echo 'active';};?>"> | |
| 149 | 168 | <span data-index="<?php echo esc_attr( $i ); ?>" data-href="#scene-<?php echo esc_attr( $i ); ?>"> |
| 150 | 169 | <i class="fa fa-image"></i> |
| 151 | 170 | </span> |
| 152 | 171 | </li> |
| 153 | 172 | |
| 154 | - <?php $i++; } ?> | |
| 173 | + <?php $i++; } | |
| 174 | + } ?> | |
| 155 | 175 | <li class="add" data-repeater-create><span><i class="fa fa-plus-circle"></i></span></li> |
| 156 | 176 | </ul> |
| 157 | 177 | <?php |
| 158 | 178 | ob_end_flush(); |
| @@ -660,8 +680,11 @@ | ||
| 660 | 680 | * @since 8.0.0 |
| 661 | 681 | */ |
| 662 | 682 | public function render_scene_shortcode($postdata, $panoid, $id, $radius, $width, $height, $mobile_height) |
| 663 | 683 | { |
| 684 | + if ( function_exists( 'wpvr_enqueue_frontend_scripts' ) ) { | |
| 685 | + wpvr_enqueue_frontend_scripts( 'scene' ); | |
| 686 | + } | |
| 664 | 687 | $postdata = is_array( $postdata ) ? wpvr_get_effective_panodata( $postdata ) : []; |
| 665 | 688 | $show_scene_info = ( $postdata['scene-info-enabled'] ?? 'on' ) !== 'off'; |
| 666 | 689 | $tour_layout = is_array( $postdata['tourLayout'] ?? null ) |
| 667 | 690 | ? ( $postdata['tourLayout']['layout'] ?? 'default' ) |
| @@ -885,10 +908,10 @@ | ||
| 885 | 908 | if (isset($postdata['scenefadeduration'])) { |
| 886 | 909 | $scene_fade_duration = $postdata['scenefadeduration']; |
| 887 | 910 | } |
| 888 | 911 | |
| 889 | - $panodata = ''; | |
| 890 | - if (isset($postdata['panodata'])) { | |
| 912 | + $panodata = array(); | |
| 913 | + if (isset($postdata['panodata']) && is_array($postdata['panodata'])) { | |
| 891 | 914 | $panodata = $postdata['panodata']; |
| 892 | 915 | } |
| 893 | 916 | |
| 894 | 917 | $hotspoticoncolor = '#00b4ff'; |
| @@ -1028,10 +1051,18 @@ | ||
| 1028 | 1051 | ob_start(); |
| 1029 | 1052 | do_action('wpvr_hotspot_content', $hotspot_data); |
| 1030 | 1053 | $hotspot_content = ob_get_clean(); |
| 1031 | 1054 | |
| 1032 | - if (!$hotspot_content) { | |
| 1033 | - $hotspot_content = $hotspot_data["hotspot-content"]; | |
| 1055 | + $is_fluent_form = isset($hotspot_data["hotspot-type"]) && 'fluent_form' === $hotspot_data["hotspot-type"]; | |
| 1056 | + | |
| 1057 | + if ($is_fluent_form) { | |
| 1058 | + if (!empty($hotspot_content)) { | |
| 1059 | + $hotspot_content = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script>/i', '', $hotspot_content); | |
| 1060 | + } | |
| 1061 | + } else { | |
| 1062 | + if (!$hotspot_content) { | |
| 1063 | + $hotspot_content = $hotspot_data["hotspot-content"] ?? ''; | |
| 1064 | + } | |
| 1034 | 1065 | } |
| 1035 | 1066 | |
| 1036 | 1067 | $hotspot_url = $this->normalize_hotspot_external_url($hotspot_data["hotspot-url"] ?? ''); |
| 1037 | 1068 | |
| @@ -1051,16 +1082,11 @@ | ||
| 1051 | 1082 | $hotspot_data['hotspot-hover'] ?? '' |
| 1052 | 1083 | ); |
| 1053 | 1084 | |
| 1054 | 1085 | |
| 1055 | - if('fluent_form' !== $hotspot_data["hotspot-type"]){ | |
| 1056 | - $on_hover_content = $this->sanitize_content_preserve_styles($on_hover_content ?? ''); | |
| 1057 | - $on_click_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_content ?? ''); | |
| 1058 | - $on_click_content = $this->sanitize_content_preserve_styles($on_click_content ?? ''); | |
| 1059 | - }else{ | |
| 1060 | - $on_hover_content = $on_hover_content ?? ''; | |
| 1061 | - $on_click_content = $hotspot_content ?? ''; | |
| 1062 | - } | |
| 1086 | + $on_hover_content = $this->sanitize_content_preserve_styles($on_hover_content ?? '', false); | |
| 1087 | + $on_click_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_content ?? ''); | |
| 1088 | + $on_click_content = $this->sanitize_content_preserve_styles($on_click_content ?? '', $is_fluent_form); | |
| 1063 | 1089 | |
| 1064 | 1090 | // Shape is independent of the optional custom icon in the |
| 1065 | 1091 | // new editor, so it must always be included in the public |
| 1066 | 1092 | // hotspot configuration. |
| @@ -1290,13 +1316,17 @@ | ||
| 1290 | 1316 | if(isset($postdata['customcss_enable']) && $postdata['customcss_enable'] == 'on'){ |
| 1291 | 1317 | $html .= isset($postdata['customcss']) ? $postdata['customcss'] : ''; |
| 1292 | 1318 | } |
| 1293 | 1319 | } |
| 1294 | - $panoid2 = 'pano2'.$id; | |
| 1320 | + $pano_suffix = (strpos($panoid, 'pano') === 0) ? substr($panoid, 4) : (string) $panoid; | |
| 1321 | + $panoid2 = 'pano2' . $pano_suffix; | |
| 1322 | + $master_container_id = ($panoid === 'pano' . $id) ? 'master-container' : ('master-container-' . $pano_suffix); | |
| 1295 | 1323 | $status = get_option('wpvr_edd_license_status'); |
| 1296 | - if ($status !== false && $status == 'valid') { | |
| 1324 | + if ($status !== false && $status == 'valid' && ! empty( $panodata['scene-list'] ) && is_array( $panodata['scene-list'] )) { | |
| 1297 | 1325 | foreach ($panodata['scene-list'] as $panoscenes){ |
| 1298 | - | |
| 1326 | + if ( empty( $panoscenes['hotspot-list'] ) || ! is_array( $panoscenes['hotspot-list'] ) ) { | |
| 1327 | + continue; | |
| 1328 | + } | |
| 1299 | 1329 | foreach($panoscenes['hotspot-list'] as $hotspot){ |
| 1300 | 1330 | if (isset($hotspot['hotspot-customclass-color-icon-value']) && !empty($hotspot['hotspot-customclass-color-icon-value'])) { |
| 1301 | 1331 | $hotspoticoncolor = $hotspot['hotspot-customclass-color-icon-value']; |
| 1302 | 1332 | } else { |
| @@ -1492,16 +1522,24 @@ | ||
| 1492 | 1522 | $animation_css = apply_filters('wpvr_tour_scene_animation',$animation_type,$animationDuration,$animationDelay,$postdata,$id); |
| 1493 | 1523 | $html .= $animation_css; |
| 1494 | 1524 | } |
| 1495 | 1525 | |
| 1526 | + $container_width = $width; | |
| 1527 | + $container_height = $height; | |
| 1528 | + $container_mobile_height = $mobile_height; | |
| 1529 | + | |
| 1496 | 1530 | if ($width == 'fullwidth') { |
| 1497 | - $width = "100%"; | |
| 1531 | + $container_width = "100%"; | |
| 1532 | + } elseif ($width == 'embed') { | |
| 1533 | + $container_width = "100%"; | |
| 1534 | + $container_height = "100%"; | |
| 1535 | + $container_mobile_height = "100%"; | |
| 1498 | 1536 | } |
| 1499 | 1537 | |
| 1500 | 1538 | if (wpvr_isMobileDevice()) { |
| 1501 | - $html .= '<div id="master-container" class="wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $width . '; width: 100%; height: ' . $mobile_height . '; border-radius:' . $radius . '; direction:ltr; ">'; | |
| 1539 | + $html .= '<div id="' . $master_container_id . '" class="wpvr-master-container wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $container_width . '; width: 100%; height: ' . $container_mobile_height . '; border-radius:' . $radius . '; direction:ltr; ">'; | |
| 1502 | 1540 | } else { |
| 1503 | - $html .= '<div id="master-container" class="wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $width . '; width: 100%; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr; ">'; | |
| 1541 | + $html .= '<div id="' . $master_container_id . '" class="wpvr-master-container wpvr-cardboard '.$enable_cardboard.'" style="max-width:' . $container_width . '; width: 100%; height: ' . $container_height . '; border-radius:' . $radius . '; direction:ltr; ">'; | |
| 1504 | 1542 | } |
| 1505 | 1543 | $is_pro = apply_filters('is_wpvr_pro_active',false); |
| 1506 | 1544 | $status = get_option('wpvr_edd_license_status'); |
| 1507 | 1545 | $is_cardboard = get_option('wpvr_cardboard_disable'); |
| @@ -1519,9 +1557,9 @@ | ||
| 1519 | 1557 | if($width == "embed"){ |
| 1520 | 1558 | $embed_mode = "vr-embade-mode"; |
| 1521 | 1559 | } |
| 1522 | 1560 | $html .= '<label class="wpvr-cardboard-switcher '.$embed_mode.'"> |
| 1523 | - <input type="checkbox" class="vr_mode_change' . $id . '" name="vr_mode_change" value="off"> | |
| 1561 | + <input type="checkbox" class="vr_mode_change' . $pano_suffix . '" name="vr_mode_change" value="off"> | |
| 1524 | 1562 | <span class="switcher-box"> |
| 1525 | 1563 | <span class="normal-mode-tooltip">Normal VR Mode</span> |
| 1526 | 1564 | <svg width="78" height="60" viewBox="0 0 78 60" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1527 | 1565 | <path d="M42.25 21.4286C42.25 22.2811 41.9076 23.0986 41.2981 23.7014C40.6886 24.3042 39.862 24.6429 39 24.6429C38.138 24.6429 37.3114 24.3042 36.7019 23.7014C36.0924 23.0986 35.75 22.2811 35.75 21.4286C35.75 20.5761 36.0924 19.7585 36.7019 19.1557C37.3114 18.5529 38.138 18.2143 39 18.2143C39.862 18.2143 40.6886 18.5529 41.2981 19.1557C41.9076 19.7585 42.25 20.5761 42.25 21.4286ZM19.5 30C18.9254 30 18.3743 30.2258 17.9679 30.6276C17.5616 31.0295 17.3333 31.5745 17.3333 32.1429C17.3333 32.7112 17.5616 33.2562 17.9679 33.6581C18.3743 34.06 18.9254 34.2857 19.5 34.2857H28.1667C28.7413 34.2857 29.2924 34.06 29.6987 33.6581C30.1051 33.2562 30.3333 32.7112 30.3333 32.1429C30.3333 31.5745 30.1051 31.0295 29.6987 30.6276C29.2924 30.2258 28.7413 30 28.1667 30H19.5ZM47.6667 32.1429C47.6667 31.5745 47.8949 31.0295 48.3013 30.6276C48.7076 30.2258 49.2587 30 49.8333 30H58.5C59.0746 30 59.6257 30.2258 60.0321 30.6276C60.4384 31.0295 60.6667 31.5745 60.6667 32.1429C60.6667 32.7112 60.4384 33.2562 60.0321 33.6581C59.6257 34.06 59.0746 34.2857 58.5 34.2857H49.8333C49.2587 34.2857 48.7076 34.06 48.3013 33.6581C47.8949 33.2562 47.6667 32.7112 47.6667 32.1429ZM32.5 0C31.9254 0 31.3743 0.225765 30.9679 0.627629C30.5616 1.02949 30.3333 1.57454 30.3333 2.14286V8.57143H18.4167C14.8693 8.57183 11.4528 9.89617 8.84994 12.2798C6.24706 14.6634 4.64954 17.9306 4.37667 21.4286H2.16667C1.59203 21.4286 1.04093 21.6543 0.634602 22.0562C0.228273 22.4581 0 23.0031 0 23.5714V36.4286C0 36.9969 0.228273 37.5419 0.634602 37.9438C1.04093 38.3457 1.59203 38.5714 2.16667 38.5714H4.33333V46.0714C4.33333 49.7655 5.81711 53.3083 8.45825 55.9204C11.0994 58.5325 14.6815 60 18.4167 60H25.3933C29.1269 59.9986 32.7071 58.5311 35.347 55.92L37.921 53.3786C38.0618 53.2393 38.229 53.1288 38.4131 53.0534C38.5971 52.978 38.7943 52.9392 38.9935 52.9392C39.1927 52.9392 39.3899 52.978 39.5739 53.0534C39.758 53.1288 39.9252 53.2393 40.066 53.3786L42.6357 55.92C45.2766 58.5322 48.8586 59.9998 52.5937 60H59.5833C63.3185 60 66.9006 58.5325 69.5418 55.9204C72.1829 53.3083 73.6667 49.7655 73.6667 46.0714V38.5714H75.8333C76.408 38.5714 76.9591 38.3457 77.3654 37.9438C77.7717 37.5419 78 36.9969 78 36.4286V23.5714C78 23.0031 77.7717 22.4581 77.3654 22.0562C76.9591 21.6543 76.408 21.4286 75.8333 21.4286H73.6233C73.3505 17.9306 71.753 14.6634 69.1501 12.2798C66.5472 9.89617 63.1307 8.57183 59.5833 8.57143H47.6667V2.14286C47.6667 1.57454 47.4384 1.02949 47.0321 0.627629C46.6257 0.225765 46.0746 0 45.5 0H32.5ZM69.3333 22.5V46.0714C69.3333 48.6289 68.3061 51.0816 66.4776 52.89C64.6491 54.6983 62.1692 55.7143 59.5833 55.7143H52.5937C50.0093 55.7132 47.5311 54.6973 45.7037 52.89L43.1297 50.3486C42.5864 49.8108 41.9413 49.3842 41.2312 49.0931C40.5211 48.8021 39.76 48.6522 38.9913 48.6522C38.2227 48.6522 37.4616 48.8021 36.7515 49.0931C36.0414 49.3842 35.3963 49.8108 34.853 50.3486L32.2833 52.89C30.4559 54.6973 27.9777 55.7132 25.3933 55.7143H18.4167C15.8308 55.7143 13.3509 54.6983 11.5224 52.89C9.6939 51.0816 8.66667 48.6289 8.66667 46.0714V22.5C8.66667 19.9426 9.6939 17.4899 11.5224 15.6815C13.3509 13.8731 15.8308 12.8571 18.4167 12.8571H59.5833C62.1692 12.8571 64.6491 13.8731 66.4776 15.6815C68.3061 17.4899 69.3333 19.9426 69.3333 22.5Z" fill="#216DF0"/> |
| @@ -1533,43 +1571,43 @@ | ||
| 1533 | 1571 | |
| 1534 | 1572 | if ($width == 'fullwidth') { |
| 1535 | 1573 | if (wpvr_isMobileDevice()) { |
| 1536 | 1574 | $html .= '<div class="cardboard-vrfullwidth vrfullwidth">'; |
| 1537 | - $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left cardboard-half" style="width: 49%!important; border-radius:' . $radius . ' text-align:center; direction:ltr;" ><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1538 | - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; text-align:center; direction:ltr; border-radius:' . $radius . '" >'; | |
| 1575 | + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left cardboard-half pano2' . $id . '" style="width: 49%!important; border-radius:' . $radius . ' text-align:center; direction:ltr;" ><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1576 | + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%; text-align:center; direction:ltr; border-radius:' . $radius . '" >'; | |
| 1539 | 1577 | } else { |
| 1540 | - $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1578 | + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left pano2' . $id . '" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1541 | 1579 | if ($radius) { |
| 1542 | - $html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr;" >'; | |
| 1580 | + $html .= '<div id="' . $panoid . '" class="pano-wrap vrfullwidth pano' . $id . '" style=" text-align:center; height: ' . $height . '; border-radius:' . $radius . '; direction:ltr;" >'; | |
| 1543 | 1581 | } else { |
| 1544 | - $html .= '<div id="pano' . $id . '" class="pano-wrap vrfullwidth" style=" text-align:center; height: ' . $height . '; direction:ltr;" >'; | |
| 1582 | + $html .= '<div id="' . $panoid . '" class="pano-wrap vrfullwidth pano' . $id . '" style=" text-align:center; height: ' . $height . '; direction:ltr;" >'; | |
| 1545 | 1583 | } |
| 1546 | 1584 | } |
| 1547 | 1585 | } elseif ($width == 'embed') { |
| 1548 | 1586 | $html .= '<div class="cardboard-vrembed vrembed">'; |
| 1549 | - $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style=" width: 49%!important; text-align:center; direction:ltr;" ><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1550 | - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" text-align:center; direction:ltr;" >'; | |
| 1587 | + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left pano2' . $id . '" style=" width: 49%!important; text-align:center; direction:ltr;" ><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1588 | + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%; height: 100%; text-align:center; direction:ltr;" >'; | |
| 1551 | 1589 | } else { |
| 1552 | 1590 | if (wpvr_isMobileDevice()) { |
| 1553 | - $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left cardboard-half" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1591 | + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left cardboard-half pano2' . $id . '" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1554 | 1592 | if ($radius) { |
| 1555 | - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" width: 100%; border-radius:' . $radius . ';">'; | |
| 1593 | + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style=" width: 100%; border-radius:' . $radius . ';">'; | |
| 1556 | 1594 | } else { |
| 1557 | - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style=" width: 100%; ">'; | |
| 1595 | + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style=" width: 100%; ">'; | |
| 1558 | 1596 | } |
| 1559 | 1597 | } else { |
| 1560 | - $html .= '<div id="pano2' . $id . '" class="pano-wrap pano-left" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $id . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1598 | + $html .= '<div id="' . $panoid2 . '" class="pano-wrap pano-left pano2' . $id . '" style="width: 49%; border-radius:' . $radius . '"><div id="center-pointer2' . $pano_suffix . '" class="vr-pointer-container"><span class="center-pointer"></span></div></div>'; | |
| 1561 | 1599 | |
| 1562 | 1600 | if ($radius) { |
| 1563 | - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%; border-radius:' . $radius . ';">'; | |
| 1601 | + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%; border-radius:' . $radius . ';">'; | |
| 1564 | 1602 | } else { |
| 1565 | - $html .= '<div id="pano' . $id . '" class="pano-wrap pano-right" style="width: 100%;">'; | |
| 1603 | + $html .= '<div id="' . $panoid . '" class="pano-wrap pano-right pano' . $id . '" style="width: 100%;">'; | |
| 1566 | 1604 | } |
| 1567 | 1605 | } |
| 1568 | 1606 | } |
| 1569 | 1607 | // Vr mode transction scene to scene |
| 1570 | 1608 | if ($status !== false && 'valid' == $status && $is_pro) { |
| 1571 | - $html .= '<div id="center-pointer' . $id . '" class="vr-pointer-container" style="display:none"><span class="center-pointer"></span></div>'; | |
| 1609 | + $html .= '<div id="center-pointer' . $pano_suffix . '" class="vr-pointer-container" style="display:none"><span class="center-pointer"></span></div>'; | |
| 1572 | 1610 | } |
| 1573 | 1611 | $social_logo_top = ''; |
| 1574 | 1612 | //===company logo===// |
| 1575 | 1613 | if (isset($postdata['cpLogoSwitch'])) { |
| @@ -1606,14 +1644,14 @@ | ||
| 1606 | 1644 | $generic_form_icon = isset($postdata['genericformicon']) ? (string) $postdata['genericformicon'] : 'fab fa-wpforms'; |
| 1607 | 1645 | $generic_form_icon = implode(' ', array_filter(array_map('sanitize_html_class', preg_split('/\s+/', $generic_form_icon)))); |
| 1608 | 1646 | $generic_form_icon = $generic_form_icon ?: 'fab fa-wpforms'; |
| 1609 | 1647 | $generic_form_icon_color = sanitize_hex_color($postdata['genericformiconcolor'] ?? '') ?: '#f7fffb'; |
| 1610 | - $html .= '<div class="generic_form_button" id="generic_form_button_' . esc_attr($id) . '">'; | |
| 1611 | - $html .= '<div class="generic-form-icon" title ="Generic Form" id="generic_form_target_' . esc_attr($id) . '"><i class="' . esc_attr($generic_form_icon) . '" style="color:' . esc_attr($generic_form_icon_color) . ';"></i></div>'; | |
| 1648 | + $html .= '<div class="generic_form_button" id="generic_form_button_' . esc_attr($pano_suffix) . '">'; | |
| 1649 | + $html .= '<div class="generic-form-icon" title ="Generic Form" id="generic_form_target_' . esc_attr($pano_suffix) . '"><i class="' . esc_attr($generic_form_icon) . '" style="color:' . esc_attr($generic_form_icon_color) . ';"></i></div>'; | |
| 1612 | 1650 | $html .= '</div>'; |
| 1613 | 1651 | |
| 1614 | 1652 | // Generate the modal form container |
| 1615 | - $html .= '<div class="wpvr-generic-form" id="wpvr-generic-form' . esc_attr($id) . '" style="display: none">'; | |
| 1653 | + $html .= '<div class="wpvr-generic-form" id="wpvr-generic-form' . esc_attr($pano_suffix) . '" style="display: none">'; | |
| 1616 | 1654 | $html .= '<span class="close-generic-form"><i class="fa fa-times"></i></span>'; |
| 1617 | 1655 | $html .= '<div class="generic-form-container">' . $shortcode_content . '</div>'; |
| 1618 | 1656 | $html .= '</div>'; |
| 1619 | 1657 | } |
| @@ -1666,23 +1704,23 @@ | ||
| 1666 | 1704 | //===Custom Control===// |
| 1667 | 1705 | if (isset($custom_control)) { |
| 1668 | 1706 | $gyro_button_enabled = wpvr_isMobileDevice() && $custom_control['gyroSwitch'] == "on" && $custom_control['gyroscopeSwitch'] == "on"; |
| 1669 | 1707 | if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $gyro_button_enabled || $custom_control['backToHomeSwitch'] == "on") { |
| 1670 | - $html .= '<div id="zoom-in-out-controls' . $id . '" class="zoom-in-out-controls">'; | |
| 1708 | + $html .= '<div id="zoom-in-out-controls' . $pano_suffix . '" class="zoom-in-out-controls">'; | |
| 1671 | 1709 | |
| 1672 | 1710 | if ($custom_control['backToHomeSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 1673 | - $html .= '<div class="ctrl" id="backToHome' . $id . '"><i class="' . $custom_control['backToHomeIcon'] . '" style="color:' . $custom_control['backToHomeColor'] . ';"></i></div>'; | |
| 1711 | + $html .= '<div class="ctrl" id="backToHome' . $pano_suffix . '"><i class="' . $custom_control['backToHomeIcon'] . '" style="color:' . $custom_control['backToHomeColor'] . ';"></i></div>'; | |
| 1674 | 1712 | } |
| 1675 | 1713 | |
| 1676 | 1714 | if ($custom_control['panZoomInSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 1677 | - $html .= '<div class="ctrl" id="zoom-in' . $id . '"><i class="' . $custom_control['panZoomInIcon'] . '" style="color:' . $custom_control['panZoomInColor'] . ';"></i></div>'; | |
| 1715 | + $html .= '<div class="ctrl" id="zoom-in' . $pano_suffix . '"><i class="' . $custom_control['panZoomInIcon'] . '" style="color:' . $custom_control['panZoomInColor'] . ';"></i></div>'; | |
| 1678 | 1716 | } |
| 1679 | 1717 | |
| 1680 | 1718 | if ($custom_control['panZoomOutSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 1681 | - $html .= '<div class="ctrl" id="zoom-out' . $id . '"><i class="' . $custom_control['panZoomOutIcon'] . '" style="color:' . $custom_control['panZoomOutColor'] . ';"></i></div>'; | |
| 1719 | + $html .= '<div class="ctrl" id="zoom-out' . $pano_suffix . '"><i class="' . $custom_control['panZoomOutIcon'] . '" style="color:' . $custom_control['panZoomOutColor'] . ';"></i></div>'; | |
| 1682 | 1720 | } |
| 1683 | 1721 | if ($gyro_button_enabled && 'valid' == $status && $is_pro) { |
| 1684 | - $html .= '<div class="ctrl" id="gyroscope' . $id . '" ><i class="' . $custom_control['gyroscopeIcon'] . '" style="color:' . $custom_control['gyroscopeColor'] . ';"></i></div>'; | |
| 1722 | + $html .= '<div class="ctrl" id="gyroscope' . $pano_suffix . '" ><i class="' . $custom_control['gyroscopeIcon'] . '" style="color:' . $custom_control['gyroscopeColor'] . ';"></i></div>'; | |
| 1685 | 1723 | } |
| 1686 | 1724 | $html .= '</div>'; |
| 1687 | 1725 | } |
| 1688 | 1726 | //===zoom in out Control===// |
| @@ -1688,28 +1726,28 @@ | ||
| 1688 | 1726 | //===zoom in out Control===// |
| 1689 | 1727 | |
| 1690 | 1728 | if (($custom_control['panupSwitch'] == "on" || $custom_control['panDownSwitch'] == "on" || $custom_control['panLeftSwitch'] == "on" || $custom_control['panRightSwitch'] == "on" || $custom_control['panFullscreenSwitch'] == "on" ) && 'valid' == $status && $is_pro) { |
| 1691 | 1729 | //===Custom Control===// |
| 1692 | - $html .= '<div class="controls" id="controls' . $id . '">'; | |
| 1730 | + $html .= '<div class="controls" id="controls' . $pano_suffix . '">'; | |
| 1693 | 1731 | |
| 1694 | 1732 | if ($custom_control['panupSwitch'] == "on") { |
| 1695 | - $html .= '<div class="ctrl pan-up" id="pan-up' . $id . '"><i class="' . $custom_control['panupIcon'] . '" style="color:' . $custom_control['panupColor'] . ';"></i></div>'; | |
| 1733 | + $html .= '<div class="ctrl pan-up" id="pan-up' . $pano_suffix . '"><i class="' . $custom_control['panupIcon'] . '" style="color:' . $custom_control['panupColor'] . ';"></i></div>'; | |
| 1696 | 1734 | } |
| 1697 | 1735 | |
| 1698 | 1736 | if ($custom_control['panDownSwitch'] == "on") { |
| 1699 | - $html .= '<div class="ctrl pan-down" id="pan-down' . $id . '"><i class="' . $custom_control['panDownIcon'] . '" style="color:' . $custom_control['panDownColor'] . ';"></i></div>'; | |
| 1737 | + $html .= '<div class="ctrl pan-down" id="pan-down' . $pano_suffix . '"><i class="' . $custom_control['panDownIcon'] . '" style="color:' . $custom_control['panDownColor'] . ';"></i></div>'; | |
| 1700 | 1738 | } |
| 1701 | 1739 | |
| 1702 | 1740 | if ($custom_control['panLeftSwitch'] == "on") { |
| 1703 | - $html .= '<div class="ctrl pan-left" id="pan-left' . $id . '"><i class="' . $custom_control['panLeftIcon'] . '" style="color:' . $custom_control['panLeftColor'] . ';"></i></div>'; | |
| 1741 | + $html .= '<div class="ctrl pan-left" id="pan-left' . $pano_suffix . '"><i class="' . $custom_control['panLeftIcon'] . '" style="color:' . $custom_control['panLeftColor'] . ';"></i></div>'; | |
| 1704 | 1742 | } |
| 1705 | 1743 | |
| 1706 | 1744 | if ($custom_control['panRightSwitch'] == "on") { |
| 1707 | - $html .= '<div class="ctrl pan-right" id="pan-right' . $id . '"><i class="' . $custom_control['panRightIcon'] . '" style="color:' . $custom_control['panRightColor'] . ';"></i></div>'; | |
| 1745 | + $html .= '<div class="ctrl pan-right" id="pan-right' . $pano_suffix . '"><i class="' . $custom_control['panRightIcon'] . '" style="color:' . $custom_control['panRightColor'] . ';"></i></div>'; | |
| 1708 | 1746 | } |
| 1709 | 1747 | |
| 1710 | 1748 | if ($custom_control['panFullscreenSwitch'] == "on") { |
| 1711 | - $html .= '<div class="ctrl fullscreen" id="fullscreen' . $id . '"><i class="' . $custom_control['panFullscreenIcon'] . '" style="color:' . $custom_control['panFullscreenColor'] . ';"></i></div>'; | |
| 1749 | + $html .= '<div class="ctrl fullscreen" id="fullscreen' . $pano_suffix . '"><i class="' . $custom_control['panFullscreenIcon'] . '" style="color:' . $custom_control['panFullscreenColor'] . ';"></i></div>'; | |
| 1712 | 1750 | } |
| 1713 | 1751 | $html .= '</div>'; |
| 1714 | 1752 | } |
| 1715 | 1753 | } |
| @@ -1721,9 +1759,9 @@ | ||
| 1721 | 1759 | $postdata, |
| 1722 | 1760 | $is_pro, |
| 1723 | 1761 | $autoload, |
| 1724 | 1762 | $explainer_right, |
| 1725 | - $id | |
| 1763 | + $pano_suffix | |
| 1726 | 1764 | ); |
| 1727 | 1765 | //===explainer button end===// |
| 1728 | 1766 | |
| 1729 | 1767 | //===Floor map button===// |
| @@ -1729,10 +1767,10 @@ | ||
| 1729 | 1767 | //===Floor map button===// |
| 1730 | 1768 | $status = get_option('wpvr_edd_license_status'); |
| 1731 | 1769 | if ($status !== false && 'valid' == $status && $is_pro){ |
| 1732 | 1770 | if ($floor_plan_enable == "on" && !empty($floor_plan_image)) { |
| 1733 | - $html .= '<div class="floor_map_button" id="floor_map_button_' . $id . '" style="right:'.$floor_map_right.'">'; | |
| 1734 | - $html .= '<div class="ctrl" id="floor_map_target_' . $id . '"><i class="fas fa-map" style="color:#f7fffb;"></i></div>'; | |
| 1771 | + $html .= '<div class="floor_map_button" id="floor_map_button_' . $pano_suffix . '" style="right:'.$floor_map_right.'">'; | |
| 1772 | + $html .= '<div class="ctrl" id="floor_map_target_' . $pano_suffix . '"><i class="fas fa-map" style="color:#f7fffb;"></i></div>'; | |
| 1735 | 1773 | $html .= '</div>'; |
| 1736 | 1774 | } |
| 1737 | 1775 | } |
| 1738 | 1776 | //===floor map button===// |
| @@ -1742,11 +1780,11 @@ | ||
| 1742 | 1780 | $size = ''; |
| 1743 | 1781 | if($vrgallery_icon_size){ |
| 1744 | 1782 | $size = 'vrg-icon-size-large'; |
| 1745 | 1783 | } |
| 1746 | - $html .= '<div id="vrgcontrols' . $id . '" class="vrgcontrols">'; | |
| 1784 | + $html .= '<div id="vrgcontrols' . $pano_suffix . '" class="vrgcontrols">'; | |
| 1747 | 1785 | |
| 1748 | - $html .= '<div class="vrgctrl' . $id . ' vrbounce '.$size.'">'; | |
| 1786 | + $html .= '<div class="vrgctrl' . $pano_suffix . ' vrbounce '.$size.'">'; | |
| 1749 | 1787 | $html .= '</div>'; |
| 1750 | 1788 | $html .= '</div>'; |
| 1751 | 1789 | |
| 1752 | 1790 | $gallery_layout_class = isset($postdata['tourLayout']['layout']) && 'layout1' === $postdata['tourLayout']['layout'] |
| @@ -1751,9 +1789,9 @@ | ||
| 1751 | 1789 | |
| 1752 | 1790 | $gallery_layout_class = isset($postdata['tourLayout']['layout']) && 'layout1' === $postdata['tourLayout']['layout'] |
| 1753 | 1791 | ? 'wpvr-gallery--modern' |
| 1754 | 1792 | : 'wpvr-gallery--classic'; |
| 1755 | - $html .= '<div id="sccontrols' . $id . '" class="scene-gallery vrowl-carousel ' . esc_attr($gallery_layout_class) . '">'; | |
| 1793 | + $html .= '<div id="sccontrols' . $pano_suffix . '" class="scene-gallery vrowl-carousel ' . esc_attr($gallery_layout_class) . '">'; | |
| 1756 | 1794 | if (isset($panodata["scene-list"])) { |
| 1757 | 1795 | foreach ($panodata["scene-list"] as $panoscenes) { |
| 1758 | 1796 | $scene_key = $panoscenes['scene-id']; |
| 1759 | 1797 | |
| @@ -1777,11 +1815,11 @@ | ||
| 1777 | 1815 | $thumbnail = $img_src_url; |
| 1778 | 1816 | } |
| 1779 | 1817 | |
| 1780 | 1818 | if( isset($postdata['tourLayout']['layout']) && 'layout1' !== $postdata['tourLayout']['layout']) { |
| 1781 | - $html .= '<ul><li title="Click to view scene"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $id . '" src="' . $thumbnail . '"></li></ul>'; | |
| 1819 | + $html .= '<ul><li title="Click to view scene"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $pano_suffix . '" src="' . $thumbnail . '"></li></ul>'; | |
| 1782 | 1820 | }else { |
| 1783 | - $html .= '<ul><li title="Click to view scene"><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $id . '" src="' . $thumbnail . '"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span></li></ul>'; | |
| 1821 | + $html .= '<ul><li title="Click to view scene"><img loading="lazy" class="scctrl" id="' . $scene_key . '_gallery_' . $pano_suffix . '" src="' . $thumbnail . '"><span class="scene-title" title="' . esc_attr($scene_key_title) . '">' . $scene_key_title . '</span></li></ul>'; | |
| 1784 | 1822 | } |
| 1785 | 1823 | } |
| 1786 | 1824 | } |
| 1787 | 1825 | |
| @@ -1812,15 +1850,15 @@ | ||
| 1812 | 1850 | $audio_muted_attr = ($autoplay_bg_music === 'on') ? 'muted' : ''; |
| 1813 | 1851 | $audio_icon_class = 'fa-volume-mute'; // Always start with mute icon |
| 1814 | 1852 | |
| 1815 | 1853 | if ($bg_music === 'on' && 'valid' == $status && $is_pro) { |
| 1816 | - $html .= '<div id="adcontrol' . esc_attr( $id ) . '" class="adcontrol" style="right:' . esc_attr( $audio_right ) . '">'; | |
| 1817 | - $html .= '<audio id="vrAudio' . esc_attr($id) . '" class="vrAudioDefault" data-autoplay="' . esc_attr($autoplay_bg_music) . '" onended="audionEnd' . esc_attr($id) . '()" ' . $autoplay_attr . ' ' . $audio_muted_attr . ' ' . $bg_loop . '> | |
| 1854 | + $html .= '<div id="adcontrol' . esc_attr( $pano_suffix ) . '" class="adcontrol" style="right:' . esc_attr( $audio_right ) . '">'; | |
| 1855 | + $html .= '<audio id="vrAudio' . esc_attr($pano_suffix) . '" class="vrAudioDefault" data-autoplay="' . esc_attr($autoplay_bg_music) . '" onended="audionEnd' . esc_attr($pano_suffix) . '()" ' . $autoplay_attr . ' ' . $audio_muted_attr . ' ' . $bg_loop . '> | |
| 1818 | 1856 | <source src="' . esc_url($bg_music_url) . '" type="audio/mpeg"> |
| 1819 | 1857 | Your browser does not support the audio element. |
| 1820 | 1858 | </audio>'; |
| 1821 | - $html .= '<button onclick="playPause' . esc_attr($id) . '()" class="ctrl audio_control" id="audio_control' . esc_attr($id) . '"> | |
| 1822 | - <i id="vr-volume' . esc_attr($id) . '" class="wpvrvolumeicon' . esc_attr($id) . ' fas ' . esc_attr($audio_icon_class) . '" style="color:#fff;"></i> | |
| 1859 | + $html .= '<button onclick="playPause' . esc_attr($pano_suffix) . '()" class="ctrl audio_control" id="audio_control' . esc_attr($pano_suffix) . '"> | |
| 1860 | + <i id="vr-volume' . esc_attr($pano_suffix) . '" class="wpvrvolumeicon' . esc_attr($pano_suffix) . ' fas ' . esc_attr($audio_icon_class) . '" style="color:#fff;"></i> | |
| 1823 | 1861 | </button>'; |
| 1824 | 1862 | $html .= '</div>'; |
| 1825 | 1863 | } |
| 1826 | 1864 | //===Explainer video section===// |
| @@ -1827,9 +1865,9 @@ | ||
| 1827 | 1865 | $explainerContent = ""; |
| 1828 | 1866 | if (isset($postdata['explainerContent'])) { |
| 1829 | 1867 | $explainerContent = $this->wpvr_sanitize_iframe_only($postdata['explainerContent']); |
| 1830 | 1868 | } |
| 1831 | - $html .= '<div class="explainer" id="explainer' . $id . '" style="display: none">'; | |
| 1869 | + $html .= '<div class="explainer" id="explainer' . $pano_suffix . '" style="display: none">'; | |
| 1832 | 1870 | $html .= '<span class="close-explainer-video"><i class="fa fa-times"></i></span>'; |
| 1833 | 1871 | $html .= '' . $explainerContent . ''; |
| 1834 | 1872 | $html .= '</div>'; |
| 1835 | 1873 | //===Explainer video section End===// |
| @@ -1847,13 +1885,13 @@ | ||
| 1847 | 1885 | .zoom-in-out-controls { |
| 1848 | 1886 | top: 37px; |
| 1849 | 1887 | } |
| 1850 | 1888 | </style>'; |
| 1851 | - $html .= '<div id="custom-scene-navigation' . $id . '" class="custom-scene-navigation"> | |
| 1889 | + $html .= '<div id="custom-scene-navigation' . $pano_suffix . '" class="custom-scene-navigation"> | |
| 1852 | 1890 | <span class="hamburger-menu"><svg width="16" height="10" fill="none" viewBox="0 0 22 15" xmlns="http://www.w3.org/2000/svg"><rect width="21.177" height="2.647" fill="#f7fffb" rx="1.324"/><rect width="21.177" height="2.647" y="6.177" fill="#f7fffb" rx="1.324"/><rect width="21.177" height="2.647" y="12.352" fill="#f7fffb" rx="1.324"/></svg></span> |
| 1853 | 1891 | </div> |
| 1854 | 1892 | |
| 1855 | - <div id="custom-scene-navigation-nav' . $id . '" class="' . esc_attr( $scene_navigation_nav_class ) . '"> | |
| 1893 | + <div id="custom-scene-navigation-nav' . $pano_suffix . '" class="' . esc_attr( $scene_navigation_nav_class ) . '"> | |
| 1856 | 1894 | <ul></ul> |
| 1857 | 1895 | </div> |
| 1858 | 1896 | '; |
| 1859 | 1897 | } |
| @@ -1861,9 +1899,9 @@ | ||
| 1861 | 1899 | |
| 1862 | 1900 | |
| 1863 | 1901 | if( 'embed' === $width){ |
| 1864 | 1902 | if(WPVR_Helper::is_enable_social_share($postdata) === 'on'){ |
| 1865 | - $html .= '<div id="wpvr-social-share-bg-box'.$id.'" class="wpvr-social-share-bg-box" style="top:'.$social_logo_top.'"> | |
| 1903 | + $html .= '<div id="wpvr-social-share-bg-box'.$pano_suffix.'" class="wpvr-social-share-bg-box" style="top:'.$social_logo_top.'"> | |
| 1866 | 1904 | <span class="share-btn-svg"><svg fill="none" viewBox="0 0 24 24" width="24" height="24" ><path fill="#1F1CF4" d="M18.4 2.4a3.2 3.2 0 00-3.2 3.2 3.2 3.2 0 00.075.67L8.01 9.901A3.2 3.2 0 005.6 8.8a3.2 3.2 0 101.325 6.112 3.2 3.2 0 001.086-.812l7.261 3.632a3.2 3.2 0 101.803-2.242c-.415.189-.786.466-1.085.81l-7.261-3.63A3.2 3.2 0 008.8 12a3.2 3.2 0 00-.075-.667L15.991 7.7a3.2 3.2 0 002.41 1.1 3.2 3.2 0 100-6.4z"/></svg></span> |
| 1867 | 1905 | <nav class="wpvr-share-nav"> |
| 1868 | 1906 | '.WPVR_Helper::social_media_share_links_display_in_embed(home_url().'/?embed_page='. $id).' |
| 1869 | 1907 | </nav> |
| @@ -1882,9 +1920,9 @@ | ||
| 1882 | 1920 | $floor_map_pointer = $postdata['floor_plan_pointer_position']; |
| 1883 | 1921 | $floor_map_scene_id = $postdata['floor_plan_data_list']; |
| 1884 | 1922 | $floor_plan_custom_color = $postdata['floor_plan_custom_color']; |
| 1885 | 1923 | } |
| 1886 | - $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $id . '" style="display: none">'; | |
| 1924 | + $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $pano_suffix . '" style="display: none">'; | |
| 1887 | 1925 | $html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>'; |
| 1888 | 1926 | $html .= '<img loading="lazy" src="'.$floor_map_image.'">'; |
| 1889 | 1927 | foreach($floor_map_pointer as $key=> $pointer_position){ |
| 1890 | 1928 | $html .= '<div class="floor-plan-pointer ui-draggable ui-draggable-handle" scene_id = "'.$floor_map_scene_id[$key]->value.'" id="'.$pointer_position->id.'" data-top="'.$pointer_position->data_top.'" data-left="'.$pointer_position->data_left.'" style="'.$pointer_position->style.'"> |
| @@ -1988,9 +2026,10 @@ | ||
| 1988 | 2026 | border: '.$border_width.'px '.$border_style.' '.$border_color.'; |
| 1989 | 2027 | border-radius: '.$border_radius.'px; |
| 1990 | 2028 | padding: '.$button_pt.'px '.$button_pr.'px '.$button_pb.'px '.$button_pl.'px; |
| 1991 | 2029 | '; |
| 1992 | - $html .= '<div class="wpvr-call-to-action-button position-'.$text_align.'" style="max-width:' . $width.'"> | |
| 2030 | + $cta_width = ( $width === 'fullwidth' || $width === 'embed' ) ? '100%' : $width; | |
| 2031 | + $html .= '<div class="wpvr-call-to-action-button position-'.$text_align.'" style="max-width:' . $cta_width . '"> | |
| 1993 | 2032 | <a href="'.$buttonurl.'" style="'.$style.'" target="'.$target.'">'.$buttontext.'</a> |
| 1994 | 2033 | </div>'; |
| 1995 | 2034 | |
| 1996 | 2035 | } |
| @@ -2000,26 +2039,26 @@ | ||
| 2000 | 2039 | //script started |
| 2001 | 2040 | $html .= '<script>'; |
| 2002 | 2041 | if (isset($postdata['bg_music']) && $bg_music == 'on' && 'valid' == $status && $is_pro) { |
| 2003 | 2042 | $html .= ' |
| 2004 | - var x' . $id . ' = document.getElementById("vrAudio' . $id . '"); | |
| 2005 | - var playing' . $id . ' = false; | |
| 2006 | - var autoplaySupported' . $id . ' = false; | |
| 2007 | - var alertShown' . $id . ' = false; | |
| 2008 | - var autoplayChecked' . $id . ' = false; | |
| 2043 | + var x' . $pano_suffix . ' = document.getElementById("vrAudio' . $pano_suffix . '"); | |
| 2044 | + var playing' . $pano_suffix . ' = false; | |
| 2045 | + var autoplaySupported' . $pano_suffix . ' = false; | |
| 2046 | + var alertShown' . $pano_suffix . ' = false; | |
| 2047 | + var autoplayChecked' . $pano_suffix . ' = false; | |
| 2009 | 2048 | |
| 2010 | - function playPause' . $id . '() { | |
| 2011 | - if (playing' . $id . ') { | |
| 2012 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2013 | - x' . $id . '.pause(); | |
| 2014 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2015 | - playing' . $id . ' = false; | |
| 2049 | + function playPause' . $pano_suffix . '() { | |
| 2050 | + if (playing' . $pano_suffix . ') { | |
| 2051 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2052 | + x' . $pano_suffix . '.pause(); | |
| 2053 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2054 | + playing' . $pano_suffix . ' = false; | |
| 2016 | 2055 | } else { |
| 2017 | - x' . $id . '.muted = false; | |
| 2018 | - x' . $id . '.play().then(function() { | |
| 2019 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2020 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2021 | - playing' . $id . ' = true; | |
| 2056 | + x' . $pano_suffix . '.muted = false; | |
| 2057 | + x' . $pano_suffix . '.play().then(function() { | |
| 2058 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2059 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2060 | + playing' . $pano_suffix . ' = true; | |
| 2022 | 2061 | }).catch(function(e) { |
| 2023 | 2062 | console.log("Play failed:", e); |
| 2024 | 2063 | }); |
| 2025 | 2064 | } |
| @@ -2024,133 +2063,139 @@ | ||
| 2024 | 2063 | }); |
| 2025 | 2064 | } |
| 2026 | 2065 | } |
| 2027 | 2066 | |
| 2028 | - function audionEnd' . $id . '() { | |
| 2029 | - playing' . $id . ' = false; | |
| 2030 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2031 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2067 | + function audionEnd' . $pano_suffix . '() { | |
| 2068 | + playing' . $pano_suffix . ' = false; | |
| 2069 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2070 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2032 | 2071 | } |
| 2033 | 2072 | |
| 2034 | - x' . $id . '.addEventListener("ended", audionEnd' . $id . ');'; | |
| 2073 | + x' . $pano_suffix . '.addEventListener("ended", audionEnd' . $pano_suffix . ');'; | |
| 2035 | 2074 | |
| 2036 | 2075 | if ($autoplay_bg_music == 'on') { |
| 2037 | 2076 | $html .= ' |
| 2038 | 2077 | |
| 2039 | - x' . $id . '.addEventListener("loadeddata", function() { | |
| 2040 | - if (!autoplayChecked' . $id . ') { | |
| 2041 | - checkAutoplayStatus' . $id . '(); | |
| 2078 | + x' . $pano_suffix . '.addEventListener("loadeddata", function() { | |
| 2079 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2080 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2042 | 2081 | } |
| 2043 | 2082 | }); |
| 2044 | 2083 | |
| 2045 | - x' . $id . '.addEventListener("canplay", function() { | |
| 2046 | - if (!autoplayChecked' . $id . ') { | |
| 2047 | - checkAutoplayStatus' . $id . '(); | |
| 2084 | + x' . $pano_suffix . '.addEventListener("canplay", function() { | |
| 2085 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2086 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2048 | 2087 | } |
| 2049 | 2088 | }); |
| 2050 | 2089 | |
| 2051 | - x' . $id . '.addEventListener("canplaythrough", function() { | |
| 2052 | - if (!autoplayChecked' . $id . ') { | |
| 2053 | - checkAutoplayStatus' . $id . '(); | |
| 2090 | + x' . $pano_suffix . '.addEventListener("canplaythrough", function() { | |
| 2091 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2092 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2054 | 2093 | } |
| 2055 | 2094 | }); |
| 2056 | 2095 | |
| 2057 | 2096 | setTimeout(function() { |
| 2058 | - if (!autoplayChecked' . $id . ') { | |
| 2059 | - checkAutoplayStatus' . $id . '(); | |
| 2097 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2098 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2060 | 2099 | } |
| 2061 | 2100 | }, 1000); |
| 2062 | 2101 | |
| 2063 | - x' . $id . '.addEventListener("play", function() { | |
| 2064 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2065 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2066 | - playing' . $id . ' = true; | |
| 2102 | + x' . $pano_suffix . '.addEventListener("play", function() { | |
| 2103 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2104 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2105 | + playing' . $pano_suffix . ' = true; | |
| 2067 | 2106 | }); |
| 2068 | 2107 | |
| 2069 | - x' . $id . '.addEventListener("pause", function() { | |
| 2070 | - if (!playing' . $id . ') { | |
| 2071 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2072 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2108 | + x' . $pano_suffix . '.addEventListener("pause", function() { | |
| 2109 | + if (!playing' . $pano_suffix . ') { | |
| 2110 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2111 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2073 | 2112 | } |
| 2074 | 2113 | }); |
| 2075 | 2114 | |
| 2076 | - function checkAutoplayStatus' . $id . '() { | |
| 2077 | - autoplayChecked' . $id . ' = true; | |
| 2115 | + function checkAutoplayStatus' . $pano_suffix . '() { | |
| 2116 | + autoplayChecked' . $pano_suffix . ' = true; | |
| 2078 | 2117 | |
| 2079 | - x' . $id . '.muted = true; | |
| 2080 | - var playPromise = x' . $id . '.play(); | |
| 2118 | + x' . $pano_suffix . '.muted = true; | |
| 2119 | + var playPromise = x' . $pano_suffix . '.play(); | |
| 2081 | 2120 | |
| 2082 | 2121 | if (playPromise !== undefined) { |
| 2083 | 2122 | playPromise.then(function () { |
| 2084 | - if (x' . $id . '.muted || x' . $id . '.volume === 0) { | |
| 2085 | - handleAutoplayBlocked' . $id . '(); | |
| 2123 | + if (x' . $pano_suffix . '.muted || x' . $pano_suffix . '.volume === 0) { | |
| 2124 | + handleAutoplayBlocked' . $pano_suffix . '(); | |
| 2086 | 2125 | } else { |
| 2087 | - autoplaySupported' . $id . ' = true; | |
| 2088 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2089 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2090 | - playing' . $id . ' = true; | |
| 2126 | + autoplaySupported' . $pano_suffix . ' = true; | |
| 2127 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2128 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2129 | + playing' . $pano_suffix . ' = true; | |
| 2091 | 2130 | } |
| 2092 | 2131 | }).catch(function () { |
| 2093 | - handleAutoplayBlocked' . $id . '(); | |
| 2132 | + handleAutoplayBlocked' . $pano_suffix . '(); | |
| 2094 | 2133 | }); |
| 2095 | 2134 | } else { |
| 2096 | 2135 | setTimeout(function () { |
| 2097 | - if (x' . $id . '.paused || x' . $id . '.currentTime === 0) { | |
| 2098 | - handleAutoplayBlocked' . $id . '(); | |
| 2136 | + if (x' . $pano_suffix . '.paused || x' . $pano_suffix . '.currentTime === 0) { | |
| 2137 | + handleAutoplayBlocked' . $pano_suffix . '(); | |
| 2099 | 2138 | } else { |
| 2100 | - autoplaySupported' . $id . ' = true; | |
| 2101 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2102 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2103 | - playing' . $id . ' = true; | |
| 2139 | + autoplaySupported' . $pano_suffix . ' = true; | |
| 2140 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2141 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2142 | + playing' . $pano_suffix . ' = true; | |
| 2104 | 2143 | } |
| 2105 | 2144 | }, 300); |
| 2106 | 2145 | } |
| 2107 | 2146 | } |
| 2108 | 2147 | |
| 2109 | - function handleAutoplayBlocked' . $id . '() { | |
| 2110 | - autoplaySupported' . $id . ' = false; | |
| 2111 | - if (!alertShown' . $id . ') { | |
| 2148 | + function handleAutoplayBlocked' . $pano_suffix . '() { | |
| 2149 | + autoplaySupported' . $pano_suffix . ' = false; | |
| 2150 | + if (!alertShown' . $pano_suffix . ') { | |
| 2112 | 2151 | alert("Autoplay is not supported in your browser. Please click the audio button to play music."); |
| 2113 | - alertShown' . $id . ' = true; | |
| 2152 | + alertShown' . $pano_suffix . ' = true; | |
| 2114 | 2153 | } |
| 2115 | 2154 | |
| 2116 | - x' . $id . '.pause(); | |
| 2117 | - x' . $id . '.currentTime = 0; | |
| 2118 | - x' . $id . '.muted = true; | |
| 2155 | + x' . $pano_suffix . '.pause(); | |
| 2156 | + x' . $pano_suffix . '.currentTime = 0; | |
| 2157 | + x' . $pano_suffix . '.muted = true; | |
| 2119 | 2158 | |
| 2120 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2121 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2159 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2160 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2122 | 2161 | |
| 2123 | - document.getElementById("pano' . $id . '").addEventListener("click", musicPlay' . $id . '); | |
| 2124 | - document.addEventListener("touchstart", musicPlay' . $id . ', { once: true }); | |
| 2125 | - document.addEventListener("click", musicPlay' . $id . ', { once: true }); | |
| 2162 | + var musicTriggerElem = document.getElementById("' . $panoid . '"); | |
| 2163 | + if (musicTriggerElem) { | |
| 2164 | + musicTriggerElem.addEventListener("click", musicPlay' . $pano_suffix . '); | |
| 2165 | + } | |
| 2166 | + document.addEventListener("touchstart", musicPlay' . $pano_suffix . ', { once: true }); | |
| 2167 | + document.addEventListener("click", musicPlay' . $pano_suffix . ', { once: true }); | |
| 2126 | 2168 | } |
| 2127 | 2169 | |
| 2128 | - function musicPlay' . $id . '() { | |
| 2129 | - x' . $id . '.muted = false; | |
| 2130 | - var playPromise = x' . $id . '.play(); | |
| 2170 | + function musicPlay' . $pano_suffix . '() { | |
| 2171 | + x' . $pano_suffix . '.muted = false; | |
| 2172 | + var playPromise = x' . $pano_suffix . '.play(); | |
| 2131 | 2173 | |
| 2132 | 2174 | if (playPromise !== undefined) { |
| 2133 | 2175 | playPromise.then(function () { |
| 2134 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2135 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2136 | - playing' . $id . ' = true; | |
| 2176 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2177 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2178 | + playing' . $pano_suffix . ' = true; | |
| 2137 | 2179 | }).catch(function(e) { |
| 2138 | 2180 | console.log("Play failed:", e); |
| 2139 | 2181 | }); |
| 2140 | 2182 | } else { |
| 2141 | 2183 | setTimeout(function () { |
| 2142 | - if (!x' . $id . '.paused) { | |
| 2143 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2144 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2145 | - playing' . $id . ' = true; | |
| 2184 | + if (!x' . $pano_suffix . '.paused) { | |
| 2185 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2186 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2187 | + playing' . $pano_suffix . ' = true; | |
| 2146 | 2188 | } |
| 2147 | 2189 | }, 100); |
| 2148 | 2190 | } |
| 2149 | 2191 | |
| 2150 | - document.getElementById("pano' . $id . '").removeEventListener("click", musicPlay' . $id . '); | |
| 2151 | - document.removeEventListener("touchstart", musicPlay' . $id . '); | |
| 2152 | - document.removeEventListener("click", musicPlay' . $id . '); | |
| 2192 | + var musicTriggerElem = document.getElementById("' . $panoid . '"); | |
| 2193 | + if (musicTriggerElem) { | |
| 2194 | + musicTriggerElem.removeEventListener("click", musicPlay' . $pano_suffix . '); | |
| 2195 | + } | |
| 2196 | + document.removeEventListener("touchstart", musicPlay' . $pano_suffix . '); | |
| 2197 | + document.removeEventListener("click", musicPlay' . $pano_suffix . '); | |
| 2153 | 2198 | } |
| 2154 | 2199 | '; |
| 2155 | 2200 | } |
| 2156 | 2201 | } |
| @@ -2159,27 +2204,31 @@ | ||
| 2159 | 2204 | $html .= 'var response = ' . $response . ';'; |
| 2160 | 2205 | $html .= 'var scenes = response[1];'; |
| 2161 | 2206 | $html .= 'if(scenes) {'; |
| 2162 | 2207 | $html .= 'var scenedata = scenes.scenes;'; |
| 2163 | - $html .= 'for(var i in scenedata) {'; | |
| 2164 | - $html .= 'var scenehotspot = scenedata[i].hotSpots;'; | |
| 2165 | - $html .= 'for(var i = 0; i < scenehotspot.length; i++) {'; | |
| 2166 | - $html .= 'if(scenehotspot[i].type === "info") {'; | |
| 2167 | - $html .= ' scenehotspot[i]["clickHandlerFunc"] = wpvrhotspot;'; | |
| 2168 | - $html .= '} else if(scenehotspot[i].type === "scene") {'; | |
| 2169 | - $html .= ' scenehotspot[i]["clickHandlerArgs"] = scenehotspot[i]["text"];'; | |
| 2208 | + $html .= 'for(var scId in scenedata) {'; | |
| 2209 | + $html .= 'if(!scenedata.hasOwnProperty(scId)) continue;'; | |
| 2210 | + $html .= 'var scenehotspot = scenedata[scId].hotSpots;'; | |
| 2211 | + $html .= 'if(scenehotspot && scenehotspot.length) {'; | |
| 2212 | + $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {'; | |
| 2213 | + $html .= 'if(scenehotspot[hIdx].type === "info") {'; | |
| 2214 | + $html .= ' scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; | |
| 2215 | + $html .= '} else if(scenehotspot[hIdx].type === "scene") {'; | |
| 2216 | + $html .= ' scenehotspot[hIdx]["clickHandlerArgs"] = scenehotspot[hIdx]["text"] || "";'; | |
| 2170 | 2217 | $status = get_option('wpvr_edd_license_status'); |
| 2171 | 2218 | if ($status !== false && $status == 'valid') { |
| 2219 | + $html .='if(typeof wpvr_public !== "undefined") {'; | |
| 2172 | 2220 | $html .='if(wpvr_public.is_pro_active) {'; |
| 2173 | - $html .= ' scenehotspot[i]["clickHandlerFunc"] = wpvrhotspotscene;'; | |
| 2221 | + $html .= ' scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof wpvrhotspotscene' . $pano_suffix . ' === "function") { wpvrhotspotscene' . $pano_suffix . '(div, args); } else if (typeof wpvrhotspotscene === "function") { wpvrhotspotscene(div, args); } else if (typeof window.wpvrhotspotscene === "function") { window.wpvrhotspotscene(div, args); } };'; | |
| 2174 | 2222 | $html .='}'; |
| 2223 | + $html .='}'; | |
| 2175 | 2224 | } |
| 2176 | 2225 | $html .= '}'; |
| 2177 | 2226 | |
| 2178 | 2227 | if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 2179 | 2228 | } else { |
| 2180 | - $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {'; | |
| 2181 | - $html .= 'scenehotspot[i]["createTooltipFunc"] = wpvrtooltip;'; | |
| 2229 | + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2230 | + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2182 | 2231 | $html .= '}'; |
| 2183 | 2232 | } |
| 2184 | 2233 | |
| 2185 | 2234 | $html .= '}'; |
| @@ -2184,20 +2233,25 @@ | ||
| 2184 | 2233 | |
| 2185 | 2234 | $html .= '}'; |
| 2186 | 2235 | $html .= '}'; |
| 2187 | 2236 | $html .= '}'; |
| 2188 | - $html .= 'var panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);'; | |
| 2237 | + $html .= '}'; | |
| 2238 | + $html .= 'var panoshow' . $pano_suffix . ';'; | |
| 2239 | + $html .= 'var panoshow2' . $pano_suffix . ';'; | |
| 2240 | + $html .= 'function initWPVRViewer' . $pano_suffix . '() {'; | |
| 2241 | + $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer' . $pano_suffix . ', 50); return; }'; | |
| 2242 | + $html .= 'panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes);'; | |
| 2189 | 2243 | $html .= ' |
| 2190 | 2244 | window.wpvrViewers = window.wpvrViewers || {}; |
| 2191 | - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . '; | |
| 2245 | + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . '; | |
| 2192 | 2246 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 2193 | - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' } | |
| 2247 | + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' } | |
| 2194 | 2248 | })); |
| 2195 | 2249 | '; |
| 2196 | 2250 | if ( (float) $scene_fade_duration > 0 ) { |
| 2197 | 2251 | $html .= ' |
| 2198 | - panoshow' . $id . '.on("scenechange", function() { | |
| 2199 | - var fadeImage = document.querySelector("#pano' . $id . ' .pnlm-render-container > .pnlm-fade-img"); | |
| 2252 | + panoshow' . $pano_suffix . '.on("scenechange", function() { | |
| 2253 | + var fadeImage = document.querySelector("#' . $panoid . ' .pnlm-render-container > .pnlm-fade-img"); | |
| 2200 | 2254 | if (fadeImage) { |
| 2201 | 2255 | fadeImage.style.opacity = "1"; |
| 2202 | 2256 | void fadeImage.offsetWidth; |
| 2203 | 2257 | } |
| @@ -2204,19 +2258,21 @@ | ||
| 2204 | 2258 | });'; |
| 2205 | 2259 | } |
| 2206 | 2260 | $html .= ' |
| 2207 | 2261 | |
| 2208 | - if(!wpvr_public.is_pro_active || !wpvr_public.is_license_active) { | |
| 2209 | - panoshow' . $id . '.on("load", function() { | |
| 2262 | + if(typeof wpvr_public === "undefined" || !wpvr_public.is_pro_active || !wpvr_public.is_license_active) { | |
| 2263 | + panoshow' . $pano_suffix . '.on("load", function() { | |
| 2210 | 2264 | jQuery(".pnlm-panorama-info").hide(); |
| 2211 | 2265 | jQuery(".pnlm-compass").hide(); |
| 2212 | 2266 | }); |
| 2213 | 2267 | |
| 2214 | - panoshow' . $id . '.on("scenechange", function() { | |
| 2268 | + panoshow' . $pano_suffix . '.on("scenechange", function() { | |
| 2215 | 2269 | jQuery(".pnlm-panorama-info").hide(); |
| 2216 | 2270 | jQuery(".pnlm-compass").hide(); |
| 2217 | 2271 | }); |
| 2218 | 2272 | }'; |
| 2273 | + $html .= '}'; | |
| 2274 | + $html .= 'initWPVRViewer' . $pano_suffix . '();'; | |
| 2219 | 2275 | //===Dplicate mode only for vr mode===// |
| 2220 | 2276 | $response2 = json_decode($response); |
| 2221 | 2277 | $response2[1]->compass = false; |
| 2222 | 2278 | $response2[1]->autoRotate = false; |
| @@ -2225,36 +2281,43 @@ | ||
| 2225 | 2281 | $html .= 'var scenes_duplicate = response_duplicate[1];'; |
| 2226 | 2282 | |
| 2227 | 2283 | $html .= 'if(scenes_duplicate) {'; |
| 2228 | 2284 | $html .= 'var scenedata = scenes_duplicate.scenes;'; |
| 2229 | - $html .= 'for(var i in scenedata) {'; | |
| 2230 | - $html .= 'var scenehotspot = scenedata[i].hotSpots;'; | |
| 2231 | - $html .= 'for(var i = 0; i < scenehotspot.length; i++) {'; | |
| 2232 | - $html .= 'if(scenehotspot[i]["clickHandlerArgs"] != "") {'; | |
| 2233 | - $html .= 'scenehotspot[i]["clickHandlerFunc"] = wpvrhotspot;'; | |
| 2285 | + $html .= 'for(var scId in scenedata) {'; | |
| 2286 | + $html .= 'if(!scenedata.hasOwnProperty(scId)) continue;'; | |
| 2287 | + $html .= 'var scenehotspot = scenedata[scId].hotSpots;'; | |
| 2288 | + $html .= 'if(scenehotspot && scenehotspot.length) {'; | |
| 2289 | + $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {'; | |
| 2290 | + $html .= 'if(scenehotspot[hIdx]["clickHandlerArgs"] != "") {'; | |
| 2291 | + $html .= 'scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; | |
| 2234 | 2292 | $html .= '}'; |
| 2235 | 2293 | if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 2236 | 2294 | } else { |
| 2237 | - $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {'; | |
| 2238 | - $html .= 'scenehotspot[i]["createTooltipFunc"] = wpvrtooltip;'; | |
| 2295 | + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2296 | + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2239 | 2297 | $html .= '}'; |
| 2240 | 2298 | } |
| 2241 | 2299 | $html .= '}'; |
| 2242 | 2300 | $html .= '}'; |
| 2243 | 2301 | $html .= '}'; |
| 2302 | + $html .= '}'; | |
| 2244 | 2303 | |
| 2245 | 2304 | $is_pro = apply_filters('is_wpvr_pro_active',false); |
| 2246 | 2305 | $status = get_option('wpvr_edd_license_status'); |
| 2247 | 2306 | $html .= 'var vr_mode = "off";'; |
| 2248 | 2307 | if ($status !== false && 'valid' == $status && $is_pro) { |
| 2249 | - $html .= 'var panoshow2' . $id . ' = pannellum.viewer("pano2' . $id . '", scenes_duplicate);'; | |
| 2308 | + $html .= 'function initWPVRViewer2' . $pano_suffix . '() {'; | |
| 2309 | + $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer2' . $pano_suffix . ', 50); return; }'; | |
| 2310 | + $html .= 'panoshow2' . $pano_suffix . ' = pannellum.viewer("' . $panoid2 . '", scenes_duplicate);'; | |
| 2250 | 2311 | $html .= ' |
| 2251 | 2312 | window.wpvrViewers = window.wpvrViewers || {}; |
| 2252 | - window.wpvrViewers["pano2' . $id . '"] = panoshow2' . $id . '; | |
| 2313 | + window.wpvrViewers["' . $panoid2 . '"] = panoshow2' . $pano_suffix . '; | |
| 2253 | 2314 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 2254 | - detail: { containerId: "pano2' . $id . '", viewer: panoshow2' . $id . ' } | |
| 2315 | + detail: { containerId: "' . $panoid2 . '", viewer: panoshow2' . $pano_suffix . ' } | |
| 2255 | 2316 | })); |
| 2256 | 2317 | '; |
| 2318 | + $html .= '}'; | |
| 2319 | + $html .= 'initWPVRViewer2' . $pano_suffix . '();'; | |
| 2257 | 2320 | // Show Cardboard Mode in Tour |
| 2258 | 2321 | $html .= ' |
| 2259 | 2322 | var tim; |
| 2260 | 2323 | var im = 0; |
| @@ -2267,43 +2330,45 @@ | ||
| 2267 | 2330 | var scenedata = scenes_duplicate.scenes; |
| 2268 | 2331 | for(var i in scenedata) { |
| 2269 | 2332 | if(active_scene === i) { |
| 2270 | 2333 | var scenehotspot = scenedata[i].hotSpots; |
| 2271 | - for(var j in scenehotspot) { | |
| 2272 | - var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5; | |
| 2273 | - var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5; | |
| 2274 | - var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5; | |
| 2275 | - var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5; | |
| 2276 | - var firstCondition = ( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ; | |
| 2277 | - var secCondition = (Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw); | |
| 2278 | - if(( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ){ | |
| 2279 | - if((Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw)){ | |
| 2280 | - jQuery(".center-pointer").addClass("wpvr-pluse-effect") | |
| 2281 | - var getScene = scenehotspot[j].sceneId; | |
| 2282 | - if(scenehotspot[j].type == "scene"){ | |
| 2283 | - panoshow' . $id . '.loadScene(getScene); | |
| 2284 | - panoshow2' . $id . '.loadScene(getScene); | |
| 2285 | -// var inside_current_time_object = new Date(); | |
| 2286 | -// var inside_timer = inside_current_time_object.getTime(); | |
| 2287 | -// if(inside_timer > timer) { | |
| 2288 | -// panoshow' . $id . '.loadScene(getScene); | |
| 2289 | -// panoshow2' . $id . '.loadScene(getScene); | |
| 2290 | -// jQuery(".center-pointer").removeClass("wpvr-pluse-effect") | |
| 2291 | -// } | |
| 2292 | - }else{ | |
| 2293 | - jQuery(".center-pointer").removeClass("wpvr-pluse-effect") | |
| 2334 | + if(scenehotspot && scenehotspot.length) { | |
| 2335 | + for(var j = 0; j < scenehotspot.length; j++) { | |
| 2336 | + var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5; | |
| 2337 | + var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5; | |
| 2338 | + var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5; | |
| 2339 | + var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5; | |
| 2340 | + if(Math.round(data.pitch) > minusFivePitch) { | |
| 2341 | + if(Math.round(data.pitch) < plusFivePitch) { | |
| 2342 | + if(Math.round(data.yaw) > minusFiveYaw) { | |
| 2343 | + if(Math.round(data.yaw) < plusFiveYaw) { | |
| 2344 | + jQuery(".center-pointer").addClass("wpvr-pluse-effect"); | |
| 2345 | + var getScene = scenehotspot[j].sceneId; | |
| 2346 | + if(scenehotspot[j].type == "scene"){ | |
| 2347 | + panoshow' . $pano_suffix . '.loadScene(getScene); | |
| 2348 | + panoshow2' . $pano_suffix . '.loadScene(getScene); | |
| 2349 | + }else{ | |
| 2350 | + jQuery(".center-pointer").removeClass("wpvr-pluse-effect"); | |
| 2351 | + } | |
| 2352 | + } else { | |
| 2353 | + jQuery(".center-pointer").removeClass("wpvr-pluse-effect"); | |
| 2354 | + c_time = new Date(); | |
| 2355 | + timer = c_time.getTime() + 2000; | |
| 2356 | + } | |
| 2357 | + } else { | |
| 2358 | + jQuery(".center-pointer").removeClass("wpvr-pluse-effect"); | |
| 2359 | + c_time = new Date(); | |
| 2360 | + timer = c_time.getTime() + 2000; | |
| 2361 | + } | |
| 2362 | + } else { | |
| 2363 | + c_time = new Date(); | |
| 2364 | + timer = c_time.getTime() + 2000; | |
| 2294 | 2365 | } |
| 2295 | - } | |
| 2296 | - else { | |
| 2297 | - jQuery(".center-pointer").removeClass("wpvr-pluse-effect") | |
| 2366 | + } else { | |
| 2298 | 2367 | c_time = new Date(); |
| 2299 | 2368 | timer = c_time.getTime() + 2000; |
| 2300 | 2369 | } |
| 2301 | 2370 | } |
| 2302 | - else { | |
| 2303 | - c_time = new Date(); | |
| 2304 | - timer = c_time.getTime() + 2000; | |
| 2305 | - } | |
| 2306 | 2371 | } |
| 2307 | 2372 | } |
| 2308 | 2373 | } |
| 2309 | 2374 | } |
| @@ -2309,26 +2374,28 @@ | ||
| 2309 | 2374 | } |
| 2310 | 2375 | }; |
| 2311 | 2376 | function vrDeviseOrientation(){ |
| 2312 | 2377 | var data = { |
| 2313 | - pitch: panoshow' . $id . '.getPitch(), | |
| 2314 | - yaw: panoshow' . $id . '.getYaw(), | |
| 2378 | + pitch: panoshow' . $pano_suffix . '.getPitch(), | |
| 2379 | + yaw: panoshow' . $pano_suffix . '.getYaw(), | |
| 2315 | 2380 | }; |
| 2316 | 2381 | panoShowCardBoardOnTrigger(data); |
| 2317 | 2382 | }'; |
| 2318 | 2383 | $html .= ' |
| 2319 | 2384 | function requestFullScreen(){ |
| 2320 | - var elem = document.getElementById("master-container"); | |
| 2321 | - if (elem.requestFullscreen) { | |
| 2322 | - elem.requestFullscreen(); | |
| 2323 | - } else if (elem.webkitRequestFullscreen) { /* Safari */ | |
| 2324 | - elem.webkitRequestFullscreen(); | |
| 2325 | - } else if (elem.msRequestFullscreen) { /* IE11 */ | |
| 2326 | - elem.msRequestFullscreen(); | |
| 2327 | - } | |
| 2385 | + var elem = document.getElementById("' . $master_container_id . '") || document.getElementById("master-container"); | |
| 2386 | + if (elem) { | |
| 2387 | + if (elem.requestFullscreen) { | |
| 2388 | + elem.requestFullscreen(); | |
| 2389 | + } else if (elem.webkitRequestFullscreen) { /* Safari */ | |
| 2390 | + elem.webkitRequestFullscreen(); | |
| 2391 | + } else if (elem.msRequestFullscreen) { /* IE11 */ | |
| 2392 | + elem.msRequestFullscreen(); | |
| 2393 | + } | |
| 2394 | + } | |
| 2328 | 2395 | } |
| 2329 | 2396 | function requestExitFullscreen(){ |
| 2330 | - var elem = document.getElementById("master-container"); | |
| 2397 | + var elem = document.getElementById("' . $master_container_id . '") || document.getElementById("master-container"); | |
| 2331 | 2398 | if (document.exitFullscreen) { |
| 2332 | 2399 | document.exitFullscreen(); |
| 2333 | 2400 | } else if (document.webkitExitFullscreen) { /* Safari */ |
| 2334 | 2401 | document.webkitExitFullscreen(); |
| @@ -2350,29 +2417,33 @@ | ||
| 2350 | 2417 | let onLoadAnalytics = false; |
| 2351 | 2418 | let sceneLoadAnalytics = false; |
| 2352 | 2419 | |
| 2353 | 2420 | function storeAnalyticsData(data) { |
| 2354 | - if (typeof wpvrAnalyticsObj !== "undefined" && wpvr_public.is_pro_active) { | |
| 2355 | - jQuery.ajax({ | |
| 2356 | - url: wpvrAnalyticsObj.ajaxUrl, | |
| 2357 | - type: "POST", | |
| 2358 | - data: { | |
| 2359 | - action: "store_scene_hotspot_data", | |
| 2360 | - scene_id: data.scene_id, | |
| 2361 | - tour_id: data.tour_id, | |
| 2362 | - type: data.type, | |
| 2363 | - hotspot_id: data.hotspot_id || "", | |
| 2364 | - user_agent: navigator.userAgent, | |
| 2365 | - device_type: getDeviceType() || "desktop", | |
| 2366 | - nonce: wpvrAnalyticsObj.nonce, | |
| 2367 | - }, | |
| 2368 | - success: function (response) { | |
| 2369 | - console.log("Data stored successfully"); | |
| 2370 | - }, | |
| 2371 | - error: function (error) { | |
| 2372 | - console.log("Error in storing data"); | |
| 2421 | + if (typeof wpvrAnalyticsObj !== "undefined") { | |
| 2422 | + if (typeof wpvr_public !== "undefined") { | |
| 2423 | + if (wpvr_public.is_pro_active) { | |
| 2424 | + jQuery.ajax({ | |
| 2425 | + url: wpvrAnalyticsObj.ajaxUrl, | |
| 2426 | + type: "POST", | |
| 2427 | + data: { | |
| 2428 | + action: "store_scene_hotspot_data", | |
| 2429 | + scene_id: data.scene_id, | |
| 2430 | + tour_id: data.tour_id, | |
| 2431 | + type: data.type, | |
| 2432 | + hotspot_id: data.hotspot_id || "", | |
| 2433 | + user_agent: navigator.userAgent, | |
| 2434 | + device_type: getDeviceType() || "desktop", | |
| 2435 | + nonce: wpvrAnalyticsObj.nonce, | |
| 2436 | + }, | |
| 2437 | + success: function (response) { | |
| 2438 | + console.log("Data stored successfully"); | |
| 2439 | + }, | |
| 2440 | + error: function (error) { | |
| 2441 | + console.log("Error in storing data"); | |
| 2442 | + } | |
| 2443 | + }); | |
| 2373 | 2444 | } |
| 2374 | - }); | |
| 2445 | + } | |
| 2375 | 2446 | } else { |
| 2376 | 2447 | console.warn("Analytics object not available or pro not active"); |
| 2377 | 2448 | } |
| 2378 | 2449 | } |
| @@ -2385,9 +2456,9 @@ | ||
| 2385 | 2456 | } else { |
| 2386 | 2457 | return "desktop"; |
| 2387 | 2458 | } |
| 2388 | 2459 | } |
| 2389 | - panoshow' . $id . '.on("scenechange", function(scene) { | |
| 2460 | + panoshow' . $pano_suffix . '.on("scenechange", function(scene) { | |
| 2390 | 2461 | onLoadAnalytics = true; |
| 2391 | 2462 | sceneLoadAnalytics = true; |
| 2392 | 2463 | let scene_id = scene; |
| 2393 | 2464 | let tour_id = ' . $id . '; |
| @@ -2403,29 +2474,31 @@ | ||
| 2403 | 2474 | user_agent: user_agent, |
| 2404 | 2475 | device_type: device_type, |
| 2405 | 2476 | }); |
| 2406 | 2477 | }); |
| 2407 | - panoshow' . $id . '.on("load", function() { | |
| 2408 | - let scene_id = panoshow' . $id . '.getScene(); | |
| 2478 | + panoshow' . $pano_suffix . '.on("load", function() { | |
| 2479 | + let scene_id = panoshow' . $pano_suffix . '.getScene(); | |
| 2409 | 2480 | let tour_id = ' . $id . '; |
| 2410 | 2481 | let type = "scene"; |
| 2411 | 2482 | let hotspot_id = ""; |
| 2412 | 2483 | let user_agent = navigator.userAgent; |
| 2413 | 2484 | let device_type = getDeviceType() ? getDeviceType() : "desktop"; |
| 2414 | - if(!onLoadAnalytics && !sceneLoadAnalytics) { | |
| 2415 | - storeAnalyticsData({ | |
| 2416 | - scene_id: scene_id, | |
| 2417 | - tour_id: tour_id, | |
| 2418 | - type: type, | |
| 2419 | - hotspot_id: hotspot_id, | |
| 2420 | - user_agent: user_agent, | |
| 2421 | - device_type: device_type, | |
| 2422 | - }); | |
| 2485 | + if(!onLoadAnalytics) { | |
| 2486 | + if(!sceneLoadAnalytics) { | |
| 2487 | + storeAnalyticsData({ | |
| 2488 | + scene_id: scene_id, | |
| 2489 | + tour_id: tour_id, | |
| 2490 | + type: type, | |
| 2491 | + hotspot_id: hotspot_id, | |
| 2492 | + user_agent: user_agent, | |
| 2493 | + device_type: device_type, | |
| 2494 | + }); | |
| 2495 | + } | |
| 2423 | 2496 | } |
| 2424 | 2497 | }); |
| 2425 | - function wpvrhotspotscene(hotSpotDiv, args) { | |
| 2498 | + function wpvrhotspotscene' . $pano_suffix . '(hotSpotDiv, args) { | |
| 2426 | 2499 | onLoadAnalytics = true; |
| 2427 | - let scene_id = panoshow' . $id . '.getScene(); | |
| 2500 | + let scene_id = panoshow' . $pano_suffix . '.getScene(); | |
| 2428 | 2501 | let tour_id = ' . $id . '; |
| 2429 | 2502 | let type = "hotspot"; |
| 2430 | 2503 | let hotspot_id = args; |
| 2431 | 2504 | let user_agent = navigator.userAgent; |
| @@ -2438,27 +2511,28 @@ | ||
| 2438 | 2511 | user_agent: user_agent, |
| 2439 | 2512 | device_type: device_type |
| 2440 | 2513 | }); |
| 2441 | 2514 | } |
| 2515 | + var wpvrhotspotscene = wpvrhotspotscene' . $pano_suffix . '; | |
| 2442 | 2516 | '; |
| 2443 | - $html .= 'panoshow' . $id . '.on("scenechange", function (scene){ | |
| 2517 | + $html .= 'panoshow' . $pano_suffix . '.on("scenechange", function (scene){ | |
| 2444 | 2518 | jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 2445 | 2519 | active_scene = scene; |
| 2446 | 2520 | // if(localStorage.getItem("vr_mode") == "on") { |
| 2447 | 2521 | if(vr_mode == "on") { |
| 2448 | - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2449 | - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2522 | + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2523 | + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2450 | 2524 | } |
| 2451 | 2525 | }); |
| 2452 | 2526 | var compassBlock = ""; |
| 2453 | 2527 | var infoBlock = ""; |
| 2454 | - jQuery(document).on("click",".vr_mode_change' . $id . '",function (){ | |
| 2455 | - jQuery("#pano2' . $id . ' .pnlm-load-button").trigger("click"); | |
| 2456 | - jQuery("#pano' . $id . ' .pnlm-load-button").trigger("click"); | |
| 2528 | + jQuery(document).on("click",".vr_mode_change' . $pano_suffix . '",function (){ | |
| 2529 | + jQuery("#' . $panoid2 . ' .pnlm-load-button").trigger("click"); | |
| 2530 | + jQuery("#' . $panoid . ' .pnlm-load-button").trigger("click"); | |
| 2457 | 2531 | var getValue = jQuery(this).val(); |
| 2458 | 2532 | var getParent = jQuery(this).parent().parent(); |
| 2459 | - var compass = getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display"); | |
| 2460 | - var panoInfo = getParent.find("#pano' . $id . ' .pnlm-panorama-info").css("display"); | |
| 2533 | + var compass = getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display"); | |
| 2534 | + var panoInfo = getParent.find("#' . $panoid . ' .pnlm-panorama-info").css("display"); | |
| 2461 | 2535 | if(compass == "block"){ |
| 2462 | 2536 | compassBlock = "block"; |
| 2463 | 2537 | } |
| 2464 | 2538 | if(panoInfo == "block"){ |
| @@ -2473,79 +2547,79 @@ | ||
| 2473 | 2547 | // localStorage.setItem("vr_mode", "on"); |
| 2474 | 2548 | vr_mode = "on"; |
| 2475 | 2549 | jQuery(".vr-mode-title").show(); |
| 2476 | 2550 | jQuery(this).val("on"); |
| 2477 | - getParent.find("#pano2' . $id . '").css({ | |
| 2551 | + getParent.find("#' . $panoid2 . '").css({ | |
| 2478 | 2552 | "opacity": "1", |
| 2479 | 2553 | "visibility": "visible", |
| 2480 | 2554 | "position": "relative", |
| 2481 | 2555 | }); |
| 2482 | 2556 | gyroSwitch = true; |
| 2483 | - panoshow' . $id . '.startOrientation(); | |
| 2484 | - panoshow2' . $id . '.startOrientation(); | |
| 2485 | - panoshow2' . $id . '.setPitch(panoshow' . $id . '.getPitch(), 0); | |
| 2486 | - panoshow2' . $id . '.setYaw(panoshow' . $id . '.getYaw(), 0); | |
| 2557 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 2558 | + panoshow2' . $pano_suffix . '.startOrientation(); | |
| 2559 | + panoshow2' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch(), 0); | |
| 2560 | + panoshow2' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw(), 0); | |
| 2487 | 2561 | getParent.find(".pano-wrap").addClass("wpvr-cardboard-disable-event"); |
| 2488 | - getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").hide(); | |
| 2489 | - getParent.find("#pano' .$id. ' #controls'.$id.'").hide(); | |
| 2490 | - getParent.find("#pano' .$id. ' #explainer_button_'.$id. '").hide(); | |
| 2491 | - getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").hide(); | |
| 2492 | - getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").hide(); | |
| 2493 | - getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").hide(); | |
| 2494 | - getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide(); | |
| 2495 | - getParent.find("#pano' .$id. ' #adcontrol'.$id.'").hide(); | |
| 2496 | - getParent.find("#pano' .$id. ' .wpvr_slider_nav").hide(); | |
| 2497 | - getParent.find("#pano' .$id. ' #cp-logo-controls").hide(); | |
| 2498 | - getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").hide(); | |
| 2499 | - getParent.find("#pano2' . $id . ' .pnlm-controls-container").hide(); | |
| 2500 | - getParent.find("#pano' . $id . ' .pnlm-controls-container").hide(); | |
| 2501 | - getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2502 | - getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2503 | - getParent.find("#pano2' . $id . ' .pnlm-panorama-info").hide(); | |
| 2504 | - getParent.find("#pano' . $id . ' .pnlm-panorama-info").hide(); | |
| 2505 | - getParent.find("#pano' . $id . '").addClass("cardboard-half"); | |
| 2506 | - getParent.find("#center-pointer' . $id . '").show(); | |
| 2562 | + getParent.find("#' . $panoid . ' #zoom-in-out-controls' . $pano_suffix . '").hide(); | |
| 2563 | + getParent.find("#' . $panoid . ' #controls' . $pano_suffix . '").hide(); | |
| 2564 | + getParent.find("#' . $panoid . ' #explainer_button_' . $pano_suffix . '").hide(); | |
| 2565 | + getParent.find("#' . $panoid . ' #generic_form_button_' . $pano_suffix . '").hide(); | |
| 2566 | + getParent.find("#' . $panoid . ' #floor_map_button_' . $pano_suffix . '").hide(); | |
| 2567 | + getParent.find("#' . $panoid . ' #vrgcontrols' . $pano_suffix . '").hide(); | |
| 2568 | + getParent.find("#' . $panoid . ' #sccontrols' . $pano_suffix . '").hide(); | |
| 2569 | + getParent.find("#' . $panoid . ' #adcontrol' . $pano_suffix . '").hide(); | |
| 2570 | + getParent.find("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 2571 | + getParent.find("#' . $panoid . ' #cp-logo-controls").hide(); | |
| 2572 | + getParent.find("#' . $panoid . ' #wpvr-social-share-bg-box' . $pano_suffix . '").hide(); | |
| 2573 | + getParent.find("#' . $panoid2 . ' .pnlm-controls-container").hide(); | |
| 2574 | + getParent.find("#' . $panoid . ' .pnlm-controls-container").hide(); | |
| 2575 | + getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2576 | + getParent.find("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2577 | + getParent.find("#' . $panoid2 . ' .pnlm-panorama-info").hide(); | |
| 2578 | + getParent.find("#' . $panoid . ' .pnlm-panorama-info").hide(); | |
| 2579 | + getParent.find("#' . $panoid . '").addClass("cardboard-half"); | |
| 2580 | + getParent.find("#center-pointer' . $pano_suffix . '").show(); | |
| 2507 | 2581 | getParent.find(".fullscreen-button").hide(); |
| 2508 | - getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").hide(); | |
| 2582 | + getParent.find("#' . $panoid . ' #custom-scene-navigation' . $pano_suffix . '").hide(); | |
| 2509 | 2583 | if (window.DeviceOrientationEvent) { |
| 2510 | 2584 | window.addEventListener("deviceorientation", vrDeviseOrientation); |
| 2511 | 2585 | } |
| 2512 | - panoshow' . $id . '.on("zoomchange", function (data){ | |
| 2513 | - panoshow2' . $id . '.setHfov(data, 0); | |
| 2586 | + panoshow' . $pano_suffix . '.on("zoomchange", function (data){ | |
| 2587 | + panoshow2' . $pano_suffix . '.setHfov(data, 0); | |
| 2514 | 2588 | }); |
| 2515 | - panoshow2' . $id . '.on("zoomchange", function (data){ | |
| 2516 | - panoshow' . $id . '.setHfov(data, 0); | |
| 2589 | + panoshow2' . $pano_suffix . '.on("zoomchange", function (data){ | |
| 2590 | + panoshow' . $pano_suffix . '.setHfov(data, 0); | |
| 2517 | 2591 | }); |
| 2518 | - jQuery(document).on("click","#pano2' . $id . '",function(event) { | |
| 2519 | - panoshow' . $id . '.startOrientation(); | |
| 2520 | - panoshow2' . $id . '.startOrientation(); | |
| 2592 | + jQuery(document).on("click","#' . $panoid2 . '",function(event) { | |
| 2593 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 2594 | + panoshow2' . $pano_suffix . '.startOrientation(); | |
| 2521 | 2595 | }); |
| 2522 | - jQuery(document).on("click","#pano' . $id . '",function(event) { | |
| 2523 | - panoshow' . $id . '.startOrientation(); | |
| 2524 | - panoshow2' . $id . '.startOrientation(); | |
| 2596 | + jQuery(document).on("click","#' . $panoid . '",function(event) { | |
| 2597 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 2598 | + panoshow2' . $pano_suffix . '.startOrientation(); | |
| 2525 | 2599 | }); |
| 2526 | - panoshow' . $id . '.on("mousemove", function (data){ | |
| 2527 | - panoshow2' . $id . '.setPitch(data.pitch, 0); | |
| 2528 | - panoshow2' . $id . '.setYaw(data.yaw, 0); | |
| 2600 | + panoshow' . $pano_suffix . '.on("mousemove", function (data){ | |
| 2601 | + panoshow2' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2602 | + panoshow2' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2529 | 2603 | panoShowCardBoardOnTrigger(data); |
| 2530 | 2604 | }); |
| 2531 | - panoshow2' . $id . '.on("mousemove", function (data){ | |
| 2532 | - panoshow' . $id . '.setPitch(data.pitch, 0); | |
| 2533 | - panoshow' . $id . '.setYaw(data.yaw, 0); | |
| 2605 | + panoshow2' . $pano_suffix . '.on("mousemove", function (data){ | |
| 2606 | + panoshow' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2607 | + panoshow' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2534 | 2608 | panoShowCardBoardOnTrigger(data); |
| 2535 | 2609 | }); |
| 2536 | - panoshow' . $id . '.on("touchmove", function (data){ | |
| 2537 | - panoshow' . $id . '.stopOrientation(); | |
| 2538 | - panoshow2' . $id . '.stopOrientation(); | |
| 2539 | - panoshow2' . $id . '.setPitch(data.pitch, 0); | |
| 2540 | - panoshow2' . $id . '.setYaw(data.yaw, 0); | |
| 2610 | + panoshow' . $pano_suffix . '.on("touchmove", function (data){ | |
| 2611 | + panoshow' . $pano_suffix . '.stopOrientation(); | |
| 2612 | + panoshow2' . $pano_suffix . '.stopOrientation(); | |
| 2613 | + panoshow2' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2614 | + panoshow2' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2541 | 2615 | panoShowCardBoardOnTrigger(data); |
| 2542 | 2616 | }); |
| 2543 | - panoshow2' . $id . '.on("touchmove", function (data){ | |
| 2544 | - panoshow' . $id . '.stopOrientation(); | |
| 2545 | - panoshow2' . $id . '.stopOrientation(); | |
| 2546 | - panoshow' . $id . '.setPitch(data.pitch, 0); | |
| 2547 | - panoshow' . $id . '.setYaw(data.yaw, 0); | |
| 2617 | + panoshow2' . $pano_suffix . '.on("touchmove", function (data){ | |
| 2618 | + panoshow' . $pano_suffix . '.stopOrientation(); | |
| 2619 | + panoshow2' . $pano_suffix . '.stopOrientation(); | |
| 2620 | + panoshow' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2621 | + panoshow' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2548 | 2622 | panoShowCardBoardOnTrigger(data); |
| 2549 | 2623 | }); |
| 2550 | 2624 | } else if(getValue == "on") { |
| 2551 | 2625 | screen.orientation.unlock(); |
| @@ -2553,66 +2627,66 @@ | ||
| 2553 | 2627 | // localStorage.setItem("vr_mode", "off"); |
| 2554 | 2628 | vr_mode = "off"; |
| 2555 | 2629 | jQuery(".vr-mode-title").hide(); |
| 2556 | 2630 | jQuery(this).val("off"); |
| 2557 | - getParent.find("#pano2' . $id . '").css({ | |
| 2631 | + getParent.find("#' . $panoid2 . '").css({ | |
| 2558 | 2632 | "opacity": "0", |
| 2559 | 2633 | "visibility": "hidden", |
| 2560 | 2634 | "position": "absolute", |
| 2561 | 2635 | }); |
| 2562 | 2636 | getParent.find(".pano-wrap").removeClass("wpvr-cardboard-disable-event"); |
| 2563 | - getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").show(); | |
| 2564 | - getParent.find("#pano' .$id. ' #controls'.$id.'").show(); | |
| 2565 | - getParent.find("#pano' .$id. ' #explainer_button_'.$id. '").show(); | |
| 2566 | - getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").show(); | |
| 2567 | - getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").show(); | |
| 2568 | - getParent.find("#pano2' . $id . ' .pnlm-controls-container").show(); | |
| 2569 | - getParent.find("#pano' . $id . ' .pnlm-controls-container").show(); | |
| 2570 | - getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").show(); | |
| 2571 | - getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide(); | |
| 2572 | - getParent.find("#pano' .$id. ' #adcontrol'.$id.'").show(); | |
| 2573 | - getParent.find("#pano' .$id. ' .wpvr_slider_nav").hide(); | |
| 2574 | - getParent.find("#pano' .$id. ' #cp-logo-controls").show(); | |
| 2575 | - getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").show(); | |
| 2576 | - getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").show(); | |
| 2637 | + getParent.find("#' . $panoid . ' #zoom-in-out-controls' . $pano_suffix . '").show(); | |
| 2638 | + getParent.find("#' . $panoid . ' #controls' . $pano_suffix . '").show(); | |
| 2639 | + getParent.find("#' . $panoid . ' #explainer_button_' . $pano_suffix . '").show(); | |
| 2640 | + getParent.find("#' . $panoid . ' #generic_form_button_' . $pano_suffix . '").show(); | |
| 2641 | + getParent.find("#' . $panoid . ' #floor_map_button_' . $pano_suffix . '").show(); | |
| 2642 | + getParent.find("#' . $panoid2 . ' .pnlm-controls-container").show(); | |
| 2643 | + getParent.find("#' . $panoid . ' .pnlm-controls-container").show(); | |
| 2644 | + getParent.find("#' . $panoid . ' #vrgcontrols' . $pano_suffix . '").show(); | |
| 2645 | + getParent.find("#' . $panoid . ' #sccontrols' . $pano_suffix . '").hide(); | |
| 2646 | + getParent.find("#' . $panoid . ' #adcontrol' . $pano_suffix . '").show(); | |
| 2647 | + getParent.find("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 2648 | + getParent.find("#' . $panoid . ' #cp-logo-controls").show(); | |
| 2649 | + getParent.find("#' . $panoid . ' #wpvr-social-share-bg-box' . $pano_suffix . '").show(); | |
| 2650 | + getParent.find("#' . $panoid . ' #custom-scene-navigation' . $pano_suffix . '").show(); | |
| 2577 | 2651 | if(compassBlock == "block"){ |
| 2578 | - getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2579 | - getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2652 | + getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2653 | + getParent.find("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2580 | 2654 | } |
| 2581 | 2655 | if(infoBlock == "block"){ |
| 2582 | - getParent.find("#pano2' . $id . ' .pnlm-panorama-info").show(); | |
| 2583 | - getParent.find("#pano' . $id . ' .pnlm-panorama-info").show(); | |
| 2656 | + getParent.find("#' . $panoid2 . ' .pnlm-panorama-info").show(); | |
| 2657 | + getParent.find("#' . $panoid . ' .pnlm-panorama-info").show(); | |
| 2584 | 2658 | } |
| 2585 | - getParent.find("#pano' . $id . '").removeClass("cardboard-half"); | |
| 2586 | - getParent.find("#center-pointer' . $id . '").hide(); | |
| 2659 | + getParent.find("#' . $panoid . '").removeClass("cardboard-half"); | |
| 2660 | + getParent.find("#center-pointer' . $pano_suffix . '").hide(); | |
| 2587 | 2661 | getParent.find(".fullscreen-button").hide(); |
| 2588 | - panoshow' . $id . '.off("mousemove"); | |
| 2589 | - panoshow' . $id . '.off("touchmove"); | |
| 2590 | - panoshow2' . $id . '.off("mousemove"); | |
| 2591 | - panoshow2' . $id . '.off("touchmove"); | |
| 2662 | + panoshow' . $pano_suffix . '.off("mousemove"); | |
| 2663 | + panoshow' . $pano_suffix . '.off("touchmove"); | |
| 2664 | + panoshow2' . $pano_suffix . '.off("mousemove"); | |
| 2665 | + panoshow2' . $pano_suffix . '.off("touchmove"); | |
| 2592 | 2666 | if (window.DeviceOrientationEvent) { |
| 2593 | 2667 | window.removeEventListener("deviceorientation", vrDeviseOrientation); |
| 2594 | 2668 | } |
| 2595 | 2669 | } |
| 2596 | 2670 | });'; |
| 2597 | - $html .= 'panoshow2' . $id . '.on("load", function (){ | |
| 2671 | + $html .= 'panoshow2' . $pano_suffix . '.on("load", function (){ | |
| 2598 | 2672 | // if(localStorage.getItem("vr_mode") == "off") { |
| 2599 | 2673 | if( vr_mode == "off") { |
| 2600 | 2674 | jQuery(".vr-mode-title").hide(); |
| 2601 | 2675 | } |
| 2602 | 2676 | else { |
| 2603 | - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2604 | - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2605 | - jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide(); | |
| 2606 | - jQuery("#pano' . $id . ' .pnlm-panorama-info").hide(); | |
| 2677 | + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2678 | + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2679 | + jQuery("#' . $panoid2 . ' .pnlm-panorama-info").hide(); | |
| 2680 | + jQuery("#' . $panoid . ' .pnlm-panorama-info").hide(); | |
| 2607 | 2681 | jQuery(".vr-mode-title").show(); |
| 2608 | 2682 | } |
| 2609 | 2683 | });'; |
| 2610 | 2684 | } |
| 2611 | 2685 | //=== end Dplicate mode only for vr mode===// |
| 2612 | - $html .= 'jQuery("#pano' . $id . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){ | |
| 2686 | + $html .= 'jQuery("#' . $panoid . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){ | |
| 2613 | 2687 | var scene_id = jQuery(this).attr("scene_id"); |
| 2614 | - panoshow' . $id . '.loadScene(scene_id) | |
| 2688 | + panoshow' . $pano_suffix . '.loadScene(scene_id) | |
| 2615 | 2689 | jQuery(".floor-plan-pointer").removeClass("add-pulse") |
| 2616 | 2690 | jQuery(this).addClass("add-pulse") |
| 2617 | 2691 | });'; |
| 2618 | 2692 | if ($scene_animation_enabled && is_plugin_active('wpvr-pro/wpvr-pro.php')) { |
| @@ -2622,9 +2696,9 @@ | ||
| 2622 | 2696 | $animationDelay = $postdata['sceneAnimationTransitionDelay'] ?? '0ms'; |
| 2623 | 2697 | $animation_js = apply_filters('wpvr_scene_animation_js', $id, $animation_type, $animationDuration, $animationDelay); |
| 2624 | 2698 | if (!empty($animation_js)) { |
| 2625 | 2699 | $html .= $animation_js; |
| 2626 | - $html .= 'panoshow' . $id . '.on("load", function (scene){ | |
| 2700 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (scene){ | |
| 2627 | 2701 | if (typeof changeScene === "function") { |
| 2628 | 2702 | changeScene(); |
| 2629 | 2703 | } else { |
| 2630 | 2704 | console.warn("changeScene function is not defined."); |
| @@ -2632,15 +2706,15 @@ | ||
| 2632 | 2706 | });'; |
| 2633 | 2707 | } |
| 2634 | 2708 | } |
| 2635 | 2709 | |
| 2636 | - $html .= 'panoshow' . $id . '.on("mousemove", function (data){ | |
| 2710 | + $html .= 'panoshow' . $pano_suffix . '.on("mousemove", function (data){ | |
| 2637 | 2711 | jQuery(".add-pulse").css({"transform":"rotate("+data.yaw+"deg)"}); |
| 2638 | 2712 | }); |
| 2639 | 2713 | '; |
| 2640 | 2714 | $status = get_option('wpvr_edd_license_status'); |
| 2641 | 2715 | if ($status !== false && 'valid' == $status && $is_pro){ |
| 2642 | - $html .= 'panoshow' . $id . '.on("scenechange", function (scene){ | |
| 2716 | + $html .= 'panoshow' . $pano_suffix . '.on("scenechange", function (scene){ | |
| 2643 | 2717 | jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 2644 | 2718 | jQuery(".floor-plan-pointer").each(function(index ,element){ |
| 2645 | 2719 | var scene_id = jQuery(this).attr("scene_id"); |
| 2646 | 2720 | if( active_scene == scene_id ){ |
| @@ -2648,9 +2722,9 @@ | ||
| 2648 | 2722 | jQuery(this).addClass("add-pulse") |
| 2649 | 2723 | } |
| 2650 | 2724 | }); |
| 2651 | 2725 | });'; |
| 2652 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 2726 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 2653 | 2727 | if(jQuery(".floor-plan-pointer").length > 0){ |
| 2654 | 2728 | jQuery(".floor-plan-pointer").each(function(index ,element){ |
| 2655 | 2729 | var scene_id = jQuery(this).attr("scene_id"); |
| 2656 | 2730 | if( active_scene == scene_id ){ |
| @@ -2662,14 +2736,14 @@ | ||
| 2662 | 2736 | });'; |
| 2663 | 2737 | } |
| 2664 | 2738 | if ($status !== false && 'valid' == $status && $is_pro){ |
| 2665 | 2739 | $scene_navigation_content_type = isset($postdata['scene_navigation_content_type']) ? $postdata['scene_navigation_content_type'] : 'scene_id'; |
| 2666 | - $html .= 'jQuery("#pano' . $id . ' .custom-scene-navigation").on("click", function() { | |
| 2667 | - jQuery("#custom-scene-navigation-nav' . $id . ' ul").empty(); | |
| 2740 | + $html .= 'jQuery("#' . $panoid . ' .custom-scene-navigation").on("click", function() { | |
| 2741 | + jQuery("#custom-scene-navigation-nav' . $pano_suffix . ' ul").empty(); | |
| 2668 | 2742 | if (scenes) { |
| 2669 | 2743 | var scene_navigation_content_type = "' . $scene_navigation_content_type . '"; |
| 2670 | 2744 | var sceneList = scenes.scenes; |
| 2671 | - var getScene = panoshow' . $id . '.getScene(); | |
| 2745 | + var getScene = panoshow' . $pano_suffix . '.getScene(); | |
| 2672 | 2746 | for (const key in sceneList) { |
| 2673 | 2747 | let title; |
| 2674 | 2748 | if (scene_navigation_content_type === "scene_title") { |
| 2675 | 2749 | if (sceneList[key].title) { |
| @@ -2688,9 +2762,9 @@ | ||
| 2688 | 2762 | } else { |
| 2689 | 2763 | title = key; |
| 2690 | 2764 | } |
| 2691 | 2765 | if (sceneList.hasOwnProperty(key)) { |
| 2692 | - let ulElement = document.querySelector("#custom-scene-navigation-nav' . $id . ' ul"); | |
| 2766 | + let ulElement = document.querySelector("#custom-scene-navigation-nav' . $pano_suffix . ' ul"); | |
| 2693 | 2767 | if (ulElement) { |
| 2694 | 2768 | let liElement = document.createElement("li"); |
| 2695 | 2769 | liElement.className = "scene-navigation-list" + (key === getScene ? " active" : ""); |
| 2696 | 2770 | liElement.setAttribute("scene_id", key); |
| @@ -2698,9 +2772,9 @@ | ||
| 2698 | 2772 | ulElement.appendChild(liElement); |
| 2699 | 2773 | } |
| 2700 | 2774 | } |
| 2701 | 2775 | } |
| 2702 | - jQuery("#custom-scene-navigation-nav' . $id . '").toggleClass("visible"); | |
| 2776 | + jQuery("#custom-scene-navigation-nav' . $pano_suffix . '").toggleClass("visible"); | |
| 2703 | 2777 | } |
| 2704 | 2778 | });'; |
| 2705 | 2779 | $html .='function getImageNameWithoutExtension(imageUrl) { |
| 2706 | 2780 | // Split the URL by "/" |
| @@ -2713,70 +2787,70 @@ | ||
| 2713 | 2787 | var imageNameWithoutExtension = imageNameParts.slice(0, -1).join("."); |
| 2714 | 2788 | // Return the image name without extension |
| 2715 | 2789 | return imageNameWithoutExtension; |
| 2716 | 2790 | }'; |
| 2717 | - $html .= 'jQuery("#pano' . $id . ' #custom-scene-navigation-nav' . $id . ' ul").on("click", "li.scene-navigation-list", function() { | |
| 2791 | + $html .= 'jQuery("#' . $panoid . ' #custom-scene-navigation-nav' . $pano_suffix . ' ul").on("click", "li.scene-navigation-list", function() { | |
| 2718 | 2792 | if (scenes) { |
| 2719 | 2793 | jQuery(this).siblings("li").removeClass("active"); |
| 2720 | 2794 | jQuery(this).addClass("active"); |
| 2721 | 2795 | var scene_key = jQuery(this).attr("scene_id"); |
| 2722 | - panoshow' . $id . '.loadScene(scene_key); | |
| 2796 | + panoshow' . $pano_suffix . '.loadScene(scene_key); | |
| 2723 | 2797 | } |
| 2724 | 2798 | });'; |
| 2725 | 2799 | } |
| 2726 | 2800 | $html .= 'const node = document.querySelector(".add-pulse"); |
| 2727 | - panoshow' . $id . '.on("compasschange", function (data){ | |
| 2801 | + panoshow' . $pano_suffix . '.on("compasschange", function (data){ | |
| 2728 | 2802 | // const node = document.querySelector(".add-pulse"); |
| 2729 | 2803 | // node.style.transform = data; |
| 2730 | 2804 | // jQuery(".add-pulse").css({"transform":data}); |
| 2731 | 2805 | });'; |
| 2732 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 2806 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 2733 | 2807 | // if(localStorage.getItem("vr_mode") == "off") { |
| 2734 | 2808 | if(vr_mode == "off") { |
| 2735 | 2809 | jQuery(".vr-mode-title").hide(); |
| 2736 | 2810 | } else { |
| 2737 | - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2738 | - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2739 | - jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide(); | |
| 2740 | - jQuery("#pano' . $id . ' .pnlm-panorama-info").hide(); | |
| 2811 | + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2812 | + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2813 | + jQuery("#' . $panoid2 . ' .pnlm-panorama-info").hide(); | |
| 2814 | + jQuery("#' . $panoid . ' .pnlm-panorama-info").hide(); | |
| 2741 | 2815 | jQuery(".vr-mode-title").show(); |
| 2742 | 2816 | } |
| 2743 | 2817 | setTimeout(() => { |
| 2744 | 2818 | window.dispatchEvent(new Event("resize")); |
| 2745 | 2819 | }, 200); |
| 2746 | - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 2747 | - jQuery("#controls' . $id . '").css("bottom", "80px"); | |
| 2820 | + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 2821 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "80px"); | |
| 2748 | 2822 | } |
| 2749 | 2823 | else { |
| 2750 | - jQuery("#controls' . $id . '").css("bottom", "5px"); | |
| 2824 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px"); | |
| 2751 | 2825 | } |
| 2752 | 2826 | });'; |
| 2753 | - $html .= 'panoshow' . $id . '.on("render", function (){ | |
| 2827 | + $html .= 'panoshow' . $pano_suffix . '.on("render", function (){ | |
| 2754 | 2828 | window.dispatchEvent(new Event("resize")); |
| 2755 | 2829 | });'; |
| 2756 | 2830 | $html .= 'if (scenes.autoRotate) { |
| 2757 | - var wpvrAutoRotateTimer' . $id . ' = null; | |
| 2758 | - var wpvrAutoRotateStopDelay' . $id . ' = parseInt(scenes.autoRotateStopDelay, 10) || 0; | |
| 2759 | - var wpvrScheduleAutoRotate' . $id . ' = function () { | |
| 2760 | - clearTimeout(wpvrAutoRotateTimer' . $id . '); | |
| 2761 | - if (wpvrAutoRotateStopDelay' . $id . ' > 0) { | |
| 2762 | - wpvrAutoRotateTimer' . $id . ' = setTimeout(function () { | |
| 2763 | - panoshow' . $id . '.stopAutoRotate(); | |
| 2764 | - }, wpvrAutoRotateStopDelay' . $id . '); | |
| 2831 | + var wpvrAutoRotateTimer' . $pano_suffix . ' = null; | |
| 2832 | + var wpvrAutoRotateStopDelay' . $pano_suffix . ' = parseInt(scenes.autoRotateStopDelay, 10) || 0; | |
| 2833 | + var wpvrScheduleAutoRotate' . $pano_suffix . ' = function () { | |
| 2834 | + clearTimeout(wpvrAutoRotateTimer' . $pano_suffix . '); | |
| 2835 | + if (wpvrAutoRotateStopDelay' . $pano_suffix . ' > 0) { | |
| 2836 | + wpvrAutoRotateTimer' . $pano_suffix . ' = setTimeout(function () { | |
| 2837 | + panoshow' . $pano_suffix . '.stopAutoRotate(); | |
| 2838 | + }, wpvrAutoRotateStopDelay' . $pano_suffix . '); | |
| 2765 | 2839 | } else { |
| 2766 | - wpvrAutoRotateTimer' . $id . ' = setTimeout(function () { | |
| 2767 | - panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); | |
| 2840 | + wpvrAutoRotateTimer' . $pano_suffix . ' = setTimeout(function () { | |
| 2841 | + panoshow' . $pano_suffix . '.startAutoRotate(scenes.autoRotate, 0); | |
| 2768 | 2842 | }, 3000); |
| 2769 | 2843 | } |
| 2770 | 2844 | }; |
| 2771 | - panoshow' . $id . '.on("load", wpvrScheduleAutoRotate' . $id . '); | |
| 2772 | - panoshow' . $id . '.on("scenechange", wpvrScheduleAutoRotate' . $id . '); | |
| 2845 | + panoshow' . $pano_suffix . '.on("load", wpvrScheduleAutoRotate' . $pano_suffix . '); | |
| 2846 | + panoshow' . $pano_suffix . '.on("scenechange", wpvrScheduleAutoRotate' . $pano_suffix . '); | |
| 2773 | 2847 | }'; |
| 2774 | 2848 | $html .= 'var touchtime = 0;'; |
| 2775 | 2849 | $html .= ' |
| 2776 | - var wpvrHotspotRoot' . $id . ' = document.getElementById("pano' . $id . '"); | |
| 2777 | - if (wpvrHotspotRoot' . $id . ') { | |
| 2778 | - wpvrHotspotRoot' . $id . '.addEventListener("click", function (event) { | |
| 2850 | + var wpvrHotspotRoot' . $pano_suffix . ' = document.getElementById("' . $panoid . '"); | |
| 2851 | + if (wpvrHotspotRoot' . $pano_suffix . ') { | |
| 2852 | + wpvrHotspotRoot' . $pano_suffix . '.addEventListener("click", function (event) { | |
| 2779 | 2853 | var hotspot = event.target.closest(".pnlm-hotspot-base"); |
| 2780 | 2854 | |
| 2781 | 2855 | if (!hotspot) { |
| 2782 | 2856 | return; |
| @@ -2807,11 +2881,11 @@ | ||
| 2807 | 2881 | if (isset($panodata["scene-list"])) { |
| 2808 | 2882 | foreach ($panodata["scene-list"] as $panoscenes) { |
| 2809 | 2883 | $scene_key = $panoscenes['scene-id']; |
| 2810 | 2884 | $gallery_scene_ids[] = (string) $scene_key; |
| 2811 | - $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $id; | |
| 2885 | + $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $pano_suffix; | |
| 2812 | 2886 | $html .= 'jQuery(document).on("click","#' . $scene_key_gallery . '",function() { |
| 2813 | - panoshow' . $id . '.loadScene("' . $scene_key . '"); | |
| 2887 | + panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $scene_key ) . '); | |
| 2814 | 2888 | });'; |
| 2815 | 2889 | } |
| 2816 | 2890 | } |
| 2817 | 2891 | |
| @@ -2839,22 +2913,22 @@ | ||
| 2839 | 2913 | stagePadding: 0 |
| 2840 | 2914 | }'; |
| 2841 | 2915 | |
| 2842 | 2916 | $html .= ' |
| 2843 | - var wpvrGallery' . $id . ' = jQuery("#sccontrols' . $id . '"); | |
| 2844 | - var wpvrGalleryRoot' . $id . ' = jQuery("#pano' . $id . '"); | |
| 2845 | - var wpvrGalleryScenes' . $id . ' = ' . wp_json_encode(array_values($gallery_scene_ids)) . '; | |
| 2846 | - var wpvrGalleryResizeTimer' . $id . '; | |
| 2847 | - var wpvrGalleryVisibilityTimer' . $id . '; | |
| 2848 | - var wpvrGalleryObserver' . $id . '; | |
| 2917 | + var wpvrGallery' . $pano_suffix . ' = jQuery("#sccontrols' . $pano_suffix . '"); | |
| 2918 | + var wpvrGalleryRoot' . $pano_suffix . ' = jQuery("#' . $panoid . '"); | |
| 2919 | + var wpvrGalleryScenes' . $pano_suffix . ' = ' . wp_json_encode(array_values($gallery_scene_ids)) . '; | |
| 2920 | + var wpvrGalleryResizeTimer' . $pano_suffix . '; | |
| 2921 | + var wpvrGalleryVisibilityTimer' . $pano_suffix . '; | |
| 2922 | + var wpvrGalleryObserver' . $pano_suffix . '; | |
| 2849 | 2923 | |
| 2850 | - function wpvrPrepareSceneNavigation' . $id . '() { | |
| 2851 | - var navigationDisabled = wpvrGalleryScenes' . $id . '.length < 2; | |
| 2852 | - var previousButtons = wpvrGalleryRoot' . $id . '.find(".wpvr_owl_prev"); | |
| 2853 | - var nextButtons = wpvrGalleryRoot' . $id . '.find(".wpvr_owl_next"); | |
| 2924 | + function wpvrPrepareSceneNavigation' . $pano_suffix . '() { | |
| 2925 | + var navigationDisabled = wpvrGalleryScenes' . $pano_suffix . '.length < 2; | |
| 2926 | + var previousButtons = wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_owl_prev"); | |
| 2927 | + var nextButtons = wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_owl_next"); | |
| 2854 | 2928 | |
| 2855 | - wpvrGallery' . $id . '.removeClass("owl-theme"); | |
| 2856 | - wpvrGalleryRoot' . $id . '.find(".wpvr_slider_nav").removeClass("owl-nav"); | |
| 2929 | + wpvrGallery' . $pano_suffix . '.removeClass("owl-theme"); | |
| 2930 | + wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_slider_nav").removeClass("owl-nav"); | |
| 2857 | 2931 | previousButtons |
| 2858 | 2932 | .removeClass("owl-prev") |
| 2859 | 2933 | .prop("disabled", navigationDisabled) |
| 2860 | 2934 | .toggleClass("disabled", navigationDisabled); |
| @@ -2863,76 +2937,76 @@ | ||
| 2863 | 2937 | .prop("disabled", navigationDisabled) |
| 2864 | 2938 | .toggleClass("disabled", navigationDisabled); |
| 2865 | 2939 | } |
| 2866 | 2940 | |
| 2867 | - function wpvrRefreshGallery' . $id . '() { | |
| 2868 | - wpvrPrepareSceneNavigation' . $id . '(); | |
| 2941 | + function wpvrRefreshGallery' . $pano_suffix . '() { | |
| 2942 | + wpvrPrepareSceneNavigation' . $pano_suffix . '(); | |
| 2869 | 2943 | |
| 2870 | - if (!wpvrGallery' . $id . '.length || !wpvrGallery' . $id . '.hasClass("owl-loaded") || !wpvrGallery' . $id . '.is(":visible")) { | |
| 2944 | + if (!wpvrGallery' . $pano_suffix . '.length || !wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded") || !wpvrGallery' . $pano_suffix . '.is(":visible")) { | |
| 2871 | 2945 | return; |
| 2872 | 2946 | } |
| 2873 | 2947 | |
| 2874 | - if (wpvrGallery' . $id . '.css("display") === "flex") { | |
| 2875 | - wpvrGallery' . $id . '.css("display", "block"); | |
| 2948 | + if (wpvrGallery' . $pano_suffix . '.css("display") === "flex") { | |
| 2949 | + wpvrGallery' . $pano_suffix . '.css("display", "block"); | |
| 2876 | 2950 | } |
| 2877 | - wpvrGallery' . $id . '.trigger("refresh.owl.carousel"); | |
| 2878 | - wpvrUpdateGalleryNavigation' . $id . '(panoshow' . $id . '.getScene()); | |
| 2951 | + wpvrGallery' . $pano_suffix . '.trigger("refresh.owl.carousel"); | |
| 2952 | + wpvrUpdateGalleryNavigation' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene()); | |
| 2879 | 2953 | } |
| 2880 | 2954 | |
| 2881 | - function wpvrGallerySceneIndex' . $id . '(sceneId) { | |
| 2882 | - return wpvrGalleryScenes' . $id . '.indexOf(String(sceneId)); | |
| 2955 | + function wpvrGallerySceneIndex' . $pano_suffix . '(sceneId) { | |
| 2956 | + return wpvrGalleryScenes' . $pano_suffix . '.indexOf(String(sceneId)); | |
| 2883 | 2957 | } |
| 2884 | 2958 | |
| 2885 | - function wpvrUpdateGalleryNavigation' . $id . '(sceneId) { | |
| 2886 | - var currentIndex = wpvrGallerySceneIndex' . $id . '(sceneId); | |
| 2887 | - var activeThumbnailId = String(sceneId) + "_gallery_' . $id . '"; | |
| 2888 | - var thumbnails = wpvrGallery' . $id . '.find("img.scctrl"); | |
| 2959 | + function wpvrUpdateGalleryNavigation' . $pano_suffix . '(sceneId) { | |
| 2960 | + var currentIndex = wpvrGallerySceneIndex' . $pano_suffix . '(sceneId); | |
| 2961 | + var activeThumbnailId = String(sceneId) + "_gallery_' . $pano_suffix . '"; | |
| 2962 | + var thumbnails = wpvrGallery' . $pano_suffix . '.find("img.scctrl"); | |
| 2889 | 2963 | var activeThumbnail = thumbnails.filter(function () { |
| 2890 | 2964 | return this.id === activeThumbnailId; |
| 2891 | 2965 | }); |
| 2892 | 2966 | |
| 2893 | - wpvrPrepareSceneNavigation' . $id . '(); | |
| 2967 | + wpvrPrepareSceneNavigation' . $pano_suffix . '(); | |
| 2894 | 2968 | thumbnails.removeClass("wpvr-active-thumbnail"); |
| 2895 | - wpvrGallery' . $id . '.find(".owl-item").removeClass("clicked"); | |
| 2969 | + wpvrGallery' . $pano_suffix . '.find(".owl-item").removeClass("clicked"); | |
| 2896 | 2970 | activeThumbnail.addClass("wpvr-active-thumbnail"); |
| 2897 | 2971 | activeThumbnail.closest(".owl-item").addClass("clicked"); |
| 2898 | 2972 | |
| 2899 | 2973 | if (currentIndex >= 0) { |
| 2900 | - if (wpvrGallery' . $id . '.hasClass("owl-loaded")) { | |
| 2901 | - wpvrGallery' . $id . '.trigger("to.owl.carousel", [currentIndex, 300, true]); | |
| 2902 | - window.setTimeout(wpvrPrepareSceneNavigation' . $id . ', 0); | |
| 2974 | + if (wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded")) { | |
| 2975 | + wpvrGallery' . $pano_suffix . '.trigger("to.owl.carousel", [currentIndex, 300, true]); | |
| 2976 | + window.setTimeout(wpvrPrepareSceneNavigation' . $pano_suffix . ', 0); | |
| 2903 | 2977 | } |
| 2904 | 2978 | } |
| 2905 | 2979 | } |
| 2906 | 2980 | |
| 2907 | - function wpvrLoadAdjacentGalleryScene' . $id . '(direction) { | |
| 2908 | - var currentIndex = wpvrGallerySceneIndex' . $id . '(panoshow' . $id . '.getScene()); | |
| 2981 | + function wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(direction) { | |
| 2982 | + var currentIndex = wpvrGallerySceneIndex' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene()); | |
| 2909 | 2983 | |
| 2910 | - if (currentIndex < 0 || wpvrGalleryScenes' . $id . '.length < 2) { | |
| 2984 | + if (currentIndex < 0 || wpvrGalleryScenes' . $pano_suffix . '.length < 2) { | |
| 2911 | 2985 | return; |
| 2912 | 2986 | } |
| 2913 | 2987 | |
| 2914 | - var targetIndex = (currentIndex + direction + wpvrGalleryScenes' . $id . '.length) % wpvrGalleryScenes' . $id . '.length; | |
| 2915 | - panoshow' . $id . '.loadScene(wpvrGalleryScenes' . $id . '[targetIndex]); | |
| 2988 | + var targetIndex = (currentIndex + direction + wpvrGalleryScenes' . $pano_suffix . '.length) % wpvrGalleryScenes' . $pano_suffix . '.length; | |
| 2989 | + panoshow' . $pano_suffix . '.loadScene(wpvrGalleryScenes' . $pano_suffix . '[targetIndex]); | |
| 2916 | 2990 | } |
| 2917 | 2991 | |
| 2918 | 2992 | if (jQuery.fn.owlCarousel) { |
| 2919 | - if (wpvrGallery' . $id . '.length) { | |
| 2920 | - if (!wpvrGallery' . $id . '.hasClass("owl-loaded")) { | |
| 2921 | - wpvrGallery' . $id . '.owlCarousel(' . $gallery_options . '); | |
| 2993 | + if (wpvrGallery' . $pano_suffix . '.length) { | |
| 2994 | + if (!wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded")) { | |
| 2995 | + wpvrGallery' . $pano_suffix . '.owlCarousel(' . $gallery_options . '); | |
| 2922 | 2996 | } |
| 2923 | 2997 | } |
| 2924 | 2998 | } |
| 2925 | 2999 | |
| 2926 | - wpvrGalleryRoot' . $id . ' | |
| 2927 | - .off("click.wpvrGalleryRefresh' . $id . '", "#vrgcontrols' . $id . '") | |
| 2928 | - .on("click.wpvrGalleryRefresh' . $id . '", "#vrgcontrols' . $id . '", function () { | |
| 2929 | - wpvrPrepareSceneNavigation' . $id . '(); | |
| 2930 | - window.setTimeout(wpvrRefreshGallery' . $id . ', 450); | |
| 3000 | + wpvrGalleryRoot' . $pano_suffix . ' | |
| 3001 | + .off("click.wpvrGalleryRefresh' . $pano_suffix . '", "#vrgcontrols' . $pano_suffix . '") | |
| 3002 | + .on("click.wpvrGalleryRefresh' . $pano_suffix . '", "#vrgcontrols' . $pano_suffix . '", function () { | |
| 3003 | + wpvrPrepareSceneNavigation' . $pano_suffix . '(); | |
| 3004 | + window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 450); | |
| 2931 | 3005 | }); |
| 2932 | 3006 | |
| 2933 | - if (wpvrGalleryRoot' . $id . '.length) { | |
| 2934 | - wpvrGalleryRoot' . $id . '[0].addEventListener("click", function (event) { | |
| 3007 | + if (wpvrGalleryRoot' . $pano_suffix . '.length) { | |
| 3008 | + wpvrGalleryRoot' . $pano_suffix . '[0].addEventListener("click", function (event) { | |
| 2935 | 3009 | var navigationButton = event.target.closest(".wpvr_owl_prev, .wpvr_owl_next"); |
| 2936 | 3010 | |
| 2937 | 3011 | if (!navigationButton) { |
| 2938 | 3012 | return; |
| @@ -2937,9 +3011,9 @@ | ||
| 2937 | 3011 | if (!navigationButton) { |
| 2938 | 3012 | return; |
| 2939 | 3013 | } |
| 2940 | 3014 | |
| 2941 | - if (!wpvrGalleryRoot' . $id . '[0].contains(navigationButton)) { | |
| 3015 | + if (!wpvrGalleryRoot' . $pano_suffix . '[0].contains(navigationButton)) { | |
| 2942 | 3016 | return; |
| 2943 | 3017 | } |
| 2944 | 3018 | |
| 2945 | 3019 | event.preventDefault(); |
| @@ -2945,29 +3019,29 @@ | ||
| 2945 | 3019 | event.preventDefault(); |
| 2946 | 3020 | event.stopImmediatePropagation(); |
| 2947 | 3021 | |
| 2948 | 3022 | if (navigationButton.classList.contains("wpvr_owl_prev")) { |
| 2949 | - wpvrLoadAdjacentGalleryScene' . $id . '(-1); | |
| 3023 | + wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(-1); | |
| 2950 | 3024 | } else { |
| 2951 | - wpvrLoadAdjacentGalleryScene' . $id . '(1); | |
| 3025 | + wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(1); | |
| 2952 | 3026 | } |
| 2953 | 3027 | }, true); |
| 2954 | 3028 | } |
| 2955 | 3029 | |
| 2956 | 3030 | jQuery(window) |
| 2957 | - .off("resize.wpvrGallery' . $id . '") | |
| 2958 | - .on("resize.wpvrGallery' . $id . '", function () { | |
| 2959 | - window.clearTimeout(wpvrGalleryResizeTimer' . $id . '); | |
| 2960 | - wpvrGalleryResizeTimer' . $id . ' = window.setTimeout(wpvrRefreshGallery' . $id . ', 100); | |
| 3031 | + .off("resize.wpvrGallery' . $pano_suffix . '") | |
| 3032 | + .on("resize.wpvrGallery' . $pano_suffix . '", function () { | |
| 3033 | + window.clearTimeout(wpvrGalleryResizeTimer' . $pano_suffix . '); | |
| 3034 | + wpvrGalleryResizeTimer' . $pano_suffix . ' = window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 100); | |
| 2961 | 3035 | }); |
| 2962 | 3036 | |
| 2963 | 3037 | if (window.MutationObserver) { |
| 2964 | - if (wpvrGallery' . $id . '.length) { | |
| 2965 | - wpvrGalleryObserver' . $id . ' = new MutationObserver(function () { | |
| 2966 | - window.clearTimeout(wpvrGalleryVisibilityTimer' . $id . '); | |
| 2967 | - wpvrGalleryVisibilityTimer' . $id . ' = window.setTimeout(wpvrRefreshGallery' . $id . ', 50); | |
| 3038 | + if (wpvrGallery' . $pano_suffix . '.length) { | |
| 3039 | + wpvrGalleryObserver' . $pano_suffix . ' = new MutationObserver(function () { | |
| 3040 | + window.clearTimeout(wpvrGalleryVisibilityTimer' . $pano_suffix . '); | |
| 3041 | + wpvrGalleryVisibilityTimer' . $pano_suffix . ' = window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 50); | |
| 2968 | 3042 | }); |
| 2969 | - wpvrGalleryObserver' . $id . '.observe(wpvrGallery' . $id . '[0], { | |
| 3043 | + wpvrGalleryObserver' . $pano_suffix . '.observe(wpvrGallery' . $pano_suffix . '[0], { | |
| 2970 | 3044 | attributes: true, |
| 2971 | 3045 | attributeFilter: ["style"] |
| 2972 | 3046 | }); |
| 2973 | 3047 | } |
| @@ -2972,15 +3046,15 @@ | ||
| 2972 | 3046 | }); |
| 2973 | 3047 | } |
| 2974 | 3048 | } |
| 2975 | 3049 | |
| 2976 | - panoshow' . $id . '.on("scenechange", function (sceneId) { | |
| 2977 | - wpvrUpdateGalleryNavigation' . $id . '(sceneId); | |
| 3050 | + panoshow' . $pano_suffix . '.on("scenechange", function (sceneId) { | |
| 3051 | + wpvrUpdateGalleryNavigation' . $pano_suffix . '(sceneId); | |
| 2978 | 3052 | }); |
| 2979 | 3053 | |
| 2980 | - window.setTimeout(wpvrRefreshGallery' . $id . ', 0); | |
| 3054 | + window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 0); | |
| 2981 | 3055 | window.setTimeout(function () { |
| 2982 | - wpvrUpdateGalleryNavigation' . $id . '(panoshow' . $id . '.getScene()); | |
| 3056 | + wpvrUpdateGalleryNavigation' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene()); | |
| 2983 | 3057 | }, 0); |
| 2984 | 3058 | '; |
| 2985 | 3059 | } |
| 2986 | 3060 | //===Custom Control===// |
| @@ -2985,44 +3059,44 @@ | ||
| 2985 | 3059 | } |
| 2986 | 3060 | //===Custom Control===// |
| 2987 | 3061 | if (isset($custom_control)) { |
| 2988 | 3062 | if ($custom_control['panupSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 2989 | - $html .= 'document.getElementById("pan-up' . $id . '").addEventListener("click", function(e) {'; | |
| 2990 | - $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() + 10);'; | |
| 3063 | + $html .= 'document.getElementById("pan-up' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3064 | + $html .= 'panoshow' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch() + 10);'; | |
| 2991 | 3065 | $html .= '});'; |
| 2992 | 3066 | } |
| 2993 | 3067 | if ($custom_control['panDownSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 2994 | - $html .= 'document.getElementById("pan-down' . $id . '").addEventListener("click", function(e) {'; | |
| 2995 | - $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() - 10);'; | |
| 3068 | + $html .= 'document.getElementById("pan-down' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3069 | + $html .= 'panoshow' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch() - 10);'; | |
| 2996 | 3070 | $html .= '});'; |
| 2997 | 3071 | } |
| 2998 | 3072 | if ($custom_control['panLeftSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 2999 | - $html .= 'document.getElementById("pan-left' . $id . '").addEventListener("click", function(e) {'; | |
| 3000 | - $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() - 10);'; | |
| 3073 | + $html .= 'document.getElementById("pan-left' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3074 | + $html .= 'panoshow' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw() - 10);'; | |
| 3001 | 3075 | $html .= '});'; |
| 3002 | 3076 | } |
| 3003 | 3077 | if ($custom_control['panRightSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3004 | - $html .= 'document.getElementById("pan-right' . $id . '").addEventListener("click", function(e) {'; | |
| 3005 | - $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() + 10);'; | |
| 3078 | + $html .= 'document.getElementById("pan-right' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3079 | + $html .= 'panoshow' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw() + 10);'; | |
| 3006 | 3080 | $html .= '});'; |
| 3007 | 3081 | } |
| 3008 | 3082 | if ($custom_control['panZoomInSwitch'] == "on") { |
| 3009 | - $html .= 'document.getElementById("zoom-in' . $id . '").addEventListener("click", function(e) {'; | |
| 3010 | - $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() - 10);'; | |
| 3083 | + $html .= 'document.getElementById("zoom-in' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3084 | + $html .= 'panoshow' . $pano_suffix . '.setHfov(panoshow' . $pano_suffix . '.getHfov() - 10);'; | |
| 3011 | 3085 | $html .= '});'; |
| 3012 | 3086 | } |
| 3013 | 3087 | if ($custom_control['panZoomOutSwitch'] == "on") { |
| 3014 | - $html .= 'document.getElementById("zoom-out' . $id . '").addEventListener("click", function(e) {'; | |
| 3015 | - $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() + 10);'; | |
| 3088 | + $html .= 'document.getElementById("zoom-out' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3089 | + $html .= 'panoshow' . $pano_suffix . '.setHfov(panoshow' . $pano_suffix . '.getHfov() + 10);'; | |
| 3016 | 3090 | $html .= '});'; |
| 3017 | 3091 | } |
| 3018 | 3092 | if ($custom_control['panFullscreenSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3019 | - $html .= 'document.getElementById("fullscreen' . $id . '").addEventListener("click", function(e) {'; | |
| 3020 | - $html .= 'panoshow' . $id . '.toggleFullscreen();'; | |
| 3093 | + $html .= 'document.getElementById("fullscreen' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3094 | + $html .= 'panoshow' . $pano_suffix . '.toggleFullscreen();'; | |
| 3021 | 3095 | $html .= '});'; |
| 3022 | 3096 | $html .= '(function() {'; |
| 3023 | - $html .= 'function wpvrFsChange' . $id . '() {'; | |
| 3024 | - $html .= 'var fsIcon = document.querySelector("#fullscreen' . $id . ' i");'; | |
| 3097 | + $html .= 'function wpvrFsChange' . $pano_suffix . '() {'; | |
| 3098 | + $html .= 'var fsIcon = document.querySelector("#fullscreen' . $pano_suffix . ' i");'; | |
| 3025 | 3099 | $html .= 'if (!fsIcon) return;'; |
| 3026 | 3100 | $html .= 'if (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement) {'; |
| 3027 | 3101 | $html .= 'fsIcon.classList.remove("fa-expand"); fsIcon.classList.add("fa-minimize");'; |
| 3028 | 3102 | $html .= '} else {'; |
| @@ -3028,23 +3102,23 @@ | ||
| 3028 | 3102 | $html .= '} else {'; |
| 3029 | 3103 | $html .= 'fsIcon.classList.remove("fa-minimize"); fsIcon.classList.add("fa-expand");'; |
| 3030 | 3104 | $html .= '}'; |
| 3031 | 3105 | $html .= '}'; |
| 3032 | - $html .= 'document.addEventListener("fullscreenchange", wpvrFsChange' . $id . ');'; | |
| 3033 | - $html .= 'document.addEventListener("webkitfullscreenchange", wpvrFsChange' . $id . ');'; | |
| 3034 | - $html .= 'document.addEventListener("mozfullscreenchange", wpvrFsChange' . $id . ');'; | |
| 3035 | - $html .= 'document.addEventListener("MSFullscreenChange", wpvrFsChange' . $id . ');'; | |
| 3106 | + $html .= 'document.addEventListener("fullscreenchange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3107 | + $html .= 'document.addEventListener("webkitfullscreenchange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3108 | + $html .= 'document.addEventListener("mozfullscreenchange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3109 | + $html .= 'document.addEventListener("MSFullscreenChange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3036 | 3110 | $html .= '})();'; |
| 3037 | 3111 | } |
| 3038 | 3112 | if ($custom_control['backToHomeSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3039 | - $html .= 'document.getElementById("backToHome' . $id . '").addEventListener("click", function(e) {'; | |
| 3040 | - $html .= 'panoshow' . $id . '.loadScene("' . $default_scene . '");'; | |
| 3113 | + $html .= 'document.getElementById("backToHome' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3114 | + $html .= 'panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $default_scene ) . ');'; | |
| 3041 | 3115 | $html .= '});'; |
| 3042 | 3116 | } |
| 3043 | 3117 | if ($gyro_button_enabled && 'valid' == $status && $is_pro) { |
| 3044 | 3118 | $html .= ' |
| 3045 | 3119 | (function() { |
| 3046 | - var gyroButton = document.getElementById("gyroscope' . $id . '"); | |
| 3120 | + var gyroButton = document.getElementById("gyroscope' . $pano_suffix . '"); | |
| 3047 | 3121 | var gyroIcon = gyroButton ? gyroButton.querySelector("i") : null; |
| 3048 | 3122 | var activeColor = ' . wp_json_encode($custom_control['gyroscopeColor']) . '; |
| 3049 | 3123 | var permissionGranted = false; |
| 3050 | 3124 | |
| @@ -3052,20 +3126,20 @@ | ||
| 3052 | 3126 | return; |
| 3053 | 3127 | } |
| 3054 | 3128 | |
| 3055 | 3129 | function updateGyroscopeState() { |
| 3056 | - gyroIcon.style.color = panoshow' . $id . '.isOrientationActive() | |
| 3130 | + gyroIcon.style.color = panoshow' . $pano_suffix . '.isOrientationActive() | |
| 3057 | 3131 | ? activeColor |
| 3058 | 3132 | : "red"; |
| 3059 | 3133 | } |
| 3060 | 3134 | |
| 3061 | 3135 | function startGyroscope() { |
| 3062 | - if (!panoshow' . $id . '.isOrientationSupported()) { | |
| 3136 | + if (!panoshow' . $pano_suffix . '.isOrientationSupported()) { | |
| 3063 | 3137 | updateGyroscopeState(); |
| 3064 | 3138 | return; |
| 3065 | 3139 | } |
| 3066 | 3140 | |
| 3067 | - panoshow' . $id . '.startOrientation(); | |
| 3141 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 3068 | 3142 | window.setTimeout(updateGyroscopeState, 0); |
| 3069 | 3143 | } |
| 3070 | 3144 | |
| 3071 | 3145 | function requestGyroscopePermission() { |
| @@ -3090,14 +3164,14 @@ | ||
| 3090 | 3164 | |
| 3091 | 3165 | startGyroscope(); |
| 3092 | 3166 | } |
| 3093 | 3167 | |
| 3094 | - panoshow' . $id . '.on("load", updateGyroscopeState); | |
| 3095 | - panoshow' . $id . '.on("scenechange", updateGyroscopeState); | |
| 3168 | + panoshow' . $pano_suffix . '.on("load", updateGyroscopeState); | |
| 3169 | + panoshow' . $pano_suffix . '.on("scenechange", updateGyroscopeState); | |
| 3096 | 3170 | |
| 3097 | 3171 | gyroButton.addEventListener("click", function() { |
| 3098 | - if (panoshow' . $id . '.isOrientationActive()) { | |
| 3099 | - panoshow' . $id . '.stopOrientation(); | |
| 3172 | + if (panoshow' . $pano_suffix . '.isOrientationActive()) { | |
| 3173 | + panoshow' . $pano_suffix . '.stopOrientation(); | |
| 3100 | 3174 | updateGyroscopeState(); |
| 3101 | 3175 | return; |
| 3102 | 3176 | } |
| 3103 | 3177 | |
| @@ -3112,15 +3186,15 @@ | ||
| 3112 | 3186 | |
| 3113 | 3187 | //===Explainer Script===// |
| 3114 | 3188 | |
| 3115 | 3189 | if ($autoplay_bg_music == 'on') { |
| 3116 | - $html .= 'jQuery(document).on("click","#explainer_button_' . $id . '",function() { | |
| 3117 | - jQuery("#explainer' . $id . '").slideToggle(); | |
| 3118 | - playing' . $id . ' = false; | |
| 3119 | - var x' . $id . ' = document.getElementById("vrAudio' . $id . '"); | |
| 3120 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up"); | |
| 3121 | - jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute"); | |
| 3122 | - x' . $id . '.pause(); | |
| 3190 | + $html .= 'jQuery(document).on("click","#explainer_button_' . $pano_suffix . '",function() { | |
| 3191 | + jQuery("#explainer' . $pano_suffix . '").slideToggle(); | |
| 3192 | + playing' . $pano_suffix . ' = false; | |
| 3193 | + var x' . $pano_suffix . ' = document.getElementById("vrAudio' . $pano_suffix . '"); | |
| 3194 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up"); | |
| 3195 | + jQuery("#vr-volume' . $pano_suffix . '").addClass("fas fa-volume-mute"); | |
| 3196 | + x' . $pano_suffix . '.pause(); | |
| 3123 | 3197 | }); |
| 3124 | 3198 | jQuery(document).on("click",".close-explainer-video",function() { |
| 3125 | 3199 | jQuery(this).parent(".explainer").hide(); |
| 3126 | 3200 | var el_src = jQuery(".vr-iframe").attr("src"); |
| @@ -3126,11 +3200,11 @@ | ||
| 3126 | 3200 | var el_src = jQuery(".vr-iframe").attr("src"); |
| 3127 | 3201 | jQuery(".vr-iframe").attr("src", el_src); |
| 3128 | 3202 | });'; |
| 3129 | 3203 | } else { |
| 3130 | - $html .= 'jQuery(document).on("click","#explainer_button_' . $id . '",function() { | |
| 3131 | - jQuery("#explainer' . $id . '").slideToggle(function(){ | |
| 3132 | - var $explainerVideoId = jQuery("#explainer' . $id . '"); | |
| 3204 | + $html .= 'jQuery(document).on("click","#explainer_button_' . $pano_suffix . '",function() { | |
| 3205 | + jQuery("#explainer' . $pano_suffix . '").slideToggle(function(){ | |
| 3206 | + var $explainerVideoId = jQuery("#explainer' . $pano_suffix . '"); | |
| 3133 | 3207 | var $explainerVideoIframe = $explainerVideoId.find("iframe"); |
| 3134 | 3208 | var explainerVideoIframSrc = $explainerVideoIframe.attr("src"); |
| 3135 | 3209 | $explainerVideoIframe.attr("src", ""); |
| 3136 | 3210 | $explainerVideoIframe.attr("src", explainerVideoIframSrc); |
| @@ -3146,12 +3220,16 @@ | ||
| 3146 | 3220 | });'; |
| 3147 | 3221 | } |
| 3148 | 3222 | |
| 3149 | 3223 | $html .= ' |
| 3150 | - jQuery(document).on("click","#pano' . $id . '",function(event) { | |
| 3224 | + jQuery(document).on("click","#' . $panoid . '",function(event) { | |
| 3225 | + var isCross = event.target.closest(".cross"); | |
| 3151 | 3226 | var isActiveModal = event.target.closest(".custom-ifram-wrapper"); |
| 3152 | - var isForm = event.target.closest(".wpvr-hotspot-tweak-contents"); | |
| 3227 | + var isForm = event.target.closest(".wpvr-hotspot-tweak-contents-wrapper"); | |
| 3153 | 3228 | var isHotspot = event.target.closest(".pnlm-hotspot-base"); |
| 3229 | + if(isCross != null){ | |
| 3230 | + return; | |
| 3231 | + } | |
| 3154 | 3232 | if(isForm != null){ |
| 3155 | 3233 | jQuery(this).addClass("show-modal"); |
| 3156 | 3234 | }else if(isActiveModal == null){ |
| 3157 | 3235 | if(isHotspot == null){ |
| @@ -3157,9 +3235,9 @@ | ||
| 3157 | 3235 | if(isHotspot == null){ |
| 3158 | 3236 | jQuery(".custom-ifram-wrapper .custom-ifram").empty(); |
| 3159 | 3237 | jQuery(".custom-ifram-wrapper").hide(); |
| 3160 | 3238 | jQuery(this).removeClass("show-modal"); |
| 3161 | - jQuery(".wpvr-hotspot-tweak-contents-wrapper").hide("show-modal"); | |
| 3239 | + jQuery(".wpvr-hotspot-tweak-contents-wrapper").hide(); | |
| 3162 | 3240 | } |
| 3163 | 3241 | } |
| 3164 | 3242 | });'; |
| 3165 | 3243 | |
| @@ -3167,10 +3245,10 @@ | ||
| 3167 | 3245 | |
| 3168 | 3246 | //===generic form script===// |
| 3169 | 3247 | if (isset($postdata["genericform"]) && $postdata["genericform"] === 'on') { |
| 3170 | 3248 | $html .= ' |
| 3171 | - jQuery(document).on("click","#generic_form_button_' . $id . '",function() { | |
| 3172 | - jQuery("#wpvr-generic-form' . $id . '").fadeToggle(); | |
| 3249 | + jQuery(document).on("click","#generic_form_button_' . $pano_suffix . '",function() { | |
| 3250 | + jQuery("#wpvr-generic-form' . $pano_suffix . '").fadeToggle(); | |
| 3173 | 3251 | }); |
| 3174 | 3252 | |
| 3175 | 3253 | jQuery(document).on("click",".close-generic-form",function() { |
| 3176 | 3254 | jQuery(this).parent(".wpvr-generic-form").fadeOut() |
| @@ -3179,12 +3257,12 @@ | ||
| 3179 | 3257 | } |
| 3180 | 3258 | //===generic from script===// |
| 3181 | 3259 | |
| 3182 | 3260 | //===Floor map Script===// |
| 3183 | - $html .= 'jQuery(document).on("click","#floor_map_button_' . $id . '",function() { | |
| 3184 | - jQuery("#wpvr-floor-map' . $id . '").toggle().removeClass("fullwindow"); | |
| 3261 | + $html .= 'jQuery(document).on("click","#floor_map_button_' . $pano_suffix . '",function() { | |
| 3262 | + jQuery("#wpvr-floor-map' . $pano_suffix . '").toggle().removeClass("fullwindow"); | |
| 3185 | 3263 | }); |
| 3186 | - jQuery(document).on("dblclick","#wpvr-floor-map' . $id . '",function(){ | |
| 3264 | + jQuery(document).on("dblclick","#wpvr-floor-map' . $pano_suffix . '",function(){ | |
| 3187 | 3265 | jQuery(this).addClass("fullwindow"); |
| 3188 | 3266 | jQuery(this).parents(".pano-wrap").addClass("show-modal"); |
| 3189 | 3267 | }); |
| 3190 | 3268 | jQuery(document).on("click",".close-floor-map-plan",function() { |
| @@ -3197,24 +3275,24 @@ | ||
| 3197 | 3275 | if ($vrgallery_display) { |
| 3198 | 3276 | |
| 3199 | 3277 | if (!$autoload) { |
| 3200 | 3278 | $html .= 'jQuery(document).ready(function($){ |
| 3201 | - jQuery("#sccontrols' . $id . '").hide(); | |
| 3202 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3203 | - jQuery("#sccontrols' . $id . '").hide(); | |
| 3204 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").hide(); | |
| 3279 | + jQuery("#sccontrols' . $pano_suffix . '").hide(); | |
| 3280 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3281 | + jQuery("#sccontrols' . $pano_suffix . '").hide(); | |
| 3282 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 3205 | 3283 | });'; |
| 3206 | - $html .= 'var slide' . $id . ' = "down"; | |
| 3207 | - jQuery(document).on("click","#vrgcontrols' . $id . '",function() { | |
| 3208 | - if (slide' . $id . ' == "up") { | |
| 3209 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3210 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3211 | - slide' . $id . ' = "down"; | |
| 3212 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3213 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3284 | + $html .= 'var slide' . $pano_suffix . ' = "down"; | |
| 3285 | + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() { | |
| 3286 | + if (slide' . $pano_suffix . ' == "up") { | |
| 3287 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3288 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3289 | + slide' . $pano_suffix . ' = "down"; | |
| 3290 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3291 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3214 | 3292 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3215 | 3293 | if (jQuery(this).is(":visible")) { |
| 3216 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3294 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3217 | 3295 | "display": "flex", |
| 3218 | 3296 | "justify-content": "center", |
| 3219 | 3297 | "align-items": "center", |
| 3220 | 3298 | "gap": "15px" |
| @@ -3222,9 +3300,9 @@ | ||
| 3222 | 3300 | } |
| 3223 | 3301 | } |
| 3224 | 3302 | if (jQuery(".bricks-is-frontend").length) { |
| 3225 | 3303 | if (jQuery(this).is(":visible")) { |
| 3226 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3304 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3227 | 3305 | "display": "flex", |
| 3228 | 3306 | "justify-content": "center", |
| 3229 | 3307 | "align-items": "center" |
| 3230 | 3308 | }); |
| @@ -3232,16 +3310,16 @@ | ||
| 3232 | 3310 | } |
| 3233 | 3311 | }); |
| 3234 | 3312 | } |
| 3235 | 3313 | else { |
| 3236 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3237 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3238 | - slide' . $id . ' = "up"; | |
| 3239 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3240 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3314 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3315 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3316 | + slide' . $pano_suffix . ' = "up"; | |
| 3317 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3318 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3241 | 3319 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3242 | 3320 | if (jQuery(this).is(":visible")) { |
| 3243 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3321 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3244 | 3322 | "display": "flex", |
| 3245 | 3323 | "justify-content": "center", |
| 3246 | 3324 | "align-items": "center", |
| 3247 | 3325 | "gap": "15px" |
| @@ -3249,9 +3327,9 @@ | ||
| 3249 | 3327 | } |
| 3250 | 3328 | } |
| 3251 | 3329 | if (jQuery(".bricks-is-frontend").length) { |
| 3252 | 3330 | if (jQuery(this).is(":visible")) { |
| 3253 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3331 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3254 | 3332 | "display": "flex", |
| 3255 | 3333 | "justify-content": "center", |
| 3256 | 3334 | "align-items": "center" |
| 3257 | 3335 | }); |
| @@ -3261,28 +3339,28 @@ | ||
| 3261 | 3339 | } |
| 3262 | 3340 | });'; |
| 3263 | 3341 | } else { |
| 3264 | 3342 | $html .= 'jQuery(document).ready(function($){ |
| 3265 | - jQuery("#sccontrols' . $id . '").show(); | |
| 3266 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3267 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").show(); | |
| 3343 | + jQuery("#sccontrols' . $pano_suffix . '").show(); | |
| 3344 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3345 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").show(); | |
| 3268 | 3346 | });'; |
| 3269 | - $html .= 'var slide' . $id . ' = "down"; | |
| 3270 | - jQuery(document).on("click","#vrgcontrols' . $id . '",function() { | |
| 3271 | - if (slide' . $id . ' == "up") { | |
| 3272 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3273 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3274 | - slide' . $id . ' = "down"; | |
| 3347 | + $html .= 'var slide' . $pano_suffix . ' = "down"; | |
| 3348 | + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() { | |
| 3349 | + if (slide' . $pano_suffix . ' == "up") { | |
| 3350 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3351 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3352 | + slide' . $pano_suffix . ' = "down"; | |
| 3275 | 3353 | } else { |
| 3276 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3277 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3278 | - slide' . $id . ' = "up"; | |
| 3354 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3355 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3356 | + slide' . $pano_suffix . ' = "up"; | |
| 3279 | 3357 | } |
| 3280 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3281 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3358 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3359 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3282 | 3360 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3283 | 3361 | if (jQuery(this).is(":visible")) { |
| 3284 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3362 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3285 | 3363 | "display": "flex", |
| 3286 | 3364 | "justify-content": "center", |
| 3287 | 3365 | "align-items": "center", |
| 3288 | 3366 | "gap": "15px" |
| @@ -3290,9 +3368,9 @@ | ||
| 3290 | 3368 | } |
| 3291 | 3369 | } |
| 3292 | 3370 | if (jQuery(".bricks-is-frontend").length) { |
| 3293 | 3371 | if (jQuery(this).is(":visible")) { |
| 3294 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3372 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3295 | 3373 | "display": "flex", |
| 3296 | 3374 | "justify-content": "center", |
| 3297 | 3375 | "align-items": "center" |
| 3298 | 3376 | }); |
| @@ -3302,29 +3380,29 @@ | ||
| 3302 | 3380 | });'; |
| 3303 | 3381 | } |
| 3304 | 3382 | } else { |
| 3305 | 3383 | $html .= 'jQuery(document).ready(function($){ |
| 3306 | - jQuery("#sccontrols' . $id . '").hide(); | |
| 3307 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").hide(); | |
| 3308 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3384 | + jQuery("#sccontrols' . $pano_suffix . '").hide(); | |
| 3385 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 3386 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3309 | 3387 | });'; |
| 3310 | - $html .= 'var slide' . $id . ' = "down"; | |
| 3311 | - jQuery(document).on("click","#vrgcontrols' . $id . '",function() { | |
| 3312 | - if (slide' . $id . ' == "up") { | |
| 3313 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3314 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3315 | - slide' . $id . ' = "down"; | |
| 3388 | + $html .= 'var slide' . $pano_suffix . ' = "down"; | |
| 3389 | + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() { | |
| 3390 | + if (slide' . $pano_suffix . ' == "up") { | |
| 3391 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3392 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3393 | + slide' . $pano_suffix . ' = "down"; | |
| 3316 | 3394 | } |
| 3317 | 3395 | else { |
| 3318 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3319 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3320 | - slide' . $id . ' = "up"; | |
| 3396 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3397 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3398 | + slide' . $pano_suffix . ' = "up"; | |
| 3321 | 3399 | } |
| 3322 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3323 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3400 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3401 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3324 | 3402 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3325 | 3403 | if (jQuery(this).is(":visible")) { |
| 3326 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3404 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3327 | 3405 | "display": "flex", |
| 3328 | 3406 | "justify-content": "center", |
| 3329 | 3407 | "align-items": "center", |
| 3330 | 3408 | "gap": "15px" |
| @@ -3332,9 +3410,9 @@ | ||
| 3332 | 3410 | } |
| 3333 | 3411 | } |
| 3334 | 3412 | if (jQuery(".bricks-is-frontend").length) { |
| 3335 | 3413 | if (jQuery(this).is(":visible")) { |
| 3336 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3414 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3337 | 3415 | "display": "flex", |
| 3338 | 3416 | "justify-content": "center", |
| 3339 | 3417 | "align-items": "center" |
| 3340 | 3418 | }); |
| @@ -3344,33 +3422,33 @@ | ||
| 3344 | 3422 | });'; |
| 3345 | 3423 | } |
| 3346 | 3424 | if (!$autoload) { |
| 3347 | 3425 | $html .= 'jQuery(document).ready(function(){ |
| 3348 | - jQuery("#controls' . $id . '").hide(); | |
| 3349 | - jQuery("#zoom-in-out-controls' . $id . '").hide(); | |
| 3350 | - jQuery("#adcontrol' . $id . '").hide(); | |
| 3351 | - jQuery("#explainer_button_' . $id . '").hide(); | |
| 3352 | - jQuery("#generic_form_button_' . $id . '").hide(); | |
| 3353 | - jQuery("#floor_map_button_' . $id . '").hide(); | |
| 3354 | - jQuery("#vrgcontrols' . $id . '").hide(); | |
| 3426 | + jQuery("#controls' . $pano_suffix . '").hide(); | |
| 3427 | + jQuery("#zoom-in-out-controls' . $pano_suffix . '").hide(); | |
| 3428 | + jQuery("#adcontrol' . $pano_suffix . '").hide(); | |
| 3429 | + jQuery("#explainer_button_' . $pano_suffix . '").hide(); | |
| 3430 | + jQuery("#generic_form_button_' . $pano_suffix . '").hide(); | |
| 3431 | + jQuery("#floor_map_button_' . $pano_suffix . '").hide(); | |
| 3432 | + jQuery("#vrgcontrols' . $pano_suffix . '").hide(); | |
| 3355 | 3433 | jQuery("#cp-logo-controls").hide(); |
| 3356 | 3434 | jQuery(".custom-scene-navigation").hide(); |
| 3357 | - jQuery("#pano' . $id . '").find(".pnlm-panorama-info").hide(); | |
| 3435 | + jQuery("#' . $panoid . '").find(".pnlm-panorama-info").hide(); | |
| 3358 | 3436 | });'; |
| 3359 | 3437 | if ($vrgallery_display) { |
| 3360 | - $html .= 'var load_once = "true";'; | |
| 3361 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 3362 | - if (load_once == "true") { | |
| 3363 | - load_once = "false"; | |
| 3364 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3438 | + $html .= 'var load_once' . $pano_suffix . ' = "true";'; | |
| 3439 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 3440 | + if (load_once' . $pano_suffix . ' == "true") { | |
| 3441 | + load_once' . $pano_suffix . ' = "false"; | |
| 3442 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3365 | 3443 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3366 | 3444 | if (jQuery(this).is(":visible")) { |
| 3367 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css("display", "flex"); | |
| 3445 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css("display", "flex"); | |
| 3368 | 3446 | } |
| 3369 | 3447 | } |
| 3370 | 3448 | if (jQuery(".bricks-is-frontend").length) { |
| 3371 | 3449 | if (jQuery(this).is(":visible")) { |
| 3372 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3450 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3373 | 3451 | "display": "flex", |
| 3374 | 3452 | "justify-content": "center", |
| 3375 | 3453 | "align-items": "center" |
| 3376 | 3454 | }); |
| @@ -3376,23 +3454,23 @@ | ||
| 3376 | 3454 | }); |
| 3377 | 3455 | } |
| 3378 | 3456 | } |
| 3379 | 3457 | }); |
| 3380 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3458 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3381 | 3459 | } |
| 3382 | 3460 | });'; |
| 3383 | 3461 | } |
| 3384 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 3385 | - jQuery("#controls' . $id . '").show(); | |
| 3386 | - jQuery("#zoom-in-out-controls' . $id . '").show(); | |
| 3387 | - jQuery("#adcontrol' . $id . '").show(); | |
| 3388 | - jQuery("#explainer_button_' . $id . '").show(); | |
| 3389 | - jQuery("#generic_form_button_' . $id . '").show(); | |
| 3390 | - jQuery("#floor_map_button_' . $id . '").show(); | |
| 3391 | - jQuery("#vrgcontrols' . $id . '").show(); | |
| 3462 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 3463 | + jQuery("#controls' . $pano_suffix . '").show(); | |
| 3464 | + jQuery("#zoom-in-out-controls' . $pano_suffix . '").show(); | |
| 3465 | + jQuery("#adcontrol' . $pano_suffix . '").show(); | |
| 3466 | + jQuery("#explainer_button_' . $pano_suffix . '").show(); | |
| 3467 | + jQuery("#generic_form_button_' . $pano_suffix . '").show(); | |
| 3468 | + jQuery("#floor_map_button_' . $pano_suffix . '").show(); | |
| 3469 | + jQuery("#vrgcontrols' . $pano_suffix . '").show(); | |
| 3392 | 3470 | jQuery("#cp-logo-controls").show(); |
| 3393 | 3471 | jQuery(".custom-scene-navigation").show(); |
| 3394 | - jQuery("#pano' . $id . '").find(".pnlm-panorama-info").show(); | |
| 3472 | + jQuery("#' . $panoid . '").find(".pnlm-panorama-info").show(); | |
| 3395 | 3473 | });'; |
| 3396 | 3474 | } |
| 3397 | 3475 | |
| 3398 | 3476 | //==Old code working properly==// |
| @@ -3406,31 +3484,29 @@ | ||
| 3406 | 3484 | var pano_id; |
| 3407 | 3485 | var element_id = this.id; |
| 3408 | 3486 | element_id = element_id.split("-"); |
| 3409 | 3487 | element_id = element_id[3]; |
| 3410 | - jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).addClass("awwww"); | |
| 3488 | + jQuery("#elementor-tab-content-"+element_id).find("#' . $master_container_id . '").children("div").eq(1).addClass("awwww"); | |
| 3411 | 3489 | var pano_id = jQuery(".awwww").attr("id"); |
| 3412 | - jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).removeClass("awwww");; | |
| 3490 | + jQuery("#elementor-tab-content-"+element_id).find("#' . $master_container_id . '").children("div").eq(1).removeClass("awwww");; | |
| 3413 | 3491 | if (pano_id != undefined) { |
| 3414 | - pano_id = pano_id.split("o"); | |
| 3415 | - pano_id = pano_id[1]; | |
| 3416 | - if (pano_id == "' . $id . '") { | |
| 3417 | - jQuery("#pano' . $id . '").children(".pnlm-render-container").remove(); | |
| 3418 | - jQuery("#pano' . $id . '").children(".pnlm-ui").remove(); | |
| 3419 | - panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3492 | + if (pano_id == "' . $panoid . '") { | |
| 3493 | + jQuery("#' . $panoid . '").children(".pnlm-render-container").remove(); | |
| 3494 | + jQuery("#' . $panoid . '").children(".pnlm-ui").remove(); | |
| 3495 | + panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3420 | 3496 | window.wpvrViewers = window.wpvrViewers || {}; |
| 3421 | - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . '; | |
| 3497 | + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . '; | |
| 3422 | 3498 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 3423 | - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' } | |
| 3499 | + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' } | |
| 3424 | 3500 | })); |
| 3425 | - jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $previeword . '") | |
| 3501 | + jQuery("#' . $panoid . '").children(".pnlm-ui").find(".pnlm-load-button p").text(' . wp_json_encode( (string) $previeword ) . ') | |
| 3426 | 3502 | setTimeout(function() { |
| 3427 | - // panoshow' . $id . '.loadScene("' . $default_scene . '"); | |
| 3503 | + // panoshow' . $pano_suffix . '.loadScene("' . $default_scene . '"); | |
| 3428 | 3504 | window.dispatchEvent(new Event("resize")); |
| 3429 | - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3430 | - jQuery("#controls' . $id . '").css("bottom", "55px"); | |
| 3505 | + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3506 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "55px"); | |
| 3431 | 3507 | } else { |
| 3432 | - jQuery("#controls' . $id . '").css("bottom", "5px"); | |
| 3508 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px"); | |
| 3433 | 3509 | } |
| 3434 | 3510 | }, 200); |
| 3435 | 3511 | } |
| 3436 | 3512 | } |
| @@ -3435,30 +3511,30 @@ | ||
| 3435 | 3511 | } |
| 3436 | 3512 | } |
| 3437 | 3513 | });'; |
| 3438 | 3514 | $html .= 'jQuery(".geodir-tab-head dd, #vr-tour-tab").click(function(){ |
| 3439 | - jQuery("#pano' . $id . '").children(".pnlm-render-container").remove(); | |
| 3440 | - jQuery("#pano' . $id . '").children(".pnlm-ui").remove(); | |
| 3441 | - panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3515 | + jQuery("#' . $panoid . '").children(".pnlm-render-container").remove(); | |
| 3516 | + jQuery("#' . $panoid . '").children(".pnlm-ui").remove(); | |
| 3517 | + panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3442 | 3518 | window.wpvrViewers = window.wpvrViewers || {}; |
| 3443 | - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . '; | |
| 3519 | + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . '; | |
| 3444 | 3520 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 3445 | - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' } | |
| 3521 | + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' } | |
| 3446 | 3522 | })); |
| 3447 | 3523 | setTimeout(function() { |
| 3448 | - panoshow' . $id . '.loadScene("' . $default_scene . '"); | |
| 3524 | + panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $default_scene ) . '); | |
| 3449 | 3525 | window.dispatchEvent(new Event("resize")); |
| 3450 | - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3451 | - jQuery("#controls' . $id . '").css("bottom", "55px"); | |
| 3526 | + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3527 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "55px"); | |
| 3452 | 3528 | } |
| 3453 | 3529 | else { |
| 3454 | - jQuery("#controls' . $id . '").css("bottom", "5px"); | |
| 3530 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px"); | |
| 3455 | 3531 | } |
| 3456 | 3532 | }, 200); |
| 3457 | 3533 | });'; |
| 3458 | 3534 | if (isset($previeword) && $previeword != '') { |
| 3459 | 3535 | $html .= ' |
| 3460 | - jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $previeword . '") | |
| 3536 | + jQuery("#' . $panoid . '").children(".pnlm-ui").find(".pnlm-load-button p").text(' . wp_json_encode( (string) $previeword ) . ') | |
| 3461 | 3537 | '; |
| 3462 | 3538 | } |
| 3463 | 3539 | if ($default_global_zoom != '' || $max_global_zoom != '' || $min_global_zoom != '') { |
| 3464 | 3540 | $html .= 'jQuery(".globalzoom").val("on").change();'; |
| @@ -3463,12 +3539,12 @@ | ||
| 3463 | 3539 | if ($default_global_zoom != '' || $max_global_zoom != '' || $min_global_zoom != '') { |
| 3464 | 3540 | $html .= 'jQuery(".globalzoom").val("on").change();'; |
| 3465 | 3541 | } |
| 3466 | 3542 | |
| 3467 | - $html .= 'jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseenter", function(){ | |
| 3543 | + $html .= 'jQuery("#' . $panoid . ' .pnlm-title-box").on("mouseenter", function(){ | |
| 3468 | 3544 | jQuery(this).attr("title", jQuery(this).text()); |
| 3469 | 3545 | }); |
| 3470 | - jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseleave", function(){ | |
| 3546 | + jQuery("#' . $panoid . ' .pnlm-title-box").on("mouseleave", function(){ | |
| 3471 | 3547 | jQuery(this).removeAttr("title"); |
| 3472 | 3548 | });'; |
| 3473 | 3549 | $html .= '});'; |
| 3474 | 3550 | $html .= '})(jQuery);'; |
| @@ -3498,16 +3574,20 @@ | ||
| 3498 | 3574 | } |
| 3499 | 3575 | |
| 3500 | 3576 | } |
| 3501 | 3577 | |
| 3502 | -private function sanitize_content_preserve_styles($content) { | |
| 3578 | +private function sanitize_content_preserve_styles($content, $allow_forms = false) { | |
| 3503 | 3579 | // Decode HTML entities first (in case content was encoded in database) |
| 3504 | 3580 | $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8'); |
| 3505 | 3581 | |
| 3506 | - // Escape <script> blocks to display as text instead of removing them | |
| 3507 | - $content = preg_replace_callback('/<script\b[^>]*>(.*?)<\/script>/si', function($matches) { | |
| 3508 | - return esc_html($matches[0]); // Convert to plain text | |
| 3509 | - }, $content); | |
| 3582 | + // Escape or strip <script> blocks | |
| 3583 | + if ($allow_forms) { | |
| 3584 | + $content = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script>/i', '', $content); | |
| 3585 | + } else { | |
| 3586 | + $content = preg_replace_callback('/<script\b[^>]*>(.*?)<\/script>/si', function($matches) { | |
| 3587 | + return esc_html($matches[0]); // Convert to plain text | |
| 3588 | + }, $content); | |
| 3589 | + } | |
| 3510 | 3590 | |
| 3511 | 3591 | // Strip dangerous URL-based attributes |
| 3512 | 3592 | $content = preg_replace('/(href|action|formaction)\s*=\s*["\']?\s*(javascript|vbscript|data|about):/i', '$1=""', $content); |
| 3513 | 3593 | |
| @@ -3520,11 +3600,16 @@ | ||
| 3520 | 3600 | // Handle unquoted event handlers |
| 3521 | 3601 | return ' ' . esc_html($matches[1]) . '=' . esc_html($matches[2]); |
| 3522 | 3602 | }, $content); |
| 3523 | 3603 | |
| 3524 | - // Remove all unsafe embedded/interactive elements except iframe | |
| 3525 | - $content = preg_replace('/<(object|embed|applet|frame|frameset|meta|link|base|form|input|button|textarea|select|option)\b[^>]*>/i', '', $content); | |
| 3526 | - $content = preg_replace('/<\/(object|embed|applet|frame|frameset|meta|link|base|form|input|button|textarea|select|option)>/i', '', $content); | |
| 3604 | + // Remove unsafe embedded/interactive elements | |
| 3605 | + if ($allow_forms) { | |
| 3606 | + $content = preg_replace('/<(object|embed|applet|frame|frameset|meta|link|base)\b[^>]*>/i', '', $content); | |
| 3607 | + $content = preg_replace('/<\/(object|embed|applet|frame|frameset|meta|link|base)>/i', '', $content); | |
| 3608 | + } else { | |
| 3609 | + $content = preg_replace('/<(object|embed|applet|frame|frameset|meta|link|base|form|input|button|textarea|select|option)\b[^>]*>/i', '', $content); | |
| 3610 | + $content = preg_replace('/<\/(object|embed|applet|frame|frameset|meta|link|base|form|input|button|textarea|select|option)>/i', '', $content); | |
| 3611 | + } | |
| 3527 | 3612 | |
| 3528 | 3613 | // Clean style attributes safely |
| 3529 | 3614 | $content = preg_replace_callback('/style\s*=\s*["\']([^"\']*)["\']/', function($matches) { |
| 3530 | 3615 | $style = $matches[1]; |
| @@ -3545,10 +3630,16 @@ | ||
| 3545 | 3630 | $css = preg_replace('/-moz-binding\s*:/i', '', $css); |
| 3546 | 3631 | return '<style>' . esc_html($css) . '</style>'; |
| 3547 | 3632 | }, $content); |
| 3548 | 3633 | |
| 3549 | - // Allow iframes from safe sources only (e.g., YouTube, Vimeo) | |
| 3634 | + // Allow iframes and styles from safe sources only | |
| 3550 | 3635 | $allowed_tags = wp_kses_allowed_html('post'); |
| 3636 | + $allowed_tags['style'] = [ | |
| 3637 | + 'type' => true, | |
| 3638 | + 'id' => true, | |
| 3639 | + 'class' => true, | |
| 3640 | + 'media' => true, | |
| 3641 | + ]; | |
| 3551 | 3642 | $allowed_tags['iframe'] = [ |
| 3552 | 3643 | 'src' => true, |
| 3553 | 3644 | 'width' => true, |
| 3554 | 3645 | 'height' => true, |
| @@ -3575,8 +3666,72 @@ | ||
| 3575 | 3666 | 'loading' => true, |
| 3576 | 3667 | 'srcset' => true, |
| 3577 | 3668 | 'sizes' => true, |
| 3578 | 3669 | ]; |
| 3670 | + | |
| 3671 | + if ($allow_forms) { | |
| 3672 | + $form_attributes = [ | |
| 3673 | + 'id' => true, | |
| 3674 | + 'class' => true, | |
| 3675 | + 'style' => true, | |
| 3676 | + 'name' => true, | |
| 3677 | + 'value' => true, | |
| 3678 | + 'type' => true, | |
| 3679 | + 'placeholder' => true, | |
| 3680 | + 'action' => true, | |
| 3681 | + 'method' => true, | |
| 3682 | + 'target' => true, | |
| 3683 | + 'enctype' => true, | |
| 3684 | + 'disabled' => true, | |
| 3685 | + 'readonly' => true, | |
| 3686 | + 'required' => true, | |
| 3687 | + 'checked' => true, | |
| 3688 | + 'selected' => true, | |
| 3689 | + 'multiple' => true, | |
| 3690 | + 'size' => true, | |
| 3691 | + 'rows' => true, | |
| 3692 | + 'cols' => true, | |
| 3693 | + 'maxlength' => true, | |
| 3694 | + 'minlength' => true, | |
| 3695 | + 'min' => true, | |
| 3696 | + 'max' => true, | |
| 3697 | + 'step' => true, | |
| 3698 | + 'pattern' => true, | |
| 3699 | + 'autocomplete' => true, | |
| 3700 | + 'autofocus' => true, | |
| 3701 | + 'for' => true, | |
| 3702 | + 'data-*' => true, | |
| 3703 | + 'data-form_id' => true, | |
| 3704 | + 'data-form_instance' => true, | |
| 3705 | + 'data-name' => true, | |
| 3706 | + 'data-type' => true, | |
| 3707 | + 'aria-invalid' => true, | |
| 3708 | + 'aria-required' => true, | |
| 3709 | + 'aria-label' => true, | |
| 3710 | + 'aria-describedby' => true, | |
| 3711 | + 'aria-labelledby' => true, | |
| 3712 | + ]; | |
| 3713 | + $allowed_tags['form'] = $form_attributes; | |
| 3714 | + $allowed_tags['input'] = $form_attributes; | |
| 3715 | + $allowed_tags['button'] = $form_attributes; | |
| 3716 | + $allowed_tags['textarea'] = $form_attributes; | |
| 3717 | + $allowed_tags['select'] = $form_attributes; | |
| 3718 | + $allowed_tags['option'] = $form_attributes; | |
| 3719 | + $allowed_tags['optgroup'] = $form_attributes; | |
| 3720 | + $allowed_tags['label'] = $form_attributes; | |
| 3721 | + $allowed_tags['fieldset'] = $form_attributes; | |
| 3722 | + $allowed_tags['legend'] = $form_attributes; | |
| 3723 | + if (!isset($allowed_tags['div'])) { | |
| 3724 | + $allowed_tags['div'] = []; | |
| 3725 | + } | |
| 3726 | + $allowed_tags['div']['data-*'] = true; | |
| 3727 | + $allowed_tags['div']['data-form_id'] = true; | |
| 3728 | + $allowed_tags['div']['data-form_instance'] = true; | |
| 3729 | + if (!isset($allowed_tags['span'])) { | |
| 3730 | + $allowed_tags['span'] = []; | |
| 3731 | + } | |
| 3732 | + $allowed_tags['span']['data-*'] = true; | |
| 3733 | + } | |
| 3579 | 3734 | |
| 3580 | 3735 | // Apply wp_kses() to keep only allowed tags/attributes |
| 3581 | 3736 | $content = wp_kses($content, $allowed_tags); |
| 3582 | 3737 | |