e = campaignTrail_temp; nct_stuff.themes[nct_stuff.selectedTheme].coloring_title = "#415070"; nct_stuff.themes[nct_stuff.selectedTheme].coloring_window = "#415070"; document.getElementsByClassName("game_header")[0].style.backgroundColor = nct_stuff.themes[nct_stuff.selectedTheme].coloring_title; $("#game_window")[0].style.backgroundColor = nct_stuff.themes[nct_stuff.selectedTheme].coloring_window; $(".container")[0].style.backgroundColor = "#647bac"; document.getElementById("header").src = "https://i.imgur.com/F7ZAXdo.png"; HistHexcolour=["#9d3522","#2c4581","#bfa72c","#023020"]; HistName=[" Chris Christie"," Barbara Buono"," Kenneth Kaplan"," Steve Welzer"]; HistEV=["0","0","0","0"]; HistPV=["1,278,932","619,926","12,155","8,295"]; HistPVP=["60.30%","38.19%","0.57%","0.39%"]; campaignTrail_temp.modBoxTheme = { "header_color": "#6581ff", "header_text_color": "#000000", "description_text_color": "#000000", "description_background_color": "#91bcff", "main_color": "#3f498a", "secondary_color": "#92414d", "ui_text_color": "#FFFFFF" } document.body.background = "https://www.nj.com/resizer/PKYscd4MGzc9S8wcdL3jh3QXKqk=/1280x0/smart/cloudfront-us-east-1.images.arcpublishing.com/advancelocal/B447UCEAQBEJ3OYNQHEKN3GHKM.JPG"; document.head.innerHTML += ""; e.election_json = [{"model":"campaign_trail.election","pk":20,"fields":{"year":2013,"summary":"

After the events of Hurricane Sandy, and Governor Christie’s much-approved response to it, his national profile is on the rise. As he heads into his reelection campaign, he has every reason to expect a layup. Even though New Jersey is a solidly blue state at the presidential level, Democrats at the state level are essentially retreating from this race.

Top prospects within the party like Newark Mayor Cory Booker have opted to run for Senate instead, leaving the Democrats with no bench to challenge him. So, there’s no way he could lose, right?

","image_url":"https://i.imgur.com/0EjY3Jh.png","winning_electoral_vote_number":0,"advisor_url":"https://i.imgur.com/pqnbZC8.png","recommended_reading":"","has_visits":0,"no_electoral_majority_image":"../static/images/2012-no-majority.jpg"}}];e.temp_election_list = [{"id":20,"year":2013,"is_premium":0,"display_year":"2013"}];e.credits = "Señor más pan";e.global_parameter_json = [{"model":"campaign_trail.global_parameter","pk":1,"fields":{"vote_variable":1.125,"max_swing":0.12,"start_point":0.94,"candidate_issue_weight":10,"running_mate_issue_weight":3,"issue_stance_1_max":-0.71,"issue_stance_2_max":-0.3,"issue_stance_3_max":-0.125,"issue_stance_4_max":0.125,"issue_stance_5_max":0.3,"issue_stance_6_max":0.71,"global_variance":0.01,"state_variance":0.005,"question_count":25,"default_map_color_hex":"#C9C9C9","no_state_map_color_hex":"#999999"}}];e.candidate_json = [{"model":"campaign_trail.candidate","pk":201,"fields":{"first_name":"Tony","last_name":"Soprano","election":20,"party":"Democratic","state":"North Caldwell","priority":1,"description":"

Anthony John Soprano is a waste management consultant from North Jersey, a legitimate businessman, and nothing else! Any insinuation that he is involved with organized crime is wrong, is a stereotype, and is offensive, and it’s the last thing that I’d want (you, the player) to perpetuate!

NOTE: This scenario contains heavy spoilers to “The Sopranos” T.V. Show.

","color_hex":"#2a3fde","secondary_color_hex":null,"is_active":1,"image_url":"https://i.imgur.com/cjgMnuu.png","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":null,"candidate_score":1,"running_mate":false,"scrollable":false}},{"model":"campaign_trail.candidate","pk":200,"fields":{"first_name":"Chris","last_name":"Christie","election":20,"party":"Rethuglican","state":"Jersey","priority":1,"description":"","color_hex":"#d41c18","secondary_color_hex":null,"is_active":0,"image_url":"https://upload.wikimedia.org/wikipedia/commons/6/6b/Chris_Christie_2020.jpg","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":null,"candidate_score":1,"running_mate":false,"scrollable":false}},{"model":"campaign_trail.candidate","pk":1003,"fields":{"first_name":"Ronald","last_name":"Zellman","election":20,"party":"Democratic","state":"Newark","priority":1,"description":"

Ronald Zellman is the current State Senator for District 26 in New Jersey, which includes the North Caldwell municipality that Tony resides in. Zellman thinks that Tony is crazy for trying something like this, but when Tony invites him to a nice lunch at Satriale’s to preposition him with being his running mate, he knows he doesn't really have a choice but to go along with it.

","color_hex":"#0000ff","secondary_color_hex":null,"is_active":0,"image_url":"https://i.imgur.com/G3GxTsq.png","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":"Ronald Zellman is the current State Senator for District 26 in New Jersey, which includes the North Caldwell municipality that Tony resides in. Zellman thinks that Tony is crazy for trying something like this, but when Tony invites him to a nice lunch at Satriale’s to preposition him with being his running mate, he knows he doesn't really have a choice but to go along with it.","candidate_score":1,"running_mate":true,"scrollable":false,"partner":"1"}},{"model":"campaign_trail.candidate","pk":1004,"fields":{"first_name":"Dummy","last_name":"Example","election":20,"party":"Example Party","state":"Hell","priority":1,"description":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","color_hex":"#0000ff","secondary_color_hex":null,"is_active":0,"image_url":"../static/images/barack-obama-2012.jpg","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","candidate_score":1,"running_mate":true,"scrollable":false,"partner":"1"}},{"model":"campaign_trail.candidate","pk":202,"fields":{"first_name":"Kenneth","last_name":"Kaplan","election":20,"party":"Libertarian","state":"Hell","priority":1,"description":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","color_hex":"#bfa72c","secondary_color_hex":null,"is_active":0,"image_url":"../static/images/barack-obama-2012.jpg","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":null,"candidate_score":1,"running_mate":false,"scrollable":false}},{"model":"campaign_trail.candidate","pk":1006,"fields":{"first_name":"Dummy","last_name":"Example","election":20,"party":"Example Party","state":"Hell","priority":1,"description":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","color_hex":"#0000ff","secondary_color_hex":null,"is_active":0,"image_url":"../static/images/barack-obama-2012.jpg","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","candidate_score":1,"running_mate":true,"scrollable":false,"partner":"4"}},{"model":"campaign_trail.candidate","pk":203,"fields":{"first_name":"Steve","last_name":"Welzer","election":20,"party":"Example Party","state":"Hell","priority":1,"description":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","color_hex":"#023020","secondary_color_hex":null,"is_active":0,"image_url":"../static/images/barack-obama-2012.jpg","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":null,"candidate_score":1,"running_mate":false,"scrollable":false}},{"model":"campaign_trail.candidate","pk":1008,"fields":{"first_name":"Dummy","last_name":"Example","election":20,"party":"Example Party","state":"Hell","priority":1,"description":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","color_hex":"#0000ff","secondary_color_hex":null,"is_active":0,"image_url":"../static/images/barack-obama-2012.jpg","electoral_victory_message":"

REAL PATRIOT DUMMY EXAMPLE SWEEPS

","electoral_loss_message":"

Fake News?

","no_electoral_majority_message":"

DUMMY EXAMPLE RETURNS TO HELL

","description_as_running_mate":"Dummy Example is a veteran from Hell. He loves puppies and magic! Dummy Example will unite America!

New line

This is bold and this italic!","candidate_score":1,"running_mate":true,"scrollable":false,"partner":"6"}}];e.running_mate_json = [{"model":"campaign_trail.running_mate","pk":2001,"fields":{"candidate":201,"running_mate":1003}},{"model":"campaign_trail.running_mate","pk":2002,"fields":{"candidate":200,"running_mate":1004}},{"model":"campaign_trail.running_mate","pk":2003,"fields":{"candidate":202,"running_mate":1006}},{"model":"campaign_trail.running_mate","pk":2004,"fields":{"candidate":203,"running_mate":1008}}]; $("#game_start").click((event) => { event.preventDefault(); $("#election_id_button").click((event) => { event.preventDefault(); nct_stuff.themes[nct_stuff.selectedTheme].coloring_title = "#553413"; nct_stuff.themes[nct_stuff.selectedTheme].coloring_window = "#afb2bf"; document.getElementsByClassName("game_header")[0].style.backgroundColor = nct_stuff.themes[nct_stuff.selectedTheme].coloring_title; $("#game_window")[0].style.backgroundColor = nct_stuff.themes[nct_stuff.selectedTheme].coloring_window; $(".container")[0].style.backgroundColor = "#604d41"; document.getElementById("header").src = "https://i.imgur.com/cdkOOJU.png"; document.body.background = "https://i.imgur.com/Nt5Avnx.png"; document.head.innerHTML += ""; musicMode() }) }) musicMode = () => { // Initialise custom music $("#music_player")[0].children[0].style.display = "none" $("#music_player")[0].children[1].style.display = "none" document.getElementById("modLoadReveal").style.display = "none" document.getElementById("modloaddiv").style.display = "none" musicBox = document.getElementById("music_player") musicBox.style.display = "" var trackSel; e = campaignTrail_temp e.selectedSoundtrack = 0 toTime = (seconds) => { var date = new Date(null); date.setSeconds(seconds); return date.toISOString().substr(11, 8); } generateTime = () => { // Get the audio element var audio = document.getElementById("campaigntrailmusic"); timeTracker = document.createElement("div"); timeTracker.style = ` text-align:left; border-style:solid; border-width:3px; height:150px; width:200px; background-color:#999999; float:right; padding: 10px; ` $("#trackSelParent")[0].prepend(timeTracker); $("#trackSelParent")[0].prepend(document.createElement("br")); // Create a new element to display the current position of the audio var positionDisplay = document.createElement("gg"); positionDisplay.id = "position-display"; // Create a new slider element to change the time var timeSlider = document.createElement("input"); timeSlider.type = "range"; timeSlider.min = 0; timeSlider.max = 1; timeSlider.step = 0.001; timeSlider.value = 0; timeSlider.style.width = "200px"; timeSlider.id = "time-slider"; var pausePlay = document.createElement("button"); pausePlay.id = "position-display"; pausePlay.innerHTML = "Pause" pausePlay.style.width = "100%"; pausePlay.addEventListener("click", event => { event.preventDefault(); updatePositionDisplay(); let audio = document.getElementById("campaigntrailmusic"); if (audio.paused) { audio.play(); event.target.innerHTML = "Pause"; return; } audio.pause(); event.target.innerHTML = "Play"; return; }) var volumeLabel = document.createElement("gg"); volumeLabel.id = "volume-label"; volumeLabel.innerHTML = "
Volume: " var volumeSlider = document.createElement("input"); volumeSlider.type = "range"; volumeSlider.min = 0; volumeSlider.max = 1; volumeSlider.step = 0.001; volumeSlider.value = 0; volumeSlider.style.width = "200px"; volumeSlider.id = "volume-slider"; volumeSlider.value = audio.volume; timeTracker.appendChild(pausePlay); timeTracker.appendChild(document.createElement("br")); timeTracker.appendChild(document.createElement("br")); timeTracker.appendChild(positionDisplay); timeTracker.appendChild(timeSlider); timeTracker.appendChild(volumeLabel); timeTracker.appendChild(volumeSlider); updatePositionDisplay(); //for (let i = 0; i < 10; i++) //timeTracker.append(document.createElement("br")); // Function to update the position display function updatePositionDisplay() { positionDisplay.innerHTML = "Time: " + toTime(audio.currentTime) + "
"; timeSlider.value = audio.duration ? audio.currentTime / audio.duration : 0; } // Function to change the time of the audio function changeTime() { positionDisplay.innerHTML = "Time: " + toTime(audio.currentTime) + "
"; audio.currentTime = timeSlider.value * audio.duration; } updateVolume = event => { audio.volume = event.target.value; } // Update the position display and slider every second setInterval(updatePositionDisplay, 1000); // Listen for changes to the time slider and change the time of the audio timeSlider.addEventListener("input", changeTime); volumeSlider.addEventListener("input", updateVolume) } function newMusicPlayer() { trackSel = document.createElement("div"); trackSel.id = "trackSelParent" let z = `









` z += `

` //
for (i in soundtracks[e.selectedSoundtrack].tracklist) { let a = soundtracks[e.selectedSoundtrack].tracklist[i] let b = `
` z += b } z += "


" trackSel.innerHTML = z // select correct song musicBox.appendChild(trackSel); Array.from(document.getElementById("trackSel").children).filter(f => { return f.tagName == "LABEL" }).map(f => f.children[0])[0].checked = true // set soundtrack changer soundtrackSelector = document.getElementById("selectSoundtrack") soundtrackSelector.onchange = function() { for (i in soundtracks) { if (soundtracks[i].name == soundtrackSelector.value) { e.selectedSoundtrack = i break } } document.getElementById("trackSelParent").remove() newMusicPlayer() } var matches = document.querySelectorAll('.trackSelector'); for (match in matches) { matches[match].onchange = function() { audio = $("#campaigntrailmusic")[0]; audio.src = soundtracks[e.selectedSoundtrack].tracklist[this.value].url audio.currentTime = 0 } } musicBox.children[2].loop = false musicBox.children[2].src = soundtracks[e.selectedSoundtrack].tracklist[0].url musicBox.children[2].onended = function() { console.log("next track") let selected = Number(document.querySelector('input[name="trackSelector"]:checked').value); let newSel = clamp(selected + 1, soundtracks[e.selectedSoundtrack].tracklist.length - 1, 0) let buttons = Array.from(document.getElementById("trackSel").children).filter(f => { return f.tagName == "LABEL" }).map(f => f.children[0]) //let selectedIndex = buttons.map(f=>f.children[0]).map(f=>f.checked) buttons[newSel].click() } for (w = 0; w < 7; w++) { document.getElementById("trackSelParent").appendChild(document.createElement("br")) } generateTime(); } clamp = function(a, max, min, overflow = true) { if (overflow) { return a > max ? min : a < min ? max : a; } return a > max ? max : a < min ? min : a; } // Track list var soundtracks = { 0: { name: "Opening Song", tracklist: [ { "name": "Woke Up This Morning - Alabama 3", "url": "https://audio.jukehost.co.uk/HIbc7QXc8akYF0YyyyUuiGlzsxqkm6AL" } ] }, } // Set up new music player newMusicPlayer() }