diff options
author | Thomas Lange <code@nerdmind.de> | 2017-04-10 22:47:54 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2017-04-10 22:47:54 +0200 |
commit | 8615695162fa67b02cbbc2acf46baefb752813ac (patch) | |
tree | 9a8d1be6ea679f7163890c98be35d4ea3087a819 /template | |
parent | da262a32ec4ff009b70059fe78fffadeeb18d4f3 (diff) | |
download | blog-8615695162fa67b02cbbc2acf46baefb752813ac.tar.gz blog-8615695162fa67b02cbbc2acf46baefb752813ac.tar.xz blog-8615695162fa67b02cbbc2acf46baefb752813ac.zip |
Javascript for confirmation message on delete buttons was moved to the main.js file to prevent trouble with an active Content-Security-Policy in a case where "unsafe-inline" for Javascript is not allowed.
Diffstat (limited to 'template')
-rw-r--r-- | template/admin/html/page/form.php | 2 | ||||
-rw-r--r-- | template/admin/html/post/form.php | 2 | ||||
-rw-r--r-- | template/admin/html/user/form.php | 2 | ||||
-rw-r--r-- | template/admin/rsrc/main.js | 11 |
4 files changed, 14 insertions, 3 deletions
diff --git a/template/admin/html/page/form.php b/template/admin/html/page/form.php index 99b3e00..9b8a39e 100644 --- a/template/admin/html/page/form.php +++ b/template/admin/html/page/form.php @@ -85,7 +85,7 @@ <?php elseif($FORM['TYPE'] === 'UPDATE'): ?> <input type="submit" name="update" value="<?=$Language->text('update')?>" /> <?php elseif($FORM['TYPE'] === 'DELETE'): ?> - <input type="submit" name="delete" value="<?=$Language->text('delete')?>" onclick="return confirm('<?=$Language->template('sure')?>')" /> + <input type="submit" name="delete" value="<?=$Language->text('delete')?>" id="delete-button" data-text="<?=$Language->template('sure')?>" /> <?php endif; ?> </section> </form>
\ No newline at end of file diff --git a/template/admin/html/post/form.php b/template/admin/html/post/form.php index cba4aa8..66db820 100644 --- a/template/admin/html/post/form.php +++ b/template/admin/html/post/form.php @@ -85,7 +85,7 @@ <?php elseif($FORM['TYPE'] === 'UPDATE'): ?> <input type="submit" name="update" value="<?=$Language->text('update')?>" /> <?php elseif($FORM['TYPE'] === 'DELETE'): ?> - <input type="submit" name="delete" value="<?=$Language->text('delete')?>" onclick="return confirm('<?=$Language->template('sure')?>')" /> + <input type="submit" name="delete" value="<?=$Language->text('delete')?>" id="delete-button" data-text="<?=$Language->template('sure')?>" /> <?php endif; ?> </section> </form>
\ No newline at end of file diff --git a/template/admin/html/user/form.php b/template/admin/html/user/form.php index 333b46d..845c55c 100644 --- a/template/admin/html/user/form.php +++ b/template/admin/html/user/form.php @@ -91,7 +91,7 @@ <?php elseif($FORM['TYPE'] === 'UPDATE'): ?> <input type="submit" name="update" value="<?=$Language->text('update')?>" /> <?php elseif($FORM['TYPE'] === 'DELETE'): ?> - <input type="submit" name="delete" value="<?=$Language->text('delete')?>" onclick="return confirm('<?=$Language->template('sure')?>')" /> + <input type="submit" name="delete" value="<?=$Language->text('delete')?>" id="delete-button" data-text="<?=$Language->template('sure')?>" /> <?php endif; ?> </section> </form>
\ No newline at end of file diff --git a/template/admin/rsrc/main.js b/template/admin/rsrc/main.js index 3d5546f..679a3fc 100644 --- a/template/admin/rsrc/main.js +++ b/template/admin/rsrc/main.js @@ -91,4 +91,15 @@ addEventListener("DOMContentLoaded", function() { } }, false); } +}, false); + +//============================================================================== +// Confirmation message for delete buttons +//============================================================================== +addEventListener("DOMContentLoaded", function() { + if(document.getElementById("delete-button")) { + document.getElementById("delete-button").onclick = function(e) { + return confirm(e.target.getAttribute('data-text')); + }; + } }, false);
\ No newline at end of file |