Set against the natural beauty of the Okanagan region, the festival creates a peaceful setting for reflection, renewal, and personal transformation. Whether attending to deepen a <a s premier <a ;
if(window.innerWidth > 500){
html += '';
}
else {
html += '';
}
if(typeof story.read_time != 'undefined' && story.read_time > 0){
html += '';
html += story.read_time + ' min read';
html += '';
}
if(story.categories.length){
html += '';
for (var category in story.categories) {
html += '';
html += story.categories[category].name;
html += ' ';
}
html += '
';
}
if(window.innerWidth > 979){
html += '';
html += story.title;
html += '';
}
else if(window.innerWidth > 500){
html += '';
html += story.title;
html += '';
}
else {
html += '';
html += story.title;
html += '';
}
if(window.innerWidth > 767){
html += '';
html += story.subtitle;
html += '';
}
else if(window.innerWidth > 500){
html += '';
html += story.subtitle;
html += '';
}
if(story.author > ''){
html += '';
html += story.author;
html += ' • ';
html += ' ';
}
html += '';
html += story.publish_friendly;
html += '';
html += '
';
html += '
';
return html;
}
function story_to_thumbnail_item(story, options){
var html = '';
var photo_url = '';
if(story.photo_cdn > ''){
photo_url = story.photo_cdn + '/width=850,height=400,fit=cover';
}
else if(story.photo_square_cdn > ''){
photo_url = story.photo_square_cdn + '/width=850,height=400,fit=cover';
}
else {
photo_url = '/image/w850-h400-c850: + story.photo;
}
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 += ”;
for (var category in story.categories) {
html += ”;
html += story.categories[category].name;
html += ‘ ‘;
}
html += ‘
‘;
}
html += ‘
‘;
html += ”;
html += story.title;
html += ”;
if(window.innerWidth <= 500){
if(story.author > ”){
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<=500){
ad_class = ‘dfp-square’;
max_width = 300;
}
else {
//var random = Math.floor(Math.random() * 3);
//if(random == 1){
// ad_class = ‘dfp-square’;
// max_width = 300;
//}
//else {
ad_class = ‘dfp-leaderboard’;
max_width = 728;
//}
}
if(data.options.show_ads == ‘before’){
html += ”;
html += ”;
html += ‘
‘;
data.ad_counter++;
}
for (var i = 0; i < news_feed.length; i++) {
if(window.innerWidth > 500){
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 < stories.length; i++){
top = stories[i].getBoundingClientRect().top + scroll_y;
story_positions.push({
id:stories[i].getAttribute(‘data-id’),
position:{top:top}
});
}
}
return story_positions;
}
function calculate_ad_positions(){
var ads = document.querySelectorAll(“.dfp-feed-ad”);
var scroll_y = window.scrollY || document.documentElement.scrollTop;
var ad_positions = [];
if(ads.length){
var top;
for (var i = 0; i < ads.length; i++){
if(ads[i].getAttribute(‘data-shown’) == 0){
top = ads[i].getBoundingClientRect().top + scroll_y;
ad_positions.push({
id:ads[i].getAttribute(‘data-id’),
position:{top:top}
});
}
}
}
return ad_positions;
}
function update_ad_positions(data){
data.ad_positions = calculate_ad_positions();
//console.log(data.ad_positions);
}
function load_stories(data){
if(data.loading_stories == false){
var url = ‘/optimized/feed/?’;
var post = {
offset: data.options.offset,
limit: data.options.limit
};
if(typeof data.options.category != ‘undefined’ && data.options.category != null){
post.category = data.options.category;
}
if(typeof data.options.exclude_stories != ‘undefined’ && data.options.exclude_stories != null){
post.exclude_story = data.options.exclude_stories;
}
for (var key in post) {
url += key + ‘=’ + post[key] + ‘&’;
}
url = url.slice(0, -1);
data.loading_stories = true;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = feed_request_callback(xhr, data)
xhr.open(“GET”, url, true);
data.options.offset += data.options.limit;
xhr.send();
// gtag(“event”, “page_view”, {
// pageTitle: data.url + “| page: ” + (data.options.offset/data.options.limit)
//
// });
// ga(‘send’, ‘pageview’, {‘page’: data.url + ‘:’ + (data.options.offset/data.options.limit)});
}
}
function handleScroll(position,data){
var furthest_scrolled_story = {
id: ”,
position:{top: 0}
};
//use bottom of screen
var compare_to = position+window.innerHeight;
var position_in_list = 0;
if(data.story_positions.length){
data.story_positions.sort(function(a,b) {
return a.position.top < b.position.top ? -1 : a.position.top > b.position.top ? 1 : 0;
});
for (i = 0; i < data.story_positions.length; i++){
if(compare_to>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 <7){
load_stories(data);
}
if(data.ad_positions.length){
var ad_compare_to = compare_to + 100;
for (i = 0; i < data.ad_positions.length; i++){
if(data.ad_positions[i] != null && ad_compare_to>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<=500){
feed_ajax_ad(ad, ‘/15020739/nowmedia_sidebar’, [300, 250], dfp_targeting);
}
else {
feed_ajax_ad(ad, ‘/15020739/nowmedia_news_feed’, [728, 90], dfp_targeting);
}
/*
if(typeof site_url != ‘undefined’ && site_url != ‘www.kelownanow.com’ && site_url != ‘www.kamloopsbcnow.com’){
//var rand = Math.floor(Math.random() * Math.floor(11));
//if(rand < 8){
//console.log(‘feed adsense’);
//feed_ajax_ad(ad, ‘/15020739/nowmedia_leaderboard/nowmedia_leaderboard_adsense’, [728, 90], dfp_targeting);
//}
//else {
feed_ajax_ad(ad, ‘/15020739/nowmedia_news_feed’, [728, 90], dfp_targeting);
//}
}
else {
feed_ajax_ad(ad, ‘/15020739/nowmedia_news_feed’, [728, 90], dfp_targeting);
}
*/
}
}
//googletag.openConsole();
function feed_ajax_ad(e, slotCode, size, targeting) {
if (typeof targeting === ‘undefined’) {
targeting = {};
} else if ( Object.prototype.toString.call( targeting ) !== ‘[object Object]’ ) {
targeting = {};
}
var elId = e.getAttribute(‘id’);
googletag.cmd.push(function() {
//console.log(elId);
var slot = googletag.defineSlot(slotCode, size, elId);
//console.log(slot);
for (var t in targeting) {
slot.setTargeting(t, targeting[t]);
}
slot.addService(googletag.pubads());
googletag.display(elId);
//googletag.pubads().refresh([slot]);
});
}
function init_feed(element_id){
var e = document.getElementById(element_id);
var now = Math.floor(Date.now() / 1000);
if(typeof e != ‘undefined’){
var options = {};
if(typeof e.getAttribute(‘data-options’) > ”){
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 < saved_list.length; i++){
show_list(saved_list[i],data);
data.options.offset += data.options.limit;
}
data.saved_list = saved_list;
}
//if its been more than 5 minutes, load new stories
if(!window.location.hash || saved_date == null || (now – parseInt(saved_date)) > (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’);
//}
“;
$(“#social-share-anchor”).html(str);
$(“.share-horizontal”).csekShare({“direction”:”horizontal”, icons: [“facebook”,”twitter”,”pinterest”, “linkedin”, “reddit”,”email”] });
}else{
var str=””;
$(“#social-share-anchor”).html(str);
}
if(window.innerWidth >= 1650){
if(typeof hasHomepageTakeover == ‘undefined’ || hasHomepageTakeover == false){
var floatingAdHtml = ”;
floatingAdHtml += ”;
floatingAdHtml += ‘
‘;
$(‘body’).prepend(floatingAdHtml);
var left = ((window.innerWidth – 1190) / 2) – 30 – 160 – 15;
document.getElementById(‘left-floating-skyscraper’).style.left = left + ‘px’;
}
function moveLeftScroller() {
var anchor = $(‘#left-floating-skyscraper’);
var scroller = $(‘#left-floating-skyscraper>div’);
if(anchor.length>0){
var moveLeft = function () {
var st = $(window).scrollTop();
var ot = anchor.offset().top;
console.log(st + ‘>’ + ot);
if (st > ot) {
scroller.css({
position: ‘fixed’,
top: ‘0px’,
});
} else {
scroller.css({
position: ‘relative’,
top: ”,
});
}
};
$(window).scroll(moveLeft);
moveLeft();
}
}
moveLeftScroller();
$(window).on(‘resize’, function(event){
moveLeftScroller();
});
}
$(‘a.inline’).fancybox({
padding:0,
margin:0
});
$(‘.fblogin’).click(function(){ login(); });
$(‘#MemberPassword’).focus(function(){
if($(this).val()==’Your Password’)
$(this).val(”);
});
$(‘#MemberEmail’).focus(function(){
if($(this).val()==’Your Email Address’)
$(this).val(”);
});
$(‘#MemberEmail’).blur(function(){
if($(this).val()==”)
$(this).val(‘Your Email Address’);
});
$(‘.MemberEmail’).focus(function(){
if($(this).val()==’Your Email Address’)
$(this).val(”);
});
$(‘.MemberEmail’).blur(function(){
if($(this).val()==”)
$(this).val(‘Your Email Address’);
});
$(‘.sub-toggle’).click(function(e){
e.preventDefault();
$(this).siblings(‘.sub’).slideToggle();
});
$(‘.eventDatepicker’).datepicker({ dateFormat: ‘yy-mm-dd’ });
$(‘a.inline’).fancybox({
padding:0,
margin:0
});
$(‘.fblogin’).click(function(){ login(); });
$(‘#MemberPassword’).focus(function(){
if($(this).val()==’Your Password’)
$(this).val(”);
});
$(‘#MemberEmail’).focus(function(){
if($(this).val()==’Your Email Address’)
$(this).val(”);
});
$(‘#MemberEmail’).blur(function(){
if($(this).val()==”)
$(this).val(‘Your Email Address’);
});
$(‘.MemberEmail’).focus(function(){
if($(this).val()==’Your Email Address’)
$(this).val(”);
});
$(‘.MemberEmail’).blur(function(){
if($(this).val()==”)
$(this).val(‘Your Email Address’);
});
$(‘.desktop-search-toggle’).mouseover(function(){
var e = this;
$(‘.desktop-tab-link’).removeClass(‘active’);
$(e).addClass(‘active’);
$(‘.desktop-nav-tab’).hide();
$(‘#desktop-search’).show();
if(renderedGoogleSearch == false){
renderedGoogleSearch = true;
showGoogleSearch();
}
});
if(window.innerWidth > 979){
$(‘.main_nav_wrapper ul li’).mouseover(function(){
$(this).children(‘ul’).first().css(‘display’,’block’);
});
$(‘.main_nav_wrapper ul li ul li’).mouseover(function(){
$(this).children(‘ul’).first().css(‘display’,’block’);
});
$(‘.main_nav_wrapper li’).mouseleave(function(){
$(this).children(‘ul’).first().css(‘display’,’none’);
});
}
$(window).on(‘resize’, function(event){
if($(this).width() > 979){
$(‘.main_nav_wrapper ul li’).mouseover(function(){
$(this).children(‘ul’).first().css(‘display’,’block’);
});
$(‘.main_nav_wrapper ul li ul li’).mouseover(function(){
$(this).children(‘ul’).first().css(‘display’,’block’);
});
$(‘.main_nav_wrapper li’).mouseleave(function(){
$(this).children(‘ul’).first().css(‘display’,’none’);
});
}
});
$(‘#desktop-search’).mouseleave(function(){
$(‘#desktop-search’).hide();
});
$(‘.desktop-tab-link’).mouseover(function(){
$(‘.desktop-nav-tab’).hide();
$(‘.desktop-tab-link, .desktop-search-toggle’).removeClass(‘active’);
var e = this;
$(e).addClass(‘active’);
var target = $(e).attr(‘href’);
$(target).show();
});
$(‘.desktop-nav-tab’).mouseleave(function(){
$(‘.desktop-tab-link’).removeClass(‘active’);
$(‘.desktop-nav-tab’).hide();
});
$(‘.container_header’).mouseover(function(){
$(‘.desktop-tab-link’).removeClass(‘active’);
$(‘.desktop-nav-tab’).hide();
});
if($(‘.sidebar-container’).length){
$(‘.sidebar-container’).css(‘min-height’, $(‘.article’).height());
var shareSideY = $(‘.sidebar-container’).offset().top;
$(window).scroll(function(){
var windowY = window.pageYOffset;
if(windowY > shareSideY-120){
$(‘.shareside_parent’).css({‘position’:’fixed’,’top’:’30px’});
}
else {
$(‘.shareside_parent’).css({‘position’:’relative’});
}
});
}
$(‘.eventDatepicker’).datepicker({ dateFormat: ‘yy-mm-dd’ });
});
//]]>