Example

Example-1

//TODO: κ°œλ…μ •λ¦¬μ€‘
var jelly = new JellySpeaker({modeNeedsToCallName: true, validTimeToCommand: 4000, storagePath: '/jelly/icon'})
    .addPlugin([
        new JellySpeaker.PluginStats(),
        new JellySpeaker.PluginCommandSearchTest('search', '검색'),
        new JellySpeaker.PluginWordChain(),
        new JellySpeaker.PluginAlarmManager(),
        new JellySpeaker.PluginDBManager(),
        new JellySpeaker.PluginXHRManager(),
        new JellySpeaker.PluginIconManager()
            .setCustomChecker('web-checker', {'url':'http*'}, function(iconList, resolve){
                var urlList = getData(iconList).collect(function(it){ return it.url });
                getXHR(SEARCHER.URL_CHECK_URL_ALL, {urlList:urlList, timeout:1500}).request(function(resultList){
                    var statusMap = getData(iconList).collectMap(function(it, index){ return {key:iconList[index].id, value:resultList[index]}; });
                    resolve(statusMap);
                });
            }, 10000)
            .setCustomChecker('db-checker', {'url':'jdbc*'}, function(iconList, resolve){
                var urlList = getData(iconList).collect(function(it){ return it.url });
                var idList = getData(iconList).collect(function(it){ return it.data.username });
                var pwList = getData(iconList).collect(function(it){ return it.data.password });
                getXHR(SEARCHER.URL_CHECK_DB_ALL,{urlList:urlList, idList:idList, pwList:pwList}).request( function(resultList){
                    var statusMap = getData(iconList).collectMap(function(it, index){ return {key:iconList[index].id, value:resultList[index]}; });
                    resolve(statusMap);
                });
            }, 10000),
        new JellySpeaker.PluginIconManagerInputer().setLoadData(function(){
            return { hi: {id:'test', type:'click'},  hello: {id:'test2', type:'click'}, };
        }),
    ])
    .setupSystemIcon([
        new JellySpeaker.Icon('search').setCommand(function(parameter){
            searchWithParameterURL(parameter.keyword); //μ—†μœΌλ©΄ μžλ™μœΌλ‘œ Input의 Value 채취
        }),
        new JellySpeaker.Icon('search-on-naver').setCommand(function(parameter){
            window.open("https://search.naver.com/search.naver?ie=UTF-8&query=" +parameter, "_blank");
        }),
        new JellySpeaker.Icon('search-on-google').setCommand(function(parameter){
            window.open("https://www.google.com/search?q=" +parameter, "_blank");
        }),
        new JellySpeaker.Icon('show').setCommand(function(parameter){
            // run('show', parameter);
        }),
        new JellySpeaker.Icon('open').setCommand(function(parameter){
            window.open('https://naver.com', '_blank');
        }),
        new JellySpeaker.Icon('move-to-home').setCommand(function(parameter){
            location.href = SEARCHER.URL_TO_HOME;
        }),
        new JellySpeaker.Icon('open-user-manager').setCommand(function(parameter){
            openUserManager();
        }),
        new JellySpeaker.Icon('open-team-manager').setCommand(function(parameter){
            openTeamManager();
        }),
        new JellySpeaker.Icon('open-category-manager').setCommand(function(parameter){
            openCategoryManager();
        }),
        new JellySpeaker.Icon('open-product-manager').setCommand(function(parameter){
            openProductManager();
        }),
        new JellySpeaker.Icon('open-index-manager').setCommand(function(parameter){
            openIndexManager();
        }),
        new JellySpeaker.Icon().setCommand('search').setRunner([
            new JellySpeaker.SpeechRunner('${parameter.except(이라고).except(라고)} 검색'),
            new JellySpeaker.SpeechRunner(new RegExp('\\w+ 검색')),
        ]),
        new JellySpeaker.Icon().setCommand('search-on-naver').setRunner([
            new JellySpeaker.SpeechRunner('${parameter.except(이라고).except(라고)} λ„€μ΄λ²„μ—μ„œ 검색'),
            new JellySpeaker.SpeechRunner(new RegExp('.+ 검색')),
        ]),
        new JellySpeaker.Icon().setCommand('search-on-google').setRunner([
            new JellySpeaker.SpeechRunner('${parameter.except(이라고).except(라고)} κ΅¬κΈ€μ—μ„œ 검색'),
        ]),
        new JellySpeaker.Icon().setCommand('open').setRunner([
            new JellySpeaker.SpeechRunner('μ•ˆλ…•'),
            // new JellySpeaker.ScheduleRunner('{dayOfWeek(ν† ,일), cycle(10m, 05:45)}, {dayOfWeek(μ›”), cycle(07:00, 14:00, 19:30)}'),
        ]),
        new JellySpeaker.Icon('open-graph-network').setCommand(function(parameter){
            openGraphNetwork(parameter);
        }),
    ])
    .setupUserIcon([
        /** 데이터 보쑰 **/
        new JellySpeaker.Icon('user-manager').setTitle('μ‚¬μš©μž κ΄€λ¦¬μž').setHTML('🧍').setCommand('open-user-manager').setRunner([
            new JellySpeaker.KeyRunner([KeyMan.ALT, KeyMan.N2]),
        ]),
        new JellySpeaker.Icon('team-manager').setTitle('μ†Œμ† κ΄€λ¦¬μž').setHTML('πŸ‘¨β€πŸ‘©β€πŸ‘§ ').setCommand('open-team-manager').setRunner([
            new JellySpeaker.KeyRunner([KeyMan.ALT, KeyMan.N9]),
        ]),
        new JellySpeaker.Icon('category-manager').setTitle('μΉ΄ν…Œκ³ λ¦¬ κ΄€λ¦¬μž').setHTML('πŸ—‚οΈ').setCommand('open-category-manager').setRunner([
            new JellySpeaker.KeyRunner([KeyMan.ALT, KeyMan.N3]),
        ]),
        new JellySpeaker.Icon('product-manager').setTitle('μƒν’ˆ κ΄€λ¦¬μž').setHTML('πŸ“¦').setCommand('open-product-manager').setRunner([
            new JellySpeaker.KeyRunner([KeyMan.ALT, KeyMan.N4]),
        ]),
        new JellySpeaker.Icon('index-manager').setTitle('인덱슀 κ΄€λ¦¬μž').setHTML('πŸ•΅οΈβ€β™‚οΈ').setCommand('open-index-manager').setRunner([
            new JellySpeaker.KeyRunner([KeyMan.ALT, KeyMan.N6]),
        ]),

        /** κ΄€μ œ **/
        new JellySpeaker.Icon('page-gitlab').setTitle('GitLab').setHTML('🦊').setURL('http://192.168.0.18'),
        new JellySpeaker.Icon('page-jelly').setTitle('Jelly').setHTML('Jelly').setURL('http://192.168.0.18:8080/jelly'),
        new JellySpeaker.Icon('page-ealsticsearch').setTitle('ElasticSearch').setHTML('ES').setURL('http://192.168.0.18:9200'),
        new JellySpeaker.Icon('page-kibana').setTitle('Kibana').setHTML('Kibana').setURL('http://192.168.0.18:5601'),
        new JellySpeaker.Icon('page-logstash').setTitle('Logstash').setHTML('Logstash').setURL('http://192.168.0.18:9600'),
        // new JellySpeaker.Icon('page-tibero').setTitle('Tibero').setHTML('Tibero').setURL('jdbc:tibero:thin:@192.168.0.18:8629:tibero').setData({username:'nia', password:'nia'}),
        new JellySpeaker.Icon('page-postgres').setTitle('Postgres').setHTML('Postgres').setURL('jdbc:postgresql://192.168.0.18:5432/postgres').setData({username:'postgres', password:'postgres'}),

        /** κΈ°λŠ₯λ“€ **/
        new JellySpeaker.Icon('schedule-001').setTitle('주기적으둜 Data Count 가져와').setHTML('πŸ”’').setCommand(function(){ loadCount() }).setRunner([
            new JellySpeaker.ScheduleRunner(30 * 1000)
        ]),
        // new JellySpeaker.Icon('testing').setTitle('testing').setHTML('πŸ”’').setCommand(function(){ console.error(new Date().getTime()) }).setRunner([
        //     new JellySpeaker.ScheduleRunner('{dayOfWeek(일), cycle(23:45, 23:46, 23:50, 23:55, 00:37, 00:42)}, {dayOfWeek(μ›”,ν™”), cycle(2m)}')
        // ]),
        new JellySpeaker.Icon('button-002').setTitle('ν•™μŠ΅ν•΄λ΄!').setHTML('πŸ‘©β€πŸŽ“').setCommand(function(){ testLearn() }).setRunner([
            new JellySpeaker.SpeechRunner('ν•™μŠ΅ ν•΄ 봐'),
        ]),
        new JellySpeaker.Icon('toggle-memory-watcher').setTitle('λ©”λͺ¨λ¦¬ κ°μ‹œμž').setHTML('πŸ“‰').setClass(JellySpeaker.PluginIconManager.CLASS_ICON_TOGGLE)
            .setCommand(function(parameter, resolve){
                parameter.status ? stopMemoryWatcher(resolve) : startMemoryWatcher(resolve);
            })
            .setModeStatusCheck(true, function(resolve){
                checkMemoryWatcher(function(result){ resolve(result); });
            }),
    ])
    .setupBot([
        // new JellySpeaker.Bot({name:"WHATEVER_SOMETHING_TO_DO", cycleTime:1000}).addAction([
        //     new JellySpeaker.ActionGroupOrderly({rate:0.30}).add([
        //         new JellySpeaker.Action(rate:0.25, command:'pay', param:{"WHERE":{"NAME":"A%"}}),
        //         new JellySpeaker.Action(rate:0.25, command:'pay', param:{"WHERE":{"NAME":"B%"}}),
        //         new JellySpeaker.Action(rate:0.50, command:'pay', param:{"WHERE":{"NAME":"C%"}}),
        //     ]),
        //     new JellySpeaker.ActionGroupRandom({rate:0.25}).add([
        //         new JellySpeaker.Action(rate:0.25, command:'pay', param:{"WHERE":{"NAME":"B%"}}),
        //         new JellySpeaker.Action(rate:0.25, command:'pay', param:{"WHERE":{"NAME":"B%"}}),
        //         new JellySpeaker.Action(rate:0.50, command:'pay', param:{"WHERE":{"NAME":"B%"}}),
        //     ]),
        //     new JellySpeaker.Action({rate:0.45, command:'pay', param:{"WHERE":{"NAME":"B%"}}})
        //     ]),
        // ])
    ])
    .loadIcon()
    .detect()
    .start();