Newer
Older
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
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)})}}}));