浏览代码

fix Snapshot admin actions buttons submitting on Safari

Nick Sweeting 4 年之前
父节点
当前提交
68a506e1a7
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      archivebox/templates/admin/base.html

+ 7 - 3
archivebox/templates/admin/base.html

@@ -148,14 +148,18 @@
                     $('<button>')
                         .appendTo(buttons)
                         .attr('name', this.value)
+                        .attr('type', 'button')
                         .addClass('button')
                         .text(this.text)
-                        .click(function () {
+                        .click(function (e) {
+                            e.preventDefault()
+                            e.stopPropagation()
                             container.find('select')
-                                .find(':selected').attr('selected', '').end()
-                                .find('[value=' + this.name + ']').attr('selected', 'selected');
+                                .find(':selected').removeAttr('selected').end()
+                                .find('[value=' + name + ']').attr('selected', 'selected').click();
                             $('#changelist-form button[name="index"]').click();
                             document.querySelector('#logo').outerHTML = '<div class="loader"></div>'
+                            return false
                         });
                 });
             }