Announcement

Collapse
No announcement yet.

Use the DuckDuckGo site search in Sellerdeck

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Use the DuckDuckGo site search in Sellerdeck

    The built in search in Sellerdeck is good but several of my customers over the years have sought to use a third party search facility on their sites.

    Most of these need to be paid for on a regular basis except Google Site Search which was very good and is now withdrawn.

    Step in DuckDuckGo.com site search. (https://duckduckgo.com/search_box) but as it comes in an iframe there are associated limitations.

    You can however use the coded version and this is the code to use. The site to be searched is specified in a hidden input.

    In Design Library find the Standard Quick Search Bar layout and copy it for backup.

    Open the Standard Quick Search Bar layout and replace everything there with the following:

    Code:
    <div class="quick-search">
    <form onsubmit="return searchb()" id="search_form_homepage" class="no-menu" name="x" action="https://duckduckgo.com/" target="_top">    
        <div id="sxd"></div>
        <div id="search_wrapper_homepage">
        <span class="button-wrapper quick-search-button-wrapper">
            <input class="button quick-search-button" id="search_button_homepage" value="" type="submit">
            </span>
        </div>
        <input autocomplete="off" name="q" id="search_form_input_homepage" class="quick-search-text" onfocus="if ('rc' in window) {nua('nro',rc)};fq=1;" onblur="fq=0" onclick="if (this.value=='Site Search') {this.value='';this.style.color='#000000';}" value="" placeholder="Site Search" style="color: rgb(153, 153, 153);" type="text">    
        <input type="hidden" name="sites" value="https://www.graphicz.solutions">
    <script type="text/javascript">
    var tracking=new RegExp('[\?\&]t=([^\&]+)');
    var form = document.getElementById("search_form_homepage");
    
    if (tracking.test(window.location.href)) {
      var input = document.createElement("input");
      input.type = "hidden";
      input.name = "t";
      input.value = RegExp.$1;
      form.appendChild(input);
    }
    var karr = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','aa','ab','ac','ad','ae','af','ag','ah','ai','aj','ak','al','am','an','ao','ap','aq','ar','as','at','au','av','aw','ax','ay','az');
    for (var i=0;i<karr.length;i++) {
      var kre=new RegExp('[\?\&]k'+karr[i]+'=([^\&]+)');
      var ktmp='';
      if (kre.test(window.location.href)) {
        ktmp=decodeURIComponent(RegExp.$1);
        if (ktmp.length<11) {
          var input = document.createElement("input");
          input.type = "hidden";
          input.name = "k" + karr[i];
          input.value = ktmp;
          form.appendChild(input);
        }
        if (karr[i]=='n'&&ktmp&&ktmp=='1') document.x.target='_new';              
      }
    }
    </script>
    </form>    
    </div>
    Changing 'https://www.graphicz.solutions' for your own website. This uses 'placeholder' instead of 'value' and it looks just like the original: https://www.graphicz.solutions/defaultnog/index.html

    Please note: this is a test server so robots are blocked and any search yields nothing! You can put it on a regular website though, scroll to the bottom of https://www.graphicz.co.uk

    The code for a regular site is:

    Code:
    <div class="quick-search">
    <form onsubmit="return searchb()" id="search_form_homepage" class="no-menu" name="x" action="https://duckduckgo.com/" target="_top">    
        <div id="sxd"></div>
        <div id="search_wrapper_homepage">
        <span class="button-wrapper quick-search-button-wrapper">
            <input class="button quick-search-button" id="search_button_homepage" value="" type="submit">
            </span>
        </div>
        <input autocomplete="off" name="q" id="search_form_input_homepage" onfocus="if ('rc' in window) {nua('nro',rc)};fq=1;" onblur="fq=0" onclick="if (this.value=='Site Search') {this.value='';this.style.color='#000000';}" value="" placeholder="Site Search" style="color: rgb(153, 153, 153);" type="text">
        <input type="hidden" name="sites" value="https://www.graphicz.co.uk">
    <script type="text/javascript">
    var tracking=new RegExp('[\?\&]t=([^\&]+)');
    var form = document.getElementById("search_form_homepage");
    
    if (tracking.test(window.location.href)) {
      var input = document.createElement("input");
      input.type = "hidden";
      input.name = "t";
      input.value = RegExp.$1;
      form.appendChild(input);
    }
    var karr = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9','aa','ab','ac','ad','ae','af','ag','ah','ai','aj','ak','al','am','an','ao','ap','aq','ar','as','at','au','av','aw','ax','ay','az');
    for (var i=0;i<karr.length;i++) {
      var kre=new RegExp('[\?\&]k'+karr[i]+'=([^\&]+)');
      var ktmp='';
      if (kre.test(window.location.href)) {
        ktmp=decodeURIComponent(RegExp.$1);
        if (ktmp.length<11) {
          var input = document.createElement("input");
          input.type = "hidden";
          input.name = "k" + karr[i];
          input.value = ktmp;
          form.appendChild(input);
        }
        if (karr[i]=='n'&&ktmp&&ktmp=='1') document.x.target='_new';              
      }
    }
    </script>
    </form>    
    </div>
    The styles are:

    Code:
    /*== Quick Search  ==*/
    .quick-search {
        float:none;
        clear:both;
        max-width:30em;
        margin:0 auto;
        padding:0;
    }
    .quick-search form {
        width:100%;
        position:relative;
    }
    .quick-search input[type="text"] {
        width:99%;
        height:3em;
        font-style:italic;
        border:1px solid #d0d0d0;
         border-radius: 9px;
    }
    .quick-search form span.quick-search-button-wrapper {
        margin:0;
        padding:0;
        position:absolute;
        top:1.3em;
        right:-0.8em;
    }
    .quick-search form span.quick-search-button-wrapper, .quick-search input[type="submit"], .quick-search input[type="submit"]:hover {
        width:35px;
        height:35px;
    }
    .quick-search input[type="submit"], .quick-search input[type="submit"]:hover {
        background:url('search-icon.png');
        border:none;
        text-align:left;
        text-indent:-9999px;
    }
    .quick-search .sf_suggestion {
        margin-top:2.4em;
    }
    .quick-search form span.quick-search-button-wrapper {float:left; margin:0 1.2em; padding:0; top:.8em;}
    .quick-search form input.button.quick-search-button {float:left; margin:0; padding:10%;}
    Any problems please reply to this thread.

    Thank you
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk
Working...
X