Newsroom
Newsroom
Breaking news from Finland by YLE function calculate_size_for_items()
/*
jQuery('.feed-item-expander').each(function ()
var h = 0;
jQuery(this).children().each(function ()
h = h + jQuery(this).outerHeight();
);
if(h != 0)
jQuery(this).height(h);
);
*/
function remove_height_from_feed_item()
jQuery('.feed-item').removeAttr('style');
(function($)
var language = 'en';
$(document).ready(function()
$.ajax(
type: "GET",
url: document.location.protocol + '//' + document.location.hostname + '/wp-content/plugins/thisisfinland/inc/rss/rss.php?lang=' + language,
dataType: 'html',
error: function(jqXHR,textStatus, errorThrown )
//console.log(errorThrown);
,
success: function(xml)
var $xml = $(xml);
var $items = $xml.find( "item" );
var limit = ($items.length > 8) ? 8 : $items.length;
var container = document.getElementById('news');
for (var i = 0; i 0)
if (encs[0].getAttribute('type') == 'image/jpeg')
//var image = document.createElement('img');
var imageurl = encs[0].getAttribute('url');
try
imageurl = imageurl.replace('w_205,h_115', 'w_580,h_326');
imageurl = imageurl.replace('http://', 'https://');
catch(err)
//image.setAttribute('src', imageurl);
imageWrap.setAttribute("style", "background-image: url('" + imageurl + "')" )
//imageWrap.appendChild(image);
// date
dateWrap.appendChild(document.createTextNode((pubDate.getDate()) + '/' + (pubDate.getMonth()+1) + '/' + pubDate.getFullYear()));
dateItem.setAttribute('class', 'feed-item-date');
dateItem.appendChild(dateWrap);
// title
title.appendChild(document.createTextNode($entry.find('title').text()));
// header
header.setAttribute('class', 'feed-item-title');
header.appendChild(title);
// link
link.setAttribute('class', 'feed-item-more');
link.setAttribute('href', entry.link);
link.appendChild(document.createTextNode('Read more'));
linkWrap.appendChild(link);
// teaser
teaser.innerHTML = $entry.find('description').text();
// contentWrap
contentWrap.setAttribute('class', 'feed-item-content');
contentWrap.appendChild(header);
contentWrap.appendChild(teaser);
contentWrap.appendChild(linkWrap);
// expander
expander.setAttribute('class', 'feed-item-expander');
expanderWrap.setAttribute('class', 'feed-item-expander-inner');
var content = '';
try
//console.log($entry.find('content'));
content = $entry.find('content').html();
content = content.replace('', '');
content = content.replace(']]>', '');
content = content.replace(']]>', '');
content = content.replace(']]>', '');
content = content.replace(']]>', '');
catch(err)
content = '';
expanderWrap.innerHTML = content; // tagname content:encoded brings whole lot of trouble: go around it
expander.appendChild(expanderWrap);
// feed item
article.setAttribute('id', 'news-' + guid);
article.setAttribute('class', 'feed-item');
article.appendChild(imageWrap);
article.appendChild(dateItem);
article.appendChild(contentWrap);
article.appendChild(expander);
// container
container.appendChild(article);
// endfor
// set active item from anchor
var hash = window.location.hash.substr(1);
var hash_id = '#' + hash;
if(hash)
jQuery(hash_id).find('a.feed-item-more').addClass('active');
remove_height_from_feed_item();
jQuery('.feed-item').removeClass('active');
var expand_h = 0;
if(jQuery(window).width() > 529)
expand_h = jQuery(hash_id).find('.feed-item-expander').outerHeight() + jQuery(hash_id).outerHeight();
jQuery(hash_id).height(expand_h);
jQuery(hash_id).addClass('active');
// expander triggers
jQuery('.feed-container').on('click', 'a.feed-item-more', function(e)
e.preventDefault();
);
calculate_size_for_items();
if(hash)
jQuery('html, body').animate(
scrollTop: jQuery(hash_id).offset().top
, 300);
);
);
})(jQuery);
// expander triggers
jQuery(document).ready(function()
jQuery('.feed-container').on('click', 'a.feed-item-more', function(e)
if(jQuery(this).hasClass('active'))
jQuery(this).removeClass('active');
else
jQuery('a.feed-item-more').removeClass('active');
jQuery(this).addClass('active');
if(jQuery(this).parents('.feed-item').hasClass('active'))
remove_height_from_feed_item();
jQuery(this).parents('.feed-item').removeClass('active');
else
remove_height_from_feed_item();
jQuery('.feed-item').removeClass('active');
var expand_h = 0;
expand_h = jQuery(this).parents('.feed-item').find('.feed-item-expander').outerHeight() + jQuery(this).parents('.feed-item').outerHeight();
jQuery(this).parents('.feed-item').addClass('active');
if(jQuery(window).width() > 529)
jQuery(this).parents('.feed-item').height(expand_h);
jQuery('html, body').animate(
scrollTop: jQuery(this).parents('.feed-item').find('.feed-item-expander').offset().top - 35
, 300);
else
jQuery('.feed-item.active').removeAttr('style');
jQuery('html, body').animate(
scrollTop: jQuery(this).parents('.feed-item').find('.feed-item-expander').offset().top - 35
, 300);
);
// Clickable heading and image
jQuery('.feed-container').on('click', '.feed-item-content h1, .feed-item-image', function(e)
jQuery(this).parents('.feed-item').find('a.feed-item-more').trigger('click');
);
);
var rtime;
var timeout = false;
var delta = 200;
jQuery(window).resize(function()
rtime = new Date();
if (timeout === false)
timeout = true;
setTimeout(resizeend, delta);
);
function resizeend()
if (new Date() - rtime 529)
item_h = jQuery('.feed-item:not(.active)').outerHeight();
expand_h = jQuery('.feed-item.active').find('.feed-item-expander').outerHeight() + item_h;
jQuery('.feed-item.active').height(expand_h);
else
jQuery('.feed-item.active').removeAttr('style');
}
/*
jQuery('.feed-item-expander').each(function ()
var h = 0;
jQuery(this).children().each(function ()
h = h + jQuery(this).outerHeight();
);
if(h != 0)
jQuery(this).height(h);
);
*/
function remove_height_from_feed_item()
jQuery('.feed-item').removeAttr('style');
(function($)
var language = 'en';
$(document).ready(function()
$.ajax(
type: "GET",
url: document.location.protocol + '//' + document.location.hostname + '/wp-content/plugins/thisisfinland/inc/rss/rss.php?lang=' + language,
dataType: 'html',
error: function(jqXHR,textStatus, errorThrown )
//console.log(errorThrown);
,
success: function(xml)
var $xml = $(xml);
var $items = $xml.find( "item" );
var limit = ($items.length > 8) ? 8 : $items.length;
var container = document.getElementById('news');
for (var i = 0; i 0)
if (encs[0].getAttribute('type') == 'image/jpeg')
//var image = document.createElement('img');
var imageurl = encs[0].getAttribute('url');
try
imageurl = imageurl.replace('w_205,h_115', 'w_580,h_326');
imageurl = imageurl.replace('http://', 'https://');
catch(err)
//image.setAttribute('src', imageurl);
imageWrap.setAttribute("style", "background-image: url('" + imageurl + "')" )
//imageWrap.appendChild(image);
// date
dateWrap.appendChild(document.createTextNode((pubDate.getDate()) + '/' + (pubDate.getMonth()+1) + '/' + pubDate.getFullYear()));
dateItem.setAttribute('class', 'feed-item-date');
dateItem.appendChild(dateWrap);
// title
title.appendChild(document.createTextNode($entry.find('title').text()));
// header
header.setAttribute('class', 'feed-item-title');
header.appendChild(title);
// link
link.setAttribute('class', 'feed-item-more');
link.setAttribute('href', entry.link);
link.appendChild(document.createTextNode('Read more'));
linkWrap.appendChild(link);
// teaser
teaser.innerHTML = $entry.find('description').text();
// contentWrap
contentWrap.setAttribute('class', 'feed-item-content');
contentWrap.appendChild(header);
contentWrap.appendChild(teaser);
contentWrap.appendChild(linkWrap);
// expander
expander.setAttribute('class', 'feed-item-expander');
expanderWrap.setAttribute('class', 'feed-item-expander-inner');
var content = '';
try
//console.log($entry.find('content'));
content = $entry.find('content').html();
content = content.replace('', '');
content = content.replace(']]>', '');
content = content.replace(']]>', '');
content = content.replace(']]>', '');
content = content.replace(']]>', '');
catch(err)
content = '';
expanderWrap.innerHTML = content; // tagname content:encoded brings whole lot of trouble: go around it
expander.appendChild(expanderWrap);
// feed item
article.setAttribute('id', 'news-' + guid);
article.setAttribute('class', 'feed-item');
article.appendChild(imageWrap);
article.appendChild(dateItem);
article.appendChild(contentWrap);
article.appendChild(expander);
// container
container.appendChild(article);
// endfor
// set active item from anchor
var hash = window.location.hash.substr(1);
var hash_id = '#' + hash;
if(hash)
jQuery(hash_id).find('a.feed-item-more').addClass('active');
remove_height_from_feed_item();
jQuery('.feed-item').removeClass('active');
var expand_h = 0;
if(jQuery(window).width() > 529)
expand_h = jQuery(hash_id).find('.feed-item-expander').outerHeight() + jQuery(hash_id).outerHeight();
jQuery(hash_id).height(expand_h);
jQuery(hash_id).addClass('active');
// expander triggers
jQuery('.feed-container').on('click', 'a.feed-item-more', function(e)
e.preventDefault();
);
calculate_size_for_items();
if(hash)
jQuery('html, body').animate(
scrollTop: jQuery(hash_id).offset().top
, 300);
);
);
})(jQuery);
// expander triggers
jQuery(document).ready(function()
jQuery('.feed-container').on('click', 'a.feed-item-more', function(e)
if(jQuery(this).hasClass('active'))
jQuery(this).removeClass('active');
else
jQuery('a.feed-item-more').removeClass('active');
jQuery(this).addClass('active');
if(jQuery(this).parents('.feed-item').hasClass('active'))
remove_height_from_feed_item();
jQuery(this).parents('.feed-item').removeClass('active');
else
remove_height_from_feed_item();
jQuery('.feed-item').removeClass('active');
var expand_h = 0;
expand_h = jQuery(this).parents('.feed-item').find('.feed-item-expander').outerHeight() + jQuery(this).parents('.feed-item').outerHeight();
jQuery(this).parents('.feed-item').addClass('active');
if(jQuery(window).width() > 529)
jQuery(this).parents('.feed-item').height(expand_h);
jQuery('html, body').animate(
scrollTop: jQuery(this).parents('.feed-item').find('.feed-item-expander').offset().top - 35
, 300);
else
jQuery('.feed-item.active').removeAttr('style');
jQuery('html, body').animate(
scrollTop: jQuery(this).parents('.feed-item').find('.feed-item-expander').offset().top - 35
, 300);
);
// Clickable heading and image
jQuery('.feed-container').on('click', '.feed-item-content h1, .feed-item-image', function(e)
jQuery(this).parents('.feed-item').find('a.feed-item-more').trigger('click');
);
);
var rtime;
var timeout = false;
var delta = 200;
jQuery(window).resize(function()
rtime = new Date();
if (timeout === false)
timeout = true;
setTimeout(resizeend, delta);
);
function resizeend()
if (new Date() - rtime 529)
item_h = jQuery('.feed-item:not(.active)').outerHeight();
expand_h = jQuery('.feed-item.active').find('.feed-item-expander').outerHeight() + item_h;
jQuery('.feed-item.active').height(expand_h);
else
jQuery('.feed-item.active').removeAttr('style');
}
$(document).ready(function()
var news_url = '/news';
var language = 'en';
$.ajax(
type: "GET",
url: document.location.protocol + '//' + document.location.hostname + '/wp-content/plugins/thisisfinland/inc/rss/rss.php?lang=' + language,
dataType: 'xml',
error: function(jqXHR,textStatus, errorThrown )
//console.log(errorThrown);
,
success: function(xml)
var $xml = $(xml);
var $items = $xml.find( "item" );
var container = jQuery('.news-list');
var limit = ($items.length > 4) ? 4 : $items.length;
for (var i = 0; i < limit; i++)
// variables
var entry = $items[i];
var $entry = $(entry);
var guidNode = $entry.find('guid');
var $guidNode = $(guidNode);
var guid = $guidNode.text().replace( /^D+/g, '');
var link = document.createElement('a');
var listItem = document.createElement('li');
var timeWrap = document.createElement('div');
var yearWrap = document.createElement('span');
var pubDate = new Date($entry.find('pubDate').text());
var dateString = ('0' + pubDate.getDate()).slice(-2) + '/' + ('0' + (pubDate.getMonth()+1)).slice(-2);
// item
yearWrap.appendChild(document.createTextNode(pubDate.getFullYear()));
timeWrap.appendChild(document.createTextNode(dateString));
timeWrap.appendChild(yearWrap);
link.appendChild(document.createTextNode($entry.find('title').text()));
link.setAttribute('href', news_url + '#news-' + guid);
listItem.appendChild(timeWrap);
listItem.appendChild(link);
// container
container.append(listItem);
if(jQuery('.posts-grid').length && jQuery('.posts-grid').data('masonry'))
jQuery('.posts-grid').masonry('layout');
);
);
)(jQuery);var _paq = _paq || ;
_paq.push(["setCustomVariable", 1, "Category", "Newsroom", "page"]);
_paq.push(["setCustomVariable", 2, "DCType", "page", "page"]);
_paq.push(["setCustomVariable", 3, "Language", "en", "page"]);
_paq.push(["setCustomVariable", 4, "Supertag", "", "page"]);
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
(function()
var u="//seuranta.finland.fi/piwik/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "3"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
)();