Skip to content
Snippets Groups Projects
Commit 07280a4f authored by Oliver Hader's avatar Oliver Hader Committed by Oliver Hader
Browse files

[TASK] Use proper TypeScript functions instead of arrow functions

Resolves: #91229
Releases: master, 9.5
Change-Id: Ieb6211252a74983a89b7a1057574a1ebe29ae390
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64341


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarOliver Hader <oliver.hader@typo3.org>
parent 66d95e9e
Branches
Tags
No related merge requests found
......@@ -50,7 +50,7 @@ class BackendLogin {
/**
* Hide all form fields and show a progress message and icon
*/
public showLoginProcess = (): void => {
private showLoginProcess(): void {
this.showLoadingIndicator();
$(this.options.error).addClass('hidden');
$(this.options.errorNoCookies).addClass('hidden');
......@@ -59,7 +59,7 @@ class BackendLogin {
/**
* Show the loading spinner in the submit button
*/
public showLoadingIndicator = (): void => {
private showLoadingIndicator(): void {
$(this.options.submitButton).button('loading');
}
......@@ -68,7 +68,7 @@ class BackendLogin {
*
* @param {Event} event
*/
public handleSubmit = (event: Event): void => {
private handleSubmit(event: Event): void {
this.showLoginProcess();
if (typeof this.options.submitHandler === 'function') {
......@@ -79,7 +79,7 @@ class BackendLogin {
/**
* Store the new selected Interface in a cookie to save it for future visits
*/
public interfaceSelectorChanged = (): void => {
private interfaceSelectorChanged(): void {
const now = new Date();
// cookie expires in one year
const expires = new Date(now.getTime() + 1000 * 60 * 60 * 24 * 365);
......@@ -91,7 +91,7 @@ class BackendLogin {
/**
* Check if an interface was stored in a cookie and preselect it in the select box
*/
public checkForInterfaceCookie = (): void => {
private checkForInterfaceCookie(): void {
if ($(this.options.interfaceField).length) {
const posStart = document.cookie.indexOf('typo3-login-interface=');
if (posStart !== -1) {
......@@ -105,7 +105,7 @@ class BackendLogin {
/**
* Hides input fields and shows cookie warning
*/
public showCookieWarning = (): void => {
private showCookieWarning(): void {
$(this.options.formFields).addClass('hidden');
$(this.options.errorNoCookies).removeClass('hidden');
}
......@@ -113,7 +113,7 @@ class BackendLogin {
/**
* Hides cookie warning and shows input fields
*/
public hideCookieWarning = (): void => {
private hideCookieWarning(): void {
$(this.options.formFields).removeClass('hidden');
$(this.options.errorNoCookies).addClass('hidden');
}
......@@ -122,7 +122,7 @@ class BackendLogin {
* Checks browser's cookie support
* see http://stackoverflow.com/questions/8112634/jquery-detecting-cookies-enabled
*/
public checkCookieSupport = (): void => {
private checkCookieSupport(): void {
const cookieEnabled = navigator.cookieEnabled;
// when cookieEnabled flag is present and false then cookies are disabled.
......@@ -148,13 +148,13 @@ class BackendLogin {
/**
* Registers listeners for the Login Interface
*/
public initializeEvents = (): void => {
$(document).ajaxStart(this.showLoadingIndicator);
$(this.options.loginForm).on('submit', this.handleSubmit);
private initializeEvents(): void {
$(document).ajaxStart(this.showLoadingIndicator.bind(this));
$(this.options.loginForm).on('submit', this.handleSubmit.bind(this));
// the Interface selector is not always present, so this check is needed
if ($(this.options.interfaceField).length > 0) {
$(document).on('change blur', this.options.interfaceField, this.interfaceSelectorChanged);
$(document).on('change blur', this.options.interfaceField, this.interfaceSelectorChanged.bind(this));
}
(<NodeListOf<HTMLInputElement>>document.querySelectorAll('.t3js-clearable')).forEach(
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","jquery","bootstrap","TYPO3/CMS/Backend/Input/Clearable"],(function(o,i,e){"use strict";return new class{constructor(){this.showLoginProcess=()=>{this.showLoadingIndicator(),e(this.options.error).addClass("hidden"),e(this.options.errorNoCookies).addClass("hidden")},this.showLoadingIndicator=()=>{e(this.options.submitButton).button("loading")},this.handleSubmit=o=>{this.showLoginProcess(),"function"==typeof this.options.submitHandler&&this.options.submitHandler(o)},this.interfaceSelectorChanged=()=>{const o=new Date,i=new Date(o.getTime()+31536e6);document.cookie="typo3-login-interface="+e(this.options.interfaceField).val()+"; expires="+i.toUTCString()+";"},this.checkForInterfaceCookie=()=>{if(e(this.options.interfaceField).length){const o=document.cookie.indexOf("typo3-login-interface=");if(-1!==o){let i=document.cookie.substr(o+22);i=i.substr(0,i.indexOf(";")),e(this.options.interfaceField).val(i)}}},this.showCookieWarning=()=>{e(this.options.formFields).addClass("hidden"),e(this.options.errorNoCookies).removeClass("hidden")},this.hideCookieWarning=()=>{e(this.options.formFields).removeClass("hidden"),e(this.options.errorNoCookies).addClass("hidden")},this.checkCookieSupport=()=>{const o=navigator.cookieEnabled;!1===o?this.showCookieWarning():document.cookie||null!==o||(document.cookie="typo3-login-cookiecheck=1",document.cookie?document.cookie="typo3-login-cookiecheck=; expires="+new Date(0).toUTCString():this.showCookieWarning())},this.initializeEvents=()=>{e(document).ajaxStart(this.showLoadingIndicator),e(this.options.loginForm).on("submit",this.handleSubmit),e(this.options.interfaceField).length>0&&e(document).on("change blur",this.options.interfaceField,this.interfaceSelectorChanged),document.querySelectorAll(".t3js-clearable").forEach(o=>o.clearable()),e(".t3js-login-news-carousel").on("slide.bs.carousel",o=>{const i=e(o.relatedTarget).height();e(o.target).find("div.active").parent().animate({height:i},500)})},this.options={error:".t3js-login-error",errorNoCookies:".t3js-login-error-nocookies",formFields:".t3js-login-formfields",interfaceField:".t3js-login-interface-field",loginForm:"#typo3-login-form",submitButton:".t3js-login-submit",submitHandler:null,useridentField:".t3js-login-userident-field"},this.checkCookieSupport(),this.checkForInterfaceCookie(),this.initializeEvents(),top.location.href!==location.href&&(top.location.href=location.href)}}}));
\ No newline at end of file
define(["require","exports","jquery","bootstrap","TYPO3/CMS/Backend/Input/Clearable"],(function(o,e,i){"use strict";return new class{constructor(){this.options={error:".t3js-login-error",errorNoCookies:".t3js-login-error-nocookies",formFields:".t3js-login-formfields",interfaceField:".t3js-login-interface-field",loginForm:"#typo3-login-form",submitButton:".t3js-login-submit",submitHandler:null,useridentField:".t3js-login-userident-field"},this.checkCookieSupport(),this.checkForInterfaceCookie(),this.initializeEvents(),top.location.href!==location.href&&(top.location.href=location.href)}showLoginProcess(){this.showLoadingIndicator(),i(this.options.error).addClass("hidden"),i(this.options.errorNoCookies).addClass("hidden")}showLoadingIndicator(){i(this.options.submitButton).button("loading")}handleSubmit(o){this.showLoginProcess(),"function"==typeof this.options.submitHandler&&this.options.submitHandler(o)}interfaceSelectorChanged(){const o=new Date,e=new Date(o.getTime()+31536e6);document.cookie="typo3-login-interface="+i(this.options.interfaceField).val()+"; expires="+e.toUTCString()+";"}checkForInterfaceCookie(){if(i(this.options.interfaceField).length){const o=document.cookie.indexOf("typo3-login-interface=");if(-1!==o){let e=document.cookie.substr(o+22);e=e.substr(0,e.indexOf(";")),i(this.options.interfaceField).val(e)}}}showCookieWarning(){i(this.options.formFields).addClass("hidden"),i(this.options.errorNoCookies).removeClass("hidden")}hideCookieWarning(){i(this.options.formFields).removeClass("hidden"),i(this.options.errorNoCookies).addClass("hidden")}checkCookieSupport(){const o=navigator.cookieEnabled;!1===o?this.showCookieWarning():document.cookie||null!==o||(document.cookie="typo3-login-cookiecheck=1",document.cookie?document.cookie="typo3-login-cookiecheck=; expires="+new Date(0).toUTCString():this.showCookieWarning())}initializeEvents(){i(document).ajaxStart(this.showLoadingIndicator.bind(this)),i(this.options.loginForm).on("submit",this.handleSubmit.bind(this)),i(this.options.interfaceField).length>0&&i(document).on("change blur",this.options.interfaceField,this.interfaceSelectorChanged.bind(this)),document.querySelectorAll(".t3js-clearable").forEach(o=>o.clearable()),i(".t3js-login-news-carousel").on("slide.bs.carousel",o=>{const e=i(o.relatedTarget).height();i(o.target).find("div.active").parent().animate({height:e},500)})}}}));
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment