From ea5218ea03f76a9c376509e27dfa5b8797f91db4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 5 Jan 2022 08:04:38 +0100 Subject: [PATCH] add SeeddmsAjax for running function after updating div.ajax --- views/bootstrap/styles/application.js | 26 ++++++++++++++++++++++++++ views/bootstrap4/styles/application.js | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index db29c60f0..6795d4586 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -492,6 +492,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -542,6 +543,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -1366,3 +1368,27 @@ $(document).ready(function() { /* {{{ */ timeOutId = setTimeout(SeedDMSTask.run, timeout); } }( window.SeedDMSTask = window.SeedDMSTask || {}, jQuery )); /* }}} */ + +(function( SeedDMSAjax, $, undefined ) { /* {{{ */ + var tasks = Array( + {name: 'test', view: 'null', action: null, func: + test = function() { + console.log('Run in SeedDMSAjax'); + } + } + ); + + SeedDMSAjax.add = function(task) { + tasks.push(task); + } + + SeedDMSAjax.run = function(view, action) { + for(let task of tasks) { + //console.log('Checking for '+view+':'+action); + if(task.view == null || (task.view == view && task.action == null) || (task.view == view && task.action == action)) { + //console.log('Running '+task.name+' after update for '+view+':'+action); + task.func(); + } + } + } +}( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */ diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index 80ea3ae7d..a404f2def 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -523,6 +523,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -573,6 +574,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -1422,3 +1424,27 @@ $(document).ready(function() { /* {{{ */ timeOutId = setTimeout(SeedDMSTask.run, timeout); } }( window.SeedDMSTask = window.SeedDMSTask || {}, jQuery )); /* }}} */ + +(function( SeedDMSAjax, $, undefined ) { /* {{{ */ + var tasks = Array( + {name: 'test', view: 'null', action: null, func: + test = function() { + console.log('Run in SeedDMSAjax'); + } + } + ); + + SeedDMSAjax.add = function(task) { + tasks.push(task); + } + + SeedDMSAjax.run = function(view, action) { + for(let task of tasks) { + //console.log('Checking for '+view+':'+action); + if(task.view == null || (task.view == view && task.action == null) || (task.view == view && task.action == action)) { + //console.log('Running '+task.name+' after update for '+view+':'+action); + task.func(); + } + } + } +}( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */