-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjira_cards_printing_utils.js
64 lines (64 loc) · 2.14 KB
/
jira_cards_printing_utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
(function(window){
window.withjQuery = function($){
$('.gh-issue')
.css('margin-bottom','20px')
.css('margin-left','5px')
.css('margin-right','10px')
.css('font-size','18px')
.css('height','200px')
.css('width','340px');
$('.gh-issue-inner')
.css('height','200px')
.css('width','340px');
$('.gh-issue-key').css('font-size','28px');
$('table.gh-print-page td').css('padding','0px');
$('.gh-issue-field.gh-issue-field-text.gh-issue-corner').css('width','40px');
}
window.withjQueryUI = function($){
var cssText = '<style type=\'text/css\'>'
+ '.ui-selectable .ui-selecting {background: #ccc;}'
+ '.ui-selected .gh-issue-inner .gh-subhead {background: yellow;}'
+ '.ui-selected {background: #ccc;}'
+ '@media print {#menu {display:none;}}'
+ '</style>'
;
$('head').append(cssText);
removeSelectedItems = function () {
$('.ui-selected').remove();
};
$('body').prepend('<ui id=\'menu\'><li><a href=\'javascript:removeSelectedItems();\'>Remove Selection</a></li></ul>').ready(function(){
$('#menu').menu();
});
setupDDS('.gh-issue', '.gh-issue-print tr > td', {my: 'left+4 top', at: 'left top'});
function setupDDS (draggableSelector, droppableSelector, dropPosition) {
dropPosition = dropPosition || {};
$(draggableSelector)
.on('mousedown', mouseDown)
.on('mouseup', mouseUp)
.draggable({cursor: 'move', start: hDragStart, opacity: 0.5, helper: 'clone'});
$(droppableSelector).droppable({
drop: hDropEnd,
tolerance: 'touch',
hoverClass: 'drop-hover',
activeClass: 'ui-state-highlight'
});
function mouseDown() {
dragged = false;
}
function mouseUp() {
if(!dragged) {
$(this).toggleClass('ui-selected');
}
}
function hDragStart (event, ui) {
dragged = true;
}
function hDropEnd (event, ui) {
var options = {of: $(this)};
$.extend(options, dropPosition);
ui.draggable.position(options);
ui.draggable.element = $(this);
}
}
}
})(window);