1void ( function ( d, s, id ) { 2 var js, 3 fjs = d.getElementsByTagName( s )[ 0 ], 4 p = /^http:/.test( d.location ) ? 'http' : 'https'; 5 if ( ! d.getElementById( id ) ) { 6 js = d.createElement( s ); 7 js.id = id; 8 js.src = p + '://platform.twitter.com/widgets.js'; 9 fjs.parentNode.insertBefore( js, fjs ); 10 } 11} )( document, 'script', 'twitter-wjs' ); 12; 13( function () { 14 'use strict'; 15 16 if ( typeof window.wpcom === 'undefined' ) { 17 window.wpcom = {}; 18 } 19 20 if ( window.wpcom.carousel ) { 21 return; 22 } 23 24 var prebuilt_widths = jetpackCarouselStrings.widths; 25 var pageviews_stats_args = jetpackCarouselStrings.stats_query_args; 26 27 var findFirstLargeEnoughWidth = function ( original_w, original_h, dest_w, dest_h ) { 28 var inverse_ratio = original_h / original_w; 29 30 for ( var i = 0; i < prebuilt_widths.length; ++i ) { 31 if ( prebuilt_widths[ i ] >= dest_w || prebuilt_widths[ i ] * inverse_ratio >= dest_h ) { 32 return prebuilt_widths[ i ]; 33 } 34 } 35 36 return original_w; 37 }; 38 39 var removeResizeFromImageURL = function ( url ) { 40 return removeArgFromURL( url, 'resize' ); 41 }; 42 43 var removeArgFromURL = function ( url, arg ) { 44 var re = new RegExp( '[\\?&]' + arg + '(=[^?&]+)?' ); 45 if ( url.match( re ) ) { 46 return url.replace( re, '' ); 47 } 48 return url; 49 }; 50 51 var addWidthToImageURL = function ( url, width ) { 52 width = parseInt( width, 10 ); 53 // Give devices with a higher devicePixelRatio higher-res images (Retina display = 2, Android phones = 1.5, etc) 54 if ( 'undefined' !== typeof window.devicePixelRatio && window.devicePixelRatio > 1 ) { 55 width = Math.round( width * window.devicePixelRatio ); 56 } 57 url = addArgToURL( url, 'w', width ); 58 url = addArgToURL( url, 'h', '' ); 59 return url; 60 }; 61 62 var addArgToURL = function ( url, arg, value ) { 63 var re = new RegExp( arg + '=[^?&]+' ); 64 if ( url.match( re ) ) { 65 return url.replace( re, arg + '=' + value ); 66 } else { 67 var divider = url.indexOf( '?' ) !== -1 ? '&' : '?'; 68 return url + divider + arg + '=' + value; 69 } 70 }; 71 72 var stat = function ( names ) { 73 if ( typeof names !== 'string' ) { 74 names = names.join( ',' ); 75 } 76 77 new Image().src = window.location.protocol + 78 '//pixel.wp.com/g.gif?v=wpcom-no-pv' + 79 '&x_carousel=' + names + 80 '&baba=' + Math.random(); 81 }; 82 83 var lastTrackedPostId = null; 84 85 var pageview = function ( post_id ) { 86 // Prevent duplicate tracking of the same post during slide transitions 87 if ( post_id === lastTrackedPostId ) { 88 return; 89 } 90 91 lastTrackedPostId = post_id; 92 93 new Image().src = window.location.protocol + 94 '//pixel.wp.com/g.gif?host=' + encodeURIComponent( window.location.host ) + 95 '&ref=' + encodeURIComponent( document.referrer ) + 96 '&rand=' + Math.random() + 97 '&' + pageviews_stats_args + 98 '&post=' + encodeURIComponent( post_id ); 99 }; 100 101 var generateImgSrc = function ( srcItem, max ) { 102 var origSize = srcItem.getAttribute( 'data-orig-size' ) || ''; 103 104 var src = srcItem.getAttribute( 'src' ) || srcItem.getAttribute( 'original' ) || srcItem.getAttribute( 'data-original' ) || srcItem.getAttribute( 'data-lazy-src' ); 105 if ( src.indexOf( 'imgpress' ) !== -1 ) { 106 src = srcItem.getAttribute( 'data-orig-file' ); 107 } 108 // Square/Circle galleries use a resize param that needs to be removed. 109 src = removeResizeFromImageURL( src ); 110 src = addWidthToImageURL( 111 src, 112 findFirstLargeEnoughWidth( origSize.width, origSize.height, max.width, max.height ) 113 ); 114 115 return src; 116 }; 117 118 window.wpcom.carousel = { 119 findFirstLargeEnoughWidth: findFirstLargeEnoughWidth, 120 removeResizeFromImageURL: removeResizeFromImageURL, 121 addWidthToImageURL: addWidthToImageURL, 122 stat: stat, 123 pageview: pageview, 124 generateImgSrc: generateImgSrc 125 }; 126 127} )(); 128;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.