Plugin Directory

Changeset 3267601


Ignore:
Timestamp:
04/07/2025 02:42:13 AM (11 months ago)
Author:
devfelixmoira
Message:

Added Popup new version

Location:
popup-more/trunk
Files:
4 edited

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)
     1var ypmWheels = {}
     2var ypmWheelCallBack = function(id) {
     3    var alertPrize = function(indicatedSegment, wheel) {
     4        console.log("Ddd ", wheel.canvasId)
    45            // Ensure the selected segment has a 'text' and 'prize' property
    56            let prizeText = indicatedSegment.text ? indicatedSegment.text : "Unknown";
     
    78       
    89            // 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})`);
    1012     }
    1113     let audio = new Audio(YPM_WHELL_PARAMS.spinSound);
     
    2325     // Create new wheel object specifying the parameters at creation time.
    2426     let theWheel = new Winwheel({
     27        'canvasId'     : id,
    2528        'numSegments'  : YPM_WHELL_PARAMS.numSegments,
    2629        'outerRadius'  : 212,
     
    4447        }
    4548    });
     49
     50    ypmWheels[id] = theWheel;
    4651   
    47      jQuery("#ypm-add-btn").on('click', function(e) {
     52     jQuery(".ypm-add-btn").on('click', function(e) {
    4853         e.preventDefault();
    49    
     54            var id = jQuery(this).data('id')
     55            var theWheel = ypmWheels[id];
     56
    5057         // Reset the animation before each spin
    5158         theWheel.stopAnimation(false); // Ensures animation resets
     
    8087    }
    8188   
    82     ypmWheelCallBack()
    83     jQuery(document).ready(function() {
     89    // ypmWheelCallBack()
     90jQuery(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})
    8499   
    85         setTimeout(function() {
    86                 ypmWheelCallBack()
    87         }, 100)
    88     })
    89    
  • popup-more/trunk/assets/javascript/wheel/WheelCore.js

    r3265986 r3267601  
    22462246            if (typeof callback === 'function') {
    22472247                // 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);
    22492249            } else {
    22502250                eval(callback);
  • popup-more/trunk/classes/frontend/popups/WheelPopup.php

    r3265986 r3267601  
    8080    public function renderView($args, $content) {
    8181        $this->includeJs();
    82         $id = $this->getId();
     82        $id = uniqid();
     83
    8384        $arrowSize = $this->getOptionValue('ypm-wheel-arrow-size');
    8485
    8586        ob_start();
    8687        ?>
    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>
    8990            <div class="ycd-div-wrapper ycd-div-wrapper-<?php echo esc_attr($id); ?>">
    9091                   
    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">   
    9394                        <p style="color: white;" align="center">Sorry, your browser doesn't support canvas. Please try another.</p>
    9495                    </canvas>
    9596                </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>
    9798            </div>
    9899           
    99100            <style>
    100101                .ycd-div-wrapper {
    101                     position: relative; /* Ensure it acts as a reference for absolute positioning */
    102102                    display: flex;
    103                     justify-content: center;
     103                    flex-direction: column;
     104                    align-items: center;
    104105                    margin-bottom: 10px;
    105                     color: red;
    106106                }
    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); ?> {
    112108                    width: 0;
    113109                    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)
    118114                }
    119115                .ypm-wheel-container {
    120116                    text-align: center;
    121117                }
    122                 .response-wrapper {
     118                .response-wrapper-<?php echo esc_attr($id); ?> {
    123119                    margin-bottom: 40px;
    124120                }
  • popup-more/trunk/popup-more.php

    r3265986 r3267601  
    33 * Plugin Name: Popup More
    44 * Description: Popup More is the most complete pop up plugin in the WordPress popup plugins.
    5  * Version: 2.5.3
     5 * Version: 2.5.4
    66 * Author: Felix Moira
    77 * Author URI:
Note: See TracChangeset for help on using the changeset viewer.