Plugin Directory

Changeset 2032591


Ignore:
Timestamp:
02/17/2019 08:48:48 AM (7 years ago)
Author:
czp3009
Message:

update to 5.0.3

Location:
wp-lottery
Files:
9 added
4 edited

Legend:

Unmodified
Added
Removed
  • wp-lottery/trunk/common/css/wordpress-lottery.css

    r1879235 r2032591  
    99    width: 16px;
    1010    height: 16px;
    11     animation: spin 2s linear infinite;
     11    animation: wordpress-lottery-spin 2s linear infinite;
    1212}
    1313
    14 @keyframes spin {
     14/*避免全局污染*/
     15@keyframes wordpress-lottery-spin {
    1516    0% {
    1617        transform: rotate(0deg);
  • wp-lottery/trunk/common/js/wordpress-lottery.js

    r1879235 r2032591  
    1 const action = 'wordpress_lottery_doLottery';
    2 //viewData
    3 // noinspection JSUnresolvedVariable
    4 const ajaxUrl = wordpressLotteryViewData.ajaxUrl;
    5 // noinspection JSUnresolvedVariable
    6 const postId = wordpressLotteryViewData.postId;
    7 
    81document.querySelectorAll('.wordpress-lottery-container').forEach(container => {
    92    const input = container.getElementsByClassName('wordpress-lottery-input')[0];
     
    125    const canvas = container.getElementsByClassName('wordpress-lottery-canvas')[0];
    136
    14     // noinspection JSUndefinedPropertyAssignment
    157    button.onclick = () => {
    168        canvas.innerHTML = '';
    179        loader.hidden = false;
    1810
     11        //旧版本 edge 不支持 URLSearchParams, 此问题无法解决
    1912        let urlSearchParams = new URLSearchParams();
    20         urlSearchParams.append('action', action);
    21         urlSearchParams.append('postId', postId);
     13        urlSearchParams.append('action', 'wordpress_lottery_doLottery');
     14        // noinspection JSUnresolvedVariable
     15        urlSearchParams.append('postId', wordpressLotteryViewData.postId);
    2216        urlSearchParams.append('winnerCount', input.value);
    2317
    2418        //admin-ajax 仅支持 formData
    25         fetch(ajaxUrl, {
     19        // noinspection JSUnresolvedVariable
     20        fetch(wordpressLotteryViewData.ajaxUrl, {
    2621                method: 'POST',
    2722                credentials: 'same-origin',
     
    3227                if (!response.ok) {
    3328                    if (response.status === 400) {
    34                         throw Error('登陆后才能检测血统')
     29                        throw new Error('登陆后才能检测血统')
    3530                    } else {
    36                         throw Error('未知错误: ' + response.statusText)
     31                        throw new Error('未知错误: ' + response.statusText)
    3732                    }
    3833                }
     
    4237            .then(response => {
    4338                if (!response.success) {
    44                     throw Error(response.data.message)
     39                    throw new Error(response.data.message)
    4540                }
    4641                response.data.forEach(comment => {
     
    5550                canvas.innerHTML = error.message
    5651            })
    57             .finally(() => {
     52            .finally(() => {    //edge 不支持 finally, 此问题无法解决
    5853                loader.hidden = true
    5954            })
  • wp-lottery/trunk/readme.txt

    r1879242 r2032591  
    44Tags: comments, spam
    55Requires at least: 4.0.0
    6 Tested up to: 4.9.6
    7 Stable tag: 4.9.6
     6Tested up to: 5.0.3
     7Stable tag: 5.0.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2828
    2929== Changelog ==
     30
     31= 2.1 =
     32测试至 WordPress 5.0.3
    3033
    3134= 2.0 =
  • wp-lottery/trunk/wordpress-lottery.php

    r1879235 r2032591  
    44Plugin URI: https://github.com/czp3009/wordpress-lottery
    55Description: WordPress 抽奖插件
    6 Version: 2.0
     6Version: 2.1
    77Author: czp3009
    88Author URI: https://www.hiczp.com
     
    113113        //获奖人数超过了楼层数
    114114        global $wpdb;
    115         /** @noinspection SqlResolve */
     115        /** @noinspection SqlDialectInspection */
     116        /** @noinspection SqlNoDataSourceInspection */
    116117        $commentCount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE `comment_post_ID` = $postId AND `comment_parent` = 0 AND `comment_approved` = 1");
    117118        if ($winnerCount > $commentCount) {
     
    122123
    123124        //取出回复贴, 随机排序取首部 N 个
    124         /** @noinspection SqlResolve */
     125        /** @noinspection SqlDialectInspection */
     126        /** @noinspection SqlNoDataSourceInspection */
    125127        $winners = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE `comment_post_ID` = $postId AND `comment_parent` = 0 AND `comment_approved` = 1");
    126128        shuffle($winners);
     
    146148add_action('wp_ajax_wordpress_lottery_doLottery', array($wordpressLottery, 'doLottery'));
    147149if (!get_option('wordpress_lottery_login_required')) {
     150    /** @noinspection SpellCheckingInspection */
    148151    add_action('wp_ajax_nopriv_wordpress_lottery_doLottery', array($wordpressLottery, 'doLottery'));
    149152}
Note: See TracChangeset for help on using the changeset viewer.