PageSourceSearch

https://softmech.org/3t4/js/dist/gu-ug-entryrequirements.3fd6aed0.js

js softmech.org collected 2026-09-28 06:37:21 UTC 8,797 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkuniversity_of_glasgow=self.webpackChunkuniversity_of_glasgow||[]).push([[2963],{35415:function(e,t,i){i.r(t),i.d(t,{default:function(){return UndergraduateEntryRequirements}});var n=i(18987);class UndergraduateEntryRequirements{constructor(e){this.el=e,this.countryEndpoint="/feeds/countrypicker/?countries=true",this.hasRequirementsEndpoint="/feeds/apex/hasErsUgProgrammeCountry",this.requirementsEndpoint="/feeds/apex/ersUgProgrammeCountry",this.cookieName="gu_ct",this.cookieDomain=".gla.ac.uk",this.cookieExpires=365,this.countrySelectId="ug-country-selector",this.courseSelectId="ug-course-selector",this.countrySelectClass="entry-country-select",this.countries=[],this.courseOptions=[],this.init()}async init(){this.insertControls(),await Promise.all([this.loadCountries(),this.loadCourses()]),this.syncCountrySelection(),this.syncCourseSelection(),this.countrySelector.addEventListener("change",(()=>{this.setCountryCookie(this.countrySelector.value),this.renderRequirements()})),this.courseSelector.addEventListener("change",(()=>{this.renderRequirements()})),this.renderRequirements()}insertControls(){this.controls=document.createElement("div"),this.controls.className="ug-entry-requirements-controls",this.controls.innerHTML=`\n      <label class="visuallyhidden ug-entry-requirements-label" for="${this.courseSelectId}">Select your degree or UCAS code</label>\n      <select id="${this.courseSelectId}" class="ug-course-select" aria-label="Select your degree or UCAS code"><option value="">Select your degree or UCAS code</option></select>\n      <label class="visuallyhidden ug-entry-requirements-label" for="${this.countrySelectId}">Country/region</label>\n      <select id="${this.countrySelectId}" class="${this.countrySelectClass}" aria-label="Select your country/region"></select>\n   `,this.el.parentNode.insertBefore(this.controls,this.el),this.countrySelector=this.controls.querySelector(`#${this.countrySelectId}`),this.courseSelector=this.controls.querySelector(`#${this.courseSelectId}`)}async loadCountries(){const e=await fetch(this.countryEndpoint);this.countries=await e.json(),this.countrySelector.innerHTML=`<option value="">Select your country/region</option>${this.countries.map((e=>`<option data-id="${e.id}" value="${e.id}">${this.escapeHtml(e.title)}</option>`)).join("")}`}loadCourses(){const e=globalThis.combinationInfo||window.combinationInfo||[],t=new Set;this.courseOptions=[],e.forEach((e=>{(e.combinations||[]).forEach((i=>{i?.ucasCode&&!t.has(i.ucasCode)&&(t.add(i.ucasCode),this.courseOptions.push({value:i.ucasCode,label:this.buildCourseLabel(e,i)}))}))})),this.courseSelector.innerHTML="";const i=document.createDocumentFragment(),n=document.createElement("option");n.value="",n.textContent="Select your degree or UCAS code",i.appendChild(n),this.courseOptions.forEach((e=>{const t=document.createElement("option");t.value="string"==typeof e.value?e.value:String(e.value),t.textContent="string"==typeof e.label?e.label.replace(/&amp;/g,"&"):String(e.label),i.appendChild(t)})),this.courseSelector.appendChild(i)}buildCourseLabel(e,t){const i=[];return t.combinationName&&i.push(t.combinationName),e?.designation&&i.push(e.designation),t?.ucasCode&&i.push(t.ucasCode),i.join(" - ")}syncCountrySelection(){const e=this.getCountryCookie(),t=this.countries.find((t=>String(t.id)===String(e))),i=t||this.getDefaultUKCountry();i&&(this.countrySelector.value=String(i.id),e&&t||this.setCountryCookie(i.id))}syncCourseSelection(){this.courseSelector.options.length>0&&(this.courseSelector.selectedIndex=0)}getDefaultUKCountry(){return this.countries.find((e=>!0===e.isUk))||this.countries[0]}getCountryCookie(){return n.A.get(this.cookieName)||!1}setCountryCookie(e){if(!e)return;const t={expires:this.cookieExpires,secure:"https:"===window.location.protocol,path:"/"};window.location.hostname.endsWith(".gla.ac.uk")&&(t.domain=this.cookieDomain),n.A.set(this.cookieName,e,t)}async renderRequirements(){if(!this.countrySelector.value||!this.courseSelector.value)return void(this.el.innerHTML="");this.el.innerHTML='\n      <div style="text-align: center;">\n        <svg xmlns="http://www.w3.org/2000/svg" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-ellipsis" style="background: none; text-align: center;"><circle cx="84" cy="50" r="0" fill="#5b4d94"><animate attributeName="r" values="10;0;0;0;0" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;
10 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="0s"></animate><animate attributeName="cx" values="84;84;84;84;84" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="0s"></animate></circle><circle cx="16" cy="50" r="9.6148" fill="#951272"><animate attributeName="r" values="0;10;10;10;0" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="-1.85s"></animate><animate attributeName="cx" values="16;16;50;84;84" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="-1.85s"></animate></circle><circle cx="84" cy="50" r="0.385197" fill="#0274af"><animate attributeName="r" values="0;10;10;10;0" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="-0.925s"></animate><animate attributeName="cx" values="16;16;50;84;84" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="-0.925s"></animate></circle><circle cx="82.6903" cy="50" r="10" fill="#011451"><animate attributeName="r" values="0;10;10;10;0" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="0s"></animate><animate attributeName="cx" values="16;16;50;84;84" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="0s"></animate></circle><circle cx="48.6903" cy="50" r="10" fill="#5b4d94"><animate attributeName="r" values="0;0;10;10;10" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="0s"></animate><animate attributeName="cx" values="16;16;16;50;84" keyTimes="0;0.25;0.5;0.75;1" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" calcMode="spline" dur="3.7s" repeatCount="indefinite" begin="0s"></animate></circle></svg>\n      </div>';const e=this.countrySelector.value,t=this.courseSelector.value;try{const i=await fetch(`${this.hasRequirementsEndpoint}/${e}/${t}`),n=await i.json();if(!n?.hasRequirements)return void(this.el.innerHTML="<p>No undergraduate entry requirements are available for the selected country and course.</p>");const r=await fetch(`${this.requirementsEndpoint}/${e}/${t}`),s=await r.json();this.el.innerHTML=this.renderRequirementBlocks(s)}catch(e){console.error("Error loading undergraduate entry requirements:",e),this.el.innerHTML="<p>Unable to load undergraduate entry requirements at this time.</p>"}}renderRequirementBlocks(e){if(!Array.isArray(e)||0===e.length)return"<p>No undergraduate entry requirements are available for the selected course.</p>";const t=e.map((e=>this.renderRequirementBlock(e))).filter(Boolean);return t.length>0?t.join(""):"<p>No undergraduate entry requirements are available for the selected course.</p>"}renderRequirementBlock(e){if(!e)return"";const t=this.cleanText(e.qualification_title),i=this.renderQualificationText(e.qualification_text);return t||i?`\n      <section class="ug-entry-requirement">\n        ${t?`<h3>${this.escapeHtml(t)}</h3>`:""}\n        ${i}\n      </section>\n    `:""}renderQualificationText(e){const t=this.cleanText(e);if(!t)return"";const i=document.createElement("div");return i.innerHTML=t,i.querySelectorAll("h2").forEach((e=>{const t=document.createElement("h4");t.innerHTML=e.innerHTML,[...e.attributes].forEach((e=>{t.setAttribute(e.name,e.value)})),e.replaceWith(t)})),i.querySelectorAll("li").forEach((e=>{this.cleanText(e.textContent)||e.remove()})),i.querySelectorAll("ul, ol").forEach((e=>{e.querySelector("li")||e.remove()})),this.cleanText(i.innerHTML)}cleanText(e){return"string"==typeof e?e.trim():""}escapeHtml(e){return this.cleanText(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}}}}]);
2//# sourceMappingURL=gu-ug-entryrequirements.3fd6aed0.js.map

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.