Project

General

Profile

Highlight my backlog » History » Version 2

Tom Clegg, 07/11/2015 03:24 AM

1 1 Tom Clegg
h1. Highlight my backlog
2
3
<pre><code class="javascript">
4
// ==UserScript==
5
// @name         Highlight my redmine backlog
6 2 Tom Clegg
// @namespace    https://arvados.org/projects/arvados/wiki/Highlight_my_backlog
7 1 Tom Clegg
// @version      0.1
8
// @description  Highlights issues assigned to you in redmine Backlogs view.
9
// @author       Tom Clegg
10
// @match        https://arvados.org/rb/master_backlog/*
11
// @grant        none
12
// ==/UserScript==
13
14
$.ajax('/my/account', {success: function(data, _, _) {
15
    var key = $('#api-access-key',data).text();
16
    var url = '/issues.json?assigned_to_id=me&limit=100';
17
    var ajaxopts = {
18
        dataType: 'json',
19
        headers: {'X-Redmine-API-Key': key},
20
        success: dopage
21
    };
22
    $.ajax(url, ajaxopts);
23
    function dopage(data, _, _) {
24
        for (var i=0; i<data.issues.length; i++) {
25
            $('#story_'+data.issues[i].id).css({
26
                //background:'#faa',
27
                'font-weight':'bold'
28
            });
29
        }
30
        if (data.total_count > data.offset + data.limit) {
31
            $.ajax(url + '&offset=' + (data.offset + data.limit), ajaxopts);
32
        }
33
    }
34
}});
35
</code></pre>