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,7 +185,7 @@ function toggle_edition(groupid, editionid, lnk, event) {
185 185
   var showing = $(clickedRow).nextElementSibling().has_class('hidden');
186 186
   var allEditions = event.ctrlKey;
187 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 189
     var row = $(group_rows.raw(i));
190 190
     if (row.has_class('edition') && (allEditions || row.raw(0) == clickedRow)) {
191 191
       var tooltip = showing

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

@@ -116,7 +116,7 @@ function Edit_Form(post,key) {
116 116
   postid = post;
117 117
   var boxWidth, postuserid, pmbox, inputname;
118 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 120
     $('#reply_box').ghide();
121 121
     boxWidth = (location.href.match(/torrents\.php/) || location.href.match(/artist\.php/)) ? "50" : "80";
122 122
     postuserid = $('#post' + postid + ' strong a').attr('href').split('=')[1];

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

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

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

@@ -35,16 +35,13 @@ function save_message(message, err = false) {
35 35
 }
36 36
 
37 37
 $.fn.extend({
38
-  results: function () {
39
-    return this.size();
40
-  },
41
-  gshow: function () {
38
+  gshow: function() {
42 39
     return this.remove_class('hidden');
43 40
   },
44
-  ghide: function (force) {
41
+  ghide: function(force) {
45 42
     return this.add_class('hidden', force);
46 43
   },
47
-  gtoggle: function (force) {
44
+  gtoggle: function(force) {
48 45
     if (this[0].className.split(' ').indexOf('hidden') == -1) {
49 46
       this.add_class('hidden', force);
50 47
     } else {
@@ -52,8 +49,8 @@ $.fn.extend({
52 49
     }
53 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 54
       var object = this[i];
58 55
       if (document.addEventListener) {
59 56
         object.addEventListener(event, callback, false);
@@ -63,8 +60,8 @@ $.fn.extend({
63 60
     }
64 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 65
       var object = this[i];
69 66
       if (object.className === '') {
70 67
         object.className = class_name;
@@ -74,8 +71,8 @@ $.fn.extend({
74 71
     }
75 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 76
       var object = this[i];
80 77
       var classes = object.className.split(' ');
81 78
       var result = classes.indexOf(class_name);
@@ -87,7 +84,7 @@ $.fn.extend({
87 84
     return this;
88 85
   },
89 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 88
       var object = this[i];
92 89
       var classes = object.className.split(' ');
93 90
       if (classes.indexOf(class_name) != -1) {
@@ -97,7 +94,7 @@ $.fn.extend({
97 94
     return false;
98 95
   },
99 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 98
       var object = this[i];
102 99
       var classes = object.className.split(' ');
103 100
       var result = classes.indexOf(class_name);
@@ -114,21 +111,21 @@ $.fn.extend({
114 111
     }
115 112
     return this;
116 113
   },
117
-  disable : function () {
114
+  disable : function() {
118 115
     $(this).prop('disabled', true);
119 116
     return this;
120 117
   },
121
-  enable : function () {
118
+  enable : function() {
122 119
     $(this).prop('disabled', false);
123 120
     return this;
124 121
   },
125
-  raw: function (number) {
122
+  raw: function(number) {
126 123
     if (typeof number == 'undefined') {
127 124
       number = 0;
128 125
     }
129 126
     return $(this).get(number);
130 127
   },
131
-  nextElementSibling: function () {
128
+  nextElementSibling: function() {
132 129
     var here = this[0];
133 130
     if (here.nextElementSibling) {
134 131
       return $(here.nextElementSibling);
@@ -138,7 +135,7 @@ $.fn.extend({
138 135
     } while (here.nodeType != 1);
139 136
     return $(here);
140 137
   },
141
-  previousElementSibling: function () {
138
+  previousElementSibling: function() {
142 139
     var here = this[0];
143 140
     if (here.previousElementSibling) {
144 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,7 +439,7 @@ $.extend($.validator, {
439 439
     },
440 440
 
441 441
     valid: function() {
442
-      return this.size() === 0;
442
+      return this.length === 0;
443 443
     },
444 444
 
445 445
     size: function() {

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

@@ -30,7 +30,7 @@ $(document).ready(function () {
30 30
     var nextBox, index = notifyBoxes.index($(this));
31 31
     if (index > 0 && e.which === 75) { // K
32 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 34
       nextBox = notifyBoxes.get(index+1);
35 35
     } else if (e.which === 88) {
36 36
       $(this).prop('checked', !$(this).prop('checked'));

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save