Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    30
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Thumbs up I've coded strong javascript search engine

    Well, this is only beginning and kinda beta, but this is just awesome!
    This is 100% secured, but yet unfinished.
    This is huuuuuge!
    I've created temporal apache server on my computer to show how it works:
    http://80.222.127.106/downloads.php
    Last edited by StrangeCoder; 11-24-2010 at 10:45 PM.

  • #2
    New Coder
    Join Date
    Nov 2010
    Posts
    30
    Thanks
    2
    Thanked 2 Times in 2 Posts
    This is the code for main functions:

    Code:
    <script>
    
    function alpha(e) {
    
    var k;
    
    document.all ? k = e.keyCode : k = e.which;
    
    if (e.keyCode == 13)
    
    {
    
    search();
    
    }
    
    else
    
    {
    
    return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k == 32 || (k > 47 && k < 58))
    
    }
    
    }
    
    function search()
    
    {
    
    var srchs1 = document.getElementById('search').value.toUpperCase();
    
    var srchsspace = srchs1.replace(/ /gi, ". .");
    
    var srchs2 = srchsspace.replace(/A/gi,".A.");
    
    var srchs3 = srchs2.replace(/B/gi,".B.");
    
    var srchs4 = srchs3.replace(/C/gi,".C.");
    
    var srchs5 = srchs4.replace(/D/gi,".D.");
    
    var srchs6 = srchs5.replace(/E/gi,".E.");
    
    var srchs7 = srchs6.replace(/F/gi,".F.");
    
    var srchs8 = srchs7.replace(/G/gi,".G.");
    
    var srchs9 = srchs8.replace(/H/gi,".H.");
    
    var srchs10 = srchs9.replace(/I/gi,".I.");
    
    var srchs11 = srchs10.replace(/J/gi,".J.");
    
    var srchs12 = srchs11.replace(/K/gi,".K.");
    
    var srchs13 = srchs12.replace(/L/gi,".L.");
    
    var srchs14 = srchs13.replace(/M/gi,".M.");
    
    var srchs15 = srchs14.replace(/N/gi,".N.");
    
    var srchs16 = srchs15.replace(/O/gi,".O.");
    
    var srchs17 = srchs16.replace(/P/gi,".P.");
    
    var srchs18 = srchs17.replace(/Q/gi,".Q.");
    
    var srchs19 = srchs18.replace(/R/gi,".R.");
    
    var srchs20 = srchs19.replace(/S/gi,".S.");
    
    var srchs21 = srchs20.replace(/T/gi,".T.");
    
    var srchs22 = srchs21.replace(/U/gi,".U.");
    
    var srchs23 = srchs22.replace(/V/gi,".V.");
    
    var srchs24 = srchs23.replace(/W/gi,".W.");
    
    var srchs25 = srchs24.replace(/X/gi,".X.");
    
    var srchs26 = srchs25.replace(/Y/gi,".Y.");
    
    var srchs27 = srchs26.replace(/0/gi,".0.");
    
    var srchs28 = srchs27.replace(/1/gi,".1.");
    
    var srchs29 = srchs28.replace(/2/gi,".2.");
    
    var srchs30 = srchs29.replace(/3/gi,".3.");
    
    var srchs31 = srchs30.replace(/4/gi,".4.");
    
    var srchs32 = srchs31.replace(/5/gi,".5.");
    
    var srchs33 = srchs32.replace(/6/gi,".6.");
    
    var srchs34 = srchs33.replace(/7/gi,".7.");
    
    var srchs35 = srchs34.replace(/8/gi,".8.");
    
    var srchs36 = srchs35.replace(/9/gi,".9.");
    
    var srchs = srchs36.replace(/Z/gi,".Z.");
    
    var srch = document.getElementById('lmao').innerHTML; 
    
    var matchPos = srch.search(srchs);
    
    if((!srchs) || (srchs == ".W..R..I..T..E.. ..K..E..Y..W..O..R..D..S...."))
    
    {
    
    return;
    
    }
    
    else if(matchPos != -1)
    
    {
    
    var cursor = "'pointer'";
    
    var location = "'downloads.php'";
    
    var match = document.getElementById('lmao').innerHTML.replace(srchs, '<b id="result" onclick="window.scroll(0,0)" onmouseover="this.style.cursor=' + cursor + '">' + srchs.fontcolor("Red") + '</b>');
    
    document.getElementById('lmao').innerHTML=match;
    
    document.getElementById('lolz').innerHTML='<IMG SRC="images/backbutton.gif" onclick="window.location=' + location + '" onmouseover="this.style.cursor=' + cursor + '"><br><br><br>';
    
    setTimeout("tests()", 1);
    
    }
    
    else
    
    {
    
    alert("Nothing found, please, try again");
    
    }
    
    }
    
    function tests()
    
    {
    
    var posit = document.getElementById('result');
    
    var posit1 = posit.offsetTop - 200;
    
    window.scroll(0,posit1);
    
    }
    
    </script>

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    Yeah, I'd say "lmao" is about right. Maybe "lmfao" would be more accurate.

    I assume this was meant as a joke, else it's pretty pointless.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New Coder
    Join Date
    Nov 2010
    Posts
    30
    Thanks
    2
    Thanked 2 Times in 2 Posts
    well, i didn't think about div id's so much ^^
    you can change em if you don't like ^^

    And why pointless?
    This is not php engine, this is JAVASCRIPT only search engine, no google.com redirect, just pure javascript search script.
    Client-side only.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    (1) Why would anybody *NEED* a search engine in order to search for only 6 different things...especially when the 6 things are sittting right there on the page in front of you.

    (2) You are going to a lot of work to find some strangely formatted text. And it won't work to find ordinary text.

    (3) You can do all those replaces in one easy line:
    Code:
    var srchs = document.getElementById('search').value.replace(/([A-Z0-9\s])/gi, ".$1.");
    or I think you could do it as
    Code:
    var srchs = "." + document.getElementById('search').value.split("").join("..") + ".";

    But truly, reason (1) was why I thought it was all a joke.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New Coder
    Join Date
    Nov 2010
    Posts
    30
    Thanks
    2
    Thanked 2 Times in 2 Posts
    (1) Well, i didn't think a lot about content yet, only making a driver.
    (2) Actually, I've found UPPERCASE format, but because IE is being retarded, have to replace characters, maybe i'll have any new idea.
    (3) Thank you, will test this one.

    However, "optimizations" don't bother me for now.

    My main problems for now are:
    - long list of downloads will look like retarded.
    - it will load too slowly for the first time.
    - .T..H..I..S.. ..S..H..O..U..L..D.. ..B..E.. ..F..I..X..E..D.. ..T..O..O..
    - ****ing IE :\

    But, agree, the idea is kinda nice.

    Just guess, when I make it work same like php search engine.

    This is the first step.
    Last edited by StrangeCoder; 11-25-2010 at 02:13 AM.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •