Commit 70ceae89 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch...

Merge branch '590-quicktips-zeigen-auch-fur-null-und-nicht-gefundenes-ergebnisse-an' into 'development'

Resolve "Quicktips zeigen auch für "null" und nicht gefundenes ergebnisse an"

Closes #590

See merge request !1050
parents 9ac895e8 c80c9700
...@@ -15,23 +15,27 @@ $(document).ready(function () { ...@@ -15,23 +15,27 @@ $(document).ready(function () {
} else { } else {
var sprueche = getURLParameter('sprueche') === 'on'; // load the sprueche url parameter var sprueche = getURLParameter('sprueche') === 'on'; // load the sprueche url parameter
} }
var search = getMetaTag('q'); var search = getMetaTag('q') || '';
var locale = getMetaTag('l'); var locale = getMetaTag('l') || 'de';
loadQuicktips(search, locale, sprueche); // load the quicktips loadQuicktips(search, locale, sprueche); // load the quicktips
}); });
/* /*
function readLocaleFromUrl(defaultLocale) { function readLocaleFromUrl(defaultLocale) {
return location.pathname.substr(1, location.pathname.indexOf('/meta', 0) - 1) || 'de'; return location.pathname.substr(1, location.pathname.indexOf('/meta', 0) - 1) || 'de'
} }
*/ */
function getURLParameter(name) { function getURLParameter (name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null; return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
} }
function getMetaTag(name) { function getMetaTag (name) {
return $('meta[name="' + name + '"')[0].content; if (typeof $('meta[name="' + name + '"')[0] !== 'undefined') {
return $('meta[name="' + name + '"')[0].content || null;
} else {
return null;
}
} }
function activateJSOnlyContent () { function activateJSOnlyContent () {
...@@ -595,7 +599,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { ...@@ -595,7 +599,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) {
title: $(this).children('title').text(), title: $(this).children('title').text(),
text: $(this).children('text').text(), text: $(this).children('text').text(),
url: $(this).children('url').text() url: $(this).children('url').text()
} };
}).toArray() }).toArray()
}; };
}).toArray(); }).toArray();
...@@ -659,7 +663,7 @@ function createQuicktips (quicktips, sprueche) { ...@@ -659,7 +663,7 @@ function createQuicktips (quicktips, sprueche) {
detailElem detailElem
.append(detailHeadlineElem) .append(detailHeadlineElem)
.append('<p>' + detail.text + '</p>'); .append('<p>' + detail.text + '</p>');
mainElem.append(detailElem); mainElem.append(detailElem);
}); });
} else { } else {
mainElem = $('<div class="quicktip-summary">'); mainElem = $('<div class="quicktip-summary">');
......
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