From 18fcedfc834f149c9bfb8ddbfdc28ccbbde1aef2 Mon Sep 17 00:00:00 2001
From: Karl Hasselbring <Karl Hasselbring>
Date: Mon, 13 Nov 2017 09:59:49 +0100
Subject: [PATCH] Improved: Searchbar wird jetzt als part eingebunden und ist
 einheitlich auf start- und ergebnisseite

---
 gulpfile.js                                   |  10 +-
 public/js/searchbar.js                        | 359 ++++++++++++++++++
 resources/assets/js/scriptStartPage.js        | 341 -----------------
 resources/assets/js/searchbar.js              | 357 +++++++++++++++++
 resources/assets/less/metager/metager.less    |   3 +-
 .../assets/less/metager/result-page.less      |  32 --
 resources/assets/less/metager/searchbar.less  | 150 ++++++++
 resources/assets/less/metager/start-page.less | 131 -------
 resources/views/index.blade.php               |  79 +---
 .../views/layouts/researchandtabs.blade.php   |   3 +
 resources/views/layouts/resultPage.blade.php  |   5 +-
 resources/views/layouts/staticPages.blade.php |   4 +-
 .../views/{layouts => parts}/footer.blade.php |   0
 resources/views/parts/searchbar.blade.php     |  60 +++
 .../{layouts => parts}/utility.blade.php      |   2 +-
 15 files changed, 956 insertions(+), 580 deletions(-)
 create mode 100644 public/js/searchbar.js
 create mode 100644 resources/assets/js/searchbar.js
 create mode 100644 resources/assets/less/metager/searchbar.less
 rename resources/views/{layouts => parts}/footer.blade.php (100%)
 create mode 100644 resources/views/parts/searchbar.blade.php
 rename resources/views/{layouts => parts}/utility.blade.php (73%)

diff --git a/gulpfile.js b/gulpfile.js
index b38621034..eab976cd7 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -13,18 +13,12 @@ require('laravel-elixir-vue-2')
 elixir(function (mix) {
   mix.less('default.less', 'public/css/themes/default.css')
   /*
-   | Not mixed (specific pages only)
-   |
-   | widgets.js
-   | editLanguage.js
-   | kontakt.js
-   | scriptResultPage.js
-   | scriptStartPage.js
-   | settings.js
+   lib JS files not mixed (specific pages only)
   */
   mix.scripts(['lib/jquery.js', 'lib/jquery-ui.min.js', 'lib/bootstrap.js', 'lib/lightslider.js', 'lib/masonry.js', 'lib/imagesloaded.js', 'lib/openpgp.min.js', 'lib/iframeResizer.min.js', 'lib/md5.js'], 'public/js/lib.js')
   mix.scripts(['scriptStartPage.js', 'results.js'], 'public/js/scriptStartPage.js');
   mix.scripts(['scriptResultPage.js', 'results.js'], 'public/js/scriptResultPage.js');
+  mix.scripts(['searchbar.js'], 'public/js/searchbar.js');
   //mix.scripts(['scriptSubpages.js'], 'public/js/scriptSubpages.js');
   mix.less('metager/beitritt.less', 'public/css/beitritt.css')
   // utility
diff --git a/public/js/searchbar.js b/public/js/searchbar.js
new file mode 100644
index 000000000..733f48393
--- /dev/null
+++ b/public/js/searchbar.js
@@ -0,0 +1,359 @@
+$(function () {
+  loadLocalStorage();
+  setActionListeners();
+  loadInitialCustomFocuses();
+  checkFocusEditable();
+})
+
+/**
+ * Loads the user theme and stored settings from local storage
+ */
+function loadLocalStorage () {
+  if (localStorage) {
+    setSettings();
+  }
+}
+
+/**
+ * Sets all action listeners for this page
+ */
+function setActionListeners () {
+  $('.focusCheckbox').click(toggleDeleteButton);
+  $('#addFocusBtn').click(() => showFocusCreateDialog(''));
+  $('#editFocusBtn').click(editCurrentFocus);
+  $('.save-focus-btn').click(saveFocus);
+  $('.delete-focus-btn').click(deleteFocus);
+  $('#focus-select').change(checkFocusEditable);
+  // Save Focus on clicking enter while in the focus name input
+  $('#focus-name').keyup(function (event) {
+    if (event.keyCode == 13) {
+      saveFocus();
+    }
+  });
+  $('#create-focus-modal').on('shown.bs.modal', function () {
+    $('#focus-name').focus();
+  });
+}
+
+function setSettings() {
+  var acceptedParams = ['autocomplete', 'key', 'lang', 'newtab', 'sprueche'];
+  for (var key in localStorage) {
+    var value = localStorage.getItem(key);
+    var accepted = false;
+    for (var i in acceptedParams) {
+      if (key === 'param_' + acceptedParams[i]) {
+        accepted = true;
+      }
+    }
+    if (accepted) {
+      key = key.substring(6);
+      // Check for existing hidden fields for this key
+      var existing = $('.search-hidden input[name="' + key + '"]');
+      if (existing.length === 0) {
+        // if none exist, create a new one
+        $('.search-hidden').append('<input type="hidden" name="' + key + '" value="' + value + '">');
+      }
+    }
+  }
+  // Change the request method to the given parameter
+  var requestMethod = localStorage.getItem('request');
+  if (requestMethod !== null && (requestMethod === 'GET' || requestMethod === 'POST')) {
+    $('#searchForm').attr('method', requestMethod);
+  }
+}
+
+/**
+ * Loads all the custom focuses stored in local storage
+ */
+function loadInitialCustomFocuses () {
+  for (var key in localStorage) {
+    if (key.startsWith('focus_')) {
+      var focus = loadFocusById(key);
+      addFocus(focus.name);
+    }
+  }
+}
+/**
+ * Shows the focus create dialog
+ * If an id is given it will try to load a focus for the given id
+ */
+function showFocusCreateDialog (id) {
+  if (id === undefined) {
+    id = '';
+  }
+  document.getElementById('original-id').value = id;
+  $('#create-focus-modal').modal('show');
+  var storedFocus = loadFocusById(id);
+  var focus = {};
+  // Try to load a focus for the given id
+  $('#focus-name').val('');
+  uncheckAll();
+  if (storedFocus !== null) {
+    try {
+      focus = JSON.parse(localStorage.getItem(id));
+      $('#focus-name').val(focus.name);
+      for (var key in focus) {
+        if (key.startsWith('engine_')) {
+          $('.focusCheckbox[name=' + key + ']').prop('checked', true);
+        }
+      }
+    } catch (ex) {
+      console.error(ex);
+    }
+  }
+  toggleDeleteButton();
+}
+
+/**
+ * Shows the focus create dialog for a given id
+ */
+function showFocusEditDialog (id) {
+  showFocusCreateDialog(id);
+}
+
+function getCurrentFocus () {
+  return document.getElementById('focus-select').value;
+}
+
+/**
+ * Shows an edit dialog for the current selected focus
+ */
+function editCurrentFocus () {
+  console.log('hi');
+  var currentFocus = getCurrentFocus();
+  console.log(currentFocus);
+  showFocusEditDialog(currentFocus);
+}
+
+/**
+* Shows/Hides the delete button if (no) checkboxes are selected
+*/
+function toggleDeleteButton () {
+  if (atLeastOneChecked()) {
+    $('.delete-focus-btn').show();
+  } else {
+    $('.delete-focus-btn').hide();
+  }
+}
+
+/**
+ * Save the current Focus
+ * Listens for save button
+ */
+function saveFocus () {
+  /* Vorprüfungen */
+  // Falls keine Suchmaschine ausgewählt wurde
+  if (!atLeastOneChecked()) {
+    switch (document.documentElement.lang) {
+      case 'en':
+        alert('Please select at least 1 search engine.');
+        break;
+      case 'es':
+        alert('Por favor, seleccione al menos un motor de búsqueda.');
+        break;
+      default:
+        alert('Bitte mindestens 1 Suchmaschine auswählen.');
+        break;
+    }
+    return;
+  }
+  // Falls der Name zu kurz ist oder ungültige Zeichen enthält
+  var name = document.getElementById('focus-name').value;
+  if (!isValidName(name)) {
+    switch (document.documentElement.lang) {
+      case 'en':
+        alert('no Characters other then a-z, A-Z, 0-9, ä, ö, ü, ß, -, _ allowed, at least 1 character');
+        break;
+      case 'es':
+        alert(''); // TODO
+        break;
+      default:
+        alert(''); // TODO
+        break;
+    }
+    return;
+  }
+  // Liest die original-id des aktuellen fokus-dialogs (gesetzt wenn man einen Fokus bearbeitet)
+  var oldId = document.getElementById('original-id').value;
+  var id = getIdFromName(name);
+  var overwrite = true;
+  // Wenn bereits ein Fokus mit dem Namen existiert, man diesen aber nicht editiert sondern gerade einen Neuen erstellt
+  if (alreadyInUse(name) && oldId !== id) {
+    // Fragt den Nutzer ob er den Fokus überschreiben möchte
+    if (!confirm('Name bereits genutzt\nüberschreiben?')) {
+      // Falls nicht wird das Speichern abgebrochen
+      return;
+    }
+    // Ansonsten wird der andere Fokus gelöscht
+    deleteFocusById(id)
+  }
+  /* Fokus speichern */
+  var focus = {};
+  // Ausgewählte Suchmaschinen lesen und zu Fokus hinzufügen
+  $('input[type=checkbox]:checked').each(function (el) {
+    focus[$(this).attr('name')] = $(this).val();
+  });
+  // Name setzen
+  focus['name'] = name;
+  // Alte Version des Fokus löschen (aus localStorage und von der Webseite, falls eine existiert)
+  if (oldId !== '') {
+    localStorage.removeItem(oldId);
+    removeFocusById(oldId);
+  }
+  // Neue Version des Fokus hinzufügen (zu localStorage und der Webseite)
+  localStorage.setItem(id, JSON.stringify(focus));
+  addFocus(name);
+  setFocus(id);
+  // Fokus-Formular verbergen
+  $('#create-focus-modal').modal('hide');
+}
+
+/**
+ * Delete current Focus
+ * Listens for delete button
+ */
+function deleteFocusById (id) {
+  localStorage.removeItem(id);
+  removeFocusById(id);
+  $('#focus-select').change();
+}
+
+/**
+ * Delete current Focus
+ * Listens for delete button
+ */
+function deleteFocus () {
+  var oldId = document.getElementById('original-id').value;
+  deleteFocusById(oldId)
+  $('#create-focus-modal').modal('hide');
+  $('#focus-select').change();
+}
+
+/**
+ * Is the name valid (in terms of characters)?
+ */
+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);
+}
+
+/**
+ * Is at least one focus selected?
+ */
+function atLeastOneChecked () {
+  return $('.focusCheckbox:checked').length > 0;
+}
+
+/**
+ * Is there already a focus with this name?
+ */
+function alreadyInUse (name) {
+  return localStorage.hasOwnProperty(getIdFromName(name));
+}
+
+/**
+ * Adds an option to the focus selector
+ */
+function addFocus (name) {
+  var id = getIdFromName(name);
+  $('#focus-select').append('<option value="' + id + '" style="font-family: FontAwesome, sans-serif;">&#xf2c0; ' + name + '</option>');
+}
+
+/**
+ * Remove the focuses html-elements
+ */
+function removeFocus (name) {
+  removeFocusById(getIdFromName(name));
+}
+
+/**
+ * Remove the focuses html-elements
+ */
+function removeFocusById (id) {
+  if (id == '') {
+    return;
+  }
+  $('#focus-select option[value="' + id + '"]').remove();
+}
+
+/**
+ * Turns a name into an id
+ * Converts special characters and spaces
+ */
+function getIdFromName (name) {
+  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;
+}
+
+/**
+ * Loads the focus object for the given id from local storage
+ */
+function loadFocusById (id) {
+  return JSON.parse(localStorage.getItem(id));
+}
+
+/**
+ * Unchecks all focuses from the focus creator dialog
+ */
+function uncheckAll () {
+  $('.focusCheckbox').prop('checked', false);
+}
+
+/**
+ * Sets the selected focus to default
+ */
+function setFocusToDefault () {
+  setFocus(DEFAULT_FOCUS);
+}
+
+/**
+ * Sets the selected focus
+ * @param {String} focusID The id of the focus, without #
+ */
+function setFocus (focusID) {
+  $('#focus-select option[value="' + focusID + '"]').prop('selected', true);
+  $('#focus-select').change();
+}
+
+function checkFocusEditable () {
+  if (getCurrentFocus().startsWith('focus_')) {
+    enableEditFocusBtn();
+  } else {
+    disableEditFocusBtn();
+  }
+}
+
+function enableEditFocusBtn () {
+  $('#editFocusBtn').removeClass('disabled').click(editCurrentFocus);
+}
+
+function disableEditFocusBtn () {
+  $('#editFocusBtn').addClass('disabled').off('click');
+}
+
+function loadSavedResults () {
+  var results = new Results();
+  if (results.length > 0) {
+    var html = $('\
+    <div class="focus">\
+      <input id="savedResults" class="focus-radio hide" name="focus" value="container" form="searchForm" type="radio" required="">\
+      <label id="saved-results-label" class="focus-label" for="savedResults">\
+        <span class="glyphicon glyphicon-floppy-disk"></span>\
+        <span class="content">gespeicherte Ergebnisse</span>\
+        <span class="badge">' + results.length + '</span>\
+      </label>\
+    </div>\
+    ');
+    $('#addFocusBtnDiv').before(html);
+    $('#foki input#savedResults').change(function () {
+      if ($(this).prop('checked')) $('#searchForm').submit();
+    });
+  }
+}
+
+//# sourceMappingURL=searchbar.js.map
diff --git a/resources/assets/js/scriptStartPage.js b/resources/assets/js/scriptStartPage.js
index 10cc5fdf0..af3617010 100644
--- a/resources/assets/js/scriptStartPage.js
+++ b/resources/assets/js/scriptStartPage.js
@@ -10,9 +10,7 @@ $(document).ready(function () {
 
   loadLocalStorage();
   setActionListeners();
-  loadInitialCustomFocuses();
   loadSavedResults();
-  checkFocusEditable();
 });
 
 /**
@@ -59,51 +57,12 @@ function setActionListeners () {
       window.location = './settings/';
     });
   }
-  $('.focusCheckbox').click(toggleDeleteButton);
-  $('#addFocusBtn').click(() => showFocusCreateDialog(''));
-  $('#editFocusBtn').click(editCurrentFocus);
-  $('.save-focus-btn').click(saveFocus);
-  $('.delete-focus-btn').click(deleteFocus);
-  $('#focus-select').change(checkFocusEditable);
-  // Save Focus on clicking enter while in the focus name input
-  $('#focus-name').keyup(function (event) {
-    if (event.keyCode == 13) {
-      saveFocus();
-    }
-  });
-  $('#create-focus-modal').on('shown.bs.modal', function () {
-    $('#focus-name').focus();
-  });
 }
 
 /**
  * Loads stored settings from local storage
  */
 function setSettings () {
-  var acceptedParams = ['autocomplete', 'key', 'lang', 'newtab', 'sprueche'];
-  for (var key in localStorage) {
-    var value = localStorage.getItem(key);
-    var accepted = false;
-    for (var i in acceptedParams) {
-      if (key === 'param_' + acceptedParams[i]) {
-        accepted = true;
-      }
-    }
-    if (accepted) {
-      key = key.substring(6);
-      // Check for existing hidden fields for this key
-      var existing = $('.search-hidden input[name="' + key + '"]');
-      if (existing.length === 0) {
-        // if none exist, create a new one
-        $('.search-hidden').append('<input type="hidden" name="' + key + '" value="' + value + '">');
-      }
-    }
-  }
-  // Change the request method to the given parameter
-  var requestMethod = localStorage.getItem('request');
-  if (requestMethod !== null && (requestMethod === 'GET' || requestMethod === 'POST')) {
-    $('#searchForm').attr('method', requestMethod);
-  }
   if ($('fieldset#foki.mobile').length) {
     $('fieldset.mobile input#bilder').val('angepasst');
     $('fieldset.mobile input#bilder').prop('checked', true);
@@ -196,306 +155,6 @@ var isChrome = !!window.chrome && !!window.chrome.webstore;
 // Blink engine detection
 var isBlink = (isChrome || isOpera) && !!window.CSS;
 // Prüft, ob der URL-Parameter "usage" auf "once" gesetzt ist.
-function isUseOnce () {
-  var url = document.location.search;
-  var pos = url.indexOf('usage=');
-  if (pos >= 0 && url.substring(pos + 6, pos + 11) == 'once') {
-    return true;
-  } else {
-    return false;
-  }
-}
-/**
- * Loads all the custom focuses stored in local storage
- */
-function loadInitialCustomFocuses () {
-  for (var key in localStorage) {
-    if (key.startsWith('focus_')) {
-      var focus = loadFocusById(key);
-      addFocus(focus.name);
-    }
-  }
-}
-/**
- * Shows the focus create dialog
- * If an id is given it will try to load a focus for the given id
- */
-function showFocusCreateDialog (id) {
-  if (id === undefined) {
-    id = '';
-  }
-  document.getElementById('original-id').value = id;
-  $('#create-focus-modal').modal('show');
-  var storedFocus = loadFocusById(id);
-  var focus = {};
-  // Try to load a focus for the given id
-  $('#focus-name').val('');
-  uncheckAll();
-  if (storedFocus !== null) {
-    try {
-      focus = JSON.parse(localStorage.getItem(id));
-      $('#focus-name').val(focus.name);
-      for (var key in focus) {
-        if (key.startsWith('engine_')) {
-          $('.focusCheckbox[name=' + key + ']').prop('checked', true);
-        }
-      }
-    } catch (ex) {
-      console.error(ex);
-    }
-  }
-  toggleDeleteButton();
-}
-
-/**
- * Shows the focus create dialog for a given id
- */
-function showFocusEditDialog (id) {
-  showFocusCreateDialog(id);
-}
-
-function getCurrentFocus () {
-  return document.getElementById('focus-select').value;
-}
-
-/**
- * Shows an edit dialog for the current selected focus
- */
-function editCurrentFocus () {
-  console.log('hi');
-  var currentFocus = getCurrentFocus();
-  console.log(currentFocus);
-  showFocusEditDialog(currentFocus);
-}
-
-/**
-* Shows/Hides the delete button if (no) checkboxes are selected
-*/
-function toggleDeleteButton () {
-  if (atLeastOneChecked()) {
-    $('.delete-focus-btn').show();
-  } else {
-    $('.delete-focus-btn').hide();
-  }
-}
-
-/**
- * Save the current Focus
- * Listens for save button
- */
-function saveFocus () {
-  /* Vorprüfungen */
-  // Falls keine Suchmaschine ausgewählt wurde
-  if (!atLeastOneChecked()) {
-    switch (document.documentElement.lang) {
-      case 'en':
-        alert('Please select at least 1 search engine.');
-        break;
-      case 'es':
-        alert('Por favor, seleccione al menos un motor de búsqueda.');
-        break;
-      default:
-        alert('Bitte mindestens 1 Suchmaschine auswählen.');
-        break;
-    }
-    return;
-  }
-  // Falls der Name zu kurz ist oder ungültige Zeichen enthält
-  var name = document.getElementById('focus-name').value;
-  if (!isValidName(name)) {
-    switch (document.documentElement.lang) {
-      case 'en':
-        alert('no Characters other then a-z, A-Z, 0-9, ä, ö, ü, ß, -, _ allowed, at least 1 character');
-        break;
-      case 'es':
-        alert(''); // TODO
-        break;
-      default:
-        alert(''); // TODO
-        break;
-    }
-    return;
-  }
-  // Liest die original-id des aktuellen fokus-dialogs (gesetzt wenn man einen Fokus bearbeitet)
-  var oldId = document.getElementById('original-id').value;
-  var id = getIdFromName(name);
-  var overwrite = true;
-  // Wenn bereits ein Fokus mit dem Namen existiert, man diesen aber nicht editiert sondern gerade einen Neuen erstellt
-  if (alreadyInUse(name) && oldId !== id) {
-    // Fragt den Nutzer ob er den Fokus überschreiben möchte
-    if (!confirm('Name bereits genutzt\nüberschreiben?')) {
-      // Falls nicht wird das Speichern abgebrochen
-      return;
-    }
-    // Ansonsten wird der andere Fokus gelöscht
-    deleteFocusById(id)
-  }
-  /* Fokus speichern */
-  var focus = {};
-  // Ausgewählte Suchmaschinen lesen und zu Fokus hinzufügen
-  $('input[type=checkbox]:checked').each(function (el) {
-    focus[$(this).attr('name')] = $(this).val();
-  });
-  // Name setzen
-  focus['name'] = name;
-  // Alte Version des Fokus löschen (aus localStorage und von der Webseite, falls eine existiert)
-  if (oldId !== '') {
-    localStorage.removeItem(oldId);
-    removeFocusById(oldId);
-  }
-  // Neue Version des Fokus hinzufügen (zu localStorage und der Webseite)
-  localStorage.setItem(id, JSON.stringify(focus));
-  addFocus(name);
-  setFocus(id);
-  // Fokus-Formular verbergen
-  $('#create-focus-modal').modal('hide');
-}
-
-/**
- * Delete current Focus
- * Listens for delete button
- */
-function deleteFocusById (id) {
-  localStorage.removeItem(id);
-  removeFocusById(id);
-  $('#focus-select').change();
-}
-
-/**
- * Delete current Focus
- * Listens for delete button
- */
-function deleteFocus () {
-  var oldId = document.getElementById('original-id').value;
-  deleteFocusById(oldId)
-  $('#create-focus-modal').modal('hide');
-  $('#focus-select').change();
-}
-
-/**
- * Is the name valid (in terms of characters)?
- */
-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);
-}
-
-/**
- * Is at least one focus selected?
- */
-function atLeastOneChecked () {
-  return $('.focusCheckbox:checked').length > 0;
-}
-
-/**
- * Is there already a focus with this name?
- */
-function alreadyInUse (name) {
-  return localStorage.hasOwnProperty(getIdFromName(name));
-}
-
-/**
- * Adds an option to the focus selector
- */
-function addFocus (name) {
-  var id = getIdFromName(name);
-  $('#focus-select').append('<option value="' + id + '" style="font-family: FontAwesome, sans-serif;">&#xf2c0; ' + name + '</option>');
-}
-
-/**
- * Remove the focuses html-elements
- */
-function removeFocus (name) {
-  removeFocusById(getIdFromName(name));
-}
-
-/**
- * Remove the focuses html-elements
- */
-function removeFocusById (id) {
-  if (id == '') {
-    return;
-  }
-  $('#focus-select option[value="' + id + '"]').remove();
-}
-
-/**
- * Turns a name into an id
- * Converts special characters and spaces
- */
-function getIdFromName (name) {
-  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;
-}
-
-/**
- * Loads the focus object for the given id from local storage
- */
-function loadFocusById (id) {
-  return JSON.parse(localStorage.getItem(id));
-}
-
-/**
- * Unchecks all focuses from the focus creator dialog
- */
-function uncheckAll () {
-  $('.focusCheckbox').prop('checked', false);
-}
-
-/**
- * Resets all settings
- */
-function resetOptions () {
-  localStorage.removeItem('pers');
-  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_' || key.startsWith('focus'))) {
-      localStorage.removeItem(key);
-    }
-  }
-}
-
-/**
- * Sets the selected focus to default
- */
-function setFocusToDefault () {
-  setFocus(DEFAULT_FOCUS);
-}
-
-/**
- * Sets the selected focus
- * @param {String} focusID The id of the focus, without #
- */
-function setFocus (focusID) {
-  $('#focus-select option[value="' + focusID + '"]').prop('selected', true);
-  $('#focus-select').change();
-}
-
-function checkFocusEditable () {
-  if (getCurrentFocus().startsWith('focus_')) {
-    enableEditFocusBtn();
-  } else {
-    disableEditFocusBtn();
-  }
-}
-
-function enableEditFocusBtn () {
-  $('#editFocusBtn').removeClass('disabled').click(editCurrentFocus);
-}
-
-function disableEditFocusBtn () {
-  $('#editFocusBtn').addClass('disabled').off('click');
-}
 
 function loadSavedResults () {
   var results = new Results();
diff --git a/resources/assets/js/searchbar.js b/resources/assets/js/searchbar.js
new file mode 100644
index 000000000..dbe91e6ef
--- /dev/null
+++ b/resources/assets/js/searchbar.js
@@ -0,0 +1,357 @@
+$(function () {
+  loadLocalStorage();
+  setActionListeners();
+  loadInitialCustomFocuses();
+  checkFocusEditable();
+})
+
+/**
+ * Loads the user theme and stored settings from local storage
+ */
+function loadLocalStorage () {
+  if (localStorage) {
+    setSettings();
+  }
+}
+
+/**
+ * Sets all action listeners for this page
+ */
+function setActionListeners () {
+  $('.focusCheckbox').click(toggleDeleteButton);
+  $('#addFocusBtn').click(() => showFocusCreateDialog(''));
+  $('#editFocusBtn').click(editCurrentFocus);
+  $('.save-focus-btn').click(saveFocus);
+  $('.delete-focus-btn').click(deleteFocus);
+  $('#focus-select').change(checkFocusEditable);
+  // Save Focus on clicking enter while in the focus name input
+  $('#focus-name').keyup(function (event) {
+    if (event.keyCode == 13) {
+      saveFocus();
+    }
+  });
+  $('#create-focus-modal').on('shown.bs.modal', function () {
+    $('#focus-name').focus();
+  });
+}
+
+function setSettings() {
+  var acceptedParams = ['autocomplete', 'key', 'lang', 'newtab', 'sprueche'];
+  for (var key in localStorage) {
+    var value = localStorage.getItem(key);
+    var accepted = false;
+    for (var i in acceptedParams) {
+      if (key === 'param_' + acceptedParams[i]) {
+        accepted = true;
+      }
+    }
+    if (accepted) {
+      key = key.substring(6);
+      // Check for existing hidden fields for this key
+      var existing = $('.search-hidden input[name="' + key + '"]');
+      if (existing.length === 0) {
+        // if none exist, create a new one
+        $('.search-hidden').append('<input type="hidden" name="' + key + '" value="' + value + '">');
+      }
+    }
+  }
+  // Change the request method to the given parameter
+  var requestMethod = localStorage.getItem('request');
+  if (requestMethod !== null && (requestMethod === 'GET' || requestMethod === 'POST')) {
+    $('#searchForm').attr('method', requestMethod);
+  }
+}
+
+/**
+ * Loads all the custom focuses stored in local storage
+ */
+function loadInitialCustomFocuses () {
+  for (var key in localStorage) {
+    if (key.startsWith('focus_')) {
+      var focus = loadFocusById(key);
+      addFocus(focus.name);
+    }
+  }
+}
+/**
+ * Shows the focus create dialog
+ * If an id is given it will try to load a focus for the given id
+ */
+function showFocusCreateDialog (id) {
+  if (id === undefined) {
+    id = '';
+  }
+  document.getElementById('original-id').value = id;
+  $('#create-focus-modal').modal('show');
+  var storedFocus = loadFocusById(id);
+  var focus = {};
+  // Try to load a focus for the given id
+  $('#focus-name').val('');
+  uncheckAll();
+  if (storedFocus !== null) {
+    try {
+      focus = JSON.parse(localStorage.getItem(id));
+      $('#focus-name').val(focus.name);
+      for (var key in focus) {
+        if (key.startsWith('engine_')) {
+          $('.focusCheckbox[name=' + key + ']').prop('checked', true);
+        }
+      }
+    } catch (ex) {
+      console.error(ex);
+    }
+  }
+  toggleDeleteButton();
+}
+
+/**
+ * Shows the focus create dialog for a given id
+ */
+function showFocusEditDialog (id) {
+  showFocusCreateDialog(id);
+}
+
+function getCurrentFocus () {
+  return document.getElementById('focus-select').value;
+}
+
+/**
+ * Shows an edit dialog for the current selected focus
+ */
+function editCurrentFocus () {
+  console.log('hi');
+  var currentFocus = getCurrentFocus();
+  console.log(currentFocus);
+  showFocusEditDialog(currentFocus);
+}
+
+/**
+* Shows/Hides the delete button if (no) checkboxes are selected
+*/
+function toggleDeleteButton () {
+  if (atLeastOneChecked()) {
+    $('.delete-focus-btn').show();
+  } else {
+    $('.delete-focus-btn').hide();
+  }
+}
+
+/**
+ * Save the current Focus
+ * Listens for save button
+ */
+function saveFocus () {
+  /* Vorprüfungen */
+  // Falls keine Suchmaschine ausgewählt wurde
+  if (!atLeastOneChecked()) {
+    switch (document.documentElement.lang) {
+      case 'en':
+        alert('Please select at least 1 search engine.');
+        break;
+      case 'es':
+        alert('Por favor, seleccione al menos un motor de búsqueda.');
+        break;
+      default:
+        alert('Bitte mindestens 1 Suchmaschine auswählen.');
+        break;
+    }
+    return;
+  }
+  // Falls der Name zu kurz ist oder ungültige Zeichen enthält
+  var name = document.getElementById('focus-name').value;
+  if (!isValidName(name)) {
+    switch (document.documentElement.lang) {
+      case 'en':
+        alert('no Characters other then a-z, A-Z, 0-9, ä, ö, ü, ß, -, _ allowed, at least 1 character');
+        break;
+      case 'es':
+        alert(''); // TODO
+        break;
+      default:
+        alert(''); // TODO
+        break;
+    }
+    return;
+  }
+  // Liest die original-id des aktuellen fokus-dialogs (gesetzt wenn man einen Fokus bearbeitet)
+  var oldId = document.getElementById('original-id').value;
+  var id = getIdFromName(name);
+  var overwrite = true;
+  // Wenn bereits ein Fokus mit dem Namen existiert, man diesen aber nicht editiert sondern gerade einen Neuen erstellt
+  if (alreadyInUse(name) && oldId !== id) {
+    // Fragt den Nutzer ob er den Fokus überschreiben möchte
+    if (!confirm('Name bereits genutzt\nüberschreiben?')) {
+      // Falls nicht wird das Speichern abgebrochen
+      return;
+    }
+    // Ansonsten wird der andere Fokus gelöscht
+    deleteFocusById(id)
+  }
+  /* Fokus speichern */
+  var focus = {};
+  // Ausgewählte Suchmaschinen lesen und zu Fokus hinzufügen
+  $('input[type=checkbox]:checked').each(function (el) {
+    focus[$(this).attr('name')] = $(this).val();
+  });
+  // Name setzen
+  focus['name'] = name;
+  // Alte Version des Fokus löschen (aus localStorage und von der Webseite, falls eine existiert)
+  if (oldId !== '') {
+    localStorage.removeItem(oldId);
+    removeFocusById(oldId);
+  }
+  // Neue Version des Fokus hinzufügen (zu localStorage und der Webseite)
+  localStorage.setItem(id, JSON.stringify(focus));
+  addFocus(name);
+  setFocus(id);
+  // Fokus-Formular verbergen
+  $('#create-focus-modal').modal('hide');
+}
+
+/**
+ * Delete current Focus
+ * Listens for delete button
+ */
+function deleteFocusById (id) {
+  localStorage.removeItem(id);
+  removeFocusById(id);
+  $('#focus-select').change();
+}
+
+/**
+ * Delete current Focus
+ * Listens for delete button
+ */
+function deleteFocus () {
+  var oldId = document.getElementById('original-id').value;
+  deleteFocusById(oldId)
+  $('#create-focus-modal').modal('hide');
+  $('#focus-select').change();
+}
+
+/**
+ * Is the name valid (in terms of characters)?
+ */
+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);
+}
+
+/**
+ * Is at least one focus selected?
+ */
+function atLeastOneChecked () {
+  return $('.focusCheckbox:checked').length > 0;
+}
+
+/**
+ * Is there already a focus with this name?
+ */
+function alreadyInUse (name) {
+  return localStorage.hasOwnProperty(getIdFromName(name));
+}
+
+/**
+ * Adds an option to the focus selector
+ */
+function addFocus (name) {
+  var id = getIdFromName(name);
+  $('#focus-select').append('<option value="' + id + '" style="font-family: FontAwesome, sans-serif;">&#xf2c0; ' + name + '</option>');
+}
+
+/**
+ * Remove the focuses html-elements
+ */
+function removeFocus (name) {
+  removeFocusById(getIdFromName(name));
+}
+
+/**
+ * Remove the focuses html-elements
+ */
+function removeFocusById (id) {
+  if (id == '') {
+    return;
+  }
+  $('#focus-select option[value="' + id + '"]').remove();
+}
+
+/**
+ * Turns a name into an id
+ * Converts special characters and spaces
+ */
+function getIdFromName (name) {
+  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;
+}
+
+/**
+ * Loads the focus object for the given id from local storage
+ */
+function loadFocusById (id) {
+  return JSON.parse(localStorage.getItem(id));
+}
+
+/**
+ * Unchecks all focuses from the focus creator dialog
+ */
+function uncheckAll () {
+  $('.focusCheckbox').prop('checked', false);
+}
+
+/**
+ * Sets the selected focus to default
+ */
+function setFocusToDefault () {
+  setFocus(DEFAULT_FOCUS);
+}
+
+/**
+ * Sets the selected focus
+ * @param {String} focusID The id of the focus, without #
+ */
+function setFocus (focusID) {
+  $('#focus-select option[value="' + focusID + '"]').prop('selected', true);
+  $('#focus-select').change();
+}
+
+function checkFocusEditable () {
+  if (getCurrentFocus().startsWith('focus_')) {
+    enableEditFocusBtn();
+  } else {
+    disableEditFocusBtn();
+  }
+}
+
+function enableEditFocusBtn () {
+  $('#editFocusBtn').removeClass('disabled').click(editCurrentFocus);
+}
+
+function disableEditFocusBtn () {
+  $('#editFocusBtn').addClass('disabled').off('click');
+}
+
+function loadSavedResults () {
+  var results = new Results();
+  if (results.length > 0) {
+    var html = $('\
+    <div class="focus">\
+      <input id="savedResults" class="focus-radio hide" name="focus" value="container" form="searchForm" type="radio" required="">\
+      <label id="saved-results-label" class="focus-label" for="savedResults">\
+        <span class="glyphicon glyphicon-floppy-disk"></span>\
+        <span class="content">gespeicherte Ergebnisse</span>\
+        <span class="badge">' + results.length + '</span>\
+      </label>\
+    </div>\
+    ');
+    $('#addFocusBtnDiv').before(html);
+    $('#foki input#savedResults').change(function () {
+      if ($(this).prop('checked')) $('#searchForm').submit();
+    });
+  }
+}
diff --git a/resources/assets/less/metager/metager.less b/resources/assets/less/metager/metager.less
index 671b3ecf0..70fb8159a 100644
--- a/resources/assets/less/metager/metager.less
+++ b/resources/assets/less/metager/metager.less
@@ -6,4 +6,5 @@
 @import "./settings.less";
 @import "./variables.less";
 @import "./sidebar.less";
-@import "./footer.less";
\ No newline at end of file
+@import "./footer.less";
+@import "./searchbar.less";
\ No newline at end of file
diff --git a/resources/assets/less/metager/result-page.less b/resources/assets/less/metager/result-page.less
index bc99cb711..ddc217ad2 100644
--- a/resources/assets/less/metager/result-page.less
+++ b/resources/assets/less/metager/result-page.less
@@ -310,38 +310,6 @@ a {
     flex-grow: 1;
 }
 
-.searchbar {
-    margin-top: 5px;
-    display: flex;
-    align-items: center;
-    border-left: #bbb solid 1px;
-    .search-input {
-        order: 2;
-        border: none;
-        box-shadow: none !important;
-        border: white solid 1px;
-        font-size: 16px;
-        &:focus {
-            border: #bbb dotted 1px;
-            background-color: #eee;
-            -webkit-box-shadow: none;
-            -moz-box-shadow: none;
-            box-shadow: none;
-        }
-    }
-    .search-reset {
-        order: 1;
-        border: none;
-        background-color: transparent;
-        color: #444;
-    }
-    .search-submit {
-        order: 3;
-        color: #bbb;
-        font-size: 20px;
-    }
-}
-
 .result {
     margin-top: 20px;
     margin-bottom: 40px;
diff --git a/resources/assets/less/metager/searchbar.less b/resources/assets/less/metager/searchbar.less
new file mode 100644
index 000000000..a8c83dbd5
--- /dev/null
+++ b/resources/assets/less/metager/searchbar.less
@@ -0,0 +1,150 @@
+.searchbar {
+    display: flex;
+    align-items: stretch;
+    font-size: 16px;
+    background-color: white;
+    .search-focus-selector {
+        background-color: transparent;
+        border-radius: 5px 0px 0px 5px;
+        select {
+            width: 100%;
+            color: #777;
+            -webkit-appearance: none;
+            -moz-appearance: none;
+            appearance: none;
+            background-color: transparent;
+            padding-right: 35px;
+        }
+    }
+    .search-add-focus {
+        display: flex;
+        button {
+            background-color: white;
+            border: none;
+            padding: 0px 8px;
+            font-size: 16px;
+            &:hover {
+                background-color: #e6e6e6;
+            }
+        }
+    }
+    .search-edit-focus {
+        display: flex;
+        button {
+            background-color: white;
+            border: none;
+            padding: 0px 8px;
+            font-size: 16px;
+            &:hover {
+                background-color: #e6e6e6;
+            }
+        }
+    }
+    .search-settings {
+        display: flex;
+        a.btn {
+            border: none;
+            padding: 0px 8px;
+            display: flex;
+            align-items: center;
+            font-size: 16px;
+        }
+    }
+    .search-input-submit {
+        flex-grow: 1;
+        display: flex;
+    }
+    .search-input {
+        flex-grow: 1;
+        input {
+            border: none;
+            height: 40px;
+            &:focus {
+                outline-color: rgb(255, 128, 0);
+                -webkit-box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
+                -moz-box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
+                box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
+                border-color: rgba(255, 128, 0, 1);
+            }
+        }
+    }
+    .search-submit {
+        button {
+            width: 50px;
+            line-height: 100%;
+            border: 0;
+            background-color: transparent;
+            padding: 0;
+            height: 100%;
+        }
+    }
+    .search-hidden {
+        display: none;
+    }
+    @media (max-width: @screen-xs-max) {
+        flex-direction: column-reverse;
+    }
+}
+
+.search-focus-selector {
+    background-color: white;
+    position: relative;
+    text-overflow: ellipsis;
+    &:after {
+        content: "\f078";
+        font: 15px "FontAwesome", sans-serif; //text-align: center;
+        line-height: 30px;
+        color: #aaa;
+        background-color: transparent;
+        right: 8px;
+        top: 2px;
+        padding: 2px 2px 2px 5px;
+        border-left: 1px solid #aaa;
+        position: absolute;
+        pointer-events: none;
+    }
+}
+
+.searchform-bonus {
+    li {
+        margin: 5px;
+    }
+}
+
+.startpage-searchbar {
+    >* {
+        border: 1px solid #aaa;
+        &:not(:first-child) {
+            border-left: none;
+        }
+    }
+    .search-input-submit {
+        border-radius: 0px 5px 5px 0px;
+    }
+    .search-submit {
+        border-left: 1px solid #aaa;
+    }
+    @media (max-width: @screen-xs-max) {
+        .search-focus-selector {
+            border: 1px solid #aaa;
+            border-top: none;
+            border-radius: 5px;
+        }
+        .search-input-submit {
+            border: 1px solid #aaa;
+            border-radius: 5px;
+        }
+    }
+}
+
+.resultpage-searchbar {
+    margin: 5px 0px 0px 5px;
+    border-left: #bbb solid 1px;
+    >* {
+        border-left: 1px solid #aaa;
+        background-color: transparent;
+	}
+	:first-child {
+		border-left: none;
+	}
+}
\ No newline at end of file
diff --git a/resources/assets/less/metager/start-page.less b/resources/assets/less/metager/start-page.less
index 7cb529801..321b93044 100644
--- a/resources/assets/less/metager/start-page.less
+++ b/resources/assets/less/metager/start-page.less
@@ -8,137 +8,6 @@
     }
 }
 
-.search-bar {
-    display: flex;
-    align-items: stretch;
-    font-size: 16px;
-    background-color: white;
-    >* {
-        border: 1px solid #aaa;
-        background-color: transparent;
-        &:not(:first-child) {
-            border-left: none;
-        }
-    }
-    .search-focus-selector {
-        background-color: transparent;
-        border-radius: 5px 0px 0px 5px;
-        select {
-            width: 100%;
-            color: #777;
-            -webkit-appearance: none;
-            -moz-appearance: none;
-            appearance: none;
-            background-color: transparent;
-            padding-right: 35px;
-        }
-    }
-    .search-add-focus {
-        display: flex;
-        button {
-            background-color: white;
-            border: none;
-            padding: 0px 8px;
-            font-size: 16px;
-            &:hover {
-                background-color: #e6e6e6;
-            }
-        }
-    }
-    .search-edit-focus {
-        display: flex;
-        button {
-            background-color: white;
-            border: none;
-            padding: 0px 8px;
-            font-size: 16px;
-            &:hover {
-                background-color: #e6e6e6;
-            }
-        }
-    }
-    .search-settings {
-        display: flex;
-        a.btn {
-            border: none;
-            padding: 0px 8px;
-            display: flex;
-            align-items: center;
-            font-size: 16px;
-        }
-    }
-    .search-input-submit {
-        flex-grow: 1;
-        border-radius: 0px 5px 5px 0px;
-        display: flex;
-    }
-    .search-input {
-        flex-grow: 1;
-        input {
-            border: none;
-            height: 40px;
-            &:focus {
-                outline-color: rgb(255, 128, 0);
-                -webkit-box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
-                -moz-box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
-                box-shadow: 0px 0px 2px 2px rgba(255, 128, 0, 1);
-                border-color: rgba(255, 128, 0, 1);
-            }
-        }
-    }
-    .search-submit {
-        border-left: 1px solid #aaa;
-        button {
-            width: 50px;
-            line-height: 100%;
-            border: 0;
-            background-color: transparent;
-            padding: 0;
-            height: 100%;
-        }
-    }
-    .search-hidden {
-        display: none;
-    }
-    @media (max-width: @screen-xs-max) {
-        flex-direction: column-reverse;
-        .search-focus-selector {
-            border: 1px solid #aaa;
-            border-top: none;
-            border-radius: 5px;
-        }
-        .search-input-submit {
-            border: 1px solid #aaa;
-            border-radius: 5px;
-        }
-    }
-}
-
-.search-focus-selector {
-    background-color: white;
-    position: relative;
-    text-overflow: ellipsis;
-    &:after {
-        content: "\f078";
-        font: 15px "FontAwesome", sans-serif; //text-align: center;
-        line-height: 30px;
-        color: #aaa;
-        background-color: transparent;
-        right: 8px;
-        top: 2px;
-        padding: 2px 2px 2px 5px;
-        border-left: 1px solid #aaa;
-        position: absolute;
-        pointer-events: none;
-    }
-}
-
-.searchform-bonus {
-    li {
-        margin: 5px;
-    }
-}
-
 .settings-modal-buttons {
     padding: 5px;
     button {
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index 70d7fb510..5c92e81a8 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -6,68 +6,23 @@
 	@include('modals.plugin-modal')
 	@include('modals.create-focus-modal')
 	<h1 id="mglogo"><a class="hidden-xs" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}">MetaGer</a></h1>
-		<fieldset>
-			<form id="searchForm" method={{ $request }} action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3") }}" accept-charset="UTF-8">
-				<div class="search-bar">
-					<div class="search-focus-selector">
-						<select id="focus-select" name="focus" style="font-family: FontAwesome, sans-serif;">
-							<option value="web" style="font-family: FontAwesome, sans-serif;" selected >&#xf0ac; Websuche</option>
-							<option value="nachrichten" style="font-family: FontAwesome, sans-serif;" >&#xf0a1; Nachrichtensuche</option>
-							<option value="wissenschaft" style="font-family: FontAwesome, sans-serif;" >&#xf15c; Wissenschaftssuche</option>
-							<option value="produktsuche" style="font-family: FontAwesome, sans-serif;" >&#xf07a; Produktsuche</option>
-							<option value="maps" style="font-family: FontAwesome, sans-serif;" >&#xf279; Kartensuche</option>
-						</select>
-					</div>
-					<div class="search-add-focus js-only">
-						<button type="button" id="addFocusBtn" title="@lang('index.add-focus')"><i class="fa fa-plus"></i></button>
-					</div>
-					<div class="search-edit-focus js-only">
-						<button type="button" id="editFocusBtn" title="@lang('index.edit-focus')"><i class="fa fa-wrench"></i></button>
-					</div>
-					<div class="search-settings">
-						<a id="settings-btn" class="mutelink btn btn-default" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "settings") }}">
-							<i class="fa fa-cog" aria-hidden="true"></i>
-						</a>
-					</div>
-					<div class="search-input-submit">
-						<div class="search-input">
-							<input type="text" name="eingabe" required="" autofocus="" autocomplete="{{$autocomplete}}" class="form-control" placeholder="{{ trans('index.placeholder') }}">
-						</div>
-						<div class="search-submit" id="submit-inputgroup">
-							<button type="submit">
-								<i class="fa fa-search" aria-hidden="true"></i>
-							</button>
-						</div>
-					</div>
-					<div class="search-hidden">
-						<input type="hidden" name="encoding" value="utf8">
-						@foreach($option_values as $option => $value)
-							<input type="hidden" name={{ $option }} value={{ $value }}>
-						@endforeach
-						<input type="hidden" name="time" value={{ $time }}>
-						@foreach ($focusPages as $fp)
-							<input type="hidden" name={{ $fp }} value="on">
-						@endforeach
-						<input type="hidden" name="theme" value={{ $theme }}>
-					</div>
-				</div>
-			</form>
-		</fieldset>
-		<ul class="list-inline searchform-bonus hidden">
-			<li id="plug"
-			@unless ($browser === 'Firefox' || $browser === 'Mozilla' || $browser === 'Chrome' || $browser === 'Opera' || $browser === 'IE' || $browser === 'Edge' || $browser === 'Safari' || $browser === 'Vivaldi')
-				class="hidden"
-			@endunless>
-			<a href="#" data-toggle="modal" data-target="#plugin-modal" class="btn btn-default mutelink" title="{{ trans('index.plugintitle') }}"><i class="fa fa-plug" aria-hidden="true"></i> {{ trans('index.plugin') }}</a></li>
-			@if (LaravelLocalization::getCurrentLocale() == "de")
-			<li>
-				<a href="https://suma-ev.de/presse/Werbefreie-Suche-mit-MetaGer.html" target="_blank" class="btn btn-default mutelink">
-						Werbefreie Suche mit MetaGer
-				</a>
-			</li>
-			@endif
-		</ul>
-	<script src="{{ elixir('js/scriptStartPage.js') }}"></script>
+	@include('parts.searchbar', ['class' => 'startpage-searchbar'])
+	<ul class="list-inline searchform-bonus hidden">
+		<li id="plug"
+		@unless ($browser === 'Firefox' || $browser === 'Mozilla' || $browser === 'Chrome' || $browser === 'Opera' || $browser === 'IE' || $browser === 'Edge' || $browser === 'Safari' || $browser === 'Vivaldi')
+			class="hidden"
+		@endunless>
+		<a href="#" data-toggle="modal" data-target="#plugin-modal" class="btn btn-default mutelink" title="{{ trans('index.plugintitle') }}"><i class="fa fa-plug" aria-hidden="true"></i> {{ trans('index.plugin') }}</a></li>
+		@if (LaravelLocalization::getCurrentLocale() == "de")
+		<li>
+			<a href="https://suma-ev.de/presse/Werbefreie-Suche-mit-MetaGer.html" target="_blank" class="btn btn-default mutelink">
+					Werbefreie Suche mit MetaGer
+			</a>
+		</li>
+		@endif
+	</ul>
+	<script type="text/javascript" src="{{ elixir('js/scriptStartPage.js') }}"></script>
+	<script type="text/javascript" src="{{ elixir('js/searchbar.js') }}"></script>
 @endsection
 
 @section('optionalContent')
diff --git a/resources/views/layouts/researchandtabs.blade.php b/resources/views/layouts/researchandtabs.blade.php
index a691a25d0..d16c17e65 100644
--- a/resources/views/layouts/researchandtabs.blade.php
+++ b/resources/views/layouts/researchandtabs.blade.php
@@ -17,6 +17,8 @@
 						<a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}"><h1 class="mg-logo">M<span class="hidden-xs">eta</span>G<span class="hidden-xs">er</span></h1></a>
 					</div>
 					<div id="header-searchbar">
+					@include('parts.searchbar', ['class' => 'resultpage-searchbar', 'request' => Request::method()])
+					<!--
 						<form method="{{ Request::method() }}" accept-charset="UTF-8" class="form search-bar-input" id="submitForm">
 							<div class="searchbar">
 								<input autocomplete="off" class="form-control search-input" form="submitForm" id="eingabeTop" name="eingabe" placeholder="{{ @trans('resultPage.search-placeholder') }}" tabindex="1" type="text" value="{{ $eingabe }}" required />
@@ -29,6 +31,7 @@
 								@endif
 							@endforeach
 						</form>
+					-->
           </div>
 				</div>
 			</div>
diff --git a/resources/views/layouts/resultPage.blade.php b/resources/views/layouts/resultPage.blade.php
index 060f9ac44..e5bacc2b2 100644
--- a/resources/views/layouts/resultPage.blade.php
+++ b/resources/views/layouts/resultPage.blade.php
@@ -17,7 +17,7 @@
 		<link type="text/css" rel="stylesheet" href="/css/lightslider.css" />
 		<link type="text/css" rel="stylesheet" href="/font-awesome/css/font-awesome.min.css" />
 		<link id="theme" type="text/css" rel="stylesheet" href="/css/theme.css.php" />
-		@include('layouts.utility')
+		@include('parts.utility')
 	</head>
 	<body id="resultBody">
 		@if( !isset($suspendheader) )
@@ -33,9 +33,10 @@
   					{!! trans('kontakt.form.1') !!}</a>
   				</strong>
 		</div>
-		@include('layouts.footer', ['type' => 'resultpage', 'id' => 'resultPageFooter'])
+		@include('parts.footer', ['type' => 'resultpage', 'id' => 'resultPageFooter'])
 		<img src="{{ action('ImageController@generateImage')}}?site={{ urlencode(url()->current()) }}" class="hidden" />
 		<script type="text/javascript" src="{{ elixir('js/lib.js') }}"></script>
 		<script type="text/javascript" src="{{ elixir('js/scriptResultPage.js') }}"></script>
+		<script type="text/javascript" src="{{ elixir('js/searchbar.js') }}"></script>
 	</body>
 </html>
diff --git a/resources/views/layouts/staticPages.blade.php b/resources/views/layouts/staticPages.blade.php
index effcfc47f..34f9353a9 100644
--- a/resources/views/layouts/staticPages.blade.php
+++ b/resources/views/layouts/staticPages.blade.php
@@ -56,9 +56,9 @@
 			<img src="{{ action('ImageController@generateImage')}}?site={{ urlencode(url()->current()) }}" class="hidden" />
 		</div>
 		@if (isset($page) && $page === 'startpage')
-			@include('layouts.footer', ['type' => 'startpage', 'id' => 'startPageFooter'])
+			@include('parts.footer', ['type' => 'startpage', 'id' => 'startPageFooter'])
 		@else
-			@include('layouts.footer', ['type' => 'subpage', 'id' => 'subPageFooter'])
+			@include('parts.footer', ['type' => 'subpage', 'id' => 'subPageFooter'])
 		@endif
 	</body>
 </html>
diff --git a/resources/views/layouts/footer.blade.php b/resources/views/parts/footer.blade.php
similarity index 100%
rename from resources/views/layouts/footer.blade.php
rename to resources/views/parts/footer.blade.php
diff --git a/resources/views/parts/searchbar.blade.php b/resources/views/parts/searchbar.blade.php
new file mode 100644
index 000000000..5daff3063
--- /dev/null
+++ b/resources/views/parts/searchbar.blade.php
@@ -0,0 +1,60 @@
+<fieldset>
+	<form id="searchForm" method={{ $request }} action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3") }}" accept-charset="UTF-8">
+		<div class="searchbar {{$class or ''}}">
+			<div class="search-focus-selector">
+				<select id="focus-select" name="focus" style="font-family: FontAwesome, sans-serif;">
+					<option value="web" style="font-family: FontAwesome, sans-serif;" selected>&#xf0ac; Websuche</option>
+					<option value="nachrichten" style="font-family: FontAwesome, sans-serif;">&#xf0a1; Nachrichtensuche</option>
+					<option value="wissenschaft" style="font-family: FontAwesome, sans-serif;">&#xf15c; Wissenschaftssuche</option>
+					<option value="produktsuche" style="font-family: FontAwesome, sans-serif;">&#xf07a; Produktsuche</option>
+					<option value="maps" style="font-family: FontAwesome, sans-serif;">&#xf279; Kartensuche</option>
+				</select>
+			</div>
+			<div class="search-add-focus js-only">
+				<button type="button" id="addFocusBtn" title="@lang('index.add-focus')">
+					<i class="fa fa-plus"></i>
+				</button>
+			</div>
+			<div class="search-edit-focus js-only">
+				<button type="button" id="editFocusBtn" title="@lang('index.edit-focus')">
+					<i class="fa fa-wrench"></i>
+				</button>
+			</div>
+			<div class="search-settings">
+				<a id="settings-btn" class="mutelink btn btn-default" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "
+				 settings ") }}">
+					<i class="fa fa-cog" aria-hidden="true"></i>
+				</a>
+			</div>
+			<div class="search-input-submit">
+				<div class="search-input">
+					<input type="text" name="eingabe" required="" autofocus="" autocomplete="{{$autocomplete or 'off'}}" class="form-control" placeholder="{{ trans('index.placeholder') }}">
+				</div>
+				<div class="search-submit" id="submit-inputgroup">
+					<button type="submit">
+						<i class="fa fa-search" aria-hidden="true"></i>
+					</button>
+				</div>
+			</div>
+			<div class="search-hidden">
+				<input type="hidden" name="encoding" value="utf8">
+				@if (isset($option_values))
+					@foreach($option_values as $option => $value)
+						<input type="hidden" name={{ $option }} value={{ $value }}>
+					@endforeach
+				@endif
+				@if (isset($option_values))
+					<input type="hidden" name="time" value={{ $time }}>
+				@endif
+				@if (isset($focusPages))
+					@foreach ($focusPages as $fp)
+						<input type="hidden" name={{ $fp }} value="on">
+					@endforeach
+				@endif
+				@if (isset($theme))
+					<input type="hidden" name="theme" value={{ $theme }}>
+				@endif
+			</div>
+		</div>
+	</form>
+</fieldset>
\ No newline at end of file
diff --git a/resources/views/layouts/utility.blade.php b/resources/views/parts/utility.blade.php
similarity index 73%
rename from resources/views/layouts/utility.blade.php
rename to resources/views/parts/utility.blade.php
index 749f74335..73dfdc6b0 100644
--- a/resources/views/layouts/utility.blade.php
+++ b/resources/views/parts/utility.blade.php
@@ -1,4 +1,4 @@
-{{-- Verwendung: @include('layouts.utility') --}}
+{{-- Verwendung: @include('parts.utility') --}}
 
 <script defer src="{{ elixir('js/utility.js') }}"></script>
 <link type="text/css" rel="stylesheet" href="{{ elixir('css/utility.css') }}" />
-- 
GitLab