add option/ keyword to not use the default search engine
[consearch.git] / index.php
index 285bce4b0629db42aa535952c71d28416f5789c6..3f1966dc993291449dcfece9a5dbc18444627075 100644 (file)
--- a/index.php
+++ b/index.php
@@ -140,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["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["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 = "";
 
 function display_searchbuttons() {
     document.getElementById("searchbuttons").innerHTML = "";
@@ -157,17 +159,22 @@ function parse_fragmentstring() {
         document.getElementById("querystring").focus();
     } else {
         fragmentarr = fragmentstring.replace("%20", "+").split("+");
         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 {
             fragmentarr.shift();
             location.href = se[kw][1] + fragmentarr.join(" ");
         } else {
-            // there is no keyword
 <?php
 if ( $dse ) {
     // use a default searchengine
 <?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
 ';
 } else {
     // display all buttons and write the fragmentstring into the querystring input