Commit a0506a1f authored by Aria Givi's avatar Aria Givi

Merge 667

parents fbc2127a 7800017b
......@@ -37,15 +37,6 @@ class StartpageController extends Controller
$autocomplete = $option_values['autocomplete'];
}
foreach ($request->all() as $key => $value) {
if ($value === 'on' && !in_array($key, $optionParams)) {
$focusPages[] = str_replace('param_', '', $key);
}
if ($key === 'param_theme') {
$theme = str_replace('param_', '', $key);
}
}
$lang = LaravelLocalization::getCurrentLocale();
if ($lang === 'de') {
$lang = 'all';
......@@ -54,10 +45,8 @@ class StartpageController extends Controller
return view('index')
->with('title', trans('titles.index'))
->with('homeIcon')
->with('focusPages', $focusPages)
->with('browser', (new Agent())->browser())
->with('navbarFocus', 'suche')
->with('theme', $theme)
->with('focus', $request->input('focus', 'web'))
->with('time', $request->input('param_time', '1500'))
->with('request', $request->input('request', 'GET'))
......
......@@ -90,6 +90,15 @@ class MetaGer
# Erstellt aus den gesammelten Ergebnissen den View
public function createView($quicktipResults = NULL)
{
# Hiermit werden die evtl. ausgewählten SuMas extrahiert, damit die Input-Boxen richtig gesetzt werden können
$focusPages = [];
foreach ($this->request->all() as $key => $value) {
if ($value === 'on') {
$focusPages[] = str_replace('param_', '', str_replace('engine_', '', $key));
}
}
$viewResults = [];
# Wir extrahieren alle notwendigen Variablen und geben Sie an unseren View:
foreach ($this->results as $result) {
......@@ -179,6 +188,7 @@ class MetaGer
default:
return view('metager3')
->with('eingabe', $this->eingabe)
->with('focusPages', $focusPages)
->with('mobile', $this->mobile)
->with('warnings', $this->warnings)
->with('errors', $this->errors)
......@@ -493,6 +503,12 @@ class MetaGer
$sumaCount = 0;
$isCustomSearch = $this->startsWith($this->fokus, 'focus_');
# Im Falle einer Custom-Suche ohne mindestens einer selektierter Suchmaschine wird eine Web-Suche durchgeführt
if($isCustomSearch && !$this->atLeastOneSearchengineSelected($request)) {
$isCustomSearch = false;
$this->fokus = 'web';
}
/* Erstellt die Liste der eingestellten Sumas
* Der einzige Unterschied bei angepasstem Suchfokus ist,
......@@ -1209,6 +1225,15 @@ class MetaGer
}
}
public function atLeastOneSearchengineSelected(Request $request) {
foreach ($request->all() as $key => $value) {
if ($this->startsWith($key, 'engine')) {
return true;
}
}
return false;
}
public function showQuicktips()
{
return $this->quicktips;
......
......@@ -469,7 +469,7 @@
},
{
"name": "jaybizzle/crawler-detect",
"version": "v1.2.57",
"version": "v1.2.58",
"source": {
"type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git",
......@@ -3045,16 +3045,16 @@
},
{
"name": "phpspec/prophecy",
"version": "1.7.3",
"version": "1.7.4",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf"
"reference": "9f901e29c93dae4aa77c0bb161df4276f9c9a1be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/9f901e29c93dae4aa77c0bb161df4276f9c9a1be",
"reference": "9f901e29c93dae4aa77c0bb161df4276f9c9a1be",
"shasum": ""
},
"require": {
......@@ -3066,7 +3066,7 @@
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
"phpunit/phpunit": "^4.8.35 || ^5.7"
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
},
"type": "library",
"extra": {
......
$(function () {
loadLocalStorage();
setSearchbarActionListeners();
});
/**
......@@ -12,10 +11,6 @@ function loadLocalStorage () {
}
}
function setSearchbarActionListeners () {
$('#toggleOptBtn').click(toggleOptionsDialog);
}
function setSettings () {
var acceptedParams = ['autocomplete', 'key', 'lang', 'newtab', 'sprueche'];
for (var key in localStorage) {
......@@ -41,25 +36,4 @@ function setSettings () {
if (requestMethod !== null && (requestMethod === 'GET' || requestMethod === 'POST')) {
$('#searchForm').attr('method', requestMethod);
}
}
function toggleOptionsDialog () {
var btnMode = $('#toggleOptBtn').attr('data-mode');
if (btnMode == 'o') {
openOptionsDialog();
} else {
closeOptionsDialog();
}
}
function openOptionsDialog () {
$('#toggleOptBtn').html('<i class="fa fa-chevron-up" aria-hidden="true"></i>');
$('#toggleOptBtn').attr('data-mode', 'c');
$('.search-option-frame').removeClass('hide');
}
function closeOptionsDialog () {
$('#toggleOptBtn').html('<i class="fa fa-sliders" aria-hidden="true"></i>');
$('#toggleOptBtn').attr('data-mode', 'o');
$('.search-option-frame').addClass('hide');
}
}
\ No newline at end of file
/* Rund ums Fokus Modal */
#show-create-focus:checked {
& + #create-focus-modal {
display: flex;
}
}
#create-focus-modal {
display: none;
position: fixed;
justify-content: center;
min-height: 100%;
background: linear-gradient(rgba(0,0,0,.7),rgba(0,0,0,.7));
z-index: 150;
#foki-modal-dialog {
background-color: white;
max-width: 70%;
margin: 30px auto;
height: 900px;
overflow-y: auto;
#foki-modal-content {
#foki-modal-header {
padding: 15px;
position: relative;
border-bottom: 1px solid #e5e5e5;
#close-create-focus{
position: absolute;
right: 15px;
&::after {
font-size: 24px;
content: "×";
}
}
}
.focus-dropdown-toggle {
display: none;
&:not(:checked) {
& ~ .focus-dropdown-label ~ .row {
max-height: 0px;
overflow: hidden;
}
}
&:checked {
& ~ .focus-dropdown-label::after {
content: "🡡";
}
}
}
.focus-dropdown-label {
&::after {
font-size: 16px;
content: "🡣";
margin-left: 3px;
}
& ~ .row {
-webkit-transition: max-height 0.4s ease; /* Chrome 1-25, Safari 3.2+ */
-moz-transition: max-height 0.4s ease; /* Firefox 4-15 */
-o-transition: max-height 0.4s ease; /* Opera 10.50–12.00 */
transition: max-height 0.4s ease;
max-height: 400px;
}
}
}
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
@import "./settings.less";
@import "./variables.less";
@import "./sidebar.less";
@import "./foki.less";
@import "./footer.less";
@import "./searchbar.less";
@import "./aufruf-winter.less";
\ No newline at end of file
......@@ -176,9 +176,11 @@
}
}
div:hover>.searchbar-tooltip {
label:hover+.searchbar-tooltip {
display: inline-block;
@media (max-width: @screen-xs-max) {
top: 30px;
left: -10px;
@media (max-width: 799px) {
display: none;
}
}
......@@ -252,8 +254,6 @@ div:hover>.searchbar-tooltip {
.searchbar-tooltip {
display: none;
position: absolute;
top: 45px;
left: -10px;
&>.searchbar-tooltip-arrow {
position: absolute;
top: -4px;
......@@ -339,24 +339,25 @@ header:nth-child(1) {
display: flex;
width: 100%;
max-width: @resultpage-leftbox-max-width;
background-color: white;
border: 1px solid #ccc;
box-shadow: 0px 1px 1.5px 0px rgba(0, 0, 0, 0.12), 1px 0px 1px 0px rgba(0, 0, 0, 0.24);
background-color: white;
border: 1px solid #ccc;
box-shadow: 0px 1px 1.5px 0px rgba(0, 0, 0, 0.12), 1px 0px 1px 0px rgba(0, 0, 0, 0.24);
overflow-x: auto;
padding: 10px;
&>div {
padding: 0px 10px;
&>a {
color: black;
}
overflow-x: auto;
&>div {
padding: 0px 10px;
&>a {
color: black;
}
&.active>a {
border-bottom: 1px solid rgb(255, 128, 0);
color: rgb(255, 128, 0);
}
}
}
.edit-focus {
margin-left: 7px;
}
margin-left: 7px;
}
/* Scrollbar Style */
&::-webkit-scrollbar {
height: 0px;
......
......@@ -119,7 +119,7 @@ return [
'plugin.vivaldi.9' => 'Klicken Sie in Ihrem Browser oben links auf das rote Vivaldi Logo und wählen Sie zuerst "Werkzeuge", dann im Untermenü "Einstellungen".',
'plugin.vivaldi.10' => 'Tragen Sie im Feld "Startseite" "https://metager.de" ein.',
'tooltips.add-focus' => 'Eigenen Fokus hinzufügen',
'tooltips.add-focus' => 'Suche anpassen',
'tooltips.edit-focus' => 'Aktuellen Fokus bearbeiten',
'tooltips.settings' => 'Allgemeine Einstellungen',
];
......@@ -33,8 +33,8 @@
<div id="results-container">
@yield('results')
</div>
<div id="additions-container">
<div id="search-settings" style="display:none">
<div id="additions-container" style="display: none;">
<div id="search-settings">
<h1>Eigene Suche</h1>
@foreach( App\Http\Controllers\FokiLoader::loadFoki() as $fokus => $sumas )
<h2 class="focus-category">
......
<div id="create-focus-modal" class="modal fade" tab-index="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="content modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
{{-- TODO HIDDEN INPUT-FIELD fürs Modal in dem die vorherige Eingabe steht, eigenes <form> tag fürs Modal --}}
<input type="checkbox" id="show-create-focus" class="hidden">
<div id="create-focus-modal" tab-index="-1" role="dialog">
<div id="foki-modal-dialog">
<div id="foki-modal-content">
<div id="foki-modal-header">
<label type="button" id="close-create-focus" role= "button" for="show-create-focus"></label>
<h4>
@lang("index.focus-creator.head")
</h4>
<p class="text-muted">@lang("index.focus-creator.description")</p>
</div>
<div class="modal-body">
<div class="clearfix">
<div class="pull-left">
<label for="focus-name">@lang('index.focus-creator.focusname')</label>
<input id="focus-name" type="text" name="focus-name" placeholder="@lang('index.focus-creator.name-placeholder')">
<input id="original-id" type="hidden" name="original-id" value="">
</div>
<div class="settings-modal-buttons pull-right">
<button class="delete-focus-btn btn btn-danger">
@lang('index.focus-creator.delete')
</button>
<button class="save-focus-btn btn btn-primary">
<button type="submit" form="customSearchForm" class="save-focus-btn btn btn-primary">
@lang('index.focus-creator.save')
</button>
</div>
</div>
@foreach( App\Http\Controllers\FokiLoader::loadFoki() as $fokus => $sumas )
<div class="headingGroup {{ $fokus }}">
<h3 class="focus-category">
@lang("settings.foki." . $fokus)
</h3>
<div class="row">
@foreach( $sumas as $name => $data )
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="checkbox settings-checkbox">
<label>
<input type="checkbox" name="engine_{{ strtolower($name) }}" class="focusCheckbox" @if ($fokus=='web' ) checked @endif>{{ $data['displayName'] }}
<a class="settings-icon" target="_blank" rel="noopener" href="{{ $data['url'] }}">
<i class="fa fa-link" aria-hidden="true"></i>
</a>
</label>
</div>
<div class="modal-body">
<form id="customSearchForm" method="GET" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3 ") }}" accept-charset="UTF-8">
<input type="hidden" name="eingabe" value="@if(isset($eingabe)){{$eingabe}}@endif">
<input type="hidden" name="encoding" value="utf8">
<input type="hidden" name="focus" value="focus_custom">
@foreach( App\Http\Controllers\FokiLoader::loadFoki() as $fokus => $sumas )
<div class="headingGroup {{ $fokus }}">
<input type="checkbox" id="toggle-{{ $fokus }}-dropdown" class="focus-dropdown-toggle" checked>
<label for="toggle-{{ $fokus }}-dropdown" class="focus-category focus-dropdown-label h3">
@lang("settings.foki." . $fokus)
</label>
<div class="row">
@foreach( $sumas as $name => $data )
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="checkbox settings-checkbox">
<label>
<input type="checkbox" name="engine_{{ strtolower($name) }}" class="focusCheckbox" @if(isset($focusPages) && in_array(strtolower($name), $focusPages)) checked @endif>
{{ $data['displayName'] }}
<a class="settings-icon" target="_blank" rel="noopener" href="{{ $data['url'] }}">
<i class="fa fa-link" aria-hidden="true"></i>
</a>
</label>
</div>
</div>
@endforeach
</div>
@endforeach
</div>
@endforeach
<div class="clearfix">
<div class="settings-modal-buttons pull-right">
<button type="submit" class="save-focus-btn btn btn-primary">
@lang('index.focus-creator.save')
</button>
</div>
</div>
@endforeach
<div class="clearfix">
<div class="settings-modal-buttons pull-right">
<button class="delete-focus-btn btn btn-danger">
@lang('index.focus-creator.delete')
</button>
<button class="save-focus-btn btn btn-primary">
@lang('index.focus-creator.save')
</button>
</div>
</div>
</form>
</div>
</div>
</div>
......
......@@ -14,18 +14,13 @@
<a href="https://maps.metager.de/map/{{ $metager->getQ() }}/9.7380161,52.37119740000003,12" target="_self">@lang('index.foki.maps')</a>
</div>
<div class="search-option-frame">
<div class="searchbar-options-arrow"></div>
<div class="search-button-container">
<div class="search-add-focus js-only">
<button type="button" id="addFocusBtn">
<i class="fa fa-plus"></i>
</button>
<div class="searchbar-tooltip">
<div class="searchbar-tooltip-arrow"></div>
<div class="searchbar-tooltip-content">
<p>{{{ trans('index.tooltips.add-focus') }}}</p>
</div>
</div>
</div>
</div>
</div>
<label for="show-create-focus" role="button" id="">
<i class="fa fa-sliders"></i>
</label>
<div class="searchbar-tooltip">
<div class="searchbar-tooltip-arrow"></div>
<div class="searchbar-tooltip-content">
<p>{{{ trans('index.tooltips.add-focus') }}}</p>
</div>
</div>
</div>
......@@ -23,7 +23,8 @@
@if (isset($option_values))
<input type="hidden" name="time" value={{ $time }}>
@endif
@if (isset($focusPages))
@if (isset($focusPages) && !empty($focusPages))
<input type="hidden" name="focus" value="focus_custom">
@foreach ($focusPages as $fp)
<input type="hidden" name={{ $fp }} value="on">
@endforeach
......
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