summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2016-08-23 20:02:23 -0400
committerAnthony G. Basile <blueness@gentoo.org>2016-08-23 20:02:50 -0400
commitad3f35663e4e2b80a92166b590d3e2052b5aab91 (patch)
tree94f987efbdb50e1426956c1c04ac459a19c77e53 /plugins/jetpack/modules/infinite-scroll
parentbin/update-wordpress: also update twentyfourteen twentyfifteen twentysixteen (diff)
downloadblogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.tar.gz
blogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.tar.bz2
blogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.zip
Update plugin jetpack to 4.2.2
Diffstat (limited to 'plugins/jetpack/modules/infinite-scroll')
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.js12
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.php25
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php4
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyten.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php4
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php6
9 files changed, 49 insertions, 26 deletions
diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.js b/plugins/jetpack/modules/infinite-scroll/infinity.js
index d2827a30..11001246 100644
--- a/plugins/jetpack/modules/infinite-scroll/infinity.js
+++ b/plugins/jetpack/modules/infinite-scroll/infinity.js
@@ -252,15 +252,8 @@ Scroller.prototype.refresh = function() {
return;
}
- // If there are no remaining posts...
- if ( response.type == 'empty' ) {
- // Disable the scroller.
- self.disabled = true;
- // Update body classes, allowing the footer to return to static positioning
- self.body.addClass( 'infinity-end' ).removeClass( 'infinity-success' );
-
// If we've succeeded...
- } else if ( response.type == 'success' ) {
+ if ( response.type == 'success' ) {
// If additional scripts are required by the incoming set of posts, parse them
if ( response.scripts ) {
$( response.scripts ).each( function() {
@@ -356,6 +349,9 @@ Scroller.prototype.refresh = function() {
self.body.trigger( 'infinite-scroll-posts-more' );
}
}
+ } else if ( response.lastbatch ) {
+ self.disabled = true;
+ self.body.addClass( 'infinity-end' ).removeClass( 'infinity-success' );
}
// Update currentday to the latest value returned from the server
diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.php b/plugins/jetpack/modules/infinite-scroll/infinity.php
index 0aba8d22..c4810fbe 100644
--- a/plugins/jetpack/modules/infinite-scroll/infinity.php
+++ b/plugins/jetpack/modules/infinite-scroll/infinity.php
@@ -255,7 +255,7 @@ class The_Neverending_Home_Page {
self::$settings = apply_filters( 'infinite_scroll_settings', $settings );
}
- /** This filter is documented in modules/infinite-scroll/infinity.php */
+ /** This filter is already documented in modules/infinite-scroll/infinity.php */
return (object) apply_filters( 'infinite_scroll_settings', self::$settings );
}
@@ -300,7 +300,12 @@ class The_Neverending_Home_Page {
* Is this guaranteed to be the last batch of posts?
*/
static function is_last_batch() {
- return (bool) ( count( self::wp_query()->posts ) < self::get_settings()->posts_per_page );
+ $post_type = get_post_type();
+ $entries = wp_count_posts( empty( $post_type ) ? 'post' : $post_type )->publish;
+ if ( self::wp_query()->get( 'paged' ) && self::wp_query()->get( 'paged' ) > 1 ) {
+ $entries -= self::get_settings()->posts_per_page * self::wp_query()->get( 'paged' );
+ }
+ return $entries <= self::get_settings()->posts_per_page;
}
/**
@@ -369,18 +374,25 @@ class The_Neverending_Home_Page {
if ( empty( $id ) )
return;
+ // Add our scripts.
+ wp_register_script( 'the-neverending-homepage', plugins_url( 'infinity.js', __FILE__ ), array( 'jquery' ), '4.0.0', true );
+
+ // Add our default styles.
+ wp_register_style( 'the-neverending-homepage', plugins_url( 'infinity.css', __FILE__ ), array(), '20140422' );
+
// Make sure there are enough posts for IS
- if ( 'click' == self::get_settings()->type && self::is_last_batch() )
+ if ( self::is_last_batch() ) {
return;
+ }
// Add a class to the body.
add_filter( 'body_class', array( $this, 'body_class' ) );
// Add our scripts.
- wp_enqueue_script( 'the-neverending-homepage', plugins_url( 'infinity.js', __FILE__ ), array( 'jquery' ), '4.0.0', true );
+ wp_enqueue_script( 'the-neverending-homepage' );
// Add our default styles.
- wp_enqueue_style( 'the-neverending-homepage', plugins_url( 'infinity.css', __FILE__ ), array(), '20140422' );
+ wp_enqueue_style( 'the-neverending-homepage' );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_spinner_scripts' ) );
@@ -735,6 +747,7 @@ class The_Neverending_Home_Page {
}
}
}
+
unset( $post_type );
// Base JS settings
@@ -1429,7 +1442,7 @@ class The_Neverending_Home_Page {
*/
private function default_footer() {
$credits = sprintf(
- '<a href="http://wordpress.org/" target="_blank" rel="generator">%1$s</a> ',
+ '<a href="https://wordpress.org/" target="_blank" rel="generator">%1$s</a> ',
__( 'Proudly powered by WordPress', 'jetpack' )
);
$credits .= sprintf(
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
index ff6f7878..d7f21e38 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
@@ -20,8 +20,10 @@ add_action( 'init', 'twenty_eleven_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for infinity.
*/
function twenty_eleven_infinite_scroll_enqueue_styles() {
- // Add theme specific styles.
- wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ // Add theme specific styles.
+ wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twenty_eleven_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
index e47a7c2c..a94108f0 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
@@ -20,7 +20,9 @@ add_action( 'after_setup_theme', 'twentyfifteen_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentyfifteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentyfifteen', plugins_url( 'twentyfifteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20141022' );
- wp_style_add_data( 'infinity-twentyfifteen', 'rtl', 'replace' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentyfifteen', plugins_url( 'twentyfifteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20141022' );
+ wp_style_add_data( 'infinity-twentyfifteen', 'rtl', 'replace' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentyfifteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
index f6ddc700..22ae3844 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
@@ -42,6 +42,8 @@ if ( function_exists( 'jetpack_is_mobile' ) ) {
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentyfourteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentyfourteen_infinite_scroll_enqueue_styles', 25 ); \ No newline at end of file
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
index 99af00ef..723d3cee 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
@@ -35,7 +35,9 @@ function twentysixteen_infinite_scroll_render() {
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentysixteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentysixteen', plugins_url( 'twentysixteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20151102' );
- wp_style_add_data( 'infinity-twentysixteen', 'rtl', 'replace' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentysixteen', plugins_url( 'twentysixteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20151102' );
+ wp_style_add_data( 'infinity-twentysixteen', 'rtl', 'replace' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentysixteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
index 094cef9c..a087238d 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
@@ -31,8 +31,10 @@ function twenty_ten_infinite_scroll_render() {
* Enqueue CSS stylesheet with theme styles for infinity.
*/
function twenty_ten_infinite_scroll_enqueue_styles() {
- // Add theme specific styles.
- wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ // Add theme specific styles.
+ wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twenty_ten_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
index dbc18c70..85490b45 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
@@ -21,6 +21,8 @@ add_action( 'after_setup_theme', 'twentythirteen_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentythirteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentythirteen', plugins_url( 'twentythirteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20130409' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentythirteen', plugins_url( 'twentythirteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20130409' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentythirteen_infinite_scroll_enqueue_styles', 25 ); \ No newline at end of file
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
index f8b77011..02e802e4 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
@@ -20,8 +20,10 @@ add_action( 'after_setup_theme', 'twenty_twelve_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for infinity.
*/
function twenty_twelve_infinite_scroll_enqueue_styles() {
- // Add theme specific styles.
- wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ // Add theme specific styles.
+ wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twenty_twelve_infinite_scroll_enqueue_styles', 25 );