Browse Source

Upgrade jquery to 3.2.1

Comes with a feature removal that needed to be taken care of
spaghetti 7 years ago
parent
commit
bbcd0ddfc1

+ 1
- 1
static/functions/browse.js View File

185
   var showing = $(clickedRow).nextElementSibling().has_class('hidden');
185
   var showing = $(clickedRow).nextElementSibling().has_class('hidden');
186
   var allEditions = event.ctrlKey;
186
   var allEditions = event.ctrlKey;
187
   var group_rows = $('tr.groupid_' + groupid);
187
   var group_rows = $('tr.groupid_' + groupid);
188
-  for (var i = 0; i < group_rows.results(); i++) {
188
+  for (var i = 0; i < group_rows.length; i++) {
189
     var row = $(group_rows.raw(i));
189
     var row = $(group_rows.raw(i));
190
     if (row.has_class('edition') && (allEditions || row.raw(0) == clickedRow)) {
190
     if (row.has_class('edition') && (allEditions || row.raw(0) == clickedRow)) {
191
       var tooltip = showing
191
       var tooltip = showing

+ 1
- 1
static/functions/comments.js View File

116
   postid = post;
116
   postid = post;
117
   var boxWidth, postuserid, pmbox, inputname;
117
   var boxWidth, postuserid, pmbox, inputname;
118
   //If no edit is already going underway or a previous edit was finished, make the necessary dom changes.
118
   //If no edit is already going underway or a previous edit was finished, make the necessary dom changes.
119
-  if (!$('#editbox' + postid).results() || $('#editbox' + postid + '.hidden').results()) {
119
+  if (!$('#editbox' + postid).length || $('#editbox' + postid + '.hidden').length) {
120
     $('#reply_box').ghide();
120
     $('#reply_box').ghide();
121
     boxWidth = (location.href.match(/torrents\.php/) || location.href.match(/artist\.php/)) ? "50" : "80";
121
     boxWidth = (location.href.match(/torrents\.php/) || location.href.match(/artist\.php/)) ? "50" : "80";
122
     postuserid = $('#post' + postid + ' strong a').attr('href').split('=')[1];
122
     postuserid = $('#post' + postid + ' strong a').attr('href').split('=')[1];

+ 1
- 1
static/functions/donor_titles.js View File

1
 $(document).ready(function() {
1
 $(document).ready(function() {
2
-  if ($('#donor_title_prefix_preview').size() === 0) {
2
+  if ($('#donor_title_prefix_preview').length === 0) {
3
     return;
3
     return;
4
   }
4
   }
5
   $('#donor_title_prefix_preview').text($('#donor_title_prefix').val().trim() + ' ');
5
   $('#donor_title_prefix_preview').text($('#donor_title_prefix').val().trim() + ' ');

+ 16
- 19
static/functions/global.js View File

35
 }
35
 }
36
 
36
 
37
 $.fn.extend({
37
 $.fn.extend({
38
-  results: function () {
39
-    return this.size();
40
-  },
41
-  gshow: function () {
38
+  gshow: function() {
42
     return this.remove_class('hidden');
39
     return this.remove_class('hidden');
43
   },
40
   },
44
-  ghide: function (force) {
41
+  ghide: function(force) {
45
     return this.add_class('hidden', force);
42
     return this.add_class('hidden', force);
46
   },
43
   },
47
-  gtoggle: function (force) {
44
+  gtoggle: function(force) {
48
     if (this[0].className.split(' ').indexOf('hidden') == -1) {
45
     if (this[0].className.split(' ').indexOf('hidden') == -1) {
49
       this.add_class('hidden', force);
46
       this.add_class('hidden', force);
50
     } else {
47
     } else {
52
     }
49
     }
53
     return this;
50
     return this;
54
   },
51
   },
55
-  listen: function (event, callback) {
56
-    for (var i = 0, il = this.size(); i < il; i++) {
52
+  listen: function(event, callback) {
53
+    for (var i = 0; i < this.length; i++) {
57
       var object = this[i];
54
       var object = this[i];
58
       if (document.addEventListener) {
55
       if (document.addEventListener) {
59
         object.addEventListener(event, callback, false);
56
         object.addEventListener(event, callback, false);
63
     }
60
     }
64
     return this;
61
     return this;
65
   },
62
   },
66
-  add_class: function (class_name, force) {
67
-    for (var i = 0, il = this.size(); i < il; i++) {
63
+  add_class: function(class_name, force) {
64
+    for (var i = 0; i < this.length; i++) {
68
       var object = this[i];
65
       var object = this[i];
69
       if (object.className === '') {
66
       if (object.className === '') {
70
         object.className = class_name;
67
         object.className = class_name;
74
     }
71
     }
75
     return this;
72
     return this;
76
   },
73
   },
77
-  remove_class: function (class_name) {
78
-    for (var i = 0, il = this.size(); i < il; i++) {
74
+  remove_class: function(class_name) {
75
+    for (var i = 0; i < this.length; i++) {
79
       var object = this[i];
76
       var object = this[i];
80
       var classes = object.className.split(' ');
77
       var classes = object.className.split(' ');
81
       var result = classes.indexOf(class_name);
78
       var result = classes.indexOf(class_name);
87
     return this;
84
     return this;
88
   },
85
   },
89
   has_class: function(class_name) {
86
   has_class: function(class_name) {
90
-    for (var i = 0, il = this.size(); i < il; i++) {
87
+    for (var i = 0; i < this.length; i++) {
91
       var object = this[i];
88
       var object = this[i];
92
       var classes = object.className.split(' ');
89
       var classes = object.className.split(' ');
93
       if (classes.indexOf(class_name) != -1) {
90
       if (classes.indexOf(class_name) != -1) {
97
     return false;
94
     return false;
98
   },
95
   },
99
   toggle_class: function(class_name) {
96
   toggle_class: function(class_name) {
100
-    for (var i = 0, il = this.size(); i < il; i++) {
97
+    for (var i = 0, il; i < this.length; i++) {
101
       var object = this[i];
98
       var object = this[i];
102
       var classes = object.className.split(' ');
99
       var classes = object.className.split(' ');
103
       var result = classes.indexOf(class_name);
100
       var result = classes.indexOf(class_name);
114
     }
111
     }
115
     return this;
112
     return this;
116
   },
113
   },
117
-  disable : function () {
114
+  disable : function() {
118
     $(this).prop('disabled', true);
115
     $(this).prop('disabled', true);
119
     return this;
116
     return this;
120
   },
117
   },
121
-  enable : function () {
118
+  enable : function() {
122
     $(this).prop('disabled', false);
119
     $(this).prop('disabled', false);
123
     return this;
120
     return this;
124
   },
121
   },
125
-  raw: function (number) {
122
+  raw: function(number) {
126
     if (typeof number == 'undefined') {
123
     if (typeof number == 'undefined') {
127
       number = 0;
124
       number = 0;
128
     }
125
     }
129
     return $(this).get(number);
126
     return $(this).get(number);
130
   },
127
   },
131
-  nextElementSibling: function () {
128
+  nextElementSibling: function() {
132
     var here = this[0];
129
     var here = this[0];
133
     if (here.nextElementSibling) {
130
     if (here.nextElementSibling) {
134
       return $(here.nextElementSibling);
131
       return $(here.nextElementSibling);
138
     } while (here.nodeType != 1);
135
     } while (here.nodeType != 1);
139
     return $(here);
136
     return $(here);
140
   },
137
   },
141
-  previousElementSibling: function () {
138
+  previousElementSibling: function() {
142
     var here = this[0];
139
     var here = this[0];
143
     if (here.previousElementSibling) {
140
     if (here.previousElementSibling) {
144
       return $(here.previousElementSibling);
141
       return $(here.previousElementSibling);

+ 3
- 2
static/functions/jquery.js
File diff suppressed because it is too large
View File


+ 1
- 1
static/functions/jquery.validate.js View File

439
     },
439
     },
440
 
440
 
441
     valid: function() {
441
     valid: function() {
442
-      return this.size() === 0;
442
+      return this.length === 0;
443
     },
443
     },
444
 
444
 
445
     size: function() {
445
     size: function() {

+ 1
- 1
static/functions/notifications.js View File

30
     var nextBox, index = notifyBoxes.index($(this));
30
     var nextBox, index = notifyBoxes.index($(this));
31
     if (index > 0 && e.which === 75) { // K
31
     if (index > 0 && e.which === 75) { // K
32
       nextBox = notifyBoxes.get(index-1);
32
       nextBox = notifyBoxes.get(index-1);
33
-    } else if (index < notifyBoxes.size()-1 && e.which === 74) { // J
33
+    } else if (index < notifyBoxes.length-1 && e.which === 74) { // J
34
       nextBox = notifyBoxes.get(index+1);
34
       nextBox = notifyBoxes.get(index+1);
35
     } else if (e.which === 88) {
35
     } else if (e.which === 88) {
36
       $(this).prop('checked', !$(this).prop('checked'));
36
       $(this).prop('checked', !$(this).prop('checked'));

+ 5
- 5
static/functions/reportsv2.js View File

57
     if (response) {
57
     if (response) {
58
       ErrorBox(reportid, response);
58
       ErrorBox(reportid, response);
59
     } else {
59
     } else {
60
-      if ($('#from_delete' + reportid).size()) {
60
+      if ($('#from_delete' + reportid).length) {
61
         window.location.search = '?id=' + $('#from_delete' + reportid).val();
61
         window.location.search = '?id=' + $('#from_delete' + reportid).val();
62
       } else {
62
       } else {
63
         $('#report' + reportid).remove();
63
         $('#report' + reportid).remove();
81
     if (response) {
81
     if (response) {
82
       var div = $(response);
82
       var div = $(response);
83
       var id = div.data("reportid");
83
       var id = div.data("reportid");
84
-      if (!$('#report'+id).size()) {
84
+      if (!$('#report'+id).length) {
85
         $('#all_reports').append(div);
85
         $('#all_reports').append(div);
86
         $('#no_reports').remove();
86
         $('#no_reports').remove();
87
-        if ($('#type', div).size()) {
87
+        if ($('#type', div).length) {
88
           Load(id);
88
           Load(id);
89
         }
89
         }
90
       }
90
       }
91
     } else {
91
     } else {
92
       // No new reports at this time
92
       // No new reports at this time
93
-      if (!$('.report').size() && !$('#no_reports') == 0) {
93
+      if (!$('.report').length && !$('#no_reports') == 0) {
94
         $('#all_reports').append($('<div id="no_reports" class="box pad center"><strong>No new reports! \o/</strong></div>'));
94
         $('#all_reports').append($('<div id="no_reports" class="box pad center"><strong>No new reports! \o/</strong></div>'));
95
       }
95
       }
96
     }
96
     }
104
 function AddMore(view, id) {
104
 function AddMore(view, id) {
105
   // Function will add the amount of reports in the input box unless that will take it over 50
105
   // Function will add the amount of reports in the input box unless that will take it over 50
106
   var num = parseInt($('#repop_amount').val()) || 10;
106
   var num = parseInt($('#repop_amount').val()) || 10;
107
-  var curCount = $('.report').size();
107
+  var curCount = $('.report').length;
108
   if (curCount < 50) {
108
   if (curCount < 50) {
109
     NewReport(Math.min(num, 50 - curCount), view, id)
109
     NewReport(Math.min(num, 50 - curCount), view, id)
110
   }
110
   }

+ 1
- 1
static/functions/requests.js View File

39
         votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1;
39
         votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1;
40
       }
40
       }
41
 
41
 
42
-      if ($('#total_bounty').results() > 0) {
42
+      if ($('#total_bounty').length > 0) {
43
         totalBounty = parseInt($('#total_bounty').raw().value);
43
         totalBounty = parseInt($('#total_bounty').raw().value);
44
         totalBounty += (amount * (1 - $('#request_tax').raw().value));
44
         totalBounty += (amount * (1 - $('#request_tax').raw().value));
45
         $('#total_bounty').raw().value = totalBounty;
45
         $('#total_bounty').raw().value = totalBounty;

+ 1
- 1
static/functions/subscriptions.js View File

30
 function Collapse() {
30
 function Collapse() {
31
   var collapseLink = $('#collapselink').raw();
31
   var collapseLink = $('#collapselink').raw();
32
   var hide = (collapseLink.innerHTML.substr(0,1) == 'H' ? 1 : 0);
32
   var hide = (collapseLink.innerHTML.substr(0,1) == 'H' ? 1 : 0);
33
-  if ($('.row').results() > 0) {
33
+  if ($('.row').length > 0) {
34
     $('.row').gtoggle();
34
     $('.row').gtoggle();
35
   }
35
   }
36
   if (hide) {
36
   if (hide) {

+ 1
- 1
static/functions/torrent.js View File

174
         votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1;
174
         votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1;
175
       }
175
       }
176
 
176
 
177
-      if ($('#total_bounty').results() > 0) {
177
+      if ($('#total_bounty').length > 0) {
178
         totalBounty = parseInt($('#total_bounty').raw().value);
178
         totalBounty = parseInt($('#total_bounty').raw().value);
179
         totalBounty += (amount * (1 - $('#request_tax').raw().value));
179
         totalBounty += (amount * (1 - $('#request_tax').raw().value));
180
         $('#total_bounty').raw().value = totalBounty;
180
         $('#total_bounty').raw().value = totalBounty;

+ 3
- 3
static/functions/user.js View File

87
 
87
 
88
 function ParanoiaReset(checkbox, drops) {
88
 function ParanoiaReset(checkbox, drops) {
89
   var selects = $('select');
89
   var selects = $('select');
90
-  for (var i = 0; i < selects.results(); i++) {
90
+  for (var i = 0; i < selects.length; i++) {
91
     if (selects.raw(i).name.match(/^p_/)) {
91
     if (selects.raw(i).name.match(/^p_/)) {
92
       if (drops == 0) {
92
       if (drops == 0) {
93
         selects.raw(i).selectedIndex = 0;
93
         selects.raw(i).selectedIndex = 0;
100
     }
100
     }
101
   }
101
   }
102
   var checkboxes = $(':checkbox');
102
   var checkboxes = $(':checkbox');
103
-  for (var i = 0; i < checkboxes.results(); i++) {
103
+  for (var i = 0; i < checkboxes.length; i++) {
104
     if (checkboxes.raw(i).name.match(/^p_/) && (checkboxes.raw(i).name != 'p_lastseen')) {
104
     if (checkboxes.raw(i).name.match(/^p_/) && (checkboxes.raw(i).name != 'p_lastseen')) {
105
       if (checkbox == 3) {
105
       if (checkbox == 3) {
106
         checkboxes.raw(i).checked = !(checkboxes.raw(i).name.match(/_list$/) || checkboxes.raw(i).name.match(/_l$/));
106
         checkboxes.raw(i).checked = !(checkboxes.raw(i).name.match(/_list$/) || checkboxes.raw(i).name.match(/_l$/));
142
 document.addEventListener("DOMContentLoaded", ToggleIdenticons);
142
 document.addEventListener("DOMContentLoaded", ToggleIdenticons);
143
 function ToggleIdenticons() {
143
 function ToggleIdenticons() {
144
   var disableAvatars = $('#disableavatars');
144
   var disableAvatars = $('#disableavatars');
145
-  if (disableAvatars.size()) {
145
+  if (disableAvatars.length) {
146
     var selected = disableAvatars[0].selectedIndex;
146
     var selected = disableAvatars[0].selectedIndex;
147
     if (selected == 2 || selected == 3) {
147
     if (selected == 2 || selected == 3) {
148
       $('#identicons').gshow();
148
       $('#identicons').gshow();

Loading…
Cancel
Save