PageSourceSearch

https://doahomework.com/js/calculate.js

js doahomework.com collected 2026-10-06 15:24:57 UTC 11,993 bytes, 387 lines download raw bytes

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

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.