Commit eca44be5 authored by Karl's avatar Karl
Browse files

Die Einstellungen sind jetzt streng unterteilt in Allgemeines und Suchmaschinen.

Die allgemeinen Einstellungen werden (wenn Javascript aktiviert ist) für alle Suchen übernommen, die gewählten Suchmaschinen nur für die "Eigene Suche".
parent ba232bf6
......@@ -21,21 +21,15 @@ class StartpageController extends Controller
$focusPages = [];
$theme = "default";
foreach ($request->all() as $key => $value) {
if ($value === 'on'
&& $key !== 'meta_sprueche'
&& $key !== 'meta_maps'
&& $key !== 'meta_newtab'
&& $key !== 'meta_lang'
&& $key !== 'request'
&& $key !== 'meta_autocomplete') {
$focusPages[] = str_replace('meta_', '', $key);
if ($value === 'on' && $key != 'param_sprueche' && $key != 'param_tab' && $key !== 'param_maps' && $key !== 'param_autocomplete') {
$focusPages[] = str_replace('param_', '', $key);
}
if ($key === 'meta_theme') {
$theme = str_replace('meta_', '', $key);
if ($key === 'param_theme') {
$theme = str_replace('param_', '', $key);
}
}
$maps = $request->input('meta_maps', 'on');
$maps = $request->input('param_maps', 'on');
$agent = new Agent();
$browser = $agent->browser();
......@@ -44,17 +38,17 @@ class StartpageController extends Controller
->with('title', trans('titles.index'))
->with('homeIcon')
->with('focus', $request->input('focus', 'web'))
->with('lang', $request->input('meta_lang', 'all'))
->with('resultCount', $request->input('meta_resultCount', '20'))
->with('time', $request->input('meta_time', '1000'))
->with('sprueche', $request->input('meta_sprueche', 'off'))
->with('tab', $request->input('meta_tab', 'off'))
->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('tab', $request->input('param_tab', 'off'))
->with('focusPages', $focusPages)
->with('browser', $browser)
->with('navbarFocus', 'suche')
->with('theme', $theme)
->with('maps', $maps)
->with('autocomplete', $request->input('meta_autocomplete', 'on'));
->with('autocomplete', $request->input('param_autocomplete', 'on'));
}
public function loadPage($subpage)
......
......@@ -35,6 +35,7 @@ class MetaGer
protected $addedHosts = [];
protected $startCount = 0;
protected $canCache = false;
protected $canCustomSearch = false;
# Daten über die Abfrage
protected $ip;
protected $language;
......@@ -888,7 +889,7 @@ class MetaGer
} else {
$this->sprueche = false;
}
$this->maps = $request->input('maps', 'off');
$this->maps = $request->input('maps', 'on');
if ($this->maps === "on") {
$this->maps = true;
} else {
......@@ -900,6 +901,7 @@ class MetaGer
} else {
$this->newtab = "_self";
}
$this->canCustomSearch = $request->input('canCustomSearch', 'false') === 'true';
# Theme
$this->theme = preg_replace("/[^[:alnum:][:space:]]/u", '', $request->input('theme', 'default'));
# Ergebnisse pro Seite:
......@@ -1262,6 +1264,11 @@ class MetaGer
# Komplexe Getter
public function canCustomSearch()
{
return $this->canCustomSearch;
}
public function getHostCount($host)
{
$hash = md5($host);
......
This diff is collapsed.
......@@ -3947,35 +3947,34 @@ $(document).ready(function() {
});
}
$("#reset-settings-btn").click(function() {
resetOptions();
softResetOptions();
document.location.href = $("#reset-settings-btn").attr("data-href");
});
});
function setSettings() {
if (localStorage.length > 0) {
if (canCustomSearch()) {
$("#foki input[type=radio]#angepasst").attr("checked", true);
$("#foki label#anpassen-label").removeClass("hide");
$("#foki button#reset-settings-btn").removeClass("hide");
$("#searchForm").append("<input type=\"hidden\" name=\"canCustomSearch\" value=\"true\">");
}
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith("engine_")) {
key = key.substring(key.indexOf("engine_") + 7);
$("#searchForm").append("<input type=\"hidden\" name=\"" + key + "\" value=\"" + value + "\">");
}
if (key.startsWith("meta_") && !key.endsWith("lang") && !key.endsWith('autocomplete')) {
key = key.substring(key.indexOf("meta_") + 5);
if (key.startsWith("param_") && !key.endsWith("lang") && !key.endsWith('autocomplete')) {
key = key.substring(key.indexOf("param_") + 6);
$("#searchForm").append("<input type=\"hidden\" name=\"" + key + "\" value=\"" + value + "\">");
}
}
if (localStorage.getItem("meta_lang") !== null) {
var value = localStorage.getItem("meta_lang");
if (localStorage.getItem("param_lang") !== null) {
var value = localStorage.getItem("param_lang");
// Change the value of the lang input field to the given parameter
$("input[name=lang]").val(value);
}
if (localStorage.getItem("meta_autocomplete") !== null) {
var value = localStorage.getItem("meta_autocomplete");
if (localStorage.getItem("param_autocomplete") !== null) {
var value = localStorage.getItem("param_autocomplete");
// Change the value of the lang input field to the given parameter
$("input[name=eingabe]").attr("autocomplete", value);
}
if ($("fieldset#foki.mobile").length) {
......@@ -4075,21 +4074,47 @@ function isUseOnce() {
return false;
}
function resetOptions() {
localStorage.removeItem("pers");
function softResetOptions() {
// localStorage.removeItem("pers");
localStorage.removeItem("focus");
var keys = [];
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i)
keys.push(key);
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("engine_" || key.startsWith("focus"))) {
localStorage.removeItem(key);
if (key.startsWith("param_" || key.startsWith("focus"))) {
if (metaParams.indexOf(key) === -1) {
localStorage.removeItem(key);
}
}
}
}
function canCustomSearch() {
if (localStorage.key("focus") === "angepasst") {
return true;
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
var keys = [];
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i)
keys.push(key);
}
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("param_")) {
if (metaParams.indexOf(key) === -1) {
return true;
}
}
}
return false;
}
$(document).ready(function() {
pageCanJS(); // Einige Inhalte der Seite sollen mit Javascript anders aussehen
tickOptions();
// Wenn LocalStorage verfügbar ist, geben wir die Möglichkeit die Einstellungen dort zu speichern
// Checker listener
......@@ -4161,16 +4186,16 @@ function tickOptions() {
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith("engine_")) {
if (key.startsWith("param_")) {
if ($("input[name=" + key + "]").length) {
$("input[name=" + key + "]").attr("checked", "");
} else {
$("select[name=" + key + "] > option[value=" + value + "]").attr("selected", true);
}
} else if (key.startsWith("meta_")) {
$("select[name=" + key + "] > option[value=" + value + "]").attr("selected", true);
}
}
} else {
$("div.web input").attr("checked", true);
// $("div.web input").attr("checked", true);
}
}
......@@ -4181,10 +4206,13 @@ function resetOptions() {
var key = localStorage.key(i)
keys.push(key);
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("engine_" || key.startsWith("focus"))) {
localStorage.removeItem(key);
if (key.startsWith("param_" || key.startsWith("focus"))) {
if (metaParams.indexOf(key) === -1) {
localStorage.removeItem(key);
}
}
}
}
......@@ -4197,6 +4225,11 @@ function getLanguage() {
}
}
}
function pageCanJS() {
$("#collapse-engines-div").removeClass("in");
$("#collapse-engines-btn").removeClass("hide");
}
/*! iFrame Resizer (iframeSizer.min.js ) - v3.5.5 - 2016-06-16
* Desc: Force cross domain iframes to size to content.
* Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.
......
This diff is collapsed.
{
"css/themes/default.css": "css/themes/default-3d930e48d2.css",
"js/all.js": "js/all-7acad910d2.js",
"js/all.js": "js/all-5ecffcf961.js",
"js/quicktips.js": "js/quicktips-34d41bc58a.js"
}
\ No newline at end of file
......@@ -3947,35 +3947,34 @@ $(document).ready(function() {
});
}
$("#reset-settings-btn").click(function() {
resetOptions();
softResetOptions();
document.location.href = $("#reset-settings-btn").attr("data-href");
});
});
function setSettings() {
if (localStorage.length > 0) {
if (canCustomSearch()) {
$("#foki input[type=radio]#angepasst").attr("checked", true);
$("#foki label#anpassen-label").removeClass("hide");
$("#foki button#reset-settings-btn").removeClass("hide");
$("#searchForm").append("<input type=\"hidden\" name=\"canCustomSearch\" value=\"true\">");
}
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith("engine_")) {
key = key.substring(key.indexOf("engine_") + 7);
$("#searchForm").append("<input type=\"hidden\" name=\"" + key + "\" value=\"" + value + "\">");
}
if (key.startsWith("meta_") && !key.endsWith("lang") && !key.endsWith('autocomplete')) {
key = key.substring(key.indexOf("meta_") + 5);
if (key.startsWith("param_") && !key.endsWith("lang") && !key.endsWith('autocomplete')) {
key = key.substring(key.indexOf("param_") + 6);
$("#searchForm").append("<input type=\"hidden\" name=\"" + key + "\" value=\"" + value + "\">");
}
}
if (localStorage.getItem("meta_lang") !== null) {
var value = localStorage.getItem("meta_lang");
if (localStorage.getItem("param_lang") !== null) {
var value = localStorage.getItem("param_lang");
// Change the value of the lang input field to the given parameter
$("input[name=lang]").val(value);
}
if (localStorage.getItem("meta_autocomplete") !== null) {
var value = localStorage.getItem("meta_autocomplete");
if (localStorage.getItem("param_autocomplete") !== null) {
var value = localStorage.getItem("param_autocomplete");
// Change the value of the lang input field to the given parameter
$("input[name=eingabe]").attr("autocomplete", value);
}
if ($("fieldset#foki.mobile").length) {
......@@ -4075,21 +4074,47 @@ function isUseOnce() {
return false;
}
function resetOptions() {
localStorage.removeItem("pers");
function softResetOptions() {
// localStorage.removeItem("pers");
localStorage.removeItem("focus");
var keys = [];
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i)
keys.push(key);
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("engine_" || key.startsWith("focus"))) {
localStorage.removeItem(key);
if (key.startsWith("param_" || key.startsWith("focus"))) {
if (metaParams.indexOf(key) === -1) {
localStorage.removeItem(key);
}
}
}
}
function canCustomSearch() {
if (localStorage.key("focus") === "angepasst") {
return true;
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
var keys = [];
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i)
keys.push(key);
}
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("param_")) {
if (metaParams.indexOf(key) === -1) {
return true;
}
}
}
return false;
}
$(document).ready(function() {
pageCanJS(); // Einige Inhalte der Seite sollen mit Javascript anders aussehen
tickOptions();
// Wenn LocalStorage verfügbar ist, geben wir die Möglichkeit die Einstellungen dort zu speichern
// Checker listener
......@@ -4161,16 +4186,16 @@ function tickOptions() {
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith("engine_")) {
if (key.startsWith("param_")) {
if ($("input[name=" + key + "]").length) {
$("input[name=" + key + "]").attr("checked", "");
} else {
$("select[name=" + key + "] > option[value=" + value + "]").attr("selected", true);
}
} else if (key.startsWith("meta_")) {
$("select[name=" + key + "] > option[value=" + value + "]").attr("selected", true);
}
}
} else {
$("div.web input").attr("checked", true);
// $("div.web input").attr("checked", true);
}
}
......@@ -4181,10 +4206,13 @@ function resetOptions() {
var key = localStorage.key(i)
keys.push(key);
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("engine_" || key.startsWith("focus"))) {
localStorage.removeItem(key);
if (key.startsWith("param_" || key.startsWith("focus"))) {
if (metaParams.indexOf(key) === -1) {
localStorage.removeItem(key);
}
}
}
}
......@@ -4197,6 +4225,11 @@ function getLanguage() {
}
}
}
function pageCanJS() {
$("#collapse-engines-div").removeClass("in");
$("#collapse-engines-btn").removeClass("hide");
}
/*! iFrame Resizer (iframeSizer.min.js ) - v3.5.5 - 2016-06-16
* Desc: Force cross domain iframes to size to content.
* Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.
......
This diff is collapsed.
......@@ -37,35 +37,34 @@ $(document).ready(function() {
});
}
$("#reset-settings-btn").click(function() {
resetOptions();
softResetOptions();
document.location.href = $("#reset-settings-btn").attr("data-href");
});
});
function setSettings() {
if (localStorage.length > 0) {
if (canCustomSearch()) {
$("#foki input[type=radio]#angepasst").attr("checked", true);
$("#foki label#anpassen-label").removeClass("hide");
$("#foki button#reset-settings-btn").removeClass("hide");
$("#searchForm").append("<input type=\"hidden\" name=\"canCustomSearch\" value=\"true\">");
}
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith("engine_")) {
key = key.substring(key.indexOf("engine_") + 7);
$("#searchForm").append("<input type=\"hidden\" name=\"" + key + "\" value=\"" + value + "\">");
}
if (key.startsWith("meta_") && !key.endsWith("lang") && !key.endsWith('autocomplete')) {
key = key.substring(key.indexOf("meta_") + 5);
if (key.startsWith("param_") && !key.endsWith("lang") && !key.endsWith('autocomplete')) {
key = key.substring(key.indexOf("param_") + 6);
$("#searchForm").append("<input type=\"hidden\" name=\"" + key + "\" value=\"" + value + "\">");
}
}
if (localStorage.getItem("meta_lang") !== null) {
var value = localStorage.getItem("meta_lang");
if (localStorage.getItem("param_lang") !== null) {
var value = localStorage.getItem("param_lang");
// Change the value of the lang input field to the given parameter
$("input[name=lang]").val(value);
}
if (localStorage.getItem("meta_autocomplete") !== null) {
var value = localStorage.getItem("meta_autocomplete");
if (localStorage.getItem("param_autocomplete") !== null) {
var value = localStorage.getItem("param_autocomplete");
// Change the value of the lang input field to the given parameter
$("input[name=eingabe]").attr("autocomplete", value);
}
if ($("fieldset#foki.mobile").length) {
......@@ -165,17 +164,42 @@ function isUseOnce() {
return false;
}
function resetOptions() {
localStorage.removeItem("pers");
function softResetOptions() {
// localStorage.removeItem("pers");
localStorage.removeItem("focus");
var keys = [];
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i)
keys.push(key);
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("engine_" || key.startsWith("focus"))) {
localStorage.removeItem(key);
if (key.startsWith("param_" || key.startsWith("focus"))) {
if (metaParams.indexOf(key) === -1) {
localStorage.removeItem(key);
}
}
}
}
function canCustomSearch() {
if (localStorage.key("focus") === "angepasst") {
return true;
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
var keys = [];
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i)
keys.push(key);
}
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("param_")) {
if (metaParams.indexOf(key) === -1) {
return true;
}
}
}
return false;
}
\ No newline at end of file
$(document).ready(function() {
pageCanJS(); // Einige Inhalte der Seite sollen mit Javascript anders aussehen
tickOptions();
// Wenn LocalStorage verfügbar ist, geben wir die Möglichkeit die Einstellungen dort zu speichern
// Checker listener
......@@ -70,16 +71,16 @@ function tickOptions() {
for (var i = 0; i < localStorage.length; i++) {
var key = localStorage.key(i);
var value = localStorage.getItem(key);
if (key.startsWith("engine_")) {
if (key.startsWith("param_")) {
if ($("input[name=" + key + "]").length) {
$("input[name=" + key + "]").attr("checked", "");
} else {
$("select[name=" + key + "] > option[value=" + value + "]").attr("selected", true);
}
} else if (key.startsWith("meta_")) {
$("select[name=" + key + "] > option[value=" + value + "]").attr("selected", true);
}
}
} else {
$("div.web input").attr("checked", true);
// $("div.web input").attr("checked", true);
}
}
......@@ -90,10 +91,13 @@ function resetOptions() {
var key = localStorage.key(i)
keys.push(key);
}
var metaParams = ["param_sprueche", "param_maps", "param_newtab", "param_lang", "param_autocomplete"];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key.startsWith("engine_" || key.startsWith("focus"))) {
localStorage.removeItem(key);
if (key.startsWith("param_" || key.startsWith("focus"))) {
if (metaParams.indexOf(key) === -1) {
localStorage.removeItem(key);
}
}
}
}
......@@ -105,4 +109,9 @@ function getLanguage() {
return metaData[m]["content"];
}
}
}
function pageCanJS() {
$("#collapse-engines-div").removeClass("in");
$("#collapse-engines-btn").removeClass("hide");
}
\ No newline at end of file
......@@ -109,7 +109,7 @@
</a>
</li>
@else
<li data-loaded="0" id="produktsucheTabSelector" class="tab-selector" role="presentation" >
<li data-loaded="0" id="produktsucheTabSelector" class="tab-selector" role="presentation">
<a aria-controls="produktsuche" data-href="{{ $metager->generateSearchLink('produktsuche') }}" href="{{ $metager->generateSearchLink('produktsuche') }}">
<span class='glyphicon glyphicon-shopping-cart'></span>
<span class="hidden-xs">{{ trans('index.foki.produkte') }}</span>
......@@ -117,13 +117,20 @@
</li>
@endif
@if( $metager->getFokus() === "angepasst" )
@if( $metager->getFokus() === "angepasst")
<li id="angepasstTabSelector" role="presentation" data-loaded="1" class="active tab-selector">
<a aria-controls="angepasst" data-href="#angepasst" href="#angepasst">
<span class='glyphicon glyphicon-cog'></span>
<span class='glyphicon glyphicon-star'></span>
<span class="hidden-xs">{!! trans('index.foki.eigene') !!}</span>
</a>
</li>
@elseif( $metager->canCustomSearch() )
<li data-loaded="0" id="angepasstTabSelector" class="tab-selector" role="presentation">
<a aria-controls="angepasst" data-href="{{ $metager->generateSearchLink('angepasst') }}" href="{{ $metager->generateSearchLink('angepasst') }}">
<span class='glyphicon glyphicon-star'></span>
<span class="hidden-xs">{{ trans('index.foki.eigene') }}</span>
</a>
</li>
@endif
<li id="mapsTabSelector" role="presentation" class="tab-selector">
......@@ -195,7 +202,7 @@
@if( $metager->getFokus() === "produktsuche" )
<div role="tabpanel" class="tab-pane active" id="produktsuche">
<div class="row">
@yield('results')
@yield('results')
</div>
</div>
@else
......@@ -206,10 +213,16 @@
</div>
@endif
@if( $metager->getFokus() === "angepasst" )
@if( $metager->getFokus() === "angepasst")
<div role="tabpanel" class="tab-pane active" id="angepasst">
<div class="row">
@yield('results')
@yield('results')
</div>
</div>
@elseif( $metager->canCustomSearch() )
<div role="tabpanel" class="tab-pane" id="angepasst">
<div class="loader">
<img src="/img/ajax-loader.gif" alt="" />
</div>
</div>
@endif
......
......@@ -12,28 +12,28 @@
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-3">
<label class="select-label">@lang("settings.quotes.label")</label>
<select class="form-control settings-form-control" name="meta_sprueche">
<select class="form-control settings-form-control" name="param_sprueche">
<option value="on" selected>@lang("settings.quotes.on")</option>
<option value="off">@lang("settings.quotes.off")</option>
</select>
</div>
<div class="col-sm-6 col-md-4 col-lg-3">
<label class="select-label">@lang("settings.maps.label")</label>