Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/mod/gui/termsdialog/termsdialog.js
/** | |||||
* This implements a basic "Clickwrap agreement", which is an industry standard: | |||||
* | |||||
* The European Court of Justice decided in the case El Majdoub (case nr C-322/14) that click-wrap agreements are acceptable under certain circumstances | |||||
* as proof of the acceptance of terms and conditions (in the meaning of Regulation 44/2001, now replaced by Regulation 1215/2012). | |||||
* See https://eur-lex.europa.eu/legal-content/en/TXT/HTML/?uri=uriserv%3AOJ.C_.2015.236.01.0019.01.ENG | |||||
*/ | |||||
var g_TermsPage; | var g_TermsPage; | ||||
var g_TermsFile; | var g_TermsFile; | ||||
var g_TermsSprintf; | var g_TermsSprintf; | ||||
function init(data) | function init(data) | ||||
{ | { | ||||
g_TermsPage = data.page; | g_TermsPage = data.page; | ||||
g_TermsFile = data.file; | g_TermsFile = data.file; | ||||
g_TermsSprintf = data.sprintf; | g_TermsSprintf = data.sprintf; | ||||
Engine.GetGUIObjectByName("title").caption = data.title; | Engine.GetGUIObjectByName("title").caption = data.title; | ||||
initURLButtons(data.urlButtons); | initURLButtons(data.termsURL, data.urlButtons); | ||||
initLanguageSelection(); | initLanguageSelection(); | ||||
} | } | ||||
function initURLButtons(urlButtons) | function initURLButtons(termsURL, urlButtons) | ||||
{ | { | ||||
urlButtons.forEach((urlButton, i) => { | if (termsURL) | ||||
urlButtons.unshift({ | |||||
// Translation: Label of a button that when pressed opens the Terms and Conditions in the default webbrowser. | |||||
"caption": translate("View online"), | |||||
"url": termsURL | |||||
}); | |||||
urlButtons.forEach((urlButton, i) => { | |||||
let button = Engine.GetGUIObjectByName("button[" + i + "]"); | let button = Engine.GetGUIObjectByName("button[" + i + "]"); | ||||
button.caption = urlButton.caption; | button.caption = urlButton.caption; | ||||
button.hidden = false; | button.hidden = false; | ||||
button.tooltip = sprintf(translate("Open %(url)s in the browser."), { | button.tooltip = sprintf(translate("Open %(url)s in the browser."), { | ||||
"url": urlButton.url | "url": urlButton.url | ||||
}); | }); | ||||
button.onPress = () => { | button.onPress = () => { | ||||
openURL(urlButton.url); | openURL(urlButton.url); | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator