Hot topics close

Snowfall warnings issued for majority of southern BC highways this weekend

Snowfall warnings issued for majority of southern BC highways this weekend
Environment Canada is warning travellers over a number of snowfall warnings set to affect the province of BC According to EC, the Coquih...

'; return html; } function story_to_thumbnail_item(story, options){ var html = ''; html += '

'; html += '
'; html += ''; html += ''; html += ''; if(typeof story.read_time != 'undefined' && story.read_time > 0){ html += ''; html += '' + story.read_time + ''; html += ''; html += 'minute'; if(story.read_time > 1){ html += 's'; } html += ''; html += ''; } html += '
'; if(window.innerWidth > 500){ html += '
'; } else { html += '
'; } if(window.innerWidth > 500){ html += '

'; if(story.author > ''){ html += ''; html += story.author; html += ' • '; html += ' '; } html += ''; html += story.publish_friendly; html += ''; html += '

'; } html += '
'; if(story.categories.length){ html += ''; } html += '
'; html += ''; html += story.title; html += ''; if(window.innerWidth ''){ html += ''; html += story.author; html += ' • '; html += ' '; } html += ''; html += story.publish_friendly; html += ''; } html += ''; html += story.subtitle; html += ''; html += '
'; html += '
'; return html; } function show_list(news_feed, data){ if(news_feed.length){ var html = ''; var options = {}; var ad_class = ''; var max_width = 728; if(window.innerWidth'; html += ''; html += '
'; } else { html += '

'; } if(i == 0){ html += story_to_thumbnail_item(news_feed[i], options); } else { html += story_to_list_item(news_feed[i], options); } html += '

'; if(window.innerWidth > 500){ html += ''; } } if(data.options.show_ads == 'after'){ //leaderboard if(ad_class == 'dfp-leaderboard'){ html += '
'; } else { html += '
'; } html += ''; html += '
'; data.ad_counter++; } if(data.should_append_feed){ document.getElementById("news_feed").insertAdjacentHTML('beforeend',html); //show_ad(data); } else { document.getElementById("news_feed").innerHTML = html; data.should_append_feed = true; } data.story_positions = calculate_story_positions(); data.ad_positions = calculate_ad_positions(); } } function feed_request_callback(xhr, data) { return function() { if(this.readyState == 4 && this.status == 200) { var now = Math.floor(Date.now() / 1000); var json = JSON.parse(this.responseText); data.saved_list.push(json.news_feed); //console.log(data.saved_list); //console.log('show feed'); show_list(json.news_feed, data); try { sessionStorage.setItem('feed_' + data.options_string, JSON.stringify(data.saved_list)); sessionStorage.setItem('feed_date_' + data.options_string, now);; } catch (e) { if (e == QUOTA_EXCEEDED_ERR) { sessionStorage.clear(); sessionStorage.setItem('feed_' + data.options_string, JSON.stringify(data.saved_list)); sessionStorage.setItem('feed_saved_' + data.options_string, now);; } } data.loading.style.display = 'none'; data.loading_stories = false; } }; } function calculate_story_positions(){ var stories = document.querySelectorAll(".feed_story"); var scroll_y = window.scrollY || document.documentElement.scrollTop; var story_positions = []; if(stories.length){ var top; for (var i = 0; i b.position.top ? 1 : 0; }); for (i = 0; i data.story_positions[i].position.top && data.story_positions[i].position.top>furthest_scrolled_story.position.top){ furthest_scrolled_story = data.story_positions[i]; position_in_list = i; } } } if(furthest_scrolled_story.id > '' && window.location.hash != '#fs_' + furthest_scrolled_story.id){ if(history.replaceState){ history.replaceState(undefined, undefined, '#fs_' + furthest_scrolled_story.id); } } if(data.story_positions.length - position_in_list data.ad_positions[i].position.top){ show_ad(data.ad_positions[i].id); data.ad_positions[i] = null; } } } } //may switch this to a timeout of 50 for better performance function scroll_callback(data){ return function(){ data.last_known_scroll_position = window.scrollY || document.documentElement.scrollTop; if(!data.ticking){ window.requestAnimationFrame(function() { handleScroll(data.last_known_scroll_position,data); data.ticking = false; }); data.ticking = true; } }; } function refresh_callback(data){ return function(event){ event.preventDefault(); data.loading_status.innerHTML = 'Updating Stories'; data.loading_svg.style.display = 'block'; data.options.offset = 0; data.should_append_feed = false; load_stories(data); }; } function show_ad(ad_id){ var ad = document.getElementById(ad_id); ad.setAttribute('data-shown',1); //console.log('yay ad! ' + ad_id); if((' ' + ad.className + ' ').indexOf(' dfp-square ') > -1){ feed_ajax_ad(ad, '/15020739/nowmedia_sidebar', [300, 250], dfp_targeting); } else { if(window.innerWidth ''){ options = JSON.parse(e.getAttribute('data-options')); } options.offset = 0; if(typeof options.limit == 'undefined'){ options.limit = 7; } if(typeof options.show_ads == 'undefined'){ options.show_ads = 'after'; } var options_string = JSON.stringify(options); var data = { options_string: options_string, options:options, ticking: false, saved_list: [], loading: document.getElementById('news_feed_loading'), loading_status: document.getElementById('news_feed_loading_status'), loading_svg: document.getElementById('news_feed_svg'), ad_counter: 0, last_known_scroll_position: 0, loading_stories: false, story_positions: [], ad_positions: [], should_append_feed: true, url: window.location.pathname }; var saved_list = sessionStorage.getItem('feed_' + options_string); var saved_date = sessionStorage.getItem('feed_date_' + options_string); //if there are saved stories, and there's a hash in the url, indicating scrolling down the page if(window.location.hash && saved_list != null && saved_date != null){ //console.log('load new stories'); saved_list = JSON.parse(saved_list); data.loading.style.display = 'block'; for (i = 0; i (60*5)){ data.should_append_feed = false; data.options.offset = 0; data.saved_list = []; load_stories(data); } else { //console.log('show_saved_stories'); data.loading.style.display = 'none'; setTimeout(function(){ data.loading_status.innerHTML = 'Click to Check for New Stories'; data.loading_svg.style.display = 'none'; data.loading.style.display = 'block'; }, 240000); } //load_stories(data); //may want to also do this for stories window.addEventListener('load', update_ad_positions(data)); setTimeout(function(){ update_ad_positions(data); }, 3000); window.addEventListener('scroll', scroll_callback(data)); data.loading.addEventListener('click', refresh_callback(data)); return true; } return false; } //only show ads if should_append_feed is true init_feed('news_feed'); //}
Similar news
News Archive
  • Bradley Zimmer
    Bradley Zimmer
    Blue Jays Acquire Outfielder Bradley Zimmer From Guardians
    8 Apr 2022
    2
  • Ben Chiarot
    Ben Chiarot
    Canadiens trade Ben Chiarot to Panthers for prospect, first-round pick
    17 Mar 2022
    4
  • Bernard Pivot
    Bernard Pivot
    Bernard Pivot (1935-2024) L'adieu au « roi Lire »
    6 May 2024
    5
  • Calista Flockhart
    Calista Flockhart
    Harrison Ford and Calista Flockhart make rare outing with son in Croatia
    9 Aug 2021
    1
  • Atovaquone Oral
    Atovaquone Oral
    Testing found this recalled medicine can have a deadly bacterial contamination
    4 Apr 2024
    1
  • Carmelo Anthony
    Carmelo Anthony
    Carmelo Anthony announces he is retiring from the NBA after 19 ...
    22 May 2023
    15