authors
8 years ago
contact-info
5 years ago
eu-cookie-law
4 years ago
facebook-likebox
11 years ago
flickr
4 years ago
gallery
4 years ago
goodreads
5 years ago
google-translate
4 years ago
image-widget
8 years ago
instagram
6 years ago
migrate-to-core
3 years ago
milestone
3 years ago
my-community
8 years ago
simple-payments
4 years ago
social-icons
4 years ago
social-media-icons
5 years ago
top-posts
8 years ago
wordpress-post-widget
3 years ago
authors.php
3 years ago
blog-stats.php
3 years ago
class-jetpack-eu-cookie-law-widget.php
3 years ago
class-jetpack-instagram-widget.php
3 years ago
contact-info.php
3 years ago
customizer-controls.css
9 years ago
customizer-utils.js
6 years ago
facebook-likebox.php
3 years ago
flickr.php
3 years ago
gallery.php
3 years ago
goodreads.php
3 years ago
google-translate.php
3 years ago
gravatar-profile.css
10 years ago
gravatar-profile.php
3 years ago
image-widget.php
3 years ago
internet-defense-league.php
3 years ago
mailchimp.php
3 years ago
milestone.php
5 years ago
my-community.php
3 years ago
rsslinks-widget.php
3 years ago
simple-payments.php
3 years ago
social-icons.php
3 years ago
social-media-icons.php
3 years ago
top-posts.php
3 years ago
twitter-timeline-admin.js
6 years ago
twitter-timeline.php
3 years ago
upcoming-events.php
3 years ago
wordpress-post-widget.php
4 years ago
twitter-timeline-admin.js
67 lines
| 1 | jQuery( function ( $ ) { |
| 2 | function twitterWidgetTypeChanged( widgetTypeSelector ) { |
| 3 | var selectedType = $( widgetTypeSelector ).val(); |
| 4 | $( widgetTypeSelector ) |
| 5 | .closest( '.jetpack-twitter-timeline-widget-type-container' ) |
| 6 | .next( '.jetpack-twitter-timeline-widget-id-container' ) |
| 7 | .find( 'label' ) |
| 8 | .css( 'display', function () { |
| 9 | var labelType = $( this ).data( 'widget-type' ); |
| 10 | if ( selectedType === labelType ) { |
| 11 | return ''; |
| 12 | } else { |
| 13 | return 'none'; |
| 14 | } |
| 15 | } ); |
| 16 | } |
| 17 | |
| 18 | function twitterWidgetTweetDisplayChanged( event ) { |
| 19 | var $tweetDisplaySelector = $( event.target ); |
| 20 | var selectedTweetDisplay = $tweetDisplaySelector.val(); |
| 21 | var $form = $tweetDisplaySelector.closest( 'form' ); |
| 22 | var $heightContainer = $form.find( '.jetpack-twitter-timeline-widget-height-container' ); |
| 23 | var $tweetLimitContainer = $form.find( |
| 24 | '.jetpack-twitter-timeline-widget-tweet-limit-container' |
| 25 | ); |
| 26 | var $scrollbarInput = $form.find( 'input[id*=chrome-noscrollbar]' ); |
| 27 | switch ( selectedTweetDisplay ) { |
| 28 | case 'fixed': |
| 29 | $heightContainer.hide(); |
| 30 | $tweetLimitContainer.show(); |
| 31 | $scrollbarInput.prop( 'disabled', true ); |
| 32 | break; |
| 33 | case 'dynamic': |
| 34 | $tweetLimitContainer.hide(); |
| 35 | $heightContainer.show(); |
| 36 | $scrollbarInput.prop( 'disabled', false ); |
| 37 | break; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // We could either be in wp-admin/widgets.php or the Customizer. |
| 42 | var $container = $( '#customize-controls' ); |
| 43 | if ( ! $container.length ) { |
| 44 | $container = $( '#wpbody' ); |
| 45 | } |
| 46 | |
| 47 | // Observe widget settings for 'change' events of the 'type' property for |
| 48 | // current and future Twitter timeline widgets. |
| 49 | $container.on( 'change', '.jetpack-twitter-timeline-widget-type', function () { |
| 50 | twitterWidgetTypeChanged( this ); |
| 51 | } ); |
| 52 | |
| 53 | // Set the labels for currently existing widgets (including the "template" |
| 54 | // version that is copied when a new widget is added). |
| 55 | $container.find( '.jetpack-twitter-timeline-widget-type' ).each( function () { |
| 56 | twitterWidgetTypeChanged( this ); |
| 57 | } ); |
| 58 | |
| 59 | // Observe widget settings for 'change' events of the 'tweet-display' property for |
| 60 | // current and future Twitter timeline widgets. |
| 61 | $container.on( |
| 62 | 'change', |
| 63 | '.jetpack-twitter-timeline-widget-tweet-display-radio', |
| 64 | twitterWidgetTweetDisplayChanged |
| 65 | ); |
| 66 | } ); |
| 67 |