diff --git a/WeChatTweak.lbaction/Contents/Info.plist b/WeChatTweak.lbaction/Contents/Info.plist new file mode 100644 index 0000000..f40600f --- /dev/null +++ b/WeChatTweak.lbaction/Contents/Info.plist @@ -0,0 +1,53 @@ + + + + + CFBundleIconFile + icon.png + CFBundleIdentifier + com.viko16.LaunchBar.action.WeChatTweak + CFBundleName + WeChatTweak + CFBundleVersion + 1.0 + LBAbbreviation + wc + LBDescription + + LBAuthor + viko16 + LBEmail + + LBSummary + A LaunchBar action for WeChatTweak. + LBTwitter + + LBWebsiteURL + https://github.com/viko16 + + LBScripts + + LBDefaultScript + + LBAcceptedArgumentTypes + + string + + LBKeepWindowActive + + LBLiveFeedbackEnabled + + LBRequiresArgument + + LBResultType + unknown + LBReturnsResult + + LBScriptName + default.js + + + LBTextInputTitle + Search your friend... + + diff --git a/WeChatTweak.lbaction/Contents/Resources/icon.png b/WeChatTweak.lbaction/Contents/Resources/icon.png new file mode 100644 index 0000000..5e457bd Binary files /dev/null and b/WeChatTweak.lbaction/Contents/Resources/icon.png differ diff --git a/WeChatTweak.lbaction/Contents/Scripts/default.js b/WeChatTweak.lbaction/Contents/Scripts/default.js new file mode 100644 index 0000000..fd3fe16 --- /dev/null +++ b/WeChatTweak.lbaction/Contents/Scripts/default.js @@ -0,0 +1,32 @@ +// LaunchBar Action Script + +function run(string) { + if (!string) return []; + + var url = 'http://localhost:48065/wechat/search?keyword='; + var result = HTTP.getJSON(url + encodeURIComponent(string.trim())); + + if (result == undefined) { + LaunchBar.alert('HTTP.getJSON() returned undefined'); + return []; + } + + if (result.error != undefined) { + LaunchBar.log('Error in HTTP request: ' + result.error); + return []; + } + + return result.data.map(function (i) { + return { + title: i.m_nsRemark || i.m_nsNickName, + subtitle: i.m_nsNickName, + icon: "icon.png", + action: "open", + actionArgument: i.m_nsUsrName + } + }); +} + +function open(id) { + HTTP.get('http://localhost:48065/wechat/start?session=' + id); +} \ No newline at end of file