diff --git a/app/Models/Quicktips/Quicktips.php b/app/Models/Quicktips/Quicktips.php index 86c6534b8550b9f5a6ed4f47410c82afeb093014..ef06935bc23cb7597d6a1e6f4bed2797656b36d0 100644 --- a/app/Models/Quicktips/Quicktips.php +++ b/app/Models/Quicktips/Quicktips.php @@ -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 []; } diff --git a/gulpfile.js b/gulpfile.js index 4de54a12ea310d12ec51c9967c9ec874e9dd0b20..1679a9b683ed77645d611e2656d403ce9d4d67c0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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'); diff --git a/resources/assets/js/focus-creator.js b/resources/assets/js/focus-creator.js index b1989859c8e947279bd81d160f9dcdb820b05205..fd1b06725298a30def137f0bb2fa5a0c229b2b04 100644 --- a/resources/assets/js/focus-creator.js +++ b/resources/assets/js/focus-creator.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); diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 5e7aabff7d88e087bfc55ced202aacd7225f638b..80259672b05d4cf65e90437f386388f872635e73 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -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 }); /* diff --git a/resources/assets/less/metager/quicktips.less b/resources/assets/less/metager/quicktips.less index 5fcc75995f0e896404c2c11bc557812bf78c895b..a6fd9bb439399680c8c43f32ac8f632ce693d646 100644 --- a/resources/assets/less/metager/quicktips.less +++ b/resources/assets/less/metager/quicktips.less @@ -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 diff --git a/resources/views/parts/quicktip.blade.php b/resources/views/parts/quicktip.blade.php index 4ac21b233b8068aa20c35d6f608d5f22d5dad043..2841b77128e5b5172071ccd2eeb00e0a914027cf 100644 --- a/resources/views/parts/quicktip.blade.php +++ b/resources/views/parts/quicktip.blade.php @@ -1,15 +1,16 @@ -{{ 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