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();