From 588967ac1490e5b041cae3036aa2dbabfee3844e Mon Sep 17 00:00:00 2001 From: Aria Date: Tue, 12 Sep 2017 11:19:00 +0200 Subject: [PATCH 01/36] Werbung hinzugefuegt --- resources/views/layouts/atom10-ad.blade.php | 8 +++++++ .../views/metager3resultsatom10.blade.php | 21 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 resources/views/layouts/atom10-ad.blade.php diff --git a/resources/views/layouts/atom10-ad.blade.php b/resources/views/layouts/atom10-ad.blade.php new file mode 100644 index 00000000..3ccbaf82 --- /dev/null +++ b/resources/views/layouts/atom10-ad.blade.php @@ -0,0 +1,8 @@ +@if(isset($ad) && !$apiAuthorized) + + {!! trans('ad.von') !!} {!! $ad->gefVon !!} + {{ $ad->titel }} + {{ $ad->anzeigeLink }} + + +@endif \ No newline at end of file diff --git a/resources/views/metager3resultsatom10.blade.php b/resources/views/metager3resultsatom10.blade.php index 55468b92..42ad1cd8 100644 --- a/resources/views/metager3resultsatom10.blade.php +++ b/resources/views/metager3resultsatom10.blade.php @@ -1,15 +1,31 @@ + xmlns:mg="http://metager.de/opensearch/" + xmlns:advertisement="http://a9.com/-/opensearch/extensions/advertisement/1.0/"> {!! htmlspecialchars($eingabe, ENT_XML1, 'UTF-8'); !!} - MetaGer {{ date('c') }} {{ $resultcount }} - + urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240 + @include('layouts.atom10-ad', ['ad' => $metager->popAd()]) @foreach($metager->getResults() as $result) + @if($result->number % 7 === 0) + + [Ad] + 20% Off Coffee + Walk in and show us this ad on your phone + example.com/coffee + + + Click for Cafes Near You + + + 1234567890 + + @endif {!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!} @@ -19,6 +35,7 @@ @endforeach + -- GitLab From a995f7a9b943e18029f8c1fa72ae5899581b13e1 Mon Sep 17 00:00:00 2001 From: Aria Date: Tue, 12 Sep 2017 11:19:42 +0200 Subject: [PATCH 02/36] =?UTF-8?q?Kleinigkeit=20=C3=BCbersehen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/metager3resultsatom10.blade.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/resources/views/metager3resultsatom10.blade.php b/resources/views/metager3resultsatom10.blade.php index 42ad1cd8..050ce4a7 100644 --- a/resources/views/metager3resultsatom10.blade.php +++ b/resources/views/metager3resultsatom10.blade.php @@ -12,19 +12,8 @@ urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240 @include('layouts.atom10-ad', ['ad' => $metager->popAd()]) @foreach($metager->getResults() as $result) - @if($result->number % 7 === 0) - - [Ad] - 20% Off Coffee - Walk in and show us this ad on your phone - example.com/coffee - - - Click for Cafes Near You - - - 1234567890 - + @if($result->number % 5 === 0) + @include('layouts.atom10-ad', ['ad' => $metager->popAd()]) @endif {!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!} -- GitLab From 4a7772c890e7ee1e3632c3308ad2aa75d6c5c72c Mon Sep 17 00:00:00 2001 From: Aria Date: Tue, 12 Sep 2017 11:21:22 +0200 Subject: [PATCH 03/36] Kommentar und whitespace entfernt --- resources/views/metager3resultsatom10.blade.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/resources/views/metager3resultsatom10.blade.php b/resources/views/metager3resultsatom10.blade.php index 050ce4a7..5e5beab5 100644 --- a/resources/views/metager3resultsatom10.blade.php +++ b/resources/views/metager3resultsatom10.blade.php @@ -24,7 +24,4 @@ @endforeach - - - - + \ No newline at end of file -- GitLab From d4807acbbb283a72c21afc0c5609f5a78262852b Mon Sep 17 00:00:00 2001 From: Aria Date: Tue, 12 Sep 2017 11:25:36 +0200 Subject: [PATCH 04/36] Update --- ...atom10-ad.blade.php => atom10ad.blade.php} | 0 .../views/metager3resultsatom10.blade.php | 28 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) rename resources/views/layouts/{atom10-ad.blade.php => atom10ad.blade.php} (100%) diff --git a/resources/views/layouts/atom10-ad.blade.php b/resources/views/layouts/atom10ad.blade.php similarity index 100% rename from resources/views/layouts/atom10-ad.blade.php rename to resources/views/layouts/atom10ad.blade.php diff --git a/resources/views/metager3resultsatom10.blade.php b/resources/views/metager3resultsatom10.blade.php index 5e5beab5..d832f64c 100644 --- a/resources/views/metager3resultsatom10.blade.php +++ b/resources/views/metager3resultsatom10.blade.php @@ -10,18 +10,18 @@ urn:uuid:1d634a8c-2764-424f-b082-6c96494b7240 - @include('layouts.atom10-ad', ['ad' => $metager->popAd()]) - @foreach($metager->getResults() as $result) - @if($result->number % 5 === 0) - @include('layouts.atom10-ad', ['ad' => $metager->popAd()]) - @endif - - {!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!} - - {!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!} - - {!! htmlspecialchars($result->longDescr, ENT_XML1, 'UTF-8'); !!} - - - @endforeach + @include('layouts.atom10ad', ['ad' => $metager->popAd()]) + @foreach($metager->getResults() as $result) + @if($result->number % 5 === 0) + @include('layouts.atom10ad', ['ad' => $metager->popAd()]) + @endif + + {!! htmlspecialchars($result->titel, ENT_XML1, 'UTF-8'); !!} + + {!! htmlspecialchars($result->anzeigeLink, ENT_XML1, 'UTF-8'); !!} + + {!! htmlspecialchars($result->longDescr, ENT_XML1, 'UTF-8'); !!} + + + @endforeach \ No newline at end of file -- GitLab From 66b69ac4612e83375931c2f412893c48acc4b22d Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 13 Sep 2017 10:54:04 +0200 Subject: [PATCH 05/36] WIP routing for quicktip requests --- app/Http/Controllers/MetaGerSearch.php | 216 ---------------------- gulpfile.js | 3 +- resources/assets/js/scriptResultPage.js | 26 +++ resources/views/layouts/utility.blade.php | 2 +- resources/views/metager3.blade.php | 4 +- resources/views/quicktips.blade.php | 11 ++ routes/api.php | 6 + 7 files changed, 46 insertions(+), 222 deletions(-) create mode 100644 resources/views/quicktips.blade.php diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index fa10a798..df3a682e 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -51,222 +51,6 @@ class MetaGerSearch extends Controller ->with('r', $redirect); } - public function quicktips(Request $request, MetaGer $metager) - { - $q = $request->input('q', ''); - $mquicktips = []; - $quicktips = []; - $spruch = ""; - - # DuckDuckGo-!bangs - try { - $placeholder = "0X0plchldr0X0"; - $searchWords = explode(" ", $q); - $dummyQuery = ""; - $realQuery = ""; - foreach ($searchWords as $index => $word) { - if ($word[0] === "!") { - $dummyQuery .= $word . " "; - } else { - $realQuery .= $word . " "; - } - } - $realQuery = rtrim($realQuery); - - if ($dummyQuery !== "") { - $dummyQuery .= $placeholder; - $url = "https://api.duckduckgo.com/?format=json&no_redirect=1&t=MetaGerDE&q=" . urlencode($dummyQuery); - - $result = json_decode($this->get($url), true); - - if (isset($result["Redirect"])) { - $bang = []; - $bang["title"] = trans('metaGerSearch.quicktips.bang.title'); - $bang["URL"] = str_replace($placeholder, urlencode(trim($realQuery)), $result["Redirect"]); - $bang["summary"] = '' . trans('metaGerSearch.quicktips.bang.buttonlabel') . " " . parse_url($bang["URL"], PHP_URL_HOST) . '…'; - $bang["gefVon"] = trans('metaGerSearch.quicktips.bang.from') . " DuckDuckGo"; - $mquicktips[] = $bang; - } - - } - } catch (\ErrorException $e) { - } - - if (APP::getLocale() === "de") { - # Spruch - $spruecheFile = storage_path() . "/app/public/sprueche.txt"; - if (file_exists($spruecheFile) && $request->has('sprueche')) { - $sprueche = file($spruecheFile); - $spruch = $sprueche[array_rand($sprueche)]; - } else { - $spruch = ""; - } - - # manuelle Quicktips: - $file = storage_path() . "/app/public/qtdata.csv"; - - if (file_exists($file) && $q !== '') { - $file = fopen($file, 'r'); - while (($line = fgetcsv($file)) !== false) { - $words = array_slice($line, 3); - $isIn = false; - foreach ($words as $word) { - $word = strtolower($word); - if (strpos($q, $word) !== false) { - $isIn = true; - break; - } - } - if ($isIn === true) { - $quicktip = array('QT_Type' => "MQT"); - $quicktip["URL"] = $line[0]; - $quicktip["title"] = $line[1]; - $quicktip["summary"] = $line[2]; - $mquicktips[] = $quicktip; - } - } - fclose($file); - } - - # Wetter - /* Derzeit Deaktiviert, da bei unseren Abfragezahlen nicht kostenlos */ - /* - try { - $url = "http://api.openweathermap.org/data/2.5/weather?type=accurate&units=metric&lang=" . APP::getLocale() . "&q=" . urlencode($q) . "&APPID=" . getenv("openweathermap"); - - $result = json_decode($this->get($url), true); - - $searchWords = explode(' ', $q); - $within = false; - foreach ($searchWords as $word) { - if (stripos($result["name"], $word) !== false) { - $within = true; - } - } - if ($within) { - $weather = []; - $weather["title"] = "Wetter in " . $result["name"]; - $weather["URL"] = "http://openweathermap.org/city/" . $result["id"]; - - $summary = '' . $result["main"]["temp"] . " °C, " . $result["weather"][0]["description"] . ""; - $details = '"; - $details .= ""; - $details .= ""; - $details .= ""; - $details .= ""; - if (isset($result->rain)) { - $details .= " | Regen letzte drei Stunden: " . $result["rain"]["3h"] . " h"; - } - $details .= "
Temperatur' . $result["main"]["temp_min"] . " bis " . $result["main"]["temp_max"] . " °C
Druck" . $result["main"]["pressure"] . " hPa
Luftfeuchtigkeit" . $result["main"]["humidity"] . " %
Wind" . $result["wind"]["speed"] . " m/s, " . $result["wind"]["deg"] . "°
Bewölkung" . $result["clouds"]["all"] . " %
"; - $weather["summary"] = $summary; - $weather["details"] = $details; - $weather["gefVon"] = "von Openweathermap"; - $requestData = []; - $requestData["url"] = "http://openweathermap.org/img/w/"; - $weather["image"] = action('Pictureproxy@get', $requestData) . $result["weather"][0]["icon"] . ".png"; - $weather["image-alt"] = $result["weather"][0]["main"]; - $mquicktips[] = $weather; - } - } catch (\ErrorException $e) { - - } - */ - } - - # Wikipedia Quicktip - $url = "https://" . APP::getLocale() . ".wikipedia.org/w/api.php?action=opensearch&search=" . urlencode($q) . "&limit=10&namespace=0&format=json&redirects=resolve"; - try{ - $content = $this->get($url); - }catch(\ErrorException $e){ - $content = ""; - } - $decodedResponse = json_decode($content, true); - if (isset($decodedResponse[1][0]) && isset($decodedResponse[2][0]) && isset($decodedResponse[3][0])) { - $quicktip = []; - $firstSummary = $decodedResponse[2][0]; - // Wenn es mehr als ein Ergebnis gibt - if (isset($decodedResponse[1][1])) { - // Solange noch zusätzliche Seiten vorhanden sind, füge sie der Tabelle hinzu - $details = ''; - for ($i = 1;isset($decodedResponse[1][$i]) && isset($decodedResponse[2][$i]) && isset($decodedResponse[3][$i]); $i++) { - $details .= ''; - } - $details .= '
' . $decodedResponse[1][$i] . '
'; - $quicktip["title"] = $decodedResponse[1][0]; - $quicktip["URL"] = $decodedResponse[3][0]; - $quicktip["summary"] = $decodedResponse[2][0]; - $quicktip["details"] = $details; - $quicktip['gefVon'] = trans('metaGerSearch.quicktips.wikipedia.adress'); - } else { - $quicktip["title"] = $decodedResponse[1][0]; - $quicktip["URL"] = $decodedResponse[3][0]; - $quicktip["summary"] = $decodedResponse[2][0]; - $quicktip['gefVon'] = trans('metaGerSearch.quicktips.wikipedia.adress'); - } - $quicktips[] = $quicktip; - } - $mquicktips = array_merge($mquicktips, $quicktips); - - if (APP::getLocale() === "de") { - # Dict.cc Quicktip - if (count(explode(' ', $q)) < 3) { - $url = "http://www.dict.cc/metager.php?s=" . urlencode($q); - $decodedResponse = json_decode($this->get($url), true); - if ($decodedResponse["headline"] != "" && $decodedResponse["link"] != "") { - $quicktip = []; - $quicktip["title"] = $decodedResponse["headline"]; - $quicktip["URL"] = $decodedResponse["link"]; - $quicktip["summary"] = implode(", ", $decodedResponse["translations"]); - $quicktip['gefVon'] = trans('metaGerSearch.quicktips.dictcc.adress'); - - if (App::isLocale('de')) { - array_unshift($mquicktips, $quicktip); - } else { - $mquicktips[] = $quicktip; - } - } - } - - # wussten Sie schon - $file = storage_path() . "/app/public/tips.txt"; - if (file_exists($file)) { - $tips = file($file); - $tip = $tips[array_rand($tips)]; - - $mquicktips[] = ['title' => trans('metaGerSearch.quicktips.tips.title'), 'summary' => $tip, 'URL' => '/tips']; - } - - # Werbelinks - $file = storage_path() . "/app/public/ads.txt"; - if (file_exists($file)) { - $ads = json_decode(file_get_contents($file), true); - $ad = $ads[array_rand($ads)]; - if (isset($ads['details'])) { - $mquicktips[] = ['title' => $ad['title'], 'summary' => $ad['summary'], 'details' => $ad['details'], 'URL' => $ad['URL']]; - } else { - $mquicktips[] = ['title' => $ad['title'], 'summary' => $ad['summary'], 'URL' => $ad['URL']]; - } - } - } - - return view('quicktip') - ->with('spruch', $spruch) - ->with('mqs', $mquicktips); - - } - - public function tips() - { - $file = storage_path() . "/app/public/tips.txt"; - $tips = []; - if (file_exists($file)) { - $tips = file($file); - } - return view('tips') - ->with('title', 'MetaGer - Tipps & Tricks') - ->with('tips', $tips); - } - public function get($url) { $ctx = stream_context_create(array('http'=>array('timeout' => 2,))); diff --git a/gulpfile.js b/gulpfile.js index 5e95aaae..b3862103 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -23,7 +23,6 @@ elixir(function (mix) { | settings.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/iframeResizer.contentWindow.min.js'], 'public/js/quicktips.js') mix.scripts(['scriptStartPage.js', 'results.js'], 'public/js/scriptStartPage.js'); mix.scripts(['scriptResultPage.js', 'results.js'], 'public/js/scriptResultPage.js'); //mix.scripts(['scriptSubpages.js'], 'public/js/scriptSubpages.js'); @@ -31,6 +30,6 @@ elixir(function (mix) { // utility mix.scripts(['utility.js'], 'public/js/utility.js'); mix.less('utility.less', 'public/css/utility.css'); - mix.version(['css/themes/default.css', 'js/lib.js', 'js/quicktips.js', 'js/utility.js', 'css/utility.css', 'js/widgets.js', 'js/editLanguage.js', 'js/kontakt.js', 'js/scriptResultPage.js', 'js/scriptStartPage.js', 'js/settings.js', 'css/beitritt.css']); + mix.version(['css/themes/default.css', 'js/lib.js', 'js/utility.js', 'css/utility.css', 'js/widgets.js', 'js/editLanguage.js', 'js/kontakt.js', 'js/scriptResultPage.js', 'js/scriptStartPage.js', 'js/settings.js', 'css/beitritt.css']); }) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index b5e90c7f..38c7b0bc 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -9,6 +9,8 @@ $(document).ready(function () { if (document.location.href.indexOf('focus=container') !== -1) { $($('#foki > li#savedFokiTabSelector').get(0)).find('>a').tab('show'); } + + loadQuicktips(); }); function activateJSOnlyContent () { @@ -533,3 +535,27 @@ function resultSaver (index) { $('div.tab-pane.active .result[data-count=' + index + ']').transfer({to: to, duration: 1000}); new Results().updateResultPageInterface(); } + +function loadQuicktips () { + /* + {{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/qt") }} + ?q={{ $metager->getQ() }} + &sprueche={{ $metager->getSprueche() }} + &lang={{ Request::input('lang', 'all') }} + &unfilteredLink={{ base64_encode($metager->getUnfilteredLink()) }} + */ + + var mainDiv = $('#quicktips'); + mainDiv.attr('status', 'loading'); + mainDiv.append('

Hello World

'); + + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + mainDiv.append(this.responseXML); + console.log(this); + } + }; + xhttp.open("GET", "/quicktips.xml?search=test" /*TODO change*/, true); + xhttp.send(); +} diff --git a/resources/views/layouts/utility.blade.php b/resources/views/layouts/utility.blade.php index 17817e3a..749f7433 100644 --- a/resources/views/layouts/utility.blade.php +++ b/resources/views/layouts/utility.blade.php @@ -1,4 +1,4 @@ {{-- Verwendung: @include('layouts.utility') --}} - + diff --git a/resources/views/metager3.blade.php b/resources/views/metager3.blade.php index cd41558e..73fb5079 100644 --- a/resources/views/metager3.blade.php +++ b/resources/views/metager3.blade.php @@ -56,8 +56,6 @@ @if( $metager->showQuicktips() ) - + @endif @endsection diff --git a/resources/views/quicktips.blade.php b/resources/views/quicktips.blade.php new file mode 100644 index 00000000..6ce6562c --- /dev/null +++ b/resources/views/quicktips.blade.php @@ -0,0 +1,11 @@ + + MetaGer quicktip search: @yield{'search'} + + @yield{'time'} + {{ $quicktips->amount }} + @foreach ($quicktips as $quicktip) + + $quicktip + + @endforeach + diff --git a/routes/api.php b/routes/api.php index 6b907f39..a430b520 100644 --- a/routes/api.php +++ b/routes/api.php @@ -16,3 +16,9 @@ use Illuminate\Http\Request; Route::get('/user', function (Request $request) { return $request->user(); })->middleware('auth:api'); + +Route::get('/quicktips', function (Request $request) { + return view('quicktips') + ->with('search', 'TODO') + ->with('time', 'TODO'); +})->middleware('auth:api'); -- GitLab From 60dfc2fabe81056623adc8807aa453993411ff30 Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 13 Sep 2017 13:57:38 +0200 Subject: [PATCH 06/36] Quicktips are now loaded from local quicktip server and created --- resources/assets/js/scriptResultPage.js | 68 ++++++++++++++++++----- resources/views/metager3results.blade.php | 4 +- resources/views/quicktips.blade.php | 11 ---- routes/api.php | 6 -- 4 files changed, 55 insertions(+), 34 deletions(-) delete mode 100644 resources/views/quicktips.blade.php diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 38c7b0bc..6dc517b2 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -9,8 +9,8 @@ $(document).ready(function () { if (document.location.href.indexOf('focus=container') !== -1) { $($('#foki > li#savedFokiTabSelector').get(0)).find('>a').tab('show'); } - - loadQuicktips(); + + loadQuicktips('test', 'de', true); // TODO }); function activateJSOnlyContent () { @@ -536,7 +536,11 @@ function resultSaver (index) { new Results().updateResultPageInterface(); } -function loadQuicktips () { +function loadQuicktips (search, locale, sprueche) { + getQuicktips(search, locale, sprueche, createQuicktips); +} + +function getQuicktips (search, locale, sprueche, loadedHandler) { /* {{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/qt") }} ?q={{ $metager->getQ() }} @@ -545,17 +549,53 @@ function loadQuicktips () { &unfilteredLink={{ base64_encode($metager->getUnfilteredLink()) }} */ - var mainDiv = $('#quicktips'); - mainDiv.attr('status', 'loading'); - mainDiv.append('

Hello World

'); + $.get('http://localhost:8080/quicktips.xml?search=' + search + '&locale=' + locale, function (data, status) { + if (status === 'success') { + var quicktips = $(data).find('entry').map(function () { + return quicktip = { + type: $(this).children('type').text(), + title: $(this).children('title').text(), + summary: $(this).children('summary').text(), + details: $(this).children('details').map(function () { + return { + title: $(this).children('title').text(), + text: $(this).children('text').text(), + url: $(this).children('url').text() + } + }).toArray(), + url: $(this).children('url').text(), + gefVon: $(this).children('gefVon').text() + }; + }).toArray(); + loadedHandler(quicktips); + } else { + console.error('Loading quicktips failed with status ' + status); + } + }, 'xml'); +} - var xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - mainDiv.append(this.responseXML); - console.log(this); +function createQuicktips (quicktips) { + var quicktipsDiv = $('#quicktips'); + quicktips.forEach(function (quicktip) { + var detailsElem; + if (quicktip.details.length > 0) { + detailsElem = $('

' + quicktip.title + '

'); + quicktip.details.forEach(function (detail) { + var detailDiv = $('
'); + detailDiv + .append('

' + detail.title + '

') + .append('

' + detail.text + '

'); + // .append('TODO') + detailsElem.append(detailDiv); + }); + } else { + detailsElem = $('

' + quicktip.title + '

'); } - }; - xhttp.open("GET", "/quicktips.xml?search=test" /*TODO change*/, true); - xhttp.send(); + var quicktipDiv = $('
'); + quicktipDiv + .append(detailsElem) + // .append('TODO') + .append('' + quicktip.gefVon + ''); + quicktipsDiv.append(quicktipDiv); + }); } diff --git a/resources/views/metager3results.blade.php b/resources/views/metager3results.blade.php index a1f66a4e..f0e66ecd 100644 --- a/resources/views/metager3results.blade.php +++ b/resources/views/metager3results.blade.php @@ -48,8 +48,6 @@
@if( $metager->showQuicktips() ) - + @endif
diff --git a/resources/views/quicktips.blade.php b/resources/views/quicktips.blade.php deleted file mode 100644 index 6ce6562c..00000000 --- a/resources/views/quicktips.blade.php +++ /dev/null @@ -1,11 +0,0 @@ - - MetaGer quicktip search: @yield{'search'} - - @yield{'time'} - {{ $quicktips->amount }} - @foreach ($quicktips as $quicktip) - - $quicktip - - @endforeach - diff --git a/routes/api.php b/routes/api.php index a430b520..6b907f39 100644 --- a/routes/api.php +++ b/routes/api.php @@ -16,9 +16,3 @@ use Illuminate\Http\Request; Route::get('/user', function (Request $request) { return $request->user(); })->middleware('auth:api'); - -Route::get('/quicktips', function (Request $request) { - return view('quicktips') - ->with('search', 'TODO') - ->with('time', 'TODO'); -})->middleware('auth:api'); -- GitLab From 207dfd99731094074afe926a02de367b01a53f7d Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Tue, 19 Sep 2017 11:50:07 +0200 Subject: [PATCH 07/36] Quicktips werden jetzt komplett vom Server abgefragt und korrekt angezeigt --- resources/assets/js/scriptResultPage.js | 72 ++++++++++++--- .../assets/less/metager/result-page.less | 92 ++++++++++++++++++- .../assets/less/metager/static-pages.less | 18 ---- 3 files changed, 148 insertions(+), 34 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 6dc517b2..be13d900 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -564,7 +564,8 @@ function getQuicktips (search, locale, sprueche, loadedHandler) { } }).toArray(), url: $(this).children('url').text(), - gefVon: $(this).children('gefVon').text() + gefVon: $(this).children('gefVon').text(), + priority: $(this).children('priority').text() }; }).toArray(); loadedHandler(quicktips); @@ -574,28 +575,71 @@ function getQuicktips (search, locale, sprueche, loadedHandler) { }, 'xml'); } +/** + *
+ *
+ *
+ * + *

TITLE + *

SUMMARY + *

+ *

DETAILTITLE + *

DETAILSUMMARY + * GEFVON + * + * + * + * @param {*} quicktips + */ function createQuicktips (quicktips) { + console.log(quicktips); var quicktipsDiv = $('#quicktips'); - quicktips.forEach(function (quicktip) { - var detailsElem; + quicktips.sort(function (a, b) { + return b.priority - a.priority; + }).forEach(function (quicktip) { + var mainElem; if (quicktip.details.length > 0) { - detailsElem = $('

' + quicktip.title + '

'); + mainElem = $('
'); + var summaryElem = $(''); + var headlineElem = $('

'); + if (quicktip.url.length > 0) { + headlineElem.append('' + quicktip.title + ''); + } else { + headlineElem.text(quicktip.title); + } + summaryElem + .append(headlineElem) + .append('

' + quicktip.summary + '

'); + mainElem.append(summaryElem); quicktip.details.forEach(function (detail) { - var detailDiv = $('
'); - detailDiv - .append('

' + detail.title + '

') + var detailElem = $('
'); + var detailHeadlineElem = $('

'); + if (detail.url.length > 0) { + detailHeadlineElem.append('' + detail.title + ''); + } else { + detailHeadlineElem.text(detail.title); + } + detailElem + .append(detailHeadlineElem) .append('

' + detail.text + '

'); - // .append('TODO') - detailsElem.append(detailDiv); + mainElem.append(detailElem); }); } else { - detailsElem = $('

' + quicktip.title + '

'); + mainElem = $('
'); + var headlineElem = $('

'); + if (quicktip.url.length > 0) { + headlineElem.append('' + quicktip.title + ''); + } else { + headlineElem.text(quicktip.title); + } + mainElem + .append(headlineElem) + .append('

' + quicktip.summary + '

'); } - var quicktipDiv = $('
'); + var quicktipDiv = $('
'); quicktipDiv - .append(detailsElem) - // .append('TODO') - .append('' + quicktip.gefVon + ''); + .append(mainElem) + .append('' + quicktip.gefVon + ''); quicktipsDiv.append(quicktipDiv); }); } diff --git a/resources/assets/less/metager/result-page.less b/resources/assets/less/metager/result-page.less index 1c6e9478..ee7e5bb6 100644 --- a/resources/assets/less/metager/result-page.less +++ b/resources/assets/less/metager/result-page.less @@ -130,7 +130,7 @@ footer { } } -.fa.fa-twitter{ +.fa.fa-twitter { color: #6faedc } @@ -425,7 +425,10 @@ a { li:not(.option-title):hover { background-color: #e0e0e0; } - a, a:hover, a:focus, a:visited { + a, + a:hover, + a:focus, + a:visited { color: black; display: block; } @@ -620,4 +623,89 @@ a { padding-left: 0; padding-right: 0; } +} + + +/* + *
+ *
+ *
+ * + *

TITLE + *

SUMMARY + *

+ *

DETAILTITLE + *

DETAILSUMMARY + * GEFVON + * + */ + +#quicktips { + display: flex; + flex-direction: column; + // border: 2px solid #ccc; + .quicktip { + margin: 10px 0px; + padding-left: 10px; + border-left: 3px solid #fb0; + .quicktip-summary { + h1 { + font-size: 16px; + font-weight: bold; + } + p {} + } + .quicktip-detail { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + h2 { + margin: 10px 0px; + font-size: 14px; + font-weight: bold; + } + p { + display: none; + font-size: 12px; + } + } + .gefVon { + font-size: 14px; + } + &[type=spruch] { + border-left: 3px solid #070; + p { + color: #070; + .author { + color: #404040; + font-style: italic; + } + } + } + &[type=spendenaufruf] { + border-left: #ddd; + color: #ff8000; + .quicktip-summary { + display: flex; + justify-content: space-between; + h1 { + margin-right: 15px; + } + p { + margin: 5px; + .spendenaufruf-btn { + color: white; + background-color: #ff8000; + font-size: 16px; + } + } + } + } + &[type=dictCC] { + .quicktip-summary { + p { + font-weight: bold; + } + } + } + } } \ No newline at end of file diff --git a/resources/assets/less/metager/static-pages.less b/resources/assets/less/metager/static-pages.less index c91ba95e..0ef22cdf 100644 --- a/resources/assets/less/metager/static-pages.less +++ b/resources/assets/less/metager/static-pages.less @@ -425,24 +425,6 @@ textarea#message { margin-bottom: 5px; } -.quicktip { - margin-bottom: 15px; - padding: 10px; - line-height: 1.2 !important; - font-family: Georgia, "Times New Roman", Palatino, Times, serif; - color: @quicktip-color; - border-left: 3px solid @quicktip-border-left-color; - font-size: 14px; - h1 { - font-size: 22px; - margin-top: 0px; - } - &.aufruf { - color: @quicktip-aufruf-color; - border-left: 3px solid @quicktip-aufruf-border-left-color; - } -} - .wikiqtextract { font-family: Georgia, "Times New Roman", Palatino, Times, serif; } -- GitLab From fb13cbae174a715be65bf9ee3c08cb4385c616ce Mon Sep 17 00:00:00 2001 From: Carsten Riel Date: Wed, 20 Sep 2017 11:01:16 +0200 Subject: [PATCH 08/36] Update languages.php --- resources/lang/en/languages.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/lang/en/languages.php b/resources/lang/en/languages.php index b1bee6bc..583d8564 100644 --- a/resources/lang/en/languages.php +++ b/resources/lang/en/languages.php @@ -8,5 +8,8 @@ return [ "hinweis.1" => "Please click \"Submit data\" when finished. You don't have to translate all items.", "hinweis.2" => "Hint: You won't see your translations until we checked and inserted it. Save your work by setting a bookmark.", "hinweis.3" => "Note: We publish the hole content of your work on aPublication. This is subject to a AGPL-v3-License. You agree with clicking the \"Submit data\" button.", - "email" => "Email address for possible inquiries (optional):" + "email" => "Email address for possible inquiries (optional):", + "synoptic" => [ + "hinweis" => "Last modified:" + ] ]; \ No newline at end of file -- GitLab From 241178e8c781334c928d093d17dd2ac8aabbb5d3 Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Tue, 26 Sep 2017 10:10:51 +0200 Subject: [PATCH 09/36] Made sprueche quicktip optional Added quicktip blacklist --- resources/assets/js/scriptResultPage.js | 72 ++++++++++++++++--------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index be13d900..0209e4d6 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -10,9 +10,17 @@ $(document).ready(function () { $($('#foki > li#savedFokiTabSelector').get(0)).find('>a').tab('show'); } - loadQuicktips('test', 'de', true); // TODO + var sprueche = getURLParameter('sprueche') === 'on'; // load the sprueche url parameter + if (localStorage.hasOwnProperty('param_sprueche')) { + sprueche = localStorage.getItem('param_sprueche') === 'on'; // check for sprueche local storage parameter + } + loadQuicktips('test', 'de', sprueche); // load the quicktips }); +function getURLParameter(name) { + return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null; +} + function activateJSOnlyContent () { $('#searchplugin').removeClass('hide'); $('.js-only').removeClass('js-only'); @@ -537,35 +545,45 @@ function resultSaver (index) { } function loadQuicktips (search, locale, sprueche) { - getQuicktips(search, locale, sprueche, createQuicktips); + var blacklist = []; + if (!sprueche) { + blacklist.push('sprueche'); + } + getQuicktips(search, locale, blacklist, createQuicktips); } -function getQuicktips (search, locale, sprueche, loadedHandler) { - /* - {{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/qt") }} - ?q={{ $metager->getQ() }} - &sprueche={{ $metager->getSprueche() }} - &lang={{ Request::input('lang', 'all') }} - &unfilteredLink={{ base64_encode($metager->getUnfilteredLink()) }} - */ +const QUICKTIP_SERVER = 'http://localhost:63825'; - $.get('http://localhost:8080/quicktips.xml?search=' + search + '&locale=' + locale, function (data, status) { +/** + * Requests quicktips from the quicktip server and passes them to the loadedHandler + * + * @param {String} search search term + * @param {String} locale 2 letter locale identifier + * @param {Array} blacklist excluded loaders + * @param {Function} loadedHandler handler for loaded quicktips + */ +function getQuicktips (search, locale, blacklist, loadedHandler) { + var getString = QUICKTIP_SERVER + '/quicktips.xml?search=' + search + '&locale=' + locale; + blacklist.forEach(function (value) { + getString += '&loader_' + value + '=false'; + }); + $.get(getString, function (data, status) { if (status === 'success') { var quicktips = $(data).find('entry').map(function () { return quicktip = { type: $(this).children('type').text(), title: $(this).children('title').text(), summary: $(this).children('summary').text(), + url: $(this).children('url').text(), + gefVon: $(this).children('gefVon').text(), + priority: $(this).children('priority').text(), details: $(this).children('details').map(function () { return { title: $(this).children('title').text(), text: $(this).children('text').text(), url: $(this).children('url').text() } - }).toArray(), - url: $(this).children('url').text(), - gefVon: $(this).children('gefVon').text(), - priority: $(this).children('priority').text() + }).toArray() }; }).toArray(); loadedHandler(quicktips); @@ -580,19 +598,25 @@ function getQuicktips (search, locale, sprueche, loadedHandler) { *

+ *

* - * @param {*} quicktips + * @param {Object} quicktips */ -function createQuicktips (quicktips) { - console.log(quicktips); +function createQuicktips (quicktips, sprueche) { var quicktipsDiv = $('#quicktips'); quicktips.sort(function (a, b) { return b.priority - a.priority; -- GitLab From a06fb014f15b23a5a88be8f62accd0b8e2664fc3 Mon Sep 17 00:00:00 2001 From: Dominik Pfennig Date: Tue, 26 Sep 2017 10:27:16 +0200 Subject: [PATCH 10/36] Server Adresse korrigiert --- resources/assets/js/scriptResultPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 0209e4d6..9d3b1eff 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -552,7 +552,7 @@ function loadQuicktips (search, locale, sprueche) { getQuicktips(search, locale, blacklist, createQuicktips); } -const QUICKTIP_SERVER = 'http://localhost:63825'; +const QUICKTIP_SERVER = 'https://quicktips.metager3.de'; /** * Requests quicktips from the quicktip server and passes them to the loadedHandler -- GitLab From 09f37c7bc81881efc8a621473a3e6108678b633f Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Tue, 26 Sep 2017 13:19:02 +0200 Subject: [PATCH 11/36] Fixed layout of donation quicktip Fixed passing of locale parameter --- resources/assets/js/scriptResultPage.js | 9 +++++++-- resources/assets/less/metager/result-page.less | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 0209e4d6..e06c0309 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -14,9 +14,14 @@ $(document).ready(function () { if (localStorage.hasOwnProperty('param_sprueche')) { sprueche = localStorage.getItem('param_sprueche') === 'on'; // check for sprueche local storage parameter } - loadQuicktips('test', 'de', sprueche); // load the quicktips + var locale = readLocaleFromUrl('de'); + loadQuicktips('test', locale, sprueche); // load the quicktips }); +function readLocaleFromUrl(defaultLocale) { + return location.pathname.substr(1, location.pathname.indexOf('/meta', 0) - 1) || 'de'; +} + function getURLParameter(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null; } @@ -552,7 +557,7 @@ function loadQuicktips (search, locale, sprueche) { getQuicktips(search, locale, blacklist, createQuicktips); } -const QUICKTIP_SERVER = 'http://localhost:63825'; +const QUICKTIP_SERVER = 'http://quicktips.metager3.de:63825'; /** * Requests quicktips from the quicktip server and passes them to the loadedHandler diff --git a/resources/assets/less/metager/result-page.less b/resources/assets/less/metager/result-page.less index ee7e5bb6..7fbd4eef 100644 --- a/resources/assets/less/metager/result-page.less +++ b/resources/assets/less/metager/result-page.less @@ -687,8 +687,9 @@ a { .quicktip-summary { display: flex; justify-content: space-between; + align-items: center; h1 { - margin-right: 15px; + margin: 0px; } p { margin: 5px; -- GitLab From c274adedee678ae3c4d07bc4ebf403ab0534175d Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Tue, 26 Sep 2017 13:23:26 +0200 Subject: [PATCH 12/36] Fixed usage of search word --- resources/assets/js/scriptResultPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 97eea30b..0dde3efc 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -14,8 +14,9 @@ $(document).ready(function () { if (localStorage.hasOwnProperty('param_sprueche')) { sprueche = localStorage.getItem('param_sprueche') === 'on'; // check for sprueche local storage parameter } + var search = getUrlParameter('eingabe'); var locale = readLocaleFromUrl('de'); - loadQuicktips('test', locale, sprueche); // load the quicktips + loadQuicktips(search, locale, sprueche); // load the quicktips }); function readLocaleFromUrl(defaultLocale) { -- GitLab From 6f3459e04fa0939bf2cbcd39117346d09e4593d4 Mon Sep 17 00:00:00 2001 From: Dominik Pfennig Date: Tue, 26 Sep 2017 13:29:57 +0200 Subject: [PATCH 13/36] Bugfix --- resources/assets/js/scriptResultPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 0dde3efc..8a85380f 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -14,7 +14,7 @@ $(document).ready(function () { if (localStorage.hasOwnProperty('param_sprueche')) { sprueche = localStorage.getItem('param_sprueche') === 'on'; // check for sprueche local storage parameter } - var search = getUrlParameter('eingabe'); + var search = getURLParameter('eingabe'); var locale = readLocaleFromUrl('de'); loadQuicktips(search, locale, sprueche); // load the quicktips }); -- GitLab From 7b4c0c7ed5028ec5adfcba8cc64c83c2c35b4ff1 Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 27 Sep 2017 09:00:42 +0200 Subject: [PATCH 14/36] Suchwort und Sprache werden jetzt aus den Meta Tags ausgelesen und funktionieren so auch mit Post --- resources/assets/js/scriptResultPage.js | 15 +++++++++++---- resources/views/layouts/resultPage.blade.php | 5 +++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 8a85380f..5a01018a 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -10,23 +10,30 @@ $(document).ready(function () { $($('#foki > li#savedFokiTabSelector').get(0)).find('>a').tab('show'); } - var sprueche = getURLParameter('sprueche') === 'on'; // load the sprueche url parameter if (localStorage.hasOwnProperty('param_sprueche')) { - sprueche = localStorage.getItem('param_sprueche') === 'on'; // check for sprueche local storage parameter + var sprueche = localStorage.getItem('param_sprueche') === 'on'; // check for sprueche local storage parameter + } else { + var sprueche = getURLParameter('sprueche') === 'on'; // load the sprueche url parameter } - var search = getURLParameter('eingabe'); - var locale = readLocaleFromUrl('de'); + var search = getMetaTag('q'); + var locale = getMetaTag('l'); loadQuicktips(search, locale, sprueche); // load the quicktips }); +/* function readLocaleFromUrl(defaultLocale) { return location.pathname.substr(1, location.pathname.indexOf('/meta', 0) - 1) || 'de'; } +*/ function getURLParameter(name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null; } +function getMetaTag(name) { + return $('meta[name="' + name + '"')[0].content; +} + function activateJSOnlyContent () { $('#searchplugin').removeClass('hide'); $('.js-only').removeClass('js-only'); diff --git a/resources/views/layouts/resultPage.blade.php b/resources/views/layouts/resultPage.blade.php index c2d31c96..ed7d1f81 100644 --- a/resources/views/layouts/resultPage.blade.php +++ b/resources/views/layouts/resultPage.blade.php @@ -5,8 +5,9 @@ - - + + + -- GitLab From c80c97005086fda21d13e796ebdaa0da8b169999 Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 27 Sep 2017 09:54:54 +0200 Subject: [PATCH 15/36] =?UTF-8?q?Die=20Quicktips=20laden=20f=C3=BCr=20null?= =?UTF-8?q?=20werte=20jetzt=20standardwerte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/scriptResultPage.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 5a01018a..83355e35 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -15,23 +15,27 @@ $(document).ready(function () { } else { var sprueche = getURLParameter('sprueche') === 'on'; // load the sprueche url parameter } - var search = getMetaTag('q'); - var locale = getMetaTag('l'); + var search = getMetaTag('q') || ''; + var locale = getMetaTag('l') || 'de'; loadQuicktips(search, locale, sprueche); // load the quicktips }); /* 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; } -function getMetaTag(name) { - return $('meta[name="' + name + '"')[0].content; +function getMetaTag (name) { + if (typeof $('meta[name="' + name + '"')[0] !== 'undefined') { + return $('meta[name="' + name + '"')[0].content || null; + } else { + return null; + } } function activateJSOnlyContent () { @@ -595,7 +599,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { title: $(this).children('title').text(), text: $(this).children('text').text(), url: $(this).children('url').text() - } + }; }).toArray() }; }).toArray(); @@ -659,7 +663,7 @@ function createQuicktips (quicktips, sprueche) { detailElem .append(detailHeadlineElem) .append('

' + detail.text + '

'); - mainElem.append(detailElem); + mainElem.append(detailElem); }); } else { mainElem = $('
'); -- GitLab From 659194946974cf9ffc2bac2d84cc255e59733f12 Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 27 Sep 2017 10:18:02 +0200 Subject: [PATCH 16/36] Texte mit details werden jetzt erst beim ausklappen der details voll angezeigt --- resources/assets/less/metager/result-page.less | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/assets/less/metager/result-page.less b/resources/assets/less/metager/result-page.less index 7fbd4eef..d20107f0 100644 --- a/resources/assets/less/metager/result-page.less +++ b/resources/assets/less/metager/result-page.less @@ -648,12 +648,18 @@ a { margin: 10px 0px; padding-left: 10px; border-left: 3px solid #fb0; + details:not([open=""]) { + .quicktip-summary p { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + } .quicktip-summary { h1 { font-size: 16px; font-weight: bold; } - p {} } .quicktip-detail { border-top: 1px solid #ddd; -- GitLab From 16014207b04b839c56d374fa05b8153e144f67fc Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 27 Sep 2017 11:09:54 +0200 Subject: [PATCH 17/36] Ausklappbare Quicktips sind jetzt mit einem Pfeil gekennzeichnet --- resources/assets/js/scriptResultPage.js | 9 +++---- .../assets/less/metager/result-page.less | 24 ++++++++++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 8a85380f..21ec1eea 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -19,11 +19,11 @@ $(document).ready(function () { 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'; } -function getURLParameter(name) { +function getURLParameter (name) { return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null; } @@ -588,7 +588,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { title: $(this).children('title').text(), text: $(this).children('text').text(), url: $(this).children('url').text() - } + }; }).toArray() }; }).toArray(); @@ -637,6 +637,7 @@ function createQuicktips (quicktips, sprueche) { } else { headlineElem.text(quicktip.title); } + headlineElem.append(''); summaryElem .append(headlineElem) .append('

' + quicktip.summary + '

'); @@ -652,7 +653,7 @@ function createQuicktips (quicktips, sprueche) { detailElem .append(detailHeadlineElem) .append('

' + detail.text + '

'); - mainElem.append(detailElem); + mainElem.append(detailElem); }); } else { mainElem = $('
'); diff --git a/resources/assets/less/metager/result-page.less b/resources/assets/less/metager/result-page.less index 7fbd4eef..968f84f1 100644 --- a/resources/assets/less/metager/result-page.less +++ b/resources/assets/less/metager/result-page.less @@ -640,10 +640,22 @@ a { * */ +@keyframes quicktip-extender-turn { + from { + transform: rotate(0deg); + } + to { + transform: rotate(180deg); + } +} + #quicktips { display: flex; - flex-direction: column; - // border: 2px solid #ccc; + flex-direction: column; // border: 2px solid #ccc; + details[open=""] .quicktip-extender { + animation-name: quicktip-extender-turn; + animation-fill-mode: forwards; + } .quicktip { margin: 10px 0px; padding-left: 10px; @@ -652,8 +664,14 @@ a { h1 { font-size: 16px; font-weight: bold; + display: flex; + justify-content: space-between; + .quicktip-extender { + margin-left: 10px; + color: #777; + font-size: 20px; + } } - p {} } .quicktip-detail { border-top: 1px solid #ddd; -- GitLab From 50f5cb04d06212fd04961fa57ed56869b4f3fe5f Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 4 Oct 2017 10:11:29 +0200 Subject: [PATCH 18/36] Quicktips nutzen jetzt Opensearch relevance extension --- resources/assets/js/scriptResultPage.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 5a01018a..91fa5bb0 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -566,6 +566,7 @@ function loadQuicktips (search, locale, sprueche) { } const QUICKTIP_SERVER = 'https://quicktips.metager3.de'; +//const QUICKTIP_SERVER = 'http://localhost:63825'; /** * Requests quicktips from the quicktip server and passes them to the loadedHandler @@ -589,7 +590,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { summary: $(this).children('summary').text(), url: $(this).children('url').text(), gefVon: $(this).children('gefVon').text(), - priority: $(this).children('priority').text(), + score: $(this).children('relevance\\:score').text(), details: $(this).children('details').map(function () { return { title: $(this).children('title').text(), @@ -632,7 +633,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { function createQuicktips (quicktips, sprueche) { var quicktipsDiv = $('#quicktips'); quicktips.sort(function (a, b) { - return b.priority - a.priority; + return b.score - a.score; }).forEach(function (quicktip) { var mainElem; if (quicktip.details.length > 0) { -- GitLab From a96b8481e2fb6c994561caeb75ea858e55f046ef Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Wed, 4 Oct 2017 11:32:18 +0200 Subject: [PATCH 19/36] Quicktips auf neuste Version umgestellt --- resources/assets/js/scriptResultPage.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/assets/js/scriptResultPage.js b/resources/assets/js/scriptResultPage.js index 91fa5bb0..b3e4db10 100644 --- a/resources/assets/js/scriptResultPage.js +++ b/resources/assets/js/scriptResultPage.js @@ -583,15 +583,16 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { }); $.get(getString, function (data, status) { if (status === 'success') { - var quicktips = $(data).find('entry').map(function () { + var quicktips = $(data).children('feed').children('entry').map(function () { + console.log(this); return quicktip = { - type: $(this).children('type').text(), + type: $(this).children('mg\\:type').text(), title: $(this).children('title').text(), - summary: $(this).children('summary').text(), - url: $(this).children('url').text(), + summary: $(this).children('content').text(), + url: $(this).children('link').text(), gefVon: $(this).children('gefVon').text(), score: $(this).children('relevance\\:score').text(), - details: $(this).children('details').map(function () { + details: $(this).children('mg\\:details').children('entry').map(function () { return { title: $(this).children('title').text(), text: $(this).children('text').text(), @@ -600,6 +601,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) { }).toArray() }; }).toArray(); + console.log(quicktips); loadedHandler(quicktips); } else { console.error('Loading quicktips failed with status ' + status); -- GitLab From 0f85483da241638cc033aa08a4b75e87c6cff979 Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Tue, 10 Oct 2017 08:47:52 +0200 Subject: [PATCH 20/36] Update result-page.less --- resources/assets/less/metager/result-page.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/less/metager/result-page.less b/resources/assets/less/metager/result-page.less index b4d788bd..81580746 100644 --- a/resources/assets/less/metager/result-page.less +++ b/resources/assets/less/metager/result-page.less @@ -651,7 +651,7 @@ a { #quicktips { display: flex; - flex-direction: column; // border: 2px solid #ccc; + flex-direction: column; details[open=""] .quicktip-extender { animation-name: quicktip-extender-turn; animation-fill-mode: forwards; -- GitLab From a8806d9726edb8a19cb1f9ad66facba955ef631c Mon Sep 17 00:00:00 2001 From: Karl Hasselbring Date: Tue, 10 Oct 2017 09:35:18 +0200 Subject: [PATCH 21/36] versteckter lang parameter der startseite wird jetzt durch die locale bestimmt --- app/Http/Controllers/StartpageController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/StartpageController.php b/app/Http/Controllers/StartpageController.php index 51d8dc60..6a6cb1f0 100644 --- a/app/Http/Controllers/StartpageController.php +++ b/app/Http/Controllers/StartpageController.php @@ -6,6 +6,7 @@ use App; use Illuminate\Http\Request; use Jenssegers\Agent\Agent; use Response; +use LaravelLocalization; class StartpageController extends Controller { @@ -15,18 +16,12 @@ class StartpageController extends Controller * @param int $id * @return Response */ - /* public function loadStartPage($locale = "de") - { - \App::setLocale($locale); - return view('index', [ - 'title' => 'MetaGer: Sicher suchen & finden, Privatsphäre schützen', - 'homeIcon']); - } */ public function loadStartPage(Request $request) { $focusPages = []; $theme = "default"; + foreach ($request->all() as $key => $value) { if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_newtab' && $key !== 'param_maps' && $key !== 'param_autocomplete') { $focusPages[] = str_replace('param_', '', $key); @@ -36,6 +31,11 @@ class StartpageController extends Controller } } + $lang = LaravelLocalization::getCurrentLocale(); + if ($lang === 'de') { + $lang = 'all'; + } + return view('index') ->with('title', trans('titles.index')) ->with('homeIcon') @@ -46,7 +46,7 @@ class StartpageController extends Controller ->with('autocomplete', $request->input('param_autocomplete', 'on')) ->with('foki', $this->loadFoki()) ->with('focus', $request->input('focus', 'web')) - ->with('lang', $request->input('param_lang', 'all')) + ->with('lang', $lang) ->with('resultCount', $request->input('param_resultCount', '20')) ->with('time', $request->input('param_time', '1500')) ->with('sprueche', $request->input('param_sprueche', 'on')) -- GitLab From 557c12942a58916403b9baa476caa53ccffb2208 Mon Sep 17 00:00:00 2001 From: Dominik Pfennig Date: Tue, 10 Oct 2017 11:29:49 +0200 Subject: [PATCH 22/36] Update StartpageController.php --- app/Http/Controllers/StartpageController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/StartpageController.php b/app/Http/Controllers/StartpageController.php index 6a6cb1f0..65cc6dab 100644 --- a/app/Http/Controllers/StartpageController.php +++ b/app/Http/Controllers/StartpageController.php @@ -23,7 +23,7 @@ class StartpageController extends Controller $theme = "default"; foreach ($request->all() as $key => $value) { - if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_newtab' && $key !== 'param_maps' && $key !== 'param_autocomplete') { + if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_newtab' && $key !== 'param_maps' && $key !== 'param_autocomplete' && $key !== 'param_lang') { $focusPages[] = str_replace('param_', '', $key); } if ($key === 'param_theme') { @@ -46,7 +46,7 @@ class StartpageController extends Controller ->with('autocomplete', $request->input('param_autocomplete', 'on')) ->with('foki', $this->loadFoki()) ->with('focus', $request->input('focus', 'web')) - ->with('lang', $lang) + ->with('lang', $request->input('param_lang', $lang)) ->with('resultCount', $request->input('param_resultCount', '20')) ->with('time', $request->input('param_time', '1500')) ->with('sprueche', $request->input('param_sprueche', 'on')) -- GitLab From 669fd42fecd7bdb8e6b8831c0775122ecf2514ea Mon Sep 17 00:00:00 2001 From: Dominik Pfennig Date: Wed, 11 Oct 2017 09:33:20 +0200 Subject: [PATCH 23/36] =?UTF-8?q?Der=20Host=20Filter=20wurde=20nicht=20meh?= =?UTF-8?q?r=20angewendet,=20weil=20der=20Sitesearch=20String=20nicht=20me?= =?UTF-8?q?hr=20""=20ist,=20wenn=20keine=20Sitesearch=20durchgef=C3=BChrt?= =?UTF-8?q?=20wird,=20sondern=20null.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Result.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Result.php b/app/Models/Result.php index 4da2b07a..7ffc3150 100644 --- a/app/Models/Result.php +++ b/app/Models/Result.php @@ -264,7 +264,7 @@ class Result * dass von jedem Host maximal 3 Links angezeigt werden. * Diese Überprüfung führen wir unter bestimmten Bedingungen nicht durch. */ - if ($metager->getSite() === "" && + if (($metager->getSite() === "" || $metager->getSite() === null) && strpos($this->strippedHost, "ncbi.nlm.nih.gov") === false && strpos($this->strippedHost, "twitter.com") === false && strpos($this->strippedHost, "www.ladenpreis.net") === false && -- GitLab From e63a7f42bb10576d28948a8a22f988a356ca2a74 Mon Sep 17 00:00:00 2001 From: Dominik Pfennig Date: Wed, 11 Oct 2017 09:36:31 +0200 Subject: [PATCH 24/36] Added Git Ignore for Eclipse Project Files --- .gitignore | 2 ++ .settings/.gitignore | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 .settings/.gitignore diff --git a/.gitignore b/.gitignore index 31ef0b58..a4355241 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ langfiles.zip /public/js/utility.js **/*.map +/.buildpath +/.project diff --git a/.settings/.gitignore b/.settings/.gitignore new file mode 100644 index 00000000..f0f7c9f2 --- /dev/null +++ b/.settings/.gitignore @@ -0,0 +1,2 @@ +/org.eclipse.core.resources.prefs +/org.eclipse.wst.validation.prefs -- GitLab From 9cfc8a47edbfebc72da68c96799dc80ecff4741d Mon Sep 17 00:00:00 2001 From: Dominik Pfennig Date: Tue, 17 Oct 2017 10:49:18 +0200 Subject: [PATCH 25/36] Removed the Maps IFrame from the results page and the maps setting from the settings page. --- resources/lang/de/settings.php | 3 --- resources/views/metager3.blade.php | 8 -------- resources/views/metager3results.blade.php | 8 -------- resources/views/settings.blade.php | 7 ------- 4 files changed, 26 deletions(-) diff --git a/resources/lang/de/settings.php b/resources/lang/de/settings.php index 620046d3..467168e6 100644 --- a/resources/lang/de/settings.php +++ b/resources/lang/de/settings.php @@ -7,9 +7,6 @@ return [ "quotes.label" => "Sprüche", "quotes.on" => "anzeigen", "quotes.off" => "nicht anzeigen", - "maps.label" => "Maps", - "maps.on" => "anzeigen", - "maps.off" => "nicht anzeigen", "tab.label" => "Ergebnisse öffnen:", "tab.new" => "In einem neuen Tab", "tab.same" => "Im gleichen Tab", diff --git a/resources/views/metager3.blade.php b/resources/views/metager3.blade.php index 73fb5079..df2bdf66 100644 --- a/resources/views/metager3.blade.php +++ b/resources/views/metager3.blade.php @@ -34,14 +34,6 @@ @include('layouts.ad', ['ad' => $metager->popAd()]) @endfor @endif - @if($metager->getMaps()) -
- -
- -
-
- @endif @foreach($metager->getResults() as $result) @if($result->number % 7 === 0) @include('layouts.ad', ['ad' => $metager->popAd()]) diff --git a/resources/views/metager3results.blade.php b/resources/views/metager3results.blade.php index f0e66ecd..d16d1304 100644 --- a/resources/views/metager3results.blade.php +++ b/resources/views/metager3results.blade.php @@ -26,14 +26,6 @@ @include('layouts.ad', ['ad' => $metager->popAd()]) @endfor @endif - @if($metager->getMaps()) -
- -
- -
-
- @endif @foreach($metager->getResults() as $result) @if($result->number % 7 === 0) @include('layouts.ad', ['ad' => $metager->popAd()]) diff --git a/resources/views/settings.blade.php b/resources/views/settings.blade.php index 1bfa47e0..b2c8c24c 100644 --- a/resources/views/settings.blade.php +++ b/resources/views/settings.blade.php @@ -16,13 +16,6 @@
-
- - -