-->
`;
const embedded = createRawHtml(rawHtml);
embedded.appendChild(appendScript("https://platform.twitter.com/widgets.js"));
return embedded;
}
function processSingleContentElement(contentElement) {
switch (contentElement.displayType) {
case 'section': return contentElement.elements.map(it => processSingleContentElement(it));
case 'paragraph': return createSimpleTextElement(contentElement.text);
case 'header': return createSimpleTextElement(contentElement.text, 'h' + contentElement.level);
case 'image': return createImage(contentElement);
case 'twitter': return createTwitter(contentElement);
case 'youtube': return createYoutube(contentElement);
default: return createSimpleTextElement(JSON.stringify(contentElement));
}
}
function fillContentIntoElement(createdElement, htmlEl) {
try {
console.log(createdElement, htmlEl);
if (createdElement.length) {
createdElement.forEach(ch => htmlEl.appendChild(ch));
} else {
htmlEl.appendChild(createdElement);
}
} catch (e) {
console.error(e.message);
}
}
function fillContent(contentElementsList, htmlElements) {
const contentElements = Array.from(contentElementsList);
console.log(contentElements);
const lastElementIndex = htmlElements.length - 1;
htmlElements.forEach((htmlEl, index) => {
htmlEl.innerHTML = '';
if(contentElements.length > index) {
if(index === lastElementIndex) {
contentElements.slice(index).forEach(ce => fillContentIntoElement(processSingleContentElement(ce),htmlEl))
} else {
const createdElement = processSingleContentElement(contentElements[index]);
fillContentIntoElement(createdElement, htmlEl);
}
}
});
}
function createSlides(slides) {
const templateWrapper = document.getElementById('slide-template');
const template = templateWrapper.content.querySelector(".slide-template");
return slides.map((it, index) => {
const cloned = template.cloneNode(true);
const contentPlaceholders = cloned.querySelectorAll(".content-placeholder");
fillContent(it.elements, contentPlaceholders)
if (infiniteLayout) {
cloned.querySelectorAll(".adslot").forEach(slot => {
slot.id = slot.id + '_' + index;
});
}
return cloned;
});
}
var slides = [{"elements":[{"text":"Before you get started on the process, here's what you've got to look forward to.","level":3,"displayType":"header"},{"elements":[{"text":"There are plenty of DIY projects floating around the Internet, but some of them are just more inspired than the others. This particular project, which is a floating bed that is totally under lit and totally awesome, is one of them. The original builders definitely created something beautiful when they put this together, and luckily, they decided to share it. Check out this amazing DIY below - you're going to want one in your own bedroom immediately.This DIY is basically the most amazing thing ever, and it's also not too difficult to build. Can't you see one of these fitting in with the rest of your bedroom decor?","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/59172be6-9b60-39e3-b619-518b041e59fd.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"And it gets better: Here's the bed at night.","level":3,"displayType":"header"},{"elements":[{"text":"That's right - the bed is lit from below, so at night it gives the appearance that it's glowing. We know you're convinced now, so let's get started.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/a147e5d9-aa7f-3013-8406-663e980c4f71.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Begin with purchasing your lumber.","level":3,"displayType":"header"},{"elements":[{"text":"The original builder used California Redwood 2x6s to make the frame, regular 2x4s to make the structural portions of the frame, and a 2x10 to make the box support that the bed \"floats\" on. They cut the lumber with a simple circular saw.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/5afe2326-49d5-3c69-bb5f-fdea1dceb9a5.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Build the perimeter.","level":3,"displayType":"header"},{"elements":[{"text":"The perimeter dimensions for this queen bed are 80\"x60\" and made exclusively with the California Redwood 2x6s.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/97e9c6d5-ee2b-3edf-998d-0c8e45fdb2cf.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Apply the internal bracing.","level":3,"displayType":"header"},{"elements":[{"text":"Add the braces, but makes sure they're fit correctly or else the whole thing will fall apart. Here is the advice from the original builder: \"I used 2x4s for the internal bracing, but the fit wasn't just quite right - there was still some flex in the frame, which turned out to be because the 2x4s edges weren't cut absolutely perpendicular. So where they were screwed onto the outside frame, they didn't make full contact with the cut face, but instead were oblique (by a fraction of a millimeter) - which prevented them from becoming absolutely tight, and allowed the frame to flex.\"","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/1d001f21-6bf8-34cd-940e-0243cb8fd2ad.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Make right angle cuts.","level":3,"displayType":"header"},{"elements":[{"text":"It's difficult to make precise right angle cuts with a circular saw, so get a workbench to steady your hand and produce clean lines.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/e0cfa263-d9b4-30d2-809e-d80751e85c10.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Here's the finished base frame.","level":3,"displayType":"header"},{"elements":[{"text":"Screw the braces on tight and make sure there's no flex in the wood.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/253f242b-1ad9-3dac-a1f8-7dbaef8ce0fa.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Now build the box support.","level":3,"displayType":"header"},{"elements":[{"text":"The bed frame is supported on a box frame made out of 5 foot sections of 2x10s, joined together by four 2x4s.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/8542255d-ba81-3675-b334-1132094735a8.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Check out this work in progress.","level":3,"displayType":"header"},{"elements":[{"text":"It's really coming along, isn't it?","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/d3dd36cb-6446-302d-97e8-a1cd4adfc95a.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Add the two frame parts together.","level":3,"displayType":"header"},{"elements":[{"text":"The main frame is placed on top of the support frame. Now it's really starting to look like a bed.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/1623eea0-b075-34f6-85d6-a7cc18bca909.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Secure the two frames together.","level":3,"displayType":"header"},{"elements":[{"text":"Add 2x4s for the backrest, which would also hold both the frames together, plus a couple of 2x2s.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/b20a9b61-35bd-3c9e-a931-3ec3010708f9.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Join the backrest and the frame.","level":3,"displayType":"header"},{"elements":[{"text":"The backrest supports were screwed into the 2x10 base and also the main frame. Definitely use a level at this stage to make sure everything is aligned properly.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/064fba3f-f291-383d-b246-c395d46417f2.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Here's the completed assembly of the frame.","level":3,"displayType":"header"},{"elements":[{"text":"Isn't she a beauty?","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/92abde18-b16b-3008-a3e1-d4b56019d381.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Now it's time to add the mattress slats.","level":3,"displayType":"header"},{"elements":[{"text":"Add support slats at the head and foot of the bed. The slats are resting on the edges on a pair of 2x3s.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/b4d28e49-70bd-3c95-8b54-72d869ad57fe.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Here's a detail shot of what the slats look like up close.","level":3,"displayType":"header"},{"elements":[{"text":"","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/f6a296ff-cf0e-3dc7-bcf4-1bf21f98f226.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Build up the headboard and backrest.","level":3,"displayType":"header"},{"elements":[{"text":"Used the remaining Redwood 2x6s for the backrest, with a 1\" gap in between each board. The original builder used a 3/4\" and 1/4\" piece of plywood to rest the 2x6 on, then screwed it to the support. Repeat till desired height is achieved.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/62e6a855-ed41-3a6c-bce0-3c7631159230.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Here's the completed headboard in all of its glory.","level":3,"displayType":"header"},{"elements":[{"text":"Put a lamp (without a shade) behind the bed to give the headboard that glowy effect.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/15b51747-b100-32d8-9251-b3bbb84825ed.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Here's the bed with all the slats on it.","level":3,"displayType":"header"},{"elements":[{"text":"These are strips of 1/4\" thick ply, cut in 4\" width. You can have them cut accurately and easily at the hardware store.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/7ea1817c-490c-388e-8780-8ca44c3e11ac.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Add your lighting.","level":3,"displayType":"header"},{"elements":[{"text":"Wrap a ropelight for the base of the bed. Rope light is an LED light source, so it won't generate heat. Isn't this gorgeous?","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/d30dd00c-d904-3fce-82ef-ecd4d26ef790.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]},{"elements":[{"text":"Take in your hard work and pat yourself on the back.","level":3,"displayType":"header"},{"elements":[{"text":"This is the totally complete and appointed bed. It's amazing, and it's only a few hours and some hard work away.","level":0,"displayType":"paragraph"}],"displayType":"section"},{"imageUrl":"/static/57ad9db1-b9d0-32ad-82c7-679621b73608.jpeg","caption":"imgur","displayType":"image"},{"elements":[{"text":"","level":1,"displayType":"paragraph"}],"displayType":"section"}]}];
var slide_index = parseInt(0);
var slide_json = createSlides(slides);
var initial_slide = slide_index;
var initial_url = location.pathname + location.search;
var base_url = '/floating-bed';
var next_gallery = '/bird-panhandling';
var first_load = true;
var has_scrolled = false;
var title = "This Guy Made A DIY Floating Bed In 19 Simple Steps… Wait Till You See How He Did The Lights.";
var path = base_url
var utm_campaign, utm_subid, utm_source, utm_content, utm_term = 'n/a';
// try {
// var url = new URL(window.location.href);
// utm_campaign = encodeURIComponent(url.searchParams.get("utm_campaign"));
// utm_source = encodeURIComponent(url.searchParams.get("utm_source"));
// utm_content = encodeURIComponent(url.searchParams.get("utm_content"));
// utm_term = encodeURIComponent(url.searchParams.get("utm_term"));
// utm_medium = encodeURIComponent(url.searchParams.get("utm_medium"));
// if (utm_content && utm_campaign){
// var googletag = googletag || {};
// googletag.cmd = googletag.cmd || [];
// googletag.cmd.push(function() {
// googletag.pubads().setTargeting("utm_subid", utm_term);
// googletag.pubads().setTargeting("utm_subid_c", utm_campaign);
// });
// }
// } catch (e) {
// }