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)); -};