@ -6,32 +6,49 @@ define([
'/customize/languageSelector.js' ,
'/customize/languageSelector.js' ,
'/bower_components/jquery/dist/jquery.min.js' ,
'/bower_components/jquery/dist/jquery.min.js' ,
] , function ( Messages , Config , Cryptpad , LilUri , LS ) {
] , function ( Messages , Config , Cryptpad , LilUri , LS ) {
if ( Cryptpad . isLoggedIn ( ) ) {
document . location . href = '/drive' ;
return ;
}
var $ = window . $ ;
var $ = window . $ ;
var $main = $ ( '#mainBlock' ) ;
var USE _TABLE = Config . USE _HOMEPAGE _TABLE ;
var USE _FS _STORE = Config . USE _FS _STORE ;
var APP = window . APP = {
var APP = window . APP = {
Cryptpad : Cryptpad ,
Cryptpad : Cryptpad ,
} ;
} ;
// Language selector
var $sel = $ ( '#language-selector' ) ;
Cryptpad . createLanguageSelector ( undefined , $sel ) ;
$sel . find ( 'button' ) . addClass ( 'btn' ) . addClass ( 'btn-secondary' ) ;
$sel . show ( ) ;
$ ( window ) . click ( function ( ) {
$ ( '.cryptpad-dropdown' ) . hide ( ) ;
} ) ;
// main block is hidden in case javascript is disabled
// main block is hidden in case javascript is disabled
$ ( '#mainBlock' ) . removeClass ( 'hidden' ) ;
$ main. removeClass ( 'hidden' ) ;
var padTypes = {
// Make sure we don't display non-translated content (empty button)
'/pad/' : Messages . type . pad ,
$main . find ( '#data' ) . removeClass ( 'hidden' ) ;
'/code/' : Messages . type . code ,
'/poll/' : Messages . type . poll ,
if ( Cryptpad . isLoggedIn ( ) ) {
'/slide/' : Messages . type . slide ,
var name = localStorage [ Cryptpad . userNameKey ] || sessionStorage [ Cryptpad . userNameKey ] ;
} ;
var $loggedInBlock = $main . find ( '#loggedIn' ) ;
var $hello = $loggedInBlock . find ( '#loggedInHello' ) ;
var $logout = $loggedInBlock . find ( '#loggedInLogOut' ) ;
$hello . text ( Messages . _getKey ( 'login_hello' , [ name ] ) ) ;
$ ( '#buttons' ) . find ( '.nologin' ) . hide ( ) ;
$logout . click ( function ( ) {
Cryptpad . logout ( function ( ) {
window . location . reload ( ) ;
} ) ;
} ) ;
var now = new Date ( ) ;
$loggedInBlock . removeClass ( 'hidden' ) ;
var hasRecent = false ;
//return;
} else {
$main . find ( '#userForm' ) . removeClass ( 'hidden' ) ;
}
var displayCreateButtons = function ( ) {
var displayCreateButtons = function ( ) {
var $parent = $ ( '#buttons' ) ;
var $parent = $ ( '#buttons' ) ;
@ -55,17 +72,6 @@ define([
$block . find ( 'button' ) . addClass ( 'btn' ) . addClass ( 'btn-success' ) ;
$block . find ( 'button' ) . addClass ( 'btn' ) . addClass ( 'btn-success' ) ;
$block . appendTo ( $parent ) ;
$block . appendTo ( $parent ) ;
} ;
} ;
// Language selector
var $sel = $ ( '#language-selector' ) ;
Cryptpad . createLanguageSelector ( undefined , $sel ) ;
$sel . find ( 'button' ) . addClass ( 'btn' ) . addClass ( 'btn-secondary' ) ;
$sel . show ( ) ;
$ ( window ) . click ( function ( ) {
$sel . find ( '.cryptpad-dropdown' ) . hide ( ) ;
} ) ;
var addButtonHandlers = function ( ) {
var addButtonHandlers = function ( ) {
$ ( 'button.login' ) . click ( function ( e ) {
$ ( 'button.login' ) . click ( function ( e ) {
var username = $ ( '#name' ) . val ( ) ;
var username = $ ( '#name' ) . val ( ) ;