1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 $(document).ready(function() { 33 $.ajax({ 34 url: "https://ws.iadsnetwork.com/syndicatedfeeds.svc/GetSyndicatedItems?feedslug=united-states&count=10", 35 data: { }, 36 dataType: "json", 37 type: "GET", 38 contentType: "application/json; charset=utf-8", 39 success: function (data) { 40 if (data.d != null) { 41 var dtHeadlines = data.d; 42 for (i = 0; i < dtHeadlines.length; i++) { 43 $("#webads-national-headlines-widget").append('<div class="fl-post-carousel-post" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><div class="fl-post-carousel-text"><h2 class="fl-post-carousel-title" itemprop="headline"><a href="' + dtHeadlines[i].url + '" target="_blank" title="' + dtHeadlines[i].title + '">' + dtHeadlines[i].title + '</a></h2><div class="fl-post-carousel-meta"><span class="fl-post-feed-date">' + dtHeadlines[i].pubdate + '</span></div></div></div>'); 44 } 45 } 46 }, 47 error: function (d) { 48 //alert("Error"); 49 } 50 }); 51 52 var delay = 1000; 53 setTimeout(function() { 54 55 WAFLBuilderPostCarousel = function (settings) { 56 this.settings = settings.settings; 57 this.transitionType = settings.transition; 58 this.nodeClass = '.fl-node-' + settings.id; 59 this.wrapperClass = this.nodeClass + ' .fl-post-carousel-wrapper'; 60 this.postClass = this.nodeClass + ' .fl-post-carousel-post'; 61 this.prevCarouselBtn = $(this.nodeClass + ' .carousel-prev'); 62 this.nextCarouselBtn = $(this.nodeClass + ' .carousel-next'); 63 this.layout = settings.layout; 64 this.navigation = settings.navigationControls; 65 this.slideWidth = settings.slideWidth; 66 this.currentBrowserWidth = $(window).width(); 67 if (this._hasPosts()) { 68 //alert('yes'); 69 this._initCarousel(); 70 $(window).on('resize', function (e) { 71 var width = $(window).width(); 72 if (width != this.currentBrowserWidth) { 73 this._resizeDebounce(); 74 this.currentBrowserWidth = width; 75 } 76 }.bind(this)); 77 } else { 78 //alert('no'); 79 } 80 }; 81 WAFLBuilderPostCarousel.prototype = { 82 settings: {}, 83 nodeClass: '', 84 wrapperClass: '', 85 postClass: '', 86 prevCarouselBtn: '', 87 nextCarouselBtn: '', 88 layout: '', 89 navigation: false, 90 slideWidth: 0, 91 carousel: '', 92 _hasPosts: function () { 93 return $(this.postClass).length > 0; 94 }, 95 _resizeDebounce: function () { 96 clearTimeout(this.resizeTimer); 97 this.resizeTimer = setTimeout(function () { 98 this._reloadCarousel(); 99 }.bind(this), 250); 100 }, 101 _getSlidesNumber: function () { 102 var $wrapperWidth = $(this.nodeClass + ' .fl-post-carousel').width(), $slideWidth = $(this.postClass).width(), columns = Math.ceil($wrapperWidth / this.slideWidth); 103 return columns; 104 }, 105 _getSlideWidth: function () { 106 return Math.ceil(($(this.nodeClass + ' .fl-post-carousel').width() - (this.settings.slideMargin * (this._getSlidesNumber() - 1))) / this._getSlidesNumber()); 107 }, 108 _getSettings: function () { 109 var newSettings, settings = { 110 slideWidth: this._getSlideWidth(), 111 minSlides: this._getSlidesNumber(), 112 maxSlides: this._getSlidesNumber(), 113 onSliderLoad: function () { 114 $(this.wrapperClass).addClass('fl-post-carousel-loaded'); 115 }.bind(this), 116 } 117 newSettings = $.extend({}, this.settings, settings); 118 return newSettings; 119 }, 120 _initCarousel: function () { 121 this.carousel = $(this.wrapperClass).bxSlider( 122 this._getSettings() 123 124 ); 125 if (this.navigation) { 126 this.prevCarouselBtn.on('click', function (e) { 127 e.preventDefault(); 128 this.carousel.goToPrevSlide(); 129 }.bind(this)); 130 this.nextCarouselBtn.on('click', function (e) { 131 e.preventDefault(); 132 this.carousel.goToNextSlide(); 133 }.bind(this)); 134 } 135 },
136 _reloadCarousel: function () { 137 this.carousel.reloadSlider(this._getSettings()); 138 }, 139 }; 140 141 new WAFLBuilderPostCarousel({ 142 id: '593ae829a39ce', 143 layout: 'grid', 144 slideWidth: 300, 145 settings: { 146 auto: true, 147 pause: 5000, 148 speed: 1000, 149 infiniteLoop: true, 150 adaptiveHeight: true, 151 controls: false, 152 autoHover: true, 153 slideMargin: 30, 154 moveSlides: 1, 155 } 156 }); 157 }, delay); 158 }); 159 160})( jQuery ); 161 162 163 164 165
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.