if (!Array.prototype.includes) { Array.prototype.includes = function(searchElement /*, fromIndex*/ ) { 'use strict'; var O = Object(this); var len = parseInt(O.length) || 0; if (len === 0) { return false; } var n = parseInt(arguments[1]) || 0; var k; if (n >= 0) { k = n; } else { k = len + n; if (k < 0) {k = 0;} } var currentElement; while (k < len) { currentElement = O[k]; if (searchElement === currentElement || (searchElement !== searchElement && currentElement !== currentElement)) { // NaN !== NaN return true; } k++; } return false; }; } var cathegories = [ { title: "Nervový systém (CNS, VNS)", subs: [ { title: "Hypnosedativa", no: 1 }, { title: "Antidepresiva + anxiolytika", no: 2 }, { title: "Psychostimulancia", no: 3 }, { title: "Kognitiva", no: 4 }, { title: "Vegetativní nervový systém", no: 5 }, { title: "Rostliny zneužívané pro omamné a psychotropní účinky", no: 49 } ] }, { title: "Bolest", subs: [ { title: "Analgetika", no: 6 }, { title: "Antiflogistika, antiuratika", no: 7 }, { title: "Lokální anestetika", no: 8 } ] }, { title: "Dýchací systém, nachlazení", subs: [ { title: "Antitusika", no: 9 }, { title: "Expektorancia", no: 10 }, { title: "Diaforetika", no: 11 }, { title: "Antiastmatika", no: 44 } ] } , { title: "Srdce a cévy (KVS)", subs: [ { title: "Hemokoagulace", no: 12 }, { title: "Krevní tlak", no: 13 }, { title: "Venotonika", no: 14 }, { title: "Antiarytmika", no: 15 }, { title: "Hypolipidemika", no: 16 } ] } , { title: "Urogenitální systém", subs: [ { title: "Onemocnění prostaty", no: 17 }, { title: "Afrodisiaka", no: 18 }, { title: "Gynekologika", no: 19 }, { title: "Fytoestrogeny", no: 20 }, { title: "Antiseptika močového traktu", no: 48 }, { title: "Diuretika", no: 21 }, ] } , { title: "Trávicí trakt, metabolismus", subs: [ { title: "Antiulceróza, cytoprotektiva", no: 22 }, { title: "Stomachika", no: 24 }, { title: "Karminativa, spasmolytika", no: 25 }, { title: "Laxativa", no: 27 }, { title: "Cholagoga", no: 28 }, { title: "Antiemetika", no: 29 }, { title: "Antidiabetika", no: 30 }, { title: "Anobezika", no: 31 }, { title: "Antidiarhoika", no: 46 }, { title: "Hepatoprotektiva", no: 47 } //{ title: "Digestiva ", no: 23 }, //{ title: "Amara", no: 26 }, ] }, { title: "Kůže a její adnex", subs: [ { title: "Dermatologika, kosmetika", no: 32 } ] }, { title: "Nádorová onemocnění, imunitní systém", subs: [ { title: "Cytostatika", no: 33 }, { title: "Imunomodulancia", no: 34 }, ] }, { title: "Antiinfektiva", subs: [ { title: "Anthelmintika", no: 39 }, { title: "Antivirotika", no: 36 }, { title: "Antiseptika močového traktu", no: 48 }, { title: "Antiseptika", no: 41 } ] }, { title: "Ostatní", subs: [ { title: "Antioxidanty", no: 37 }, { title: "Systémová enzymoterapie", no: 35 }, { title: "Insekticidy", no: 38 }, { title: "Jedovaté rostliny, toxiny", no: 40 }, { title: "Ostatní", no: 42 } ] }, { title: "Stomatologie", no: 50 }, { title: "Oko", no: 51 } ] var authors = [ "doc. PharmDr. Jan Juřica, Ph.D., Farmakologický ústav LF MU", "MUDr. Jana Pistovčáková, Ph.D., Farmakologický ústav LF MU", "PharmDr. Jana Rudá-Kučerová, Ph.D., Farmakologický ústav LF MU", "Mgr. Gabriela Dovrtělová, Farmakologický ústav LF MU", "Mgr. Jana Merhautová, Farmakologický ústav LF MU", "Mgr. Kristýna Nosková, Farmakologický ústav LF MU", "Mgr. Katarína Tabiová, Farmakologický ústav LF MU", "MUDr. Jana Nováková, Ph.D., Farmakologický ústav LF MU", "Mgr. Tibor Štark, Farmakologický ústav LF MU", "Ing. Lea Jedonková, Centrum léčivých rostlin LF MU", "Mgr. Milan Šenkýř, Centrum léčivých rostlin LF MU" ] var licences = [ { title: "volné dílo", url: "https://cs.wikipedia.org/wiki/Voln%C3%A9_d%C3%ADlo#Public_domain" }, { title: "CC0 1.0", url: "https://creativecommons.org/publicdomain/zero/1.0/deed.cs" }, { title: "CC BY 2.0", url: "https://creativecommons.org/licenses/by/2.0/deed.cs" }, { title: "CC BY-NC 2.0", url: "https://creativecommons.org/licenses/by-nc/2.0/deed.cs" }, { title: "CC BY-SA 2.0", url: "https://creativecommons.org/licenses/by-sa/2.0/deed.cs" }, { title: "CC BY-NC-SA 2.0", url: "https://creativecommons.org/licenses/by-nc-sa/2.0/deed.cs" }, { title: "CC BY-SA 2.5", url: "https://creativecommons.org/licenses/by-sa/2.5/deed.cs" }, { title: "CC BY 3.0", url: "https://creativecommons.org/licenses/by/3.0/deed.cs" }, { title: "CC BY-SA 3.0", url: "https://creativecommons.org/licenses/by-sa/3.0/deed.cs" }, { title: "CC BY-NC 4.0", url: "https://creativecommons.org/licenses/by-nc/4.0/deed.cs" }, { title: "CC BY-SA 4.0", url: "https://creativecommons.org/licenses/by-sa/4.0/deed.cs" } ] function initAtlas() { showSection("single"); var url = window.location.href; if (url.indexOf("iid=") > 0) { var iid = url.substring(url.indexOf("iid=")+4); var lat = iid.replace("_", " "); for (var i = 0; i < data.length; i++) { var item = data[i]; console.log(iid + " - " + item.la) if (item.la.indexOf(lat) == 0) { showItem(item); } } //loadItem(iid); } if (url.indexOf("la=") > 0) { var iid = url.substring(url.indexOf("la=")+3); var lat = iid.replace("_", " "); for (var i = 0; i < data.length; i++) { var item = data[i]; console.log(iid + " - " + item.la) if (item.la.indexOf(lat) == 0) { showItem(item); } } //loadItem(iid); } } var actual = { cat: -1, sub: -1, aCat: null, aSub: null, foundItem: null, lang: "cs", list: [] } function showItem(item) { showSection("single"); var sect = document.querySelector(".single2"); sect.innerHTML = ""; //sect.style.border = "0 none"; var maintitle = sect.appendChild(document.createElement("h1")); maintitle.innerHTML = item.cs; var langs = sect.appendChild(document.createElement("ul")); langs.className = "names"; var li = langs.appendChild(document.createElement("li")); li.className = "sk"; li.innerHTML = item.sk; li = langs.appendChild(document.createElement("li")); li.className = "la"; li.innerHTML = item.la; if (item.en && item.en != "") { li = langs.appendChild(document.createElement("li")); li.className = "en"; li.innerHTML = item.en; } if (item.de && item.de != "") { li = langs.appendChild(document.createElement("li")); li.className = "de"; li.innerHTML = item.de; } if (item.pics && item.pics.length > 0) { var imgs = sect.appendChild(document.createElement("figure")); imgs.className = "images"; for (var i = 0; i < item.pics.length; i++) { var pic = item.pics[i]; var link = imgs.appendChild(document.createElement("a")); link.setAttribute("rel", "prettyPhoto[gallery_plant]"); link.setAttribute("href", "images/plants/" + pic.file); link.title = "Autor: " + pic.author + ", licence: " + licences[pic.lic].title + ", zdroj" var img = link.appendChild(document.createElement("img")); img.src = "images/plants/" + pic.file + "?nahled=1"; img.className = "thumb"; } } createSection(sect, "sber", "Charakteristika rostliny a sběr", item.col); createSection(sect, "latky", "Účinné látky", item.as); //markSubstances(item.as) createSection(sect, "efekt", "Působení", item.effect); createSection(sect, "uziti", "Užití", item.usage); createSection(sect, "kontra", "Kontraindikace", item.ko); createSection(sect, "evidence", "Evidence", ["nízká", "střední", "vysoká"][item.ev]); if (typeof item.ref == "string") { // var refs = item.ref.split(/\s*\|\s*/) item.ref= item.ref.replace(/\"/g, "").split(/\s*\|\s*|xxx/); } if (item.ref && item.ref.length > 0) { var refs = createTitledSection(sect, "reference", "Reference"); var ul = refs.appendChild(document.createElement("ul")); var arts = item.ref //.split(/\|/g); for (var i = 0; i < arts.length; i++) { var li = ul.appendChild(document.createElement("li")); li.innerHTML = arts[i].trim(); } } var author = sect.appendChild(document.createElement("p")); //author.className = "author"; author.innerHTML = "Autor: " +authors[item.author]; //$(sect).ready(function(){ pprefresh(); }); pprefresh(); } function markSubstances(text) { var replacement = "$1$2$4" var out = text.replace(/([\s\(^])(\S+in(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+on(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+an(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+en(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+id(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+yd(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+ík(u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+ol(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+al(y|u)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+át(ů|u|y)*)([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+ov(á|ou|é))([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+n(á|ou|é))([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+it(á|ou|é))([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(\S+os(a|y|u))([\s\.\),$])/gi, replacement); out = out.replace(/([\s\(^])(silic(e|í|i)*)([\s\.\),$])/gi, replacement); return out; } function createSection(parent, cname, title, content) { var section = parent.appendChild(document.createElement("section")); section.className = cname; var h3 = section.appendChild(document.createElement("h2")) h3.innerHTML = title; var p = section.appendChild(document.createElement("p")) p.innerHTML = content.trim().replace(/([\s\(])([ksvziouKSVZIOU])\s/g, "$1$2 "); return section; } function createTitledSection(parent, cname, title) { var section = parent.appendChild(document.createElement("section")); section.className = cname; var h3 = section.appendChild(document.createElement("h2")) h3.innerHTML = title; return section; } function showSection(sid) { var sect = document.querySelector("#" + sid + ", ." + sid); if (sect) sect.style.display = "block"; } function hideSection(sid) { var sect = document.querySelector("#" + sid + ", ." + sid); if (sect) sect.style.display = "none"; } function resolveKeys(evt) { var input = evt.currentTarget; //searchPhrase(); // if (evt.keyCode == 13) { // searchPhrase(); // } } window.addEventListener("load", initAtlas); //window.addEventListener("load", loadData) var actSource = { url: "/el/1433/test/s_zakazky/rozprac16/002_jurica/atlas/js/data.qwarp", imageDir: "/images/plants/" } var baseurl = this.location.href; var basedir = baseurl.substring(0, baseurl.lastIndexOf("/")); if (actSource) { actSource.url = basedir + actSource.url; actSource.imageDir = basedir + actSource.imageDir; } var data = data || []; function loadItem(iid) { var url = window.location.href; url = url.substring(0, url.lastIndexOf("/")) loadHTML( "https://is.muni.cz/auth/elearning/warp_ajax_edit?typ_prvku=h;akce=edituj_prvek;edituj_prvek_id=" + iid, "readItem"); } function loadSubIos(evt) { var index = 0; if (typeof evt == "number") index = evt; else index = parseInt(event.currentTarget.value); outline.base = outline.ios[index].base; outline.divid = outline.ios[index].divid; loadHTML( outline.base + "?prejit=" + outline.divid, "readSubsections"); } function loadHTML(url, akce) { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { console.log(strProblemXMLHTTP); return false; } http_request.onreadystatechange = function () { parseHTML(akce, http_request); }; http_request.open('GET', url, true); http_request.send(); } function parseHTML(akce, http_request) { if (akce == "readList") { var list = document.getElementById("itemList"); list.innerHTML = ""; } if (http_request.readyState == 4) { if (http_request.status == 200) { var vystup = "" var response = http_request.responseText; if (akce == "readItem") { var itemText = response.substring(response.indexOf("<textarea"), response.indexOf("</textarea")); itemText = itemText.substring(itemText.indexOf("{"), itemText.lastIndexOf("}")+1).replace(/"/g, "\"").replace(/&/g, "&") itemText = itemText.replace(/&lt;/g, "<").replace(/&gt;/g, ">"); var item = JSON.parse(itemText) showItem(item); return; } if (akce == "readImages") { console.log("Mapa slozky nactena"); parseImages(response); return; } if (akce == "vlozit") { report("Položka byla uložena.") return; } if (akce == "vlozitNovy") { report("Nová položka byla uložena.") return; } } else { if (http_request.getAllResponseHeaders()) { console.log(strProblemRequest); } } } } //function loadItem(iid) { // makeRequest("GET", "/auth/elearning/warp_ajax_edit?typ_prvku=h;akce=edituj_prvek;edituj_prvek_id=" + iid +";", "", "parseItem" ) //} var nextAction = ""; var lastInsertedItem = null; function makeRequest(gptype, url, elemid, akce, parameters) { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { //http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { console.log(strProblemXMLHTTP) return false; } nextAction = akce; http_request.onreadystatechange = function () { feedbackContents(elemid, akce, http_request); }; // // http://developer.mozilla.org/cs/docs/index.php?title=AJAX:Jak_za%C4%8D%C3%ADt&printable=yes // if (gptype == 'POST') { http_request.open('POST', url, true); // http_request.setRequestHeader("Content-type", "text/xml"); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); } else if (gptype == 'GET') { http_request.open('GET', url, true); } http_request.send(parameters); } function setReport(text) { document.getElementById("report").innerHTML = text } function report(text) { document.getElementById("report").innerHTML += text; } function feedbackContents(global_elemid, global_akce, http_request) { if (global_akce == 'sbalit') { document.getElementById(global_elemid).innerHTML = "... " + strPacking + " ..."; } if (global_akce == 'rozbalit') { document.getElementById(global_elemid).innerHTML = "... " + strUnpacking + " ..."; } if (global_akce == 'fastedit') { document.getElementById(global_elemid).innerHTML = "... " + saving + " ..."; } if (global_akce == 'saveText') { } if (http_request.readyState == 4) { if (http_request.status == 200) { var response = http_request.responseXML.documentElement; var rText = http_request.responseText; var resultHTML = ''; var rootNode = response.getElementsByTagName('html')[0]; for (i = 0; i < rootNode.childNodes.length; i++) { resultHTML += rootNode.childNodes[i].nodeValue; } if (global_akce == "vlozit") { repeatLastAction(); setReport("Změny byly uloženy.") hideSection("editor"); showSection("addnew"); return; } if (global_akce == "vlozitNovy") { setReport("Nová položka byla uložena.") hideSection("editor"); showSection("addnew"); return; } //document.getElementById("report").innerHTML = resultHTML; if (nextAction == "savedComment") { setReport("Video ulozeno"); return; } if (nextAction == "vlozitZaPosledni") { var newId = resultHTML.match(/div\sid=\"divid_(\d+)/); if ( newId) { lastItem = newId[1]; lastInsertedItem.id = newId[1]; } hideSection("editor"); showSection("addnew"); repeatLastAction(); return; } if (nextAction == 'parseItem') { var rText = rootNode.innerHTML; var cont = rText.substring(rText.indexOf("<textarea"), rText.indexOf("</textarea")); cont = cont.substring(cont.indexOf("{"),cont.lastIndexOf("}")+1); document.getElementById("feedback").innerHTML = cont; var quest = cont.replace(/\&/g, "&"); quest = quest.replace(/\&/g, "&"); quest = quest.replace(/\&/g, "&"); quest = quest.replace(/\</g, "<"); quest = quest.replace(/\>/g, ">"); quest = quest.replace(/\"/g, "\""); quest = quest.replace(/\ /g, String.fromCharCode(160)); quest = quest.replace(/\−/g, String.fromCharCode(8722)); document.getElementById("feedback").innerHTML += quest; quest = JSON.parse(quest); if (quest.task) { document.getElementById("feedback").innerHTML += "
" + quest.task } if (quest.param_in) { document.getElementById("feedback").innerHTML += "
  1. " + quest.param_in.join("
  2. ") + "
" } if (quest.param_out) { document.getElementById("feedback").innerHTML += "
  1. " + quest.param_out.join("
  2. ") + "
" } nextAction = ""; } if (nextAction == "vlozitNovouPodosnovu") { var rt = http_request.responseText var nid = rt.match(/podosnova_divid_(\d+)/); chainData.subId = nid[1]; report("Vytvorena podosnova: " + chainData.currentDir + " (" + chainData.subId + ").") renameSubsection(chainData.subId, chainData.currentDir); } if (nextAction == "openSubsection") { console.log(" Podosnova odemcena." + chainData.subId); document.querySelector("#player figure").style.visibility = "visible"; document.getElementById("subsectionAdder").style.display = "none"; var actSub = { id: chainData.subId, title: chainData.title} outline.subs.push(actSub); outline.actSub = actSub; } if (nextAction == "renameOsnova") { console.log(" Nova podosnova prejmenovana." + chainData.subId); //report(" Nova podosnova prejmenovana."); // setTimeout(null, 1500); //if (chainData.subId) openSubsection(chainData.subId); } } else { if (http_request.getAllResponseHeaders()) { concole.log(strProblemRequest) } } } } var chainData = { }; function addZeros(no) { return (no < 10) ? "0" + no : "" + no; } var lastItem = -1; function badItem() { this.title = { cs:"Položka nenačtena", en: "Item didn't load" }; this.desc = { cs: "", en: "" }; this.file= "skull.png"; this.markers = [ ] } function Cathegory() { this.id = ""; this.en = ""; this.cs = ""; this.subs = []; this.items = []; }