Commit f90e10f1 authored by Karl's avatar Karl
Browse files

Die Neue Fokusauswahl und die Neue Einstellungsseite scheinen zu funktionieren.

Es muss noch die Kompatibilität mit alten Links und Plugins getestet werden
parent 07fb0f6f
......@@ -36,29 +36,23 @@ class StartpageController extends Controller
}
}
$maps = $request->input('param_maps', 'on');
$agent = new Agent();
$browser = $agent->browser();
$foki = $this->loadFoki();
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('autocomplete', $request->input('param_autocomplete', 'on'))
->with('foki', $this->loadFoki())
->with('focus', $request->input('focus', 'web'))
->with('lang', $request->input('param_lang', 'all'))
->with('resultCount', $request->input('param_resultCount', '20'))
->with('time', $request->input('param_time', '1000'))
->with('sprueche', $request->input('param_sprueche', 'off'))
->with('newtab', $request->input('param_newtab', 'on'))
->with('focusPages', $focusPages)
->with('browser', $browser)
->with('navbarFocus', 'suche')
->with('theme', $theme)
->with('maps', $maps)
->with('autocomplete', $request->input('param_autocomplete', 'on'))
->with('foki', $foki);
->with('maps', $maps = $request->input('param_maps', 'on'));
}
public function loadPage($subpage)
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -212,21 +212,49 @@ function showFocusEditDialog(id) {
}
function saveFocus() {
var focus = {};
var name = document.getElementById("focus-name").value;
var id = getIdFromName(name);
var oldId = document.getElementById("original-id").value;
$("input[type=checkbox]:checked").each(function(el) {
focus[$(this).attr("name")] = $(this).val();
});
focus["name"] = name;
if (oldId !== "") {
localStorage.removeItem(oldId);
removeFocusById(oldId);
if (isValidName(name) && atLeastOneChecked()) {
var id = getIdFromName(name);
var overwrite = true;
if (alreadyInUse(name)) {
overwrite = confirm("Name bereits genutzt\nüberschreiben?");
if (overwrite) {
localStorage.removeItem(id);
removeFocusById(id);
}
}
if (overwrite) {
var oldId = document.getElementById("original-id").value;
var focus = {};
$("input[type=checkbox]:checked").each(function(el) {
focus[$(this).attr("name")] = $(this).val();
});
focus["name"] = name;
if (oldId !== "") {
localStorage.removeItem(oldId);
removeFocusById(oldId);
}
localStorage.setItem(id, JSON.stringify(focus));
addFocus(name);
$("#create-focus-modal").modal("hide");
}
} else {
alert("Bitte gültigen Namen eingeben:\n* Keine Sonderzeichen\n* Mindestens 1 Buchstabe\n* Mindestens 1 Suchmaschine auswählen");
}
localStorage.setItem(id, JSON.stringify(focus));
addFocus(name);
$("#create-focus-modal").modal("hide");
}
function isValidName(name) {
// no Characters other then a-z, A-Z, 0-9, ä, ö, ü, ß, -, _ allowed
// at least 1 character
return /^[a-zA-Z0-9äöüß\-_ ]*$/.test(name);
}
function atLeastOneChecked() {
return $("input[type=checkbox]:checked").length > 0;
}
function alreadyInUse(name) {
return localStorage.hasOwnProperty(getIdFromName(name));
}
function deleteFocus() {
......@@ -312,7 +340,12 @@ function removeFocusById(id) {
}
function getIdFromName(name) {
return "focus_" + name.split(" ").join("_").toLowerCase();
name = name.toLowerCase();
name = name.split(" ").join("_");
name = name.split("ä").join("ae");
name = name.split("ö").join("oe");
name = name.split("ü").join("ue");
return "focus_" + name;
}
function loadFocusById(id) {
......
......@@ -2,7 +2,7 @@
"js/editLanguage.js": "js/editLanguage-7a1cbfb2ba.js",
"js/kontakt.js": "js/kontakt-de49d68db3.js",
"js/scriptResultPage.js": "js/scriptResultPage-1eb7e4a36b.js",
"js/scriptStartPage.js": "js/scriptStartPage-ebe8cec134.js",
"js/scriptStartPage.js": "js/scriptStartPage-1d6e62e8c9.js",
"js/settings.js": "js/settings-6ff0eab621.js",
"js/widgets.js": "js/widgets-866379dd63.js"
}
\ No newline at end of file
......@@ -25,7 +25,7 @@ input[type=text]:focus, textarea:focus, input[type=email]:focus, input[type=tel]
-webkit-box-shadow: 0px 0px 2px 2px <?=$colorRGBA?>;
-moz-box-shadow: 0px 0px 2px 2px <?=$colorRGBA?>;
box-shadow: 0px 0px 2px 2px <?=$colorRGBA?>;
border: 1px solid <?=$colorRGBA?>;
// border-color: <?=$colorRGBA?>;
}
#mglogo > a {
background-image: linear-gradient(<?=$color?> 0%, <?=$color?> 250%);
......
......@@ -212,21 +212,49 @@ function showFocusEditDialog(id) {
}
function saveFocus() {
var focus = {};
var name = document.getElementById("focus-name").value;
var id = getIdFromName(name);
var oldId = document.getElementById("original-id").value;
$("input[type=checkbox]:checked").each(function(el) {
focus[$(this).attr("name")] = $(this).val();
});
focus["name"] = name;
if (oldId !== "") {
localStorage.removeItem(oldId);
removeFocusById(oldId);
if (isValidName(name) && atLeastOneChecked()) {
var id = getIdFromName(name);
var overwrite = true;
if (alreadyInUse(name)) {
overwrite = confirm("Name bereits genutzt\nüberschreiben?");
if (overwrite) {
localStorage.removeItem(id);
removeFocusById(id);
}
}
if (overwrite) {
var oldId = document.getElementById("original-id").value;
var focus = {};
$("input[type=checkbox]:checked").each(function(el) {
focus[$(this).attr("name")] = $(this).val();
});
focus["name"] = name;
if (oldId !== "") {
localStorage.removeItem(oldId);
removeFocusById(oldId);
}
localStorage.setItem(id, JSON.stringify(focus));
addFocus(name);
$("#create-focus-modal").modal("hide");
}
} else {
alert("Bitte gültigen Namen eingeben:\n* Keine Sonderzeichen\n* Mindestens 1 Buchstabe\n* Mindestens 1 Suchmaschine auswählen");
}
localStorage.setItem(id, JSON.stringify(focus));
addFocus(name);
$("#create-focus-modal").modal("hide");
}
function isValidName(name) {
// no Characters other then a-z, A-Z, 0-9, ä, ö, ü, ß, -, _ allowed
// at least 1 character
return /^[a-zA-Z0-9äöüß\-_ ]*$/.test(name);
}
function atLeastOneChecked() {
return $("input[type=checkbox]:checked").length > 0;
}
function alreadyInUse(name) {
return localStorage.hasOwnProperty(getIdFromName(name));
}
function deleteFocus() {
......@@ -312,7 +340,12 @@ function removeFocusById(id) {
}
function getIdFromName(name) {
return "focus_" + name.split(" ").join("_").toLowerCase();
name = name.toLowerCase();
name = name.split(" ").join("_");
name = name.split("ä").join("ae");
name = name.split("ö").join("oe");
name = name.split("ü").join("ue");
return "focus_" + name;
}
function loadFocusById(id) {
......
......@@ -153,13 +153,13 @@
{{--
<h2>{!! trans('settings.suchmaschinen.1') !!} <small><button type="button" class="btn btn-link allUnchecker hide">{!! trans('settings.suchmaschinen.2') !!}</button></small></h2>
--}}
@foreach( $foki as $focus => $sumas )
<div class="headingGroup {{ $focus }}">
@foreach( $foki as $fokus => $sumas )
<div class="headingGroup {{ $fokus }}">
<h3 class="focus-category">
@lang("settings.foki." . $focus)
@lang("settings.foki." . $fokus)
{{--
<small>
<button type="button" class="checker btn btn-link hide" data-type="{{ $focus }}">{!! trans('settings.suchmaschinen.3') !!}</button>
<button type="button" class="checker btn btn-link hide" data-type="{{ $fokus }}">{!! trans('settings.suchmaschinen.3') !!}</button>
</small>
--}}
</h3>
......@@ -168,7 +168,7 @@
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="checkbox settings-checkbox">
<label>
<input type="checkbox" name="engine_{{ $name }}" class="focusCheckbox" @if ($focus == 'web') checked @endif >{{ $data['displayName'] }}
<input type="checkbox" name="engine_{{ $name }}" class="focusCheckbox" @if ($fokus == 'web') checked @endif >{{ $data['displayName'] }}
<a class="glyphicon settings-glyphicon glyphicon-link" target="_blank" rel="noopener" href="{{ $data['url'] }}"></a>
</label>
</div>
......@@ -178,12 +178,14 @@
</div>
@endforeach
<div class="clearfix">
<button id="save-focus-btn" class="btn btn-primary pull-right">
@lang('index.focus-creator.save')
</button>
<button id="delete-focus-btn" type="button" class="btn btn-danger pull-right">
@lang('index.focus-creator.delete')
</button>
<div class="pull-right">
<button id="delete-focus-btn" type="button" class="btn btn-danger">
@lang('index.focus-creator.delete')
</button>
<button id="save-focus-btn" class="btn btn-primary">
@lang('index.focus-creator.save')
</button>
</div>
</div>
</div>
</div>
......@@ -257,22 +259,16 @@
</div>
<input type="text" name="eingabe" required="" autofocus="" autocomplete="{{$autocomplete}}" class="form-control" placeholder="{{ trans('index.placeholder') }}">
<input type="hidden" name="encoding" value="utf8">
@if ($focus === 'angepasst')
<input type="hidden" name="lang" value={{ $lang }} >
<input type="hidden" name="resultCount" value={{ $resultCount }} >
<input type="hidden" name="time" value={{ $time }} >
<input type="hidden" name="sprueche" value={{ $sprueche }} >
<input type="hidden" name="newtab" value={{ $newtab }} >
<input type="hidden" name="maps" value={{ $maps }} >
@foreach ($focusPages as $fp)
<input type="hidden" name={{ $fp }} value="on">
@endforeach
<input type="hidden" name="theme" value={{ $theme }}>
@elseif( !App::isLocale('de') )
<input type="hidden" name="lang" value="{{ App::getLocale() }}">
@else
<input type="hidden" name="lang" value="all">
@endif
<input type="hidden" name="lang" value={{ $lang }} >
<input type="hidden" name="resultCount" value={{ $resultCount }} >
<input type="hidden" name="time" value={{ $time }} >
<input type="hidden" name="sprueche" value={{ $sprueche }} >
<input type="hidden" name="newtab" value={{ $newtab }} >
<input type="hidden" name="maps" value={{ $maps }} >
@foreach ($focusPages as $fp)
<input type="hidden" name={{ $fp }} value="on">
@endforeach
<input type="hidden" name="theme" value={{ $theme }}>
<div class="input-group-addon">
<button type="submit">
<span class="glyphicon glyphicon-search"></span>
......
......@@ -7,7 +7,6 @@
<h1>{!! trans('settings.head.1') !!}</h1>
<p id="lead">{!! trans('settings.head.2') !!}</p>
<h2>{!! trans('settings.allgemein.1') !!}</h2>
<input id="settings-focus" type="hidden" name="focus" value="eigene">
<container>
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-3">
......@@ -56,7 +55,7 @@
</div>
</container>
<div id="settingsButtons">
<a id="settings-abort-btn" class="btn btn-danger mutelink" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}">@lang('settings.abort')</a>
<a id="settings-abort-btn" class="btn btn-danger mutelink" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}">@lang('settings.abort') <span class="glyphicon glyphicon-remove"></span></a>
<input id="unten" class="btn btn-primary settings-btn" type="submit" value="{!! trans('settings.speichern.1') !!}">
<input id="save" class="btn btn-primary settings-btn hidden" type="button" data-href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}" value="{!! trans('settings.speichern.2') !!}">
<input id="plugin" class="btn btn-primary settings-btn" type="submit" value="{!! trans('settings.speichern.3') !!}">
......
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