Commit cbb2489a authored by Karl Hasselbring's avatar Karl Hasselbring

Die Quicktips werden jetzt komplett ohne Javascript geladen

parent d86e4c42
......@@ -99,38 +99,37 @@ class Quicktips
}
$content->registerXPathNamespace('main', 'http://www.w3.org/2005/Atom');
$content->registerXPathNamespace('opensearch', 'http://a9.com/-/spec/opensearch/1.1/');
$content->registerXPathNamespace('relevance', 'http://a9.com/-/opensearch/extensions/relevance/1.0/');
$content->registerXPathNamespace('mg', 'http://metager.de/opensearch/quicktips/');
$quicktips = [];
#die(var_dump($content->xpath('//main:entry/mg:type')));
$quicktips_xpath = $content->xpath('main:entry');
foreach ($quicktips_xpath as $quicktip_xml) {
$content->registerXPathNamespace('mg', 'http://metager.de/opensearch/quicktips/');
// Title
$title = $quicktip_xml->title->__toString();
// Link
$link = $quicktip_xml->link['href']->__toString();
// Type
$quicktip_xml->registerXPathNamespace('mg', 'http://metager.de/opensearch/quicktips/');
$types = $quicktip_xml->xpath('mg:type');
if (sizeof($types) > 0) {
$type = $types[0]->__toString();
}
$title = $quicktip_xml->{"title"}->__toString();
$link_xml = $quicktip_xml->link['href'];
if ($link_xml->count() > 0) {
$link = $link_xml->toString();
} else {
$link = "";
$type = "";
}
$link = $quicktip_xml->{"link"}->__toString();
$descr = $quicktip_xml->{"content"}->__toString();
// Description
$descr = $quicktip_xml->content->__toString();
// Details
$details = [];
$details_xpath = $quicktip_xml->xpath('mg:details');
if (sizeof($details_xpath) > 0) {
foreach ($details_xpath as $detail_xml) {
$details_title = $detail_xml->{"title"}->__toString();
$details_link = $detail_xml->{"url"}->__toString();
$details_descr = $detail_xml->{"text"}->__toString();
foreach ($details_xpath[0] as $detail_xml) {
$details_title = $detail_xml->title->__toString();
$details_link = $detail_xml->url->__toString();
$details_descr = $detail_xml->text->__toString();
$details[] = new \App\Models\Quicktips\Quicktip_detail(
$details_title,
$details_link,
......@@ -146,10 +145,8 @@ class Quicktips
$details
);
}
die(var_dump($quicktips));
return $quicktips;
} catch (\Exception $e) {
die($e);
Log::error("A problem occurred parsing quicktips");
return [];
}
......
......@@ -17,7 +17,7 @@ elixir(function (mix) {
// js
mix.scripts(['lib/jquery.js', 'lib/jquery-ui.min.js', 'lib/bootstrap.js', 'lib/lightslider.js', 'lib/masonry.js', 'lib/imagesloaded.js', 'lib/openpgp.min.js', 'lib/iframeResizer.min.js', 'lib/md5.js'], 'public/js/lib.js')
mix.scripts(['scriptStartPage.js', 'result-saver.js'], 'public/js/scriptStartPage.js');
mix.scripts(['scriptResultPage.js', 'result-saver.js', 'quicktips.js'], 'public/js/scriptResultPage.js');
mix.scripts(['scriptResultPage.js', 'result-saver.js'], 'public/js/scriptResultPage.js');
mix.scripts(['searchbar.js', 'focus-creator.js'], 'public/js/searchbar.js');
// utility
mix.scripts(['utility.js'], 'public/js/utility.js');
......
......@@ -322,9 +322,7 @@ function loadFocusForSearch (focus) {
var url ="/meta/meta.ger3?eingabe=x&focus=";
console.log(focus, url);
clearCustomSearch();
//clearCustomSearch();
for (var key in focus) {
if (key.startsWith('engine_') && focus[key] == 'on') {
addSumaToCustomSearch(key);
......
......@@ -15,7 +15,7 @@ $(document).ready(function () {
}
var search = getMetaTag('q') || '';
var locale = getMetaTag('l') || 'de';
loadQuicktips(search, locale, sprueche); // load the quicktips
//loadQuicktips(search, locale, sprueche); // load the quicktips
});
/*
......
......@@ -57,6 +57,7 @@
font-size: 15px;
}
&[type=spruch] {
order: 0;
border-left: 3px solid #070;
p {
color: #070;
......@@ -69,7 +70,35 @@
}
}
}
&[type=duckDuckGo-bang] {
order: 1;
.bang-btn {
width: 100%;
margin-top: 5px;
color: #fff;
background-color: #286992;
font-size: 16px;
}
}
&[type=wikipedia] {
order: 2;
}
&[type=dictCC] {
order: 3;
.quicktip-summary {
p {
font-weight: bold;
}
}
}
&[type=tip] {
order: 4;
}
&[type=ad] {
order: 5;
}
&[type=spendenaufruf] {
order: 6;
border: none;
color: #ff8000;
background-color: inherit;
......@@ -90,21 +119,5 @@
}
}
}
&[type=dictCC] {
.quicktip-summary {
p {
font-weight: bold;
}
}
}
&[type=duckDuckGo-bang] {
.bang-btn {
width: 100%;
margin-top: 5px;
color: #fff;
background-color: #286992;
font-size: 16px;
}
}
}
}
\ No newline at end of file
{{ die(var_dump($quicktip)) }}
@if (sizeof($quicktip->details) > 0)
<details>
<summary class="quicktip-summary">
<h1>
@if (isset($quicktip->link))
<a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a>
@else
{{ $quicktip->title }}
@endif
</h1>
<p>{{ $quicktip->descr }}</p>
@if ($quicktip->title != "")
<h1>
@if ($quicktip->link != "")
<a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a>
@else
{{ $quicktip->title }}
@endif
</h1>
@endif
<p>{!! $quicktip->descr !!}</p>
</summary>
@foreach ($quicktip->details as $detail)
<div class="quicktip-detail">
......@@ -20,18 +21,21 @@
{{ $detail->title }}
@endif
</h2>
<p>{{ $detail->descr }}</p>
<p>{!! $detail->descr !!}</p>
</div>
@endforeach
</details>
@else
<summary class="quicktip-summary">
<h1>
@if (isset($quicktip->link))
<a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a>
@else
{{ $quicktip->title }}
@endif
</h1>
</summary>
<div class="quicktip-summary">
@if ($quicktip->title != "")
<h1>
@if ($quicktip->link != "")
<a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a>
@else
{{ $quicktip->title }}
@endif
</h1>
@endif
<p>{!! $quicktip->descr !!}</p>
</div>
@endif
\ No newline at end of file
Markdown is supported
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