Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Add Legal disclaimers. #201

Merged
merged 4 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions bfportal/bfportal/static/js/bfportal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://portal.battlefield.com/experience/package/era?playgroundId=d23be170-33aa-11ed-98f8-9d6912d338ca

$(document).ready(function() {
$(document).ready(function () {
"use strict";
$("body").on('click touch', function (event) {
animateNavBarPane(true);
Expand All @@ -18,7 +18,7 @@ $(document).ready(function() {
otherInp = $('#id_code');
}
const req = $(`#${inp.prop('id')}Reason`),
otherReq = $(`#${otherInp.prop('id')}Reason`);
otherReq = $(`#${otherInp.prop('id')}Reason`);

if (req.siblings().length <= 2) {
required_asterisk.insertBefore(req);
Expand All @@ -40,7 +40,7 @@ $(document).ready(function() {
}


async function GetPlaygroundInfo(url=null, experienceCode=null ){
async function GetPlaygroundInfo(url = null, experienceCode = null) {
let api_url;
if (url) {
api_url = `https://api.gametools.network/bf2042/playground/?playgroundid=${url.search.split('=').at(-1)}&blockydata=false&lang=en-us&return_ownername=false`;
Expand All @@ -54,24 +54,26 @@ $(document).ready(function() {
}

function fillForm(GTApiResponse) {
GTApiResponse.playgroundName = String;
GTApiResponse.playgroundDescription = String;
if (!GTApiResponse.hasOwnProperty('errors')) {
GTApiResponse.tag.forEach(elm => {addTagToDeck(elm['metadata']['translations'][0]['localizedText'])});
GTApiResponse.playgroundName = String;
GTApiResponse.playgroundDescription = String;
if (!GTApiResponse.hasOwnProperty('errors')) {
GTApiResponse.tag.forEach(elm => {
addTagToDeck(elm['metadata']['translations'][0]['localizedText'])
});


GTApiResponse = GTApiResponse.validatedPlayground;
document.getElementById("id_title").value = toTitleCase(GTApiResponse.playgroundName);
document.getElementById("id_description").value = GTApiResponse.playgroundDescription;
document.getElementById("id_no_players").value = GTApiResponse.mapRotation.maps[0].gameSize;
{
document.getElementById("id_no_bots").value = GTApiResponse.mapRotation.maps[0].gameSize;
GTApiResponse = GTApiResponse.validatedPlayground;
document.getElementById("id_title").value = toTitleCase(GTApiResponse.playgroundName);
document.getElementById("id_description").value = GTApiResponse.playgroundDescription;
document.getElementById("id_no_players").value = GTApiResponse.mapRotation.maps[0].gameSize;
{
document.getElementById("id_no_bots").value = GTApiResponse.mapRotation.maps[0].gameSize;

}
}
}
}

$('#autoFillBtn').on('click touch', function (){
$('#autoFillBtn').on('click touch', function () {
let expUrl = $("#id_exp_url");
let experienceCode = $("#id_code");

Expand Down Expand Up @@ -102,13 +104,13 @@ $(document).ready(function() {
});


function animateNavBarPane(hide=null) {
function animateNavBarPane(hide = null) {
if (hide) {
navBarPane.animate({'right': `-${navBarPane.width()}px`}, 100, function () {
navBarPane.addClass("hidden");
});
} else {
if (navBarPane.css('right') === '0px'){
if (navBarPane.css('right') === '0px') {
navBarPane.animate({'right': `-${navBarPane.width()}px`}, 100, function () {
navBarPane.addClass("hidden");
});
Expand All @@ -121,6 +123,7 @@ $(document).ready(function() {

$('#menuIcon').on('click touch', function (e) {
e.stopPropagation();
showPopUpBackGround();
$('#nav-bar-pane').height($('#main').height() - 2);
animateNavBarPane();
});
Expand All @@ -131,6 +134,7 @@ $(document).ready(function() {
});

addDropDownPair("profileButton", "accountNavBarDropdown")

});

function getCookie(name) {
Expand Down
10 changes: 9 additions & 1 deletion bfportal/bfportal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,20 @@
function showPopUp(id) {
const popup = $(document.getElementById(id))
if (popup) {
$(`#popUpBackground`).fadeIn(100);
showPopUpBackGround();
popup.fadeIn();
popup.css('display', 'flex');
}
}

function showPopUpBackGround() {
$(`#popUpBackground`).fadeIn(100);
}

$('#disclaimer-mobile').on('click touch', function() {
showPopUp('disclaimerPopUp');
});

</script>
{% block extra_js %}
{# Override this in templates to add extra javascript #}
Expand Down
Loading