| @@ -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(); |
| @@ -888,10 +908,10 @@ | ||
| 888 | 908 | if (isset($postdata['scenefadeduration'])) { |
| 889 | 909 | $scene_fade_duration = $postdata['scenefadeduration']; |
| 890 | 910 | } |
| 891 | 911 | |
| 892 | - $panodata = ''; | |
| 893 | - if (isset($postdata['panodata'])) { | |
| 912 | + $panodata = array(); | |
| 913 | + if (isset($postdata['panodata']) && is_array($postdata['panodata'])) { | |
| 894 | 914 | $panodata = $postdata['panodata']; |
| 895 | 915 | } |
| 896 | 916 | |
| 897 | 917 | $hotspoticoncolor = '#00b4ff'; |
| @@ -1031,10 +1051,18 @@ | ||
| 1031 | 1051 | ob_start(); |
| 1032 | 1052 | do_action('wpvr_hotspot_content', $hotspot_data); |
| 1033 | 1053 | $hotspot_content = ob_get_clean(); |
| 1034 | 1054 | |
| 1035 | - if (!$hotspot_content) { | |
| 1036 | - $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 | + } | |
| 1037 | 1065 | } |
| 1038 | 1066 | |
| 1039 | 1067 | $hotspot_url = $this->normalize_hotspot_external_url($hotspot_data["hotspot-url"] ?? ''); |
| 1040 | 1068 | |
| @@ -1054,9 +1082,8 @@ | ||
| 1054 | 1082 | $hotspot_data['hotspot-hover'] ?? '' |
| 1055 | 1083 | ); |
| 1056 | 1084 | |
| 1057 | 1085 | |
| 1058 | - $is_fluent_form = isset($hotspot_data["hotspot-type"]) && 'fluent_form' === $hotspot_data["hotspot-type"]; | |
| 1059 | 1086 | $on_hover_content = $this->sanitize_content_preserve_styles($on_hover_content ?? '', false); |
| 1060 | 1087 | $on_click_content = preg_replace_callback('/<img[^>]*>/', "replace_callback", $hotspot_content ?? ''); |
| 1061 | 1088 | $on_click_content = $this->sanitize_content_preserve_styles($on_click_content ?? '', $is_fluent_form); |
| 1062 | 1089 | |
| @@ -1289,13 +1316,17 @@ | ||
| 1289 | 1316 | if(isset($postdata['customcss_enable']) && $postdata['customcss_enable'] == 'on'){ |
| 1290 | 1317 | $html .= isset($postdata['customcss']) ? $postdata['customcss'] : ''; |
| 1291 | 1318 | } |
| 1292 | 1319 | } |
| 1293 | - $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); | |
| 1294 | 1323 | $status = get_option('wpvr_edd_license_status'); |
| 1295 | - if ($status !== false && $status == 'valid') { | |
| 1324 | + if ($status !== false && $status == 'valid' && ! empty( $panodata['scene-list'] ) && is_array( $panodata['scene-list'] )) { | |
| 1296 | 1325 | foreach ($panodata['scene-list'] as $panoscenes){ |
| 1297 | - | |
| 1326 | + if ( empty( $panoscenes['hotspot-list'] ) || ! is_array( $panoscenes['hotspot-list'] ) ) { | |
| 1327 | + continue; | |
| 1328 | + } | |
| 1298 | 1329 | foreach($panoscenes['hotspot-list'] as $hotspot){ |
| 1299 | 1330 | if (isset($hotspot['hotspot-customclass-color-icon-value']) && !empty($hotspot['hotspot-customclass-color-icon-value'])) { |
| 1300 | 1331 | $hotspoticoncolor = $hotspot['hotspot-customclass-color-icon-value']; |
| 1301 | 1332 | } else { |
| @@ -1491,16 +1522,24 @@ | ||
| 1491 | 1522 | $animation_css = apply_filters('wpvr_tour_scene_animation',$animation_type,$animationDuration,$animationDelay,$postdata,$id); |
| 1492 | 1523 | $html .= $animation_css; |
| 1493 | 1524 | } |
| 1494 | 1525 | |
| 1526 | + $container_width = $width; | |
| 1527 | + $container_height = $height; | |
| 1528 | + $container_mobile_height = $mobile_height; | |
| 1529 | + | |
| 1495 | 1530 | if ($width == 'fullwidth') { |
| 1496 | - $width = "100%"; | |
| 1531 | + $container_width = "100%"; | |
| 1532 | + } elseif ($width == 'embed') { | |
| 1533 | + $container_width = "100%"; | |
| 1534 | + $container_height = "100%"; | |
| 1535 | + $container_mobile_height = "100%"; | |
| 1497 | 1536 | } |
| 1498 | 1537 | |
| 1499 | 1538 | if (wpvr_isMobileDevice()) { |
| 1500 | - $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; ">'; | |
| 1501 | 1540 | } else { |
| 1502 | - $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; ">'; | |
| 1503 | 1542 | } |
| 1504 | 1543 | $is_pro = apply_filters('is_wpvr_pro_active',false); |
| 1505 | 1544 | $status = get_option('wpvr_edd_license_status'); |
| 1506 | 1545 | $is_cardboard = get_option('wpvr_cardboard_disable'); |
| @@ -1518,9 +1557,9 @@ | ||
| 1518 | 1557 | if($width == "embed"){ |
| 1519 | 1558 | $embed_mode = "vr-embade-mode"; |
| 1520 | 1559 | } |
| 1521 | 1560 | $html .= '<label class="wpvr-cardboard-switcher '.$embed_mode.'"> |
| 1522 | - <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"> | |
| 1523 | 1562 | <span class="switcher-box"> |
| 1524 | 1563 | <span class="normal-mode-tooltip">Normal VR Mode</span> |
| 1525 | 1564 | <svg width="78" height="60" viewBox="0 0 78 60" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 1526 | 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"/> |
| @@ -1532,43 +1571,43 @@ | ||
| 1532 | 1571 | |
| 1533 | 1572 | if ($width == 'fullwidth') { |
| 1534 | 1573 | if (wpvr_isMobileDevice()) { |
| 1535 | 1574 | $html .= '<div class="cardboard-vrfullwidth vrfullwidth">'; |
| 1536 | - $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>'; | |
| 1537 | - $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 . '" >'; | |
| 1538 | 1577 | } else { |
| 1539 | - $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>'; | |
| 1540 | 1579 | if ($radius) { |
| 1541 | - $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;" >'; | |
| 1542 | 1581 | } else { |
| 1543 | - $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;" >'; | |
| 1544 | 1583 | } |
| 1545 | 1584 | } |
| 1546 | 1585 | } elseif ($width == 'embed') { |
| 1547 | 1586 | $html .= '<div class="cardboard-vrembed vrembed">'; |
| 1548 | - $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>'; | |
| 1549 | - $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;" >'; | |
| 1550 | 1589 | } else { |
| 1551 | 1590 | if (wpvr_isMobileDevice()) { |
| 1552 | - $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>'; | |
| 1553 | 1592 | if ($radius) { |
| 1554 | - $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 . ';">'; | |
| 1555 | 1594 | } else { |
| 1556 | - $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%; ">'; | |
| 1557 | 1596 | } |
| 1558 | 1597 | } else { |
| 1559 | - $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>'; | |
| 1560 | 1599 | |
| 1561 | 1600 | if ($radius) { |
| 1562 | - $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 . ';">'; | |
| 1563 | 1602 | } else { |
| 1564 | - $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%;">'; | |
| 1565 | 1604 | } |
| 1566 | 1605 | } |
| 1567 | 1606 | } |
| 1568 | 1607 | // Vr mode transction scene to scene |
| 1569 | 1608 | if ($status !== false && 'valid' == $status && $is_pro) { |
| 1570 | - $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>'; | |
| 1571 | 1610 | } |
| 1572 | 1611 | $social_logo_top = ''; |
| 1573 | 1612 | //===company logo===// |
| 1574 | 1613 | if (isset($postdata['cpLogoSwitch'])) { |
| @@ -1605,14 +1644,14 @@ | ||
| 1605 | 1644 | $generic_form_icon = isset($postdata['genericformicon']) ? (string) $postdata['genericformicon'] : 'fab fa-wpforms'; |
| 1606 | 1645 | $generic_form_icon = implode(' ', array_filter(array_map('sanitize_html_class', preg_split('/\s+/', $generic_form_icon)))); |
| 1607 | 1646 | $generic_form_icon = $generic_form_icon ?: 'fab fa-wpforms'; |
| 1608 | 1647 | $generic_form_icon_color = sanitize_hex_color($postdata['genericformiconcolor'] ?? '') ?: '#f7fffb'; |
| 1609 | - $html .= '<div class="generic_form_button" id="generic_form_button_' . esc_attr($id) . '">'; | |
| 1610 | - $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>'; | |
| 1611 | 1650 | $html .= '</div>'; |
| 1612 | 1651 | |
| 1613 | 1652 | // Generate the modal form container |
| 1614 | - $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">'; | |
| 1615 | 1654 | $html .= '<span class="close-generic-form"><i class="fa fa-times"></i></span>'; |
| 1616 | 1655 | $html .= '<div class="generic-form-container">' . $shortcode_content . '</div>'; |
| 1617 | 1656 | $html .= '</div>'; |
| 1618 | 1657 | } |
| @@ -1665,23 +1704,23 @@ | ||
| 1665 | 1704 | //===Custom Control===// |
| 1666 | 1705 | if (isset($custom_control)) { |
| 1667 | 1706 | $gyro_button_enabled = wpvr_isMobileDevice() && $custom_control['gyroSwitch'] == "on" && $custom_control['gyroscopeSwitch'] == "on"; |
| 1668 | 1707 | if ($custom_control['panZoomInSwitch'] == "on" || $custom_control['panZoomOutSwitch'] == "on" || $gyro_button_enabled || $custom_control['backToHomeSwitch'] == "on") { |
| 1669 | - $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">'; | |
| 1670 | 1709 | |
| 1671 | 1710 | if ($custom_control['backToHomeSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 1672 | - $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>'; | |
| 1673 | 1712 | } |
| 1674 | 1713 | |
| 1675 | 1714 | if ($custom_control['panZoomInSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 1676 | - $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>'; | |
| 1677 | 1716 | } |
| 1678 | 1717 | |
| 1679 | 1718 | if ($custom_control['panZoomOutSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 1680 | - $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>'; | |
| 1681 | 1720 | } |
| 1682 | 1721 | if ($gyro_button_enabled && 'valid' == $status && $is_pro) { |
| 1683 | - $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>'; | |
| 1684 | 1723 | } |
| 1685 | 1724 | $html .= '</div>'; |
| 1686 | 1725 | } |
| 1687 | 1726 | //===zoom in out Control===// |
| @@ -1687,28 +1726,28 @@ | ||
| 1687 | 1726 | //===zoom in out Control===// |
| 1688 | 1727 | |
| 1689 | 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) { |
| 1690 | 1729 | //===Custom Control===// |
| 1691 | - $html .= '<div class="controls" id="controls' . $id . '">'; | |
| 1730 | + $html .= '<div class="controls" id="controls' . $pano_suffix . '">'; | |
| 1692 | 1731 | |
| 1693 | 1732 | if ($custom_control['panupSwitch'] == "on") { |
| 1694 | - $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>'; | |
| 1695 | 1734 | } |
| 1696 | 1735 | |
| 1697 | 1736 | if ($custom_control['panDownSwitch'] == "on") { |
| 1698 | - $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>'; | |
| 1699 | 1738 | } |
| 1700 | 1739 | |
| 1701 | 1740 | if ($custom_control['panLeftSwitch'] == "on") { |
| 1702 | - $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>'; | |
| 1703 | 1742 | } |
| 1704 | 1743 | |
| 1705 | 1744 | if ($custom_control['panRightSwitch'] == "on") { |
| 1706 | - $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>'; | |
| 1707 | 1746 | } |
| 1708 | 1747 | |
| 1709 | 1748 | if ($custom_control['panFullscreenSwitch'] == "on") { |
| 1710 | - $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>'; | |
| 1711 | 1750 | } |
| 1712 | 1751 | $html .= '</div>'; |
| 1713 | 1752 | } |
| 1714 | 1753 | } |
| @@ -1720,20 +1759,19 @@ | ||
| 1720 | 1759 | $postdata, |
| 1721 | 1760 | $is_pro, |
| 1722 | 1761 | $autoload, |
| 1723 | 1762 | $explainer_right, |
| 1724 | - $id | |
| 1763 | + $pano_suffix | |
| 1725 | 1764 | ); |
| 1726 | 1765 | //===explainer button end===// |
| 1727 | 1766 | |
| 1728 | 1767 | //===Floor map button===// |
| 1729 | 1768 | $status = get_option('wpvr_edd_license_status'); |
| 1730 | - if ($status !== false && 'valid' == $status && $is_pro){ | |
| 1731 | - if ($floor_plan_enable == "on" && !empty($floor_plan_image)) { | |
| 1732 | - $html .= '<div class="floor_map_button" id="floor_map_button_' . $id . '" style="right:'.$floor_map_right.'">'; | |
| 1733 | - $html .= '<div class="ctrl" id="floor_map_target_' . $id . '"><i class="fas fa-map" style="color:#f7fffb;"></i></div>'; | |
| 1734 | - $html .= '</div>'; | |
| 1735 | - } | |
| 1769 | + $has_floor_plan = ( $status !== false && 'valid' == $status && $is_pro && 'on' == $floor_plan_enable && ! empty( $floor_plan_image ) ); | |
| 1770 | + if ( $has_floor_plan ) { | |
| 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>'; | |
| 1773 | + $html .= '</div>'; | |
| 1736 | 1774 | } |
| 1737 | 1775 | //===floor map button===// |
| 1738 | 1776 | |
| 1739 | 1777 | if ($vrgallery && 'valid' == $status && $is_pro ) { |
| @@ -1741,11 +1779,11 @@ | ||
| 1741 | 1779 | $size = ''; |
| 1742 | 1780 | if($vrgallery_icon_size){ |
| 1743 | 1781 | $size = 'vrg-icon-size-large'; |
| 1744 | 1782 | } |
| 1745 | - $html .= '<div id="vrgcontrols' . $id . '" class="vrgcontrols">'; | |
| 1783 | + $html .= '<div id="vrgcontrols' . $pano_suffix . '" class="vrgcontrols">'; | |
| 1746 | 1784 | |
| 1747 | - $html .= '<div class="vrgctrl' . $id . ' vrbounce '.$size.'">'; | |
| 1785 | + $html .= '<div class="vrgctrl' . $pano_suffix . ' vrbounce '.$size.'">'; | |
| 1748 | 1786 | $html .= '</div>'; |
| 1749 | 1787 | $html .= '</div>'; |
| 1750 | 1788 | |
| 1751 | 1789 | $gallery_layout_class = isset($postdata['tourLayout']['layout']) && 'layout1' === $postdata['tourLayout']['layout'] |
| @@ -1750,9 +1788,9 @@ | ||
| 1750 | 1788 | |
| 1751 | 1789 | $gallery_layout_class = isset($postdata['tourLayout']['layout']) && 'layout1' === $postdata['tourLayout']['layout'] |
| 1752 | 1790 | ? 'wpvr-gallery--modern' |
| 1753 | 1791 | : 'wpvr-gallery--classic'; |
| 1754 | - $html .= '<div id="sccontrols' . $id . '" class="scene-gallery vrowl-carousel ' . esc_attr($gallery_layout_class) . '">'; | |
| 1792 | + $html .= '<div id="sccontrols' . $pano_suffix . '" class="scene-gallery vrowl-carousel ' . esc_attr($gallery_layout_class) . '">'; | |
| 1755 | 1793 | if (isset($panodata["scene-list"])) { |
| 1756 | 1794 | foreach ($panodata["scene-list"] as $panoscenes) { |
| 1757 | 1795 | $scene_key = $panoscenes['scene-id']; |
| 1758 | 1796 | |
| @@ -1776,11 +1814,11 @@ | ||
| 1776 | 1814 | $thumbnail = $img_src_url; |
| 1777 | 1815 | } |
| 1778 | 1816 | |
| 1779 | 1817 | if( isset($postdata['tourLayout']['layout']) && 'layout1' !== $postdata['tourLayout']['layout']) { |
| 1780 | - $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>'; | |
| 1818 | + $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>'; | |
| 1781 | 1819 | }else { |
| 1782 | - $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>'; | |
| 1820 | + $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>'; | |
| 1783 | 1821 | } |
| 1784 | 1822 | } |
| 1785 | 1823 | } |
| 1786 | 1824 | |
| @@ -1811,15 +1849,15 @@ | ||
| 1811 | 1849 | $audio_muted_attr = ($autoplay_bg_music === 'on') ? 'muted' : ''; |
| 1812 | 1850 | $audio_icon_class = 'fa-volume-mute'; // Always start with mute icon |
| 1813 | 1851 | |
| 1814 | 1852 | if ($bg_music === 'on' && 'valid' == $status && $is_pro) { |
| 1815 | - $html .= '<div id="adcontrol' . esc_attr( $id ) . '" class="adcontrol" style="right:' . esc_attr( $audio_right ) . '">'; | |
| 1816 | - $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 . '> | |
| 1853 | + $html .= '<div id="adcontrol' . esc_attr( $pano_suffix ) . '" class="adcontrol" style="right:' . esc_attr( $audio_right ) . '">'; | |
| 1854 | + $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 . '> | |
| 1817 | 1855 | <source src="' . esc_url($bg_music_url) . '" type="audio/mpeg"> |
| 1818 | 1856 | Your browser does not support the audio element. |
| 1819 | 1857 | </audio>'; |
| 1820 | - $html .= '<button onclick="playPause' . esc_attr($id) . '()" class="ctrl audio_control" id="audio_control' . esc_attr($id) . '"> | |
| 1821 | - <i id="vr-volume' . esc_attr($id) . '" class="wpvrvolumeicon' . esc_attr($id) . ' fas ' . esc_attr($audio_icon_class) . '" style="color:#fff;"></i> | |
| 1858 | + $html .= '<button onclick="playPause' . esc_attr($pano_suffix) . '()" class="ctrl audio_control" id="audio_control' . esc_attr($pano_suffix) . '"> | |
| 1859 | + <i id="vr-volume' . esc_attr($pano_suffix) . '" class="wpvrvolumeicon' . esc_attr($pano_suffix) . ' fas ' . esc_attr($audio_icon_class) . '" style="color:#fff;"></i> | |
| 1822 | 1860 | </button>'; |
| 1823 | 1861 | $html .= '</div>'; |
| 1824 | 1862 | } |
| 1825 | 1863 | //===Explainer video section===// |
| @@ -1826,9 +1864,9 @@ | ||
| 1826 | 1864 | $explainerContent = ""; |
| 1827 | 1865 | if (isset($postdata['explainerContent'])) { |
| 1828 | 1866 | $explainerContent = $this->wpvr_sanitize_iframe_only($postdata['explainerContent']); |
| 1829 | 1867 | } |
| 1830 | - $html .= '<div class="explainer" id="explainer' . $id . '" style="display: none">'; | |
| 1868 | + $html .= '<div class="explainer" id="explainer' . $pano_suffix . '" style="display: none">'; | |
| 1831 | 1869 | $html .= '<span class="close-explainer-video"><i class="fa fa-times"></i></span>'; |
| 1832 | 1870 | $html .= '' . $explainerContent . ''; |
| 1833 | 1871 | $html .= '</div>'; |
| 1834 | 1872 | //===Explainer video section End===// |
| @@ -1846,13 +1884,13 @@ | ||
| 1846 | 1884 | .zoom-in-out-controls { |
| 1847 | 1885 | top: 37px; |
| 1848 | 1886 | } |
| 1849 | 1887 | </style>'; |
| 1850 | - $html .= '<div id="custom-scene-navigation' . $id . '" class="custom-scene-navigation"> | |
| 1888 | + $html .= '<div id="custom-scene-navigation' . $pano_suffix . '" class="custom-scene-navigation"> | |
| 1851 | 1889 | <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> |
| 1852 | 1890 | </div> |
| 1853 | 1891 | |
| 1854 | - <div id="custom-scene-navigation-nav' . $id . '" class="' . esc_attr( $scene_navigation_nav_class ) . '"> | |
| 1892 | + <div id="custom-scene-navigation-nav' . $pano_suffix . '" class="' . esc_attr( $scene_navigation_nav_class ) . '"> | |
| 1855 | 1893 | <ul></ul> |
| 1856 | 1894 | </div> |
| 1857 | 1895 | '; |
| 1858 | 1896 | } |
| @@ -1860,9 +1898,9 @@ | ||
| 1860 | 1898 | |
| 1861 | 1899 | |
| 1862 | 1900 | if( 'embed' === $width){ |
| 1863 | 1901 | if(WPVR_Helper::is_enable_social_share($postdata) === 'on'){ |
| 1864 | - $html .= '<div id="wpvr-social-share-bg-box'.$id.'" class="wpvr-social-share-bg-box" style="top:'.$social_logo_top.'"> | |
| 1902 | + $html .= '<div id="wpvr-social-share-bg-box'.$pano_suffix.'" class="wpvr-social-share-bg-box" style="top:'.$social_logo_top.'"> | |
| 1865 | 1903 | <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> |
| 1866 | 1904 | <nav class="wpvr-share-nav"> |
| 1867 | 1905 | '.WPVR_Helper::social_media_share_links_display_in_embed(home_url().'/?embed_page='. $id).' |
| 1868 | 1906 | </nav> |
| @@ -1869,45 +1907,88 @@ | ||
| 1869 | 1907 | </div>'; |
| 1870 | 1908 | } |
| 1871 | 1909 | } |
| 1872 | 1910 | //===Floor plan section===// |
| 1873 | - $floor_map_image = ""; | |
| 1874 | - $floor_map_pointer = array(); | |
| 1875 | - $floor_map_scene_id = ''; | |
| 1876 | - $floor_plan_custom_color = '#cca92c'; | |
| 1877 | - $floor_plan_direction_indicator = isset($postdata['floor_plan_direction_indicator']) ? $postdata['floor_plan_direction_indicator'] : 'on'; | |
| 1911 | + if ( $has_floor_plan ) { | |
| 1912 | + $floor_map_image = $floor_plan_image; | |
| 1913 | + $floor_map_pointer = isset($postdata['floor_plan_pointer_position']) && is_array($postdata['floor_plan_pointer_position']) ? $postdata['floor_plan_pointer_position'] : array(); | |
| 1914 | + $floor_map_scene_id = isset($postdata['floor_plan_data_list']) && is_array($postdata['floor_plan_data_list']) ? $postdata['floor_plan_data_list'] : array(); | |
| 1915 | + $floor_plan_custom_color = isset($postdata['floor_plan_custom_color']) && ! empty($postdata['floor_plan_custom_color']) ? $postdata['floor_plan_custom_color'] : '#cca92c'; | |
| 1916 | + $floor_plan_direction_indicator = isset($postdata['floor_plan_direction_indicator']) ? $postdata['floor_plan_direction_indicator'] : 'on'; | |
| 1878 | 1917 | |
| 1879 | - if (isset($postdata['floor_plan_attachment_url'])) { | |
| 1880 | - $floor_map_image = $postdata['floor_plan_attachment_url']; | |
| 1881 | - $floor_map_pointer = $postdata['floor_plan_pointer_position']; | |
| 1882 | - $floor_map_scene_id = $postdata['floor_plan_data_list']; | |
| 1883 | - $floor_plan_custom_color = $postdata['floor_plan_custom_color']; | |
| 1884 | - } | |
| 1885 | - $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $id . '" style="display: none">'; | |
| 1886 | - $html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>'; | |
| 1887 | - $html .= '<img loading="lazy" src="'.$floor_map_image.'">'; | |
| 1888 | - foreach($floor_map_pointer as $key=> $pointer_position){ | |
| 1889 | - $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.'"> | |
| 1890 | - <svg class="floor-pointer-circle" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| 1891 | - <circle cx="12" cy="12" r="11.5" stroke="'.$floor_plan_custom_color.'"/> | |
| 1892 | - <circle cx="12" cy="12" r="5" fill="'.$foreground_color_pointer.'"/> | |
| 1893 | - </svg>'; | |
| 1894 | - | |
| 1895 | - // Only add the floor pointer flash SVG if floor_plan_direction_indicator is "on" | |
| 1896 | - if ($floor_plan_direction_indicator === "on") { | |
| 1897 | - $html .= '<svg class="floor-pointer-flash" width="54" height="35" viewBox="0 0 54 35" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| 1898 | - <path d="M0.454054 1.32433L11.7683 34.3243C11.9069 34.7285 12.287 35 12.7143 35H41.2857C41.713 35 42.0931 34.7285 42.2317 34.3243L53.5459 1.32432C53.7685 0.675257 53.2862 0 52.6 0H1.4C0.713843 0 0.231517 0.675258 0.454054 1.32433Z" fill="url(#paint0_linear_1_10)"/> | |
| 1899 | - <defs> | |
| 1900 | - <linearGradient id="paint0_linear_1_10" x1="27" y1="4.59807e-08" x2="26.5" y2="28" gradientUnits="userSpaceOnUse"> | |
| 1901 | - <stop stop-color="' . esc_attr( $floor_plan_custom_color ) . '" stop-opacity="0"/> | |
| 1902 | - <stop offset="1" stop-color="' . esc_attr( $floor_plan_custom_color ) . '"/> | |
| 1903 | - </linearGradient> | |
| 1904 | - </defs> | |
| 1905 | - </svg>'; | |
| 1918 | + $media_alt = ''; | |
| 1919 | + $attachment_id = attachment_url_to_postid( $floor_map_image ); | |
| 1920 | + | |
| 1921 | + if ( $attachment_id ) { | |
| 1922 | + $media_alt = sanitize_text_field( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ); | |
| 1923 | + } | |
| 1924 | + | |
| 1925 | + if ( ! empty( $media_alt ) ) { | |
| 1926 | + $floor_map_alt = $media_alt; | |
| 1927 | + } else { | |
| 1928 | + $tour_title = sanitize_text_field( get_the_title( $id ) ); | |
| 1929 | + | |
| 1930 | + $floor_map_alt = ! empty( $tour_title ) | |
| 1931 | + /* translators: %s: tour title */ | |
| 1932 | + ? sprintf( __( '%s - Floor Plan', 'wpvr' ), $tour_title ) | |
| 1933 | + : __( 'Floor Plan', 'wpvr' ); | |
| 1934 | + } | |
| 1935 | + | |
| 1936 | + $html .= '<div class="wpvr-floor-map" id="wpvr-floor-map' . $pano_suffix . '" style="display: none">'; | |
| 1937 | + $html .= '<span class="close-floor-map-plan"><i class="fa fa-times"></i></span>'; | |
| 1938 | + $html .= '<img loading="lazy" src="' . esc_url( $floor_map_image ) . '" alt="' . esc_attr( $floor_map_alt ) . '">'; | |
| 1939 | + foreach ( $floor_map_pointer as $key => $pointer_position ) { | |
| 1940 | + $pointer_id = ''; | |
| 1941 | + $data_top = ''; | |
| 1942 | + $data_left = ''; | |
| 1943 | + $style = ''; | |
| 1944 | + | |
| 1945 | + if ( is_object( $pointer_position ) ) { | |
| 1946 | + $pointer_id = isset( $pointer_position->id ) ? (string) $pointer_position->id : ''; | |
| 1947 | + $data_top = isset( $pointer_position->data_top ) ? (string) $pointer_position->data_top : ''; | |
| 1948 | + $data_left = isset( $pointer_position->data_left ) ? (string) $pointer_position->data_left : ''; | |
| 1949 | + $style = isset( $pointer_position->style ) ? (string) $pointer_position->style : ''; | |
| 1950 | + } elseif ( is_array( $pointer_position ) ) { | |
| 1951 | + $pointer_id = isset( $pointer_position['id'] ) ? (string) $pointer_position['id'] : ''; | |
| 1952 | + $data_top = isset( $pointer_position['data_top'] ) ? (string) $pointer_position['data_top'] : ''; | |
| 1953 | + $data_left = isset( $pointer_position['data_left'] ) ? (string) $pointer_position['data_left'] : ''; | |
| 1954 | + $style = isset( $pointer_position['style'] ) ? (string) $pointer_position['style'] : ''; | |
| 1955 | + } | |
| 1956 | + | |
| 1957 | + $scene_id_val = ''; | |
| 1958 | + if ( isset( $floor_map_scene_id[ $key ] ) ) { | |
| 1959 | + $scene_item = $floor_map_scene_id[ $key ]; | |
| 1960 | + if ( is_object( $scene_item ) && isset( $scene_item->value ) ) { | |
| 1961 | + $scene_id_val = (string) $scene_item->value; | |
| 1962 | + } elseif ( is_array( $scene_item ) && isset( $scene_item['value'] ) ) { | |
| 1963 | + $scene_id_val = (string) $scene_item['value']; | |
| 1964 | + } elseif ( is_scalar( $scene_item ) ) { | |
| 1965 | + $scene_id_val = (string) $scene_item; | |
| 1906 | 1966 | } |
| 1967 | + } | |
| 1968 | + | |
| 1969 | + $html .= '<div class="floor-plan-pointer ui-draggable ui-draggable-handle" scene_id="' . esc_attr( $scene_id_val ) . '" id="' . esc_attr( $pointer_id ) . '" data-top="' . esc_attr( $data_top ) . '" data-left="' . esc_attr( $data_left ) . '" style="' . esc_attr( $style ) . '"> | |
| 1970 | + <svg class="floor-pointer-circle" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| 1971 | + <circle cx="12" cy="12" r="11.5" stroke="' . esc_attr( $floor_plan_custom_color ) . '"/> | |
| 1972 | + <circle cx="12" cy="12" r="5" fill="' . esc_attr( $foreground_color_pointer ) . '"/> | |
| 1973 | + </svg>'; | |
| 1974 | + | |
| 1975 | + // Only add the floor pointer flash SVG if floor_plan_direction_indicator is "on" | |
| 1976 | + if ( $floor_plan_direction_indicator === 'on' ) { | |
| 1977 | + $html .= '<svg class="floor-pointer-flash" width="54" height="35" viewBox="0 0 54 35" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| 1978 | + <path d="M0.454054 1.32433L11.7683 34.3243C11.9069 34.7285 12.287 35 12.7143 35H41.2857C41.713 35 42.0931 34.7285 42.2317 34.3243L53.5459 1.32432C53.7685 0.675257 53.2862 0 52.6 0H1.4C0.713843 0 0.231517 0.675258 0.454054 1.32433Z" fill="url(#paint0_linear_1_10)"/> | |
| 1979 | + <defs> | |
| 1980 | + <linearGradient id="paint0_linear_1_10" x1="27" y1="4.59807e-08" x2="26.5" y2="28" gradientUnits="userSpaceOnUse"> | |
| 1981 | + <stop stop-color="' . esc_attr( $floor_plan_custom_color ) . '" stop-opacity="0"/> | |
| 1982 | + <stop offset="1" stop-color="' . esc_attr( $floor_plan_custom_color ) . '"/> | |
| 1983 | + </linearGradient> | |
| 1984 | + </defs> | |
| 1985 | + </svg>'; | |
| 1986 | + } | |
| 1987 | + $html .= '</div>'; | |
| 1988 | + } | |
| 1907 | 1989 | $html .= '</div>'; |
| 1908 | 1990 | } |
| 1909 | - $html .= '</div>'; | |
| 1910 | 1991 | //===Floor plan section===// |
| 1911 | 1992 | |
| 1912 | 1993 | $html .= '<div class="wpvr-hotspot-tweak-contents-wrapper" style="display: none">'; |
| 1913 | 1994 | $html .= '<i class="fa fa-times cross" data-id="' . $id . '"></i>'; |
| @@ -1987,9 +2068,10 @@ | ||
| 1987 | 2068 | border: '.$border_width.'px '.$border_style.' '.$border_color.'; |
| 1988 | 2069 | border-radius: '.$border_radius.'px; |
| 1989 | 2070 | padding: '.$button_pt.'px '.$button_pr.'px '.$button_pb.'px '.$button_pl.'px; |
| 1990 | 2071 | '; |
| 1991 | - $html .= '<div class="wpvr-call-to-action-button position-'.$text_align.'" style="max-width:' . $width.'"> | |
| 2072 | + $cta_width = ( $width === 'fullwidth' || $width === 'embed' ) ? '100%' : $width; | |
| 2073 | + $html .= '<div class="wpvr-call-to-action-button position-'.$text_align.'" style="max-width:' . $cta_width . '"> | |
| 1992 | 2074 | <a href="'.$buttonurl.'" style="'.$style.'" target="'.$target.'">'.$buttontext.'</a> |
| 1993 | 2075 | </div>'; |
| 1994 | 2076 | |
| 1995 | 2077 | } |
| @@ -1999,26 +2081,26 @@ | ||
| 1999 | 2081 | //script started |
| 2000 | 2082 | $html .= '<script>'; |
| 2001 | 2083 | if (isset($postdata['bg_music']) && $bg_music == 'on' && 'valid' == $status && $is_pro) { |
| 2002 | 2084 | $html .= ' |
| 2003 | - var x' . $id . ' = document.getElementById("vrAudio' . $id . '"); | |
| 2004 | - var playing' . $id . ' = false; | |
| 2005 | - var autoplaySupported' . $id . ' = false; | |
| 2006 | - var alertShown' . $id . ' = false; | |
| 2007 | - var autoplayChecked' . $id . ' = false; | |
| 2085 | + var x' . $pano_suffix . ' = document.getElementById("vrAudio' . $pano_suffix . '"); | |
| 2086 | + var playing' . $pano_suffix . ' = false; | |
| 2087 | + var autoplaySupported' . $pano_suffix . ' = false; | |
| 2088 | + var alertShown' . $pano_suffix . ' = false; | |
| 2089 | + var autoplayChecked' . $pano_suffix . ' = false; | |
| 2008 | 2090 | |
| 2009 | - function playPause' . $id . '() { | |
| 2010 | - if (playing' . $id . ') { | |
| 2011 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2012 | - x' . $id . '.pause(); | |
| 2013 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2014 | - playing' . $id . ' = false; | |
| 2091 | + function playPause' . $pano_suffix . '() { | |
| 2092 | + if (playing' . $pano_suffix . ') { | |
| 2093 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2094 | + x' . $pano_suffix . '.pause(); | |
| 2095 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2096 | + playing' . $pano_suffix . ' = false; | |
| 2015 | 2097 | } else { |
| 2016 | - x' . $id . '.muted = false; | |
| 2017 | - x' . $id . '.play().then(function() { | |
| 2018 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2019 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2020 | - playing' . $id . ' = true; | |
| 2098 | + x' . $pano_suffix . '.muted = false; | |
| 2099 | + x' . $pano_suffix . '.play().then(function() { | |
| 2100 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2101 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2102 | + playing' . $pano_suffix . ' = true; | |
| 2021 | 2103 | }).catch(function(e) { |
| 2022 | 2104 | console.log("Play failed:", e); |
| 2023 | 2105 | }); |
| 2024 | 2106 | } |
| @@ -2023,133 +2105,139 @@ | ||
| 2023 | 2105 | }); |
| 2024 | 2106 | } |
| 2025 | 2107 | } |
| 2026 | 2108 | |
| 2027 | - function audionEnd' . $id . '() { | |
| 2028 | - playing' . $id . ' = false; | |
| 2029 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2030 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2109 | + function audionEnd' . $pano_suffix . '() { | |
| 2110 | + playing' . $pano_suffix . ' = false; | |
| 2111 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2112 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2031 | 2113 | } |
| 2032 | 2114 | |
| 2033 | - x' . $id . '.addEventListener("ended", audionEnd' . $id . ');'; | |
| 2115 | + x' . $pano_suffix . '.addEventListener("ended", audionEnd' . $pano_suffix . ');'; | |
| 2034 | 2116 | |
| 2035 | 2117 | if ($autoplay_bg_music == 'on') { |
| 2036 | 2118 | $html .= ' |
| 2037 | 2119 | |
| 2038 | - x' . $id . '.addEventListener("loadeddata", function() { | |
| 2039 | - if (!autoplayChecked' . $id . ') { | |
| 2040 | - checkAutoplayStatus' . $id . '(); | |
| 2120 | + x' . $pano_suffix . '.addEventListener("loadeddata", function() { | |
| 2121 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2122 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2041 | 2123 | } |
| 2042 | 2124 | }); |
| 2043 | 2125 | |
| 2044 | - x' . $id . '.addEventListener("canplay", function() { | |
| 2045 | - if (!autoplayChecked' . $id . ') { | |
| 2046 | - checkAutoplayStatus' . $id . '(); | |
| 2126 | + x' . $pano_suffix . '.addEventListener("canplay", function() { | |
| 2127 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2128 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2047 | 2129 | } |
| 2048 | 2130 | }); |
| 2049 | 2131 | |
| 2050 | - x' . $id . '.addEventListener("canplaythrough", function() { | |
| 2051 | - if (!autoplayChecked' . $id . ') { | |
| 2052 | - checkAutoplayStatus' . $id . '(); | |
| 2132 | + x' . $pano_suffix . '.addEventListener("canplaythrough", function() { | |
| 2133 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2134 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2053 | 2135 | } |
| 2054 | 2136 | }); |
| 2055 | 2137 | |
| 2056 | 2138 | setTimeout(function() { |
| 2057 | - if (!autoplayChecked' . $id . ') { | |
| 2058 | - checkAutoplayStatus' . $id . '(); | |
| 2139 | + if (!autoplayChecked' . $pano_suffix . ') { | |
| 2140 | + checkAutoplayStatus' . $pano_suffix . '(); | |
| 2059 | 2141 | } |
| 2060 | 2142 | }, 1000); |
| 2061 | 2143 | |
| 2062 | - x' . $id . '.addEventListener("play", function() { | |
| 2063 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2064 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2065 | - playing' . $id . ' = true; | |
| 2144 | + x' . $pano_suffix . '.addEventListener("play", function() { | |
| 2145 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2146 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2147 | + playing' . $pano_suffix . ' = true; | |
| 2066 | 2148 | }); |
| 2067 | 2149 | |
| 2068 | - x' . $id . '.addEventListener("pause", function() { | |
| 2069 | - if (!playing' . $id . ') { | |
| 2070 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2071 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2150 | + x' . $pano_suffix . '.addEventListener("pause", function() { | |
| 2151 | + if (!playing' . $pano_suffix . ') { | |
| 2152 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2153 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2072 | 2154 | } |
| 2073 | 2155 | }); |
| 2074 | 2156 | |
| 2075 | - function checkAutoplayStatus' . $id . '() { | |
| 2076 | - autoplayChecked' . $id . ' = true; | |
| 2157 | + function checkAutoplayStatus' . $pano_suffix . '() { | |
| 2158 | + autoplayChecked' . $pano_suffix . ' = true; | |
| 2077 | 2159 | |
| 2078 | - x' . $id . '.muted = true; | |
| 2079 | - var playPromise = x' . $id . '.play(); | |
| 2160 | + x' . $pano_suffix . '.muted = true; | |
| 2161 | + var playPromise = x' . $pano_suffix . '.play(); | |
| 2080 | 2162 | |
| 2081 | 2163 | if (playPromise !== undefined) { |
| 2082 | 2164 | playPromise.then(function () { |
| 2083 | - if (x' . $id . '.muted || x' . $id . '.volume === 0) { | |
| 2084 | - handleAutoplayBlocked' . $id . '(); | |
| 2165 | + if (x' . $pano_suffix . '.muted || x' . $pano_suffix . '.volume === 0) { | |
| 2166 | + handleAutoplayBlocked' . $pano_suffix . '(); | |
| 2085 | 2167 | } else { |
| 2086 | - autoplaySupported' . $id . ' = true; | |
| 2087 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2088 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2089 | - playing' . $id . ' = true; | |
| 2168 | + autoplaySupported' . $pano_suffix . ' = true; | |
| 2169 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2170 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2171 | + playing' . $pano_suffix . ' = true; | |
| 2090 | 2172 | } |
| 2091 | 2173 | }).catch(function () { |
| 2092 | - handleAutoplayBlocked' . $id . '(); | |
| 2174 | + handleAutoplayBlocked' . $pano_suffix . '(); | |
| 2093 | 2175 | }); |
| 2094 | 2176 | } else { |
| 2095 | 2177 | setTimeout(function () { |
| 2096 | - if (x' . $id . '.paused || x' . $id . '.currentTime === 0) { | |
| 2097 | - handleAutoplayBlocked' . $id . '(); | |
| 2178 | + if (x' . $pano_suffix . '.paused || x' . $pano_suffix . '.currentTime === 0) { | |
| 2179 | + handleAutoplayBlocked' . $pano_suffix . '(); | |
| 2098 | 2180 | } else { |
| 2099 | - autoplaySupported' . $id . ' = true; | |
| 2100 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2101 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2102 | - playing' . $id . ' = true; | |
| 2181 | + autoplaySupported' . $pano_suffix . ' = true; | |
| 2182 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2183 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2184 | + playing' . $pano_suffix . ' = true; | |
| 2103 | 2185 | } |
| 2104 | 2186 | }, 300); |
| 2105 | 2187 | } |
| 2106 | 2188 | } |
| 2107 | 2189 | |
| 2108 | - function handleAutoplayBlocked' . $id . '() { | |
| 2109 | - autoplaySupported' . $id . ' = false; | |
| 2110 | - if (!alertShown' . $id . ') { | |
| 2190 | + function handleAutoplayBlocked' . $pano_suffix . '() { | |
| 2191 | + autoplaySupported' . $pano_suffix . ' = false; | |
| 2192 | + if (!alertShown' . $pano_suffix . ') { | |
| 2111 | 2193 | alert("Autoplay is not supported in your browser. Please click the audio button to play music."); |
| 2112 | - alertShown' . $id . ' = true; | |
| 2194 | + alertShown' . $pano_suffix . ' = true; | |
| 2113 | 2195 | } |
| 2114 | 2196 | |
| 2115 | - x' . $id . '.pause(); | |
| 2116 | - x' . $id . '.currentTime = 0; | |
| 2117 | - x' . $id . '.muted = true; | |
| 2197 | + x' . $pano_suffix . '.pause(); | |
| 2198 | + x' . $pano_suffix . '.currentTime = 0; | |
| 2199 | + x' . $pano_suffix . '.muted = true; | |
| 2118 | 2200 | |
| 2119 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2120 | - jQuery("#audio_control' . $id . '").attr("data-play", "off"); | |
| 2201 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up").addClass("fas fa-volume-mute"); | |
| 2202 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "off"); | |
| 2121 | 2203 | |
| 2122 | - document.getElementById("pano' . $id . '").addEventListener("click", musicPlay' . $id . '); | |
| 2123 | - document.addEventListener("touchstart", musicPlay' . $id . ', { once: true }); | |
| 2124 | - document.addEventListener("click", musicPlay' . $id . ', { once: true }); | |
| 2204 | + var musicTriggerElem = document.getElementById("' . $panoid . '"); | |
| 2205 | + if (musicTriggerElem) { | |
| 2206 | + musicTriggerElem.addEventListener("click", musicPlay' . $pano_suffix . '); | |
| 2207 | + } | |
| 2208 | + document.addEventListener("touchstart", musicPlay' . $pano_suffix . ', { once: true }); | |
| 2209 | + document.addEventListener("click", musicPlay' . $pano_suffix . ', { once: true }); | |
| 2125 | 2210 | } |
| 2126 | 2211 | |
| 2127 | - function musicPlay' . $id . '() { | |
| 2128 | - x' . $id . '.muted = false; | |
| 2129 | - var playPromise = x' . $id . '.play(); | |
| 2212 | + function musicPlay' . $pano_suffix . '() { | |
| 2213 | + x' . $pano_suffix . '.muted = false; | |
| 2214 | + var playPromise = x' . $pano_suffix . '.play(); | |
| 2130 | 2215 | |
| 2131 | 2216 | if (playPromise !== undefined) { |
| 2132 | 2217 | playPromise.then(function () { |
| 2133 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2134 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2135 | - playing' . $id . ' = true; | |
| 2218 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2219 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2220 | + playing' . $pano_suffix . ' = true; | |
| 2136 | 2221 | }).catch(function(e) { |
| 2137 | 2222 | console.log("Play failed:", e); |
| 2138 | 2223 | }); |
| 2139 | 2224 | } else { |
| 2140 | 2225 | setTimeout(function () { |
| 2141 | - if (!x' . $id . '.paused) { | |
| 2142 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2143 | - jQuery("#audio_control' . $id . '").attr("data-play", "on"); | |
| 2144 | - playing' . $id . ' = true; | |
| 2226 | + if (!x' . $pano_suffix . '.paused) { | |
| 2227 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-mute").addClass("fas fa-volume-up"); | |
| 2228 | + jQuery("#audio_control' . $pano_suffix . '").attr("data-play", "on"); | |
| 2229 | + playing' . $pano_suffix . ' = true; | |
| 2145 | 2230 | } |
| 2146 | 2231 | }, 100); |
| 2147 | 2232 | } |
| 2148 | 2233 | |
| 2149 | - document.getElementById("pano' . $id . '").removeEventListener("click", musicPlay' . $id . '); | |
| 2150 | - document.removeEventListener("touchstart", musicPlay' . $id . '); | |
| 2151 | - document.removeEventListener("click", musicPlay' . $id . '); | |
| 2234 | + var musicTriggerElem = document.getElementById("' . $panoid . '"); | |
| 2235 | + if (musicTriggerElem) { | |
| 2236 | + musicTriggerElem.removeEventListener("click", musicPlay' . $pano_suffix . '); | |
| 2237 | + } | |
| 2238 | + document.removeEventListener("touchstart", musicPlay' . $pano_suffix . '); | |
| 2239 | + document.removeEventListener("click", musicPlay' . $pano_suffix . '); | |
| 2152 | 2240 | } |
| 2153 | 2241 | '; |
| 2154 | 2242 | } |
| 2155 | 2243 | } |
| @@ -2158,27 +2246,31 @@ | ||
| 2158 | 2246 | $html .= 'var response = ' . $response . ';'; |
| 2159 | 2247 | $html .= 'var scenes = response[1];'; |
| 2160 | 2248 | $html .= 'if(scenes) {'; |
| 2161 | 2249 | $html .= 'var scenedata = scenes.scenes;'; |
| 2162 | - $html .= 'for(var i in scenedata) {'; | |
| 2163 | - $html .= 'var scenehotspot = scenedata[i].hotSpots;'; | |
| 2164 | - $html .= 'for(var i = 0; i < scenehotspot.length; i++) {'; | |
| 2165 | - $html .= 'if(scenehotspot[i].type === "info") {'; | |
| 2166 | - $html .= ' scenehotspot[i]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; | |
| 2167 | - $html .= '} else if(scenehotspot[i].type === "scene") {'; | |
| 2168 | - $html .= ' scenehotspot[i]["clickHandlerArgs"] = scenehotspot[i]["text"];'; | |
| 2250 | + $html .= 'for(var scId in scenedata) {'; | |
| 2251 | + $html .= 'if(!scenedata.hasOwnProperty(scId)) continue;'; | |
| 2252 | + $html .= 'var scenehotspot = scenedata[scId].hotSpots;'; | |
| 2253 | + $html .= 'if(scenehotspot && scenehotspot.length) {'; | |
| 2254 | + $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {'; | |
| 2255 | + $html .= 'if(scenehotspot[hIdx].type === "info") {'; | |
| 2256 | + $html .= ' scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; | |
| 2257 | + $html .= '} else if(scenehotspot[hIdx].type === "scene") {'; | |
| 2258 | + $html .= ' scenehotspot[hIdx]["clickHandlerArgs"] = scenehotspot[hIdx]["text"] || "";'; | |
| 2169 | 2259 | $status = get_option('wpvr_edd_license_status'); |
| 2170 | 2260 | if ($status !== false && $status == 'valid') { |
| 2171 | - $html .='if(typeof wpvr_public !== "undefined" && wpvr_public.is_pro_active) {'; | |
| 2172 | - $html .= ' scenehotspot[i]["clickHandlerFunc"] = function(div, args) { if (typeof wpvrhotspotscene === "function") { wpvrhotspotscene(div, args); } else if (typeof window.wpvrhotspotscene === "function") { window.wpvrhotspotscene(div, args); } };'; | |
| 2261 | + $html .='if(typeof wpvr_public !== "undefined") {'; | |
| 2262 | + $html .='if(wpvr_public.is_pro_active) {'; | |
| 2263 | + $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); } };'; | |
| 2173 | 2264 | $html .='}'; |
| 2265 | + $html .='}'; | |
| 2174 | 2266 | } |
| 2175 | 2267 | $html .= '}'; |
| 2176 | 2268 | |
| 2177 | 2269 | if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 2178 | 2270 | } else { |
| 2179 | - $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {'; | |
| 2180 | - $html .= 'scenehotspot[i]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2271 | + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2272 | + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2181 | 2273 | $html .= '}'; |
| 2182 | 2274 | } |
| 2183 | 2275 | |
| 2184 | 2276 | $html .= '}'; |
| @@ -2183,24 +2275,25 @@ | ||
| 2183 | 2275 | |
| 2184 | 2276 | $html .= '}'; |
| 2185 | 2277 | $html .= '}'; |
| 2186 | 2278 | $html .= '}'; |
| 2187 | - $html .= 'var panoshow' . $id . ';'; | |
| 2188 | - $html .= 'var panoshow2' . $id . ';'; | |
| 2189 | - $html .= 'function initWPVRViewer' . $id . '() {'; | |
| 2190 | - $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer' . $id . ', 50); return; }'; | |
| 2191 | - $html .= 'panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes);'; | |
| 2279 | + $html .= '}'; | |
| 2280 | + $html .= 'var panoshow' . $pano_suffix . ';'; | |
| 2281 | + $html .= 'var panoshow2' . $pano_suffix . ';'; | |
| 2282 | + $html .= 'function initWPVRViewer' . $pano_suffix . '() {'; | |
| 2283 | + $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer' . $pano_suffix . ', 50); return; }'; | |
| 2284 | + $html .= 'panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes);'; | |
| 2192 | 2285 | $html .= ' |
| 2193 | 2286 | window.wpvrViewers = window.wpvrViewers || {}; |
| 2194 | - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . '; | |
| 2287 | + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . '; | |
| 2195 | 2288 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 2196 | - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' } | |
| 2289 | + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' } | |
| 2197 | 2290 | })); |
| 2198 | 2291 | '; |
| 2199 | 2292 | if ( (float) $scene_fade_duration > 0 ) { |
| 2200 | 2293 | $html .= ' |
| 2201 | - panoshow' . $id . '.on("scenechange", function() { | |
| 2202 | - var fadeImage = document.querySelector("#pano' . $id . ' .pnlm-render-container > .pnlm-fade-img"); | |
| 2294 | + panoshow' . $pano_suffix . '.on("scenechange", function() { | |
| 2295 | + var fadeImage = document.querySelector("#' . $panoid . ' .pnlm-render-container > .pnlm-fade-img"); | |
| 2203 | 2296 | if (fadeImage) { |
| 2204 | 2297 | fadeImage.style.opacity = "1"; |
| 2205 | 2298 | void fadeImage.offsetWidth; |
| 2206 | 2299 | } |
| @@ -2208,20 +2301,20 @@ | ||
| 2208 | 2301 | } |
| 2209 | 2302 | $html .= ' |
| 2210 | 2303 | |
| 2211 | 2304 | if(typeof wpvr_public === "undefined" || !wpvr_public.is_pro_active || !wpvr_public.is_license_active) { |
| 2212 | - panoshow' . $id . '.on("load", function() { | |
| 2305 | + panoshow' . $pano_suffix . '.on("load", function() { | |
| 2213 | 2306 | jQuery(".pnlm-panorama-info").hide(); |
| 2214 | 2307 | jQuery(".pnlm-compass").hide(); |
| 2215 | 2308 | }); |
| 2216 | 2309 | |
| 2217 | - panoshow' . $id . '.on("scenechange", function() { | |
| 2310 | + panoshow' . $pano_suffix . '.on("scenechange", function() { | |
| 2218 | 2311 | jQuery(".pnlm-panorama-info").hide(); |
| 2219 | 2312 | jQuery(".pnlm-compass").hide(); |
| 2220 | 2313 | }); |
| 2221 | 2314 | }'; |
| 2222 | 2315 | $html .= '}'; |
| 2223 | - $html .= 'initWPVRViewer' . $id . '();'; | |
| 2316 | + $html .= 'initWPVRViewer' . $pano_suffix . '();'; | |
| 2224 | 2317 | //===Dplicate mode only for vr mode===// |
| 2225 | 2318 | $response2 = json_decode($response); |
| 2226 | 2319 | $response2[1]->compass = false; |
| 2227 | 2320 | $response2[1]->autoRotate = false; |
| @@ -2230,40 +2323,43 @@ | ||
| 2230 | 2323 | $html .= 'var scenes_duplicate = response_duplicate[1];'; |
| 2231 | 2324 | |
| 2232 | 2325 | $html .= 'if(scenes_duplicate) {'; |
| 2233 | 2326 | $html .= 'var scenedata = scenes_duplicate.scenes;'; |
| 2234 | - $html .= 'for(var i in scenedata) {'; | |
| 2235 | - $html .= 'var scenehotspot = scenedata[i].hotSpots;'; | |
| 2236 | - $html .= 'for(var i = 0; i < scenehotspot.length; i++) {'; | |
| 2237 | - $html .= 'if(scenehotspot[i]["clickHandlerArgs"] != "") {'; | |
| 2238 | - $html .= 'scenehotspot[i]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; | |
| 2327 | + $html .= 'for(var scId in scenedata) {'; | |
| 2328 | + $html .= 'if(!scenedata.hasOwnProperty(scId)) continue;'; | |
| 2329 | + $html .= 'var scenehotspot = scenedata[scId].hotSpots;'; | |
| 2330 | + $html .= 'if(scenehotspot && scenehotspot.length) {'; | |
| 2331 | + $html .= 'for(var hIdx = 0; hIdx < scenehotspot.length; hIdx++) {'; | |
| 2332 | + $html .= 'if(scenehotspot[hIdx]["clickHandlerArgs"] != "") {'; | |
| 2333 | + $html .= 'scenehotspot[hIdx]["clickHandlerFunc"] = function(div, args) { if (typeof window.wpvrhotspot === "function") { window.wpvrhotspot(div, args); } };'; | |
| 2239 | 2334 | $html .= '}'; |
| 2240 | 2335 | if (wpvr_isMobileDevice() && get_option('dis_on_hover') == "true") { |
| 2241 | 2336 | } else { |
| 2242 | - $html .= 'if(scenehotspot[i]["createTooltipArgs"] != "") {'; | |
| 2243 | - $html .= 'scenehotspot[i]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2337 | + $html .= 'if(scenehotspot[hIdx]["createTooltipArgs"] != "") {'; | |
| 2338 | + $html .= 'scenehotspot[hIdx]["createTooltipFunc"] = function(div, args) { if (typeof window.wpvrtooltip === "function") { window.wpvrtooltip(div, args); } };'; | |
| 2244 | 2339 | $html .= '}'; |
| 2245 | 2340 | } |
| 2246 | 2341 | $html .= '}'; |
| 2247 | 2342 | $html .= '}'; |
| 2248 | 2343 | $html .= '}'; |
| 2344 | + $html .= '}'; | |
| 2249 | 2345 | |
| 2250 | 2346 | $is_pro = apply_filters('is_wpvr_pro_active',false); |
| 2251 | 2347 | $status = get_option('wpvr_edd_license_status'); |
| 2252 | 2348 | $html .= 'var vr_mode = "off";'; |
| 2253 | 2349 | if ($status !== false && 'valid' == $status && $is_pro) { |
| 2254 | - $html .= 'function initWPVRViewer2' . $id . '() {'; | |
| 2255 | - $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer2' . $id . ', 50); return; }'; | |
| 2256 | - $html .= 'panoshow2' . $id . ' = pannellum.viewer("pano2' . $id . '", scenes_duplicate);'; | |
| 2350 | + $html .= 'function initWPVRViewer2' . $pano_suffix . '() {'; | |
| 2351 | + $html .= 'if (typeof pannellum === "undefined" || typeof jQuery === "undefined") { setTimeout(initWPVRViewer2' . $pano_suffix . ', 50); return; }'; | |
| 2352 | + $html .= 'panoshow2' . $pano_suffix . ' = pannellum.viewer("' . $panoid2 . '", scenes_duplicate);'; | |
| 2257 | 2353 | $html .= ' |
| 2258 | 2354 | window.wpvrViewers = window.wpvrViewers || {}; |
| 2259 | - window.wpvrViewers["pano2' . $id . '"] = panoshow2' . $id . '; | |
| 2355 | + window.wpvrViewers["' . $panoid2 . '"] = panoshow2' . $pano_suffix . '; | |
| 2260 | 2356 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 2261 | - detail: { containerId: "pano2' . $id . '", viewer: panoshow2' . $id . ' } | |
| 2357 | + detail: { containerId: "' . $panoid2 . '", viewer: panoshow2' . $pano_suffix . ' } | |
| 2262 | 2358 | })); |
| 2263 | 2359 | '; |
| 2264 | 2360 | $html .= '}'; |
| 2265 | - $html .= 'initWPVRViewer2' . $id . '();'; | |
| 2361 | + $html .= 'initWPVRViewer2' . $pano_suffix . '();'; | |
| 2266 | 2362 | // Show Cardboard Mode in Tour |
| 2267 | 2363 | $html .= ' |
| 2268 | 2364 | var tim; |
| 2269 | 2365 | var im = 0; |
| @@ -2276,43 +2372,45 @@ | ||
| 2276 | 2372 | var scenedata = scenes_duplicate.scenes; |
| 2277 | 2373 | for(var i in scenedata) { |
| 2278 | 2374 | if(active_scene === i) { |
| 2279 | 2375 | var scenehotspot = scenedata[i].hotSpots; |
| 2280 | - for(var j in scenehotspot) { | |
| 2281 | - var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5; | |
| 2282 | - var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5; | |
| 2283 | - var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5; | |
| 2284 | - var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5; | |
| 2285 | - var firstCondition = ( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ; | |
| 2286 | - var secCondition = (Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw); | |
| 2287 | - if(( Math.round(data.pitch) > minusFivePitch) && (Math.round(data.pitch) < plusFivePitch) ){ | |
| 2288 | - if((Math.round(data.yaw) > minusFiveYaw) && (Math.round(data.yaw) < plusFiveYaw)){ | |
| 2289 | - jQuery(".center-pointer").addClass("wpvr-pluse-effect") | |
| 2290 | - var getScene = scenehotspot[j].sceneId; | |
| 2291 | - if(scenehotspot[j].type == "scene"){ | |
| 2292 | - panoshow' . $id . '.loadScene(getScene); | |
| 2293 | - panoshow2' . $id . '.loadScene(getScene); | |
| 2294 | -// var inside_current_time_object = new Date(); | |
| 2295 | -// var inside_timer = inside_current_time_object.getTime(); | |
| 2296 | -// if(inside_timer > timer) { | |
| 2297 | -// panoshow' . $id . '.loadScene(getScene); | |
| 2298 | -// panoshow2' . $id . '.loadScene(getScene); | |
| 2299 | -// jQuery(".center-pointer").removeClass("wpvr-pluse-effect") | |
| 2300 | -// } | |
| 2301 | - }else{ | |
| 2302 | - jQuery(".center-pointer").removeClass("wpvr-pluse-effect") | |
| 2376 | + if(scenehotspot && scenehotspot.length) { | |
| 2377 | + for(var j = 0; j < scenehotspot.length; j++) { | |
| 2378 | + var plusFiveYaw = Math.round(scenehotspot[j].yaw) + 5; | |
| 2379 | + var minusFiveYaw = Math.round(scenehotspot[j].yaw) - 5; | |
| 2380 | + var plusFivePitch = Math.round(scenehotspot[j].pitch) + 5; | |
| 2381 | + var minusFivePitch = Math.round(scenehotspot[j].pitch) - 5; | |
| 2382 | + if(Math.round(data.pitch) > minusFivePitch) { | |
| 2383 | + if(Math.round(data.pitch) < plusFivePitch) { | |
| 2384 | + if(Math.round(data.yaw) > minusFiveYaw) { | |
| 2385 | + if(Math.round(data.yaw) < plusFiveYaw) { | |
| 2386 | + jQuery(".center-pointer").addClass("wpvr-pluse-effect"); | |
| 2387 | + var getScene = scenehotspot[j].sceneId; | |
| 2388 | + if(scenehotspot[j].type == "scene"){ | |
| 2389 | + panoshow' . $pano_suffix . '.loadScene(getScene); | |
| 2390 | + panoshow2' . $pano_suffix . '.loadScene(getScene); | |
| 2391 | + }else{ | |
| 2392 | + jQuery(".center-pointer").removeClass("wpvr-pluse-effect"); | |
| 2393 | + } | |
| 2394 | + } else { | |
| 2395 | + jQuery(".center-pointer").removeClass("wpvr-pluse-effect"); | |
| 2396 | + c_time = new Date(); | |
| 2397 | + timer = c_time.getTime() + 2000; | |
| 2398 | + } | |
| 2399 | + } else { | |
| 2400 | + jQuery(".center-pointer").removeClass("wpvr-pluse-effect"); | |
| 2401 | + c_time = new Date(); | |
| 2402 | + timer = c_time.getTime() + 2000; | |
| 2403 | + } | |
| 2404 | + } else { | |
| 2405 | + c_time = new Date(); | |
| 2406 | + timer = c_time.getTime() + 2000; | |
| 2303 | 2407 | } |
| 2304 | - } | |
| 2305 | - else { | |
| 2306 | - jQuery(".center-pointer").removeClass("wpvr-pluse-effect") | |
| 2408 | + } else { | |
| 2307 | 2409 | c_time = new Date(); |
| 2308 | 2410 | timer = c_time.getTime() + 2000; |
| 2309 | 2411 | } |
| 2310 | 2412 | } |
| 2311 | - else { | |
| 2312 | - c_time = new Date(); | |
| 2313 | - timer = c_time.getTime() + 2000; | |
| 2314 | - } | |
| 2315 | 2413 | } |
| 2316 | 2414 | } |
| 2317 | 2415 | } |
| 2318 | 2416 | } |
| @@ -2318,26 +2416,28 @@ | ||
| 2318 | 2416 | } |
| 2319 | 2417 | }; |
| 2320 | 2418 | function vrDeviseOrientation(){ |
| 2321 | 2419 | var data = { |
| 2322 | - pitch: panoshow' . $id . '.getPitch(), | |
| 2323 | - yaw: panoshow' . $id . '.getYaw(), | |
| 2420 | + pitch: panoshow' . $pano_suffix . '.getPitch(), | |
| 2421 | + yaw: panoshow' . $pano_suffix . '.getYaw(), | |
| 2324 | 2422 | }; |
| 2325 | 2423 | panoShowCardBoardOnTrigger(data); |
| 2326 | 2424 | }'; |
| 2327 | 2425 | $html .= ' |
| 2328 | 2426 | function requestFullScreen(){ |
| 2329 | - var elem = document.getElementById("master-container"); | |
| 2330 | - if (elem.requestFullscreen) { | |
| 2331 | - elem.requestFullscreen(); | |
| 2332 | - } else if (elem.webkitRequestFullscreen) { /* Safari */ | |
| 2333 | - elem.webkitRequestFullscreen(); | |
| 2334 | - } else if (elem.msRequestFullscreen) { /* IE11 */ | |
| 2335 | - elem.msRequestFullscreen(); | |
| 2336 | - } | |
| 2427 | + var elem = document.getElementById("' . $master_container_id . '") || document.getElementById("master-container"); | |
| 2428 | + if (elem) { | |
| 2429 | + if (elem.requestFullscreen) { | |
| 2430 | + elem.requestFullscreen(); | |
| 2431 | + } else if (elem.webkitRequestFullscreen) { /* Safari */ | |
| 2432 | + elem.webkitRequestFullscreen(); | |
| 2433 | + } else if (elem.msRequestFullscreen) { /* IE11 */ | |
| 2434 | + elem.msRequestFullscreen(); | |
| 2435 | + } | |
| 2436 | + } | |
| 2337 | 2437 | } |
| 2338 | 2438 | function requestExitFullscreen(){ |
| 2339 | - var elem = document.getElementById("master-container"); | |
| 2439 | + var elem = document.getElementById("' . $master_container_id . '") || document.getElementById("master-container"); | |
| 2340 | 2440 | if (document.exitFullscreen) { |
| 2341 | 2441 | document.exitFullscreen(); |
| 2342 | 2442 | } else if (document.webkitExitFullscreen) { /* Safari */ |
| 2343 | 2443 | document.webkitExitFullscreen(); |
| @@ -2359,29 +2459,33 @@ | ||
| 2359 | 2459 | let onLoadAnalytics = false; |
| 2360 | 2460 | let sceneLoadAnalytics = false; |
| 2361 | 2461 | |
| 2362 | 2462 | function storeAnalyticsData(data) { |
| 2363 | - if (typeof wpvrAnalyticsObj !== "undefined" && typeof wpvr_public !== "undefined" && wpvr_public.is_pro_active) { | |
| 2364 | - jQuery.ajax({ | |
| 2365 | - url: wpvrAnalyticsObj.ajaxUrl, | |
| 2366 | - type: "POST", | |
| 2367 | - data: { | |
| 2368 | - action: "store_scene_hotspot_data", | |
| 2369 | - scene_id: data.scene_id, | |
| 2370 | - tour_id: data.tour_id, | |
| 2371 | - type: data.type, | |
| 2372 | - hotspot_id: data.hotspot_id || "", | |
| 2373 | - user_agent: navigator.userAgent, | |
| 2374 | - device_type: getDeviceType() || "desktop", | |
| 2375 | - nonce: wpvrAnalyticsObj.nonce, | |
| 2376 | - }, | |
| 2377 | - success: function (response) { | |
| 2378 | - console.log("Data stored successfully"); | |
| 2379 | - }, | |
| 2380 | - error: function (error) { | |
| 2381 | - console.log("Error in storing data"); | |
| 2463 | + if (typeof wpvrAnalyticsObj !== "undefined") { | |
| 2464 | + if (typeof wpvr_public !== "undefined") { | |
| 2465 | + if (wpvr_public.is_pro_active) { | |
| 2466 | + jQuery.ajax({ | |
| 2467 | + url: wpvrAnalyticsObj.ajaxUrl, | |
| 2468 | + type: "POST", | |
| 2469 | + data: { | |
| 2470 | + action: "store_scene_hotspot_data", | |
| 2471 | + scene_id: data.scene_id, | |
| 2472 | + tour_id: data.tour_id, | |
| 2473 | + type: data.type, | |
| 2474 | + hotspot_id: data.hotspot_id || "", | |
| 2475 | + user_agent: navigator.userAgent, | |
| 2476 | + device_type: getDeviceType() || "desktop", | |
| 2477 | + nonce: wpvrAnalyticsObj.nonce, | |
| 2478 | + }, | |
| 2479 | + success: function (response) { | |
| 2480 | + console.log("Data stored successfully"); | |
| 2481 | + }, | |
| 2482 | + error: function (error) { | |
| 2483 | + console.log("Error in storing data"); | |
| 2484 | + } | |
| 2485 | + }); | |
| 2382 | 2486 | } |
| 2383 | - }); | |
| 2487 | + } | |
| 2384 | 2488 | } else { |
| 2385 | 2489 | console.warn("Analytics object not available or pro not active"); |
| 2386 | 2490 | } |
| 2387 | 2491 | } |
| @@ -2394,9 +2498,9 @@ | ||
| 2394 | 2498 | } else { |
| 2395 | 2499 | return "desktop"; |
| 2396 | 2500 | } |
| 2397 | 2501 | } |
| 2398 | - panoshow' . $id . '.on("scenechange", function(scene) { | |
| 2502 | + panoshow' . $pano_suffix . '.on("scenechange", function(scene) { | |
| 2399 | 2503 | onLoadAnalytics = true; |
| 2400 | 2504 | sceneLoadAnalytics = true; |
| 2401 | 2505 | let scene_id = scene; |
| 2402 | 2506 | let tour_id = ' . $id . '; |
| @@ -2412,29 +2516,31 @@ | ||
| 2412 | 2516 | user_agent: user_agent, |
| 2413 | 2517 | device_type: device_type, |
| 2414 | 2518 | }); |
| 2415 | 2519 | }); |
| 2416 | - panoshow' . $id . '.on("load", function() { | |
| 2417 | - let scene_id = panoshow' . $id . '.getScene(); | |
| 2520 | + panoshow' . $pano_suffix . '.on("load", function() { | |
| 2521 | + let scene_id = panoshow' . $pano_suffix . '.getScene(); | |
| 2418 | 2522 | let tour_id = ' . $id . '; |
| 2419 | 2523 | let type = "scene"; |
| 2420 | 2524 | let hotspot_id = ""; |
| 2421 | 2525 | let user_agent = navigator.userAgent; |
| 2422 | 2526 | let device_type = getDeviceType() ? getDeviceType() : "desktop"; |
| 2423 | - if(!onLoadAnalytics && !sceneLoadAnalytics) { | |
| 2424 | - storeAnalyticsData({ | |
| 2425 | - scene_id: scene_id, | |
| 2426 | - tour_id: tour_id, | |
| 2427 | - type: type, | |
| 2428 | - hotspot_id: hotspot_id, | |
| 2429 | - user_agent: user_agent, | |
| 2430 | - device_type: device_type, | |
| 2431 | - }); | |
| 2527 | + if(!onLoadAnalytics) { | |
| 2528 | + if(!sceneLoadAnalytics) { | |
| 2529 | + storeAnalyticsData({ | |
| 2530 | + scene_id: scene_id, | |
| 2531 | + tour_id: tour_id, | |
| 2532 | + type: type, | |
| 2533 | + hotspot_id: hotspot_id, | |
| 2534 | + user_agent: user_agent, | |
| 2535 | + device_type: device_type, | |
| 2536 | + }); | |
| 2537 | + } | |
| 2432 | 2538 | } |
| 2433 | 2539 | }); |
| 2434 | - function wpvrhotspotscene(hotSpotDiv, args) { | |
| 2540 | + function wpvrhotspotscene' . $pano_suffix . '(hotSpotDiv, args) { | |
| 2435 | 2541 | onLoadAnalytics = true; |
| 2436 | - let scene_id = panoshow' . $id . '.getScene(); | |
| 2542 | + let scene_id = panoshow' . $pano_suffix . '.getScene(); | |
| 2437 | 2543 | let tour_id = ' . $id . '; |
| 2438 | 2544 | let type = "hotspot"; |
| 2439 | 2545 | let hotspot_id = args; |
| 2440 | 2546 | let user_agent = navigator.userAgent; |
| @@ -2447,27 +2553,28 @@ | ||
| 2447 | 2553 | user_agent: user_agent, |
| 2448 | 2554 | device_type: device_type |
| 2449 | 2555 | }); |
| 2450 | 2556 | } |
| 2557 | + var wpvrhotspotscene = wpvrhotspotscene' . $pano_suffix . '; | |
| 2451 | 2558 | '; |
| 2452 | - $html .= 'panoshow' . $id . '.on("scenechange", function (scene){ | |
| 2559 | + $html .= 'panoshow' . $pano_suffix . '.on("scenechange", function (scene){ | |
| 2453 | 2560 | jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 2454 | 2561 | active_scene = scene; |
| 2455 | 2562 | // if(localStorage.getItem("vr_mode") == "on") { |
| 2456 | 2563 | if(vr_mode == "on") { |
| 2457 | - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2458 | - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2564 | + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2565 | + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2459 | 2566 | } |
| 2460 | 2567 | }); |
| 2461 | 2568 | var compassBlock = ""; |
| 2462 | 2569 | var infoBlock = ""; |
| 2463 | - jQuery(document).on("click",".vr_mode_change' . $id . '",function (){ | |
| 2464 | - jQuery("#pano2' . $id . ' .pnlm-load-button").trigger("click"); | |
| 2465 | - jQuery("#pano' . $id . ' .pnlm-load-button").trigger("click"); | |
| 2570 | + jQuery(document).on("click",".vr_mode_change' . $pano_suffix . '",function (){ | |
| 2571 | + jQuery("#' . $panoid2 . ' .pnlm-load-button").trigger("click"); | |
| 2572 | + jQuery("#' . $panoid . ' .pnlm-load-button").trigger("click"); | |
| 2466 | 2573 | var getValue = jQuery(this).val(); |
| 2467 | 2574 | var getParent = jQuery(this).parent().parent(); |
| 2468 | - var compass = getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display"); | |
| 2469 | - var panoInfo = getParent.find("#pano' . $id . ' .pnlm-panorama-info").css("display"); | |
| 2575 | + var compass = getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display"); | |
| 2576 | + var panoInfo = getParent.find("#' . $panoid . ' .pnlm-panorama-info").css("display"); | |
| 2470 | 2577 | if(compass == "block"){ |
| 2471 | 2578 | compassBlock = "block"; |
| 2472 | 2579 | } |
| 2473 | 2580 | if(panoInfo == "block"){ |
| @@ -2482,79 +2589,79 @@ | ||
| 2482 | 2589 | // localStorage.setItem("vr_mode", "on"); |
| 2483 | 2590 | vr_mode = "on"; |
| 2484 | 2591 | jQuery(".vr-mode-title").show(); |
| 2485 | 2592 | jQuery(this).val("on"); |
| 2486 | - getParent.find("#pano2' . $id . '").css({ | |
| 2593 | + getParent.find("#' . $panoid2 . '").css({ | |
| 2487 | 2594 | "opacity": "1", |
| 2488 | 2595 | "visibility": "visible", |
| 2489 | 2596 | "position": "relative", |
| 2490 | 2597 | }); |
| 2491 | 2598 | gyroSwitch = true; |
| 2492 | - panoshow' . $id . '.startOrientation(); | |
| 2493 | - panoshow2' . $id . '.startOrientation(); | |
| 2494 | - panoshow2' . $id . '.setPitch(panoshow' . $id . '.getPitch(), 0); | |
| 2495 | - panoshow2' . $id . '.setYaw(panoshow' . $id . '.getYaw(), 0); | |
| 2599 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 2600 | + panoshow2' . $pano_suffix . '.startOrientation(); | |
| 2601 | + panoshow2' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch(), 0); | |
| 2602 | + panoshow2' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw(), 0); | |
| 2496 | 2603 | getParent.find(".pano-wrap").addClass("wpvr-cardboard-disable-event"); |
| 2497 | - getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").hide(); | |
| 2498 | - getParent.find("#pano' .$id. ' #controls'.$id.'").hide(); | |
| 2499 | - getParent.find("#pano' .$id. ' #explainer_button_'.$id. '").hide(); | |
| 2500 | - getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").hide(); | |
| 2501 | - getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").hide(); | |
| 2502 | - getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").hide(); | |
| 2503 | - getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide(); | |
| 2504 | - getParent.find("#pano' .$id. ' #adcontrol'.$id.'").hide(); | |
| 2505 | - getParent.find("#pano' .$id. ' .wpvr_slider_nav").hide(); | |
| 2506 | - getParent.find("#pano' .$id. ' #cp-logo-controls").hide(); | |
| 2507 | - getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").hide(); | |
| 2508 | - getParent.find("#pano2' . $id . ' .pnlm-controls-container").hide(); | |
| 2509 | - getParent.find("#pano' . $id . ' .pnlm-controls-container").hide(); | |
| 2510 | - getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2511 | - getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2512 | - getParent.find("#pano2' . $id . ' .pnlm-panorama-info").hide(); | |
| 2513 | - getParent.find("#pano' . $id . ' .pnlm-panorama-info").hide(); | |
| 2514 | - getParent.find("#pano' . $id . '").addClass("cardboard-half"); | |
| 2515 | - getParent.find("#center-pointer' . $id . '").show(); | |
| 2604 | + getParent.find("#' . $panoid . ' #zoom-in-out-controls' . $pano_suffix . '").hide(); | |
| 2605 | + getParent.find("#' . $panoid . ' #controls' . $pano_suffix . '").hide(); | |
| 2606 | + getParent.find("#' . $panoid . ' #explainer_button_' . $pano_suffix . '").hide(); | |
| 2607 | + getParent.find("#' . $panoid . ' #generic_form_button_' . $pano_suffix . '").hide(); | |
| 2608 | + getParent.find("#' . $panoid . ' #floor_map_button_' . $pano_suffix . '").hide(); | |
| 2609 | + getParent.find("#' . $panoid . ' #vrgcontrols' . $pano_suffix . '").hide(); | |
| 2610 | + getParent.find("#' . $panoid . ' #sccontrols' . $pano_suffix . '").hide(); | |
| 2611 | + getParent.find("#' . $panoid . ' #adcontrol' . $pano_suffix . '").hide(); | |
| 2612 | + getParent.find("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 2613 | + getParent.find("#' . $panoid . ' #cp-logo-controls").hide(); | |
| 2614 | + getParent.find("#' . $panoid . ' #wpvr-social-share-bg-box' . $pano_suffix . '").hide(); | |
| 2615 | + getParent.find("#' . $panoid2 . ' .pnlm-controls-container").hide(); | |
| 2616 | + getParent.find("#' . $panoid . ' .pnlm-controls-container").hide(); | |
| 2617 | + getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2618 | + getParent.find("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").hide(); | |
| 2619 | + getParent.find("#' . $panoid2 . ' .pnlm-panorama-info").hide(); | |
| 2620 | + getParent.find("#' . $panoid . ' .pnlm-panorama-info").hide(); | |
| 2621 | + getParent.find("#' . $panoid . '").addClass("cardboard-half"); | |
| 2622 | + getParent.find("#center-pointer' . $pano_suffix . '").show(); | |
| 2516 | 2623 | getParent.find(".fullscreen-button").hide(); |
| 2517 | - getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").hide(); | |
| 2624 | + getParent.find("#' . $panoid . ' #custom-scene-navigation' . $pano_suffix . '").hide(); | |
| 2518 | 2625 | if (window.DeviceOrientationEvent) { |
| 2519 | 2626 | window.addEventListener("deviceorientation", vrDeviseOrientation); |
| 2520 | 2627 | } |
| 2521 | - panoshow' . $id . '.on("zoomchange", function (data){ | |
| 2522 | - panoshow2' . $id . '.setHfov(data, 0); | |
| 2628 | + panoshow' . $pano_suffix . '.on("zoomchange", function (data){ | |
| 2629 | + panoshow2' . $pano_suffix . '.setHfov(data, 0); | |
| 2523 | 2630 | }); |
| 2524 | - panoshow2' . $id . '.on("zoomchange", function (data){ | |
| 2525 | - panoshow' . $id . '.setHfov(data, 0); | |
| 2631 | + panoshow2' . $pano_suffix . '.on("zoomchange", function (data){ | |
| 2632 | + panoshow' . $pano_suffix . '.setHfov(data, 0); | |
| 2526 | 2633 | }); |
| 2527 | - jQuery(document).on("click","#pano2' . $id . '",function(event) { | |
| 2528 | - panoshow' . $id . '.startOrientation(); | |
| 2529 | - panoshow2' . $id . '.startOrientation(); | |
| 2634 | + jQuery(document).on("click","#' . $panoid2 . '",function(event) { | |
| 2635 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 2636 | + panoshow2' . $pano_suffix . '.startOrientation(); | |
| 2530 | 2637 | }); |
| 2531 | - jQuery(document).on("click","#pano' . $id . '",function(event) { | |
| 2532 | - panoshow' . $id . '.startOrientation(); | |
| 2533 | - panoshow2' . $id . '.startOrientation(); | |
| 2638 | + jQuery(document).on("click","#' . $panoid . '",function(event) { | |
| 2639 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 2640 | + panoshow2' . $pano_suffix . '.startOrientation(); | |
| 2534 | 2641 | }); |
| 2535 | - panoshow' . $id . '.on("mousemove", function (data){ | |
| 2536 | - panoshow2' . $id . '.setPitch(data.pitch, 0); | |
| 2537 | - panoshow2' . $id . '.setYaw(data.yaw, 0); | |
| 2642 | + panoshow' . $pano_suffix . '.on("mousemove", function (data){ | |
| 2643 | + panoshow2' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2644 | + panoshow2' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2538 | 2645 | panoShowCardBoardOnTrigger(data); |
| 2539 | 2646 | }); |
| 2540 | - panoshow2' . $id . '.on("mousemove", function (data){ | |
| 2541 | - panoshow' . $id . '.setPitch(data.pitch, 0); | |
| 2542 | - panoshow' . $id . '.setYaw(data.yaw, 0); | |
| 2647 | + panoshow2' . $pano_suffix . '.on("mousemove", function (data){ | |
| 2648 | + panoshow' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2649 | + panoshow' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2543 | 2650 | panoShowCardBoardOnTrigger(data); |
| 2544 | 2651 | }); |
| 2545 | - panoshow' . $id . '.on("touchmove", function (data){ | |
| 2546 | - panoshow' . $id . '.stopOrientation(); | |
| 2547 | - panoshow2' . $id . '.stopOrientation(); | |
| 2548 | - panoshow2' . $id . '.setPitch(data.pitch, 0); | |
| 2549 | - panoshow2' . $id . '.setYaw(data.yaw, 0); | |
| 2652 | + panoshow' . $pano_suffix . '.on("touchmove", function (data){ | |
| 2653 | + panoshow' . $pano_suffix . '.stopOrientation(); | |
| 2654 | + panoshow2' . $pano_suffix . '.stopOrientation(); | |
| 2655 | + panoshow2' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2656 | + panoshow2' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2550 | 2657 | panoShowCardBoardOnTrigger(data); |
| 2551 | 2658 | }); |
| 2552 | - panoshow2' . $id . '.on("touchmove", function (data){ | |
| 2553 | - panoshow' . $id . '.stopOrientation(); | |
| 2554 | - panoshow2' . $id . '.stopOrientation(); | |
| 2555 | - panoshow' . $id . '.setPitch(data.pitch, 0); | |
| 2556 | - panoshow' . $id . '.setYaw(data.yaw, 0); | |
| 2659 | + panoshow2' . $pano_suffix . '.on("touchmove", function (data){ | |
| 2660 | + panoshow' . $pano_suffix . '.stopOrientation(); | |
| 2661 | + panoshow2' . $pano_suffix . '.stopOrientation(); | |
| 2662 | + panoshow' . $pano_suffix . '.setPitch(data.pitch, 0); | |
| 2663 | + panoshow' . $pano_suffix . '.setYaw(data.yaw, 0); | |
| 2557 | 2664 | panoShowCardBoardOnTrigger(data); |
| 2558 | 2665 | }); |
| 2559 | 2666 | } else if(getValue == "on") { |
| 2560 | 2667 | screen.orientation.unlock(); |
| @@ -2562,66 +2669,66 @@ | ||
| 2562 | 2669 | // localStorage.setItem("vr_mode", "off"); |
| 2563 | 2670 | vr_mode = "off"; |
| 2564 | 2671 | jQuery(".vr-mode-title").hide(); |
| 2565 | 2672 | jQuery(this).val("off"); |
| 2566 | - getParent.find("#pano2' . $id . '").css({ | |
| 2673 | + getParent.find("#' . $panoid2 . '").css({ | |
| 2567 | 2674 | "opacity": "0", |
| 2568 | 2675 | "visibility": "hidden", |
| 2569 | 2676 | "position": "absolute", |
| 2570 | 2677 | }); |
| 2571 | 2678 | getParent.find(".pano-wrap").removeClass("wpvr-cardboard-disable-event"); |
| 2572 | - getParent.find("#pano' .$id. ' #zoom-in-out-controls'.$id.'").show(); | |
| 2573 | - getParent.find("#pano' .$id. ' #controls'.$id.'").show(); | |
| 2574 | - getParent.find("#pano' .$id. ' #explainer_button_'.$id. '").show(); | |
| 2575 | - getParent.find("#pano' . $id . ' #generic_form_button_' . $id . '").show(); | |
| 2576 | - getParent.find("#pano' .$id. ' #floor_map_button_'.$id.'").show(); | |
| 2577 | - getParent.find("#pano2' . $id . ' .pnlm-controls-container").show(); | |
| 2578 | - getParent.find("#pano' . $id . ' .pnlm-controls-container").show(); | |
| 2579 | - getParent.find("#pano' .$id. ' #vrgcontrols'.$id.'").show(); | |
| 2580 | - getParent.find("#pano' .$id. ' #sccontrols'.$id.'").hide(); | |
| 2581 | - getParent.find("#pano' .$id. ' #adcontrol'.$id.'").show(); | |
| 2582 | - getParent.find("#pano' .$id. ' .wpvr_slider_nav").hide(); | |
| 2583 | - getParent.find("#pano' .$id. ' #cp-logo-controls").show(); | |
| 2584 | - getParent.find("#pano' .$id. ' #wpvr-social-share-bg-box'.$id.'").show(); | |
| 2585 | - getParent.find("#pano' . $id . ' #custom-scene-navigation' . $id . '").show(); | |
| 2679 | + getParent.find("#' . $panoid . ' #zoom-in-out-controls' . $pano_suffix . '").show(); | |
| 2680 | + getParent.find("#' . $panoid . ' #controls' . $pano_suffix . '").show(); | |
| 2681 | + getParent.find("#' . $panoid . ' #explainer_button_' . $pano_suffix . '").show(); | |
| 2682 | + getParent.find("#' . $panoid . ' #generic_form_button_' . $pano_suffix . '").show(); | |
| 2683 | + getParent.find("#' . $panoid . ' #floor_map_button_' . $pano_suffix . '").show(); | |
| 2684 | + getParent.find("#' . $panoid2 . ' .pnlm-controls-container").show(); | |
| 2685 | + getParent.find("#' . $panoid . ' .pnlm-controls-container").show(); | |
| 2686 | + getParent.find("#' . $panoid . ' #vrgcontrols' . $pano_suffix . '").show(); | |
| 2687 | + getParent.find("#' . $panoid . ' #sccontrols' . $pano_suffix . '").hide(); | |
| 2688 | + getParent.find("#' . $panoid . ' #adcontrol' . $pano_suffix . '").show(); | |
| 2689 | + getParent.find("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 2690 | + getParent.find("#' . $panoid . ' #cp-logo-controls").show(); | |
| 2691 | + getParent.find("#' . $panoid . ' #wpvr-social-share-bg-box' . $pano_suffix . '").show(); | |
| 2692 | + getParent.find("#' . $panoid . ' #custom-scene-navigation' . $pano_suffix . '").show(); | |
| 2586 | 2693 | if(compassBlock == "block"){ |
| 2587 | - getParent.find("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2588 | - getParent.find("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2694 | + getParent.find("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2695 | + getParent.find("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").show(); | |
| 2589 | 2696 | } |
| 2590 | 2697 | if(infoBlock == "block"){ |
| 2591 | - getParent.find("#pano2' . $id . ' .pnlm-panorama-info").show(); | |
| 2592 | - getParent.find("#pano' . $id . ' .pnlm-panorama-info").show(); | |
| 2698 | + getParent.find("#' . $panoid2 . ' .pnlm-panorama-info").show(); | |
| 2699 | + getParent.find("#' . $panoid . ' .pnlm-panorama-info").show(); | |
| 2593 | 2700 | } |
| 2594 | - getParent.find("#pano' . $id . '").removeClass("cardboard-half"); | |
| 2595 | - getParent.find("#center-pointer' . $id . '").hide(); | |
| 2701 | + getParent.find("#' . $panoid . '").removeClass("cardboard-half"); | |
| 2702 | + getParent.find("#center-pointer' . $pano_suffix . '").hide(); | |
| 2596 | 2703 | getParent.find(".fullscreen-button").hide(); |
| 2597 | - panoshow' . $id . '.off("mousemove"); | |
| 2598 | - panoshow' . $id . '.off("touchmove"); | |
| 2599 | - panoshow2' . $id . '.off("mousemove"); | |
| 2600 | - panoshow2' . $id . '.off("touchmove"); | |
| 2704 | + panoshow' . $pano_suffix . '.off("mousemove"); | |
| 2705 | + panoshow' . $pano_suffix . '.off("touchmove"); | |
| 2706 | + panoshow2' . $pano_suffix . '.off("mousemove"); | |
| 2707 | + panoshow2' . $pano_suffix . '.off("touchmove"); | |
| 2601 | 2708 | if (window.DeviceOrientationEvent) { |
| 2602 | 2709 | window.removeEventListener("deviceorientation", vrDeviseOrientation); |
| 2603 | 2710 | } |
| 2604 | 2711 | } |
| 2605 | 2712 | });'; |
| 2606 | - $html .= 'panoshow2' . $id . '.on("load", function (){ | |
| 2713 | + $html .= 'panoshow2' . $pano_suffix . '.on("load", function (){ | |
| 2607 | 2714 | // if(localStorage.getItem("vr_mode") == "off") { |
| 2608 | 2715 | if( vr_mode == "off") { |
| 2609 | 2716 | jQuery(".vr-mode-title").hide(); |
| 2610 | 2717 | } |
| 2611 | 2718 | else { |
| 2612 | - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2613 | - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2614 | - jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide(); | |
| 2615 | - jQuery("#pano' . $id . ' .pnlm-panorama-info").hide(); | |
| 2719 | + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2720 | + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2721 | + jQuery("#' . $panoid2 . ' .pnlm-panorama-info").hide(); | |
| 2722 | + jQuery("#' . $panoid . ' .pnlm-panorama-info").hide(); | |
| 2616 | 2723 | jQuery(".vr-mode-title").show(); |
| 2617 | 2724 | } |
| 2618 | 2725 | });'; |
| 2619 | 2726 | } |
| 2620 | 2727 | //=== end Dplicate mode only for vr mode===// |
| 2621 | - $html .= 'jQuery("#pano' . $id . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){ | |
| 2728 | + $html .= 'jQuery("#' . $panoid . ' .wpvr-floor-map .floor-plan-pointer").on("click",function(){ | |
| 2622 | 2729 | var scene_id = jQuery(this).attr("scene_id"); |
| 2623 | - panoshow' . $id . '.loadScene(scene_id) | |
| 2730 | + panoshow' . $pano_suffix . '.loadScene(scene_id) | |
| 2624 | 2731 | jQuery(".floor-plan-pointer").removeClass("add-pulse") |
| 2625 | 2732 | jQuery(this).addClass("add-pulse") |
| 2626 | 2733 | });'; |
| 2627 | 2734 | if ($scene_animation_enabled && is_plugin_active('wpvr-pro/wpvr-pro.php')) { |
| @@ -2631,9 +2738,9 @@ | ||
| 2631 | 2738 | $animationDelay = $postdata['sceneAnimationTransitionDelay'] ?? '0ms'; |
| 2632 | 2739 | $animation_js = apply_filters('wpvr_scene_animation_js', $id, $animation_type, $animationDuration, $animationDelay); |
| 2633 | 2740 | if (!empty($animation_js)) { |
| 2634 | 2741 | $html .= $animation_js; |
| 2635 | - $html .= 'panoshow' . $id . '.on("load", function (scene){ | |
| 2742 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (scene){ | |
| 2636 | 2743 | if (typeof changeScene === "function") { |
| 2637 | 2744 | changeScene(); |
| 2638 | 2745 | } else { |
| 2639 | 2746 | console.warn("changeScene function is not defined."); |
| @@ -2641,15 +2748,15 @@ | ||
| 2641 | 2748 | });'; |
| 2642 | 2749 | } |
| 2643 | 2750 | } |
| 2644 | 2751 | |
| 2645 | - $html .= 'panoshow' . $id . '.on("mousemove", function (data){ | |
| 2752 | + $html .= 'panoshow' . $pano_suffix . '.on("mousemove", function (data){ | |
| 2646 | 2753 | jQuery(".add-pulse").css({"transform":"rotate("+data.yaw+"deg)"}); |
| 2647 | 2754 | }); |
| 2648 | 2755 | '; |
| 2649 | 2756 | $status = get_option('wpvr_edd_license_status'); |
| 2650 | 2757 | if ($status !== false && 'valid' == $status && $is_pro){ |
| 2651 | - $html .= 'panoshow' . $id . '.on("scenechange", function (scene){ | |
| 2758 | + $html .= 'panoshow' . $pano_suffix . '.on("scenechange", function (scene){ | |
| 2652 | 2759 | jQuery(".center-pointer").removeClass("wpvr-pluse-effect") |
| 2653 | 2760 | jQuery(".floor-plan-pointer").each(function(index ,element){ |
| 2654 | 2761 | var scene_id = jQuery(this).attr("scene_id"); |
| 2655 | 2762 | if( active_scene == scene_id ){ |
| @@ -2657,9 +2764,9 @@ | ||
| 2657 | 2764 | jQuery(this).addClass("add-pulse") |
| 2658 | 2765 | } |
| 2659 | 2766 | }); |
| 2660 | 2767 | });'; |
| 2661 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 2768 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 2662 | 2769 | if(jQuery(".floor-plan-pointer").length > 0){ |
| 2663 | 2770 | jQuery(".floor-plan-pointer").each(function(index ,element){ |
| 2664 | 2771 | var scene_id = jQuery(this).attr("scene_id"); |
| 2665 | 2772 | if( active_scene == scene_id ){ |
| @@ -2671,14 +2778,14 @@ | ||
| 2671 | 2778 | });'; |
| 2672 | 2779 | } |
| 2673 | 2780 | if ($status !== false && 'valid' == $status && $is_pro){ |
| 2674 | 2781 | $scene_navigation_content_type = isset($postdata['scene_navigation_content_type']) ? $postdata['scene_navigation_content_type'] : 'scene_id'; |
| 2675 | - $html .= 'jQuery("#pano' . $id . ' .custom-scene-navigation").on("click", function() { | |
| 2676 | - jQuery("#custom-scene-navigation-nav' . $id . ' ul").empty(); | |
| 2782 | + $html .= 'jQuery("#' . $panoid . ' .custom-scene-navigation").on("click", function() { | |
| 2783 | + jQuery("#custom-scene-navigation-nav' . $pano_suffix . ' ul").empty(); | |
| 2677 | 2784 | if (scenes) { |
| 2678 | 2785 | var scene_navigation_content_type = "' . $scene_navigation_content_type . '"; |
| 2679 | 2786 | var sceneList = scenes.scenes; |
| 2680 | - var getScene = panoshow' . $id . '.getScene(); | |
| 2787 | + var getScene = panoshow' . $pano_suffix . '.getScene(); | |
| 2681 | 2788 | for (const key in sceneList) { |
| 2682 | 2789 | let title; |
| 2683 | 2790 | if (scene_navigation_content_type === "scene_title") { |
| 2684 | 2791 | if (sceneList[key].title) { |
| @@ -2697,9 +2804,9 @@ | ||
| 2697 | 2804 | } else { |
| 2698 | 2805 | title = key; |
| 2699 | 2806 | } |
| 2700 | 2807 | if (sceneList.hasOwnProperty(key)) { |
| 2701 | - let ulElement = document.querySelector("#custom-scene-navigation-nav' . $id . ' ul"); | |
| 2808 | + let ulElement = document.querySelector("#custom-scene-navigation-nav' . $pano_suffix . ' ul"); | |
| 2702 | 2809 | if (ulElement) { |
| 2703 | 2810 | let liElement = document.createElement("li"); |
| 2704 | 2811 | liElement.className = "scene-navigation-list" + (key === getScene ? " active" : ""); |
| 2705 | 2812 | liElement.setAttribute("scene_id", key); |
| @@ -2707,9 +2814,9 @@ | ||
| 2707 | 2814 | ulElement.appendChild(liElement); |
| 2708 | 2815 | } |
| 2709 | 2816 | } |
| 2710 | 2817 | } |
| 2711 | - jQuery("#custom-scene-navigation-nav' . $id . '").toggleClass("visible"); | |
| 2818 | + jQuery("#custom-scene-navigation-nav' . $pano_suffix . '").toggleClass("visible"); | |
| 2712 | 2819 | } |
| 2713 | 2820 | });'; |
| 2714 | 2821 | $html .='function getImageNameWithoutExtension(imageUrl) { |
| 2715 | 2822 | // Split the URL by "/" |
| @@ -2722,70 +2829,70 @@ | ||
| 2722 | 2829 | var imageNameWithoutExtension = imageNameParts.slice(0, -1).join("."); |
| 2723 | 2830 | // Return the image name without extension |
| 2724 | 2831 | return imageNameWithoutExtension; |
| 2725 | 2832 | }'; |
| 2726 | - $html .= 'jQuery("#pano' . $id . ' #custom-scene-navigation-nav' . $id . ' ul").on("click", "li.scene-navigation-list", function() { | |
| 2833 | + $html .= 'jQuery("#' . $panoid . ' #custom-scene-navigation-nav' . $pano_suffix . ' ul").on("click", "li.scene-navigation-list", function() { | |
| 2727 | 2834 | if (scenes) { |
| 2728 | 2835 | jQuery(this).siblings("li").removeClass("active"); |
| 2729 | 2836 | jQuery(this).addClass("active"); |
| 2730 | 2837 | var scene_key = jQuery(this).attr("scene_id"); |
| 2731 | - panoshow' . $id . '.loadScene(scene_key); | |
| 2838 | + panoshow' . $pano_suffix . '.loadScene(scene_key); | |
| 2732 | 2839 | } |
| 2733 | 2840 | });'; |
| 2734 | 2841 | } |
| 2735 | 2842 | $html .= 'const node = document.querySelector(".add-pulse"); |
| 2736 | - panoshow' . $id . '.on("compasschange", function (data){ | |
| 2843 | + panoshow' . $pano_suffix . '.on("compasschange", function (data){ | |
| 2737 | 2844 | // const node = document.querySelector(".add-pulse"); |
| 2738 | 2845 | // node.style.transform = data; |
| 2739 | 2846 | // jQuery(".add-pulse").css({"transform":data}); |
| 2740 | 2847 | });'; |
| 2741 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 2848 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 2742 | 2849 | // if(localStorage.getItem("vr_mode") == "off") { |
| 2743 | 2850 | if(vr_mode == "off") { |
| 2744 | 2851 | jQuery(".vr-mode-title").hide(); |
| 2745 | 2852 | } else { |
| 2746 | - jQuery("#pano2' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2747 | - jQuery("#pano' . $id . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2748 | - jQuery("#pano2' . $id . ' .pnlm-panorama-info").hide(); | |
| 2749 | - jQuery("#pano' . $id . ' .pnlm-panorama-info").hide(); | |
| 2853 | + jQuery("#' . $panoid2 . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2854 | + jQuery("#' . $panoid . ' .pnlm-compass.pnlm-controls.pnlm-control").css("display","none"); | |
| 2855 | + jQuery("#' . $panoid2 . ' .pnlm-panorama-info").hide(); | |
| 2856 | + jQuery("#' . $panoid . ' .pnlm-panorama-info").hide(); | |
| 2750 | 2857 | jQuery(".vr-mode-title").show(); |
| 2751 | 2858 | } |
| 2752 | 2859 | setTimeout(() => { |
| 2753 | 2860 | window.dispatchEvent(new Event("resize")); |
| 2754 | 2861 | }, 200); |
| 2755 | - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 2756 | - jQuery("#controls' . $id . '").css("bottom", "80px"); | |
| 2862 | + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 2863 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "80px"); | |
| 2757 | 2864 | } |
| 2758 | 2865 | else { |
| 2759 | - jQuery("#controls' . $id . '").css("bottom", "5px"); | |
| 2866 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px"); | |
| 2760 | 2867 | } |
| 2761 | 2868 | });'; |
| 2762 | - $html .= 'panoshow' . $id . '.on("render", function (){ | |
| 2869 | + $html .= 'panoshow' . $pano_suffix . '.on("render", function (){ | |
| 2763 | 2870 | window.dispatchEvent(new Event("resize")); |
| 2764 | 2871 | });'; |
| 2765 | 2872 | $html .= 'if (scenes.autoRotate) { |
| 2766 | - var wpvrAutoRotateTimer' . $id . ' = null; | |
| 2767 | - var wpvrAutoRotateStopDelay' . $id . ' = parseInt(scenes.autoRotateStopDelay, 10) || 0; | |
| 2768 | - var wpvrScheduleAutoRotate' . $id . ' = function () { | |
| 2769 | - clearTimeout(wpvrAutoRotateTimer' . $id . '); | |
| 2770 | - if (wpvrAutoRotateStopDelay' . $id . ' > 0) { | |
| 2771 | - wpvrAutoRotateTimer' . $id . ' = setTimeout(function () { | |
| 2772 | - panoshow' . $id . '.stopAutoRotate(); | |
| 2773 | - }, wpvrAutoRotateStopDelay' . $id . '); | |
| 2873 | + var wpvrAutoRotateTimer' . $pano_suffix . ' = null; | |
| 2874 | + var wpvrAutoRotateStopDelay' . $pano_suffix . ' = parseInt(scenes.autoRotateStopDelay, 10) || 0; | |
| 2875 | + var wpvrScheduleAutoRotate' . $pano_suffix . ' = function () { | |
| 2876 | + clearTimeout(wpvrAutoRotateTimer' . $pano_suffix . '); | |
| 2877 | + if (wpvrAutoRotateStopDelay' . $pano_suffix . ' > 0) { | |
| 2878 | + wpvrAutoRotateTimer' . $pano_suffix . ' = setTimeout(function () { | |
| 2879 | + panoshow' . $pano_suffix . '.stopAutoRotate(); | |
| 2880 | + }, wpvrAutoRotateStopDelay' . $pano_suffix . '); | |
| 2774 | 2881 | } else { |
| 2775 | - wpvrAutoRotateTimer' . $id . ' = setTimeout(function () { | |
| 2776 | - panoshow' . $id . '.startAutoRotate(scenes.autoRotate, 0); | |
| 2882 | + wpvrAutoRotateTimer' . $pano_suffix . ' = setTimeout(function () { | |
| 2883 | + panoshow' . $pano_suffix . '.startAutoRotate(scenes.autoRotate, 0); | |
| 2777 | 2884 | }, 3000); |
| 2778 | 2885 | } |
| 2779 | 2886 | }; |
| 2780 | - panoshow' . $id . '.on("load", wpvrScheduleAutoRotate' . $id . '); | |
| 2781 | - panoshow' . $id . '.on("scenechange", wpvrScheduleAutoRotate' . $id . '); | |
| 2887 | + panoshow' . $pano_suffix . '.on("load", wpvrScheduleAutoRotate' . $pano_suffix . '); | |
| 2888 | + panoshow' . $pano_suffix . '.on("scenechange", wpvrScheduleAutoRotate' . $pano_suffix . '); | |
| 2782 | 2889 | }'; |
| 2783 | 2890 | $html .= 'var touchtime = 0;'; |
| 2784 | 2891 | $html .= ' |
| 2785 | - var wpvrHotspotRoot' . $id . ' = document.getElementById("pano' . $id . '"); | |
| 2786 | - if (wpvrHotspotRoot' . $id . ') { | |
| 2787 | - wpvrHotspotRoot' . $id . '.addEventListener("click", function (event) { | |
| 2892 | + var wpvrHotspotRoot' . $pano_suffix . ' = document.getElementById("' . $panoid . '"); | |
| 2893 | + if (wpvrHotspotRoot' . $pano_suffix . ') { | |
| 2894 | + wpvrHotspotRoot' . $pano_suffix . '.addEventListener("click", function (event) { | |
| 2788 | 2895 | var hotspot = event.target.closest(".pnlm-hotspot-base"); |
| 2789 | 2896 | |
| 2790 | 2897 | if (!hotspot) { |
| 2791 | 2898 | return; |
| @@ -2816,11 +2923,11 @@ | ||
| 2816 | 2923 | if (isset($panodata["scene-list"])) { |
| 2817 | 2924 | foreach ($panodata["scene-list"] as $panoscenes) { |
| 2818 | 2925 | $scene_key = $panoscenes['scene-id']; |
| 2819 | 2926 | $gallery_scene_ids[] = (string) $scene_key; |
| 2820 | - $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $id; | |
| 2927 | + $scene_key_gallery = $panoscenes['scene-id'] . '_gallery_' . $pano_suffix; | |
| 2821 | 2928 | $html .= 'jQuery(document).on("click","#' . $scene_key_gallery . '",function() { |
| 2822 | - panoshow' . $id . '.loadScene("' . $scene_key . '"); | |
| 2929 | + panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $scene_key ) . '); | |
| 2823 | 2930 | });'; |
| 2824 | 2931 | } |
| 2825 | 2932 | } |
| 2826 | 2933 | |
| @@ -2848,22 +2955,22 @@ | ||
| 2848 | 2955 | stagePadding: 0 |
| 2849 | 2956 | }'; |
| 2850 | 2957 | |
| 2851 | 2958 | $html .= ' |
| 2852 | - var wpvrGallery' . $id . ' = jQuery("#sccontrols' . $id . '"); | |
| 2853 | - var wpvrGalleryRoot' . $id . ' = jQuery("#pano' . $id . '"); | |
| 2854 | - var wpvrGalleryScenes' . $id . ' = ' . wp_json_encode(array_values($gallery_scene_ids)) . '; | |
| 2855 | - var wpvrGalleryResizeTimer' . $id . '; | |
| 2856 | - var wpvrGalleryVisibilityTimer' . $id . '; | |
| 2857 | - var wpvrGalleryObserver' . $id . '; | |
| 2959 | + var wpvrGallery' . $pano_suffix . ' = jQuery("#sccontrols' . $pano_suffix . '"); | |
| 2960 | + var wpvrGalleryRoot' . $pano_suffix . ' = jQuery("#' . $panoid . '"); | |
| 2961 | + var wpvrGalleryScenes' . $pano_suffix . ' = ' . wp_json_encode(array_values($gallery_scene_ids)) . '; | |
| 2962 | + var wpvrGalleryResizeTimer' . $pano_suffix . '; | |
| 2963 | + var wpvrGalleryVisibilityTimer' . $pano_suffix . '; | |
| 2964 | + var wpvrGalleryObserver' . $pano_suffix . '; | |
| 2858 | 2965 | |
| 2859 | - function wpvrPrepareSceneNavigation' . $id . '() { | |
| 2860 | - var navigationDisabled = wpvrGalleryScenes' . $id . '.length < 2; | |
| 2861 | - var previousButtons = wpvrGalleryRoot' . $id . '.find(".wpvr_owl_prev"); | |
| 2862 | - var nextButtons = wpvrGalleryRoot' . $id . '.find(".wpvr_owl_next"); | |
| 2966 | + function wpvrPrepareSceneNavigation' . $pano_suffix . '() { | |
| 2967 | + var navigationDisabled = wpvrGalleryScenes' . $pano_suffix . '.length < 2; | |
| 2968 | + var previousButtons = wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_owl_prev"); | |
| 2969 | + var nextButtons = wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_owl_next"); | |
| 2863 | 2970 | |
| 2864 | - wpvrGallery' . $id . '.removeClass("owl-theme"); | |
| 2865 | - wpvrGalleryRoot' . $id . '.find(".wpvr_slider_nav").removeClass("owl-nav"); | |
| 2971 | + wpvrGallery' . $pano_suffix . '.removeClass("owl-theme"); | |
| 2972 | + wpvrGalleryRoot' . $pano_suffix . '.find(".wpvr_slider_nav").removeClass("owl-nav"); | |
| 2866 | 2973 | previousButtons |
| 2867 | 2974 | .removeClass("owl-prev") |
| 2868 | 2975 | .prop("disabled", navigationDisabled) |
| 2869 | 2976 | .toggleClass("disabled", navigationDisabled); |
| @@ -2872,76 +2979,76 @@ | ||
| 2872 | 2979 | .prop("disabled", navigationDisabled) |
| 2873 | 2980 | .toggleClass("disabled", navigationDisabled); |
| 2874 | 2981 | } |
| 2875 | 2982 | |
| 2876 | - function wpvrRefreshGallery' . $id . '() { | |
| 2877 | - wpvrPrepareSceneNavigation' . $id . '(); | |
| 2983 | + function wpvrRefreshGallery' . $pano_suffix . '() { | |
| 2984 | + wpvrPrepareSceneNavigation' . $pano_suffix . '(); | |
| 2878 | 2985 | |
| 2879 | - if (!wpvrGallery' . $id . '.length || !wpvrGallery' . $id . '.hasClass("owl-loaded") || !wpvrGallery' . $id . '.is(":visible")) { | |
| 2986 | + if (!wpvrGallery' . $pano_suffix . '.length || !wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded") || !wpvrGallery' . $pano_suffix . '.is(":visible")) { | |
| 2880 | 2987 | return; |
| 2881 | 2988 | } |
| 2882 | 2989 | |
| 2883 | - if (wpvrGallery' . $id . '.css("display") === "flex") { | |
| 2884 | - wpvrGallery' . $id . '.css("display", "block"); | |
| 2990 | + if (wpvrGallery' . $pano_suffix . '.css("display") === "flex") { | |
| 2991 | + wpvrGallery' . $pano_suffix . '.css("display", "block"); | |
| 2885 | 2992 | } |
| 2886 | - wpvrGallery' . $id . '.trigger("refresh.owl.carousel"); | |
| 2887 | - wpvrUpdateGalleryNavigation' . $id . '(panoshow' . $id . '.getScene()); | |
| 2993 | + wpvrGallery' . $pano_suffix . '.trigger("refresh.owl.carousel"); | |
| 2994 | + wpvrUpdateGalleryNavigation' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene()); | |
| 2888 | 2995 | } |
| 2889 | 2996 | |
| 2890 | - function wpvrGallerySceneIndex' . $id . '(sceneId) { | |
| 2891 | - return wpvrGalleryScenes' . $id . '.indexOf(String(sceneId)); | |
| 2997 | + function wpvrGallerySceneIndex' . $pano_suffix . '(sceneId) { | |
| 2998 | + return wpvrGalleryScenes' . $pano_suffix . '.indexOf(String(sceneId)); | |
| 2892 | 2999 | } |
| 2893 | 3000 | |
| 2894 | - function wpvrUpdateGalleryNavigation' . $id . '(sceneId) { | |
| 2895 | - var currentIndex = wpvrGallerySceneIndex' . $id . '(sceneId); | |
| 2896 | - var activeThumbnailId = String(sceneId) + "_gallery_' . $id . '"; | |
| 2897 | - var thumbnails = wpvrGallery' . $id . '.find("img.scctrl"); | |
| 3001 | + function wpvrUpdateGalleryNavigation' . $pano_suffix . '(sceneId) { | |
| 3002 | + var currentIndex = wpvrGallerySceneIndex' . $pano_suffix . '(sceneId); | |
| 3003 | + var activeThumbnailId = String(sceneId) + "_gallery_' . $pano_suffix . '"; | |
| 3004 | + var thumbnails = wpvrGallery' . $pano_suffix . '.find("img.scctrl"); | |
| 2898 | 3005 | var activeThumbnail = thumbnails.filter(function () { |
| 2899 | 3006 | return this.id === activeThumbnailId; |
| 2900 | 3007 | }); |
| 2901 | 3008 | |
| 2902 | - wpvrPrepareSceneNavigation' . $id . '(); | |
| 3009 | + wpvrPrepareSceneNavigation' . $pano_suffix . '(); | |
| 2903 | 3010 | thumbnails.removeClass("wpvr-active-thumbnail"); |
| 2904 | - wpvrGallery' . $id . '.find(".owl-item").removeClass("clicked"); | |
| 3011 | + wpvrGallery' . $pano_suffix . '.find(".owl-item").removeClass("clicked"); | |
| 2905 | 3012 | activeThumbnail.addClass("wpvr-active-thumbnail"); |
| 2906 | 3013 | activeThumbnail.closest(".owl-item").addClass("clicked"); |
| 2907 | 3014 | |
| 2908 | 3015 | if (currentIndex >= 0) { |
| 2909 | - if (wpvrGallery' . $id . '.hasClass("owl-loaded")) { | |
| 2910 | - wpvrGallery' . $id . '.trigger("to.owl.carousel", [currentIndex, 300, true]); | |
| 2911 | - window.setTimeout(wpvrPrepareSceneNavigation' . $id . ', 0); | |
| 3016 | + if (wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded")) { | |
| 3017 | + wpvrGallery' . $pano_suffix . '.trigger("to.owl.carousel", [currentIndex, 300, true]); | |
| 3018 | + window.setTimeout(wpvrPrepareSceneNavigation' . $pano_suffix . ', 0); | |
| 2912 | 3019 | } |
| 2913 | 3020 | } |
| 2914 | 3021 | } |
| 2915 | 3022 | |
| 2916 | - function wpvrLoadAdjacentGalleryScene' . $id . '(direction) { | |
| 2917 | - var currentIndex = wpvrGallerySceneIndex' . $id . '(panoshow' . $id . '.getScene()); | |
| 3023 | + function wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(direction) { | |
| 3024 | + var currentIndex = wpvrGallerySceneIndex' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene()); | |
| 2918 | 3025 | |
| 2919 | - if (currentIndex < 0 || wpvrGalleryScenes' . $id . '.length < 2) { | |
| 3026 | + if (currentIndex < 0 || wpvrGalleryScenes' . $pano_suffix . '.length < 2) { | |
| 2920 | 3027 | return; |
| 2921 | 3028 | } |
| 2922 | 3029 | |
| 2923 | - var targetIndex = (currentIndex + direction + wpvrGalleryScenes' . $id . '.length) % wpvrGalleryScenes' . $id . '.length; | |
| 2924 | - panoshow' . $id . '.loadScene(wpvrGalleryScenes' . $id . '[targetIndex]); | |
| 3030 | + var targetIndex = (currentIndex + direction + wpvrGalleryScenes' . $pano_suffix . '.length) % wpvrGalleryScenes' . $pano_suffix . '.length; | |
| 3031 | + panoshow' . $pano_suffix . '.loadScene(wpvrGalleryScenes' . $pano_suffix . '[targetIndex]); | |
| 2925 | 3032 | } |
| 2926 | 3033 | |
| 2927 | 3034 | if (jQuery.fn.owlCarousel) { |
| 2928 | - if (wpvrGallery' . $id . '.length) { | |
| 2929 | - if (!wpvrGallery' . $id . '.hasClass("owl-loaded")) { | |
| 2930 | - wpvrGallery' . $id . '.owlCarousel(' . $gallery_options . '); | |
| 3035 | + if (wpvrGallery' . $pano_suffix . '.length) { | |
| 3036 | + if (!wpvrGallery' . $pano_suffix . '.hasClass("owl-loaded")) { | |
| 3037 | + wpvrGallery' . $pano_suffix . '.owlCarousel(' . $gallery_options . '); | |
| 2931 | 3038 | } |
| 2932 | 3039 | } |
| 2933 | 3040 | } |
| 2934 | 3041 | |
| 2935 | - wpvrGalleryRoot' . $id . ' | |
| 2936 | - .off("click.wpvrGalleryRefresh' . $id . '", "#vrgcontrols' . $id . '") | |
| 2937 | - .on("click.wpvrGalleryRefresh' . $id . '", "#vrgcontrols' . $id . '", function () { | |
| 2938 | - wpvrPrepareSceneNavigation' . $id . '(); | |
| 2939 | - window.setTimeout(wpvrRefreshGallery' . $id . ', 450); | |
| 3042 | + wpvrGalleryRoot' . $pano_suffix . ' | |
| 3043 | + .off("click.wpvrGalleryRefresh' . $pano_suffix . '", "#vrgcontrols' . $pano_suffix . '") | |
| 3044 | + .on("click.wpvrGalleryRefresh' . $pano_suffix . '", "#vrgcontrols' . $pano_suffix . '", function () { | |
| 3045 | + wpvrPrepareSceneNavigation' . $pano_suffix . '(); | |
| 3046 | + window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 450); | |
| 2940 | 3047 | }); |
| 2941 | 3048 | |
| 2942 | - if (wpvrGalleryRoot' . $id . '.length) { | |
| 2943 | - wpvrGalleryRoot' . $id . '[0].addEventListener("click", function (event) { | |
| 3049 | + if (wpvrGalleryRoot' . $pano_suffix . '.length) { | |
| 3050 | + wpvrGalleryRoot' . $pano_suffix . '[0].addEventListener("click", function (event) { | |
| 2944 | 3051 | var navigationButton = event.target.closest(".wpvr_owl_prev, .wpvr_owl_next"); |
| 2945 | 3052 | |
| 2946 | 3053 | if (!navigationButton) { |
| 2947 | 3054 | return; |
| @@ -2946,9 +3053,9 @@ | ||
| 2946 | 3053 | if (!navigationButton) { |
| 2947 | 3054 | return; |
| 2948 | 3055 | } |
| 2949 | 3056 | |
| 2950 | - if (!wpvrGalleryRoot' . $id . '[0].contains(navigationButton)) { | |
| 3057 | + if (!wpvrGalleryRoot' . $pano_suffix . '[0].contains(navigationButton)) { | |
| 2951 | 3058 | return; |
| 2952 | 3059 | } |
| 2953 | 3060 | |
| 2954 | 3061 | event.preventDefault(); |
| @@ -2954,29 +3061,29 @@ | ||
| 2954 | 3061 | event.preventDefault(); |
| 2955 | 3062 | event.stopImmediatePropagation(); |
| 2956 | 3063 | |
| 2957 | 3064 | if (navigationButton.classList.contains("wpvr_owl_prev")) { |
| 2958 | - wpvrLoadAdjacentGalleryScene' . $id . '(-1); | |
| 3065 | + wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(-1); | |
| 2959 | 3066 | } else { |
| 2960 | - wpvrLoadAdjacentGalleryScene' . $id . '(1); | |
| 3067 | + wpvrLoadAdjacentGalleryScene' . $pano_suffix . '(1); | |
| 2961 | 3068 | } |
| 2962 | 3069 | }, true); |
| 2963 | 3070 | } |
| 2964 | 3071 | |
| 2965 | 3072 | jQuery(window) |
| 2966 | - .off("resize.wpvrGallery' . $id . '") | |
| 2967 | - .on("resize.wpvrGallery' . $id . '", function () { | |
| 2968 | - window.clearTimeout(wpvrGalleryResizeTimer' . $id . '); | |
| 2969 | - wpvrGalleryResizeTimer' . $id . ' = window.setTimeout(wpvrRefreshGallery' . $id . ', 100); | |
| 3073 | + .off("resize.wpvrGallery' . $pano_suffix . '") | |
| 3074 | + .on("resize.wpvrGallery' . $pano_suffix . '", function () { | |
| 3075 | + window.clearTimeout(wpvrGalleryResizeTimer' . $pano_suffix . '); | |
| 3076 | + wpvrGalleryResizeTimer' . $pano_suffix . ' = window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 100); | |
| 2970 | 3077 | }); |
| 2971 | 3078 | |
| 2972 | 3079 | if (window.MutationObserver) { |
| 2973 | - if (wpvrGallery' . $id . '.length) { | |
| 2974 | - wpvrGalleryObserver' . $id . ' = new MutationObserver(function () { | |
| 2975 | - window.clearTimeout(wpvrGalleryVisibilityTimer' . $id . '); | |
| 2976 | - wpvrGalleryVisibilityTimer' . $id . ' = window.setTimeout(wpvrRefreshGallery' . $id . ', 50); | |
| 3080 | + if (wpvrGallery' . $pano_suffix . '.length) { | |
| 3081 | + wpvrGalleryObserver' . $pano_suffix . ' = new MutationObserver(function () { | |
| 3082 | + window.clearTimeout(wpvrGalleryVisibilityTimer' . $pano_suffix . '); | |
| 3083 | + wpvrGalleryVisibilityTimer' . $pano_suffix . ' = window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 50); | |
| 2977 | 3084 | }); |
| 2978 | - wpvrGalleryObserver' . $id . '.observe(wpvrGallery' . $id . '[0], { | |
| 3085 | + wpvrGalleryObserver' . $pano_suffix . '.observe(wpvrGallery' . $pano_suffix . '[0], { | |
| 2979 | 3086 | attributes: true, |
| 2980 | 3087 | attributeFilter: ["style"] |
| 2981 | 3088 | }); |
| 2982 | 3089 | } |
| @@ -2981,15 +3088,15 @@ | ||
| 2981 | 3088 | }); |
| 2982 | 3089 | } |
| 2983 | 3090 | } |
| 2984 | 3091 | |
| 2985 | - panoshow' . $id . '.on("scenechange", function (sceneId) { | |
| 2986 | - wpvrUpdateGalleryNavigation' . $id . '(sceneId); | |
| 3092 | + panoshow' . $pano_suffix . '.on("scenechange", function (sceneId) { | |
| 3093 | + wpvrUpdateGalleryNavigation' . $pano_suffix . '(sceneId); | |
| 2987 | 3094 | }); |
| 2988 | 3095 | |
| 2989 | - window.setTimeout(wpvrRefreshGallery' . $id . ', 0); | |
| 3096 | + window.setTimeout(wpvrRefreshGallery' . $pano_suffix . ', 0); | |
| 2990 | 3097 | window.setTimeout(function () { |
| 2991 | - wpvrUpdateGalleryNavigation' . $id . '(panoshow' . $id . '.getScene()); | |
| 3098 | + wpvrUpdateGalleryNavigation' . $pano_suffix . '(panoshow' . $pano_suffix . '.getScene()); | |
| 2992 | 3099 | }, 0); |
| 2993 | 3100 | '; |
| 2994 | 3101 | } |
| 2995 | 3102 | //===Custom Control===// |
| @@ -2994,44 +3101,44 @@ | ||
| 2994 | 3101 | } |
| 2995 | 3102 | //===Custom Control===// |
| 2996 | 3103 | if (isset($custom_control)) { |
| 2997 | 3104 | if ($custom_control['panupSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 2998 | - $html .= 'document.getElementById("pan-up' . $id . '").addEventListener("click", function(e) {'; | |
| 2999 | - $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() + 10);'; | |
| 3105 | + $html .= 'document.getElementById("pan-up' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3106 | + $html .= 'panoshow' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch() + 10);'; | |
| 3000 | 3107 | $html .= '});'; |
| 3001 | 3108 | } |
| 3002 | 3109 | if ($custom_control['panDownSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3003 | - $html .= 'document.getElementById("pan-down' . $id . '").addEventListener("click", function(e) {'; | |
| 3004 | - $html .= 'panoshow' . $id . '.setPitch(panoshow' . $id . '.getPitch() - 10);'; | |
| 3110 | + $html .= 'document.getElementById("pan-down' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3111 | + $html .= 'panoshow' . $pano_suffix . '.setPitch(panoshow' . $pano_suffix . '.getPitch() - 10);'; | |
| 3005 | 3112 | $html .= '});'; |
| 3006 | 3113 | } |
| 3007 | 3114 | if ($custom_control['panLeftSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3008 | - $html .= 'document.getElementById("pan-left' . $id . '").addEventListener("click", function(e) {'; | |
| 3009 | - $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() - 10);'; | |
| 3115 | + $html .= 'document.getElementById("pan-left' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3116 | + $html .= 'panoshow' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw() - 10);'; | |
| 3010 | 3117 | $html .= '});'; |
| 3011 | 3118 | } |
| 3012 | 3119 | if ($custom_control['panRightSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3013 | - $html .= 'document.getElementById("pan-right' . $id . '").addEventListener("click", function(e) {'; | |
| 3014 | - $html .= 'panoshow' . $id . '.setYaw(panoshow' . $id . '.getYaw() + 10);'; | |
| 3120 | + $html .= 'document.getElementById("pan-right' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3121 | + $html .= 'panoshow' . $pano_suffix . '.setYaw(panoshow' . $pano_suffix . '.getYaw() + 10);'; | |
| 3015 | 3122 | $html .= '});'; |
| 3016 | 3123 | } |
| 3017 | 3124 | if ($custom_control['panZoomInSwitch'] == "on") { |
| 3018 | - $html .= 'document.getElementById("zoom-in' . $id . '").addEventListener("click", function(e) {'; | |
| 3019 | - $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() - 10);'; | |
| 3125 | + $html .= 'document.getElementById("zoom-in' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3126 | + $html .= 'panoshow' . $pano_suffix . '.setHfov(panoshow' . $pano_suffix . '.getHfov() - 10);'; | |
| 3020 | 3127 | $html .= '});'; |
| 3021 | 3128 | } |
| 3022 | 3129 | if ($custom_control['panZoomOutSwitch'] == "on") { |
| 3023 | - $html .= 'document.getElementById("zoom-out' . $id . '").addEventListener("click", function(e) {'; | |
| 3024 | - $html .= 'panoshow' . $id . '.setHfov(panoshow' . $id . '.getHfov() + 10);'; | |
| 3130 | + $html .= 'document.getElementById("zoom-out' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3131 | + $html .= 'panoshow' . $pano_suffix . '.setHfov(panoshow' . $pano_suffix . '.getHfov() + 10);'; | |
| 3025 | 3132 | $html .= '});'; |
| 3026 | 3133 | } |
| 3027 | 3134 | if ($custom_control['panFullscreenSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3028 | - $html .= 'document.getElementById("fullscreen' . $id . '").addEventListener("click", function(e) {'; | |
| 3029 | - $html .= 'panoshow' . $id . '.toggleFullscreen();'; | |
| 3135 | + $html .= 'document.getElementById("fullscreen' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3136 | + $html .= 'panoshow' . $pano_suffix . '.toggleFullscreen();'; | |
| 3030 | 3137 | $html .= '});'; |
| 3031 | 3138 | $html .= '(function() {'; |
| 3032 | - $html .= 'function wpvrFsChange' . $id . '() {'; | |
| 3033 | - $html .= 'var fsIcon = document.querySelector("#fullscreen' . $id . ' i");'; | |
| 3139 | + $html .= 'function wpvrFsChange' . $pano_suffix . '() {'; | |
| 3140 | + $html .= 'var fsIcon = document.querySelector("#fullscreen' . $pano_suffix . ' i");'; | |
| 3034 | 3141 | $html .= 'if (!fsIcon) return;'; |
| 3035 | 3142 | $html .= 'if (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement) {'; |
| 3036 | 3143 | $html .= 'fsIcon.classList.remove("fa-expand"); fsIcon.classList.add("fa-minimize");'; |
| 3037 | 3144 | $html .= '} else {'; |
| @@ -3037,23 +3144,23 @@ | ||
| 3037 | 3144 | $html .= '} else {'; |
| 3038 | 3145 | $html .= 'fsIcon.classList.remove("fa-minimize"); fsIcon.classList.add("fa-expand");'; |
| 3039 | 3146 | $html .= '}'; |
| 3040 | 3147 | $html .= '}'; |
| 3041 | - $html .= 'document.addEventListener("fullscreenchange", wpvrFsChange' . $id . ');'; | |
| 3042 | - $html .= 'document.addEventListener("webkitfullscreenchange", wpvrFsChange' . $id . ');'; | |
| 3043 | - $html .= 'document.addEventListener("mozfullscreenchange", wpvrFsChange' . $id . ');'; | |
| 3044 | - $html .= 'document.addEventListener("MSFullscreenChange", wpvrFsChange' . $id . ');'; | |
| 3148 | + $html .= 'document.addEventListener("fullscreenchange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3149 | + $html .= 'document.addEventListener("webkitfullscreenchange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3150 | + $html .= 'document.addEventListener("mozfullscreenchange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3151 | + $html .= 'document.addEventListener("MSFullscreenChange", wpvrFsChange' . $pano_suffix . ');'; | |
| 3045 | 3152 | $html .= '})();'; |
| 3046 | 3153 | } |
| 3047 | 3154 | if ($custom_control['backToHomeSwitch'] == "on" && 'valid' == $status && $is_pro) { |
| 3048 | - $html .= 'document.getElementById("backToHome' . $id . '").addEventListener("click", function(e) {'; | |
| 3049 | - $html .= 'panoshow' . $id . '.loadScene("' . $default_scene . '");'; | |
| 3155 | + $html .= 'document.getElementById("backToHome' . $pano_suffix . '").addEventListener("click", function(e) {'; | |
| 3156 | + $html .= 'panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $default_scene ) . ');'; | |
| 3050 | 3157 | $html .= '});'; |
| 3051 | 3158 | } |
| 3052 | 3159 | if ($gyro_button_enabled && 'valid' == $status && $is_pro) { |
| 3053 | 3160 | $html .= ' |
| 3054 | 3161 | (function() { |
| 3055 | - var gyroButton = document.getElementById("gyroscope' . $id . '"); | |
| 3162 | + var gyroButton = document.getElementById("gyroscope' . $pano_suffix . '"); | |
| 3056 | 3163 | var gyroIcon = gyroButton ? gyroButton.querySelector("i") : null; |
| 3057 | 3164 | var activeColor = ' . wp_json_encode($custom_control['gyroscopeColor']) . '; |
| 3058 | 3165 | var permissionGranted = false; |
| 3059 | 3166 | |
| @@ -3061,20 +3168,20 @@ | ||
| 3061 | 3168 | return; |
| 3062 | 3169 | } |
| 3063 | 3170 | |
| 3064 | 3171 | function updateGyroscopeState() { |
| 3065 | - gyroIcon.style.color = panoshow' . $id . '.isOrientationActive() | |
| 3172 | + gyroIcon.style.color = panoshow' . $pano_suffix . '.isOrientationActive() | |
| 3066 | 3173 | ? activeColor |
| 3067 | 3174 | : "red"; |
| 3068 | 3175 | } |
| 3069 | 3176 | |
| 3070 | 3177 | function startGyroscope() { |
| 3071 | - if (!panoshow' . $id . '.isOrientationSupported()) { | |
| 3178 | + if (!panoshow' . $pano_suffix . '.isOrientationSupported()) { | |
| 3072 | 3179 | updateGyroscopeState(); |
| 3073 | 3180 | return; |
| 3074 | 3181 | } |
| 3075 | 3182 | |
| 3076 | - panoshow' . $id . '.startOrientation(); | |
| 3183 | + panoshow' . $pano_suffix . '.startOrientation(); | |
| 3077 | 3184 | window.setTimeout(updateGyroscopeState, 0); |
| 3078 | 3185 | } |
| 3079 | 3186 | |
| 3080 | 3187 | function requestGyroscopePermission() { |
| @@ -3099,14 +3206,14 @@ | ||
| 3099 | 3206 | |
| 3100 | 3207 | startGyroscope(); |
| 3101 | 3208 | } |
| 3102 | 3209 | |
| 3103 | - panoshow' . $id . '.on("load", updateGyroscopeState); | |
| 3104 | - panoshow' . $id . '.on("scenechange", updateGyroscopeState); | |
| 3210 | + panoshow' . $pano_suffix . '.on("load", updateGyroscopeState); | |
| 3211 | + panoshow' . $pano_suffix . '.on("scenechange", updateGyroscopeState); | |
| 3105 | 3212 | |
| 3106 | 3213 | gyroButton.addEventListener("click", function() { |
| 3107 | - if (panoshow' . $id . '.isOrientationActive()) { | |
| 3108 | - panoshow' . $id . '.stopOrientation(); | |
| 3214 | + if (panoshow' . $pano_suffix . '.isOrientationActive()) { | |
| 3215 | + panoshow' . $pano_suffix . '.stopOrientation(); | |
| 3109 | 3216 | updateGyroscopeState(); |
| 3110 | 3217 | return; |
| 3111 | 3218 | } |
| 3112 | 3219 | |
| @@ -3121,15 +3228,15 @@ | ||
| 3121 | 3228 | |
| 3122 | 3229 | //===Explainer Script===// |
| 3123 | 3230 | |
| 3124 | 3231 | if ($autoplay_bg_music == 'on') { |
| 3125 | - $html .= 'jQuery(document).on("click","#explainer_button_' . $id . '",function() { | |
| 3126 | - jQuery("#explainer' . $id . '").slideToggle(); | |
| 3127 | - playing' . $id . ' = false; | |
| 3128 | - var x' . $id . ' = document.getElementById("vrAudio' . $id . '"); | |
| 3129 | - jQuery("#vr-volume' . $id . '").removeClass("fas fa-volume-up"); | |
| 3130 | - jQuery("#vr-volume' . $id . '").addClass("fas fa-volume-mute"); | |
| 3131 | - x' . $id . '.pause(); | |
| 3232 | + $html .= 'jQuery(document).on("click","#explainer_button_' . $pano_suffix . '",function() { | |
| 3233 | + jQuery("#explainer' . $pano_suffix . '").slideToggle(); | |
| 3234 | + playing' . $pano_suffix . ' = false; | |
| 3235 | + var x' . $pano_suffix . ' = document.getElementById("vrAudio' . $pano_suffix . '"); | |
| 3236 | + jQuery("#vr-volume' . $pano_suffix . '").removeClass("fas fa-volume-up"); | |
| 3237 | + jQuery("#vr-volume' . $pano_suffix . '").addClass("fas fa-volume-mute"); | |
| 3238 | + x' . $pano_suffix . '.pause(); | |
| 3132 | 3239 | }); |
| 3133 | 3240 | jQuery(document).on("click",".close-explainer-video",function() { |
| 3134 | 3241 | jQuery(this).parent(".explainer").hide(); |
| 3135 | 3242 | var el_src = jQuery(".vr-iframe").attr("src"); |
| @@ -3135,11 +3242,11 @@ | ||
| 3135 | 3242 | var el_src = jQuery(".vr-iframe").attr("src"); |
| 3136 | 3243 | jQuery(".vr-iframe").attr("src", el_src); |
| 3137 | 3244 | });'; |
| 3138 | 3245 | } else { |
| 3139 | - $html .= 'jQuery(document).on("click","#explainer_button_' . $id . '",function() { | |
| 3140 | - jQuery("#explainer' . $id . '").slideToggle(function(){ | |
| 3141 | - var $explainerVideoId = jQuery("#explainer' . $id . '"); | |
| 3246 | + $html .= 'jQuery(document).on("click","#explainer_button_' . $pano_suffix . '",function() { | |
| 3247 | + jQuery("#explainer' . $pano_suffix . '").slideToggle(function(){ | |
| 3248 | + var $explainerVideoId = jQuery("#explainer' . $pano_suffix . '"); | |
| 3142 | 3249 | var $explainerVideoIframe = $explainerVideoId.find("iframe"); |
| 3143 | 3250 | var explainerVideoIframSrc = $explainerVideoIframe.attr("src"); |
| 3144 | 3251 | $explainerVideoIframe.attr("src", ""); |
| 3145 | 3252 | $explainerVideoIframe.attr("src", explainerVideoIframSrc); |
| @@ -3155,12 +3262,16 @@ | ||
| 3155 | 3262 | });'; |
| 3156 | 3263 | } |
| 3157 | 3264 | |
| 3158 | 3265 | $html .= ' |
| 3159 | - jQuery(document).on("click","#pano' . $id . '",function(event) { | |
| 3266 | + jQuery(document).on("click","#' . $panoid . '",function(event) { | |
| 3267 | + var isCross = event.target.closest(".cross"); | |
| 3160 | 3268 | var isActiveModal = event.target.closest(".custom-ifram-wrapper"); |
| 3161 | - var isForm = event.target.closest(".wpvr-hotspot-tweak-contents"); | |
| 3269 | + var isForm = event.target.closest(".wpvr-hotspot-tweak-contents-wrapper"); | |
| 3162 | 3270 | var isHotspot = event.target.closest(".pnlm-hotspot-base"); |
| 3271 | + if(isCross != null){ | |
| 3272 | + return; | |
| 3273 | + } | |
| 3163 | 3274 | if(isForm != null){ |
| 3164 | 3275 | jQuery(this).addClass("show-modal"); |
| 3165 | 3276 | }else if(isActiveModal == null){ |
| 3166 | 3277 | if(isHotspot == null){ |
| @@ -3166,9 +3277,9 @@ | ||
| 3166 | 3277 | if(isHotspot == null){ |
| 3167 | 3278 | jQuery(".custom-ifram-wrapper .custom-ifram").empty(); |
| 3168 | 3279 | jQuery(".custom-ifram-wrapper").hide(); |
| 3169 | 3280 | jQuery(this).removeClass("show-modal"); |
| 3170 | - jQuery(".wpvr-hotspot-tweak-contents-wrapper").hide("show-modal"); | |
| 3281 | + jQuery(".wpvr-hotspot-tweak-contents-wrapper").hide(); | |
| 3171 | 3282 | } |
| 3172 | 3283 | } |
| 3173 | 3284 | });'; |
| 3174 | 3285 | |
| @@ -3176,10 +3287,10 @@ | ||
| 3176 | 3287 | |
| 3177 | 3288 | //===generic form script===// |
| 3178 | 3289 | if (isset($postdata["genericform"]) && $postdata["genericform"] === 'on') { |
| 3179 | 3290 | $html .= ' |
| 3180 | - jQuery(document).on("click","#generic_form_button_' . $id . '",function() { | |
| 3181 | - jQuery("#wpvr-generic-form' . $id . '").fadeToggle(); | |
| 3291 | + jQuery(document).on("click","#generic_form_button_' . $pano_suffix . '",function() { | |
| 3292 | + jQuery("#wpvr-generic-form' . $pano_suffix . '").fadeToggle(); | |
| 3182 | 3293 | }); |
| 3183 | 3294 | |
| 3184 | 3295 | jQuery(document).on("click",".close-generic-form",function() { |
| 3185 | 3296 | jQuery(this).parent(".wpvr-generic-form").fadeOut() |
| @@ -3188,12 +3299,12 @@ | ||
| 3188 | 3299 | } |
| 3189 | 3300 | //===generic from script===// |
| 3190 | 3301 | |
| 3191 | 3302 | //===Floor map Script===// |
| 3192 | - $html .= 'jQuery(document).on("click","#floor_map_button_' . $id . '",function() { | |
| 3193 | - jQuery("#wpvr-floor-map' . $id . '").toggle().removeClass("fullwindow"); | |
| 3303 | + $html .= 'jQuery(document).on("click","#floor_map_button_' . $pano_suffix . '",function() { | |
| 3304 | + jQuery("#wpvr-floor-map' . $pano_suffix . '").toggle().removeClass("fullwindow"); | |
| 3194 | 3305 | }); |
| 3195 | - jQuery(document).on("dblclick","#wpvr-floor-map' . $id . '",function(){ | |
| 3306 | + jQuery(document).on("dblclick","#wpvr-floor-map' . $pano_suffix . '",function(){ | |
| 3196 | 3307 | jQuery(this).addClass("fullwindow"); |
| 3197 | 3308 | jQuery(this).parents(".pano-wrap").addClass("show-modal"); |
| 3198 | 3309 | }); |
| 3199 | 3310 | jQuery(document).on("click",".close-floor-map-plan",function() { |
| @@ -3206,24 +3317,24 @@ | ||
| 3206 | 3317 | if ($vrgallery_display) { |
| 3207 | 3318 | |
| 3208 | 3319 | if (!$autoload) { |
| 3209 | 3320 | $html .= 'jQuery(document).ready(function($){ |
| 3210 | - jQuery("#sccontrols' . $id . '").hide(); | |
| 3211 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3212 | - jQuery("#sccontrols' . $id . '").hide(); | |
| 3213 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").hide(); | |
| 3321 | + jQuery("#sccontrols' . $pano_suffix . '").hide(); | |
| 3322 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3323 | + jQuery("#sccontrols' . $pano_suffix . '").hide(); | |
| 3324 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 3214 | 3325 | });'; |
| 3215 | - $html .= 'var slide' . $id . ' = "down"; | |
| 3216 | - jQuery(document).on("click","#vrgcontrols' . $id . '",function() { | |
| 3217 | - if (slide' . $id . ' == "up") { | |
| 3218 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3219 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3220 | - slide' . $id . ' = "down"; | |
| 3221 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3222 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3326 | + $html .= 'var slide' . $pano_suffix . ' = "down"; | |
| 3327 | + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() { | |
| 3328 | + if (slide' . $pano_suffix . ' == "up") { | |
| 3329 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3330 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3331 | + slide' . $pano_suffix . ' = "down"; | |
| 3332 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3333 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3223 | 3334 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3224 | 3335 | if (jQuery(this).is(":visible")) { |
| 3225 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3336 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3226 | 3337 | "display": "flex", |
| 3227 | 3338 | "justify-content": "center", |
| 3228 | 3339 | "align-items": "center", |
| 3229 | 3340 | "gap": "15px" |
| @@ -3231,9 +3342,9 @@ | ||
| 3231 | 3342 | } |
| 3232 | 3343 | } |
| 3233 | 3344 | if (jQuery(".bricks-is-frontend").length) { |
| 3234 | 3345 | if (jQuery(this).is(":visible")) { |
| 3235 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3346 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3236 | 3347 | "display": "flex", |
| 3237 | 3348 | "justify-content": "center", |
| 3238 | 3349 | "align-items": "center" |
| 3239 | 3350 | }); |
| @@ -3241,16 +3352,16 @@ | ||
| 3241 | 3352 | } |
| 3242 | 3353 | }); |
| 3243 | 3354 | } |
| 3244 | 3355 | else { |
| 3245 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3246 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3247 | - slide' . $id . ' = "up"; | |
| 3248 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3249 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3356 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3357 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3358 | + slide' . $pano_suffix . ' = "up"; | |
| 3359 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3360 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3250 | 3361 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3251 | 3362 | if (jQuery(this).is(":visible")) { |
| 3252 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3363 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3253 | 3364 | "display": "flex", |
| 3254 | 3365 | "justify-content": "center", |
| 3255 | 3366 | "align-items": "center", |
| 3256 | 3367 | "gap": "15px" |
| @@ -3258,9 +3369,9 @@ | ||
| 3258 | 3369 | } |
| 3259 | 3370 | } |
| 3260 | 3371 | if (jQuery(".bricks-is-frontend").length) { |
| 3261 | 3372 | if (jQuery(this).is(":visible")) { |
| 3262 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3373 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3263 | 3374 | "display": "flex", |
| 3264 | 3375 | "justify-content": "center", |
| 3265 | 3376 | "align-items": "center" |
| 3266 | 3377 | }); |
| @@ -3270,28 +3381,28 @@ | ||
| 3270 | 3381 | } |
| 3271 | 3382 | });'; |
| 3272 | 3383 | } else { |
| 3273 | 3384 | $html .= 'jQuery(document).ready(function($){ |
| 3274 | - jQuery("#sccontrols' . $id . '").show(); | |
| 3275 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3276 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").show(); | |
| 3385 | + jQuery("#sccontrols' . $pano_suffix . '").show(); | |
| 3386 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3387 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").show(); | |
| 3277 | 3388 | });'; |
| 3278 | - $html .= 'var slide' . $id . ' = "down"; | |
| 3279 | - jQuery(document).on("click","#vrgcontrols' . $id . '",function() { | |
| 3280 | - if (slide' . $id . ' == "up") { | |
| 3281 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3282 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3283 | - slide' . $id . ' = "down"; | |
| 3389 | + $html .= 'var slide' . $pano_suffix . ' = "down"; | |
| 3390 | + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() { | |
| 3391 | + if (slide' . $pano_suffix . ' == "up") { | |
| 3392 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3393 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3394 | + slide' . $pano_suffix . ' = "down"; | |
| 3284 | 3395 | } else { |
| 3285 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3286 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3287 | - slide' . $id . ' = "up"; | |
| 3396 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3397 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3398 | + slide' . $pano_suffix . ' = "up"; | |
| 3288 | 3399 | } |
| 3289 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3290 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3400 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3401 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3291 | 3402 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3292 | 3403 | if (jQuery(this).is(":visible")) { |
| 3293 | - 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({ | |
| 3294 | 3405 | "display": "flex", |
| 3295 | 3406 | "justify-content": "center", |
| 3296 | 3407 | "align-items": "center", |
| 3297 | 3408 | "gap": "15px" |
| @@ -3299,9 +3410,9 @@ | ||
| 3299 | 3410 | } |
| 3300 | 3411 | } |
| 3301 | 3412 | if (jQuery(".bricks-is-frontend").length) { |
| 3302 | 3413 | if (jQuery(this).is(":visible")) { |
| 3303 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3414 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3304 | 3415 | "display": "flex", |
| 3305 | 3416 | "justify-content": "center", |
| 3306 | 3417 | "align-items": "center" |
| 3307 | 3418 | }); |
| @@ -3311,29 +3422,29 @@ | ||
| 3311 | 3422 | });'; |
| 3312 | 3423 | } |
| 3313 | 3424 | } else { |
| 3314 | 3425 | $html .= 'jQuery(document).ready(function($){ |
| 3315 | - jQuery("#sccontrols' . $id . '").hide(); | |
| 3316 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").hide(); | |
| 3317 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3426 | + jQuery("#sccontrols' . $pano_suffix . '").hide(); | |
| 3427 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").hide(); | |
| 3428 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3318 | 3429 | });'; |
| 3319 | - $html .= 'var slide' . $id . ' = "down"; | |
| 3320 | - jQuery(document).on("click","#vrgcontrols' . $id . '",function() { | |
| 3321 | - if (slide' . $id . ' == "up") { | |
| 3322 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3323 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3324 | - slide' . $id . ' = "down"; | |
| 3430 | + $html .= 'var slide' . $pano_suffix . ' = "down"; | |
| 3431 | + jQuery(document).on("click","#vrgcontrols' . $pano_suffix . '",function() { | |
| 3432 | + if (slide' . $pano_suffix . ' == "up") { | |
| 3433 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3434 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_up . $sin_qout . '); | |
| 3435 | + slide' . $pano_suffix . ' = "down"; | |
| 3325 | 3436 | } |
| 3326 | 3437 | else { |
| 3327 | - jQuery(".vrgctrl' . $id . '").empty(); | |
| 3328 | - jQuery(".vrgctrl' . $id . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3329 | - slide' . $id . ' = "up"; | |
| 3438 | + jQuery(".vrgctrl' . $pano_suffix . '").empty(); | |
| 3439 | + jQuery(".vrgctrl' . $pano_suffix . '").html(' . $sin_qout . $angle_down . $sin_qout . '); | |
| 3440 | + slide' . $pano_suffix . ' = "up"; | |
| 3330 | 3441 | } |
| 3331 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3332 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3442 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3443 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3333 | 3444 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3334 | 3445 | if (jQuery(this).is(":visible")) { |
| 3335 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3446 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3336 | 3447 | "display": "flex", |
| 3337 | 3448 | "justify-content": "center", |
| 3338 | 3449 | "align-items": "center", |
| 3339 | 3450 | "gap": "15px" |
| @@ -3341,9 +3452,9 @@ | ||
| 3341 | 3452 | } |
| 3342 | 3453 | } |
| 3343 | 3454 | if (jQuery(".bricks-is-frontend").length) { |
| 3344 | 3455 | if (jQuery(this).is(":visible")) { |
| 3345 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3456 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3346 | 3457 | "display": "flex", |
| 3347 | 3458 | "justify-content": "center", |
| 3348 | 3459 | "align-items": "center" |
| 3349 | 3460 | }); |
| @@ -3353,33 +3464,33 @@ | ||
| 3353 | 3464 | });'; |
| 3354 | 3465 | } |
| 3355 | 3466 | if (!$autoload) { |
| 3356 | 3467 | $html .= 'jQuery(document).ready(function(){ |
| 3357 | - jQuery("#controls' . $id . '").hide(); | |
| 3358 | - jQuery("#zoom-in-out-controls' . $id . '").hide(); | |
| 3359 | - jQuery("#adcontrol' . $id . '").hide(); | |
| 3360 | - jQuery("#explainer_button_' . $id . '").hide(); | |
| 3361 | - jQuery("#generic_form_button_' . $id . '").hide(); | |
| 3362 | - jQuery("#floor_map_button_' . $id . '").hide(); | |
| 3363 | - jQuery("#vrgcontrols' . $id . '").hide(); | |
| 3468 | + jQuery("#controls' . $pano_suffix . '").hide(); | |
| 3469 | + jQuery("#zoom-in-out-controls' . $pano_suffix . '").hide(); | |
| 3470 | + jQuery("#adcontrol' . $pano_suffix . '").hide(); | |
| 3471 | + jQuery("#explainer_button_' . $pano_suffix . '").hide(); | |
| 3472 | + jQuery("#generic_form_button_' . $pano_suffix . '").hide(); | |
| 3473 | + jQuery("#floor_map_button_' . $pano_suffix . '").hide(); | |
| 3474 | + jQuery("#vrgcontrols' . $pano_suffix . '").hide(); | |
| 3364 | 3475 | jQuery("#cp-logo-controls").hide(); |
| 3365 | 3476 | jQuery(".custom-scene-navigation").hide(); |
| 3366 | - jQuery("#pano' . $id . '").find(".pnlm-panorama-info").hide(); | |
| 3477 | + jQuery("#' . $panoid . '").find(".pnlm-panorama-info").hide(); | |
| 3367 | 3478 | });'; |
| 3368 | 3479 | if ($vrgallery_display) { |
| 3369 | - $html .= 'var load_once = "true";'; | |
| 3370 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 3371 | - if (load_once == "true") { | |
| 3372 | - load_once = "false"; | |
| 3373 | - jQuery("#sccontrols' . $id . '").slideToggle(function(){ | |
| 3480 | + $html .= 'var load_once' . $pano_suffix . ' = "true";'; | |
| 3481 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 3482 | + if (load_once' . $pano_suffix . ' == "true") { | |
| 3483 | + load_once' . $pano_suffix . ' = "false"; | |
| 3484 | + jQuery("#sccontrols' . $pano_suffix . '").slideToggle(function(){ | |
| 3374 | 3485 | if (jQuery(".elementor-edit-mode .elementor-widget-container").length) { |
| 3375 | 3486 | if (jQuery(this).is(":visible")) { |
| 3376 | - jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css("display", "flex"); | |
| 3487 | + jQuery(".elementor-edit-mode .elementor-widget-container .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css("display", "flex"); | |
| 3377 | 3488 | } |
| 3378 | 3489 | } |
| 3379 | 3490 | if (jQuery(".bricks-is-frontend").length) { |
| 3380 | 3491 | if (jQuery(this).is(":visible")) { |
| 3381 | - jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $id . '").css({ | |
| 3492 | + jQuery(".bricks-is-frontend .wpvr-cardboard .pnlm-container #sccontrols' . $pano_suffix . '").css({ | |
| 3382 | 3493 | "display": "flex", |
| 3383 | 3494 | "justify-content": "center", |
| 3384 | 3495 | "align-items": "center" |
| 3385 | 3496 | }); |
| @@ -3385,23 +3496,23 @@ | ||
| 3385 | 3496 | }); |
| 3386 | 3497 | } |
| 3387 | 3498 | } |
| 3388 | 3499 | }); |
| 3389 | - jQuery("#pano' . $id . ' .wpvr_slider_nav").slideToggle(); | |
| 3500 | + jQuery("#' . $panoid . ' .wpvr_slider_nav").slideToggle(); | |
| 3390 | 3501 | } |
| 3391 | 3502 | });'; |
| 3392 | 3503 | } |
| 3393 | - $html .= 'panoshow' . $id . '.on("load", function (){ | |
| 3394 | - jQuery("#controls' . $id . '").show(); | |
| 3395 | - jQuery("#zoom-in-out-controls' . $id . '").show(); | |
| 3396 | - jQuery("#adcontrol' . $id . '").show(); | |
| 3397 | - jQuery("#explainer_button_' . $id . '").show(); | |
| 3398 | - jQuery("#generic_form_button_' . $id . '").show(); | |
| 3399 | - jQuery("#floor_map_button_' . $id . '").show(); | |
| 3400 | - jQuery("#vrgcontrols' . $id . '").show(); | |
| 3504 | + $html .= 'panoshow' . $pano_suffix . '.on("load", function (){ | |
| 3505 | + jQuery("#controls' . $pano_suffix . '").show(); | |
| 3506 | + jQuery("#zoom-in-out-controls' . $pano_suffix . '").show(); | |
| 3507 | + jQuery("#adcontrol' . $pano_suffix . '").show(); | |
| 3508 | + jQuery("#explainer_button_' . $pano_suffix . '").show(); | |
| 3509 | + jQuery("#generic_form_button_' . $pano_suffix . '").show(); | |
| 3510 | + jQuery("#floor_map_button_' . $pano_suffix . '").show(); | |
| 3511 | + jQuery("#vrgcontrols' . $pano_suffix . '").show(); | |
| 3401 | 3512 | jQuery("#cp-logo-controls").show(); |
| 3402 | 3513 | jQuery(".custom-scene-navigation").show(); |
| 3403 | - jQuery("#pano' . $id . '").find(".pnlm-panorama-info").show(); | |
| 3514 | + jQuery("#' . $panoid . '").find(".pnlm-panorama-info").show(); | |
| 3404 | 3515 | });'; |
| 3405 | 3516 | } |
| 3406 | 3517 | |
| 3407 | 3518 | //==Old code working properly==// |
| @@ -3415,31 +3526,29 @@ | ||
| 3415 | 3526 | var pano_id; |
| 3416 | 3527 | var element_id = this.id; |
| 3417 | 3528 | element_id = element_id.split("-"); |
| 3418 | 3529 | element_id = element_id[3]; |
| 3419 | - jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).addClass("awwww"); | |
| 3530 | + jQuery("#elementor-tab-content-"+element_id).find("#' . $master_container_id . '").children("div").eq(1).addClass("awwww"); | |
| 3420 | 3531 | var pano_id = jQuery(".awwww").attr("id"); |
| 3421 | - jQuery("#elementor-tab-content-"+element_id).find("#master-container").children("div").eq(1).removeClass("awwww");; | |
| 3532 | + jQuery("#elementor-tab-content-"+element_id).find("#' . $master_container_id . '").children("div").eq(1).removeClass("awwww");; | |
| 3422 | 3533 | if (pano_id != undefined) { |
| 3423 | - pano_id = pano_id.split("o"); | |
| 3424 | - pano_id = pano_id[1]; | |
| 3425 | - if (pano_id == "' . $id . '") { | |
| 3426 | - jQuery("#pano' . $id . '").children(".pnlm-render-container").remove(); | |
| 3427 | - jQuery("#pano' . $id . '").children(".pnlm-ui").remove(); | |
| 3428 | - panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3534 | + if (pano_id == "' . $panoid . '") { | |
| 3535 | + jQuery("#' . $panoid . '").children(".pnlm-render-container").remove(); | |
| 3536 | + jQuery("#' . $panoid . '").children(".pnlm-ui").remove(); | |
| 3537 | + panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3429 | 3538 | window.wpvrViewers = window.wpvrViewers || {}; |
| 3430 | - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . '; | |
| 3539 | + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . '; | |
| 3431 | 3540 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 3432 | - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' } | |
| 3541 | + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' } | |
| 3433 | 3542 | })); |
| 3434 | - jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $previeword . '") | |
| 3543 | + jQuery("#' . $panoid . '").children(".pnlm-ui").find(".pnlm-load-button p").text(' . wp_json_encode( (string) $previeword ) . ') | |
| 3435 | 3544 | setTimeout(function() { |
| 3436 | - // panoshow' . $id . '.loadScene("' . $default_scene . '"); | |
| 3545 | + // panoshow' . $pano_suffix . '.loadScene("' . $default_scene . '"); | |
| 3437 | 3546 | window.dispatchEvent(new Event("resize")); |
| 3438 | - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3439 | - jQuery("#controls' . $id . '").css("bottom", "55px"); | |
| 3547 | + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3548 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "55px"); | |
| 3440 | 3549 | } else { |
| 3441 | - jQuery("#controls' . $id . '").css("bottom", "5px"); | |
| 3550 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px"); | |
| 3442 | 3551 | } |
| 3443 | 3552 | }, 200); |
| 3444 | 3553 | } |
| 3445 | 3554 | } |
| @@ -3444,30 +3553,30 @@ | ||
| 3444 | 3553 | } |
| 3445 | 3554 | } |
| 3446 | 3555 | });'; |
| 3447 | 3556 | $html .= 'jQuery(".geodir-tab-head dd, #vr-tour-tab").click(function(){ |
| 3448 | - jQuery("#pano' . $id . '").children(".pnlm-render-container").remove(); | |
| 3449 | - jQuery("#pano' . $id . '").children(".pnlm-ui").remove(); | |
| 3450 | - panoshow' . $id . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3557 | + jQuery("#' . $panoid . '").children(".pnlm-render-container").remove(); | |
| 3558 | + jQuery("#' . $panoid . '").children(".pnlm-ui").remove(); | |
| 3559 | + panoshow' . $pano_suffix . ' = pannellum.viewer(response[0]["panoid"], scenes); | |
| 3451 | 3560 | window.wpvrViewers = window.wpvrViewers || {}; |
| 3452 | - window.wpvrViewers[response[0]["panoid"]] = panoshow' . $id . '; | |
| 3561 | + window.wpvrViewers[response[0]["panoid"]] = panoshow' . $pano_suffix . '; | |
| 3453 | 3562 | document.dispatchEvent(new CustomEvent("wpvr:viewer-ready", { |
| 3454 | - detail: { containerId: response[0]["panoid"], viewer: panoshow' . $id . ' } | |
| 3563 | + detail: { containerId: response[0]["panoid"], viewer: panoshow' . $pano_suffix . ' } | |
| 3455 | 3564 | })); |
| 3456 | 3565 | setTimeout(function() { |
| 3457 | - panoshow' . $id . '.loadScene("' . $default_scene . '"); | |
| 3566 | + panoshow' . $pano_suffix . '.loadScene(' . wp_json_encode( (string) $default_scene ) . '); | |
| 3458 | 3567 | window.dispatchEvent(new Event("resize")); |
| 3459 | - if (jQuery("#pano' . $id . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3460 | - jQuery("#controls' . $id . '").css("bottom", "55px"); | |
| 3568 | + if (jQuery("#' . $panoid . '").children().children(".pnlm-panorama-info:visible").length > 0) { | |
| 3569 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "55px"); | |
| 3461 | 3570 | } |
| 3462 | 3571 | else { |
| 3463 | - jQuery("#controls' . $id . '").css("bottom", "5px"); | |
| 3572 | + jQuery("#controls' . $pano_suffix . '").css("bottom", "5px"); | |
| 3464 | 3573 | } |
| 3465 | 3574 | }, 200); |
| 3466 | 3575 | });'; |
| 3467 | 3576 | if (isset($previeword) && $previeword != '') { |
| 3468 | 3577 | $html .= ' |
| 3469 | - jQuery("#pano' . $id . '").children(".pnlm-ui").find(".pnlm-load-button p").text("' . $previeword . '") | |
| 3578 | + jQuery("#' . $panoid . '").children(".pnlm-ui").find(".pnlm-load-button p").text(' . wp_json_encode( (string) $previeword ) . ') | |
| 3470 | 3579 | '; |
| 3471 | 3580 | } |
| 3472 | 3581 | if ($default_global_zoom != '' || $max_global_zoom != '' || $min_global_zoom != '') { |
| 3473 | 3582 | $html .= 'jQuery(".globalzoom").val("on").change();'; |
| @@ -3472,12 +3581,12 @@ | ||
| 3472 | 3581 | if ($default_global_zoom != '' || $max_global_zoom != '' || $min_global_zoom != '') { |
| 3473 | 3582 | $html .= 'jQuery(".globalzoom").val("on").change();'; |
| 3474 | 3583 | } |
| 3475 | 3584 | |
| 3476 | - $html .= 'jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseenter", function(){ | |
| 3585 | + $html .= 'jQuery("#' . $panoid . ' .pnlm-title-box").on("mouseenter", function(){ | |
| 3477 | 3586 | jQuery(this).attr("title", jQuery(this).text()); |
| 3478 | 3587 | }); |
| 3479 | - jQuery("#pano' . $id . ' .pnlm-title-box").on("mouseleave", function(){ | |
| 3588 | + jQuery("#' . $panoid . ' .pnlm-title-box").on("mouseleave", function(){ | |
| 3480 | 3589 | jQuery(this).removeAttr("title"); |
| 3481 | 3590 | });'; |
| 3482 | 3591 | $html .= '});'; |
| 3483 | 3592 | $html .= '})(jQuery);'; |
| @@ -3511,12 +3620,16 @@ | ||
| 3511 | 3620 | private function sanitize_content_preserve_styles($content, $allow_forms = false) { |
| 3512 | 3621 | // Decode HTML entities first (in case content was encoded in database) |
| 3513 | 3622 | $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8'); |
| 3514 | 3623 | |
| 3515 | - // Escape <script> blocks to display as text instead of removing them | |
| 3516 | - $content = preg_replace_callback('/<script\b[^>]*>(.*?)<\/script>/si', function($matches) { | |
| 3517 | - return esc_html($matches[0]); // Convert to plain text | |
| 3518 | - }, $content); | |
| 3624 | + // Escape or strip <script> blocks | |
| 3625 | + if ($allow_forms) { | |
| 3626 | + $content = preg_replace('/<script\b[^>]*>[\s\S]*?<\/script>/i', '', $content); | |
| 3627 | + } else { | |
| 3628 | + $content = preg_replace_callback('/<script\b[^>]*>(.*?)<\/script>/si', function($matches) { | |
| 3629 | + return esc_html($matches[0]); // Convert to plain text | |
| 3630 | + }, $content); | |
| 3631 | + } | |
| 3519 | 3632 | |
| 3520 | 3633 | // Strip dangerous URL-based attributes |
| 3521 | 3634 | $content = preg_replace('/(href|action|formaction)\s*=\s*["\']?\s*(javascript|vbscript|data|about):/i', '$1=""', $content); |
| 3522 | 3635 | |
| @@ -3559,10 +3672,16 @@ | ||
| 3559 | 3672 | $css = preg_replace('/-moz-binding\s*:/i', '', $css); |
| 3560 | 3673 | return '<style>' . esc_html($css) . '</style>'; |
| 3561 | 3674 | }, $content); |
| 3562 | 3675 | |
| 3563 | - // Allow iframes from safe sources only (e.g., YouTube, Vimeo) | |
| 3676 | + // Allow iframes and styles from safe sources only | |
| 3564 | 3677 | $allowed_tags = wp_kses_allowed_html('post'); |
| 3678 | + $allowed_tags['style'] = [ | |
| 3679 | + 'type' => true, | |
| 3680 | + 'id' => true, | |
| 3681 | + 'class' => true, | |
| 3682 | + 'media' => true, | |
| 3683 | + ]; | |
| 3565 | 3684 | $allowed_tags['iframe'] = [ |
| 3566 | 3685 | 'src' => true, |
| 3567 | 3686 | 'width' => true, |
| 3568 | 3687 | 'height' => true, |
| @@ -3592,37 +3711,47 @@ | ||
| 3592 | 3711 | ]; |
| 3593 | 3712 | |
| 3594 | 3713 | if ($allow_forms) { |
| 3595 | 3714 | $form_attributes = [ |
| 3596 | - 'id' => true, | |
| 3597 | - 'class' => true, | |
| 3598 | - 'style' => true, | |
| 3599 | - 'name' => true, | |
| 3600 | - 'value' => true, | |
| 3601 | - 'type' => true, | |
| 3602 | - 'placeholder' => true, | |
| 3603 | - 'action' => true, | |
| 3604 | - 'method' => true, | |
| 3605 | - 'target' => true, | |
| 3606 | - 'enctype' => true, | |
| 3607 | - 'disabled' => true, | |
| 3608 | - 'readonly' => true, | |
| 3609 | - 'required' => true, | |
| 3610 | - 'checked' => true, | |
| 3611 | - 'selected' => true, | |
| 3612 | - 'multiple' => true, | |
| 3613 | - 'size' => true, | |
| 3614 | - 'rows' => true, | |
| 3615 | - 'cols' => true, | |
| 3616 | - 'maxlength' => true, | |
| 3617 | - 'minlength' => true, | |
| 3618 | - 'min' => true, | |
| 3619 | - 'max' => true, | |
| 3620 | - 'step' => true, | |
| 3621 | - 'pattern' => true, | |
| 3622 | - 'autocomplete'=> true, | |
| 3623 | - 'autofocus' => true, | |
| 3624 | - 'for' => true, | |
| 3715 | + 'id' => true, | |
| 3716 | + 'class' => true, | |
| 3717 | + 'style' => true, | |
| 3718 | + 'name' => true, | |
| 3719 | + 'value' => true, | |
| 3720 | + 'type' => true, | |
| 3721 | + 'placeholder' => true, | |
| 3722 | + 'action' => true, | |
| 3723 | + 'method' => true, | |
| 3724 | + 'target' => true, | |
| 3725 | + 'enctype' => true, | |
| 3726 | + 'disabled' => true, | |
| 3727 | + 'readonly' => true, | |
| 3728 | + 'required' => true, | |
| 3729 | + 'checked' => true, | |
| 3730 | + 'selected' => true, | |
| 3731 | + 'multiple' => true, | |
| 3732 | + 'size' => true, | |
| 3733 | + 'rows' => true, | |
| 3734 | + 'cols' => true, | |
| 3735 | + 'maxlength' => true, | |
| 3736 | + 'minlength' => true, | |
| 3737 | + 'min' => true, | |
| 3738 | + 'max' => true, | |
| 3739 | + 'step' => true, | |
| 3740 | + 'pattern' => true, | |
| 3741 | + 'autocomplete' => true, | |
| 3742 | + 'autofocus' => true, | |
| 3743 | + 'for' => true, | |
| 3744 | + 'data-*' => true, | |
| 3745 | + 'data-form_id' => true, | |
| 3746 | + 'data-form_instance' => true, | |
| 3747 | + 'data-name' => true, | |
| 3748 | + 'data-type' => true, | |
| 3749 | + 'aria-invalid' => true, | |
| 3750 | + 'aria-required' => true, | |
| 3751 | + 'aria-label' => true, | |
| 3752 | + 'aria-describedby' => true, | |
| 3753 | + 'aria-labelledby' => true, | |
| 3625 | 3754 | ]; |
| 3626 | 3755 | $allowed_tags['form'] = $form_attributes; |
| 3627 | 3756 | $allowed_tags['input'] = $form_attributes; |
| 3628 | 3757 | $allowed_tags['button'] = $form_attributes; |
| @@ -3632,8 +3761,18 @@ | ||
| 3632 | 3761 | $allowed_tags['optgroup'] = $form_attributes; |
| 3633 | 3762 | $allowed_tags['label'] = $form_attributes; |
| 3634 | 3763 | $allowed_tags['fieldset'] = $form_attributes; |
| 3635 | 3764 | $allowed_tags['legend'] = $form_attributes; |
| 3765 | + if (!isset($allowed_tags['div'])) { | |
| 3766 | + $allowed_tags['div'] = []; | |
| 3767 | + } | |
| 3768 | + $allowed_tags['div']['data-*'] = true; | |
| 3769 | + $allowed_tags['div']['data-form_id'] = true; | |
| 3770 | + $allowed_tags['div']['data-form_instance'] = true; | |
| 3771 | + if (!isset($allowed_tags['span'])) { | |
| 3772 | + $allowed_tags['span'] = []; | |
| 3773 | + } | |
| 3774 | + $allowed_tags['span']['data-*'] = true; | |
| 3636 | 3775 | } |
| 3637 | 3776 | |
| 3638 | 3777 | // Apply wp_kses() to keep only allowed tags/attributes |
| 3639 | 3778 | $content = wp_kses($content, $allowed_tags); |