From 06d5918ca36c80d023f66bdd2d3d0375c7742779 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 12 Jan 2024 00:30:21 +0000 Subject: [PATCH] continue implementations --- Model/Action/Dom/Redirect.js | 22 ++++++++++++++++++++++ Model/Action/Dom/Reload.js | 13 ++++++++++++- Model/Message/Redirect.js | 17 ----------------- Model/Message/Reload.js | 12 ------------ 4 files changed, 34 insertions(+), 30 deletions(-) create mode 100644 Model/Action/Dom/Redirect.js delete mode 100755 Model/Message/Redirect.js delete mode 100755 Model/Message/Reload.js diff --git a/Model/Action/Dom/Redirect.js b/Model/Action/Dom/Redirect.js new file mode 100644 index 0000000..b2d892a --- /dev/null +++ b/Model/Action/Dom/Redirect.js @@ -0,0 +1,22 @@ +import { UriFactory } from '../../../Uri/UriFactory.js'; + +/** + * Redirect. + * + * @param {Object} action Action data + * @param {function} callback Callback + * @param {string} id Action element + * + * @since 1.0.0 + */ +export function redirectMessage (action, callback, id) +{ + setTimeout(function () + { + if (data.src) { + document.getElementById(data.src).src = UriFactory.build(data.uri); + } else { + window.location = UriFactory.build(data.uri); + } + }, parseInt(data.delay)); +}; diff --git a/Model/Action/Dom/Reload.js b/Model/Action/Dom/Reload.js index eabae4e..22ef174 100755 --- a/Model/Action/Dom/Reload.js +++ b/Model/Action/Dom/Reload.js @@ -1,3 +1,5 @@ +import { UriFactory } from '../../../Uri/UriFactory.js'; + /** * Reload page. * @@ -12,7 +14,16 @@ export function reloadButtonAction (action, callback, id) 'use strict'; setTimeout(function () { - document.location.reload(true); + if (action.src) { + console.log(document.getElementById(action.src).hasAttribute('data-src')); + console.log(UriFactory.build(document.getElementById(action.src).getAttribute('data-src'))); + + document.getElementById(action.src).src = document.getElementById(action.src).hasAttribute('data-src') + ? UriFactory.build(document.getElementById(action.src).getAttribute('data-src')) + : document.getElementById(action.src).src; + } else { + document.location.reload(); + } }, parseInt(action.delay)); callback(); diff --git a/Model/Message/Redirect.js b/Model/Message/Redirect.js deleted file mode 100755 index 0de9946..0000000 --- a/Model/Message/Redirect.js +++ /dev/null @@ -1,17 +0,0 @@ -import { UriFactory } from '../../Uri/UriFactory.js'; - -/** - * Redirect. - * - * @param {{delay:number},{uri:string}} data Message data - * - * @since 1.0.0 - */ -export function redirectMessage (data) -{ - setTimeout(function () - { - /** global: jsOMS */ - window.location = UriFactory.build(data.uri); - }, parseInt(data.delay)); -}; diff --git a/Model/Message/Reload.js b/Model/Message/Reload.js deleted file mode 100755 index 081b324..0000000 --- a/Model/Message/Reload.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Reload page. - * - * @param {{delay:number}} data Message data - * - * @since 1.0.0 - */ -export function reloadMessage (data) { - setTimeout(function () { - document.location.reload(); - }, parseInt(data.delay)); -};