Commit 92f616ea authored by Karl Hasselbring's avatar Karl Hasselbring
Browse files

Die Quicktips werden jetzt komplett ohne Javascript geladen

parent f85b4408
...@@ -99,38 +99,37 @@ class Quicktips ...@@ -99,38 +99,37 @@ class Quicktips
} }
$content->registerXPathNamespace('main', 'http://www.w3.org/2005/Atom'); $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 = []; $quicktips = [];
#die(var_dump($content->xpath('//main:entry/mg:type')));
$quicktips_xpath = $content->xpath('main:entry'); $quicktips_xpath = $content->xpath('main:entry');
foreach ($quicktips_xpath as $quicktip_xml) { 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'); $types = $quicktip_xml->xpath('mg:type');
if (sizeof($types) > 0) { if (sizeof($types) > 0) {
$type = $types[0]->__toString(); $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 { } else {
$link = ""; $type = "";
} }
$link = $quicktip_xml->{"link"}->__toString(); // Description
$descr = $quicktip_xml->{"content"}->__toString(); $descr = $quicktip_xml->content->__toString();
// Details
$details = []; $details = [];
$details_xpath = $quicktip_xml->xpath('mg:details'); $details_xpath = $quicktip_xml->xpath('mg:details');
if (sizeof($details_xpath) > 0) { if (sizeof($details_xpath) > 0) {
foreach ($details_xpath as $detail_xml) { foreach ($details_xpath[0] as $detail_xml) {
$details_title = $detail_xml->{"title"}->__toString(); $details_title = $detail_xml->title->__toString();
$details_link = $detail_xml->{"url"}->__toString(); $details_link = $detail_xml->url->__toString();
$details_descr = $detail_xml->{"text"}->__toString(); $details_descr = $detail_xml->text->__toString();
$details[] = new \App\Models\Quicktips\Quicktip_detail( $details[] = new \App\Models\Quicktips\Quicktip_detail(
$details_title, $details_title,
$details_link, $details_link,
...@@ -146,10 +145,8 @@ class Quicktips ...@@ -146,10 +145,8 @@ class Quicktips
$details $details
); );
} }
die(var_dump($quicktips));
return $quicktips; return $quicktips;
} catch (\Exception $e) { } catch (\Exception $e) {
die($e);
Log::error("A problem occurred parsing quicktips"); Log::error("A problem occurred parsing quicktips");
return []; return [];
} }
......
...@@ -17,7 +17,7 @@ elixir(function (mix) { ...@@ -17,7 +17,7 @@ elixir(function (mix) {
// js // 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(['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(['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'); mix.scripts(['searchbar.js', 'focus-creator.js'], 'public/js/searchbar.js');
// utility // utility
mix.scripts(['utility.js'], 'public/js/utility.js'); mix.scripts(['utility.js'], 'public/js/utility.js');
......
...@@ -322,9 +322,7 @@ function loadFocusForSearch (focus) { ...@@ -322,9 +322,7 @@ function loadFocusForSearch (focus) {
var url ="/meta/meta.ger3?eingabe=x&focus="; var url ="/meta/meta.ger3?eingabe=x&focus=";
console.log(focus, url); //clearCustomSearch();
clearCustomSearch();
for (var key in focus) { for (var key in focus) {
if (key.startsWith('engine_') && focus[key] == 'on') { if (key.startsWith('engine_') && focus[key] == 'on') {
addSumaToCustomSearch(key); addSumaToCustomSearch(key);
......
...@@ -15,7 +15,7 @@ $(document).ready(function () { ...@@ -15,7 +15,7 @@ $(document).ready(function () {
} }
var search = getMetaTag('q') || ''; var search = getMetaTag('q') || '';
var locale = getMetaTag('l') || 'de'; var locale = getMetaTag('l') || 'de';
loadQuicktips(search, locale, sprueche); // load the quicktips //loadQuicktips(search, locale, sprueche); // load the quicktips
}); });
/* /*
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
font-size: 15px; font-size: 15px;
} }
&[type=spruch] { &[type=spruch] {
order: 0;
border-left: 3px solid #070; border-left: 3px solid #070;
p { p {
color: #070; color: #070;
...@@ -69,7 +70,35 @@ ...@@ -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] { &[type=spendenaufruf] {
order: 6;
border: none; border: none;
color: #ff8000; color: #ff8000;
background-color: inherit; background-color: inherit;
...@@ -90,21 +119,5 @@ ...@@ -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) @if (sizeof($quicktip->details) > 0)
<details> <details>
<summary class="quicktip-summary"> <summary class="quicktip-summary">
<h1> @if ($quicktip->title != "")
@if (isset($quicktip->link)) <h1>
<a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a> @if ($quicktip->link != "")
@else <a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a>
{{ $quicktip->title }} @else
@endif {{ $quicktip->title }}
</h1> @endif
<p>{{ $quicktip->descr }}</p> </h1>
@endif
<p>{!! $quicktip->descr !!}</p>
</summary> </summary>
@foreach ($quicktip->details as $detail) @foreach ($quicktip->details as $detail)
<div class="quicktip-detail"> <div class="quicktip-detail">
...@@ -20,18 +21,21 @@ ...@@ -20,18 +21,21 @@
{{ $detail->title }} {{ $detail->title }}
@endif @endif
</h2> </h2>
<p>{{ $detail->descr }}</p> <p>{!! $detail->descr !!}</p>
</div> </div>
@endforeach @endforeach
</details> </details>
@else @else
<summary class="quicktip-summary"> <div class="quicktip-summary">
<h1> @if ($quicktip->title != "")
@if (isset($quicktip->link)) <h1>
<a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a> @if ($quicktip->link != "")
@else <a href="{{ $quicktip->link }}">{{ $quicktip->title }}</a>
{{ $quicktip->title }} @else
@endif {{ $quicktip->title }}
</h1> @endif
</summary> </h1>
@endif
<p>{!! $quicktip->descr !!}</p>
</div>
@endif @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