add option/ keyword to not use the default search engine
[consearch.git] / index.php
index c87d1444519d33d4f1e2d24cef17720662d3cdb3..3f1966dc993291449dcfece9a5dbc18444627075 100644 (file)
--- a/index.php
+++ b/index.php
@@ -72,7 +72,9 @@ input {
 }
 button {
     margin: 0px -5px 3mm 0px; /* trbl */
-    padding: -4px;
+    padding: 3px;
+    background: none;
+    border: 1px solid black;
     width: 13ex; /* 13ex 11ch */
     width: 11ch; /* used twice because some browsers don't understand it */
     height: 13mm;
@@ -138,8 +140,10 @@ se["yt"] = ["youtube", "https://www.youtube.com/results?search_query=", "yt.png"
 se["imdb"] = ["imdb", "http://www.imdb.com/find?s=all&q=", "imdb.png"];
 se["az"] = ["amazon", "https://www.amazon.de/s/?url=search-alias%3Daps&field-keywords=", "az.png"];
 se["php"] = ["php.net", "http://de2.php.net/manual-lookup.php?lang=de&pattern=", "php.png"];
-se["sh"] = ["slfhtml", "http://de.selfhtml.org/navigation/suche/index.htm?Suchanfrage=", "sh.png"];
+se["sh"] = ["slfhtml", "https://wiki.selfhtml.org/index.php?search=", "sh.png"];
 se["down"] = ["down", "http://www.downforeveryoneorjustme.com/", "down.png"];
+se["fefe"] = ["fefe", "https://blog.fefe.de/?q=", ""];
+se["wtr"] = ["wtr.com", "http://www.wetter.com/suche/?o=location&q=", ""];
 
 function display_searchbuttons() {
     document.getElementById("searchbuttons").innerHTML = "";
@@ -155,17 +159,22 @@ function parse_fragmentstring() {
         document.getElementById("querystring").focus();
     } else {
         fragmentarr = fragmentstring.replace("%20", "+").split("+");
-        if ( se[fragmentarr[0]] ) {
-            // first word in query is a keyword
-            kw = fragmentarr[0];
+        kw = fragmentarr[0];
+        if ( se[kw] ) {
+            // first word in query is a search engine keyword
             fragmentarr.shift();
             location.href = se[kw][1] + fragmentarr.join(" ");
         } else {
-            // there is no keyword
 <?php
 if ( $dse ) {
     // use a default searchengine
-    echo '            location.href = se["' . $dse . '"][1] + fragmentarr.join(" ");
+    echo '            if ( kw != "nd" ) {
+                location.href = se["' . $dse . '"][1] + fragmentarr.join(" ");
+            } else {
+                fragmentarr.shift();
+                document.getElementById("querystring").value = fragmentarr.join(" ");
+                display_searchbuttons();
+            }
 ';
 } else {
     // display all buttons and write the fragmentstring into the querystring input