From c44ce3dd0abed7b2c951d33fcdf4c6ba44ca43d3 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sun, 4 Dec 2016 22:51:55 +0100 Subject: [PATCH] misc: move javascript out of logout.html content block (fixes #9197) --- src/authentic2/static/authentic2/js/logout.js | 19 +++++++++++++++++++ src/authentic2/templates/authentic2/logout.html | 23 ++++++----------------- 2 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 src/authentic2/static/authentic2/js/logout.js diff --git a/src/authentic2/static/authentic2/js/logout.js b/src/authentic2/static/authentic2/js/logout.js new file mode 100644 index 0000000..ab22d80 --- /dev/null +++ b/src/authentic2/static/authentic2/js/logout.js @@ -0,0 +1,19 @@ +window.iframe_count = 1; + +$(window).on('load', function () {window.iframe_count -= 1}); + +$(function() { + var redir_timeout = $('body').data('redir-timeout'); + var next_url = $('body').data('next-url'); + + window.iframe_count += document.getElementsByTagName("iframe").length; + var refresh_launched = 0; + setInterval(function () { + if (iframe_count == 0) { + if (refresh_launched == 0) { + refresh_launched = 1; + setTimeout(function () { window.location = next_url; }, 300); + } + } + }, redir_timeout); +}); diff --git a/src/authentic2/templates/authentic2/logout.html b/src/authentic2/templates/authentic2/logout.html index 4a7034e..cc75fe9 100644 --- a/src/authentic2/templates/authentic2/logout.html +++ b/src/authentic2/templates/authentic2/logout.html @@ -1,17 +1,18 @@ {% extends "authentic2/base-page.html" %} -{% load i18n gadjo %} +{% load i18n gadjo static %} {% block page-title %} {{ block.super }} - {% trans "Logout" %} {% endblock %} +{% block bodyargs %} + data-next-url="{{next_url}}" data-redir-timeout="{{redir_timeout}}" +{% endblock %} + {% block extrascripts %} {{ block.super }} - + {% endblock %} {% block user-links %} @@ -24,18 +25,6 @@ {{ fragment|safe }} {% endfor %} -