Plugin Directory

Changeset 2832208


Ignore:
Timestamp:
12/12/2022 09:15:26 AM (3 years ago)
Author:
Tkama
Message:

Update to version 5.6.0 from GitHub

Location:
democracy-poll
Files:
18 added
15 deleted
21 edited
1 copied

Legend:

Unmodified
Added
Removed
  • democracy-poll/assets/icon-128x128.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/icon-256x256.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-1.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-2.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-3.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-4.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-5.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-6.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-7.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-8.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/assets/screenshot-9.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • democracy-poll/tags/5.6.0/democracy.php

    r2675586 r2832208  
    1111 * Domain Path: /languages/
    1212 *
     13 * Requires at least: 4.6
    1314 * Requires PHP: 5.6
    1415 *
     
    4849require_once DEMOC_PATH .'theme-functions.php';
    4950
    50 require_once DEMOC_PATH .'class-DemPoll.php';
    51 require_once DEMOC_PATH .'class-Democracy_Poll.php';
    52 require_once DEMOC_PATH .'admin/class-Democracy_Poll_Admin.php';
     51require_once DEMOC_PATH .'/classes/DemPoll.php';
     52require_once DEMOC_PATH .'/classes/Democracy_Poll.php';
     53require_once DEMOC_PATH .'/classes/Admin/Democracy_Poll_Admin.php';
    5354
    5455register_activation_hook( __FILE__, 'democracy_activate' );
  • democracy-poll/tags/5.6.0/js/admin.js

    r2675427 r2832208  
    1 jQuery(document).ready(function($){
     1jQuery( document ).ready( function( $ ){
    22    'use strict';
    33
    44    // EDIT POLL -----------------------
    5     var $answers_wrap = $('.new-poll-answers');
     5    var $answers_wrap = $( '.new-poll-answers' );
    66    if( $answers_wrap.length ){
    77        var focusFunction = function(){
    88            // проверка нужно ли добавлять поле новое
    9             var $li          = $(this).closest('li'),
    10                 $nextAnsw    = $li.next('li.answ'),
    11                 $nextAnswTxt = $nextAnsw.find('.answ-text');
     9            var $li = $( this ).closest( 'li' ),
     10                $nextAnsw = $li.next( 'li.answ' ),
     11                $nextAnswTxt = $nextAnsw.find( '.answ-text' );
    1212
    1313            if( $nextAnsw.length ) return this;
    1414
    1515            // добавляем поле
    16             $(this).addAnswField();
     16            $( this ).addAnswField();
    1717        };
    1818
     
    2121        // добавляет li блок (поле нового ответа) после текущего li
    2222        $.fn.addAnswField = function(){
    23             var $li  = this.closest('li'),
    24                 $_li = $li.clone().addClass('new');
    25 
    26             $_li.find('input').remove();
    27 
    28             var $input = $('<input class="answ-text" type="text" name="dmc_new_answers[]">');
     23            var $li = this.closest( 'li' ),
     24                $_li = $li.clone().addClass( 'new' );
     25
     26            $_li.find( 'input' ).remove();
     27
     28            var $input = $( '<input class="answ-text" type="text" name="dmc_new_answers[]">' );
    2929            $input.on( 'focus', focusFunction );
    3030            // удаляем блок, если в поле не было введено данных
     
    3939
    4040        // поле с новым ответом
    41         $answers_wrap.find('.answ-text').focus( focusFunction );
    42         $answers_wrap.find('li.answ').last().addAnswField();
     41        $answers_wrap.find( '.answ-text' ).focus( focusFunction );
     42        $answers_wrap.find( 'li.answ' ).last().addAnswField();
    4343
    4444
    4545        // кнопки удаления
    46         $answers_wrap.find('li.answ').each( function(){
    47             $(this).append('<span class="dem-del-button">×</span>');
     46        $answers_wrap.find( 'li.answ' ).each( function(){
     47            $( this ).append( '<span class="dem-del-button">×</span>' );
    4848        } );
    4949        // событие удаления
    50         $answers_wrap.on('click', '.dem-del-button', function(){
    51             $(this).parent('li').remove();
     50        $answers_wrap.on( 'click', '.dem-del-button', function(){
     51            $( this ).parent( 'li' ).remove();
    5252
    5353            // Перестроим порядок, если он вообще установлен
    54             if( $answers_wrap.find('li.answ:first input[name $= "[aorder]"]').val() > 0 )
     54            if( $answers_wrap.find( 'li.answ:first input[name $= "[aorder]"]' ).val() > 0 )
    5555                window.updateAnswersOrder();
    5656        } );
    5757
    5858        // datepicker
    59         $('input[name="dmc_end"], input[name="dmc_added"]').datepicker({ dateFormat : 'dd-mm-yy' });
     59        $( 'input[name="dmc_end"], input[name="dmc_added"]' ).datepicker( { dateFormat: 'dd-mm-yy' } );
    6060
    6161        // множественный ответ и user_voted
    62         var $multiple = $('input[name="dmc_multiple"]'),
    63             $multiNum   = $multiple.parent().find('[type="number"]'),
    64             $users_voted = $answers_wrap.find('input[name="dmc_users_voted"]');
     62        var $multiple = $( 'input[name="dmc_multiple"]' ),
     63            $multiNum = $multiple.parent().find( '[type="number"]' ),
     64            $users_voted = $answers_wrap.find( 'input[name="dmc_users_voted"]' );
    6565
    6666        // ReSet value of 'dmc_users_voted' when vote count change
    67         $answers_wrap.on('change.reset_users_voted', 'input[name$="[votes]"]', function(){
    68             if( ! $multiple.is(':checked') ){
     67        $answers_wrap.on( 'change.reset_users_voted', 'input[name$="[votes]"]', function(){
     68            if( ! $multiple.is( ':checked' ) ){
    6969                var sum = 0;
    70                 $answers_wrap.find('input[name$="[votes]"]').each(function() {
    71                     sum += Number($(this).val());
    72                 });
     70                $answers_wrap.find( 'input[name$="[votes]"]' ).each( function(){
     71                    sum += Number( $( this ).val() );
     72                } );
    7373
    7474                $users_voted.val( sum );
    7575            }
    76         })
    77 
    78         $multiple.change(function(){
    79             $multiple.is(':checked') ? $multiNum.show().focus() : $multiNum.hide();
    80             $multiple.is(':checked') ? $users_voted.removeProp('readonly') : $users_voted.prop('readonly',1);
    81 
    82             $answers_wrap.find('input[name$="[votes]"]').first().trigger('change.reset_users_voted'); // to reset dmc_users_voted
    83         })
    84         $multiNum.change(function(){
     76        } )
     77
     78        $multiple.change( function(){
     79            $multiple.is( ':checked' ) ? $multiNum.show().focus() : $multiNum.hide();
     80            $multiple.is( ':checked' ) ? $users_voted.removeProp( 'readonly' ) : $users_voted.prop( 'readonly', 1 );
     81
     82            $answers_wrap.find( 'input[name$="[votes]"]' ).first().trigger( 'change.reset_users_voted' ); // to reset dmc_users_voted
     83        } )
     84        $multiNum.change( function(){
    8585            $multiple.val( $multiNum.val() );
    86         })
     86        } )
    8787
    8888        // sortable - set answer order
    89         if(1){
    90             var $orderEls = $answers_wrap.find('> .answ:not(.new)');
     89        if( 1 ){
     90            var $orderEls = $answers_wrap.find( '> .answ:not(.new)' );
    9191
    9292            // для глобального доступа
    9393            window.updateAnswersOrder = function(){
    94                 $answers_wrap.find('> .answ:not(.new)').each(function(nn){
    95                     $(this).find('input[name $= "[aorder]"]').val( nn+1 );
    96                 });
    97 
    98                 $answers_wrap.find('.reset__aorder').slideDown();
    99                 $('.answers__order').slideUp();
     94                $answers_wrap.find( '> .answ:not(.new)' ).each( function( nn ){
     95                    $( this ).find( 'input[name $= "[aorder]"]' ).val( nn + 1 );
     96                } );
     97
     98                $answers_wrap.find( '.reset__aorder' ).slideDown();
     99                $( '.answers__order' ).slideUp();
    100100            };
    101101
    102102            // add order handle
    103             $orderEls.css({ position:'relative' }).prepend('<span class="sorthand dashicons dashicons-menu" style="position:absolute; left:-2.5em; margin-left:0; margin-top:.19em; cursor:move;"></span>');
    104 
    105             $answers_wrap.sortable({
    106                 axis: "y",
    107                 handle: ".sorthand",
    108                 items: "> .answ:not(.new)",
     103            $orderEls.css( { position: 'relative' } ).prepend( '<span class="sorthand dashicons dashicons-menu" style="position:absolute; left:-2.5em; margin-left:0; margin-top:.19em; cursor:move;"></span>' );
     104
     105            $answers_wrap.sortable( {
     106                axis  : 'y',
     107                handle: '.sorthand',
     108                items : '> .answ:not(.new)',
    109109                update: window.updateAnswersOrder
    110             });
    111 
    112             $answers_wrap.find('.reset__aorder').on( 'click', function(){
    113                 var $elsVotes   = $answers_wrap.find('> .answ:not(.new)'),
    114                     $elsVotesNo = $answers_wrap.find('> .answ.new, > .not__answer');
     110            } );
     111
     112            $answers_wrap.find( '.reset__aorder' ).on( 'click', function(){
     113                var $elsVotes = $answers_wrap.find( '> .answ:not(.new)' ),
     114                    $elsVotesNo = $answers_wrap.find( '> .answ.new, > .not__answer' );
    115115
    116116                // сбросим значения
    117                 $elsVotes.find('input[name $= "[aorder]"]').val('0');
     117                $elsVotes.find( 'input[name $= "[aorder]"]' ).val( '0' );
    118118
    119119                // отсортируем элементы
    120                 $elsVotes.sort(function(a, b) {
    121                     return parseInt( $(b).find('input[name $= "[votes]"]').val() ) - parseInt( $(a).find('input[name $= "[votes]"]').val() );
    122                 }).appendTo( $answers_wrap );
     120                $elsVotes.sort( function( a, b ){
     121                    return parseInt( $( b ).find( 'input[name $= "[votes]"]' ).val() ) - parseInt( $( a ).find( 'input[name $= "[votes]"]' ).val() );
     122                } ).appendTo( $answers_wrap );
    123123
    124124                // и в конец добавим несортируемые
     
    126126
    127127                // спрячем кнопку
    128                 $(this).slideUp();
    129                 $('.answers__order').slideDown();
    130             });
     128                $( this ).slideUp();
     129                $( '.answers__order' ).slideDown();
     130            } );
    131131
    132132        }
     
    136136
    137137    // DESIGN ---------------------------------------
    138     if( $('.dempage_design').length ){
    139         $('.dem-screen').height(function(){ return $(this).outerHeight(); } );
    140 
    141         $('[data-dem-act], .democracy a').on( 'click', function(e){ e.preventDefault(); }); // отменяем клики
     138    if( $( '.dempage_design' ).length ){
     139        $( '.dem-screen' ).height( function(){
     140            return $( this ).outerHeight();
     141        } );
     142
     143        $( '[data-dem-act], .democracy a' ).on( 'click', function( e ){
     144            e.preventDefault();
     145        } ); // отменяем клики
    142146
    143147        // предпросмотр
    144         var $demLoader = $(document).find('.dem-loader').first(); // loader
    145         $('.poll.show-loader .dem-screen').append( $demLoader.css('display','table') );
     148        var $demLoader = $( document ).find( '.dem-loader' ).first(); // loader
     149        $( '.poll.show-loader .dem-screen' ).append( $demLoader.css( 'display', 'table' ) );
    146150
    147151        // wpColorPicker
    148         $('.iris_color').wpColorPicker();
    149 
    150         var myOptions ={},
    151             $preview = $('.polls-preview');
    152         myOptions.change = function(event, ui){
    153             var hexcolor = $(this).wpColorPicker('color');
    154             $preview.css('background-color', hexcolor );
     152        $( '.iris_color' ).wpColorPicker();
     153
     154        var myOptions = {},
     155            $preview = $( '.polls-preview' );
     156        myOptions.change = function( event, ui ){
     157            var hexcolor = $( this ).wpColorPicker( 'color' );
     158            $preview.css( 'background-color', hexcolor );
    155159            //console.log( hexcolor );
    156160        };
    157         $('.preview-bg').wpColorPicker( myOptions );
     161        $( '.preview-bg' ).wpColorPicker( myOptions );
    158162
    159163        // checkboks for buttons
    160         var selectable_els = $('.selectable_els');
    161         selectable_els.each(function(){
    162             var $elswrap = $(this);
    163             $elswrap.find('label').on('click', function(){
    164                 $elswrap.find('input[type="radio"]:not(.demdummy)').removeProp('checked');
    165                 $(this).find('input[type="radio"]:not(.demdummy)').prop('checked','checked');
     164        var selectable_els = $( '.selectable_els' );
     165        selectable_els.each( function(){
     166            var $elswrap = $( this );
     167            $elswrap.find( 'label' ).on( 'click', function(){
     168                $elswrap.find( 'input[type="radio"]:not(.demdummy)' ).removeProp( 'checked' );
     169                $( this ).find( 'input[type="radio"]:not(.demdummy)' ).prop( 'checked', 'checked' );
    166170                //console.log( $(this).find('input[type="radio"]')[0] );
    167             });
    168         });
     171            } );
     172        } );
    169173    }
    170174
     
    172176    // POLLS LIST
    173177    // height toggle
    174     var $answs = $('.compact-answ'),
    175         $icon  = $('<span class="dashicons dashicons-exerpt-view"></span>').on( 'click', function(){
    176             $(this).toggleClass('active');
    177             $answs.trigger('click');
    178         }),
    179         $table = $('.tablenav-pages');
    180 
    181     $answs.css({ cursor:'pointer'}).on( 'click', function(){
    182         var dataHeight = $(this).data('height') || 'auto';
    183         $(this).data('height', $(this).height() ).height( dataHeight );
    184     });
     178    var $answs = $( '.compact-answ' ),
     179        $icon = $( '<span class="dashicons dashicons-exerpt-view"></span>' ).on( 'click', function(){
     180            $( this ).toggleClass( 'active' );
     181            $answs.trigger( 'click' );
     182        } ),
     183        $table = $( '.tablenav-pages' );
     184
     185    $answs.css( { cursor: 'pointer' } ).on( 'click', function(){
     186        var dataHeight = $( this ).data( 'height' ) || 'auto';
     187        $( this ).data( 'height', $( this ).height() ).height( dataHeight );
     188    } );
    185189
    186190    // убедимяс что это та таблица
    187     if( $table.closest('.wrap').find('table .column-id').length )
     191    if( $table.closest( '.wrap' ).find( 'table .column-id' ).length )
    188192        $table.prepend( $icon );
    189193
    190 });
    191 
    192 
    193 
    194 
    195 
    196 
    197 
    198 
    199 
    200 
    201 
     194} );
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
  • democracy-poll/tags/5.6.0/js/tinymce.js

    r2675427 r2832208  
    11
    2 jQuery( document ).ready( function( $ ){
     2document.addEventListener( 'DOMContentLoaded', function(){
    33
    44    tinymce.PluginManager.add( 'demTiny', function( editor ){
  • democracy-poll/tags/5.6.0/styles/loaders/pacman.svg

    r1089509 r2832208  
    1 <svg viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
    2   <rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
    3   <path d="M0 50A50 50 0 1 0 100 50" class="fill" fill="#f0c741" transform="rotate(30 50 50)">
    4     <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="30 50 50" to="30 50 50" values="30 50 50;0 50 50;30 50 50"></animateTransform>
    5   </path>
    6   <path d="M0 50A50 50 0 1 1 100 50" class="fill" fill="#f0c741" transform="rotate(-30 50 50)">
    7     <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="-30 50 50" to="-30 50 50" values="-30 50 50;0 50 50;-30 50 50"></animateTransform>
    8   </path>
     1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
     2    <rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
     3    <path d="M0 50A50 50 0 1 0 100 50" class="fill" fill="#f0c741" transform="rotate(30 50 50)">
     4        <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="30 50 50" to="30 50 50" values="30 50 50;0 50 50;30 50 50"></animateTransform>
     5    </path>
     6    <path d="M0 50A50 50 0 1 1 100 50" class="fill" fill="#f0c741" transform="rotate(-30 50 50)">
     7        <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="-30 50 50" to="-30 50 50" values="-30 50 50;0 50 50;-30 50 50"></animateTransform>
     8    </path>
    99</svg>
  • democracy-poll/tags/5.6.0/uninstall.php

    r2001058 r2832208  
    11<?php
    22
    3 if( ! defined('WP_UNINSTALL_PLUGIN') ) exit;
     3defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
    44
    5 // multisite
    65if( is_multisite() ){
    76
    8     foreach( function_exists('get_sites') ? get_sites() : wp_get_sites() as $site ) {
    9         switch_to_blog( is_array($site) ? $site['blog_id'] : $site->blog_id ); // get_sites of WP 4.6+ return objects ...
     7    foreach( get_sites() as $site ){
     8        switch_to_blog( $site->blog_id );
    109
    1110        dem_delete_plugin();
     
    1413    restore_current_blog();
    1514}
    16 else {
     15else{
    1716    dem_delete_plugin();
    1817}
    1918
    2019
    21 function dem_delete_plugin(){
     20function dem_delete_plugin() {
    2221    global $wpdb;
    23     $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}democracy_q, {$wpdb->prefix}democracy_a, {$wpdb->prefix}democracy_log");
    2422
    25     delete_option('widget_democracy'); // wp option...
    26     delete_option('democracy_options');
    27     delete_option('democracy_version');
    28     delete_option('democracy_css');
    29     delete_option('democracy_l10n');
    30     delete_option('democracy_migrated');
     23    $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}democracy_q" );
     24    $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}democracy_a" );
     25    $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}democracy_log" );
     26
     27    delete_option( 'widget_democracy' );
     28    delete_option( 'democracy_options' );
     29    delete_option( 'democracy_version' );
     30    delete_option( 'democracy_css' );
     31    delete_option( 'democracy_l10n' );
     32    delete_option( 'democracy_migrated' );
    3133
    3234    delete_transient( 'democracy_referer' );
  • democracy-poll/trunk/democracy.php

    r2675586 r2832208  
    1111 * Domain Path: /languages/
    1212 *
     13 * Requires at least: 4.6
    1314 * Requires PHP: 5.6
    1415 *
     
    4849require_once DEMOC_PATH .'theme-functions.php';
    4950
    50 require_once DEMOC_PATH .'class-DemPoll.php';
    51 require_once DEMOC_PATH .'class-Democracy_Poll.php';
    52 require_once DEMOC_PATH .'admin/class-Democracy_Poll_Admin.php';
     51require_once DEMOC_PATH .'/classes/DemPoll.php';
     52require_once DEMOC_PATH .'/classes/Democracy_Poll.php';
     53require_once DEMOC_PATH .'/classes/Admin/Democracy_Poll_Admin.php';
    5354
    5455register_activation_hook( __FILE__, 'democracy_activate' );
  • democracy-poll/trunk/js/admin.js

    r2675427 r2832208  
    1 jQuery(document).ready(function($){
     1jQuery( document ).ready( function( $ ){
    22    'use strict';
    33
    44    // EDIT POLL -----------------------
    5     var $answers_wrap = $('.new-poll-answers');
     5    var $answers_wrap = $( '.new-poll-answers' );
    66    if( $answers_wrap.length ){
    77        var focusFunction = function(){
    88            // проверка нужно ли добавлять поле новое
    9             var $li          = $(this).closest('li'),
    10                 $nextAnsw    = $li.next('li.answ'),
    11                 $nextAnswTxt = $nextAnsw.find('.answ-text');
     9            var $li = $( this ).closest( 'li' ),
     10                $nextAnsw = $li.next( 'li.answ' ),
     11                $nextAnswTxt = $nextAnsw.find( '.answ-text' );
    1212
    1313            if( $nextAnsw.length ) return this;
    1414
    1515            // добавляем поле
    16             $(this).addAnswField();
     16            $( this ).addAnswField();
    1717        };
    1818
     
    2121        // добавляет li блок (поле нового ответа) после текущего li
    2222        $.fn.addAnswField = function(){
    23             var $li  = this.closest('li'),
    24                 $_li = $li.clone().addClass('new');
    25 
    26             $_li.find('input').remove();
    27 
    28             var $input = $('<input class="answ-text" type="text" name="dmc_new_answers[]">');
     23            var $li = this.closest( 'li' ),
     24                $_li = $li.clone().addClass( 'new' );
     25
     26            $_li.find( 'input' ).remove();
     27
     28            var $input = $( '<input class="answ-text" type="text" name="dmc_new_answers[]">' );
    2929            $input.on( 'focus', focusFunction );
    3030            // удаляем блок, если в поле не было введено данных
     
    3939
    4040        // поле с новым ответом
    41         $answers_wrap.find('.answ-text').focus( focusFunction );
    42         $answers_wrap.find('li.answ').last().addAnswField();
     41        $answers_wrap.find( '.answ-text' ).focus( focusFunction );
     42        $answers_wrap.find( 'li.answ' ).last().addAnswField();
    4343
    4444
    4545        // кнопки удаления
    46         $answers_wrap.find('li.answ').each( function(){
    47             $(this).append('<span class="dem-del-button">×</span>');
     46        $answers_wrap.find( 'li.answ' ).each( function(){
     47            $( this ).append( '<span class="dem-del-button">×</span>' );
    4848        } );
    4949        // событие удаления
    50         $answers_wrap.on('click', '.dem-del-button', function(){
    51             $(this).parent('li').remove();
     50        $answers_wrap.on( 'click', '.dem-del-button', function(){
     51            $( this ).parent( 'li' ).remove();
    5252
    5353            // Перестроим порядок, если он вообще установлен
    54             if( $answers_wrap.find('li.answ:first input[name $= "[aorder]"]').val() > 0 )
     54            if( $answers_wrap.find( 'li.answ:first input[name $= "[aorder]"]' ).val() > 0 )
    5555                window.updateAnswersOrder();
    5656        } );
    5757
    5858        // datepicker
    59         $('input[name="dmc_end"], input[name="dmc_added"]').datepicker({ dateFormat : 'dd-mm-yy' });
     59        $( 'input[name="dmc_end"], input[name="dmc_added"]' ).datepicker( { dateFormat: 'dd-mm-yy' } );
    6060
    6161        // множественный ответ и user_voted
    62         var $multiple = $('input[name="dmc_multiple"]'),
    63             $multiNum   = $multiple.parent().find('[type="number"]'),
    64             $users_voted = $answers_wrap.find('input[name="dmc_users_voted"]');
     62        var $multiple = $( 'input[name="dmc_multiple"]' ),
     63            $multiNum = $multiple.parent().find( '[type="number"]' ),
     64            $users_voted = $answers_wrap.find( 'input[name="dmc_users_voted"]' );
    6565
    6666        // ReSet value of 'dmc_users_voted' when vote count change
    67         $answers_wrap.on('change.reset_users_voted', 'input[name$="[votes]"]', function(){
    68             if( ! $multiple.is(':checked') ){
     67        $answers_wrap.on( 'change.reset_users_voted', 'input[name$="[votes]"]', function(){
     68            if( ! $multiple.is( ':checked' ) ){
    6969                var sum = 0;
    70                 $answers_wrap.find('input[name$="[votes]"]').each(function() {
    71                     sum += Number($(this).val());
    72                 });
     70                $answers_wrap.find( 'input[name$="[votes]"]' ).each( function(){
     71                    sum += Number( $( this ).val() );
     72                } );
    7373
    7474                $users_voted.val( sum );
    7575            }
    76         })
    77 
    78         $multiple.change(function(){
    79             $multiple.is(':checked') ? $multiNum.show().focus() : $multiNum.hide();
    80             $multiple.is(':checked') ? $users_voted.removeProp('readonly') : $users_voted.prop('readonly',1);
    81 
    82             $answers_wrap.find('input[name$="[votes]"]').first().trigger('change.reset_users_voted'); // to reset dmc_users_voted
    83         })
    84         $multiNum.change(function(){
     76        } )
     77
     78        $multiple.change( function(){
     79            $multiple.is( ':checked' ) ? $multiNum.show().focus() : $multiNum.hide();
     80            $multiple.is( ':checked' ) ? $users_voted.removeProp( 'readonly' ) : $users_voted.prop( 'readonly', 1 );
     81
     82            $answers_wrap.find( 'input[name$="[votes]"]' ).first().trigger( 'change.reset_users_voted' ); // to reset dmc_users_voted
     83        } )
     84        $multiNum.change( function(){
    8585            $multiple.val( $multiNum.val() );
    86         })
     86        } )
    8787
    8888        // sortable - set answer order
    89         if(1){
    90             var $orderEls = $answers_wrap.find('> .answ:not(.new)');
     89        if( 1 ){
     90            var $orderEls = $answers_wrap.find( '> .answ:not(.new)' );
    9191
    9292            // для глобального доступа
    9393            window.updateAnswersOrder = function(){
    94                 $answers_wrap.find('> .answ:not(.new)').each(function(nn){
    95                     $(this).find('input[name $= "[aorder]"]').val( nn+1 );
    96                 });
    97 
    98                 $answers_wrap.find('.reset__aorder').slideDown();
    99                 $('.answers__order').slideUp();
     94                $answers_wrap.find( '> .answ:not(.new)' ).each( function( nn ){
     95                    $( this ).find( 'input[name $= "[aorder]"]' ).val( nn + 1 );
     96                } );
     97
     98                $answers_wrap.find( '.reset__aorder' ).slideDown();
     99                $( '.answers__order' ).slideUp();
    100100            };
    101101
    102102            // add order handle
    103             $orderEls.css({ position:'relative' }).prepend('<span class="sorthand dashicons dashicons-menu" style="position:absolute; left:-2.5em; margin-left:0; margin-top:.19em; cursor:move;"></span>');
    104 
    105             $answers_wrap.sortable({
    106                 axis: "y",
    107                 handle: ".sorthand",
    108                 items: "> .answ:not(.new)",
     103            $orderEls.css( { position: 'relative' } ).prepend( '<span class="sorthand dashicons dashicons-menu" style="position:absolute; left:-2.5em; margin-left:0; margin-top:.19em; cursor:move;"></span>' );
     104
     105            $answers_wrap.sortable( {
     106                axis  : 'y',
     107                handle: '.sorthand',
     108                items : '> .answ:not(.new)',
    109109                update: window.updateAnswersOrder
    110             });
    111 
    112             $answers_wrap.find('.reset__aorder').on( 'click', function(){
    113                 var $elsVotes   = $answers_wrap.find('> .answ:not(.new)'),
    114                     $elsVotesNo = $answers_wrap.find('> .answ.new, > .not__answer');
     110            } );
     111
     112            $answers_wrap.find( '.reset__aorder' ).on( 'click', function(){
     113                var $elsVotes = $answers_wrap.find( '> .answ:not(.new)' ),
     114                    $elsVotesNo = $answers_wrap.find( '> .answ.new, > .not__answer' );
    115115
    116116                // сбросим значения
    117                 $elsVotes.find('input[name $= "[aorder]"]').val('0');
     117                $elsVotes.find( 'input[name $= "[aorder]"]' ).val( '0' );
    118118
    119119                // отсортируем элементы
    120                 $elsVotes.sort(function(a, b) {
    121                     return parseInt( $(b).find('input[name $= "[votes]"]').val() ) - parseInt( $(a).find('input[name $= "[votes]"]').val() );
    122                 }).appendTo( $answers_wrap );
     120                $elsVotes.sort( function( a, b ){
     121                    return parseInt( $( b ).find( 'input[name $= "[votes]"]' ).val() ) - parseInt( $( a ).find( 'input[name $= "[votes]"]' ).val() );
     122                } ).appendTo( $answers_wrap );
    123123
    124124                // и в конец добавим несортируемые
     
    126126
    127127                // спрячем кнопку
    128                 $(this).slideUp();
    129                 $('.answers__order').slideDown();
    130             });
     128                $( this ).slideUp();
     129                $( '.answers__order' ).slideDown();
     130            } );
    131131
    132132        }
     
    136136
    137137    // DESIGN ---------------------------------------
    138     if( $('.dempage_design').length ){
    139         $('.dem-screen').height(function(){ return $(this).outerHeight(); } );
    140 
    141         $('[data-dem-act], .democracy a').on( 'click', function(e){ e.preventDefault(); }); // отменяем клики
     138    if( $( '.dempage_design' ).length ){
     139        $( '.dem-screen' ).height( function(){
     140            return $( this ).outerHeight();
     141        } );
     142
     143        $( '[data-dem-act], .democracy a' ).on( 'click', function( e ){
     144            e.preventDefault();
     145        } ); // отменяем клики
    142146
    143147        // предпросмотр
    144         var $demLoader = $(document).find('.dem-loader').first(); // loader
    145         $('.poll.show-loader .dem-screen').append( $demLoader.css('display','table') );
     148        var $demLoader = $( document ).find( '.dem-loader' ).first(); // loader
     149        $( '.poll.show-loader .dem-screen' ).append( $demLoader.css( 'display', 'table' ) );
    146150
    147151        // wpColorPicker
    148         $('.iris_color').wpColorPicker();
    149 
    150         var myOptions ={},
    151             $preview = $('.polls-preview');
    152         myOptions.change = function(event, ui){
    153             var hexcolor = $(this).wpColorPicker('color');
    154             $preview.css('background-color', hexcolor );
     152        $( '.iris_color' ).wpColorPicker();
     153
     154        var myOptions = {},
     155            $preview = $( '.polls-preview' );
     156        myOptions.change = function( event, ui ){
     157            var hexcolor = $( this ).wpColorPicker( 'color' );
     158            $preview.css( 'background-color', hexcolor );
    155159            //console.log( hexcolor );
    156160        };
    157         $('.preview-bg').wpColorPicker( myOptions );
     161        $( '.preview-bg' ).wpColorPicker( myOptions );
    158162
    159163        // checkboks for buttons
    160         var selectable_els = $('.selectable_els');
    161         selectable_els.each(function(){
    162             var $elswrap = $(this);
    163             $elswrap.find('label').on('click', function(){
    164                 $elswrap.find('input[type="radio"]:not(.demdummy)').removeProp('checked');
    165                 $(this).find('input[type="radio"]:not(.demdummy)').prop('checked','checked');
     164        var selectable_els = $( '.selectable_els' );
     165        selectable_els.each( function(){
     166            var $elswrap = $( this );
     167            $elswrap.find( 'label' ).on( 'click', function(){
     168                $elswrap.find( 'input[type="radio"]:not(.demdummy)' ).removeProp( 'checked' );
     169                $( this ).find( 'input[type="radio"]:not(.demdummy)' ).prop( 'checked', 'checked' );
    166170                //console.log( $(this).find('input[type="radio"]')[0] );
    167             });
    168         });
     171            } );
     172        } );
    169173    }
    170174
     
    172176    // POLLS LIST
    173177    // height toggle
    174     var $answs = $('.compact-answ'),
    175         $icon  = $('<span class="dashicons dashicons-exerpt-view"></span>').on( 'click', function(){
    176             $(this).toggleClass('active');
    177             $answs.trigger('click');
    178         }),
    179         $table = $('.tablenav-pages');
    180 
    181     $answs.css({ cursor:'pointer'}).on( 'click', function(){
    182         var dataHeight = $(this).data('height') || 'auto';
    183         $(this).data('height', $(this).height() ).height( dataHeight );
    184     });
     178    var $answs = $( '.compact-answ' ),
     179        $icon = $( '<span class="dashicons dashicons-exerpt-view"></span>' ).on( 'click', function(){
     180            $( this ).toggleClass( 'active' );
     181            $answs.trigger( 'click' );
     182        } ),
     183        $table = $( '.tablenav-pages' );
     184
     185    $answs.css( { cursor: 'pointer' } ).on( 'click', function(){
     186        var dataHeight = $( this ).data( 'height' ) || 'auto';
     187        $( this ).data( 'height', $( this ).height() ).height( dataHeight );
     188    } );
    185189
    186190    // убедимяс что это та таблица
    187     if( $table.closest('.wrap').find('table .column-id').length )
     191    if( $table.closest( '.wrap' ).find( 'table .column-id' ).length )
    188192        $table.prepend( $icon );
    189193
    190 });
    191 
    192 
    193 
    194 
    195 
    196 
    197 
    198 
    199 
    200 
    201 
     194} );
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
  • democracy-poll/trunk/js/tinymce.js

    r2675427 r2832208  
    11
    2 jQuery( document ).ready( function( $ ){
     2document.addEventListener( 'DOMContentLoaded', function(){
    33
    44    tinymce.PluginManager.add( 'demTiny', function( editor ){
  • democracy-poll/trunk/styles/loaders/pacman.svg

    r1089509 r2832208  
    1 <svg viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
    2   <rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
    3   <path d="M0 50A50 50 0 1 0 100 50" class="fill" fill="#f0c741" transform="rotate(30 50 50)">
    4     <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="30 50 50" to="30 50 50" values="30 50 50;0 50 50;30 50 50"></animateTransform>
    5   </path>
    6   <path d="M0 50A50 50 0 1 1 100 50" class="fill" fill="#f0c741" transform="rotate(-30 50 50)">
    7     <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="-30 50 50" to="-30 50 50" values="-30 50 50;0 50 50;-30 50 50"></animateTransform>
    8   </path>
     1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
     2    <rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
     3    <path d="M0 50A50 50 0 1 0 100 50" class="fill" fill="#f0c741" transform="rotate(30 50 50)">
     4        <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="30 50 50" to="30 50 50" values="30 50 50;0 50 50;30 50 50"></animateTransform>
     5    </path>
     6    <path d="M0 50A50 50 0 1 1 100 50" class="fill" fill="#f0c741" transform="rotate(-30 50 50)">
     7        <animateTransform attributeName="transform" type="rotate" dur=".5s" repeatCount="indefinite" from="-30 50 50" to="-30 50 50" values="-30 50 50;0 50 50;-30 50 50"></animateTransform>
     8    </path>
    99</svg>
  • democracy-poll/trunk/uninstall.php

    r2001058 r2832208  
    11<?php
    22
    3 if( ! defined('WP_UNINSTALL_PLUGIN') ) exit;
     3defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
    44
    5 // multisite
    65if( is_multisite() ){
    76
    8     foreach( function_exists('get_sites') ? get_sites() : wp_get_sites() as $site ) {
    9         switch_to_blog( is_array($site) ? $site['blog_id'] : $site->blog_id ); // get_sites of WP 4.6+ return objects ...
     7    foreach( get_sites() as $site ){
     8        switch_to_blog( $site->blog_id );
    109
    1110        dem_delete_plugin();
     
    1413    restore_current_blog();
    1514}
    16 else {
     15else{
    1716    dem_delete_plugin();
    1817}
    1918
    2019
    21 function dem_delete_plugin(){
     20function dem_delete_plugin() {
    2221    global $wpdb;
    23     $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}democracy_q, {$wpdb->prefix}democracy_a, {$wpdb->prefix}democracy_log");
    2422
    25     delete_option('widget_democracy'); // wp option...
    26     delete_option('democracy_options');
    27     delete_option('democracy_version');
    28     delete_option('democracy_css');
    29     delete_option('democracy_l10n');
    30     delete_option('democracy_migrated');
     23    $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}democracy_q" );
     24    $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}democracy_a" );
     25    $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}democracy_log" );
     26
     27    delete_option( 'widget_democracy' );
     28    delete_option( 'democracy_options' );
     29    delete_option( 'democracy_version' );
     30    delete_option( 'democracy_css' );
     31    delete_option( 'democracy_l10n' );
     32    delete_option( 'democracy_migrated' );
    3133
    3234    delete_transient( 'democracy_referer' );
Note: See TracChangeset for help on using the changeset viewer.