Changeset 3267601
- Timestamp:
- 04/07/2025 02:42:13 AM (11 months ago)
- Location:
- popup-more/trunk
- Files:
-
- 4 edited
-
assets/javascript/wheel/Wheel.js (modified) (5 diffs)
-
assets/javascript/wheel/WheelCore.js (modified) (1 diff)
-
classes/frontend/popups/WheelPopup.php (modified) (1 diff)
-
popup-more.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
popup-more/trunk/assets/javascript/wheel/Wheel.js
r3265986 r3267601 1 var ypmWheelCallBack = function() { 2 var alertPrize = function(indicatedSegment) { 3 console.log("Ddd ", indicatedSegment) 1 var ypmWheels = {} 2 var ypmWheelCallBack = function(id) { 3 var alertPrize = function(indicatedSegment, wheel) { 4 console.log("Ddd ", wheel.canvasId) 4 5 // Ensure the selected segment has a 'text' and 'prize' property 5 6 let prizeText = indicatedSegment.text ? indicatedSegment.text : "Unknown"; … … 7 8 8 9 // Show the result in a div 9 jQuery(".response-wrapper").html(`You won: <strong>${prizeText}</strong> (${prizeValue})`); 10 jQuery('.response-wrapper-'+wheel.canvasId).html(`You won: <strong>${prizeText}</strong> (${prizeValue})`) 11 // jQuery(".response-wrapper").html(`You won: <strong>${prizeText}</strong> (${prizeValue})`); 10 12 } 11 13 let audio = new Audio(YPM_WHELL_PARAMS.spinSound); … … 23 25 // Create new wheel object specifying the parameters at creation time. 24 26 let theWheel = new Winwheel({ 27 'canvasId' : id, 25 28 'numSegments' : YPM_WHELL_PARAMS.numSegments, 26 29 'outerRadius' : 212, … … 44 47 } 45 48 }); 49 50 ypmWheels[id] = theWheel; 46 51 47 jQuery(" #ypm-add-btn").on('click', function(e) {52 jQuery(".ypm-add-btn").on('click', function(e) { 48 53 e.preventDefault(); 49 54 var id = jQuery(this).data('id') 55 var theWheel = ypmWheels[id]; 56 50 57 // Reset the animation before each spin 51 58 theWheel.stopAnimation(false); // Ensures animation resets … … 80 87 } 81 88 82 ypmWheelCallBack() 83 jQuery(document).ready(function() { 89 // ypmWheelCallBack() 90 jQuery(document).ready(function() { 91 92 setTimeout(function() { 93 jQuery('.ypm-wheel-container').each(function() { 94 var id = jQuery(this).data('id') 95 ypmWheelCallBack(id) 96 }) 97 }, 100) 98 }) 84 99 85 setTimeout(function() {86 ypmWheelCallBack()87 }, 100)88 })89 -
popup-more/trunk/assets/javascript/wheel/WheelCore.js
r3265986 r3267601 2246 2246 if (typeof callback === 'function') { 2247 2247 // Pass back the indicated segment as 99% of the time you will want to know this to inform the user of their prize. 2248 callback(winwheelToDrawDuringAnimation.getIndicatedSegment() );2248 callback(winwheelToDrawDuringAnimation.getIndicatedSegment(), winwheelToDrawDuringAnimation); 2249 2249 } else { 2250 2250 eval(callback); -
popup-more/trunk/classes/frontend/popups/WheelPopup.php
r3265986 r3267601 80 80 public function renderView($args, $content) { 81 81 $this->includeJs(); 82 $id = $this->getId(); 82 $id = uniqid(); 83 83 84 $arrowSize = $this->getOptionValue('ypm-wheel-arrow-size'); 84 85 85 86 ob_start(); 86 87 ?> 87 <div class="ypm-wheel-container ">88 <div class="response-wrapper "></div>88 <div class="ypm-wheel-container ypm-wheel-container-<?php echo esc_attr($id); ?>" data-id=<?php echo esc_attr($id); ?>> 89 <div class="response-wrapper-<?php echo esc_attr($id); ?>"></div> 89 90 <div class="ycd-div-wrapper ycd-div-wrapper-<?php echo esc_attr($id); ?>"> 90 91 91 <div id="ycd-wheel-pointer" ></div>92 <canvas id=" canvas" width="434" height="434">92 <div id="ycd-wheel-pointer" class="ycd-wheel-pointer ycd-wheel-pointer-<?php echo esc_attr($id); ?>"></div> 93 <canvas id="<?php echo esc_attr($id); ?>" class="canvas" width="434" height="434"> 93 94 <p style="color: white;" align="center">Sorry, your browser doesn't support canvas. Please try another.</p> 94 95 </canvas> 95 96 </div> 96 <button id="ypm-add-btn" class="ypm-button-title"><?php esc_attr_e($this->getOptionValue('ypm-wheel-button-title'))?></button>97 <button id="ypm-add-btn" data-id=<?php echo esc_attr($id); ?> class="ypm-add-btn ypm-button-title"><?php esc_attr_e($this->getOptionValue('ypm-wheel-button-title'))?></button> 97 98 </div> 98 99 99 100 <style> 100 101 .ycd-div-wrapper { 101 position: relative; /* Ensure it acts as a reference for absolute positioning */102 102 display: flex; 103 justify-content: center; 103 flex-direction: column; 104 align-items: center; 104 105 margin-bottom: 10px; 105 color: red;106 106 } 107 #ycd-wheel-pointer { 108 position: absolute; 109 top: -<?php echo esc_attr($arrowSize)*30; ?>px; /* Adjust based on wheel position */ 110 left: 50%; 111 transform: translateX(-50%) rotate(180deg); 107 .ypm-wheel-container-<?php echo esc_attr($id); ?> .ycd-wheel-pointer-<?php echo esc_attr($id); ?> { 112 108 width: 0; 113 109 height: 0; 114 border-left: <?php echo esc_attr($arrowSize) *20; ?>px solid transparent;115 border-right: <?php echo esc_attr($arrowSize) *20; ?>px solid transparent;116 border-bottom: <?php echo esc_attr($arrowSize) *30; ?>px solid <?php esc_attr_e($this->getOptionValue('ypm-wheel-arrow-color'))?>; /* Arrow color */117 z-index: 10; /* Ensure it appears above the wheel */110 border-left: <?php echo esc_attr($arrowSize) * 20; ?>px solid transparent; 111 border-right: <?php echo esc_attr($arrowSize) * 20; ?>px solid transparent; 112 border-bottom: <?php echo esc_attr($arrowSize) * 30; ?>px solid <?php esc_attr_e($this->getOptionValue('ypm-wheel-arrow-color'))?>; 113 transform: rotate(-180deg) 118 114 } 119 115 .ypm-wheel-container { 120 116 text-align: center; 121 117 } 122 .response-wrapper {118 .response-wrapper-<?php echo esc_attr($id); ?> { 123 119 margin-bottom: 40px; 124 120 } -
popup-more/trunk/popup-more.php
r3265986 r3267601 3 3 * Plugin Name: Popup More 4 4 * Description: Popup More is the most complete pop up plugin in the WordPress popup plugins. 5 * Version: 2.5. 35 * Version: 2.5.4 6 6 * Author: Felix Moira 7 7 * Author URI:
Note: See TracChangeset
for help on using the changeset viewer.