Changeset 2832208
- Timestamp:
- 12/12/2022 09:15:26 AM (3 years ago)
- Location:
- democracy-poll
- Files:
-
- 18 added
- 15 deleted
- 21 edited
- 1 copied
-
assets/icon-128x128.png (modified) (1 prop) (previous)
-
assets/icon-256x256.png (modified) (1 prop) (previous)
-
assets/old (deleted)
-
assets/screenshot-1.png (modified) (1 prop) (previous)
-
assets/screenshot-2.png (modified) (1 prop) (previous)
-
assets/screenshot-3.png (modified) (1 prop) (previous)
-
assets/screenshot-4.png (modified) (1 prop) (previous)
-
assets/screenshot-5.png (modified) (1 prop) (previous)
-
assets/screenshot-6.png (modified) (1 prop) (previous)
-
assets/screenshot-7.png (modified) (1 prop) (previous)
-
assets/screenshot-8.png (modified) (1 prop) (previous)
-
assets/screenshot-9.png (modified) (1 prop) (previous)
-
tags/5.6.0 (copied) (copied from democracy-poll/trunk)
-
tags/5.6.0/admin/class-Dem_List_Table_Logs.php (deleted)
-
tags/5.6.0/admin/class-Dem_List_Table_Polls.php (deleted)
-
tags/5.6.0/admin/class-Dem_Tinymce.php (deleted)
-
tags/5.6.0/admin/class-Democ_Post_Metabox.php (deleted)
-
tags/5.6.0/admin/class-Democracy_Poll_Admin.php (deleted)
-
tags/5.6.0/class-DemPoll.php (deleted)
-
tags/5.6.0/class-Democracy_Poll.php (deleted)
-
tags/5.6.0/classes (added)
-
tags/5.6.0/classes/Admin (added)
-
tags/5.6.0/classes/Admin/Dem_List_Table_Logs.php (added)
-
tags/5.6.0/classes/Admin/Dem_List_Table_Polls.php (added)
-
tags/5.6.0/classes/Admin/Dem_Tinymce.php (added)
-
tags/5.6.0/classes/Admin/Democ_Post_Metabox.php (added)
-
tags/5.6.0/classes/Admin/Democracy_Poll_Admin.php (added)
-
tags/5.6.0/classes/DemPoll.php (added)
-
tags/5.6.0/classes/Democracy_Poll.php (added)
-
tags/5.6.0/democracy.php (modified) (2 diffs)
-
tags/5.6.0/js/admin.js (modified) (6 diffs)
-
tags/5.6.0/js/tinymce.js (modified) (1 diff)
-
tags/5.6.0/styles/loaders/pacman.svg (modified) (1 diff)
-
tags/5.6.0/uninstall.php (modified) (2 diffs)
-
trunk/admin/class-Dem_List_Table_Logs.php (deleted)
-
trunk/admin/class-Dem_List_Table_Polls.php (deleted)
-
trunk/admin/class-Dem_Tinymce.php (deleted)
-
trunk/admin/class-Democ_Post_Metabox.php (deleted)
-
trunk/admin/class-Democracy_Poll_Admin.php (deleted)
-
trunk/class-DemPoll.php (deleted)
-
trunk/class-Democracy_Poll.php (deleted)
-
trunk/classes (added)
-
trunk/classes/Admin (added)
-
trunk/classes/Admin/Dem_List_Table_Logs.php (added)
-
trunk/classes/Admin/Dem_List_Table_Polls.php (added)
-
trunk/classes/Admin/Dem_Tinymce.php (added)
-
trunk/classes/Admin/Democ_Post_Metabox.php (added)
-
trunk/classes/Admin/Democracy_Poll_Admin.php (added)
-
trunk/classes/DemPoll.php (added)
-
trunk/classes/Democracy_Poll.php (added)
-
trunk/democracy.php (modified) (2 diffs)
-
trunk/js/admin.js (modified) (6 diffs)
-
trunk/js/tinymce.js (modified) (1 diff)
-
trunk/styles/loaders/pacman.svg (modified) (1 diff)
-
trunk/uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
democracy-poll/assets/icon-128x128.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/icon-256x256.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-1.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-2.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-3.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-4.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-5.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-6.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-7.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-8.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/assets/screenshot-9.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
democracy-poll/tags/5.6.0/democracy.php
r2675586 r2832208 11 11 * Domain Path: /languages/ 12 12 * 13 * Requires at least: 4.6 13 14 * Requires PHP: 5.6 14 15 * … … 48 49 require_once DEMOC_PATH .'theme-functions.php'; 49 50 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';51 require_once DEMOC_PATH .'/classes/DemPoll.php'; 52 require_once DEMOC_PATH .'/classes/Democracy_Poll.php'; 53 require_once DEMOC_PATH .'/classes/Admin/Democracy_Poll_Admin.php'; 53 54 54 55 register_activation_hook( __FILE__, 'democracy_activate' ); -
democracy-poll/tags/5.6.0/js/admin.js
r2675427 r2832208 1 jQuery( document).ready(function($){1 jQuery( document ).ready( function( $ ){ 2 2 'use strict'; 3 3 4 4 // EDIT POLL ----------------------- 5 var $answers_wrap = $( '.new-poll-answers');5 var $answers_wrap = $( '.new-poll-answers' ); 6 6 if( $answers_wrap.length ){ 7 7 var focusFunction = function(){ 8 8 // проверка нужно ли добавлять поле новое 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' ); 12 12 13 13 if( $nextAnsw.length ) return this; 14 14 15 15 // добавляем поле 16 $( this).addAnswField();16 $( this ).addAnswField(); 17 17 }; 18 18 … … 21 21 // добавляет li блок (поле нового ответа) после текущего li 22 22 $.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[]">' ); 29 29 $input.on( 'focus', focusFunction ); 30 30 // удаляем блок, если в поле не было введено данных … … 39 39 40 40 // поле с новым ответом 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(); 43 43 44 44 45 45 // кнопки удаления 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>' ); 48 48 } ); 49 49 // событие удаления 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(); 52 52 53 53 // Перестроим порядок, если он вообще установлен 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 ) 55 55 window.updateAnswersOrder(); 56 56 } ); 57 57 58 58 // 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' } ); 60 60 61 61 // множественный ответ и 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"]' ); 65 65 66 66 // 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' ) ){ 69 69 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 } ); 73 73 74 74 $users_voted.val( sum ); 75 75 } 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_voted83 } )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(){ 85 85 $multiple.val( $multiNum.val() ); 86 } )86 } ) 87 87 88 88 // 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)' ); 91 91 92 92 // для глобального доступа 93 93 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(); 100 100 }; 101 101 102 102 // 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)', 109 109 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' ); 115 115 116 116 // сбросим значения 117 $elsVotes.find( 'input[name $= "[aorder]"]').val('0');117 $elsVotes.find( 'input[name $= "[aorder]"]' ).val( '0' ); 118 118 119 119 // отсортируем элементы 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 ); 123 123 124 124 // и в конец добавим несортируемые … … 126 126 127 127 // спрячем кнопку 128 $( this).slideUp();129 $( '.answers__order').slideDown();130 } );128 $( this ).slideUp(); 129 $( '.answers__order' ).slideDown(); 130 } ); 131 131 132 132 } … … 136 136 137 137 // 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 } ); // отменяем клики 142 146 143 147 // предпросмотр 144 var $demLoader = $( document).find('.dem-loader').first(); // loader145 $( '.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' ) ); 146 150 147 151 // 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 ); 155 159 //console.log( hexcolor ); 156 160 }; 157 $( '.preview-bg').wpColorPicker( myOptions );161 $( '.preview-bg' ).wpColorPicker( myOptions ); 158 162 159 163 // 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' ); 166 170 //console.log( $(this).find('input[type="radio"]')[0] ); 167 } );168 } );171 } ); 172 } ); 169 173 } 170 174 … … 172 176 // POLLS LIST 173 177 // 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 } ); 185 189 186 190 // убедимяс что это та таблица 187 if( $table.closest( '.wrap').find('table .column-id').length )191 if( $table.closest( '.wrap' ).find( 'table .column-id' ).length ) 188 192 $table.prepend( $icon ); 189 193 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 1 1 2 jQuery( document ).ready( function( $){2 document.addEventListener( 'DOMContentLoaded', function(){ 3 3 4 4 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> 9 9 </svg> -
democracy-poll/tags/5.6.0/uninstall.php
r2001058 r2832208 1 1 <?php 2 2 3 if( ! defined('WP_UNINSTALL_PLUGIN') )exit;3 defined( 'WP_UNINSTALL_PLUGIN' ) || exit; 4 4 5 // multisite6 5 if( is_multisite() ){ 7 6 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 ); 10 9 11 10 dem_delete_plugin(); … … 14 13 restore_current_blog(); 15 14 } 16 else {15 else{ 17 16 dem_delete_plugin(); 18 17 } 19 18 20 19 21 function dem_delete_plugin() {20 function dem_delete_plugin() { 22 21 global $wpdb; 23 $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}democracy_q, {$wpdb->prefix}democracy_a, {$wpdb->prefix}democracy_log");24 22 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' ); 31 33 32 34 delete_transient( 'democracy_referer' ); -
democracy-poll/trunk/democracy.php
r2675586 r2832208 11 11 * Domain Path: /languages/ 12 12 * 13 * Requires at least: 4.6 13 14 * Requires PHP: 5.6 14 15 * … … 48 49 require_once DEMOC_PATH .'theme-functions.php'; 49 50 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';51 require_once DEMOC_PATH .'/classes/DemPoll.php'; 52 require_once DEMOC_PATH .'/classes/Democracy_Poll.php'; 53 require_once DEMOC_PATH .'/classes/Admin/Democracy_Poll_Admin.php'; 53 54 54 55 register_activation_hook( __FILE__, 'democracy_activate' ); -
democracy-poll/trunk/js/admin.js
r2675427 r2832208 1 jQuery( document).ready(function($){1 jQuery( document ).ready( function( $ ){ 2 2 'use strict'; 3 3 4 4 // EDIT POLL ----------------------- 5 var $answers_wrap = $( '.new-poll-answers');5 var $answers_wrap = $( '.new-poll-answers' ); 6 6 if( $answers_wrap.length ){ 7 7 var focusFunction = function(){ 8 8 // проверка нужно ли добавлять поле новое 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' ); 12 12 13 13 if( $nextAnsw.length ) return this; 14 14 15 15 // добавляем поле 16 $( this).addAnswField();16 $( this ).addAnswField(); 17 17 }; 18 18 … … 21 21 // добавляет li блок (поле нового ответа) после текущего li 22 22 $.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[]">' ); 29 29 $input.on( 'focus', focusFunction ); 30 30 // удаляем блок, если в поле не было введено данных … … 39 39 40 40 // поле с новым ответом 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(); 43 43 44 44 45 45 // кнопки удаления 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>' ); 48 48 } ); 49 49 // событие удаления 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(); 52 52 53 53 // Перестроим порядок, если он вообще установлен 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 ) 55 55 window.updateAnswersOrder(); 56 56 } ); 57 57 58 58 // 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' } ); 60 60 61 61 // множественный ответ и 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"]' ); 65 65 66 66 // 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' ) ){ 69 69 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 } ); 73 73 74 74 $users_voted.val( sum ); 75 75 } 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_voted83 } )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(){ 85 85 $multiple.val( $multiNum.val() ); 86 } )86 } ) 87 87 88 88 // 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)' ); 91 91 92 92 // для глобального доступа 93 93 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(); 100 100 }; 101 101 102 102 // 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)', 109 109 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' ); 115 115 116 116 // сбросим значения 117 $elsVotes.find( 'input[name $= "[aorder]"]').val('0');117 $elsVotes.find( 'input[name $= "[aorder]"]' ).val( '0' ); 118 118 119 119 // отсортируем элементы 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 ); 123 123 124 124 // и в конец добавим несортируемые … … 126 126 127 127 // спрячем кнопку 128 $( this).slideUp();129 $( '.answers__order').slideDown();130 } );128 $( this ).slideUp(); 129 $( '.answers__order' ).slideDown(); 130 } ); 131 131 132 132 } … … 136 136 137 137 // 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 } ); // отменяем клики 142 146 143 147 // предпросмотр 144 var $demLoader = $( document).find('.dem-loader').first(); // loader145 $( '.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' ) ); 146 150 147 151 // 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 ); 155 159 //console.log( hexcolor ); 156 160 }; 157 $( '.preview-bg').wpColorPicker( myOptions );161 $( '.preview-bg' ).wpColorPicker( myOptions ); 158 162 159 163 // 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' ); 166 170 //console.log( $(this).find('input[type="radio"]')[0] ); 167 } );168 } );171 } ); 172 } ); 169 173 } 170 174 … … 172 176 // POLLS LIST 173 177 // 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 } ); 185 189 186 190 // убедимяс что это та таблица 187 if( $table.closest( '.wrap').find('table .column-id').length )191 if( $table.closest( '.wrap' ).find( 'table .column-id' ).length ) 188 192 $table.prepend( $icon ); 189 193 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 1 1 2 jQuery( document ).ready( function( $){2 document.addEventListener( 'DOMContentLoaded', function(){ 3 3 4 4 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> 9 9 </svg> -
democracy-poll/trunk/uninstall.php
r2001058 r2832208 1 1 <?php 2 2 3 if( ! defined('WP_UNINSTALL_PLUGIN') )exit;3 defined( 'WP_UNINSTALL_PLUGIN' ) || exit; 4 4 5 // multisite6 5 if( is_multisite() ){ 7 6 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 ); 10 9 11 10 dem_delete_plugin(); … … 14 13 restore_current_blog(); 15 14 } 16 else {15 else{ 17 16 dem_delete_plugin(); 18 17 } 19 18 20 19 21 function dem_delete_plugin() {20 function dem_delete_plugin() { 22 21 global $wpdb; 23 $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}democracy_q, {$wpdb->prefix}democracy_a, {$wpdb->prefix}democracy_log");24 22 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' ); 31 33 32 34 delete_transient( 'democracy_referer' );
Note: See TracChangeset
for help on using the changeset viewer.