<commit_before><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
        <title></title>
        <link rel="stylesheet" href="./css/demo.css">

    </head>
    <body>

    <div id="wrapper">
        <div class="search-form">
            <div class="search-form-heading"> Smart Search </div>
            <div class="formContainer">
                <form action="" method="post">
                    <div class="inputWrap">
                        <input type="text" class="input-field" name="field1" value="" 
                            autocomplete="off"
                            autocapitalize="off"
                            autocorrect="off"
                        />
                        <div class="clearQuery" style="display:none;">X</div>
                    </div>
                    <div class="buttonWrap">
                        <button type="submit" value="Submit" /> 검색
                    </div>
                </form>
            </div>

            <section class="auto-complete-wrap" style="display:none;">
                <ul class="ul-wrap"></ul>
                <div class="footer-button-wrap">
                    <button class="closeLayer">닫기</button>
                </div>
            </section>

            <section class="recent-word-wrap" style="display:none;">
                <ul class="ul-wrap"></ul>
                 <div class="footer-button-wrap">
                    <button class="deleteWord" style="display:none">전체삭제</button>
                    <button class="closeLayer">닫기</button>
                </div>
            </section>
        </div>
    </div>


    <script src="../dist/ss_merge_es5.js"></script>

    <script>

    var oSS= null;

    (function(doc){
        var elAutoCompleteLayer = doc.querySelector(".auto-complete-wrap");
        var elRecentWordLayer   = doc.querySelector(".recent-word-wrap");
        var sAutoCompleteURL = 'http://completion.amazon.com/search/complete?mkt=1&client=amazon-search-ui&x=String&search-alias=aps&';

        /*
        // callback 4 Ajax (local)
        var fnInsertAutoCompleteWord = function(sData) {
            var result  = "";
            var sHTML   = "";
            var sTemplate = "<li><span>[%sKeyword%]</span></li>";

            sData.items[0].forEach( function(v) {
                result = sTemplate.replace(/\[%sKeyword%\]/, v[0]);       
                sHTML += result;
            });

            elAutoCompleteLayer.querySelector("ul").innerHTML = sHTML;
        }
        */

        //callback 4 JSONP (Amazon)
        //자동완성레이어에 보여줄 HTML (사용자정의)
        var fnInsertAutoCompleteWord = function(sData) {
            var result  = "";
            var sHTML   = "";
            var sTemplate = "<li><span>[%sKeyword%]</span></li>";

            if(!sData) return;
            sData[1].forEach( function(v) {
                result = sTemplate.replace(/\[%sKeyword%\]/, v);       
                sHTML += result;
            });
            elAutoCompleteLayer.querySelector("ul").innerHTML = sHTML;
        }


        var fnInsertRecentSearchWord = function(aData) {
            var result  = "";
            var sHTML   = "";
            var sTemplate = "<li><span>[%sKeyword%]</span></li>";
            aData.forEach( function(v) {
                result = sTemplate.replace(/\[%sKeyword%\]/, v);       
                sHTML += result;
            });
            elRecentWordLayer.querySelector("ul").innerHTML = sHTML;
        }
        

        oSS = new SmartSearch(document.querySelector(".search-form"), {
        });

        oSS.registerAutoCompleteData({ 
            sAutoCompleteURL : sAutoCompleteURL,
            requestType : 'jsonp'
        });

        // oSS.registerAutoCompleteData({ 
        //     sAutoCompleteURL : "",
        //     requestType : 'ajax'
        // });
    
        oSS.registerCallback({
            'fnInsertAutoCompleteWord' : fnInsertAutoCompleteWord,
        });

        oSS.addOnPlugin(RecentWordPlugin)
            .registerCallback({
                'fnInsertRecentSearchWord' : fnInsertRecentSearchWord,
            });

    })(document);

    </script>

    <script>
    //support Desktop ENV.
    (function (doc) {

        // Support Mouse Events.
        doc.querySelector(".recent-word-wrap .closeLayer").
            addEventListener("mousedown", function(){ 
                oSS.htPluginInstance["RecentWordPlugin"].handlerCloseLayer();
        });

        doc.querySelector(".auto-complete-wrap .closeLayer").
            addEventListener("mousedown", function(){
                oSS.handlerCloseLayer();
        });

        doc.querySelector(".clearQuery").
            addEventListener("mousedown", function(){ 
                oSS.handlerClearInputValue();
        });

        doc.querySelector(".auto-complete-wrap .ul-wrap").addEventListener("mouseover", function(evt){
            var _el = evt.target;
            var elCurrentLI = (_el.nodeName === "SPAN") ? _el.parentElement : _el;
            var _oldSelectedLI = elCurrentLI.parentElement.querySelector(".selectedLI");

            if(_oldSelectedLI) _oldSelectedLI.className = "";
            elCurrentLI.className += "selectedLI";
        });

    })(document); 
    </script>

    </body>
</html>





<commit_msg>Feature. event handler for PC mouse control<commit_after><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
        <title></title>
        <link rel="stylesheet" href="./css/demo.css">

    </head>
    <body>

    <div id="wrapper">
        <div class="search-form">
            <div class="search-form-heading"> Smart Search </div>
            <div class="formContainer">
                <form id="search-form" action="" method="post">
                    <div class="inputWrap">
                        <input type="text" class="input-field" name="field1" value="" 
                            autocomplete="off"
                            autocapitalize="off"
                            autocorrect="off"
                        />
                        <div class="clearQuery" style="display:none;">X</div>
                    </div>
                    <div class="buttonWrap">
                        <button type="submit" value="Submit" /> 검색
                    </div>
                </form>
            </div>

            <section class="auto-complete-wrap" style="display:none;">
                <ul class="ul-wrap"></ul>
                <div class="footer-button-wrap">
                    <button class="closeLayer">닫기</button>
                </div>
            </section>

            <section class="recent-word-wrap" style="display:none;">
                <ul class="ul-wrap"></ul>
                 <div class="footer-button-wrap">
                    <button class="deleteWord" style="display:none">전체삭제</button>
                    <button class="closeLayer">닫기</button>
                </div>
            </section>
        </div>
    </div>


    <script src="../dist/ss_merge_es5.js"></script>

    <script>

    var oSS= null;

    (function(doc){
        var elAutoCompleteLayer = doc.querySelector(".auto-complete-wrap");
        var elRecentWordLayer   = doc.querySelector(".recent-word-wrap");
        var sAutoCompleteURL = 'http://completion.amazon.com/search/complete?mkt=1&client=amazon-search-ui&x=String&search-alias=aps&';

        /*
        // callback 4 Ajax (local)
        var fnInsertAutoCompleteWord = function(sData) {
            var result  = "";
            var sHTML   = "";
            var sTemplate = "<li><span>[%sKeyword%]</span></li>";

            sData.items[0].forEach( function(v) {
                result = sTemplate.replace(/\[%sKeyword%\]/, v[0]);       
                sHTML += result;
            });

            elAutoCompleteLayer.querySelector("ul").innerHTML = sHTML;
        }
        */

        //callback 4 JSONP (Amazon)
        //자동완성레이어에 보여줄 HTML (사용자정의)
        var fnInsertAutoCompleteWord = function(sData) {
            var result  = "";
            var sHTML   = "";
            var sTemplate = "<li><span>[%sKeyword%]</span></li>";

            if(!sData) return;
            sData[1].forEach( function(v) {
                result = sTemplate.replace(/\[%sKeyword%\]/, v);       
                sHTML += result;
            });
            elAutoCompleteLayer.querySelector("ul").innerHTML = sHTML;
        }


        var fnInsertRecentSearchWord = function(aData) {
            var result  = "";
            var sHTML   = "";
            var sTemplate = "<li><span>[%sKeyword%]</span></li>";
            aData.forEach( function(v) {
                result = sTemplate.replace(/\[%sKeyword%\]/, v);       
                sHTML += result;
            });
            elRecentWordLayer.querySelector("ul").innerHTML = sHTML;
        }
        

        oSS = new SmartSearch(document.querySelector(".search-form"), {
        });

        oSS.registerAutoCompleteData({ 
            sAutoCompleteURL : sAutoCompleteURL,
            requestType : 'jsonp'
        });

        // oSS.registerAutoCompleteData({ 
        //     sAutoCompleteURL : "",
        //     requestType : 'ajax'
        // });
    
        oSS.registerCallback({
            'fnInsertAutoCompleteWord' : fnInsertAutoCompleteWord,
        });

        oSS.addOnPlugin(RecentWordPlugin)
            .registerCallback({
                'fnInsertRecentSearchWord' : fnInsertRecentSearchWord,
            });

    })(document);

    </script>

    <script>
    //support Desktop ENV.
    (function (doc) {

        // Support Mouse Events.
        doc.querySelector(".recent-word-wrap .closeLayer").addEventListener("mousedown", function(){
            oSS.htPluginInstance["RecentWordPlugin"].handlerCloseLayer();
        });

        doc.querySelector(".auto-complete-wrap .closeLayer").addEventListener("mousedown", function(){
            oSS.handlerCloseLayer();
        });

        doc.querySelector(".clearQuery"). addEventListener("mousedown", function(){
            oSS.handlerClearInputValue();
        });

        doc.querySelector(".inputWrap").addEventListener("mousedown", function(evt){
            oSS.handlerInputWrap();
        });

        //change selected LI 
        doc.querySelector(".auto-complete-wrap .ul-wrap").addEventListener("mouseover", function(evt){
            var _el = evt.target;
            var elCurrentLI = (_el.nodeName === "SPAN") ? _el.parentElement : _el;
            var _oldSelectedLI = elCurrentLI.parentElement.querySelector(".selectedLI");

            if(_oldSelectedLI) _oldSelectedLI.className = "";
            elCurrentLI.className += "selectedLI";
        });

        //rollback backgroundColor when mouseover.
        doc.querySelector(".auto-complete-wrap .ul-wrap").addEventListener("mouseout", function(evt){
            var _oldSelectedLI = this.querySelector(".selectedLI");
            if(_oldSelectedLI) _oldSelectedLI.className = "";
        });

        //prevent Form submit.
        doc.querySelector(".search-form form").addEventListener("submit", function(evt){
          evt.preventDefault();
        });

    })(document); 
    </script>

    </body>
</html>






{'fraction_non_alphanumeric': 0.14481546572934972, 'fraction_numerical': 0.0019332161687170475, 'mean_word_length': 1.6981981981981982, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 135, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3670736', 'n_tokens_mistral': 3178, 'n_tokens_neox': 3051, 'n_words': 500}