3?'class="wide-digit"':"",">").concat(t.max,"
");var h=document.createElement("div");h.classList.add("task-description"),h.innerHTML="".concat(t.text.split("`").map((function(t,n,e){return n
Ваша оценка - ".concat(g>=0?g:0," ").concat(l," \r\n
Отзыв по пунктам ТЗ:\r\n
");var p={0:"Не выполненные/не засчитанные пункты:",1:"Частично выполненные пункты:",2:"Выполненные пункты:",penalty:"Штрафы:"};Object.keys(p).forEach((function(t){f.some((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t}))&&(e.innerHTML+="".concat(p[t],"\r\n
"),f.filter((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t})).map((function(t,n){e.innerHTML+="".concat(n+1,") ").concat(t.text," \r\n").concat(t.feedback?'
Отзыв: '+t.feedback+"
":"","\r\n")})))})),o=e.innerText}h.appendChild(n),h.appendChild(e),h.classList.add("visible"),i=!0}function L(t){t?c=0:c++,v.innerText=c}function O(t){if(!y[t].needFeedback||!y[t].feedback||((e=y[t]).feedback=e.feedback.replace(/(\s+)/g," ").trim(),e.feedback.length<8)){if(y[t].needFeedback){var n=y[t].activeRadio.closest(".checkbox-container");return n.querySelector("a").click(),_(n,"Фидбек не может быть пустым! Минимальная длина 8 символов"),void setTimeout((function(){return _(n,s)}),3e3)}}else document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}));var e}function F(t){var n;y[t].needFeedback&&(c--,v.innerText=c,y[t].activeRadio.checked=!1,n=y[t].max,g-=+(n/2).toFixed(1),p.innerHTML=g<0?0:g,delete y[t].needFeedback,delete y[t].activeRadio,delete y[t].status,document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"})),g||w.classList.add("hidden"))}function M(t,n,e,r){y[t].feedback=n.value,n.value?(e.classList.add("feedback-add"),e.innerHTML="Изменить отзыв"):(delete y[t].feedback,e.classList.remove("feedback-add"),e.innerHTML="Добавить отзыв"),r.remove()}b.addEventListener("click",(function(t){var n=t.target.parentElement,e=t.target.dataset.id,r=y[e];if("INPUT"===t.target.tagName){var o=t.target,c=o.dataset.score;if(u&&"true"==n.dataset.active)return n.dataset.active="false",void t.preventDefault();if(u&&"false"==n.dataset.active)return n.dataset.active="true",void t.preventDefault();if(!u&&"false"!=n.dataset.active){void 0===r.status&&L();var a="%"===r.max[r.max.length-1],f=[0,+(r.max/2).toFixed(1),r.max];r.status>=0&&!a&&(g-="penalty"!==r.type?f[r.status]:2*f[r.status]),a?1==c?S[r.text]=r.max.slice(0,-1):delete S[r.text]:g+="penalty"!==r.type?f[c]:2*f[c];var l=Object.keys(S).reduce((function(t,n){return t-S[n]}),0),h=g-g*(.01*l);if(r.status=c,p.innerHTML=h<0?0:h.toFixed(1),1==+c&&"subtask"==r.type){r.needFeedback=!0,r.activeRadio=o;var v=o.closest(".checkbox-container");v.querySelector("textarea")||v.querySelector("a").click(),v.scrollIntoView({behavior:"smooth"}),_(v,s),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="false",t===v&&(t.dataset.active="true")}))}else if(r.needFeedback&&"subtask"==r.type){r.needFeedback=!1;var d=o.closest(".checkbox-container").querySelector("form");d&&d.remove(),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}))}if(void 0!==r.activeRadio&&r.activeRadio.dataset.score!==c&&r.feedback){r.activeRadio=o;var m=o.closest(".checkbox-container");m.querySelector("a").click(),_(m,"Вы изменили оценку. Возможно стоит изменить отзыв?")}i&&k(y)}y.some((function(t){return t&&void 0!==t.status}))?w.classList.remove("hidden"):w.classList.add("hidden"),r.activeRadio=o}})),window.addFeedback=function(t){t.preventDefault(),document.querySelectorAll(".add-form").forEach((function(t){return t.remove()}));var n=t.target,e=n.closest(".checkbox-container").querySelector("input").dataset.id,r=document.createElement("form");r.classList.add("add-form");var i=document.createElement("textarea");i.setAttribute("placeholder","Use Ctrl + Enter to save this feedback or ESC to cancel"),y[e].feedback&&(i.value=y[e].feedback),r.appendChild(i);var o=document.createElement("a");o.innerText="Отмена",o.onclick=function(){r.remove(),F(e)};var c=o.cloneNode();c.innerText="Сохранить",c.onclick=function(){M(e,i,n,r),O(e)};var a=document.createElement("DIV");a.classList.add("feedback-buttons"),a.appendChild(o),a.appendChild(c),r.appendChild(a),n.parentElement.appendChild(r),i.focus(),i.select(),r.addEventListener("keyup",(function(t){13==t.keyCode&&u?(M(e,i,n,r),O(e)):27==t.keyCode&&(F(e),r.remove())}))},window.copyToClipboard=function(t){t.preventDefault(),t.target.classList.add("not-link"),t.target.innerText="Скопировано!",setTimeout((function(){t.target.classList.remove("not-link"),t.target.innerText="Скопировать в буфер"}),1e3);var n=document.createElement("textarea");n.value=o,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},n=Object.prototype,e=n.hasOwnProperty,r=Object.defineProperty||function(t,n,e){t[n]=e.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",a=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{s({},"")}catch(t){s=function(t,n,e){return t[n]=e}}function l(t,n,e,i){var o=n&&n.prototype instanceof v?n:v,u=Object.create(o.prototype),c=new O(i||[]);return r(u,"_invoke",{value:E(t,e,c)}),u}function h(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var p={};function v(){}function d(){}function y(){}var g={};s(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(F([])));b&&b!==n&&e.call(b,c)&&(g=b);var x=y.prototype=v.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(n){s(t,n,(function(t){return this._invoke(n,t)}))}))}function S(t,n){var o;r(this,"_invoke",{value:function(r,u){function c(){return new n((function(o,c){!function r(o,u,c,a){var f=h(t[o],t,u);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==i(l)&&e.call(l,"__await")?n.resolve(l.__await).then((function(t){r("next",t,c,a)}),(function(t){r("throw",t,c,a)})):n.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,a)}))}a(f.arg)}(r,u,o,c)}))}return o=o?o.then(c,c):c()}})}function E(t,n,e){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return M()}for(e.method=i,e.arg=o;;){var u=e.delegate;if(u){var c=_(u,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===r)throw r="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r="executing";var a=h(t,n,e);if("normal"===a.type){if(r=e.done?"completed":"suspendedYield",a.arg===p)continue;return{value:a.arg,done:e.done}}"throw"===a.type&&(r="completed",e.method="throw",e.arg=a.arg)}}}function _(t,n){var e=n.method,r=t.iterator[e];if(void 0===r)return n.delegate=null,"throw"===e&&t.iterator.return&&(n.method="return",n.arg=void 0,_(t,n),"throw"===n.method)||"return"!==e&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var i=h(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function L(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function F(t){if(t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r3?'class="wide-digit"':"",">").concat(t.max,"
");var f=document.createElement("div");f.classList.add("task-description"),f.innerHTML="".concat(t.text.split("`").map((function(t,n,e){return n
".concat(l["your-mark"]).concat(E>=0?E:0," ").concat(s," \r\n
").concat(l["review-by-points"],"\r\n
");var p={0:l["result-descriptions"][0],1:l["result-descriptions"][1],2:l["result-descriptions"][2],penalty:l.penalties};Object.keys(p).forEach((function(t){a.some((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t}))&&(e.innerHTML+="".concat(p[t],"\r\n
"),a.filter((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t})).map((function(t,n){e.innerHTML+="".concat(n+1,") ").concat(t.text," \r\n").concat(t.feedback?'
'.concat(l.review,"")+t.feedback+"
":"","\r\n")})))})),u=e.innerText}g.appendChild(n),g.appendChild(e),g.classList.add("visible"),c=!0}function j(t){t?f=0:f++,b.innerText=f}function T(t){if(!w[t].needFeedback||!w[t].feedback||((e=w[t]).feedback=e.feedback.replace(/(\s+)/g," ").trim(),e.feedback.length<8)){if(w[t].needFeedback){var n=w[t].activeRadio.closest(".checkbox-container");return n.querySelector("a").click(),P(n,l["not-empty-feedback"]),void setTimeout((function(){return P(n,v)}),3e3)}}else document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}));var e}function I(t){var n;w[t].needFeedback&&(f--,b.innerText=f,w[t].activeRadio.checked=!1,n=w[t].max,S-=+(n/2).toFixed(1),m.innerHTML=S<0?0:S,delete w[t].needFeedback,delete w[t].activeRadio,delete w[t].status,document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"})),S||O.classList.add("hidden"))}function N(t,n,e,r){w[t].feedback=n.value,n.value?(e.classList.add("feedback-add"),e.innerHTML=l["change-review"]):(delete w[t].feedback,e.classList.remove("feedback-add"),e.innerHTML=l["add-review"]),r.remove()}k.addEventListener("click",(function(t){var n=t.target.parentElement,e=t.target.dataset.id,r=w[e];if("INPUT"===t.target.tagName){var o=t.target,i=o.dataset.score;if(s&&"true"==n.dataset.active)return n.dataset.active="false",void t.preventDefault();if(s&&"false"==n.dataset.active)return n.dataset.active="true",void t.preventDefault();if(!s&&"false"!=n.dataset.active){void 0===r.status&&j();var u="%"===r.max[r.max.length-1],a=[0,+(r.max/2).toFixed(1),r.max];r.status>=0&&!u&&(S-="penalty"!==r.type?a[r.status]:2*a[r.status]),u?1==i?F[r.text]=r.max.slice(0,-1):delete F[r.text]:S+="penalty"!==r.type?a[i]:2*a[i];var f=Object.keys(F).reduce((function(t,n){return t-F[n]}),0);if(E=(S-S*(.01*f)).toFixed(1),r.status=i,m.innerHTML=E<0?0:E,1==+i&&"subtask"==r.type){r.needFeedback=!0,r.activeRadio=o;var l=o.closest(".checkbox-container");l.querySelector("textarea")||l.querySelector("a").click(),l.scrollIntoView({behavior:"smooth"}),P(l,v),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="false",t===l&&(t.dataset.active="true")}))}else if(r.needFeedback&&"subtask"==r.type){r.needFeedback=!1;var p=o.closest(".checkbox-container").querySelector("form");p&&p.remove(),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}))}if(void 0!==r.activeRadio&&r.activeRadio.dataset.score!==i&&r.feedback){r.activeRadio=o;var h=o.closest(".checkbox-container");h.querySelector("a").click(),P(h,d)}c&&A(w)}w.some((function(t){return t&&void 0!==t.status}))?O.classList.remove("hidden"):O.classList.add("hidden"),r.activeRadio=o}})),window.addFeedback=function(t){t.preventDefault(),document.querySelectorAll(".add-form").forEach((function(t){return t.remove()}));var n=t.target,e=n.closest(".checkbox-container").querySelector("input").dataset.id,r=document.createElement("form");r.classList.add("add-form");var o=document.createElement("textarea");o.setAttribute("placeholder",l["use-ctrl-enter"]),w[e].feedback&&(o.value=w[e].feedback),r.appendChild(o);var i=document.createElement("a");i.innerText=l.cancel,i.onclick=function(){r.remove(),I(e)};var c=i.cloneNode();c.innerText=l.save,c.onclick=function(){N(e,o,n,r),T(e)};var u=document.createElement("DIV");u.classList.add("feedback-buttons"),u.appendChild(i),u.appendChild(c),r.appendChild(u),n.parentElement.appendChild(r),o.focus(),o.select(),r.addEventListener("keyup",(function(t){13==t.keyCode&&s?(N(e,o,n,r),T(e)):27==t.keyCode&&(I(e),r.remove())}))},window.copyToClipboard=function(t){t.preventDefault(),t.target.classList.add("not-link"),t.target.innerText=l.copied,setTimeout((function(){t.target.classList.remove("not-link"),t.target.innerText=l["copy-to-clipboard"]}),1e3);var n=document.createElement("textarea");n.value=u,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}}var u="rs-checklist-lang";function a(){var t=localStorage.getItem(u);return t||"ru"}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */f=function(){return t};var t={},n=Object.prototype,e=n.hasOwnProperty,r=Object.defineProperty||function(t,n,e){t[n]=e.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function a(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{a({},"")}catch(t){a=function(t,n,e){return t[n]=e}}function l(t,n,e,o){var i=n&&n.prototype instanceof v?n:v,c=Object.create(i.prototype),u=new O(o||[]);return r(c,"_invoke",{value:E(t,e,u)}),c}function p(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function v(){}function d(){}function y(){}var g={};a(g,i,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(F([])));b&&b!==n&&e.call(b,i)&&(g=b);var x=y.prototype=v.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(n){a(t,n,(function(t){return this._invoke(n,t)}))}))}function S(t,n){var o;r(this,"_invoke",{value:function(r,i){function c(){return new n((function(o,c){!function r(o,i,c,u){var a=p(t[o],t,i);if("throw"!==a.type){var f=a.arg,l=f.value;return l&&"object"==s(l)&&e.call(l,"__await")?n.resolve(l.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):n.resolve(l).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(a.arg)}(r,i,o,c)}))}return o=o?o.then(c,c):c()}})}function E(t,n,e){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return M()}for(e.method=o,e.arg=i;;){var c=e.delegate;if(c){var u=_(c,e);if(u){if(u===h)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===r)throw r="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r="executing";var a=p(t,n,e);if("normal"===a.type){if(r=e.done?"completed":"suspendedYield",a.arg===h)continue;return{value:a.arg,done:e.done}}"throw"===a.type&&(r="completed",e.method="throw",e.arg=a.arg)}}}function _(t,n){var e=n.method,r=t.iterator[e];if(void 0===r)return n.delegate=null,"throw"===e&&t.iterator.return&&(n.method="return",n.arg=void 0,_(t,n),"throw"===n.method)||"return"!==e&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+e+"' method")),h;var o=p(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function k(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function L(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function F(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r3) ? 'class="wide-digit"' : ''}>${el.max}
`; const taskDesc = document.createElement('div'); taskDesc.classList.add('task-description'); taskDesc.innerHTML = `${getFormatedText(el.text)}
`; taskDesc.innerHTML += - "Добавить отзыв"; + `${langData['add-review']}`; const overlay = document.createElement('div'); overlay.classList.add('overlay'); @@ -300,28 +301,30 @@ export function render(criteria, taskName, information) { }); askLeaveFeedback(parent, askFeedback); } - content.innerHTML = `Ваша оценка - ${ - total >= 0 ? total : 0 - } ${points} \r\n
Отзыв по пунктам ТЗ:\r\n
`; + let points = totalWithPercent % 10 > 1 && totalWithPercent % 10 <= 4 + ? langData['point'] + : langData['points']; + content.innerHTML += `${langData['your-mark']}${ + totalWithPercent >= 0 ? totalWithPercent : 0 + } ${points} \r\n
${langData['review-by-points']}\r\n
`; const resultDescriptions = { - 0: 'Не выполненные/не засчитанные пункты:', - 1: 'Частично выполненные пункты:', - 2: 'Выполненные пункты:', - penalty: 'Штрафы:', + 0: langData['result-descriptions'][0], + 1: langData['result-descriptions'][1], + 2: langData['result-descriptions'][2], + penalty: langData['penalties'], }; Object.keys(resultDescriptions).forEach((desc) => { let partialResult = []; @@ -341,7 +344,7 @@ export function render(criteria, taskName, information) { partialResult.map((item, i) => { content.innerHTML += `${i + 1}) ${item.text} \r\n${ item.feedback - ? '
Отзыв: ' + + ? `
${langData['review']}` + item.feedback + '
' : '' @@ -379,7 +382,7 @@ export function render(criteria, taskName, information) { const textarea = document.createElement('textarea'); textarea.setAttribute( 'placeholder', - 'Use Ctrl + Enter to save this feedback or ESC to cancel' + langData['use-ctrl-enter'] ); if (filteredCriteria[id].feedback) { textarea.value = filteredCriteria[id].feedback; @@ -387,13 +390,13 @@ export function render(criteria, taskName, information) { box.appendChild(textarea); const closeText = document.createElement('a'); - closeText.innerText = 'Отмена'; + closeText.innerText = langData['cancel']; closeText.onclick = () => { box.remove(); resetRadioState(id); }; const saveText = closeText.cloneNode(); - saveText.innerText = 'Сохранить'; + saveText.innerText = langData['save']; saveText.onclick = () => { handleAreaEvent(id, textarea, link, box); checkFeedback(id); @@ -434,7 +437,7 @@ export function render(criteria, taskName, information) { parent.querySelector('a').click(); askLeaveFeedback( parent, - 'Фидбек не может быть пустым! Минимальная длина 8 символов' + langData['not-empty-feedback'] ); setTimeout(() => askLeaveFeedback(parent, askFeedback), 3000); return; @@ -472,11 +475,11 @@ export function render(criteria, taskName, information) { filteredCriteria[id].feedback = textarea.value; if (textarea.value) { link.classList.add('feedback-add'); - link.innerHTML = 'Изменить отзыв'; + link.innerHTML = langData['change-review']; } else { delete filteredCriteria[id].feedback; link.classList.remove('feedback-add'); - link.innerHTML = 'Добавить отзыв'; + link.innerHTML = langData['add-review']; } box.remove(); } @@ -484,10 +487,10 @@ export function render(criteria, taskName, information) { window.copyToClipboard = (e) => { e.preventDefault(); e.target.classList.add('not-link'); - e.target.innerText = 'Скопировано!'; + e.target.innerText = langData['copied']; setTimeout(() => { e.target.classList.remove('not-link'); - e.target.innerText = 'Скопировать в буфер'; + e.target.innerText = langData['copy-to-clipboard']; }, 1000); const el = document.createElement('textarea'); el.value = toClipBoard; @@ -512,4 +515,12 @@ function getFormatedText(text) { ) .flat() .join('') +} + +export const LANG = 'rs-checklist-lang' +const DEFAULT_LANG = 'ru' + +export function getLang () { + const langRes = localStorage.getItem(LANG); + return langRes ? langRes : DEFAULT_LANG; } \ No newline at end of file diff --git a/js/script.js b/js/script.js index 331e567..f4d56c0 100644 --- a/js/script.js +++ b/js/script.js @@ -1,4 +1,6 @@ -import { RenderTasks } from "../js/RenderTasks.js" +import lang from '../lang/lang.json' +import { RenderTasks } from "./RenderTasks.js" +import { getLang, LANG } from './RenderView.js'; const start = document.querySelector('.start'); start && start.addEventListener("click", function(e) { @@ -9,6 +11,17 @@ const header = document.querySelector('header'); const offsetTop = header.offsetTop; window.onscroll = () => stickyHeader(); +const langSelectorNode = document.querySelector('.lang-selector') +langSelectorNode.addEventListener( + 'click', + langSelector +) +for (let node of langSelectorNode.children){ + console.log(node.firstChild.textContent, getLang()) + if (node.textContent.trim() == getLang()) { + node.classList.add('disabled-link') + } +}; function stickyHeader() { if (window.pageYOffset > offsetTop + 100) { @@ -18,6 +31,27 @@ function stickyHeader() { } } +function langSelector(e) { + const tagName = e.target.tagName.toString(); + const langText = e.target.textContent; + + if(tagName.toUpperCase() !== 'A') return; + localStorage.setItem(LANG, langText); + window.location.reload(); +} + const renderTasks = new RenderTasks('tasks-to-render.json'); renderTasks.initTasks(); +const setTextWithLang = () => { + const curLang = lang[ getLang() ]; + document.querySelector('.feedback button').textContent = + curLang['show-review']; + document.querySelector('.reset').textContent = + curLang['reset']; + document.querySelector('.total-points').innerHTML = + curLang['total-points']; + document.querySelector('.progress').innerHTML = + `${curLang['checked']} 0${curLang['out-of']}`; +} +setTextWithLang(); diff --git a/lang/lang.json b/lang/lang.json new file mode 100644 index 0000000..4d3f1b4 --- /dev/null +++ b/lang/lang.json @@ -0,0 +1,82 @@ +{ + "ru": { + "reset": "Сбросить", + "total-points": "Общий балл: ", + "show-review": "Показать отзыв", + "score": "Балл за выполнение", + "penalty": "Штрафные баллы", + "checked": "Проверено", + "add-review": "Добавить отзыв", + "change-review": "Изменить отзыв", + "cancel": "Отмена", + "save": "Сохранить", + "copied": "Скопировано!", + "copy-to-clipboard": "Скопировать в буфер", + "not-empty-feedback": "Фидбек не может быть пустым! Минимальная длина 8 символов", + "use-ctrl-enter": "Use Ctrl + Enter to save this feedback or ESC to cancel", + "review": "Отзыв: ", + "penalties": "Штрафы:", + "your-mark": "Ваша оценка - ", + "review-by-points": "Отзыв по пунктам ТЗ:", + "not-all-items": "Вы проверили не все пункты задания", + "remaining": "Осталось ", + "out-of": " из ", + "obligatory-feedback": "Вам необходимо оставить обязательный фидбек ко всем пунктам, где отмечено - ", + "partially-completed": "Выполнено частично", + "changed-assessment": "Вы изменили оценку. Возможно стоит изменить отзыв?", + "partially-completed-checked": "Вы отметили: выполнено частично. Обязательно оставьте фидбек!", + "result-descriptions": [ + "Не выполненные/не засчитанные пункты:", + "Частично выполненные пункты:", + "Выполненные пункты:" + ], + "check-marks": [ + "не выполнено", + "выполнено частично", + "выполнено полностью" + ], + "penalty-marks": ["нет", "да"], + "point": "балла", + "points": "баллов" + }, + "en": { + "reset": "Reset", + "total-points": "Total points: ", + "show-review": "Show Review", + "score": "Completion score", + "penalty": "Penalty points", + "checked": "Checked", + "add-review": "Add review", + "change-review": "Change Review", + "cancel": "Cancel", + "save": "Save", + "copied": "Copied!", + "copy-to-clipboard": "Copy to clipboard", + "not-empty-feedback": "Feedback cannot be empty! Минимальная длина 8 символов", + "use-ctrl-enter": "Use Ctrl + Enter to save this feedback or ESC to cancel", + "review": "Review: ", + "penalties": "Penalties:", + "your-mark": "Your mark - ", + "review-by-points": "Feedback on the points of the Terms of Reference:", + "not-all-items": "You have checked не все пункты задания", + "remaining": "Need to check ", + "out-of": " out of ", + "obligatory-feedback": "You must оставить обязательный фидбек ко всем пунктам, где отмечено - ", + "partially-completed": "Partially done", + "changed-assessment": "You have changed your rating. Возможно стоит изменить отзыв?", + "partially-completed-checked": "Вы отметили: partially done. Обязательно оставьте фидбек!", + "result-descriptions": [ + "Not completed / not counted points:", + "Partially completed items:", + "Completed items:" + ], + "check-marks": [ + "not implemented", + "partially done", + "completely done" + ], + "penalty-marks": ["no", "yes"], + "point": "points", + "points": "points" + } +} \ No newline at end of file From 0e33f4e00dca34cb5efaadfb50c659e80cf270a5 Mon Sep 17 00:00:00 2001 From: Alexey Kuptsov3?'class="wide-digit"':"",">").concat(t.max,"
");var h=document.createElement("div");h.classList.add("task-description"),h.innerHTML="".concat(t.text.split("`").map((function(t,n,e){return n
Ваша оценка - ".concat(g>=0?g:0," ").concat(l," \r\n
Отзыв по пунктам ТЗ:\r\n
");var p={0:"Не выполненные/не засчитанные пункты:",1:"Частично выполненные пункты:",2:"Выполненные пункты:",penalty:"Штрафы:"};Object.keys(p).forEach((function(t){f.some((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t}))&&(e.innerHTML+="".concat(p[t],"\r\n
"),f.filter((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t})).map((function(t,n){e.innerHTML+="".concat(n+1,") ").concat(t.text," \r\n").concat(t.feedback?'
Отзыв: '+t.feedback+"
":"","\r\n")})))})),o=e.innerText}h.appendChild(n),h.appendChild(e),h.classList.add("visible"),i=!0}function L(t){t?c=0:c++,v.innerText=c}function O(t){if(!y[t].needFeedback||!y[t].feedback||((e=y[t]).feedback=e.feedback.replace(/(\s+)/g," ").trim(),e.feedback.length<8)){if(y[t].needFeedback){var n=y[t].activeRadio.closest(".checkbox-container");return n.querySelector("a").click(),_(n,"Фидбек не может быть пустым! Минимальная длина 8 символов"),void setTimeout((function(){return _(n,s)}),3e3)}}else document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}));var e}function F(t){var n;y[t].needFeedback&&(c--,v.innerText=c,y[t].activeRadio.checked=!1,n=y[t].max,g-=+(n/2).toFixed(1),p.innerHTML=g<0?0:g,delete y[t].needFeedback,delete y[t].activeRadio,delete y[t].status,document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"})),g||w.classList.add("hidden"))}function M(t,n,e,r){y[t].feedback=n.value,n.value?(e.classList.add("feedback-add"),e.innerHTML="Изменить отзыв"):(delete y[t].feedback,e.classList.remove("feedback-add"),e.innerHTML="Добавить отзыв"),r.remove()}b.addEventListener("click",(function(t){var n=t.target.parentElement,e=t.target.dataset.id,r=y[e];if("INPUT"===t.target.tagName){var o=t.target,c=o.dataset.score;if(u&&"true"==n.dataset.active)return n.dataset.active="false",void t.preventDefault();if(u&&"false"==n.dataset.active)return n.dataset.active="true",void t.preventDefault();if(!u&&"false"!=n.dataset.active){void 0===r.status&&L();var a="%"===r.max[r.max.length-1],f=[0,+(r.max/2).toFixed(1),r.max];r.status>=0&&!a&&(g-="penalty"!==r.type?f[r.status]:2*f[r.status]),a?1==c?S[r.text]=r.max.slice(0,-1):delete S[r.text]:g+="penalty"!==r.type?f[c]:2*f[c];var l=Object.keys(S).reduce((function(t,n){return t-S[n]}),0),h=g-g*(.01*l);if(r.status=c,p.innerHTML=h<0?0:h.toFixed(1),1==+c&&"subtask"==r.type){r.needFeedback=!0,r.activeRadio=o;var v=o.closest(".checkbox-container");v.querySelector("textarea")||v.querySelector("a").click(),v.scrollIntoView({behavior:"smooth"}),_(v,s),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="false",t===v&&(t.dataset.active="true")}))}else if(r.needFeedback&&"subtask"==r.type){r.needFeedback=!1;var d=o.closest(".checkbox-container").querySelector("form");d&&d.remove(),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}))}if(void 0!==r.activeRadio&&r.activeRadio.dataset.score!==c&&r.feedback){r.activeRadio=o;var m=o.closest(".checkbox-container");m.querySelector("a").click(),_(m,"Вы изменили оценку. Возможно стоит изменить отзыв?")}i&&k(y)}y.some((function(t){return t&&void 0!==t.status}))?w.classList.remove("hidden"):w.classList.add("hidden"),r.activeRadio=o}})),window.addFeedback=function(t){t.preventDefault(),document.querySelectorAll(".add-form").forEach((function(t){return t.remove()}));var n=t.target,e=n.closest(".checkbox-container").querySelector("input").dataset.id,r=document.createElement("form");r.classList.add("add-form");var i=document.createElement("textarea");i.setAttribute("placeholder","Use Ctrl + Enter to save this feedback or ESC to cancel"),y[e].feedback&&(i.value=y[e].feedback),r.appendChild(i);var o=document.createElement("a");o.innerText="Отмена",o.onclick=function(){r.remove(),F(e)};var c=o.cloneNode();c.innerText="Сохранить",c.onclick=function(){M(e,i,n,r),O(e)};var a=document.createElement("DIV");a.classList.add("feedback-buttons"),a.appendChild(o),a.appendChild(c),r.appendChild(a),n.parentElement.appendChild(r),i.focus(),i.select(),r.addEventListener("keyup",(function(t){13==t.keyCode&&u?(M(e,i,n,r),O(e)):27==t.keyCode&&(F(e),r.remove())}))},window.copyToClipboard=function(t){t.preventDefault(),t.target.classList.add("not-link"),t.target.innerText="Скопировано!",setTimeout((function(){t.target.classList.remove("not-link"),t.target.innerText="Скопировать в буфер"}),1e3);var n=document.createElement("textarea");n.value=o,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},n=Object.prototype,e=n.hasOwnProperty,r=Object.defineProperty||function(t,n,e){t[n]=e.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",a=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{s({},"")}catch(t){s=function(t,n,e){return t[n]=e}}function l(t,n,e,i){var o=n&&n.prototype instanceof v?n:v,u=Object.create(o.prototype),c=new O(i||[]);return r(u,"_invoke",{value:E(t,e,c)}),u}function h(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var p={};function v(){}function d(){}function y(){}var g={};s(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(F([])));b&&b!==n&&e.call(b,c)&&(g=b);var x=y.prototype=v.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(n){s(t,n,(function(t){return this._invoke(n,t)}))}))}function S(t,n){var o;r(this,"_invoke",{value:function(r,u){function c(){return new n((function(o,c){!function r(o,u,c,a){var f=h(t[o],t,u);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==i(l)&&e.call(l,"__await")?n.resolve(l.__await).then((function(t){r("next",t,c,a)}),(function(t){r("throw",t,c,a)})):n.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,a)}))}a(f.arg)}(r,u,o,c)}))}return o=o?o.then(c,c):c()}})}function E(t,n,e){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return M()}for(e.method=i,e.arg=o;;){var u=e.delegate;if(u){var c=_(u,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===r)throw r="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r="executing";var a=h(t,n,e);if("normal"===a.type){if(r=e.done?"completed":"suspendedYield",a.arg===p)continue;return{value:a.arg,done:e.done}}"throw"===a.type&&(r="completed",e.method="throw",e.arg=a.arg)}}}function _(t,n){var e=n.method,r=t.iterator[e];if(void 0===r)return n.delegate=null,"throw"===e&&t.iterator.return&&(n.method="return",n.arg=void 0,_(t,n),"throw"===n.method)||"return"!==e&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var i=h(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function L(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function F(t){if(t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r3?'class="wide-digit"':"",">").concat(t.max,"
");var h=document.createElement("div");h.classList.add("task-description"),h.innerHTML="".concat(t.text.split("`").map((function(t,n,e){return n
Ваша оценка - ".concat(m>=0?m:0," ").concat(l," \r\n
Отзыв по пунктам ТЗ:\r\n
");var p={0:"Не выполненные/не засчитанные пункты:",1:"Частично выполненные пункты:",2:"Выполненные пункты:",penalty:"Штрафы:"};Object.keys(p).forEach((function(t){f.some((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t}))&&(e.innerHTML+="".concat(p[t],"\r\n
"),f.filter((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t})).map((function(t,n){e.innerHTML+="".concat(n+1,") ").concat(t.text," \r\n").concat(t.feedback?'
Отзыв: '+t.feedback+"
":"","\r\n")})))})),o=e.innerText}h.appendChild(n),h.appendChild(e),h.classList.add("visible"),i=!0}function O(t){t?c=0:c++,v.innerText=c}function F(t){if(!y[t].needFeedback||!y[t].feedback||((e=y[t]).feedback=e.feedback.replace(/(\s+)/g," ").trim(),e.feedback.length<8)){if(y[t].needFeedback){var n=y[t].activeRadio.closest(".checkbox-container");return n.querySelector("a").click(),k(n,"Фидбек не может быть пустым! Минимальная длина 8 символов"),void setTimeout((function(){return k(n,s)}),3e3)}}else document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}));var e}function M(t){var n;y[t].needFeedback&&(c--,v.innerText=c,y[t].activeRadio.checked=!1,n=y[t].max,g-=+(n/2).toFixed(1),p.innerHTML=g<0?0:g,delete y[t].needFeedback,delete y[t].activeRadio,delete y[t].status,document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"})),g||S.classList.add("hidden"))}function P(t,n,e,r){y[t].feedback=n.value,n.value?(e.classList.add("feedback-add"),e.innerHTML="Изменить отзыв"):(delete y[t].feedback,e.classList.remove("feedback-add"),e.innerHTML="Добавить отзыв"),r.remove()}x.addEventListener("click",(function(t){var n=t.target.parentElement,e=t.target.dataset.id,r=y[e];if("INPUT"===t.target.tagName){var o=t.target,c=o.dataset.score;if(u&&"true"==n.dataset.active)return n.dataset.active="false",void t.preventDefault();if(u&&"false"==n.dataset.active)return n.dataset.active="true",void t.preventDefault();if(!u&&"false"!=n.dataset.active){void 0===r.status&&O();var a="%"===r.max[r.max.length-1],f=[0,+(r.max/2).toFixed(1),r.max];r.status>=0&&!a&&(g-="penalty"!==r.type?f[r.status]:2*f[r.status]),a?1==c?E[r.text]=r.max.slice(0,-1):delete E[r.text]:g+="penalty"!==r.type?f[c]:2*f[c];var l=Object.keys(E).reduce((function(t,n){return t-E[n]}),0);if(m=(g-g*(.01*l)).toFixed(1),r.status=c,p.innerHTML=m<0?0:m,1==+c&&"subtask"==r.type){r.needFeedback=!0,r.activeRadio=o;var h=o.closest(".checkbox-container");h.querySelector("textarea")||h.querySelector("a").click(),h.scrollIntoView({behavior:"smooth"}),k(h,s),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="false",t===h&&(t.dataset.active="true")}))}else if(r.needFeedback&&"subtask"==r.type){r.needFeedback=!1;var v=o.closest(".checkbox-container").querySelector("form");v&&v.remove(),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}))}if(void 0!==r.activeRadio&&r.activeRadio.dataset.score!==c&&r.feedback){r.activeRadio=o;var d=o.closest(".checkbox-container");d.querySelector("a").click(),k(d,"Вы изменили оценку. Возможно стоит изменить отзыв?")}i&&L(y)}y.some((function(t){return t&&void 0!==t.status}))?S.classList.remove("hidden"):S.classList.add("hidden"),r.activeRadio=o}})),window.addFeedback=function(t){t.preventDefault(),document.querySelectorAll(".add-form").forEach((function(t){return t.remove()}));var n=t.target,e=n.closest(".checkbox-container").querySelector("input").dataset.id,r=document.createElement("form");r.classList.add("add-form");var i=document.createElement("textarea");i.setAttribute("placeholder","Use Ctrl + Enter to save this feedback or ESC to cancel"),y[e].feedback&&(i.value=y[e].feedback),r.appendChild(i);var o=document.createElement("a");o.innerText="Отмена",o.onclick=function(){r.remove(),M(e)};var c=o.cloneNode();c.innerText="Сохранить",c.onclick=function(){P(e,i,n,r),F(e)};var a=document.createElement("DIV");a.classList.add("feedback-buttons"),a.appendChild(o),a.appendChild(c),r.appendChild(a),n.parentElement.appendChild(r),i.focus(),i.select(),r.addEventListener("keyup",(function(t){13==t.keyCode&&u?(P(e,i,n,r),F(e)):27==t.keyCode&&(M(e),r.remove())}))},window.copyToClipboard=function(t){t.preventDefault(),t.target.classList.add("not-link"),t.target.innerText="Скопировано!",setTimeout((function(){t.target.classList.remove("not-link"),t.target.innerText="Скопировать в буфер"}),1e3);var n=document.createElement("textarea");n.value=o,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},n=Object.prototype,e=n.hasOwnProperty,r=Object.defineProperty||function(t,n,e){t[n]=e.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",a=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{s({},"")}catch(t){s=function(t,n,e){return t[n]=e}}function l(t,n,e,i){var o=n&&n.prototype instanceof v?n:v,u=Object.create(o.prototype),c=new O(i||[]);return r(u,"_invoke",{value:E(t,e,c)}),u}function h(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var p={};function v(){}function d(){}function y(){}var g={};s(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(F([])));b&&b!==n&&e.call(b,c)&&(g=b);var x=y.prototype=v.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(n){s(t,n,(function(t){return this._invoke(n,t)}))}))}function S(t,n){var o;r(this,"_invoke",{value:function(r,u){function c(){return new n((function(o,c){!function r(o,u,c,a){var f=h(t[o],t,u);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==i(l)&&e.call(l,"__await")?n.resolve(l.__await).then((function(t){r("next",t,c,a)}),(function(t){r("throw",t,c,a)})):n.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return r("throw",t,c,a)}))}a(f.arg)}(r,u,o,c)}))}return o=o?o.then(c,c):c()}})}function E(t,n,e){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return M()}for(e.method=i,e.arg=o;;){var u=e.delegate;if(u){var c=_(u,e);if(c){if(c===p)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===r)throw r="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r="executing";var a=h(t,n,e);if("normal"===a.type){if(r=e.done?"completed":"suspendedYield",a.arg===p)continue;return{value:a.arg,done:e.done}}"throw"===a.type&&(r="completed",e.method="throw",e.arg=a.arg)}}}function _(t,n){var e=n.method,r=t.iterator[e];if(void 0===r)return n.delegate=null,"throw"===e&&t.iterator.return&&(n.method="return",n.arg=void 0,_(t,n),"throw"===n.method)||"return"!==e&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+e+"' method")),p;var i=h(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,p;var o=i.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function k(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function L(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function F(t){if(t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++rВаша оценка - ${ - total >= 0 ? total : 0 + totalWithPercent >= 0 ? totalWithPercent : 0 } ${points} \r\n
Отзыв по пунктам ТЗ:\r\n
`; const resultDescriptions = { From 63ca184478e6b81051a7aa5399b2fe90578221f9 Mon Sep 17 00:00:00 2001 From: Alexey Kuptsov3?'class="wide-digit"':"",">").concat(t.max,"
");var f=document.createElement("div");f.classList.add("task-description"),f.innerHTML="".concat(t.text.split("`").map((function(t,n,e){return n
".concat(l["your-mark"]).concat(E>=0?E:0," ").concat(s," \r\n
").concat(l["review-by-points"],"\r\n
");var p={0:l["result-descriptions"][0],1:l["result-descriptions"][1],2:l["result-descriptions"][2],penalty:l.penalties};Object.keys(p).forEach((function(t){a.some((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t}))&&(e.innerHTML+="".concat(p[t],"\r\n
"),a.filter((function(n){return n.type==t&&0!=n.status||"penalty"!=n.type&&n.status==t})).map((function(t,n){e.innerHTML+="".concat(n+1,") ").concat(t.text," \r\n").concat(t.feedback?'
'.concat(l.review,"")+t.feedback+"
":"","\r\n")})))})),u=e.innerText}g.appendChild(n),g.appendChild(e),g.classList.add("visible"),c=!0}function j(t){t?f=0:f++,b.innerText=f}function T(t){if(!w[t].needFeedback||!w[t].feedback||((e=w[t]).feedback=e.feedback.replace(/(\s+)/g," ").trim(),e.feedback.length<8)){if(w[t].needFeedback){var n=w[t].activeRadio.closest(".checkbox-container");return n.querySelector("a").click(),P(n,l["not-empty-feedback"]),void setTimeout((function(){return P(n,v)}),3e3)}}else document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}));var e}function I(t){var n;w[t].needFeedback&&(f--,b.innerText=f,w[t].activeRadio.checked=!1,n=w[t].max,S-=+(n/2).toFixed(1),m.innerHTML=S<0?0:S,delete w[t].needFeedback,delete w[t].activeRadio,delete w[t].status,document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"})),S||O.classList.add("hidden"))}function N(t,n,e,r){w[t].feedback=n.value,n.value?(e.classList.add("feedback-add"),e.innerHTML=l["change-review"]):(delete w[t].feedback,e.classList.remove("feedback-add"),e.innerHTML=l["add-review"]),r.remove()}k.addEventListener("click",(function(t){var n=t.target.parentElement,e=t.target.dataset.id,r=w[e];if("INPUT"===t.target.tagName){var o=t.target,i=o.dataset.score;if(s&&"true"==n.dataset.active)return n.dataset.active="false",void t.preventDefault();if(s&&"false"==n.dataset.active)return n.dataset.active="true",void t.preventDefault();if(!s&&"false"!=n.dataset.active){void 0===r.status&&j();var u="%"===r.max[r.max.length-1],a=[0,+(r.max/2).toFixed(1),r.max];r.status>=0&&!u&&(S-="penalty"!==r.type?a[r.status]:2*a[r.status]),u?1==i?F[r.text]=r.max.slice(0,-1):delete F[r.text]:S+="penalty"!==r.type?a[i]:2*a[i];var f=Object.keys(F).reduce((function(t,n){return t-F[n]}),0);if(E=(S-S*(.01*f)).toFixed(1),r.status=i,m.innerHTML=E<0?0:E,1==+i&&"subtask"==r.type){r.needFeedback=!0,r.activeRadio=o;var l=o.closest(".checkbox-container");l.querySelector("textarea")||l.querySelector("a").click(),l.scrollIntoView({behavior:"smooth"}),P(l,v),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="false",t===l&&(t.dataset.active="true")}))}else if(r.needFeedback&&"subtask"==r.type){r.needFeedback=!1;var p=o.closest(".checkbox-container").querySelector("form");p&&p.remove(),document.querySelectorAll(".checkbox-container").forEach((function(t){t.dataset.active="true"}))}if(void 0!==r.activeRadio&&r.activeRadio.dataset.score!==i&&r.feedback){r.activeRadio=o;var h=o.closest(".checkbox-container");h.querySelector("a").click(),P(h,d)}c&&A(w)}w.some((function(t){return t&&void 0!==t.status}))?O.classList.remove("hidden"):O.classList.add("hidden"),r.activeRadio=o}})),window.addFeedback=function(t){t.preventDefault(),document.querySelectorAll(".add-form").forEach((function(t){return t.remove()}));var n=t.target,e=n.closest(".checkbox-container").querySelector("input").dataset.id,r=document.createElement("form");r.classList.add("add-form");var o=document.createElement("textarea");o.setAttribute("placeholder",l["use-ctrl-enter"]),w[e].feedback&&(o.value=w[e].feedback),r.appendChild(o);var i=document.createElement("a");i.innerText=l.cancel,i.onclick=function(){r.remove(),I(e)};var c=i.cloneNode();c.innerText=l.save,c.onclick=function(){N(e,o,n,r),T(e)};var u=document.createElement("DIV");u.classList.add("feedback-buttons"),u.appendChild(i),u.appendChild(c),r.appendChild(u),n.parentElement.appendChild(r),o.focus(),o.select(),r.addEventListener("keyup",(function(t){13==t.keyCode&&s?(N(e,o,n,r),T(e)):27==t.keyCode&&(I(e),r.remove())}))},window.copyToClipboard=function(t){t.preventDefault(),t.target.classList.add("not-link"),t.target.innerText=l.copied,setTimeout((function(){t.target.classList.remove("not-link"),t.target.innerText=l["copy-to-clipboard"]}),1e3);var n=document.createElement("textarea");n.value=u,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}}var u="rs-checklist-lang";function a(){var t=localStorage.getItem(u);return t||"ru"}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */f=function(){return t};var t={},n=Object.prototype,e=n.hasOwnProperty,r=Object.defineProperty||function(t,n,e){t[n]=e.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function a(t,n,e){return Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{a({},"")}catch(t){a=function(t,n,e){return t[n]=e}}function l(t,n,e,o){var i=n&&n.prototype instanceof v?n:v,c=Object.create(i.prototype),u=new O(o||[]);return r(c,"_invoke",{value:E(t,e,u)}),c}function p(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function v(){}function d(){}function y(){}var g={};a(g,i,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(F([])));b&&b!==n&&e.call(b,i)&&(g=b);var x=y.prototype=v.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(n){a(t,n,(function(t){return this._invoke(n,t)}))}))}function S(t,n){var o;r(this,"_invoke",{value:function(r,i){function c(){return new n((function(o,c){!function r(o,i,c,u){var a=p(t[o],t,i);if("throw"!==a.type){var f=a.arg,l=f.value;return l&&"object"==s(l)&&e.call(l,"__await")?n.resolve(l.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):n.resolve(l).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(a.arg)}(r,i,o,c)}))}return o=o?o.then(c,c):c()}})}function E(t,n,e){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return M()}for(e.method=o,e.arg=i;;){var c=e.delegate;if(c){var u=_(c,e);if(u){if(u===h)continue;return u}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===r)throw r="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r="executing";var a=p(t,n,e);if("normal"===a.type){if(r=e.done?"completed":"suspendedYield",a.arg===h)continue;return{value:a.arg,done:e.done}}"throw"===a.type&&(r="completed",e.method="throw",e.arg=a.arg)}}}function _(t,n){var e=n.method,r=t.iterator[e];if(void 0===r)return n.delegate=null,"throw"===e&&t.iterator.return&&(n.method="return",n.arg=void 0,_(t,n),"throw"===n.method)||"return"!==e&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+e+"' method")),h;var o=p(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function k(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function L(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function F(t){if(t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r