Care in the UK: The costs you face

‘;
spinnerHolder.style.backgroundColor = ‘#fff’;
spinnerHolder.appendChild(spinner);

link.parentNode.appendChild(spinnerHolder);
},
handleIframeLoad: function (startIframing) {
// IMPORTANT: Had to make this an onload because the
// polyfilling and jquery on one page causes issues
window.addEventListener(‘load’, function () {
startIframing();
}, true);
if (this.elm.onload) {
this.elm.onload = startIframing;
}
// Bug in IE7 means onload doesn’t fire when an iframe
// loads, but the event will fire if you attach it correctly
else if (‘attachEvent’ in this.elm) {
this.elm.attachEvent(‘onload’, startIframing);
}
},

decideHowToTalkToIframe: function (href) {
if (window.postMessage) { // if window.postMessage is supported, then support for JSON is assumed
var uidForPostMessage = this.getPath(href);
this.uidForPostMessage = this.getPath(href);
this.setupPostMessage(uidForPostMessage);
var self = this;

var scrollTimer = null;
window.onscroll = function () {
if (scrollTimer) {
clearTimeout(scrollTimer); // clear any previous pending timer
}
scrollTimer = setTimeout(function () {
self.sendScrollEventToIframe(uidForPostMessage);
}, 50); // set new timer
};
}
else if (href.search(window.location.protocol + ‘//’ + window.location.hostname) -1) {
this.setupIframeBridge();
}
else {
this.data.height = staticHeight;
this.elm.scrolling = ‘yes’;
}
},
onBbcDomain: function () {
return window.location.host.search(‘bbc.co’) -1;
},
setupPostMessage: function (uid) {
var iframeWatcher = this;
window.addEventListener(‘message’, function (e) {
iframeWatcher.postMessageCallback(e.data);
}, false);
},
postMessageCallback: function (data) {
if (this.postBackMessageForThisIframe(data)) {
this.processCommunicationFromIframe(
this.getObjectNotationFromDataString(data)
);
if (this.istatsInTheData()) {
this.addToIstatsQueue();
this.emptyThisIstatsQueue(this.istatsQueue);
}
if (this.scrollInTheData()) {
if (this.data.scrollDuration -1);
},
getIframeContentHeight: function () {
if (this.data.height) {
this.lastRecordedHeight = this.data.height;
}
return this.lastRecordedHeight;
},
setDimensions: function () {
this.elm.width = this.elm.parentNode.clientWidth;
this.elm.style.width = this.elm.parentNode.clientWidth + ‘px’;
this.elm.height = this.getIframeContentHeight();
},
getAnyInstructionsFromIframe: function () {
if (
this.data.hostPageCallback
(!this.iframeInstructionsRan)
) {

this.iframeInstructionsRan = true;
}
},
getPath: function (url) {
var urlMinusProtocol = url.replace(‘http://’, ”);
return urlMinusProtocol.substring(urlMinusProtocol.indexOf(‘/’)).split(‘?’)[0];
},
getWindowLocationOrigin: function () {
if (window.location.origin) {
return window.location.origin;
}
else {
return window.location.protocol + ‘//’ + window.location.hostname + (window.location.port ? ‘:’ + window.location.port : ”);
}
},
removeAppWebViewLinksFromHostPage: function () {
this.removeElementFromHostPage(‘a’, ‘href’, window.location.pathname);
},
removeFallbackImageFromHostPage: function () {
var imageName = this.getQueryStringValue(‘fallback’);
if (imageName) {
this.removeElementFromHostPage(‘img’, ‘src’, imageName);
}
},
getQueryStringValue: function (name) {
var queryString = ‘responsive=truefallback=_80550704_cost-of-care_promo.jpg’,
regex = new RegExp(‘(?:[\?])’ + name + ‘=([^]*)’),
results = regex.exec(queryString);
return results === null ? ” : decodeURIComponent(results[1].replace(/+/g, ‘ ‘));
},
removeElementFromHostPage: function (tagName, attrName, attrValue) {
var element;
if (typeof document.querySelector !== ‘undefined’) {
element = document.querySelector(tagName + ‘[‘ + attrName + ‘*=”‘ + attrValue + ‘”]’);
if (element) {
element.parentNode.removeChild(element);
}
} else {
// Support for older browsers
element = document.getElementsByTagName(tagName);
for (var idx = 0; idx = 0) {
element[idx].parentNode.removeChild(element[idx]);
}
}
}
},
getScrollY: function () {
return window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop || 0;
},
scrollToInstant: function (iframeScrollPosition) {
var scrollPosition = this.elm.getBoundingClientRect().top + this.getScrollY() + iframeScrollPosition;
window.scrollTo(0, scrollPosition);
},
scrollToAnimated: function (iframeScrollPosition, scrollDuration) {
var self = this;

var scrollY = this.getScrollY(),
scrollPosition = this.elm.getBoundingClientRect().top + scrollY + iframeScrollPosition;

var scrollStep = (scrollPosition – scrollY) / (scrollDuration / 15);

/* Timeout to cancel if something wierd happens – prevent infinite loops */
var timeout = false;
setTimeout(function () { timeout = true; }, scrollDuration * 2);

var scrollInterval = setInterval(function () {
scrollY = self.getScrollY();
if (scrollY

‘);
return true;
}
return false;
}

function loadTheVideos() {
if (isMobile) {
loadVids();
} else {
loadFixedWidthVids();
}
}

function loadVids() {
require(config, [‘js/module/app’], function (app) {
app.init();
});
}

function loadFixedWidthVids() {
require(config, [‘js/bootstrap’], function (news) {

// wrap the video in a fixed width container
news.$(‘.newsspec_video_wrapper’).each(function () {
var forceWidth = news.$(this).css(‘max-width’);
news.$(this).wrap(”);
});

loadVids();
});
}
})();

Users of the BBC News app tap here for the care calculator.

Produced by Alison Holt, Nick Triggle, Ransome Mpini, John Walton, Charlotte Thornton, Aidan Fewster, Emily Craig and Charlotte Rose.