├── .gitignore ├── Github.lbaction └── Contents │ ├── Info.plist │ ├── Resources │ ├── icons8-github-100.png │ ├── icons8-male-user-100.png │ └── icons8-repository-100.png │ └── Scripts │ └── default.js ├── Google Translate.lbaction └── Contents │ ├── Info.plist │ ├── Resources │ └── Google_Translate_Icon.png │ └── Scripts │ ├── default.js │ └── suggestions.js ├── LICENSE ├── MDN web docs.lbaction └── Contents │ ├── Info.plist │ ├── Resources │ └── mdn.png │ └── Scripts │ └── default.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .editorConfig 3 | .idea/ 4 | -------------------------------------------------------------------------------- /Github.lbaction/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | icons8-github-100.png 7 | CFBundleIdentifier 8 | com.lk.launchBar.action.Github 9 | CFBundleName 10 | Github 11 | CFBundleVersion 12 | 1.0 13 | LBAbbreviation 14 | GH 15 | LBDescription 16 | 17 | LBAuthor 18 | LK 19 | LBEmail 20 | i91935058@gmail.com 21 | LBSummary 22 | Search github repositories and users. 23 | LBTwitter 24 | 25 | 26 | LBScripts 27 | 28 | LBDefaultScript 29 | 30 | LBAcceptedArgumentTypes 31 | 32 | string 33 | 34 | LBKeepWindowActive 35 | 36 | LBResultType 37 | unknown 38 | LBReturnsResult 39 | 40 | LBScriptName 41 | default.js 42 | 43 | 44 | LBTextInputTitle 45 | Repositories, Users 46 | 47 | 48 | -------------------------------------------------------------------------------- /Github.lbaction/Contents/Resources/icons8-github-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luokuning/LaunchbarActions/30534a7e815138a61be49b829a2dd00c96964059/Github.lbaction/Contents/Resources/icons8-github-100.png -------------------------------------------------------------------------------- /Github.lbaction/Contents/Resources/icons8-male-user-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luokuning/LaunchbarActions/30534a7e815138a61be49b829a2dd00c96964059/Github.lbaction/Contents/Resources/icons8-male-user-100.png -------------------------------------------------------------------------------- /Github.lbaction/Contents/Resources/icons8-repository-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luokuning/LaunchbarActions/30534a7e815138a61be49b829a2dd00c96964059/Github.lbaction/Contents/Resources/icons8-repository-100.png -------------------------------------------------------------------------------- /Github.lbaction/Contents/Scripts/default.js: -------------------------------------------------------------------------------- 1 | // LaunchBar Action Script 2 | 3 | function run() { 4 | LaunchBar.openURL('https://github.com') 5 | } 6 | 7 | function runWithString(string) { 8 | var intention = parseString(string) 9 | var type = intention.type 10 | string = intention.string 11 | 12 | var url 13 | var iconType 14 | var titleType 15 | if (type === 'USER') { 16 | url = 'https://api.github.com/search/users?q=' 17 | iconType = 'icons8-male-user-100.png' 18 | titleType = 'login' 19 | } else if (type === 'REPO') { 20 | url = 'https://api.github.com/search/repositories?q=' 21 | iconType = 'icons8-repository-100.png' 22 | titleType = 'full_name' 23 | } 24 | 25 | // Press cmd+enter, Open github search page 26 | if (LaunchBar.options.commandKey) { 27 | return LaunchBar.openURL('https://github.com/search?q=' + encodeURIComponent(string)) 28 | } 29 | 30 | var suggestions = [] 31 | var queryString = encodeURIComponent(string) 32 | 33 | var result = HTTP.getJSON(url + encodeURIComponent(string)) 34 | // LaunchBar.debugLog( 35 | // 'Custom Search result', 36 | // JSON.stringify(result.response.headerFields['X-RateLimit-Remaining']), 37 | // JSON.stringify(result.data), 38 | // ) 39 | 40 | 41 | if (result == undefined) { 42 | LaunchBar.alert('HTTP.getJSON() returned undefined') 43 | } 44 | 45 | if (result.error != undefined) { 46 | LaunchBar.log('Error in HTTP request: ' + result.error) 47 | } 48 | 49 | result = result.data 50 | 51 | try { 52 | // Rate limit 53 | if (result.message && result.message.indexOf('rate limit') > -1) { 54 | throw new Error('Rate Limit') 55 | } 56 | result.items && result.items.slice(0, 20).forEach(function (item) { 57 | suggestions.push({ 58 | icon: iconType, 59 | alwaysShowsSubtitle: true, 60 | title: item[titleType], 61 | subtitle: item.description || '', 62 | url: item.html_url, 63 | }) 64 | }) 65 | } catch (e) { 66 | LaunchBar.alert(e.message) 67 | } 68 | 69 | return suggestions 70 | } 71 | 72 | function parseString(string) { 73 | string = string.trim() 74 | if (string.indexOf('u ') > -1) { 75 | return { 76 | string: string.slice(2), 77 | type: 'USER' 78 | } 79 | } else { 80 | return { 81 | string: string, 82 | type: 'REPO' 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /Google Translate.lbaction/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | Google_Translate_Icon.png 7 | CFBundleIdentifier 8 | com.lk.launchBar.action.GoogleTranslate 9 | CFBundleName 10 | Google Translate 11 | CFBundleVersion 12 | 1.0 13 | LBAbbreviation 14 | GT 15 | LBDescription 16 | 17 | LBAuthor 18 | LK 19 | LBEmail 20 | i91935058@gmail.com 21 | LBSummary 22 | Google Translate Action 23 | LBTwitter 24 | 25 | LBWebsiteURL 26 | 27 | 28 | LBScripts 29 | 30 | LBDefaultScript 31 | 32 | LBAcceptedArgumentTypes 33 | 34 | string 35 | 36 | LBRequiresArgument 37 | 38 | LBResultType 39 | unknown 40 | LBScriptName 41 | default.js 42 | 43 | LBSuggestionsScript 44 | 45 | LBAcceptedArgumentTypes 46 | 47 | string 48 | 49 | LBKeepWindowActive 50 | 51 | LBLiveFeedbackEnabled 52 | 53 | LBRequiresArgument 54 | 55 | LBResultType 56 | unknown 57 | LBReturnsResult 58 | 59 | LBScriptName 60 | suggestions.js 61 | 62 | 63 | LBTextInputTitle 64 | ↩︎ 翻译为中文,⌘ + ↩︎ 翻译为英文 65 | 66 | 67 | -------------------------------------------------------------------------------- /Google Translate.lbaction/Contents/Resources/Google_Translate_Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luokuning/LaunchbarActions/30534a7e815138a61be49b829a2dd00c96964059/Google Translate.lbaction/Contents/Resources/Google_Translate_Icon.png -------------------------------------------------------------------------------- /Google Translate.lbaction/Contents/Scripts/default.js: -------------------------------------------------------------------------------- 1 | // LaunchBar Action Script 2 | 3 | function run() { 4 | LaunchBar.openURL('https://translate.google.cn') 5 | } 6 | 7 | function runWithString(argument) { 8 | var url = 'https://translate.google.cn/#auto/zh-CN/' 9 | if (LaunchBar.options.commandKey) { 10 | url = 'https://translate.google.cn/#auto/en/' 11 | } 12 | 13 | LaunchBar.openURL(url + encodeURIComponent(argument)); 14 | } -------------------------------------------------------------------------------- /Google Translate.lbaction/Contents/Scripts/suggestions.js: -------------------------------------------------------------------------------- 1 | 2 | function runWithString(argument) { 3 | var sourceLang = 'auto' 4 | var targetLang = 'zh-CN' 5 | if (!/[a-zA-Z]/.test(argument)) { 6 | targetLang = 'en' 7 | } 8 | // dt 跟 ie 参数很重要 9 | var url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" 10 | + sourceLang + "&tl=" + targetLang + "&dt=t&dt=bd&ie=UTF-8&q=" 11 | var result = HTTP.getJSON(url + encodeURIComponent(argument)); 12 | 13 | if (result == undefined) { 14 | LaunchBar.alert('HTTP.getJSON() returned undefined'); 15 | return []; 16 | } 17 | 18 | if (result.error != undefined) { 19 | LaunchBar.log('Error in HTTP request: ' + result.error); 20 | return []; 21 | } 22 | 23 | result = result.data 24 | 25 | var suggestions = [] 26 | 27 | try { 28 | if (result && result[0] && result[0][0] && result[0][0][0]) { 29 | if (!result[1]) 30 | suggestions.push({ 31 | title: result[0][0][0], 32 | icon: 'Google_Translate_Icon.png', 33 | }) 34 | 35 | result[0].forEach(function(r, i) { 36 | if (i == 0) return 37 | if (Array.isArray(r) && r[0]) { 38 | suggestions.push({ 39 | title: r[0], 40 | icon: 'Google_Translate_Icon.png', 41 | }) 42 | } 43 | }) 44 | 45 | if (Array.isArray(result[1]) && Array.isArray(result[1][0]) && Array.isArray(result[1][0][1])) { 46 | result[1][0][1].forEach(function(t) { 47 | suggestions.push({ 48 | title: t, 49 | icon: 'Google_Translate_Icon.png', 50 | }) 51 | }) 52 | } 53 | } 54 | } catch(e) { 55 | LaunchBar.alert(e.message) 56 | } 57 | 58 | return suggestions 59 | } 60 | 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MDN web docs.lbaction/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | mdn.png 7 | CFBundleIdentifier 8 | com.lk.launchBar.action.MDNWebDocs 9 | CFBundleName 10 | MDN 11 | CFBundleVersion 12 | 1.0 13 | LBDescription 14 | 15 | LBAuthor 16 | LK 17 | LBEmail 18 | i91935058@gmail.com 19 | LBSummary 20 | MDN web docs 21 | LBTwitter 22 | 23 | LBWebsiteURL 24 | 25 | 26 | LBScripts 27 | 28 | LBDefaultScript 29 | 30 | LBAcceptedArgumentTypes 31 | 32 | string 33 | 34 | LBKeepWindowActive 35 | 36 | LBLiveFeedbackEnabled 37 | 38 | LBRequiresArgument 39 | 40 | LBResultType 41 | unknown 42 | LBReturnsResult 43 | 44 | LBScriptName 45 | default.js 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /MDN web docs.lbaction/Contents/Resources/mdn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luokuning/LaunchbarActions/30534a7e815138a61be49b829a2dd00c96964059/MDN web docs.lbaction/Contents/Resources/mdn.png -------------------------------------------------------------------------------- /MDN web docs.lbaction/Contents/Scripts/default.js: -------------------------------------------------------------------------------- 1 | // LaunchBar Action Script 2 | 3 | function run() { 4 | LaunchBar.openURL('https://developer.mozilla.org/en-US/') 5 | } 6 | 7 | function runWithString(argument) { 8 | var url = 'https://developer.mozilla.org/en-US/search?q=' + encodeURIComponent(argument) 9 | 10 | var html = HTTP.get(url) 11 | 12 | if (html.data == undefined) { 13 | LaunchBar.alert("Something wrong with your network.") 14 | return [] 15 | } 16 | 17 | try { 18 | var results = /