From ffdb170119ec54181b82a859cc7825fb964d0dbd Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Sun, 14 Apr 2024 13:48:56 -0500 Subject: [PATCH] Minior CSS & JS modernizing --- src/css/post-styles.css | 16 ++++++---------- src/js/ajax.js | 16 ++++++++-------- src/js/tabs.js | 8 ++++---- src/wp-to-twitter.php | 34 +++++++++++++++++++++++----------- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/src/css/post-styles.css b/src/css/post-styles.css index 40b8135..f262589 100644 --- a/src/css/post-styles.css +++ b/src/css/post-styles.css @@ -192,21 +192,17 @@ button.time div { } .wpt_log, #wpt_set_tweet_time { - padding: .5em; + padding: .5rem 0; } #wpt_set_tweet_time { - background: #f6f6f6; - color: #333; + display: flex; } -.tweet-buttons { - display: grid; - grid-template-columns: 48% 34% 18%; - column-gap: 2px; - padding: .75em 12px; - margin: -6px -14px 0; - background: #f3f3f3; +.tweet-buttons .wpt-buttons { + display: flex; + flex-wrap: wrap; + gap: 3px; } .wpt-wrap { diff --git a/src/js/ajax.js b/src/js/ajax.js index 7fe68f1..05ac588 100644 --- a/src/js/ajax.js +++ b/src/js/ajax.js @@ -14,19 +14,19 @@ } ); $('button.tweet').on('click', function (e) { - visible = $( '.wpt_log' ).is( ':visible' ); + let visible = $( '.wpt_log' ).is( ':visible' ); if ( visible ) { $( '.wpt_log' ).hide( 200 ); } e.preventDefault(); - var text = $('#wpt_custom_tweet').val(); - var date = $('#wpt_set_tweet_time .date').val(); - var time = $('#wpt_set_tweet_time .time').val(); - var auth = $('#wpt_authorized_users').val(); + let text = $('#wpt_custom_tweet').val(); + let date = $('#wpt_set_tweet_time .date').val(); + let time = $('#wpt_set_tweet_time .time').val(); + let auth = $('#wpt_authorized_users').val(); - var upload = $('input:radio[name=_wpt_image]:checked').val(); - var tweet_action = ( $(this).attr('data-action') === 'tweet' ) ? 'tweet' : 'schedule' - var data = { + let upload = $('input:radio[name=_wpt_image]:checked').val(); + let tweet_action = ( $(this).attr('data-action') === 'tweet' ) ? 'tweet' : 'schedule' + let data = { 'action': wpt_data.action, 'tweet_post_id': wpt_data.post_ID, 'tweet_text': text, diff --git a/src/js/tabs.js b/src/js/tabs.js index 83917e9..68c8f99 100644 --- a/src/js/tabs.js +++ b/src/js/tabs.js @@ -1,5 +1,5 @@ jQuery(document).ready(function ($) { - var tabs = $('.wpt-settings .wptab').length; + const tabs = $('.wpt-settings .wptab').length; $('.wpt-settings .tabs a[href="#' + wpt.firstItem + '"]').addClass('active').attr( 'aria-selected', 'true' ); if (tabs > 1) { $('.wpt-settings .wptab').not('#' + wpt.firstItem).hide(); @@ -7,13 +7,13 @@ jQuery(document).ready(function ($) { e.preventDefault(); $('.wpt-settings .tabs a').removeClass('active').attr( 'aria-selected', 'false' ); $(this).addClass('active').attr( 'aria-selected', 'true' ); - var target = $(this).attr('href'); + let target = $(this).attr('href'); $('.wpt-settings .wptab').not(target).hide(); $(target).show().attr( 'tabindex', '-1' ).focus(); }); }; - var permissions = $('.wpt-permissions .wptab').length; + const permissions = $('.wpt-permissions .wptab').length; $('.wpt-permissions .tabs a[href="#' + wpt.firstPerm + '"]').addClass('active').attr( 'aria-selected', 'true' ); if (permissions > 1) { $('.wpt-permissions .wptab').not('#' + wpt.firstPerm).hide(); @@ -21,7 +21,7 @@ jQuery(document).ready(function ($) { e.preventDefault(); $('.wpt-permissions .tabs a').removeClass('active').attr( 'aria-selected', 'false' ); $(this).addClass('active').attr( 'aria-selected', 'true' ); - var target = $(this).attr('href'); + let target = $(this).attr('href'); $('.wpt-permissions .wptab').not(target).hide(); $(target).show().attr( 'tabindex', '-1' ).focus(); }); diff --git a/src/wp-to-twitter.php b/src/wp-to-twitter.php index 60e13e3..eb88759 100644 --- a/src/wp-to-twitter.php +++ b/src/wp-to-twitter.php @@ -1442,23 +1442,35 @@ function wpt_add_twitter_inner_box( $post ) { if ( 'publish' === $status && ( current_user_can( 'wpt_tweet_now' ) || current_user_can( 'manage_options' ) ) ) { ?>
- - + + + + + - - +
+
- -
- - +
+ +
+
+
+ + +