PageSourceSearch

https://esportsawards.com/wp-content/plugins/sizzle-nominate/js/nominate.js?ver=7.0.2

js esportsawards.com collected 2026-10-02 05:48:02 UTC 6,229 bytes, 250 lines download raw bytes

1(function() {
2  var Nominee, OrderedList,
3    indexOf = [].indexOf;
4
5  window.SizzleNominate = class SizzleNominate {
6    constructor() {
7      this.sectionList = new OrderedList(function(a, b) {
8        if (a.name < b.name) {
9          return -1;
10        }
11        if (a.name > b.name) {
12          return 1;
13        }
14        return 0;
15      });
16      this.categoryList = new OrderedList(function(a, b) {
17        if (a.name < b.name) {
18          return -1;
19        }
20        if (a.name > b.name) {
21          return 1;
22        }
23        return 0;
24      });
25      this.deselectAllCategories();
26      this.noms = [];
27      this.errors = [];
28    }
29
30    setSections(sections) {
31      var j, len, results, section;
32      this.sectionList.addAllValues(sections);
33      results = [];
34      for (j = 0, len = sections.length; j < len; j++) {
35        section = sections[j];
36        results.push(this.categoryList.addAllValues(section._categories));
37      }
38      return results;
39    }
40
41    selectCategory(id) {
42      this.selectedCategories.addValue(id);
43    }
44
45    selectCategoryByKey(key) {
46      var category, j, len, ref;
47      ref = this.categoryList.values;
48      for (j = 0, len = ref.length; j < len; j++) {
49        category = ref[j];
50        if (category.name.toLowerCase().replace(/[^a-z0-9-]+/ig, '-') === key) {
51          this.selectCategory(category.category_id);
52        }
53      }
54    }
55
56    deselectCategory(id) {
57      this.selectedCategories.removeValue(id);
58    }
59
60    deselectAllCategories() {
61      return this.selectedCategories = new OrderedList(function(a, b) {
62        return a - b;
63      });
64    }
65
66    toggleCategory(id) {
67      if (this.selectedCategories.contains(id)) {
68        this.deselectCategory(id);
69      } else {
70        this.selectCategory(id);
71      }
72    }
73
74    renderCategoryGrid(tpl) {
75      return Mustache.render(tpl, {
76        sections: this.sectionList.values
77      });
78    }
79
80    renderNomineeForm(tpl, category_id) {
81      var category;
82      return Mustache.render(tpl, {
83        category: ((function() {
84          var j, len, ref, results;
85          ref = this.categoryList.values;
86          results = [];
87          for (j = 0, len = ref.length; j < len; j++) {
88            category = ref[j];
89            if (category.category_id === category_id) {
90              results.push(category);
91            }
92          }
93          return results;
94        }).call(this))[0]
95      });
96    }
97
98    renderRegistrantForm(tpl) {
99      return Mustache.render(tpl);
100    }
101
102    renderRegistrantExtraForm(tpl) {
103      return Mustache.render(tpl);
104    }
105
106    renderThankyouPage(tpl) {
107      return Mustache.render(tpl);
108    }
109
110    storeNomineeForm(form) {
111      var nominee;
112      nominee = new Nominee(~~jQuery('[name=category_id]', form).val(), jQuery('[name=name]', form).val(), jQuery('[name=reason]', form).val(), jQuery('[name=urls]', form).val(), jQuery('[name=social]', form).val());
113      if (nominee.category_id === 0) {
114        this.errors.push('No category selected');
115      } else {
116        if (!this.selectedCategories.contains(nominee.category_id)) {
117          this.errors.push('That category isn\'t one of the ones you selected');
118        }
119      }
120      if (nominee.name === '') {
121        this.errors.push('Please enter the name of the nominee');
122      }
123      if (this.errors.length === 0) {
124        this.noms.push(nominee);
125      }
126    }
127
128    storeRegisterForm(post_url, name, email, marketing, newsletter, thirdparty, done, error) {
129      var data;
130      this.post_url = post_url;
131      if (this.post_url === '') {
132        this.errors.push('Something went wrong when finding home');
133      }
134      if (name === '') {
135        this.errors.push('Your name is required');
136      }
137      if (email === '') {
138        this.errors.push('Your email is required');
139      }
140      if (this.errors.length === 0) {
141        this.registrant = {name, email};
142        this.contact = {marketing, newsletter, thirdparty};
143        data = {
144          action: 'process_nomination',
145          registrant: this.registrant,
146          contact: this.contact,
147          noms: this.noms
148        };
149        jQuery.post(this.post_url, data).done((data) => {
150          var d;
151          d = JSON.parse(data);
152          this.cli_id = d.registered.id;
153          this.cli_hash = d.registered.h;
154          return done(data);
155        }).fail(error);
156      }
157    }
158
159    storeRegisterExtraForm(post_url, gender, age_bracket, platforms, done, error) {
160      var data;
161      this.post_url = post_url;
162      if (this.post_url === '') {
163        this.errors.push('Something went wrong when finding home');
164      }
165      if (this.errors.length === 0) {
166        this.extra = {gender, age_bracket, platforms};
167        data = {
168          action: 'process_nomination_extras',
169          extra: this.extra,
170          id: this.cli_id,
171          h: this.cli_hash
172        };
173        jQuery.post(this.post_url, data).done(done).fail(error);
174      }
175    }
176
177    hasErrors() {
178      return this.errors.length > 0;
179    }
180
181    resetErrors() {
182      return this.errors = [];
183    }
184
185  };
186
187  Nominee = class Nominee {
188    constructor(category_id1, name1, reason, urls, social) {
189      this.category_id = category_id1;
190      this.name = name1;
191      this.reason = reason;
192      this.urls = urls;
193      this.social = social;
194    }
195
196  };
197
198  OrderedList = class OrderedList {
199    constructor(sort) {
200      this.sort = sort;
201      this.values = [];
202      this.curPos = 0;
203    }
204
205    addValue(value) {
206      this.values.push(value);
207      this.values.sort(this.sort);
208    }
209
210    addAllValues(values) {
211      var j, len, value;
212      for (j = 0, len = values.length; j < len; j++) {
213        value = values[j];
214        this.addValue(value);
215      }
216    }
217
218    removeValue(value) {
219      this.values = this.values.filter(function(i) {
220        return i !== value;
221      });
222    }
223
224    contains(value) {
225      return indexOf.call(this.values, value) >= 0;
226    }
227
228    size() {
229      return this.values.length;
230    }
231
232    isEmpty() {
233      return this.size() <= 0;
234    }
235
236    rewind() {
237      this.curPos = 0;
238    }
239
240    hasNext() {
241      return this.curPos < this.values.length;
242    }
243
244    next() {
245      return this.values[this.curPos++];
246    }
247
248  };
249
250}).call(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.