Commit b397e577 authored by Phil Höfer's avatar Phil Höfer
Browse files

Merge branch '39-remove-ecmascript-6-features' into 'master'

Resolve "Remove ECMAScript 6 features"

Closes #39

See merge request open-source/metager-app!3
parents 7dc4b881 bfee8cc9
const TRIES = 3;
const TRYDELAYINCRMS = 1000;
var TRIES = 3;
var TRYDELAYINCRMS = 1000;
function loadXMLDoc(filename)
{
......@@ -12,7 +12,7 @@ return xhttp.responseXML;
function render(err, content)
{
if (err) {
alert("Fehler bei der Suche! Bitte prüfen Sie Ihr Netzwerk.");
alert("Fehler bei der Suche! Bitte prüfen Sie Ihr Netzwerk.("+err+")");
location.href="index.xhtml";
} else {
style = loadXMLDoc("style/material.xsl");
......@@ -21,7 +21,7 @@ function render(err, content)
xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(style);
resultDocument = xsltProcessor.transformToFragment(content, document);
document.body.replaceWith(resultDocument);
document.body.replaceChild(resultDocument, document.getElementById("temp"));
}
}
}
......@@ -32,7 +32,7 @@ function render(err, content)
function search(query,focus,callback, trycount) {
query = query || "eingabe=";
focus = focus || "focus=web";
let doc;
var doc;
trycount = trycount || 0;
try {
doc = loadXMLDoc("https://metager3.de/meta/meta.ger3?"+focus+"&"+query+"&encoding=utf8&out=atom10&appversion=3.0.0");
......@@ -53,9 +53,16 @@ function boot()
search(getParameter('eingabe'),getParameter('focus'),render);
}
function filterFunc(p,i,a)
{
return p.startsWith(parameterName + "=");
}
function getParameter(parameterName) {
const parameterStrings = location.search.substr(1).split("&");
const results = parameterStrings.filter((p, i, a) => p.startsWith(parameterName + "="));
var parameterStrings = location.search.substr(1).split("&");
var results = parameterStrings.filter(function(p,i,a) {
return p.startsWith(parameterName + "=");
});
return results.join("&");
}
......
......@@ -12,6 +12,7 @@
<script type="text/javascript" defer="defer" src="app/results.js"></script>
</head>
<body onload="boot()">
<div id="temp">
<header class="persistent-search">
<form class="search-card card elevation-2" id="searchform">
<a href="index.xhtml" class="back">
......@@ -27,5 +28,6 @@
<footer class="footer-text">
MetaGer wird entwickelt und betrieben vom SUMA-EV - Verein für freien Wissenszugang.
</footer>
</div>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment