Commit a503c396 authored by Peter Walter's avatar Peter Walter
Browse files

Merge branch 'feature-report-spam' into 'master'

modify spam button to forward original message to is-spam@labs.sophos.com, and delete ticket

Closes #7

See merge request !1
parents a56ae157 3d2eca1f
......@@ -5,7 +5,7 @@
// @match https://helpdesk.ebi.ac.uk/*
// @include https://helpdesk.ebi.ac.uk/*
// @grant GM_xmlhttpRequest
// @version 2.6.1
// @version 2.7.0
// @updateURL https://gitlab.ebi.ac.uk/ebiwd/rthelper/raw/stable/rthelper.user.js
// @downloadURL https://gitlab.ebi.ac.uk/ebiwd/rthelper/raw/stable/rthelper.user.js
// @supportURL https://gitlab.ebi.ac.uk/ebiwd/rthelper/issues
......@@ -424,6 +424,21 @@ function init() {
element.focus();
})();
// click on element named in Click query string
(function doClick() {
var clickElement = getParameterByName('Click');
if (!clickElement) {
return;
}
var element = document.querySelector('[name="' + clickElement + '"]');
if (!element) {
return;
}
element.click();
})();
// apply login and password to login box
(function autoLogin() {
if (!document.querySelector('form#login') || document.querySelector('ul.action-results li') || document.referrer.indexOf(info.path + '/NoAuth/Logout.html') !== -1) {
......@@ -753,11 +768,13 @@ function init() {
}
insertLink(
container,
'SPAM',
buildLink(
getModifyLink({'Queue':'spam','Status':'deleted'}),
refreshElement('#body')
)
'Report Spam',
"javascript:(function(){" +
"links=document.querySelectorAll('.actions .forward-link');fw=window.open(links[links.length-1].href+'&To=is-spam@labs.sophos.com&Content=Reporting+as+spam&Click=Forward','_blank');wait=setInterval(function(){if(fw.document.location.pathname=='/Ticket/Forward.html'&&fw.document.location.search==''){" +
"clearInterval(wait);fw.close();" +
"mod=document.querySelector('a#page-basics').href;jQuery.ajax({url:mod+'&Status=deleted',cache:false,complete:function(){location.reload();}})" +
"}},1000);" +
"})()"
);
})();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment