PageSourceSearch

https://doahomework.com/js/calculate2.js

js doahomework.com collected 2026-10-06 15:25:02 UTC 14,356 bytes, 429 lines download raw bytes

1function changeCalculator(tP, aL) {
2    var tPaper = $('#paper-type').val();
3    var aLevel = $('#academ-level').val();
4    var aLevelName = aLevel;
5    var dLine = $('#deadline').val();
6    var cPages = $('#count-pages').val().replace(/\D/gi, '');
7
8    var chDedline = $('input[type="radio"]:checked').val();
9
10    //var tPaperPrice = '';
11    var regExp = "^\\d+$";
12    if (tP.typeOfPaper[aLevel] == undefined || aLevel == '' || tPaper == '' || dLine == '') {
13        $('.words').html('~ ' + (275 * cPages) + ' words');
14        return false;
15    }
16    $.each(tP.typeOfPaper[aLevel], function() {
17        if (this.option == tPaper) {
18            tPaperPrice = this.ratio;
19            return true;
20        }
21    });
22    if (aLevelName == 'HighSchool') {
23        aLevelName = 'High School';
24    }
25    var price = (aL[aLevelName][dLine] * tPaperPrice) * cPages;
26    $('.result-price').text('$' + price.toFixed(2));
27    $('.words').html('~ ' + (275 * cPages) + ' words');
28    $('label[for="price-6"] div.h3').html('$'+ ((aL[aLevelName][1209600] * tPaperPrice) * cPages).toFixed(2) + '<span>/page</span>');
29    $('label[for="price-7"] div.h3').html('$'+ ((aL[aLevelName][864000] * tPaperPrice) * cPages).toFixed(2) + '<span>/page</span>');
30    $('label[for="price-5"] div.h3').html('$'+ ((aL[aLevelName][604800] * tPaperPrice) * cPages).toFixed(2) + '<span>/page</span>');
31    $('label[for="price-4"] div.h3').html('$'+ ((aL[aLevelName][432000] * tPaperPrice) * cPages).toFixed(2) + '<span>/page</span>');
32    $('label[for="price-3"] div.h3').html('$'+ ((aL[aLevelName][259200] * tPaperPrice) * cPages).toFixed(2) + '<span>/page</span>');
33    $('label[for="price-2"] div.h3').html('$'+ ((aL[aLevelName][86400] * tPaperPrice) * cPages).toFixed(2) + '<span>/page</span>');
34    if (!(aL[aLevelName][28800] * tPaperPrice) * cPages){
35        $('label[for="price-1"] div.h3').html('Not available');
36    }
37    else{
38        $('label[for="price-1"] div.h3').html('$'+ ((aL[aLevelName][28800] * tPaperPrice) * cPages).toFixed(2) + '<span>/page</span>');
39    }
40}
41
42function check(input) {
43    input.value = input.value.replace(/[^\d]/g, '');
44    input.value = input.value.replace(/^0/g, '1');
45    recalculatePrice(1);
46};
47function recalculatePrice(type) {
48    var tP = jQuery.parseJSON(TypeOfPaper);
49    var aL = jQuery.parseJSON(AcademyPriceDependenceList);
50    if (type == 1) {
51        changeCalculator(tP, aL);
52    } else {
53        var aLevel = '<option value="" selected style="display: none;">Please select</option>';
54        var dLine = '<option value="" selected style="display: none;">Deadline</option>';
55        var tPaper = '<option value="" selected style="display: none;">Type of assignment</option>';
56        var s = 0;
57        $.each(aL, function(key, value) {
58            var selected = '';
59            if (s == 0) {
60                selected = 'selected';
61                var i = 0;
62                $.each(this, function(key, val) {
63                    var selected1 = '';
64                    var days = convertSecToDate(key);
65                    if (key == '1209600') {
66                        selected1 = '';
67                    }
68                    dLine = '<option value="' + key + '" ' + selected1 + '>' + days + '</option>' + dLine;
69                    i++
70                });
71                var sm = key.replace(/\s+/g, '');
72                var k = 0;
73                $.each(tP.typeOfPaper[sm], function(key, val) {
74                    if (k == 0) {
75                        tPaper += '<option value="' + this.option + '" >' + this.option + '</option>';
76                    } else {
77                        tPaper += '<option value="' + this.option + '">' + this.option + '</option>';
78                    }
79                    k++;
80                });
81            }
82            s++;
83        });
84        $('#deadline').html(dLine);
85        $('#paper-type').html(tPaper);
86        $('#count-pages').val('1');
87        changeCalculator(tP, aL);
88        checkDL();
89    }
90}
91
92function convertSecToDate(time) {
93    var days = Math.floor(time / 60 / 60 / 24);
94    if (days != '0') {
95        if (days == 1) {
96            days = days + ' day';
97        } else {
98            days = days + ' days';
99        }
100    } else {
101        days = Math.floor(time / 60 / 60) % 24 + ' hours';
102    }
103    return days;
104}
105function checkTpDl(arr, val, pages, al) {
106    var bAl = ['High School', 'College'];
107    var testa;
108    var pa;
109    var out = [];
110    var falTpPaper = arr.some(function(arrVal) {
111        return val === arrVal;
112    });
113
114    if (pages > 3){
115        pa = false;
116    }else{pa = true};
117
118    for (var i = 0; i < bAl.length; i++) {
119        if (al == bAl[i]){
120            testa = true;
121            break;
122        }
123    }
124    out.push(falTpPaper),
125        out.push(testa),
126        out.push(pa);
127    function isTrue(arra) {
128        return arra > 0;
129    }
130    return out.every(isTrue);
131}
132
133function checkDL(){
134    var aL = jQuery.parseJSON(AcademyPriceDependenceList);
135    var tpChck = $('#paper-type').val();
136    var dlChck = $('#deadline').val();
137    var pages = $('#count-pages').val();
138    var keyAL = $('#academ-level').val().replace(/\s+/g, '');
139    if (keyAL == 'HighSchool') {
140        keyAL = 'High School';
141    }
142    var DropThreeDl = false;
143    var notThreeHours = ['Business plan', 'Capstone project', 'Presentation or speech',  'Lab report', 'Term paper', 'Problem solving'];
144    for(var i = 0; i < notThreeHours.length; i++ ){
145        if (tpChck == notThreeHours[i]){
146            DropThreeDl = true;
147        }
148    }
149    var dLine;
150
151    if(Number(dlChck) < 28800){
152        var dLeight =
153            [
154                'Admission essay',
155                'Annotated bibliography',
156                'Argumentative essays',
157                'Article review',
158                'Biographies',
159                'Creative writing',
160                'Editing',
161                'Essay (any type)',
162                'Formatting',
163                'Paraphrasing',
164                'Proofreading',
165                'Other',
166                'Analytical essay',
167                'Argumentative essay',
168                'Assessment',
169                'Book/movie review',
170                'Case study',
171                'Cause and effect essay',
172                'Compare and contrast essay',
173                'Coursework',
174                'Cover letter',
175                'Critical review',
176                'Critical thinking',
177                'Definition essay',
178                'Descriptive essay',
179                'Evaluation essay',
180                'Expository Essay',
181                'Literary analysis',
182                'Movie review',
183                'Multiple choice questions',
184                'Narrative essay',
185                'Personal statement',
186                'Persuasive essay',
187                'Reaction paper',
188                'Reflective essay',
189                'Research paper',
190                'Research proposal',
191                'Rhetorical analysis'
192            ];
193    }else{
194        var dLeight =
195            [
196                'Admission essay',
197                'Annotated bibliography',
198                'Argumentative essays',
199                'Article review',
200                'Biographies',
201                'Creative writing',
202                'Editing',
203                'Essay (any type)',
204                'Formatting',
205                'Paraphrasing',
206                'Proofreading',
207                'Other',
208                'Analytical essay',
209                'Argumentative essay',
210                'Assessment',
211                'Book review',
212                'Business plan',
213                'Capstone project',
214                'Case study',
215                'Cause and effect essay',
216                'Compare and contrast essay',
217                'Coursework',
218                'Cover letter',
219                'Critical review',
220                'Critical thinking',
221                'Definition essay',
222                'Descriptive essay',
223                'Evaluation essay',
224                'Expository Essay',
225                'Lab report',
226                'Literary analysis',
227                'Movie review',
228                'Multiple choice questions',
229                'Narrative essay',
230                'Personal statement',
231                'Persuasive essay',
232                'Presentation or speech',
233                'Problem solving',
234                'Reaction paper',
235                'Reflective essay',
236                'Research paper',
237                'Research proposal',
238                'Rhetorical analysis',
239                'Term paper'
240            ];
241    }
242    var i = 0;
243    function checkAlDl(pages, keyAL){
244        var testA = keyAL !== 'College' && keyAL !== 'High School';
245        var testB = pages > 10;
246        if(testA && testB == true){
247            dlChck = 86400;
248            $('input[id="price-2"]').prop('checked', true);
249            $('input[id="price-1"]').prop('disabled', true);
250        }else if(testB == true){
251            dlChck = 86400;
252            $('input[id="price-2"]').prop('checked', true);
253            $('input[id="price-1"]').prop('disabled', true);
254        }else if(testA == true){
255            dlChck = 86400;
256            $('input[id="price-2"]').prop('checked', true);
257            $('input[id="price-1"]').prop('disabled', true);
258        }else{
259            $('input[id="price-1"]').removeProp('disabled');
260            console.log('true');
261        }
262    }
263    if (checkTpDl(dLeight, tpChck, pages, keyAL) == false){
264        switch (dlChck) {
265            case "10800":
266                if(pages > 10){
267                    dlChck = 86400;
268                }else if(keyAL == 'College' || keyAL == 'High School'){
269                    dlChck = 28800;
270                    $('input[id="price-1"]').removeProp('disabled');
271                }else{
272                    dlChck = 86400;
273                    $('input[id="price-2"]').prop('checked', true);
274                    $('input[id="price-1"]').prop('disabled', true);
275                }
276                break;
277            case "28800":
278                checkAlDl(pages, keyAL);
279                break;
280            default:
281                if(dlChck == null){
282                    dlChck = 86400;
283                    $('input[id="price-2"]').prop('checked', true);
284                    $('input[id="price-1"]').prop('disabled', true);
285                }
286                console.log(dlChck);
287        }
288    };
289    $.each(aL[keyAL], function(key, val) {
290        var selected1 = '';
291        var days = convertSecToDate(key);
292        if(DropThreeDl == true && key == 10800){
293            return;
294        }
295        dLine = '<option value="' + key + '" >' + days + '</option>' + dLine;
296
297        i++
298    });
299    $('#deadline').html(dLine);
300    $('#deadline').val(dlChck);
301
302    recalculatePrice(1);
303}
304
305function filterLetters(val){
306    var res = val.replace(/[^0-9]/gi, '');
307    return res;
308}
309
310$(function() {
311    recalculatePrice(0);
312
313    $('#count-pages').bind('input', function(e) {
314        var pageLenght = $(this).val();
315        if (pageLenght != '' && pageLenght != '0') {
316            if (pageLenght.length > 3) {
317                $(this).val($(this).val().slice(0, 3));
318            }
319            $(this).val(filterLetters($(this).val()))
320            checkDL();
321            recalculatePrice(1);
322        }
323        else if (pageLenght == '0') {
324            $(this).val(1)
325            checkDL();
326            recalculatePrice(1);
327        }
328        else{
329            checkDL();
330            recalculatePrice(1);
331        }
332    });
333
334    $('#count-pages').focusout(function(){
335        var pageLenght = $(this).val();
336        if (pageLenght == '') {
337            $(this).val(1)
338            checkDL();
339            recalculatePrice(1);
340        }
341    });
342
343    $(document).on("change", '#academ-level', function() {
344        var tP = jQuery.parseJSON(TypeOfPaper);
345        var aL = jQuery.parseJSON(AcademyPriceDependenceList);
346        var tpChck = $('#paper-type').val();
347        var dlChck = $('#deadline').val();
348        var pages = $('#count-pages').val();
349        var keyAL = $(this).val().replace(/\s+/g, '');
350        var dLine; // = '<option value="" selected hidden style="display: none;">Deadline</option>';
351        var tPaper; // = '<option value="1" selected hidden style="display: none;">Type of Assignment</option>';
352        var aLevelName = $('#academ-level').find('option[value="' + $(this).val() + '"]').html();
353        var k = 0;
354        $.each(tP.typeOfPaper[keyAL], function(key, val) {
355            var selected1 = '';
356
357            if (val['option'] == tpChck) {
358                selected1 = 'selected';
359            }
360
361            tPaper += '<option value="' + this.option + '"' + selected1 + '>' + this.option + '</option>';
362
363            k++;
364        });
365        var i = 0;
366
367        //$('#deadline').val(dlChck);
368        $('#paper-type').html(tPaper);
369        recalculatePrice(1);
370        checkDL();
371    });
372});
373$(document).on("change", '#deadline', function() {
374    recalculatePrice(1);
375});
376$(document).on("change", '#paper-type', function() {
377    checkDL();
378
379    if ($(this).attr('name') == 'typeOfPaper' && $(this).val() == 'Problem solving') {
380        $('.calcpages').html('Problems');
381        $('.words').fadeOut();
382    }
383    else if ($(this).attr('name') == 'typeOfPaper' && $(this).val() == 'Multiple choice questions') {
384        $('.calcpages').html('Questions');
385        $('.words').fadeOut();
386    }
387    else {
388        $('.calcpages').html('Pages');
389        $('.words').fadeIn();
390    }
391    recalculatePrice(1);
392});
393$(function() {
394    var cal2def = "HighSchool",
395        cal1def = "Essay (any type)",
396        cal3def = "1209600";
397    $("#academ-level").val(cal2def);
398    $("#paper-type").val(cal1def);
399    $("#deadline").val(cal3def);
400    checkDL();
401    recalculatePrice(1);
402});
403
404$(document).ready(function() {
405    $('#down').on('click', function() {
406        var tmp = Number($('#count-pages').val());
407        if(tmp <= 1){
408            tmp = 1;
409        }
410        else{
411            tmp = tmp-1;
412        }
413        $('#count-pages').val(tmp);
414        checkDL();
415        recalculatePrice(1);
416    });
417    $('#up').on('click', function() {
418        var tmp = Number($('#count-pages').val());
419        if(tmp == 999){
420            tmp = 999;
421        }
422        else{
423            tmp = tmp+1;
424        }
425        $('#count-pages').val(tmp);
426        checkDL();
427        recalculatePrice(1);
428    });
429});

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.