Version Description
- November 30th 2020 =
- Date since published for n-days
Download this release
Release Info
Developer | Kometschuh |
Plugin | Category Posts Widget |
Version | 4.9.8 |
Comparing to | |
See all releases |
Code changes from version 4.9.7 to 4.9.8
- cat-posts.php +14 -5
- class-widget.php +17 -16
- js/admin/category-posts-widget.js +3 -3
- js/admin/category-posts-widget.min.js +1 -1
- js/frontend/date.js +38 -36
- js/frontend/date.min.js +1 -1
- readme.txt +13 -8
cat-posts.php
CHANGED
@@ -12,7 +12,7 @@ Plugin Name: Category Posts Widget
|
|
12 |
Plugin URI: https://wordpress.org/plugins/category-posts/
|
13 |
Description: Adds a widget that shows the most recent posts from a single category.
|
14 |
Author: TipTopPress
|
15 |
-
Version: 4.9.
|
16 |
Author URI: http://tiptoppress.com
|
17 |
Text Domain: category-posts
|
18 |
Domain Path: /languages
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
exit;
|
26 |
}
|
27 |
|
28 |
-
const VERSION = '4.9.
|
29 |
const DOC_URL = 'http://tiptoppress.com/category-posts-widget/documentation-4-9/';
|
30 |
const PRO_URL = 'http://tiptoppress.com/term-and-category-based-posts-widget/';
|
31 |
const SUPPORT_URL = 'https://wordpress.org/support/plugin/category-posts/';
|
@@ -334,6 +334,13 @@ function upgrade_settings( $settings ) {
|
|
334 |
if ( isset( $settings['hide_if_empty'] ) ) {
|
335 |
unset( $settings['hide_if_empty'] );
|
336 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
}
|
338 |
|
339 |
$settings['ver'] = VERSION;
|
@@ -697,15 +704,15 @@ function default_settings() {
|
|
697 |
'excerpt_more_text' => __( '', 'category-posts' ),
|
698 |
'excerpt_filters' => false,
|
699 |
'comment_num' => false,
|
700 |
-
'date_link' => false,
|
701 |
-
'date_format' => '',
|
702 |
'disable_css' => false,
|
703 |
'disable_font_styles' => false,
|
704 |
'disable_theme_styles' => false,
|
705 |
'show_post_format' => 'none',
|
706 |
'no_cat_childs' => false,
|
707 |
'everything_is_link' => false,
|
708 |
-
'preset_date_format' => '
|
|
|
|
|
709 |
'template' => "%title%\n\n%thumb%",
|
710 |
'text_do_not_wrap_thumb' => false,
|
711 |
'enable_loadmore' => false,
|
@@ -938,6 +945,8 @@ function customize_save_after() {
|
|
938 |
foreach ( $instance as $name => $new ) {
|
939 |
if ( isset( $meta[ $name ] ) ) { // unlikely but maybe that short code was deleted by other session.
|
940 |
$meta[ $name ] = array_merge( $meta[ $name ], $new );
|
|
|
|
|
941 |
}
|
942 |
}
|
943 |
}
|
12 |
Plugin URI: https://wordpress.org/plugins/category-posts/
|
13 |
Description: Adds a widget that shows the most recent posts from a single category.
|
14 |
Author: TipTopPress
|
15 |
+
Version: 4.9.8
|
16 |
Author URI: http://tiptoppress.com
|
17 |
Text Domain: category-posts
|
18 |
Domain Path: /languages
|
25 |
exit;
|
26 |
}
|
27 |
|
28 |
+
const VERSION = '4.9.8';
|
29 |
const DOC_URL = 'http://tiptoppress.com/category-posts-widget/documentation-4-9/';
|
30 |
const PRO_URL = 'http://tiptoppress.com/term-and-category-based-posts-widget/';
|
31 |
const SUPPORT_URL = 'https://wordpress.org/support/plugin/category-posts/';
|
334 |
if ( isset( $settings['hide_if_empty'] ) ) {
|
335 |
unset( $settings['hide_if_empty'] );
|
336 |
}
|
337 |
+
} else {
|
338 |
+
if ( version_compare( '4.9.8', $settings['ver']) ) {
|
339 |
+
if ( isset( $settings['preset_date_format'] ) && 'sincepublished' === $settings['preset_date_format'] ) {
|
340 |
+
$settings['date_past_time'] = 999;
|
341 |
+
$settings['preset_date_format'] = 'sitedate';
|
342 |
+
}
|
343 |
+
}
|
344 |
}
|
345 |
|
346 |
$settings['ver'] = VERSION;
|
704 |
'excerpt_more_text' => __( '', 'category-posts' ),
|
705 |
'excerpt_filters' => false,
|
706 |
'comment_num' => false,
|
|
|
|
|
707 |
'disable_css' => false,
|
708 |
'disable_font_styles' => false,
|
709 |
'disable_theme_styles' => false,
|
710 |
'show_post_format' => 'none',
|
711 |
'no_cat_childs' => false,
|
712 |
'everything_is_link' => false,
|
713 |
+
'preset_date_format' => 'sitedate',
|
714 |
+
'date_format' => '',
|
715 |
+
'date_past_time' => '0',
|
716 |
'template' => "%title%\n\n%thumb%",
|
717 |
'text_do_not_wrap_thumb' => false,
|
718 |
'enable_loadmore' => false,
|
945 |
foreach ( $instance as $name => $new ) {
|
946 |
if ( isset( $meta[ $name ] ) ) { // unlikely but maybe that short code was deleted by other session.
|
947 |
$meta[ $name ] = array_merge( $meta[ $name ], $new );
|
948 |
+
|
949 |
+
$meta[ $name ] = upgrade_settings( $meta[ $name ] );
|
950 |
}
|
951 |
}
|
952 |
}
|
class-widget.php
CHANGED
@@ -509,9 +509,6 @@ class Widget extends \WP_Widget {
|
|
509 |
$attr = ' data-publishtime="' . $time . '" data-format="date"';
|
510 |
add_action( 'wp_footer', __NAMESPACE__ . '\embed_date_scripts' );
|
511 |
break;
|
512 |
-
case 'sincepublished':
|
513 |
-
$date = human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) );
|
514 |
-
break;
|
515 |
default:
|
516 |
if ( isset( $instance['date_format'] ) && strlen( trim( $instance['date_format'] ) ) > 0 ) {
|
517 |
$date_format = $instance['date_format'];
|
@@ -522,18 +519,22 @@ class Widget extends \WP_Widget {
|
|
522 |
break;
|
523 |
}
|
524 |
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
}
|
531 |
-
$ret .= $date;
|
532 |
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
$ret .= '</span>';
|
537 |
return $ret;
|
538 |
}
|
539 |
|
@@ -1761,7 +1762,6 @@ class Widget extends \WP_Widget {
|
|
1761 |
array(
|
1762 |
'sitedateandtime' => esc_html__( 'Site date and time', 'category-posts' ),
|
1763 |
'sitedate' => esc_html__( 'Site date', 'category-posts' ),
|
1764 |
-
'sincepublished' => esc_html__( 'Time since published', 'category-posts' ),
|
1765 |
'localsitedateandtime' => esc_html__( 'Reader\'s local date and time', 'category-posts' ),
|
1766 |
'localsitedate' => esc_html__( 'Reader\'s local date', 'category-posts' ),
|
1767 |
'other' => esc_html__( 'PHP style format', 'category-posts' ),
|
@@ -1770,6 +1770,7 @@ class Widget extends \WP_Widget {
|
|
1770 |
true
|
1771 |
);
|
1772 |
echo $this->get_text_input_block_html( $instance, 'date_format', esc_html__( 'PHP Style Date format', 'category-posts' ), 'j M Y', 'other' === $preset_date_format );
|
|
|
1773 |
?>
|
1774 |
</div>
|
1775 |
</div>
|
@@ -1788,9 +1789,9 @@ class Widget extends \WP_Widget {
|
|
1788 |
echo $this->get_number_input_block_html( $instance, 'thumb_h', esc_html__( 'Height:', 'category-posts' ), 1, '', '', true );
|
1789 |
?>
|
1790 |
<div class="cat-post-image-dimensions-help" style="display:none;">
|
1791 |
-
<p><?php esc_html_e( 'Set one or more dimensions to 0 to
|
1792 |
<p><?php esc_html_e( 'Set both to 0 will use the original image ratio.', 'category-posts' ); ?></p>
|
1793 |
-
<p><?php esc_html_e( 'Max-width limits in terms of the total Post
|
1794 |
</div>
|
1795 |
<div class="cat-post-thumb-change-size">
|
1796 |
<p>
|
509 |
$attr = ' data-publishtime="' . $time . '" data-format="date"';
|
510 |
add_action( 'wp_footer', __NAMESPACE__ . '\embed_date_scripts' );
|
511 |
break;
|
|
|
|
|
|
|
512 |
default:
|
513 |
if ( isset( $instance['date_format'] ) && strlen( trim( $instance['date_format'] ) ) > 0 ) {
|
514 |
$date_format = $instance['date_format'];
|
519 |
break;
|
520 |
}
|
521 |
|
522 |
+
if ( isset( $instance['date_past_time'] ) && 0 < $instance['date_past_time'] ) {
|
523 |
+
$post_date = get_the_time( get_option( 'date_format' ) );
|
524 |
+
$current_date = current_time( "Y-m-d" );
|
525 |
+
$past_days = date_diff(
|
526 |
+
date_create( $post_date ),
|
527 |
+
date_create( $current_date )
|
528 |
+
)->days;
|
529 |
+
if ( $past_days <= $instance['date_past_time'] ) {
|
530 |
+
$date = human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) );
|
531 |
+
$attr = ' data-publishtime="" data-format="sincepublished"';
|
532 |
+
}
|
533 |
}
|
|
|
534 |
|
535 |
+
$post_date_class = ( isset( $instance[ 'disable_theme_styles' ] ) && $instance[ 'disable_theme_styles' ] ) ? "" : " post-date";
|
536 |
+
$ret .= '<span class="cat-post-date' . $post_date_class . '"' . $attr . '>' . $date . '</span>';
|
537 |
+
|
|
|
538 |
return $ret;
|
539 |
}
|
540 |
|
1762 |
array(
|
1763 |
'sitedateandtime' => esc_html__( 'Site date and time', 'category-posts' ),
|
1764 |
'sitedate' => esc_html__( 'Site date', 'category-posts' ),
|
|
|
1765 |
'localsitedateandtime' => esc_html__( 'Reader\'s local date and time', 'category-posts' ),
|
1766 |
'localsitedate' => esc_html__( 'Reader\'s local date', 'category-posts' ),
|
1767 |
'other' => esc_html__( 'PHP style format', 'category-posts' ),
|
1770 |
true
|
1771 |
);
|
1772 |
echo $this->get_text_input_block_html( $instance, 'date_format', esc_html__( 'PHP Style Date format', 'category-posts' ), 'j M Y', 'other' === $preset_date_format );
|
1773 |
+
echo $this->get_number_input_block_html( $instance, 'date_past_time', esc_html__( 'Show past time up to x-days:', 'category-posts' ), 0, '', '' , true );
|
1774 |
?>
|
1775 |
</div>
|
1776 |
</div>
|
1789 |
echo $this->get_number_input_block_html( $instance, 'thumb_h', esc_html__( 'Height:', 'category-posts' ), 1, '', '', true );
|
1790 |
?>
|
1791 |
<div class="cat-post-image-dimensions-help" style="display:none;">
|
1792 |
+
<p><?php esc_html_e( 'Set one or more dimensions to 0 to not perform a ratio calculation.', 'category-posts' ); ?></p>
|
1793 |
<p><?php esc_html_e( 'Set both to 0 will use the original image ratio.', 'category-posts' ); ?></p>
|
1794 |
+
<p><?php esc_html_e( 'Max-width limits in terms of the total Post width.', 'category-posts' ); ?></p>
|
1795 |
</div>
|
1796 |
<div class="cat-post-thumb-change-size">
|
1797 |
<p>
|
js/admin/category-posts-widget.js
CHANGED
@@ -158,7 +158,7 @@ var cwp_namespace = {
|
|
158 |
template = '%title%\n\n%thumb%';
|
159 |
break;
|
160 |
case 'title_thum_excerpt':
|
161 |
-
template = '%title%\n\n%thumb%\n%excerpt
|
162 |
break;
|
163 |
case 'everything':
|
164 |
template = '%title%\n\n';
|
@@ -166,7 +166,7 @@ var cwp_namespace = {
|
|
166 |
template += '%thumb%\n';
|
167 |
template += '<span class="dashicons dashicons-admin-comments"></span> %commentnum% ';
|
168 |
template += '<span class="dashicons dashicons-admin-users"></span> %author%\n';
|
169 |
-
template += '%excerpt
|
170 |
template += '%more-link%\n\n';
|
171 |
template += 'Categories: %category% ';
|
172 |
template += '<span class="dashicons dashicons-tag"></span> %post_tag%';
|
@@ -526,4 +526,4 @@ jQuery(document).ready(function() {
|
|
526 |
}
|
527 |
|
528 |
setChangeHandlers();
|
529 |
-
});
|
158 |
template = '%title%\n\n%thumb%';
|
159 |
break;
|
160 |
case 'title_thum_excerpt':
|
161 |
+
template = '%title%\n\n%thumb%\n%excerpt%\n\n%more-link%';
|
162 |
break;
|
163 |
case 'everything':
|
164 |
template = '%title%\n\n';
|
166 |
template += '%thumb%\n';
|
167 |
template += '<span class="dashicons dashicons-admin-comments"></span> %commentnum% ';
|
168 |
template += '<span class="dashicons dashicons-admin-users"></span> %author%\n';
|
169 |
+
template += '%excerpt%\n\n';
|
170 |
template += '%more-link%\n\n';
|
171 |
template += 'Categories: %category% ';
|
172 |
template += '<span class="dashicons dashicons-tag"></span> %post_tag%';
|
526 |
}
|
527 |
|
528 |
setChangeHandlers();
|
529 |
+
});
|
js/admin/category-posts-widget.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var cwp_namespace={php_settings_var:"categoryPosts",widget_class:".category-widget-cont",template_panel_prefix:".categoryposts-data-panel-",open_panels:{},template_change_timer:null,clickHandler:function(element){jQuery(element).toggleClass("open").next().stop().slideToggle();var panel=jQuery(element).data("panel"),id=jQuery(element).parent().parent().parent().parent().parent().attr("id"),o={};this.open_panels.hasOwnProperty(id)&&(o=this.open_panels[id]),o.hasOwnProperty(panel)?delete o[panel]:o[panel]=!0,this.open_panels[id]=o},toggleCatSelection:function(item){var cat=jQuery(item).find("option:selected").attr("value"),panel=item.parentElement.parentElement.parentElement.parentElement;"0"==cat?(jQuery(panel).find(".categoryPosts-title_link").hide(),jQuery(panel).find(".categoryPosts-title_link_url").show(),jQuery(panel).find(".categoryPosts-no_cat_childs").hide()):(jQuery(panel).find(".categoryPosts-title_link").show(),jQuery(panel).find(".categoryPosts-title_link_url").hide(),jQuery(panel).find(".categoryPosts-no_cat_childs").show())},toggleDisableFontStyles:function(item){var panel=item.parentElement.parentElement.parentElement;item.checked?jQuery(panel).find(".categoryPosts-disable_font_styles").hide():jQuery(panel).find(".categoryPosts-disable_font_styles").show()},toggleDateFormat:function(item){var value=jQuery(item).val(),panel=item.parentElement.parentElement;"other"!=value?jQuery(panel).find(".categoryPosts-date_format").hide():jQuery(panel).find(".categoryPosts-date_format").show()},toggleDateRange:function(item){var value=jQuery(item).val(),panel=item.parentElement.parentElement;switch(jQuery(panel).find(".categoryPosts-date-range p").hide(),jQuery(panel).find(".categoryPosts-date-range").show(),value){case"off":jQuery(panel).find(".categoryPosts-date-range").hide();break;case"days_ago":jQuery(panel).find(".categoryPosts-days_ago").show();break;case"between_dates":jQuery(panel).find(".categoryPosts-start_date").show(),jQuery(panel).find(".categoryPosts-end_date").show()}},toggleNoMatch:function(item){var value=jQuery(item).val(),panel=item.parentElement.parentElement;"text"==value?jQuery(panel).find(".categoryPosts-no-match-text").show():jQuery(panel).find(".categoryPosts-no-match-text").hide()},toggleTemplateHelp:function(item,event){event.preventDefault();var panel=item.parentElement.parentElement.parentElement.parentElement;jQuery(panel).find(".cat-post-template-help").toggle("slow")},toggleImageDimensionsHelp:function(item,event){event.preventDefault();var panel=item.parentElement.parentElement.parentElement.parentElement;jQuery(panel).find(".cat-post-image-dimensions-help").toggle("slow")},toggleMoreLinkHelp:function(item,event){event.preventDefault();var panel=item.parentElement.parentElement.parentElement.parentElement;jQuery(panel).find(".cat-post-more-link-help").toggle("slow")},toggleHideTitle:function(item){var panel=item.parentElement.parentElement.parentElement;item.checked?jQuery(panel).find(".categoryposts-data-panel-title-settings").hide():jQuery(panel).find(".categoryposts-data-panel-title-settings").show()},toggleLoadMore:function(item){var panel=item.parentElement.parentElement.parentElement;item.checked?jQuery(panel).find(".loadmore-settings").show():jQuery(panel).find(".loadmore-settings").hide()},selectPremadeTemplate:function(item){var panel=item.parentElement.parentElement.parentElement,div=item.parentElement.parentElement,select=jQuery(div).find("select"),template="%title%";switch(value=select.val(),value){case"title":template="%title%";break;case"title_excerpt":template="%title%\n\n%excerpt%\n\n%more-link%";break;case"title_thumb":template="%title%\n\n%thumb%";break;case"title_thum_excerpt":template="%title%\n\n%thumb%\n%excerpt%%more-link%";break;case"everything":template="%title%\n\n",template+="%date%\n\n",template+="%thumb%\n",template+='<span class="dashicons dashicons-admin-comments"></span> %commentnum% ',template+='<span class="dashicons dashicons-admin-users"></span> %author%\n',template+="%excerpt%",template+="%more-link%\n\n",template+="Categories: %category% ",template+='<span class="dashicons dashicons-tag"></span> %post_tag%'}var textarea=jQuery(panel).find("textarea");textarea.val(template),textarea.trigger("input","change")},autoCloseOpenPanels:function(_this){if(tiptoppress[this.php_settings_var].accordion&&!jQuery(_this).hasClass("open")){var jCloseElement=jQuery(_this).parent().find(".open");this.clickHandler(jCloseElement)}},defaultThumbnailSelection:function(elem,title,button_title){var frame=wp.media({title:title,multiple:!1,library:{type:"image"},button:{text:button_title}});return frame.on("close",(function(){var attachments=frame.state().get("selection").toJSON();if(1==attachments.length){var attachment=attachments[0],img_html='<img src="'+attachment.url+'" ';img_html+='width="60" ',img_html+='height="60" ',img_html+="/>",jQuery(elem).parent().prev().find(".default_thumb_img").html(img_html),jQuery(elem).parent().find(".cwp_default_thumb_remove").show(),jQuery(elem).parent().prev().find(".default_thumb_id").val(attachment.id).change()}})),frame.open(),!1},removeDefaultThumbnailSelection:function(elem){return jQuery(elem).parent().prev().find(".default_thumb_img").html(cwp_default_thumb_selection.none),jQuery(elem).hide(),jQuery(elem).parent().prev().find(".default_thumb_id").val(0).change(),!1},templateChange:function(elem){function adjustUiToTemplate(){var template=jQuery(elem).val(),tags=tiptoppress[this.php_settings_var].template_tags,widget_cont=jQuery(elem.parentElement.parentElement.parentElement.parentElement);for(var key in tags)-1!==template.indexOf(tags[key])?widget_cont.find(this.template_panel_prefix+tags[key]).show():widget_cont.find(this.template_panel_prefix+tags[key]).hide()}null!=this.template_change_timer&&clearTimeout(this.template_change_timer),this.template_change_timer=setTimeout(adjustUiToTemplate.bind(this),250)},thumbnailSizeChange:function(elem){var _that=jQuery(elem),thumb_h,thumb_w,_input_thumb_h=_that.closest(".categoryposts-data-panel-thumb").find(".thumb_h"),_input_thumb_w=_that.closest(".categoryposts-data-panel-thumb").find(".thumb_w");return _that.hasClass("smaller")?(thumb_w=_input_thumb_w.val()/1.015,thumb_h=_input_thumb_h.val()/1.015):_that.hasClass("quarter")?(thumb_w=_input_thumb_w.val()/4,thumb_h=_input_thumb_h.val()/4):_that.hasClass("half")?(thumb_h=_input_thumb_h.val()/2,thumb_w=_input_thumb_w.val()/2):_that.hasClass("double")?(thumb_h=2*_input_thumb_h.val(),thumb_w=2*_input_thumb_w.val()):_that.hasClass("bigger")?(thumb_w=1.02*_input_thumb_w.val(),thumb_h=1.02*_input_thumb_h.val()):_that.hasClass("square")?parseInt(_input_thumb_w.val())>=parseInt(_input_thumb_h.val())?(thumb_h=_input_thumb_w.val(),thumb_w=_input_thumb_w.val()):(thumb_h=_input_thumb_h.val(),thumb_w=_input_thumb_h.val()):_that.hasClass("standard")?parseInt(_input_thumb_w.val())>=parseInt(_input_thumb_h.val())?(thumb_h=_input_thumb_w.val()/4*3,thumb_w=_input_thumb_w.val()):(thumb_h=4*_input_thumb_w.val()/3,thumb_w=_input_thumb_w.val()):_that.hasClass("wide")?parseInt(_input_thumb_w.val())>=parseInt(_input_thumb_h.val())?(thumb_h=_input_thumb_w.val()/16*9,thumb_w=_input_thumb_w.val()):(thumb_h=16*_input_thumb_w.val()/9,thumb_w=_input_thumb_w.val()):_that.hasClass("switch")?(thumb_h=_input_thumb_w.val(),thumb_w=_input_thumb_h.val()):_that.hasClass("width")?(thumb_w=0==_input_thumb_w.val()?300:_input_thumb_w.val(),thumb_h=0):_that.hasClass("height")?(thumb_h=0==_input_thumb_h.val()?300:_input_thumb_h.val(),thumb_w=0):_that.hasClass("both")?(thumb_h=0,thumb_w=0):(thumb_w=_that.data("thumb-w"),thumb_h=_that.data("thumb-h")),_input_thumb_w.val(Math.floor(thumb_w)),_input_thumb_h.val(Math.floor(thumb_h)),_input_thumb_w.trigger("input","change"),_input_thumb_h.trigger("input","change"),!1},thumbnailFluidWidthChange:function(elem){var _that=jQuery(elem),_input_thumb_h=_that.closest(".categoryposts-data-panel-thumb").find(".thumb_h");return _that.closest("label").find("span").html(_that.val()+"%"),_input_thumb_h.trigger("input","change"),!1},openAddPlaceholder:function(elem){var _that=jQuery(elem);return _that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").toggle(),_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu span").off("click").on("click",(function(){var text=jQuery(this).data("value");switch(text){case"NewLine":text="\n";break;case"EmptyLine":text="\n\n";break;default:text="%"+text+"%"}var _div=this.parentElement.parentElement.parentElement,textarea=jQuery(_div).find("textarea"),textareaPos=textarea[0].selectionStart,textareaTxt=textarea.val();textarea.val(textareaTxt.substring(0,textareaPos)+text+textareaTxt.substring(textareaPos)),textarea[0].selectionStart=textareaPos+text.length,textarea[0].selectionEnd=textareaPos+text.length,textarea.focus(),textarea.trigger("input","change")})),_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").on("mouseenter",(function(){jQuery(this).addClass("cpw-doNotClose")})),_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").on("mouseleave",(function(){jQuery(this).removeClass("cpw-doNotClose")})),_that.closest(".cat-post-add_premade_templates").find(".cpwp-close-placeholder-dropdown-menu").off("click").on("click",(function(){_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").toggle()})),!1},selectPlaceholderHelper:function(elem){var textarea=jQuery(elem),textareaPos=textarea[0].selectionStart,textareaTxt=textarea.val(),nStartSel=textareaTxt.substring(0,textareaPos).lastIndexOf("%"),nEndSel=textareaPos+textareaTxt.substring(textareaPos).indexOf("%")+1,strSelTxt=textareaTxt.substring(nStartSel,nEndSel);return!(strSelTxt.indexOf("\n")>=0||strSelTxt.indexOf(" ")>=0||strSelTxt.length<=2)&&(textarea[0].selectionStart=nStartSel,textarea[0].selectionEnd=nEndSel,!1)}};jQuery(document).ready((function(){var class_namespace=".category-widget-cont";function setChangeHandlers(){jQuery(document).on("click",class_namespace+" .categoryPosts-hide_title input[type=checkbox]",(function(){cwp_namespace.toggleHideTitle(this)})),jQuery(document).on("change",class_namespace+" .categoryposts-data-panel-filter-cat",(function(){cwp_namespace.toggleCatSelection(this)})),jQuery(document).on("change",class_namespace+" .categoryPosts-date_range select",(function(){cwp_namespace.toggleDateRange(this)})),jQuery(".cwp_default_thumb_select").off("click").on("click",(function(){cwp_namespace.defaultThumbnailSelection(this,cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title)})),jQuery(document).on("click",class_namespace+" .cat-post-premade_templates button",(function(){cwp_namespace.selectPremadeTemplate(this)})),jQuery(document).on("change",class_namespace+" .cat-post-premade_templates select",(function(event){event.preventDefault(),event.stopPropagation()})),jQuery(document).on("input",class_namespace+" .categoryPosts-template textarea",(function(){cwp_namespace.templateChange(this)})),jQuery(document).on("change",class_namespace+" .categoryPosts-preset_date_format select",(function(){cwp_namespace.toggleDateFormat(this)})),jQuery(class_namespace+" .cat-post-thumb-change-size button").off("click").on("click",(function(){cwp_namespace.thumbnailSizeChange(this)})),jQuery(document).on("input",class_namespace+" .thumb_fluid_width",(function(){cwp_namespace.thumbnailFluidWidthChange(this)})),jQuery(".cwp_default_thumb_remove").off("click").on("click",(function(){cwp_namespace.removeDefaultThumbnailSelection(this)})),jQuery(class_namespace+" a.toggle-template-help").off("click").on("click",(function(event){cwp_namespace.toggleTemplateHelp(this,event)})),jQuery(class_namespace+" a.toggle-image-dimensions-help").off("click").on("click",(function(event){cwp_namespace.toggleImageDimensionsHelp(this,event)})),jQuery(class_namespace+" a.toggle-more-link-help").off("click").on("click",(function(event){cwp_namespace.toggleMoreLinkHelp(this,event)})),jQuery(class_namespace+" .cpwp-open-placholder-dropdown-menu").off("click").on("click",(function(){cwp_namespace.openAddPlaceholder(this)})),jQuery(document).on("onfocusout, blur",class_namespace+" .cpwp-open-placholder-dropdown-menu,"+class_namespace+" .categoryPosts-template textarea",(function(){jQuery(this).closest(class_namespace+" .categoryPosts-template").parent().find(".cpwp-placeholder-dropdown-menu").not(".cpw-doNotClose").hide()})),jQuery(document).on("click",class_namespace+" .categoryPosts-template textarea",(function(){jQuery(this).closest(class_namespace+" .categoryPosts-template").parent().find(".cpwp-placeholder-dropdown-menu").not(".cpw-doNotClose").hide()})),jQuery(document).on("mousedown",class_namespace+" .categoryPosts-template textarea",(function(){var _that=this;setTimeout((function(){cwp_namespace.selectPlaceholderHelper(_that)}),0)})),jQuery(document).on("click",class_namespace+" .categoryPosts-disable_css input[type=checkbox]",(function(){cwp_namespace.toggleDisableFontStyles(this)})),jQuery(document).on("change",class_namespace+" .categoryPosts-no_match_handling select",(function(){cwp_namespace.toggleNoMatch(this)})),jQuery(document).on("click",class_namespace+" .categoryPosts-enable_loadmore input[type=checkbox]",(function(){cwp_namespace.toggleLoadMore(this)}))}jQuery(".category-widget-cont h4").click((function(){cwp_namespace.autoCloseOpenPanels(this),cwp_namespace.clickHandler(this)})),jQuery(document).on("widget-added widget-updated panelsopen",(function(root,element){jQuery(".category-widget-cont h4").off("click").on("click",(function(){cwp_namespace.autoCloseOpenPanels(this),cwp_namespace.clickHandler(this)})),jQuery(".cwp_default_thumb_select").off("click").on("click",(function(){cwp_namespace.defaultThumbnailSelection(this,cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title)})),jQuery(".cwp_default_thumb_remove").off("click").on("click",(function(){cwp_namespace.removeDefaultThumbnailSelection(this)}));var id=jQuery(element).attr("id");if(cwp_namespace.open_panels.hasOwnProperty(id)){var o=cwp_namespace.open_panels[id];for(var panel in o)jQuery(element).find("[data-panel="+panel+"]").toggleClass("open").next().stop().show()}setChangeHandlers()})),setChangeHandlers()}));
|
1 |
+
var cwp_namespace={php_settings_var:"categoryPosts",widget_class:".category-widget-cont",template_panel_prefix:".categoryposts-data-panel-",open_panels:{},template_change_timer:null,clickHandler:function(element){jQuery(element).toggleClass("open").next().stop().slideToggle();var panel=jQuery(element).data("panel"),id=jQuery(element).parent().parent().parent().parent().parent().attr("id"),o={};this.open_panels.hasOwnProperty(id)&&(o=this.open_panels[id]),o.hasOwnProperty(panel)?delete o[panel]:o[panel]=!0,this.open_panels[id]=o},toggleCatSelection:function(item){var cat=jQuery(item).find("option:selected").attr("value"),panel=item.parentElement.parentElement.parentElement.parentElement;"0"==cat?(jQuery(panel).find(".categoryPosts-title_link").hide(),jQuery(panel).find(".categoryPosts-title_link_url").show(),jQuery(panel).find(".categoryPosts-no_cat_childs").hide()):(jQuery(panel).find(".categoryPosts-title_link").show(),jQuery(panel).find(".categoryPosts-title_link_url").hide(),jQuery(panel).find(".categoryPosts-no_cat_childs").show())},toggleDisableFontStyles:function(item){var panel=item.parentElement.parentElement.parentElement;item.checked?jQuery(panel).find(".categoryPosts-disable_font_styles").hide():jQuery(panel).find(".categoryPosts-disable_font_styles").show()},toggleDateFormat:function(item){var value=jQuery(item).val(),panel=item.parentElement.parentElement;"other"!=value?jQuery(panel).find(".categoryPosts-date_format").hide():jQuery(panel).find(".categoryPosts-date_format").show()},toggleDateRange:function(item){var value=jQuery(item).val(),panel=item.parentElement.parentElement;switch(jQuery(panel).find(".categoryPosts-date-range p").hide(),jQuery(panel).find(".categoryPosts-date-range").show(),value){case"off":jQuery(panel).find(".categoryPosts-date-range").hide();break;case"days_ago":jQuery(panel).find(".categoryPosts-days_ago").show();break;case"between_dates":jQuery(panel).find(".categoryPosts-start_date").show(),jQuery(panel).find(".categoryPosts-end_date").show()}},toggleNoMatch:function(item){var value=jQuery(item).val(),panel=item.parentElement.parentElement;"text"==value?jQuery(panel).find(".categoryPosts-no-match-text").show():jQuery(panel).find(".categoryPosts-no-match-text").hide()},toggleTemplateHelp:function(item,event){event.preventDefault();var panel=item.parentElement.parentElement.parentElement.parentElement;jQuery(panel).find(".cat-post-template-help").toggle("slow")},toggleImageDimensionsHelp:function(item,event){event.preventDefault();var panel=item.parentElement.parentElement.parentElement.parentElement;jQuery(panel).find(".cat-post-image-dimensions-help").toggle("slow")},toggleMoreLinkHelp:function(item,event){event.preventDefault();var panel=item.parentElement.parentElement.parentElement.parentElement;jQuery(panel).find(".cat-post-more-link-help").toggle("slow")},toggleHideTitle:function(item){var panel=item.parentElement.parentElement.parentElement;item.checked?jQuery(panel).find(".categoryposts-data-panel-title-settings").hide():jQuery(panel).find(".categoryposts-data-panel-title-settings").show()},toggleLoadMore:function(item){var panel=item.parentElement.parentElement.parentElement;item.checked?jQuery(panel).find(".loadmore-settings").show():jQuery(panel).find(".loadmore-settings").hide()},selectPremadeTemplate:function(item){var panel=item.parentElement.parentElement.parentElement,div=item.parentElement.parentElement,select=jQuery(div).find("select"),template="%title%";switch(value=select.val(),value){case"title":template="%title%";break;case"title_excerpt":template="%title%\n\n%excerpt%\n\n%more-link%";break;case"title_thumb":template="%title%\n\n%thumb%";break;case"title_thum_excerpt":template="%title%\n\n%thumb%\n%excerpt%\n\n%more-link%";break;case"everything":template="%title%\n\n",template+="%date%\n\n",template+="%thumb%\n",template+='<span class="dashicons dashicons-admin-comments"></span> %commentnum% ',template+='<span class="dashicons dashicons-admin-users"></span> %author%\n',template+="%excerpt%\n\n",template+="%more-link%\n\n",template+="Categories: %category% ",template+='<span class="dashicons dashicons-tag"></span> %post_tag%'}var textarea=jQuery(panel).find("textarea");textarea.val(template),textarea.trigger("input","change")},autoCloseOpenPanels:function(_this){if(tiptoppress[this.php_settings_var].accordion&&!jQuery(_this).hasClass("open")){var jCloseElement=jQuery(_this).parent().find(".open");this.clickHandler(jCloseElement)}},defaultThumbnailSelection:function(elem,title,button_title){var frame=wp.media({title:title,multiple:!1,library:{type:"image"},button:{text:button_title}});return frame.on("close",(function(){var attachments=frame.state().get("selection").toJSON();if(1==attachments.length){var attachment=attachments[0],img_html='<img src="'+attachment.url+'" ';img_html+='width="60" ',img_html+='height="60" ',img_html+="/>",jQuery(elem).parent().prev().find(".default_thumb_img").html(img_html),jQuery(elem).parent().find(".cwp_default_thumb_remove").show(),jQuery(elem).parent().prev().find(".default_thumb_id").val(attachment.id).change()}})),frame.open(),!1},removeDefaultThumbnailSelection:function(elem){return jQuery(elem).parent().prev().find(".default_thumb_img").html(cwp_default_thumb_selection.none),jQuery(elem).hide(),jQuery(elem).parent().prev().find(".default_thumb_id").val(0).change(),!1},templateChange:function(elem){function adjustUiToTemplate(){var template=jQuery(elem).val(),tags=tiptoppress[this.php_settings_var].template_tags,widget_cont=jQuery(elem.parentElement.parentElement.parentElement.parentElement);for(var key in tags)-1!==template.indexOf(tags[key])?widget_cont.find(this.template_panel_prefix+tags[key]).show():widget_cont.find(this.template_panel_prefix+tags[key]).hide()}null!=this.template_change_timer&&clearTimeout(this.template_change_timer),this.template_change_timer=setTimeout(adjustUiToTemplate.bind(this),250)},thumbnailSizeChange:function(elem){var _that=jQuery(elem),thumb_h,thumb_w,_input_thumb_h=_that.closest(".categoryposts-data-panel-thumb").find(".thumb_h"),_input_thumb_w=_that.closest(".categoryposts-data-panel-thumb").find(".thumb_w");return _that.hasClass("smaller")?(thumb_w=_input_thumb_w.val()/1.015,thumb_h=_input_thumb_h.val()/1.015):_that.hasClass("quarter")?(thumb_w=_input_thumb_w.val()/4,thumb_h=_input_thumb_h.val()/4):_that.hasClass("half")?(thumb_h=_input_thumb_h.val()/2,thumb_w=_input_thumb_w.val()/2):_that.hasClass("double")?(thumb_h=2*_input_thumb_h.val(),thumb_w=2*_input_thumb_w.val()):_that.hasClass("bigger")?(thumb_w=1.02*_input_thumb_w.val(),thumb_h=1.02*_input_thumb_h.val()):_that.hasClass("square")?parseInt(_input_thumb_w.val())>=parseInt(_input_thumb_h.val())?(thumb_h=_input_thumb_w.val(),thumb_w=_input_thumb_w.val()):(thumb_h=_input_thumb_h.val(),thumb_w=_input_thumb_h.val()):_that.hasClass("standard")?parseInt(_input_thumb_w.val())>=parseInt(_input_thumb_h.val())?(thumb_h=_input_thumb_w.val()/4*3,thumb_w=_input_thumb_w.val()):(thumb_h=4*_input_thumb_w.val()/3,thumb_w=_input_thumb_w.val()):_that.hasClass("wide")?parseInt(_input_thumb_w.val())>=parseInt(_input_thumb_h.val())?(thumb_h=_input_thumb_w.val()/16*9,thumb_w=_input_thumb_w.val()):(thumb_h=16*_input_thumb_w.val()/9,thumb_w=_input_thumb_w.val()):_that.hasClass("switch")?(thumb_h=_input_thumb_w.val(),thumb_w=_input_thumb_h.val()):_that.hasClass("width")?(thumb_w=0==_input_thumb_w.val()?300:_input_thumb_w.val(),thumb_h=0):_that.hasClass("height")?(thumb_h=0==_input_thumb_h.val()?300:_input_thumb_h.val(),thumb_w=0):_that.hasClass("both")?(thumb_h=0,thumb_w=0):(thumb_w=_that.data("thumb-w"),thumb_h=_that.data("thumb-h")),_input_thumb_w.val(Math.floor(thumb_w)),_input_thumb_h.val(Math.floor(thumb_h)),_input_thumb_w.trigger("input","change"),_input_thumb_h.trigger("input","change"),!1},thumbnailFluidWidthChange:function(elem){var _that=jQuery(elem),_input_thumb_h=_that.closest(".categoryposts-data-panel-thumb").find(".thumb_h");return _that.closest("label").find("span").html(_that.val()+"%"),_input_thumb_h.trigger("input","change"),!1},openAddPlaceholder:function(elem){var _that=jQuery(elem);return _that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").toggle(),_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu span").off("click").on("click",(function(){var text=jQuery(this).data("value");switch(text){case"NewLine":text="\n";break;case"EmptyLine":text="\n\n";break;default:text="%"+text+"%"}var _div=this.parentElement.parentElement.parentElement,textarea=jQuery(_div).find("textarea"),textareaPos=textarea[0].selectionStart,textareaTxt=textarea.val();textarea.val(textareaTxt.substring(0,textareaPos)+text+textareaTxt.substring(textareaPos)),textarea[0].selectionStart=textareaPos+text.length,textarea[0].selectionEnd=textareaPos+text.length,textarea.focus(),textarea.trigger("input","change")})),_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").on("mouseenter",(function(){jQuery(this).addClass("cpw-doNotClose")})),_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").on("mouseleave",(function(){jQuery(this).removeClass("cpw-doNotClose")})),_that.closest(".cat-post-add_premade_templates").find(".cpwp-close-placeholder-dropdown-menu").off("click").on("click",(function(){_that.closest(".cat-post-add_premade_templates").find(".cpwp-placeholder-dropdown-menu").toggle()})),!1},selectPlaceholderHelper:function(elem){var textarea=jQuery(elem),textareaPos=textarea[0].selectionStart,textareaTxt=textarea.val(),nStartSel=textareaTxt.substring(0,textareaPos).lastIndexOf("%"),nEndSel=textareaPos+textareaTxt.substring(textareaPos).indexOf("%")+1,strSelTxt=textareaTxt.substring(nStartSel,nEndSel);return!(strSelTxt.indexOf("\n")>=0||strSelTxt.indexOf(" ")>=0||strSelTxt.length<=2)&&(textarea[0].selectionStart=nStartSel,textarea[0].selectionEnd=nEndSel,!1)}};jQuery(document).ready((function(){var class_namespace=".category-widget-cont";function setChangeHandlers(){jQuery(document).on("click",class_namespace+" .categoryPosts-hide_title input[type=checkbox]",(function(){cwp_namespace.toggleHideTitle(this)})),jQuery(document).on("change",class_namespace+" .categoryposts-data-panel-filter-cat",(function(){cwp_namespace.toggleCatSelection(this)})),jQuery(document).on("change",class_namespace+" .categoryPosts-date_range select",(function(){cwp_namespace.toggleDateRange(this)})),jQuery(".cwp_default_thumb_select").off("click").on("click",(function(){cwp_namespace.defaultThumbnailSelection(this,cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title)})),jQuery(document).on("click",class_namespace+" .cat-post-premade_templates button",(function(){cwp_namespace.selectPremadeTemplate(this)})),jQuery(document).on("change",class_namespace+" .cat-post-premade_templates select",(function(event){event.preventDefault(),event.stopPropagation()})),jQuery(document).on("input",class_namespace+" .categoryPosts-template textarea",(function(){cwp_namespace.templateChange(this)})),jQuery(document).on("change",class_namespace+" .categoryPosts-preset_date_format select",(function(){cwp_namespace.toggleDateFormat(this)})),jQuery(class_namespace+" .cat-post-thumb-change-size button").off("click").on("click",(function(){cwp_namespace.thumbnailSizeChange(this)})),jQuery(document).on("input",class_namespace+" .thumb_fluid_width",(function(){cwp_namespace.thumbnailFluidWidthChange(this)})),jQuery(".cwp_default_thumb_remove").off("click").on("click",(function(){cwp_namespace.removeDefaultThumbnailSelection(this)})),jQuery(class_namespace+" a.toggle-template-help").off("click").on("click",(function(event){cwp_namespace.toggleTemplateHelp(this,event)})),jQuery(class_namespace+" a.toggle-image-dimensions-help").off("click").on("click",(function(event){cwp_namespace.toggleImageDimensionsHelp(this,event)})),jQuery(class_namespace+" a.toggle-more-link-help").off("click").on("click",(function(event){cwp_namespace.toggleMoreLinkHelp(this,event)})),jQuery(class_namespace+" .cpwp-open-placholder-dropdown-menu").off("click").on("click",(function(){cwp_namespace.openAddPlaceholder(this)})),jQuery(document).on("onfocusout, blur",class_namespace+" .cpwp-open-placholder-dropdown-menu,"+class_namespace+" .categoryPosts-template textarea",(function(){jQuery(this).closest(class_namespace+" .categoryPosts-template").parent().find(".cpwp-placeholder-dropdown-menu").not(".cpw-doNotClose").hide()})),jQuery(document).on("click",class_namespace+" .categoryPosts-template textarea",(function(){jQuery(this).closest(class_namespace+" .categoryPosts-template").parent().find(".cpwp-placeholder-dropdown-menu").not(".cpw-doNotClose").hide()})),jQuery(document).on("mousedown",class_namespace+" .categoryPosts-template textarea",(function(){var _that=this;setTimeout((function(){cwp_namespace.selectPlaceholderHelper(_that)}),0)})),jQuery(document).on("click",class_namespace+" .categoryPosts-disable_css input[type=checkbox]",(function(){cwp_namespace.toggleDisableFontStyles(this)})),jQuery(document).on("change",class_namespace+" .categoryPosts-no_match_handling select",(function(){cwp_namespace.toggleNoMatch(this)})),jQuery(document).on("click",class_namespace+" .categoryPosts-enable_loadmore input[type=checkbox]",(function(){cwp_namespace.toggleLoadMore(this)}))}jQuery(".category-widget-cont h4").click((function(){cwp_namespace.autoCloseOpenPanels(this),cwp_namespace.clickHandler(this)})),jQuery(document).on("widget-added widget-updated panelsopen",(function(root,element){jQuery(".category-widget-cont h4").off("click").on("click",(function(){cwp_namespace.autoCloseOpenPanels(this),cwp_namespace.clickHandler(this)})),jQuery(".cwp_default_thumb_select").off("click").on("click",(function(){cwp_namespace.defaultThumbnailSelection(this,cwp_default_thumb_selection.frame_title,cwp_default_thumb_selection.button_title)})),jQuery(".cwp_default_thumb_remove").off("click").on("click",(function(){cwp_namespace.removeDefaultThumbnailSelection(this)}));var id=jQuery(element).attr("id");if(cwp_namespace.open_panels.hasOwnProperty(id)){var o=cwp_namespace.open_panels[id];for(var panel in o)jQuery(element).find("[data-panel="+panel+"]").toggleClass("open").next().stop().show()}setChangeHandlers()})),setChangeHandlers()}));
|
js/frontend/date.js
CHANGED
@@ -7,43 +7,45 @@
|
|
7 |
* Released under the GPLv2 license or later - http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
*/
|
9 |
|
10 |
-
if (typeof jQuery !== 'undefined')
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
}
|
7 |
* Released under the GPLv2 license or later - http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
*/
|
9 |
|
10 |
+
if (typeof jQuery !== 'undefined') {
|
11 |
|
12 |
+
jQuery(document).ready(function() {
|
13 |
+
var $elements = jQuery('.cat-post-item .cat-post-date[data-publishtime]');
|
14 |
+
if (0 !== $elements) {
|
15 |
+
/**
|
16 |
+
* Adjust the dates for the items indicated in the $elements
|
17 |
+
* array.
|
18 |
+
*
|
19 |
+
* @param array $elements array of dom elements.
|
20 |
+
*/
|
21 |
+
var adjustlocalizeddate = function($elements) {
|
22 |
+
$elements.each(function() {
|
23 |
+
var $this = jQuery(this);
|
24 |
+
var time = $this.data('publishtime') * 1000; // new Date() requires time in ms.
|
25 |
+
var format = $this.data('format');
|
26 |
+
var orig_date = new Date(time);
|
27 |
+
switch (format) {
|
28 |
+
case 'date':
|
29 |
+
$this.text(orig_date.toLocaleDateString());
|
30 |
+
break;
|
31 |
+
case 'time':
|
32 |
+
$this.text(orig_date.toLocaleDateString() + ' ' +
|
33 |
+
orig_date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) // Eliminate seconds.
|
34 |
+
);
|
35 |
+
break;
|
36 |
+
case 'sincepublished':
|
37 |
+
break;
|
38 |
+
}
|
39 |
+
});
|
40 |
+
}
|
41 |
|
42 |
+
adjustlocalizeddate($elements);
|
43 |
|
44 |
+
// Wait for catposts.load_more event that load more triggers when for
|
45 |
+
// mewly added item, and localize the date if needed.
|
46 |
+
jQuery('ul').on('catposts.load_more', '.cat-post-item', function() {
|
47 |
+
adjustlocalizeddate(jQuery(this).find('.cat-post-date[data-publishtime]'));
|
48 |
+
});
|
49 |
+
}
|
50 |
+
});
|
51 |
}
|
js/frontend/date.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
"undefined"!=typeof jQuery&&jQuery(document).ready(function(){var
|
1 |
+
"undefined"!=typeof jQuery&&jQuery(document).ready((function(){var $elements=jQuery(".cat-post-item .cat-post-date[data-publishtime]");if(0!==$elements){var adjustlocalizeddate=function($elements){$elements.each((function(){var $this=jQuery(this),time=1e3*$this.data("publishtime"),format=$this.data("format"),orig_date=new Date(time);switch(format){case"date":$this.text(orig_date.toLocaleDateString());break;case"time":$this.text(orig_date.toLocaleDateString()+" "+orig_date.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}))}}))};adjustlocalizeddate($elements),jQuery("ul").on("catposts.load_more",".cat-post-item",(function(){adjustlocalizeddate(jQuery(this).find(".cat-post-date[data-publishtime]"))}))}}));
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: mark-k, kometschuh, mkrdip
|
|
3 |
Donate link: https://wordpress.org/support/plugin/category-posts/reviews/
|
4 |
Tags: category, categories, posts, widget, posts widget, recent posts, category recent posts, shortcode, sidebar, excerpt, multiple widgets
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 4.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -101,7 +101,14 @@ For more layout options please try our premium widget: [Term and Category based
|
|
101 |
For SVG font-icon HTML we recommend the [WordPress Dashicons](https://developer.wordpress.org/resource/dashicons/), which are included as default and can be used without any font-icon including.
|
102 |
|
103 |
= How to use Page Bilder plugins like Divi, SiteOrigin Page Builder or Elementor =
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
= Parse error: syntax error, unexpected T_FUNCTION in /home/www/blog/wp-content/plugins/category-posts/cat-posts.php on line 58 =
|
107 |
Some of the features that were used in that version needs PHP 5.3+.
|
@@ -112,11 +119,6 @@ We know there are peopel how use PHP 5.2 [wordpress.org/about/stats](https://wor
|
|
112 |
= You check the PHP version with phpversion(), but the widget don't work =
|
113 |
Check also the .htaccess file, if there is an entry for an older PHP version.
|
114 |
|
115 |
-
= Excerpt length in lines don't work with FireFox and IE =
|
116 |
-
We use for Excerpt length in lines a CSS feature called "line-clamp" which isn't supported in FireFox and IE at the moment.
|
117 |
-
But since it is supported by all other browsers, we think it will be supported in FireFox and IE soon.
|
118 |
-
The FireFox browser has a coverage of 5%, which we find little. For this 5%, we have included a polyfill in our [Excerpt Extension add-on](https://wordpress.org/plugins/excerpt-extension/).
|
119 |
-
|
120 |
== Screenshots ==
|
121 |
1. Front end of the widget with SVG font-icon support for post formats, hover effects and the Template text-area.
|
122 |
2. Template to arrange the post details with placeholders.
|
@@ -128,6 +130,9 @@ The FireFox browser has a coverage of 5%, which we find little. For this 5%, we
|
|
128 |
== Changelog ==
|
129 |
[Read more on our blog ...](http://tiptoppress.com/category/category-posts-widget)
|
130 |
|
|
|
|
|
|
|
131 |
= 4.9.7 - November 21th 2020 =
|
132 |
* Item title in lines (line-clamp)
|
133 |
* Fixed Column layout
|
3 |
Donate link: https://wordpress.org/support/plugin/category-posts/reviews/
|
4 |
Tags: category, categories, posts, widget, posts widget, recent posts, category recent posts, shortcode, sidebar, excerpt, multiple widgets
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 5.6
|
7 |
+
Stable tag: 4.9.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
101 |
For SVG font-icon HTML we recommend the [WordPress Dashicons](https://developer.wordpress.org/resource/dashicons/), which are included as default and can be used without any font-icon including.
|
102 |
|
103 |
= How to use Page Bilder plugins like Divi, SiteOrigin Page Builder or Elementor =
|
104 |
+
Read more about Page Builder plugins at our [FAQs](http://tiptoppress.com/faqs/)
|
105 |
+
|
106 |
+
= The font-size is different from that of other widgets or Theme elements? =
|
107 |
+
Use the option: 'Disable only font style' in the General panel.
|
108 |
+
|
109 |
+
= I want the title as a link pointing to the selected Categorie page? =
|
110 |
+
Is just a single category selected in the Filter panel: Enable the check box "Make widget title link".
|
111 |
+
Is 'All categories' selected in the Filter panel: Use the text field 'Title link URL'.
|
112 |
|
113 |
= Parse error: syntax error, unexpected T_FUNCTION in /home/www/blog/wp-content/plugins/category-posts/cat-posts.php on line 58 =
|
114 |
Some of the features that were used in that version needs PHP 5.3+.
|
119 |
= You check the PHP version with phpversion(), but the widget don't work =
|
120 |
Check also the .htaccess file, if there is an entry for an older PHP version.
|
121 |
|
|
|
|
|
|
|
|
|
|
|
122 |
== Screenshots ==
|
123 |
1. Front end of the widget with SVG font-icon support for post formats, hover effects and the Template text-area.
|
124 |
2. Template to arrange the post details with placeholders.
|
130 |
== Changelog ==
|
131 |
[Read more on our blog ...](http://tiptoppress.com/category/category-posts-widget)
|
132 |
|
133 |
+
= 4.9.8 - November 30th 2020 =
|
134 |
+
* Date since published for n-days
|
135 |
+
|
136 |
= 4.9.7 - November 21th 2020 =
|
137 |
* Item title in lines (line-clamp)
|
138 |
* Fixed Column layout
|