e = campaignTrail_temp; nct_stuff.themes[nct_stuff.selectedTheme].coloring_title = "#700016"; nct_stuff.themes[nct_stuff.selectedTheme].coloring_window = "#ff6b6b"; 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 = "#930301"; document.getElementById("header").src = "https://cdn.abcotvs.com/dip/images/10492832_040621-kgo-ov-total-recalled-full-doc-v2-updated-vid.jpg?w=1600"; document.body.background = "https://upload.wikimedia.org/wikipedia/en/thumb/b/b9/Terminator-2-judgement-day.jpg/220px-Terminator-2-judgement-day.jpg"; e.election_json = [{"model":"campaign_trail.election","pk":15,"fields":{"year":1988,"summary":"

Incumbent governor Gray Davis has been fairly unpopular over the years, and this will be put to the test in a recall election, which if successful, will replace Governor Gray Davis with bodybuilder and action movie star Arnold Schwarzenegger.

The Davis administration has been hammered over its handling of the California electricity crisis, the increased taxes over the last five years, and the restrictive gun-control laws.

Arnold Schwarzenegger's charisma and moderate positions may have widespread approval, and may be what Californians want if they want to make changes to the state.

","image_url":"https://i.imgur.com/YfPpEUQ.png","winning_electoral_vote_number":270,"advisor_url":"https://i.imgur.com/ueamoDX.png","recommended_reading":"","has_visits":1,"no_electoral_majority_image":"../static/images/2012-no-majority.jpg"}}];e.temp_election_list = [{"id":15,"year":1988,"is_premium":0,"display_year":"2003CA"}];e.credits = "Environmental_Cap104, Thank you CatBoxXD for the map.";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":152,"fields":{"first_name":"Arnold","last_name":"Schwarzenegger","election":15,"party":"Republican","state":"Los Angeles","priority":1,"description":"

Arnold Schwarzenegger is a world-renown actor and bodybuilder who has entered the political stage in the recall election which can potentially remove Governor Gray Davis from office. He seems to be running a populist campaign, which could very well help him get people to vote for him. Not to mention, he is fairly moderate for a Republican. This could help with running a campaign to represent Californians and change the state, at the expense of some social conservatives which isn't a huge number of people in the state as California is quite liberal.

Nonetheless, Arnold Schwarzenegger should play his cards right in order to terminate Gray Davis, and as long as he can run a moderate campaign, he will make it Judgment Day.

","color_hex":"#ff0000","secondary_color_hex":null,"is_active":1,"image_url":"https://upload.wikimedia.org/wikipedia/commons/0/0f/A._Schwarzenegger.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":153,"fields":{"first_name":"Gray","last_name":"Davis","election":15,"party":"Democrat","state":"Los Angeles","priority":1,"description":"NOT PLAYABLE

Gray Davis is the current Governor of California, who was recently elected to a second term by about 5 points in 2002. He is rather unpopular, and is facing a recall election as a result of him blocking Proposition 187, imposing new taxes, gun-control laws, and his handling of the California electricity crisis.

Can he prove to California voters that he is still up for the job until 2006? Or will his administration get terminated by Arnold Schwarzenegger?","color_hex":"#0000ff","secondary_color_hex":null,"is_active":1,"image_url":"https://upload.wikimedia.org/wikipedia/commons/e/ee/Gray_Davis_Bio.gif","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":"Vote","last_name":"Yes","election":15,"party":"","state":"","priority":1,"description":"","color_hex":"#ff0000","secondary_color_hex":null,"is_active":0,"image_url":"https://i.imgur.com/sGk7Ft0.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":"","candidate_score":1,"running_mate":true,"scrollable":false,"partner":"0"}},{"model":"campaign_trail.candidate","pk":1004,"fields":{"first_name":"Vote","last_name":"No","election":15,"party":"","state":"","priority":1,"description":"","color_hex":"#0000ff","secondary_color_hex":null,"is_active":0,"image_url":"https://i.imgur.com/VnPyxdh.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":"","candidate_score":1,"running_mate":true,"scrollable":false,"partner":"1"}}];e.running_mate_json = [{"model":"campaign_trail.running_mate","pk":2001,"fields":{"candidate":152,"running_mate":1003}},{"model":"campaign_trail.running_mate","pk":2002,"fields":{"candidate":153,"running_mate":1004}}]; campaignTrail_temp.opponents_default_json = JSON.parse("[{\"election\": 15, \"candidates\": [152, 153]}]"); e=campaignTrail_temp var changeGameDisp = (hide) => { disp = ""; if (hide) { disp = "none"; } document.getElementsByClassName("inner_window_w_desc")[0].style.display = disp }; e.creditsPage = () => { credits_html = `

Coding

Environmental_Cap104

Writing

Environmental_Cap104

Playtesting/Misc. Help

Environmental_Cap104

DecstarG#4326 for the Music Player

TomBoxXD#1642 for the California Map

Music Credit

JibJab.com - Ahnuld for Governor

The Terminator - Main Theme

Jerry Goldsmith - The Dream

Luke Million - Arnold

Tupac Shakur - California Love



` changeGameDisp(true); var spacer = document.createElement("amongusspacerthisisntarealelement"); spacer.innerHTML = "      "; document .getElementsByClassName("inner_window_w_desc")[0] .children[1].appendChild(spacer); changeGameDisp(true); var menuHeader = document.createElement("div"); menuHeader.classList.add("inner_window_front"); menuHeader.innerHTML = `

Credits

`; menuHeader.id = "SOTUheader"; menuHeader.style = "height: 50px;background-color:#2d2d2d"; var newMenu = document.createElement("div"); newMenu.classList.add("inner_window_front"); newMenu.id = "SOTUmenu"; newMenu.style = `height:260px;background-color:#2d2d2d;color:white;overflow-y: scroll;`; newMenu.innerHTML = credits_html; let z = document.getElementById("game_window"); var backButton = document.createElement("button"); backButton.style = "position: relative; bottom: -13px; left: -380px; width: 150px; height: 80px;font-size:40px;padding-top:5px;padding-left:8px"; backButton.id = "backSOTUBtn"; backButton.innerHTML = `BACK`; backButton.onclick = function () { document.getElementById("SOTUheader").remove(); document.getElementById("SOTUmenu").remove(); document.getElementById("backSOTUBtn").remove(); changeGameDisp(false); }; z.appendChild(menuHeader); z.appendChild(newMenu); z.appendChild(backButton); } e.credits = "" // 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: "Ahnuld for California", tracklist: [ { "name": "JibJab - Ahnuld for Governor", "url": "https://audio.jukehost.co.uk/f0HuZheAs6hnlJNSFELX1gSAWKNvMprz" }, { "name": "The Terminator - Main Theme", "url": "https://audio.jukehost.co.uk/YwiFaQSrDL0ZpyxhydnZpl2cm9lnaZJC" }, { "name": "Total Recall - The Dream", "url": "https://audio.jukehost.co.uk/kWbmMrfU0Gn9VYeTjk1rOuOeDUI0xg6l" }, { "name": "Luke Million - Arnold", "url": "https://audio.jukehost.co.uk/yAilvBusLaOsHKQPj4FFD6u3BH1SYP9O" }, { "name": "Tupac Shakur - California Love", "url": "https://audio.jukehost.co.uk/qCjpax4wUiaD0M3oZ73mcBcL1O5LFOY4" }, ] } } // Set up new music player newMusicPlayer()