source: trunk/admin/themes/default/js/batchManagerGlobal.js @ 28806

Last change on this file since 28806 was 28806, checked in by rvelices, 10 years ago

moved around 100k of javascript from synchronous loading to async... (a lot more could be done...)

File size: 1.2 KB
Line 
1
2/* Shift-click: select all photos between the click and the shift+click */
3jQuery(document).ready(function() {
4        var last_clicked=0,
5                last_clickedstatus=true;
6        jQuery.fn.enableShiftClick = function() {
7                var inputs = [],
8                        count=0;
9                this.find('input[type=checkbox]').each(function() {
10                        var pos=count;
11                        inputs[count++]=this;
12                        $(this).bind("shclick", function (dummy,event) {
13                                if (event.shiftKey) {
14                                        var first = last_clicked;
15                                        var last = pos;
16                                        if (first > last) {
17                                                first=pos;
18                                                last=last_clicked;
19                                        }
20
21                                        for (var i=first; i<=last;i++) {
22                                                input = $(inputs[i]);
23                                                $(input).prop('checked', last_clickedstatus);
24                                                if (last_clickedstatus)
25                                                {
26                                                        $(input).siblings("span.wrap2").addClass("thumbSelected");
27                                                }
28                                                else
29                                                {
30                                                        $(input).siblings("span.wrap2").removeClass("thumbSelected");
31                                                }
32                                        }
33                                }
34                                else {
35                                        last_clicked = pos;
36                                        last_clickedstatus = this.checked;
37                                }
38                                return true;
39                        });
40                        $(this).click(function(event) { $(this).triggerHandler("shclick",event)});
41                });
42        }
43        $('ul.thumbnails').enableShiftClick();
44});
45
46jQuery('[data-datepicker]').pwgDatepicker({
47        showTimepicker: true,
48        cancelButton: lang.Cancel
49});
50
51jQuery("a.preview-box").colorbox();
Note: See TracBrowser for help on using the repository browser.