!function() { var d = document, w = window, conf = { lang: 'en', url: 'https%3A%2F%2Fwww.wiseessays.com%2Forder%3F__utmla%3Dc2b61518b3bc4df8199c43c641daf09b', containerId: 'myIdContainer2', component: 'type2', exposition: '', addStyle: function(href) { var d = document, s = d.createElement('link'); s.rel = 'stylesheet'; s.type = 'text/css'; s.href = href; d.head.appendChild(s); }, addScript: function(src) { var d = document, s = d.createElement('script'); s.src = src; d.body.appendChild(s); }, addTemplate: function(path) { var c = document.getElementById(this.containerId); c.innerHTML = path; } }; conf.addStyle('https://www.dsa7.net/css/app.css'); conf.addTemplate('
'); function l() { var c = document.querySelector('#' + conf.containerId), f = c.querySelector('form'), fd = c.querySelector('.m-prtnrsForm06__select[name="pp[type]"]'), fl = c.querySelector('.m-prtnrsForm06__select[name="pp[level]"]'), fu = c.querySelector('.m-prtnrsForm06__select[name="pp[urgency]"]'), fp = c.querySelector('.m-prtnrsForm06__select[name="pp[pages]"]'), pr = c.querySelector('.m-prtnrsForm06__priceValue'), prf = c.querySelector('.m-prtnrsForm06__priceValueFull'), ds = c.querySelector('.m-prtnrsForm06__discount'), pageLabel = c.querySelector('.m-prtnrsForm06__inputLabelPages'), isb = c.querySelectorAll('input, select, button'); Array.prototype.forEach.call(isb, function(el, i){ el.setAttribute('disabled', true); }); var request = new XMLHttpRequest(); request.open('GET', 'https://www.dsa7.net/data?url=' + conf.url + '&component=' + conf.component, true); request.onload = function() { if (this.status >= 200 && this.status < 400) { /* Success! */ var data = JSON.parse(this.response); onSuccess(data); } else { /* We reached our target server, but it returned an error */ console.error('Server response status ' + this.status); } }; request.onerror = function() { /* There was a connection error of some sort */ console.error('Request error'); }; request.send(); function onSuccess (data) { function createListDoctype() { while(fd.firstChild) { fd.removeChild(fd.firstChild); } var g = []; for (let key in data.doctype) { if (g.indexOf(data.doctype[key].group) == -1) { g.push(data.doctype[key].group); } } for (var i = 0; i < g.length; i++) { var gr = document.createElement('optGroup'); gr.setAttribute('label', g[i]); fd.appendChild(gr); for (let key in data.doctype) { if (data.doctype[key].group == g[i]) { gr.appendChild(new Option(data.doctype[key].value, key)); } } } } function createListLevel(d, active) { while(fl.firstChild) { fl.removeChild(fl.firstChild); } var ss = 0; for (let key in data.doctype[d].level) { if (data.doctype[d].level[key].value == active) { ss = key; } if (data.doctype[d].level[key].is_default && ss == 0) { ss = key; } fl.appendChild(new Option(data.doctype[d].level[key].value, key)); } fl.querySelector('option[value="' + ss + '"]').setAttribute('selected', true); } function createListUrgency(d, l, active) { while(fu.firstChild) { fu.removeChild(fu.firstChild); } var ss = 0; for (let key in data.doctype[d].level[l].urgency) { if (data.doctype[d].level[l].urgency[key].value == active) { ss = key; } if (data.doctype[d].level[l].urgency[key].is_default && ss == 0) { ss = key; } fu.appendChild(new Option(data.doctype[d].level[l].urgency[key].value, key)); } fu.querySelector('option[value="' + ss + '"]').setAttribute('selected', true); } function numberOfElements(d) { var limit = data.page.page_limits[d], urgencyInDays = data.urgency_in_days, cvU = fu.value, ctT = fd.value, count = data.page.count[d]; if (limit == 0) { return 200; } switch (urgencyInDays[cvU]) { case 0.25: $max = 6; if (ctT == 'Multiple Choice Questions') { $max = 15; } else if (ctT == 'Math\/Physics\/Chemistry problems' || ctT == 'Accounting\/Statistic\/Economic problems') { $max = 3; } else if (ctT == 'Statistics project') { $max = 3; } break; case 0.33: $max = 10; if (ctT == 'Multiple Choice Questions') { $max = 25; } else if (ctT == 'Math\/Physics\/Chemistry problems' || ctT == 'Accounting\/Statistic\/Economic problems') { $max = 3; } else if (ctT == 'Statistics project') { $max = 3; } break; case 0.5: $max = 10; if (ctT == 'Multiple Choice Questions') { $max = 37; } else if (ctT == 'Math\/Physics\/Chemistry problems' || ctT == 'Accounting\/Statistic\/Economic problems') { $max = 4; } break; case 1: $max = 1.5 * urgencyInDays[cvU] * limit; if (ctT == 'Math\/Physics\/Chemistry problems' || ctT == 'Accounting\/Statistic\/Economic problems') { $max = 6; } break; default: $max = 1.5 * urgencyInDays[cvU] * limit; } if ($max <= count) { return $max; } return count; } function createPage(d, active) { var datapage = data.page, count = numberOfElements(d), a = 1; pageLabel.textContent = datapage.label[d]; while(fp.firstChild) { fp.removeChild(fp.firstChild); } for (var i = 1; i <= count; i++) { var text = datapage.text[d], page = '', value = ''; if (text != '') { text = (i == 1) ? text : text + 's'; } page = (datapage.per_page[d] != 0) ? (' / ' + (datapage.per_page[d] * i) + ' words') : ''; value = i + ' ' + text + page; if (i == active) { a = i; } fp.appendChild(new Option(value, i)); } fp.querySelector('option[value="' + a + '"]').setAttribute('selected', true); return a; } function createPrice(d, l, u, p = 1) { var price = 0; var priceDiscount = 0; for (let key in data.doctype[d].level[l].urgency[u].price) { price = data.doctype[d].level[l].urgency[u].price[key].value; } p = (p <= 1) ? price : (price * p); if (data.discount.constructor === Object && Object.keys(data.discount).length >= 0) { priceDiscount = p - ( p * (data.discount.value/100) ); prf.innerHTML = parseFloat(p).toFixed(2); prf.classList.remove('hide'); pr.innerHTML = parseFloat(priceDiscount).toFixed(2); } else { pr.innerHTML = parseFloat(p).toFixed(2); } } function setDiscount() { if (data.discount.constructor === Object && Object.keys(data.discount).length >= 0) { ds.value = data.discount.name; } } function work() { var d = null, l = null, u = null, p = 1; fp.addEventListener('change', function() { p = createPage(d, fp.value); createPrice(d, l, u, p); }); fu.addEventListener('change', function() { u = fu.value; triggerEvent(fp, 'change'); }); fl.addEventListener('change', function() { l = fl.value; createListUrgency(d, l, fu.value); triggerEvent(fu, 'change'); }); fd.addEventListener('change', function() { d = fd.value; createListLevel(d, fl.value); triggerEvent(fl, 'change'); triggerEvent(fp, 'change'); }); triggerEvent(fd, 'change'); } createListDoctype(); setDiscount(); work(); if(conf.exposition == undefined || !conf.exposition) { let btns = c.querySelectorAll('button'); Array.prototype.forEach.call(btns, function(el, i){ el.removeAttribute('disabled'); }); } let inputsSelects = c.querySelectorAll('input, select'); Array.prototype.forEach.call(inputsSelects, function(el, i){ el.removeAttribute('disabled'); }); } } if (d.readyState == 'complete'){ l(); } else { if (w.attachEvent){ w.attachEvent('onload', l); } else { w.addEventListener('load', l, false); } } function triggerEvent(el, eventName) { var event = document.createEvent('HTMLEvents'); event.initEvent(eventName, true, false); el.dispatchEvent(event); } }(window, document);