Sentry fast delete

Add button to quickly delete all found issues

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Sentry fast delete
// @namespace    http://tampermonkey.net/
// @version      1.1.6
// @description  Add button to quickly delete all found issues
// @author       Cáno
// @match        https://sentry.getprintbox.com/hiddendata/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var delAllSafe = function() {
        document.querySelector('.chk-select-all').click();
        document.querySelector('.action-delete').click();
    };

    var delAll = function() {
        document.querySelector('.chk-select-all').click();
        document.querySelector('.action-delete').click();
        document.querySelector('.modal-footer .btn-primary').click();
        location.reload();
    };

    var delSelected = function() {
        document.querySelector('.action-delete').click();
        //document.querySelector('.modal-footer .btn-primary').click();
    };

    setInterval(function(){
        if (document.querySelector('.delete-all')) {
        } else if (document.querySelector('.stream-actions-left')) {
            var div = document.createElement('div');
            var html = `
<div class="btn-group">
<a class="btn btn-default btn-sm delete-selected"><span class="icon icon-trash" style="margin-right: 5px"></span>Delete selected
</a>
</div>
`;
            div.innerHTML = html.trim();
            div = div.firstChild;
            document.querySelector('.stream-actions-left').appendChild(div);
            document.querySelector('.delete-selected').onclick = delSelected;

            var div = document.createElement('div');
            var html = `
<div class="btn-group">
<a class="btn btn-default btn-sm delete-all-safe"><span class="icon icon-trash" style="margin-right: 5px"></span>Delete all
</a>
</div>
`;
            div.innerHTML = html.trim();
            div = div.firstChild;

            document.querySelector('.stream-actions-left').appendChild(div);
            document.querySelector('.delete-all-safe').onclick = delAllSafe;

            var div = document.createElement('div');
            var html = `
<div class="btn-group">
<a class="btn btn-default btn-sm delete-all"><span class="icon icon-trash" style="color: red; margin-right: 1px"></span></a>
</div>
`;
            div.innerHTML = html.trim();
            div = div.firstChild;

            document.querySelector('.stream-actions-left').appendChild(div);
            document.querySelector('.delete-all').onclick = delAll;
        }
    },1000);
})();