Use window.prerenderReady to know when a page is fully loaded
parent
3fd2939c2c
commit
2a968bddd9
|
@ -191,7 +191,8 @@ PublicRegisterMessageDirective = ($config, $navUrls, templates) ->
|
||||||
template: templateFn
|
template: templateFn
|
||||||
}
|
}
|
||||||
|
|
||||||
module.directive("tgPublicRegisterMessage", ["$tgConfig", "$tgNavUrls", "$tgTemplate", PublicRegisterMessageDirective])
|
module.directive("tgPublicRegisterMessage", ["$tgConfig", "$tgNavUrls", "$tgTemplate",
|
||||||
|
PublicRegisterMessageDirective])
|
||||||
|
|
||||||
|
|
||||||
LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $events, $translate) ->
|
LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $events, $translate) ->
|
||||||
|
@ -227,11 +228,17 @@ LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls, $
|
||||||
|
|
||||||
$el.on "submit", "form", submit
|
$el.on "submit", "form", submit
|
||||||
|
|
||||||
|
window.prerenderReady = true
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgConfig", "$routeParams",
|
module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgConfig", "$routeParams",
|
||||||
"$tgNavUrls", "$tgEvents", "$translate", LoginDirective])
|
"$tgNavUrls", "$tgEvents", "$translate", LoginDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Register Directive
|
## Register Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -270,11 +277,17 @@ RegisterDirective = ($auth, $confirm, $location, $navUrls, $config, $analytics,
|
||||||
|
|
||||||
$el.on "submit", "form", submit
|
$el.on "submit", "form", submit
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
|
window.prerenderReady = true
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgNavUrls", "$tgConfig",
|
module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgNavUrls", "$tgConfig",
|
||||||
"$tgAnalytics", "$translate", RegisterDirective])
|
"$tgAnalytics", "$translate", RegisterDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Forgot Password Directive
|
## Forgot Password Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -306,11 +319,17 @@ ForgotPasswordDirective = ($auth, $confirm, $location, $navUrls, $translate) ->
|
||||||
|
|
||||||
$el.on "submit", "form", submit
|
$el.on "submit", "form", submit
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
|
window.prerenderReady = true
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgForgotPassword", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgNavUrls", "$translate",
|
module.directive("tgForgotPassword", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgNavUrls", "$translate",
|
||||||
ForgotPasswordDirective])
|
ForgotPasswordDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Change Password from Recovery Directive
|
## Change Password from Recovery Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -350,10 +369,15 @@ ChangePasswordFromRecoveryDirective = ($auth, $confirm, $location, $params, $nav
|
||||||
|
|
||||||
$el.on "submit", "form", submit
|
$el.on "submit", "form", submit
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgChangePasswordFromRecovery", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams",
|
module.directive("tgChangePasswordFromRecovery", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams",
|
||||||
"$tgNavUrls", "$translate", ChangePasswordFromRecoveryDirective])
|
"$tgNavUrls", "$translate",
|
||||||
|
ChangePasswordFromRecoveryDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Invitation
|
## Invitation
|
||||||
|
@ -380,7 +404,9 @@ InvitationDirective = ($auth, $confirm, $location, $params, $navUrls, $analytics
|
||||||
onSuccessSubmitLogin = (response) ->
|
onSuccessSubmitLogin = (response) ->
|
||||||
$analytics.trackEvent("auth", "invitationAccept", "invitation accept with existing user", 1)
|
$analytics.trackEvent("auth", "invitationAccept", "invitation accept with existing user", 1)
|
||||||
$location.path($navUrls.resolve("project", {project: $scope.invitation.project_slug}))
|
$location.path($navUrls.resolve("project", {project: $scope.invitation.project_slug}))
|
||||||
text = $translate.instant("INVITATION_LOGIN_FORM.SUCCESS", {"project_name": $scope.invitation.project_name})
|
text = $translate.instant("INVITATION_LOGIN_FORM.SUCCESS", {
|
||||||
|
"project_name": $scope.invitation.project_name
|
||||||
|
})
|
||||||
|
|
||||||
$confirm.notify("success", text)
|
$confirm.notify("success", text)
|
||||||
|
|
||||||
|
@ -428,11 +454,15 @@ InvitationDirective = ($auth, $confirm, $location, $params, $navUrls, $analytics
|
||||||
$el.on "submit", "form.register-form", submitRegister
|
$el.on "submit", "form.register-form", submitRegister
|
||||||
$el.on "click", ".button-register", submitRegister
|
$el.on "click", ".button-register", submitRegister
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams",
|
module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams",
|
||||||
"$tgNavUrls", "$tgAnalytics", "$translate", InvitationDirective])
|
"$tgNavUrls", "$tgAnalytics", "$translate", InvitationDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Change Email
|
## Change Email
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -471,10 +501,14 @@ ChangeEmailDirective = ($repo, $model, $auth, $confirm, $location, $params, $nav
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
submit()
|
submit()
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgChangeEmail", ["$tgRepo", "$tgModel", "$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams",
|
module.directive("tgChangeEmail", ["$tgRepo", "$tgModel", "$tgAuth", "$tgConfirm", "$tgLocation",
|
||||||
"$tgNavUrls", "$translate", ChangeEmailDirective])
|
"$routeParams", "$tgNavUrls", "$translate", ChangeEmailDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Cancel account
|
## Cancel account
|
||||||
|
@ -510,7 +544,10 @@ CancelAccountDirective = ($repo, $model, $auth, $confirm, $location, $params, $n
|
||||||
|
|
||||||
$el.on "submit", "form", submit
|
$el.on "submit", "form", submit
|
||||||
|
|
||||||
|
$scope.$on "$destroy", ->
|
||||||
|
$el.off()
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgCancelAccount", ["$tgRepo", "$tgModel", "$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams",
|
module.directive("tgCancelAccount", ["$tgRepo", "$tgModel", "$tgAuth", "$tgConfirm", "$tgLocation",
|
||||||
"$tgNavUrls", CancelAccountDirective])
|
"$routeParams","$tgNavUrls", CancelAccountDirective])
|
||||||
|
|
|
@ -66,7 +66,9 @@ Loader = ($rootscope) ->
|
||||||
if diff < config.minTime
|
if diff < config.minTime
|
||||||
timeoutValue = config.minTime - diff
|
timeoutValue = config.minTime - diff
|
||||||
|
|
||||||
timeout(timeoutValue, -> $rootscope.$broadcast("loader:end"))
|
timeout timeoutValue, ->
|
||||||
|
$rootscope.$broadcast("loader:end")
|
||||||
|
window.prerenderReady = true # Needed by Prerender Server
|
||||||
|
|
||||||
startLoadTime = 0
|
startLoadTime = 0
|
||||||
requestCount = 0
|
requestCount = 0
|
||||||
|
|
|
@ -11,6 +11,9 @@ html(lang="en")
|
||||||
link(rel="stylesheet", href="/styles/main.css")
|
link(rel="stylesheet", href="/styles/main.css")
|
||||||
link(rel="icon", type="image/png", href="/images/favicon.png")
|
link(rel="icon", type="image/png", href="/images/favicon.png")
|
||||||
|
|
||||||
|
//- PRERENDER SERVICE: This is to know when the page is completely loaded.
|
||||||
|
script(type='text/javascript').
|
||||||
|
window.prerenderReady = false;
|
||||||
|
|
||||||
body(tg-main)
|
body(tg-main)
|
||||||
include partials/includes/components/notification-message
|
include partials/includes/components/notification-message
|
||||||
|
|
Loading…
Reference in New Issue