Package: filetea / 0.1.16-4

jquery-compat.patch Patch series | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
From: harikrishnakanchi <harikrishnakanchi@gmail.com>
Subject: Make Filetea work with jQuery 3
Bug-Debian: https://bugs.debian.org/862742
Index: filetea/html/default/transfersView.js
===================================================================
--- filetea.orig/html/default/transfersView.js
+++ filetea/html/default/transfersView.js
@@ -73,6 +73,24 @@ Evd.Object.extend (TransfersView.prototy
             "aborted",
             "aborted"
         ];
+        this._cancelDialog = $ ("#transfer-list-confirm-cancel");
+        this._cancelDialog.dialog({
+                modal: true,
+                title: "Cancel transfer",
+                autoOpen: false,
+                buttons: {
+                    "Yes": function () {
+                        var id = $ (this).dialog("option", "transferId");
+                        self._transfers.cancel ([id]);
+
+                        $ (this).dialog ("close");
+                    },
+                    "No": function () {
+                        $ (this).dialog ("close");
+                    }
+                }
+        });
+
     },
 
     _newContainer: function (parent, inner, className) {
@@ -167,20 +185,8 @@ Evd.Object.extend (TransfersView.prototy
 
         var self = this;
         if (item.status == TransferManager.Status.ACTIVE) {
-            $ ("#transfer-list-confirm-cancel").dialog({
-                modal: true,
-                title: "Cancel transfer",
-                buttons: {
-                    "Yes": function () {
-                        self._transfers.cancel ([id]);
-
-                        $ (this).dialog ("close");
-                    },
-                    "No": function () {
-                        $ (this).dialog ("close");
-                    }
-                }
-            });
+            self._cancelDialog.dialog("option", "transferId", id);
+            self._cancelDialog.dialog('open');
         }
         else {
             delete (this._items[id]);
@@ -228,7 +234,7 @@ Evd.Object.extend (TransfersView.prototy
     },
 
     _onTransferFinished: function (transfer) {
-        $ ("#transfer-list-confirm-cancel").dialog ("close");
+        this._cancelDialog.dialog("close");
 
         this._onTransferStatus (transfer);
 
Index: filetea/html/default/ux.js
===================================================================
--- filetea.orig/html/default/ux.js
+++ filetea/html/default/ux.js
@@ -43,8 +43,6 @@ Evd.Object.extend (UxManager.prototype,
         this._content.addEventListener ("show",
             function (id, name) {
                 document.title = name + " - " + self._baseTitle;
-                self._tabs.tabs ("select", "#" + id);
-
                 self.setHighlight (id, false);
             });
         this._content.addEventListener ("loading",
@@ -112,20 +110,11 @@ Evd.Object.extend (UxManager.prototype,
             remove: function (event, ui) {
                 self._content.invalidate (ui.panel.id);
             },
-            select: window.location.hash
+            beforeActivate: function (event, ui) {
+                window.location.hash = ui.newPanel[0].id;
+            }
         });
 
-        self._tabs.bind ("tabsselect",
-            function (event, ui) {
-                window.location.hash = ui.tab.hash;
-            });
-
-        $ ("#tabs span.ui-icon-close").live ("click",
-            function (event, ui) {
-                var index = $ ("li", self._tabs).index ($ (this).parent ());
-                self._tabs.tabs ("remove", index);
-            });
-
         self._content.start ();
 
         setTimeout (function () {
@@ -143,7 +132,18 @@ Evd.Object.extend (UxManager.prototype,
                 div = document.createElement ("div");
                 div.id = id;
                 document.getElementById ("tabs").appendChild (div);
-                self._tabs.tabs ("add", "#" + id, name, index);
+                var closeButton = $ ("<span class='ui-icon ui-icon-close'>Remove Tab</span>");
+                closeButton.on ("click", function (event, ui) {
+                    var tab = $ (this).parent ().remove();
+                    var panelId = tab.attr( "aria-controls" );
+                    $( "#" + panelId ).remove();
+                    self._tabs.tabs ("refresh");
+                });
+
+                $ ("<li>").append($ ("<a>", {href: "#" + id}).html(name))
+                    .append(closeButton)
+                    .appendTo($ ("#tabs .ui-tabs-nav"));
+                self._tabs.tabs("refresh");
             }
 
             return div;
@@ -156,7 +156,8 @@ Evd.Object.extend (UxManager.prototype,
     _loading: function (id) {
         var div = document.getElementById (id);
         if (div) {
-            this._tabs.tabs ("select", "#" + id);
+            var index = $('#tabs a[href="#' + id + '"]').parent().index();
+            this._tabs.tabs ("option", "active", index);
             div.innerHTML = '<div id="content-loading"></div>';
         }
     },
@@ -166,6 +167,8 @@ Evd.Object.extend (UxManager.prototype,
 
         this._addContent (id, "Download");
         this._loading (id);
+        var index = $('#tabs a[href="#' + id + '"]').parent().index();
+        this._tabs.tabs('option', 'active', index);
 
         var el = $ ("#" + id).get(0);