Skip to content

Commit

Permalink
Integration with Infinite Scroll and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dungps committed Apr 4, 2016
1 parent b5024d4 commit deea7f2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 26 deletions.
38 changes: 19 additions & 19 deletions assets/js/script.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
jQuery(document).ready(function($){
(function($){
$.fn.extend({
disableSelection: function() {
this.each(function() {
this.onselectstart = function() {
return false;
};
this.unselectable = "on";
$(this).css('-moz-user-select', 'none');
$(this).css('-webkit-user-select', 'none');
$(this).css('-ms-user-select', 'none');
$(this).css('user-select', 'none');
});
return this;
disableSelection: function() {
this.each(function() {
this.onselectstart = function() {
return false;
};
this.unselectable = "on";
$(this).css('-moz-user-select', 'none');
$(this).css('-webkit-user-select', 'none');
$(this).css('-ms-user-select', 'none');
$(this).css('user-select', 'none');
});
return this;
}
});

$('div.dw-reactions-button').mouseenter(function(e){
$(document).on( 'mouseenter', 'div.dw-reactions-button', function(e){
$(this).addClass('reaction-show');
});

$('div.dw-reactions-button').mouseleave(function(e){
$(document).on('mouseleave', 'div.dw-reactions-button', function(e){
$(this).removeClass('reaction-show');
});

$('div.dw-reactions-button').on('taphold',function(e){
$(document).on('taphold','div.dw-reactions-button',function(e){
e.preventDefault();
$(this).addClass('reaction-show');
$(this).disableSelection();
});

$('div.dw-reactions-button').disableSelection();

$('.dw-reaction').on('click', function(e){
$(document).on('click', '.dw-reaction', function(e){
e.preventDefault();

var t = $(this), $class = t.attr('class'), main = t.parent().parent().parent(), vote_type = main.attr('data-type'), voted = main.attr('data-vote'), text = t.find('strong').text();
Expand Down Expand Up @@ -62,7 +62,7 @@ jQuery(document).ready(function($){
});
});

$('.dw-reactions-main-button').on('click', function(e) {
$(document).on('click','.dw-reactions-main-button', function(e) {
e.preventDefault();

var t = $(this), parent = t.parent().parent();
Expand Down Expand Up @@ -95,4 +95,4 @@ jQuery(document).ready(function($){
}
});
})
});
})(jQuery);
10 changes: 6 additions & 4 deletions dw-reactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
* Author: DesignWall
* Author URI: https://www.designwal.com/
*
* Version: 1.0.1.2
* Version: 1.0.1.3
* Text Domain: reactions
*/

class DW_Reaction {
private static $timeversion = 120004042016;

/**
* Class Construct
*/
Expand Down Expand Up @@ -181,8 +183,8 @@ public function count_like_layout( $post_id = false ) {
* Enqueue plugin's style/script
*/
public function enqueue_script() {
wp_enqueue_style( 'dw-reaction-style', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/css/style.css' );
wp_enqueue_script( 'dw-reaction-script', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/js/script.js', array( 'jquery' ), true );
wp_enqueue_style( 'dw-reaction-style', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/css/style.css', array(), self::$timeversion );
wp_enqueue_script( 'dw-reaction-script', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/js/script.js', array( 'jquery' ), self::$timeversion );
$localize = array(
'ajax' => admin_url( 'admin-ajax.php' ),
);
Expand Down Expand Up @@ -380,7 +382,7 @@ public function setting_layout() {
<p><?php _e( '1. Open <code>wp-content/themes/&lt;Your theme folder&gt;/</code>.', 'reactions' ); ?></p>
<p><?php _e( '2. You may place it in <code>archive.php</code>, <code>single.php</code>, <code>post.php</code> or <code>page.php</code> also.', 'reactions' ); ?></p>
<p><?php _e( '3. Find <code>&lt;&#63;php while (have_posts()) : the_post(); &#63;&gt;</code>.', 'reactions' ); ?></p>
<p><?php _e( "4. Add anywhere below it (The place you want Reactions to show): <code>&lt;&#63;php if (function_exists('dw_reactions')) { dw_reactions() } &#63;&gt;</code>.", 'reactions' ); ?></p>
<p><?php _e( "4. Add anywhere below it (The place you want Reactions to show): <code>&lt;&#63;php if (function_exists('dw_reactions')) { dw_reactions(); } &#63;&gt;</code>.", 'reactions' ); ?></p>
<hr>
<p><?php _e( 'If you DO NOT want the reactions to appear in every post/page, DO NOT use the code above. Just type in <code>[reactions]</code> into the selected post/page and it will embed reactions into that post/page only.', 'reactions' ); ?></p>
<p><?php _e( 'If you to use reactions button for specific post/page you can use this short code <code>[reactions id="1"]</code>, where 1 is the ID of the post/page.', 'reactions' ); ?></p>
Expand Down
15 changes: 12 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: designwall
Tags: reactions, reaction, facebook reactions, facebook, like, emotions, votes, voting, rating, wordpress reactions
Requires at least: 3.0
Tested up to: 4.4.2
Stable tag: 1.0.1.2
Stable tag: 1.0.1.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -49,20 +49,29 @@ Emotion icons by [EmojiOne](http://emojione.com/), License: [Creative Commons (C
1. Open `wp-content/themes/<Your theme folder>/`.
2. You may place it in `archive.php`, `single.php`, `post.php` or `page.php` also.
3. Find `<?php while (have_posts()) : the_post(); ?>`.
4. Add anywhere below it (The place you want DW Reactions to show): `<?php if (function_exists('dw_reactions')) { dw_reactions() } ?>`.
4. Add anywhere below it (The place you want DW Reactions to show): `<?php if (function_exists('dw_reactions')) { dw_reactions(); } ?>`.

- If you DO NOT want the reactions to appear in every post/page, DO NOT use the code above. Just type in `[reactions]` into the selected post/page and it will embed reactions into that post/page only.
- If you to use reactions button for specific post/page you can use this short code `[reactions id="1"]`, where 1 is the ID of the post/page.
- If you want to show reactions button you can use `[reactions count="false" button="true"]`.
- If you want to show reactions count you can use `[reactions count="true" button="false"]`.

== Screenshot ==
== Screenshots ==

1. Front-end
2. Back-end

== Changelog ==

= 1.0.1.3 =
* Fix: Integration with Infinite Scroll

= 1.0.1.2 =
* Quick fix

= 1.0.1.1 =
* Quick fix

= 1.0.1 =
* New: Anonymous can reactions
* Fix: Break layout
Expand Down

0 comments on commit deea7f2

Please sign in to comment.