blocks
4 years ago
build
4 years ago
fonts
8 years ago
genericons
6 years ago
lib
4 years ago
social-logos
5 years ago
accessible-focus.js
5 years ago
class.jetpack-provision.php
4 years ago
connect-button.js
4 years ago
crowdsignal-shortcode.js
5 years ago
crowdsignal-survey.js
5 years ago
facebook-embed.js
5 years ago
gallery-settings.js
5 years ago
genericons.php
11 years ago
header.php
7 years ago
jetpack-admin.js
5 years ago
jetpack-connection-banner.js
5 years ago
jetpack-deactivate-dialog.js
5 years ago
jetpack-modules.js
5 years ago
jetpack-modules.models.js
6 years ago
jetpack-modules.views.js
5 years ago
jetpack-recommendations-banner.js
5 years ago
jetpack-server-sandbox.php
6 years ago
jquery.jetpack-resize.js
5 years ago
polldaddy-shortcode.js
5 years ago
postmessage.js
5 years ago
social-logos.php
5 years ago
twitter-timeline.js
5 years ago
polldaddy-shortcode.js
75 lines
| 1 | ( function ( $ ) { |
| 2 | window.polldaddyshortcode = { |
| 3 | render: function () { |
| 4 | var ratings = $( 'div.pd-rating[data-settings]' ); |
| 5 | var polls = $( 'div.PDS_Poll[data-settings]' ); |
| 6 | |
| 7 | if ( polls ) { |
| 8 | $.each( polls, function () { |
| 9 | var poll = $( this ).data( 'settings' ); |
| 10 | |
| 11 | if ( poll ) { |
| 12 | var poll_url = document.createElement( 'a' ); |
| 13 | poll_url.href = poll[ 'url' ]; |
| 14 | if ( |
| 15 | poll_url.hostname != 'secure.polldaddy.com' && |
| 16 | poll_url.hostname != 'static.polldaddy.com' |
| 17 | ) { |
| 18 | return false; |
| 19 | } |
| 20 | var pathname = poll_url.pathname; |
| 21 | if ( ! /\/?p\/\d+\.js/.test( pathname ) ) { |
| 22 | return false; |
| 23 | } |
| 24 | var wp_pd_js = document.createElement( 'script' ); |
| 25 | wp_pd_js.type = 'text/javascript'; |
| 26 | wp_pd_js.src = poll[ 'url' ]; |
| 27 | wp_pd_js.charset = 'utf-8'; |
| 28 | wp_pd_js.async = true; |
| 29 | document.getElementsByTagName( 'head' )[ 0 ].appendChild( wp_pd_js ); |
| 30 | } |
| 31 | } ); |
| 32 | } |
| 33 | |
| 34 | if ( ratings ) { |
| 35 | var script = ''; |
| 36 | |
| 37 | $.each( ratings, function () { |
| 38 | var rating = $( this ).data( 'settings' ); |
| 39 | |
| 40 | if ( rating ) { |
| 41 | script += |
| 42 | 'PDRTJS_settings_' + |
| 43 | rating[ 'id' ] + |
| 44 | rating[ 'item_id' ] + |
| 45 | '=' + |
| 46 | rating[ 'settings' ] + |
| 47 | "; if ( typeof PDRTJS_RATING !== 'undefined' ){ if ( typeof PDRTJS_" + |
| 48 | rating[ 'id' ] + |
| 49 | rating[ 'item_id' ] + |
| 50 | "=='undefined' ){PDRTJS_" + |
| 51 | rating[ 'id' ] + |
| 52 | rating[ 'item_id' ] + |
| 53 | '= new PDRTJS_RATING( PDRTJS_settings_' + |
| 54 | rating[ 'id' ] + |
| 55 | rating[ 'item_id' ] + |
| 56 | ' );}}'; |
| 57 | } |
| 58 | } ); |
| 59 | |
| 60 | if ( script.length > 0 ) |
| 61 | $( '#polldaddyRatings' ).after( |
| 62 | "<script type='text/javascript' charset='utf-8' id='polldaddyDynamicRatings'>" + |
| 63 | script + |
| 64 | '</script>' |
| 65 | ); |
| 66 | } |
| 67 | }, |
| 68 | }; |
| 69 | |
| 70 | $( 'body' ).on( 'post-load pd-script-load', function () { |
| 71 | window.polldaddyshortcode.render(); |
| 72 | } ); |
| 73 | $( 'body' ).trigger( 'pd-script-load' ); |
| 74 | } )( jQuery ); |
| 75 |