From 883fdd82aca0573dff1382ab215719b891097f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 3 Dec 2015 20:50:14 +0100 Subject: [PATCH] misc: move javascript out of logout.html content block (#9197) --- src/authentic2/static/authentic2/js/logout.js | 15 +++++++++++++++ src/authentic2/templates/authentic2/logout.html | 16 +++------------- 2 files changed, 18 insertions(+), 13 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..a9b6d43 --- /dev/null +++ b/src/authentic2/static/authentic2/js/logout.js @@ -0,0 +1,15 @@ +$(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 833befc..cd1a97a 100644 --- a/src/authentic2/templates/authentic2/logout.html +++ b/src/authentic2/templates/authentic2/logout.html @@ -1,5 +1,5 @@ {% extends "authentic2/base-page.html" %} -{% load i18n %} +{% load i18n static %} {% block title %} {% trans "Logout" %} @@ -9,11 +9,13 @@ {% endblock %} {% block bodyargs %} + data-next-url="{{next_url}}" data-redir-timeout="{{redir_timeout}}" onload="window.iframe_count -= 1" {% endblock %} {% comment %}Initialize iframe countdown {% endcomment %} {% block extra_scripts %} + @@ -26,18 +28,6 @@ {{ fragment|safe }} {% endfor %} -