1// Javascript for branded web components 2 $(document).ready(function(){ 3 $.ajaxSetup({ 4 timeout: 10000 5 }); 6 // added YKimura 08-20-2015 for keyboard accessibility 7 // hide megamenu when tabbed away from 8 $(document).keyup(function(event) { 9 if (event.which == 9 && !$(event.target).parent('.dropdown-menu li').length) { 10 $(".dropdown-menu").slideUp("fast"); 11 } 12 }); 13 14 // Load Twitter feed dynamically 15 $('.twitter-feed').each(function() { 16 var compName = $(this).attr('id'); 17 $(this).find('.livefeed').html('<h4 class="loading" style="text-align:center; padding-top:20px;">Loading...</h4>').load('/twitter/index/'+compName, function( response, status, xhr ) { 18 }); 19 }); 20 21 // Load Instagram feeds dynamically 22 $('.instagram-feed').each(function() { 23 var compName = $(this).attr('id'); 24 $(this).find('.livefeed').html('<h4 class="loading" style="text-align:center; padding-top:20px;">Loading...</h4>').load('/instagram/index/'+compName, function( response, status, xhr ) { 25// console.log('STATUS: ' + xhr.status + " " + xhr.statusText ); 26 }); 27 }); 28 29 // Load Blog feed dynamically 30 var blogComp = $('.blog-feed').attr('id'); 31 $('.blog-feed .block').html('<h4 class="loading" style="text-align:center; padding-top:20px;">Loading...</h4>').load('/blog/index/'+blogComp); 32 33 // Load News feed dynamically 34 var newsComp = $('.news-feed').attr('id'); 35 $('.news-feed .block').html('<h4 class="loading" style="text-align:center; padding-top:20px;">Loading...</h4>').load('/livenews/index/'+newsComp); 36 37 // Large Carousel 38 var largeOwl = $("#carouselHome"); 39 largeOwl.owlCarousel({ 40 41 nav : true, // Show next and prev buttons 42 navText:[ "<span class='entypo chevron-thin-left'></span>", "<span class='entypo chevron-thin-right'></span>" ], 43 slideSpeed : 300, 44 paginationSpeed : 400, 45 scrollPerPage: true, 46 items : 1, 47 loop: true, 48 navElement:'button', 49 singleItem:true 50 51 }); 52 53 // Header Carousel 54 var headerOwl = $("#carouselLanding"); 55 headerOwl.owlCarousel({ 56 57 nav : true, // Show next and prev buttons 58 navText:[ "<span class='entypo chevron-thin-left'></span>", "<span class='entypo chevron-thin-right'></span>" ], 59 slideSpeed : 300, 60 paginationSpeed : 400, 61 scrollPerPage: true, 62 items : 1, 63 loop: true, 64 navElement:'button', 65 singleItem:true 66 67 }); 68 69 // Multi Item Carousel 70 var threeItemOwl = $("#carouselMultiItems"); 71 threeItemOwl.owlCarousel({ 72 73 nav : true, // Show next and prev buttons 74 navText:[ "<span class='entypo chevron-thin-left'></span>", "<span class='entypo chevron-thin-right'></span>" ], 75 slideSpeed : 300, 76 paginationSpeed : 400, 77 scrollPerPage: true, 78 singleItem:false, 79 items : 3, 80 loop: true, 81 itemsDesktop : [1199,3], 82 itemsDesktopSmall : [979,3], 83 itemsMobile : true 84 // "singleItem:true" is a shortcut for: 85 // items : 1, 86 // itemsDesktop : false, 87 // itemsDesktopSmall : false, 88 // itemsTablet: false, 89 // itemsMobile : false 90 91 }); 92 93 $('#og-more-toggle').click(function(){ 94 $('#ogDrawer').slideDown('fast'); 95 return false; 96 }); 97 98 // Modal Carousel 99 $('.slideshow-modal').click(function(){ 100 $('#modalSlideshow').modal('show'); 101 return false; 102 }); 103 104 // Modal Timeline Slideshow - added ykimura Nov 4, 2014 105 $('.slideshow-modal').click(function(){ 106 var target_modal_id_str = $(this).data("target"); 107 $(target_modal_id_str).modal('show'); 108 $(target_modal_id_str).on('shown.bs.modal', function (e) { 109 var thisID = target_modal_id_str.substring(16); 110// alert('entry id='+thisID); 111 var modalOwl = $("#carouselModal-"+thisID); 112 modalOwl.owlCarousel({ 113 nav : true, // Show next and prev buttons 114 navText:[ "<span class='entypo chevron-thin-left'></span>", "<span class='entypo chevron-thin-right'></span>" ], 115 slideSpeed : 300, 116 paginationSpeed : 400, 117 loop: true, 118 items : 1, 119 scrollPerPage: true, 120 singleItem:true 121 }); 122 }); 123 return false; 124 }); 125 126 // Thumbnail Grid with Expanding Captions 127 var squareGrid = Grid( $('#og-grid') ); 128 squareGrid.init(); 129 130 var circleGrid = Grid( $('#og-grid-02') ); 131 circleGrid.init(); 132 133 $('.og-more-toggle').click(function(){ 134 $(this).parent().siblings('.ogDrawer').slideDown('fast'); 135 return false; 136 }); 137 138 // Activate video modal 139 $('.video-modal-trigger').click(function() { 140 var target_modal_id_str = $(this).data("target"); 141 $(target_modal_id_str).modal(options); 142 var options = { 143 "backdrop" : "static", 144 "show" :true, 145 "keyboard" : true 146 } 147 return false; 148 }); 149 $('.shareemail').click(function(e){
150 e.preventDefault(); 151 var vidURL = $(this).attr("name"); 152 var thisID = $(this).parents(".modal").attr("id").substr(10); 153 $('#tellafriend'+thisID+' pre').append(vidURL); 154 $('#tellafriend'+thisID).show(); 155 $('#video-container'+thisID).hide(); 156 }); 157 158 $('.shareemail-hero').click(function(e){ 159 e.preventDefault(); 160 var vidURL = $(this).attr("name"); 161 var vidTitle = $(this).parents().siblings().find('h4').html(); 162 $('#tellafriend-hero pre').append(vidURL); 163 $('#tellafriend-hero').show(); 164 $('#video-container-hero').hide(); 165 }); 166 167 // loads the YouTube IFrame Player API code asynchronously. 168 var tag = document.createElement('script'); 169 tag.src = "https://www.youtube.com/iframe_api"; 170 var firstScriptTag = document.getElementsByTagName('script')[0]; 171 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 172 173 $('.modal').on('hidden.bs.modal',function() { 174 var thisID = $(this).attr('id'); 175 var video = $(this).find('.youtube').attr('id'); 176 var suffix = thisID.substr(10); 177 if (thisID == 'videoModal') { 178 $('#tellafriend-hero').hide(); 179 $("#video-container-hero").find("iframe").attr("src", $("#video-container-hero").find("iframe").attr("src")); 180 $('#video-container-hero').show(); 181 } else if (thisID.indexOf('video') > -1) { 182 $('#tellafriend'+suffix).hide(); 183 $('#video-container'+suffix).show(); 184 $("#video-container"+suffix).find("iframe").attr("src", $("#video-container"+suffix).find("iframe").attr("src")); 185 } 186 }); 187 188$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 189 var thisID = $(this).attr('href'); 190 if (thisID.indexOf('video') > -1) { 191 var src = $('#'+thisID+' > .embed-container').find('iframe').attr('src'); 192 alert(src); 193 $('#'+thisID).find('iframe').attr('src', ''); 194 $('#'+thisID).find('iframe').attr('src', src); 195// alert(iframe.attr('src')); 196// var src = iframe.attr('src'); 197// iframe.attr('src', ''); 198// iframe.attr('src', src); 199 } 200}); 201 202 $('.sharefacebook').click(function(){ 203 var shareURL = $(this).attr('name'); 204 var fbpopup = window.open("https://www.facebook.com/sharer/sharer.php?u="+shareURL, "fbshare", "width=600, height=400, scrollbars=no"); 205 return false; 206 }); 207 208 $('.sharetwitter').click(function(){ 209 var tweetURL = $(this).attr('name'); 210 var tweetText = $(this).closest('.modal-content').find('h4').text(); 211 window.open("https://twitter.com/intent/tweet?text="+tweetText+"&url="+tweetURL, "twshare", "width=600, height=400, scrollbars=no"); 212 }); 213 214 /* highlight active mega category */ 215 $(function() { 216 var pathArray = window.location.pathname.split( '/' ); 217 var secondLevelLocation = '/'+pathArray[1]; 218 $('#\\'+secondLevelLocation+' a').eq(0).addClass('main_menu_selected'); 219 }); 220}); 221 222 223$(window).load(function () { 224// Make all info graphics on a page the same height 225// Make social media tab box panes the same height 226// $('.social-tabbox').find('.tab-pane').equalHeightColumns(); 227}); 228$(window).resize( $.throttle( 250, function () { 229 230 // Make social media tab box panes the same height 231// $('.social-tabbox').find('.tab-pane').equalHeightColumns(); 232 233} )); 234 235 236 // function creates an <iframe> (and YouTube player) 237 // after the API code downloads. 238 var players = {}; 239 function onYouTubeIframeAPIReady() { 240 var videos = document.getElementsByClassName('youtube'); 241 for (var i = 0; i < videos.length; ++i) { 242 var thisid = videos[i].id; 243 if (thisid.indexOf("_time_") == -1) { 244 var videoid = thisid; 245 players[i] = new YT.Player(videoid, { 246 height: '1280', 247 width: '720', 248 videoId: videoid, 249 playerVars: { 'autoplay': 0, 'controls': 2, 'modestbranding': 1, 'showinfo': 0, 'ohide': 1, 'enablejsapi': 1, 'wmode':'transparent' } 250 }); 251 } else { 252//timeline videos are identified by category_url 253 var n = thisid.indexOf("_time_"); 254 var videoid = thisid.substr(n+6); 255 players[i] = new YT.Player(thisid, { 256 height: '1280', 257 width: '720', 258 videoId: videoid, 259 playerVars: { 'autoplay': 0, 'controls': 2, 'modestbranding': 1, 'showinfo': 0, 'ohide': 1, 'enablejsapi': 1, 'wmode':'transparent' } 260 }); 261 } 262 } 263 } 264 265 // JavaScript Document 266
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.