<%
var hash = window.location.hash;
var queryStr = hash.split('?')[1] || '';
var queryParams = queryStr.split('&');
var activeTab = 'home';
for (var param of queryParams) {
if (param.includes('tab')) {
activeTab = param.split('tab=')[1];
}
}
var vaultHeader = {
home: 'Welcome to the Bitsbox Vault!',
videos: '',
surveys: '',
challenges: ''
};
var vaultHomeOptions = [
{
classes: '',
iconClasses: 'fas fa-play-circle',
label: 'Watch Videos',
href: '#vault?tab=videos'
},
{
classes: '',
iconClasses: 'fas fa-comment-alt-lines',
label: 'Take Surveys',
href: '#vault?tab=surveys'
},
{
classes: '',
iconClasses: 'fas fa-swords',
label: 'Coding Challenges',
href: '#vault?tab=challenges'
},
{
classes: 'coming-soon',
iconClasses: 'fas fa-certificate',
label: 'Achievement Badges'
},
{
classes: 'coming-soon',
iconClasses: 'fas fa-lightbulb-on',
label: 'Tips & Tricks'
}
];
%>
<%
if (vaultHeader[activeTab].length) {
%>
<%
}
%>
<%
if (activeTab === 'home') {
for (var i = 0; i < vaultHomeOptions.length; i++) {
var option = vaultHomeOptions[i];
%>
<%-option.label-%>
<%
}
} else if (activeTab === 'videos') {
%>
<%
var videoWidth = 640;
var videoHeight = 360;
var hash = window.location.hash;
var videoId = hash.split('videoId=')[1] || false;
var jQueryLoaded = window.jQuery;
%>
<%
} else if (activeTab === 'surveys') {
%>
<%
var surveyId = '002';
var singlePageSurvey = true;
var pageContent = [
{
header: 'What kinds of stamps should we add to our library?',
options: [
{ name: 'Animals', icon: 'fas fa-paw' },
{ name: 'Sports', icon: 'fas fa-basketball-ball' },
{ name: 'People', icon: 'fas fa-walking' },
{ name: 'Space', icon: 'fas fa-rocket-launch' },
{ name: 'Vehicles', icon: 'fas fa-car' },
{ name: 'Symbols', icon: 'fas fa-icons' },
{ name: 'Food', icon: 'fas fa-burger-soda' },
{ name: 'I have a better idea', class: 'custom' }
],
optionsClass: 'single-survey-option',
question: 'kinds-of-stamps',
optionsOnClick: 'c123.selectSingleAnswerSurveyOption(this)'
},
{
header: 'Thanks for taking our survey!',
subheader: 'Check back soon for more :)'
}
];
var userPrefs = $_page.userPreferences_;
var surveys = userPrefs.survey;
var vaultSurveyTaken = false;
if (surveys) {
vaultSurveyTaken = surveys[surveyId] || false;
}
var hash = window.location.hash;
var surveyIndex = hash.split('page=')[1] - 1 || 0;
var lastPageIndex = 1;
if (vaultSurveyTaken) {
surveyIndex = lastPageIndex;
}
var currentPage = pageContent[surveyIndex];
var lastPage = surveyIndex === lastPageIndex;
%>
<%
if (currentPage.subheader) {
%>
<%
}
%>
<%
if (!lastPage) {
%>
<%
if (!singlePageSurvey) {
%>
<%
}
%>
<%
if (surveyIndex == lastPageIndex - 1) {
%>
<%
} else {
%>
<%
}
%>
<%
}
%>
<%
} else if (activeTab === 'challenges') {
%>
<%
var hash = window.location.hash;
var activePage = hash.split('page=')[1] || 'main';
%>
<%
if (activePage === 'main') {
%>
Bitsbox's Coding Challenge is…
Anything goes! Time to code your dream app!
Build a flying taco game, a talking cat quiz, or an alien dance party.
Whatever you imagine, Bitsbox can help bring it to life. Show us
your creativity for a chance to be showcased!
Code your app in Bitsbox.
Feel free to use your own custom stamps !
Share your app when it's done!
Share your app…
We feature some of the apps that kids share with us in the Challenge App Showcase.
Showcase apps appear at the bottom of this tab for a few weeks.
Read this article about the Challenge App Showcase if you'd like to know more : )
<%
} else if (activePage === 'shareapp') {
%>
<%
} else if (activePage === 'thankyou') {
%>
<%
}
%>
<%
}
%>