├── .gitignore
├── LICENSE
├── README.md
├── README_CN.md
├── Zhihu.bundle
├── Icon.png
├── error.html
├── examples.txt
├── info.json
└── plugin.py
├── douban.bundle
├── Icon.png
├── crel.js
├── douban.html
├── examples.txt
├── info.json
└── plugin.py
├── haomatong.bundle
├── Icon.png
├── crel.js
├── examples.txt
├── haomatong.html
├── info.json
└── plugin.py
├── images
├── douban.png
├── haomatong.png
├── kuaidi.png
└── youdao.png
├── kuaidi.bundle
├── Icon.png
├── crel.js
├── examples.txt
├── info.json
├── kuaidi.html
└── plugin.py
├── timestamp.bundle
├── examples.txt
├── info.json
└── plugin.py
└── youdaodic.bundle
├── Icon.png
├── examples.txt
├── info.json
├── plugin.py
└── youdao.html
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 |
5 | # C extensions
6 | *.so
7 |
8 | # Distribution / packaging
9 | .Python
10 | env/
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | lib/
17 | lib64/
18 | parts/
19 | sdist/
20 | var/
21 | *.egg-info/
22 | .installed.cfg
23 | *.egg
24 |
25 | # PyInstaller
26 | # Usually these files are written by a python script from a template
27 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
28 | *.manifest
29 | *.spec
30 |
31 | # Installer logs
32 | pip-log.txt
33 | pip-delete-this-directory.txt
34 |
35 | # Unit test / coverage reports
36 | htmlcov/
37 | .tox/
38 | .coverage
39 | .cache
40 | nosetests.xml
41 | coverage.xml
42 |
43 | # Translations
44 | *.mo
45 | *.pot
46 |
47 | # Django stuff:
48 | *.log
49 |
50 | # Sphinx documentation
51 | docs/_build/
52 |
53 | # PyBuilder
54 | target/
55 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Allen Hsu
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 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [中文](README_CN.md)
2 |
3 | FlashlightPlugins
4 | =================
5 |
6 | 4th-party plugins of Flashlight (https://github.com/nate-parrott/Flashlight/)
7 |
8 | ##Install##
9 |
10 | - Install and enable Flashlight (https://github.com/nate-parrott/Flashlight/releases)
11 | - Copy plugin bundle to `~/Library/FlashlightPlugins`
12 |
13 | If you are familiar with command lines, you can use `ln -s bundle_name.bundle ~/Library/FlashlightPlugins` for easier update via git.
14 |
15 | ##Usage##
16 |
17 | ###Timestamp###
18 |
19 | - `timestamp` for current timestamp
20 | - `timestamp 1400000000` to convert timestamp into human redable time string
21 |
22 | `ts` is short for `timestamp`, you can also use `ts 1400000000` for less typing.
23 |
24 | ###Haomatong###
25 |
26 | - `haomatong 10086` to fetch info from haomatong for specified phone number
27 |
28 | `hmt` is short for `haomatong`, use `hmt 10086` for less typing.
29 |
30 | 
31 |
32 | ###Kuaidi###
33 |
34 | - `kuaidi 100033892580` to fetch express info from kuaidi100.com
35 |
36 | 
37 |
38 | ###YoudaoDic (by [Hyde Wang](https://github.com/callmewhy))###
39 |
40 | - `youdao one` to translate `one` from English to Chinese.
41 | - `youdao 汪` to translate `汪` from Chinese to English.
42 |
43 | `yd` is short for `youdao`, you can also use `yd flower` for less typing.
44 |
45 | Press ENTER to see translation on dic.youdao.com in browser
46 |
47 | 
48 |
49 | ###Douban###
50 |
51 | - `douban Interstellar` to search for a movie on douban
52 |
53 | 
54 |
55 | ###ZhiHuDaily (By [小贼ZH](https://github.com/ZHONGHuanGit/ZhihuDaily))
56 |
57 | Zhihu is the chinese website like quora
58 |
59 | - `zhihu daily` to show zhihu daily
60 | - `zhihu hot` to show zhihu hot topics
61 | - `zhihu 20141111` to show zhihu hot topics of the specific date
62 |
63 | 
64 |
65 | 
66 |
67 | 
68 |
69 |
70 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 | [English](README.md)
2 |
3 | FlashlightPlugins
4 | =================
5 |
6 | 基于 Flashlight (https://github.com/nate-parrott/Flashlight/) 的中文插件列表
7 |
8 | ##Install##
9 |
10 | - 安装并启用 Flashlight (https://github.com/nate-parrott/Flashlight/releases)
11 | - 复制你需要启用的插件 (bundle 文件) 到 `~/Library/FlashlightPlugins`
12 |
13 | 如果你熟悉命令行,可以用 `ln -s bundle_name.bundle ~/Library/FlashlightPlugins` 安装插件以便通过 git 更新。
14 |
15 | ##使用##
16 |
17 | ###Timestamp###
18 |
19 | - `timestamp` 查看当前时间戳
20 | - `timestamp 1400000000` 将时间戳转化成可读的字符串形式
21 |
22 | `ts` 是 `timestamp` 的缩写,你可以用 `ts 1400000000` 以减少输入。
23 |
24 | ###搜狗号码通###
25 |
26 | - `haomatong 10086` 从搜狗号码通查看号码相关信息
27 |
28 | `hmt` 是 `haomatong` 的缩写,使用 `hmt 10086` 以减少输入。
29 |
30 | 
31 |
32 | ###快递 100###
33 |
34 | - `kuaidi 100033892580` 从快递 100 获取快递信息
35 |
36 | 
37 |
38 | ###有道词典 (作者:[Hyde Wang](https://github.com/callmewhy))###
39 |
40 | - `youdao one` 英译中
41 | - `youdao 汪` 中译英
42 |
43 | `yd` 是 `youdao` 的缩写,你可以使用 `yd flower` 以减少输入。
44 |
45 | 回车在浏览器中查看有道上的完整释义
46 |
47 | 
48 |
49 | ###Douban###
50 |
51 | - `douban 星际穿越` 搜索电影
52 |
53 | 
54 |
55 | ###知乎日报 (By [小贼ZH](https://github.com/ZHONGHuanGit/ZhihuDaily))
56 |
57 |
58 | - `zhihu daily` 展示日报
59 | - `zhihu hot` 展示今日热点话题
60 | - `zhihu 20141111` 展示某个日期的话题
61 |
62 | 
63 |
64 | 
65 |
66 | 
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/Zhihu.bundle/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/Zhihu.bundle/Icon.png
--------------------------------------------------------------------------------
/Zhihu.bundle/error.html:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
输入格式错误,请参考下面格式(Wrong input!)
20 |
21 | 输入:
22 | zhihu daily (展示最新内容)
23 | zhihu hot (展示热点内容)
24 | zhihu 日期(如:20140822) (展示该日期热点)
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Zhihu.bundle/examples.txt:
--------------------------------------------------------------------------------
1 | zhihu ~query(diary)
2 |
--------------------------------------------------------------------------------
/Zhihu.bundle/info.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "zhihuDaily",
3 | "displayName": "Zhihu Daily",
4 | "description": "Display Zhi Hu Daily to users based on youzhihu, you can get the latest questions or hot topics with it, even the news of specific date.",
5 | "examples": ["zhihu daily(show latest news)", "zhihu hot(show hot topics)", "zhihu 20140822(show the topics On August 22, 2014)"],
6 | "categories": ["Information"]
7 | }
8 |
--------------------------------------------------------------------------------
/Zhihu.bundle/plugin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #!/usr/bin/python
3 |
4 | import json, urllib,urllib2, os
5 |
6 | def getURL(parsed):
7 | q = parsed['~query'] if '~query' in parsed else "";
8 | q = q.lower().strip();
9 | q = "" if q == "daily" else q;
10 | # print q;
11 | q = "date/"+q if q!="" and q[0].isdigit() else q;
12 | url = "http://youzhihu.com/"+format(urllib.quote(q))
13 | # print url;
14 | return url;
15 |
16 | def results(parsed, original_query):
17 | html = ""
18 | try:
19 | url = getURL(parsed)
20 | html = """
25 | """ % (json.dumps(url))
26 |
27 | except:
28 | error_file = open('error.html')
29 | html = error_file.read().decode('utf-8')
30 | error_file.close()
31 | # print html
32 |
33 | return {
34 | "title": "知乎",
35 | "html": html,
36 | }
37 |
38 | # results({"~query":"20140822"},{});
--------------------------------------------------------------------------------
/douban.bundle/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/douban.bundle/Icon.png
--------------------------------------------------------------------------------
/douban.bundle/crel.js:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2012 Kory Nunn
2 |
3 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 | /*
10 |
11 | This code is not formatted for readability, but rather run-speed and to assist compilers.
12 |
13 | However, the code's intention should be transparent.
14 |
15 | *** IE SUPPORT ***
16 |
17 | If you require this library to work in IE7, add the following after declaring crel.
18 |
19 | var testDiv = document.createElement('div'),
20 | testLabel = document.createElement('label');
21 |
22 | testDiv.setAttribute('class', 'a');
23 | testDiv['className'] !== 'a' ? crel.attrMap['class'] = 'className':undefined;
24 | testDiv.setAttribute('name','a');
25 | testDiv['name'] !== 'a' ? crel.attrMap['name'] = function(element, value){
26 | element.id = value;
27 | }:undefined;
28 |
29 |
30 | testLabel.setAttribute('for', 'a');
31 | testLabel['htmlFor'] !== 'a' ? crel.attrMap['for'] = 'htmlFor':undefined;
32 |
33 |
34 |
35 | */
36 |
37 | (function (root, factory) {
38 | if (typeof exports === 'object') {
39 | module.exports = factory();
40 | } else if (typeof define === 'function' && define.amd) {
41 | define(factory);
42 | } else {
43 | root.crel = factory();
44 | }
45 | }(this, function () {
46 | var fn = 'function',
47 | obj = 'object',
48 | isType = function(a, type){
49 | return typeof a === type;
50 | },
51 | isNode = typeof Node === fn ? function (object) {
52 | return object instanceof Node;
53 | } :
54 | // in IE <= 8 Node is an object, obviously..
55 | function(object){
56 | return object &&
57 | isType(object, obj) &&
58 | ('nodeType' in object) &&
59 | isType(object.ownerDocument,obj);
60 | },
61 | isElement = function (object) {
62 | return crel.isNode(object) && object.nodeType === 1;
63 | },
64 | isArray = function(a){
65 | return a instanceof Array;
66 | },
67 | appendChild = function(element, child) {
68 | if(!isNode(child)){
69 | child = document.createTextNode(child);
70 | }
71 | element.appendChild(child);
72 | };
73 |
74 |
75 | function crel(){
76 | var args = arguments, //Note: assigned to a variable to assist compilers. Saves about 40 bytes in closure compiler. Has negligable effect on performance.
77 | element = args[0],
78 | child,
79 | settings = args[1],
80 | childIndex = 2,
81 | argumentsLength = args.length,
82 | attributeMap = crel.attrMap;
83 |
84 | element = crel.isElement(element) ? element : document.createElement(element);
85 | // shortcut
86 | if(argumentsLength === 1){
87 | return element;
88 | }
89 |
90 | if(!isType(settings,obj) || crel.isNode(settings) || isArray(settings)) {
91 | --childIndex;
92 | settings = null;
93 | }
94 |
95 | // shortcut if there is only one child that is a string
96 | if((argumentsLength - childIndex) === 1 && isType(args[childIndex], 'string') && element.textContent !== undefined){
97 | element.textContent = args[childIndex];
98 | }else{
99 | for(; childIndex < argumentsLength; ++childIndex){
100 | child = args[childIndex];
101 |
102 | if(child == null){
103 | continue;
104 | }
105 |
106 | if (isArray(child)) {
107 | for (var i=0; i < child.length; ++i) {
108 | appendChild(element, child[i]);
109 | }
110 | } else {
111 | appendChild(element, child);
112 | }
113 | }
114 | }
115 |
116 | for(var key in settings){
117 | if(!attributeMap[key]){
118 | element.setAttribute(key, settings[key]);
119 | }else{
120 | var attr = crel.attrMap[key];
121 | if(typeof attr === fn){
122 | attr(element, settings[key]);
123 | }else{
124 | element.setAttribute(attr, settings[key]);
125 | }
126 | }
127 | }
128 |
129 | return element;
130 | }
131 |
132 | // Used for mapping one kind of attribute to the supported version of that in bad browsers.
133 | // String referenced so that compilers maintain the property name.
134 | crel['attrMap'] = {};
135 |
136 | // String referenced so that compilers maintain the property name.
137 | crel["isElement"] = isElement;
138 | crel["isNode"] = isNode;
139 |
140 | return crel;
141 | }));
142 |
--------------------------------------------------------------------------------
/douban.bundle/douban.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
63 |
136 |
137 |
138 |
139 |
140 |
141 | Loading...
142 |
143 |
144 |
145 |
146 | Oops, failed to load result.
147 |
148 |
149 |
150 |
151 |
152 |
153 |
--------------------------------------------------------------------------------
/douban.bundle/examples.txt:
--------------------------------------------------------------------------------
1 | douban ~keyword(Star Wars)
2 |
--------------------------------------------------------------------------------
/douban.bundle/info.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "douban",
3 | "displayName": "Douban Movie",
4 | "displayName_zh": "豆瓣电影",
5 | "description": "Look for movie info on douban",
6 | "description_zh": "快速搜索豆瓣电影",
7 | "examples": ["douban Interstellar"],
8 | "categories": ["Information", "Media"]
9 | }
10 |
--------------------------------------------------------------------------------
/douban.bundle/plugin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #!/usr/bin/python
3 |
4 | import sys, os, re
5 | import urllib
6 |
7 | def results(parsed, original_query):
8 | keyword = parsed.get('~keyword', '').strip()
9 | html = open("douban.html").read().replace("", keyword)
10 | return {
11 | "title": u'豆瓣搜索 "%s" 结果' % (keyword.decode('utf-8')),
12 | "html": html,
13 | "run_args": [keyword],
14 | "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
15 | "webview_links_open_in_browser": True,
16 | }
17 |
18 | def run(keyword):
19 | if keyword:
20 | os.system('open "http://movie.douban.com/subject_search?search_text={0}"'.format(urllib.quote(keyword)))
21 |
--------------------------------------------------------------------------------
/haomatong.bundle/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/haomatong.bundle/Icon.png
--------------------------------------------------------------------------------
/haomatong.bundle/crel.js:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2012 Kory Nunn
2 |
3 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 | /*
10 |
11 | This code is not formatted for readability, but rather run-speed and to assist compilers.
12 |
13 | However, the code's intention should be transparent.
14 |
15 | *** IE SUPPORT ***
16 |
17 | If you require this library to work in IE7, add the following after declaring crel.
18 |
19 | var testDiv = document.createElement('div'),
20 | testLabel = document.createElement('label');
21 |
22 | testDiv.setAttribute('class', 'a');
23 | testDiv['className'] !== 'a' ? crel.attrMap['class'] = 'className':undefined;
24 | testDiv.setAttribute('name','a');
25 | testDiv['name'] !== 'a' ? crel.attrMap['name'] = function(element, value){
26 | element.id = value;
27 | }:undefined;
28 |
29 |
30 | testLabel.setAttribute('for', 'a');
31 | testLabel['htmlFor'] !== 'a' ? crel.attrMap['for'] = 'htmlFor':undefined;
32 |
33 |
34 |
35 | */
36 |
37 | (function (root, factory) {
38 | if (typeof exports === 'object') {
39 | module.exports = factory();
40 | } else if (typeof define === 'function' && define.amd) {
41 | define(factory);
42 | } else {
43 | root.crel = factory();
44 | }
45 | }(this, function () {
46 | var fn = 'function',
47 | obj = 'object',
48 | isType = function(a, type){
49 | return typeof a === type;
50 | },
51 | isNode = typeof Node === fn ? function (object) {
52 | return object instanceof Node;
53 | } :
54 | // in IE <= 8 Node is an object, obviously..
55 | function(object){
56 | return object &&
57 | isType(object, obj) &&
58 | ('nodeType' in object) &&
59 | isType(object.ownerDocument,obj);
60 | },
61 | isElement = function (object) {
62 | return crel.isNode(object) && object.nodeType === 1;
63 | },
64 | isArray = function(a){
65 | return a instanceof Array;
66 | },
67 | appendChild = function(element, child) {
68 | if(!isNode(child)){
69 | child = document.createTextNode(child);
70 | }
71 | element.appendChild(child);
72 | };
73 |
74 |
75 | function crel(){
76 | var args = arguments, //Note: assigned to a variable to assist compilers. Saves about 40 bytes in closure compiler. Has negligable effect on performance.
77 | element = args[0],
78 | child,
79 | settings = args[1],
80 | childIndex = 2,
81 | argumentsLength = args.length,
82 | attributeMap = crel.attrMap;
83 |
84 | element = crel.isElement(element) ? element : document.createElement(element);
85 | // shortcut
86 | if(argumentsLength === 1){
87 | return element;
88 | }
89 |
90 | if(!isType(settings,obj) || crel.isNode(settings) || isArray(settings)) {
91 | --childIndex;
92 | settings = null;
93 | }
94 |
95 | // shortcut if there is only one child that is a string
96 | if((argumentsLength - childIndex) === 1 && isType(args[childIndex], 'string') && element.textContent !== undefined){
97 | element.textContent = args[childIndex];
98 | }else{
99 | for(; childIndex < argumentsLength; ++childIndex){
100 | child = args[childIndex];
101 |
102 | if(child == null){
103 | continue;
104 | }
105 |
106 | if (isArray(child)) {
107 | for (var i=0; i < child.length; ++i) {
108 | appendChild(element, child[i]);
109 | }
110 | } else {
111 | appendChild(element, child);
112 | }
113 | }
114 | }
115 |
116 | for(var key in settings){
117 | if(!attributeMap[key]){
118 | element.setAttribute(key, settings[key]);
119 | }else{
120 | var attr = crel.attrMap[key];
121 | if(typeof attr === fn){
122 | attr(element, settings[key]);
123 | }else{
124 | element.setAttribute(attr, settings[key]);
125 | }
126 | }
127 | }
128 |
129 | return element;
130 | }
131 |
132 | // Used for mapping one kind of attribute to the supported version of that in bad browsers.
133 | // String referenced so that compilers maintain the property name.
134 | crel['attrMap'] = {};
135 |
136 | // String referenced so that compilers maintain the property name.
137 | crel["isElement"] = isElement;
138 | crel["isNode"] = isNode;
139 |
140 | return crel;
141 | }));
142 |
--------------------------------------------------------------------------------
/haomatong.bundle/examples.txt:
--------------------------------------------------------------------------------
1 | hmt number(10086)
2 | haomatong number(10086)
3 |
--------------------------------------------------------------------------------
/haomatong.bundle/haomatong.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
68 |
107 |
108 |
109 |
110 |
111 |
112 | Loading...
113 |
114 |
115 |
116 |
117 | Oops, failed to load result.
118 |
119 |
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/haomatong.bundle/info.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "haomatong",
3 | "displayName": "Sogou Haomatong",
4 | "displayName_zh": "搜狗号码通",
5 | "description": "Search for a phone number in Sogou Haomatong database",
6 | "description_zh": "在搜狗号码通数据库中搜索号码相关信息",
7 | "examples": ["hmt 10086", "haomatong 10086"],
8 | "categories": ["Search", "Information"]
9 | }
10 |
--------------------------------------------------------------------------------
/haomatong.bundle/plugin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #!/usr/bin/python
3 |
4 | import sys, os, re
5 | import json
6 |
7 | def results(parsed, original_query):
8 | number = parsed.get('number', '')
9 | number = re.sub(r'[^0-9]', '', number)
10 | html = open("haomatong.html").read().decode('utf-8').replace("", number)
11 | return {
12 | "title": u'号码通搜索 "%s" 结果' % (number.decode('utf-8')),
13 | "html": html,
14 | "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
15 | "webview_links_open_in_browser": True,
16 | }
17 |
--------------------------------------------------------------------------------
/images/douban.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/images/douban.png
--------------------------------------------------------------------------------
/images/haomatong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/images/haomatong.png
--------------------------------------------------------------------------------
/images/kuaidi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/images/kuaidi.png
--------------------------------------------------------------------------------
/images/youdao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/images/youdao.png
--------------------------------------------------------------------------------
/kuaidi.bundle/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/kuaidi.bundle/Icon.png
--------------------------------------------------------------------------------
/kuaidi.bundle/crel.js:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2012 Kory Nunn
2 |
3 | //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 | /*
10 |
11 | This code is not formatted for readability, but rather run-speed and to assist compilers.
12 |
13 | However, the code's intention should be transparent.
14 |
15 | *** IE SUPPORT ***
16 |
17 | If you require this library to work in IE7, add the following after declaring crel.
18 |
19 | var testDiv = document.createElement('div'),
20 | testLabel = document.createElement('label');
21 |
22 | testDiv.setAttribute('class', 'a');
23 | testDiv['className'] !== 'a' ? crel.attrMap['class'] = 'className':undefined;
24 | testDiv.setAttribute('name','a');
25 | testDiv['name'] !== 'a' ? crel.attrMap['name'] = function(element, value){
26 | element.id = value;
27 | }:undefined;
28 |
29 |
30 | testLabel.setAttribute('for', 'a');
31 | testLabel['htmlFor'] !== 'a' ? crel.attrMap['for'] = 'htmlFor':undefined;
32 |
33 |
34 |
35 | */
36 |
37 | (function (root, factory) {
38 | if (typeof exports === 'object') {
39 | module.exports = factory();
40 | } else if (typeof define === 'function' && define.amd) {
41 | define(factory);
42 | } else {
43 | root.crel = factory();
44 | }
45 | }(this, function () {
46 | var fn = 'function',
47 | obj = 'object',
48 | isType = function(a, type){
49 | return typeof a === type;
50 | },
51 | isNode = typeof Node === fn ? function (object) {
52 | return object instanceof Node;
53 | } :
54 | // in IE <= 8 Node is an object, obviously..
55 | function(object){
56 | return object &&
57 | isType(object, obj) &&
58 | ('nodeType' in object) &&
59 | isType(object.ownerDocument,obj);
60 | },
61 | isElement = function (object) {
62 | return crel.isNode(object) && object.nodeType === 1;
63 | },
64 | isArray = function(a){
65 | return a instanceof Array;
66 | },
67 | appendChild = function(element, child) {
68 | if(!isNode(child)){
69 | child = document.createTextNode(child);
70 | }
71 | element.appendChild(child);
72 | };
73 |
74 |
75 | function crel(){
76 | var args = arguments, //Note: assigned to a variable to assist compilers. Saves about 40 bytes in closure compiler. Has negligable effect on performance.
77 | element = args[0],
78 | child,
79 | settings = args[1],
80 | childIndex = 2,
81 | argumentsLength = args.length,
82 | attributeMap = crel.attrMap;
83 |
84 | element = crel.isElement(element) ? element : document.createElement(element);
85 | // shortcut
86 | if(argumentsLength === 1){
87 | return element;
88 | }
89 |
90 | if(!isType(settings,obj) || crel.isNode(settings) || isArray(settings)) {
91 | --childIndex;
92 | settings = null;
93 | }
94 |
95 | // shortcut if there is only one child that is a string
96 | if((argumentsLength - childIndex) === 1 && isType(args[childIndex], 'string') && element.textContent !== undefined){
97 | element.textContent = args[childIndex];
98 | }else{
99 | for(; childIndex < argumentsLength; ++childIndex){
100 | child = args[childIndex];
101 |
102 | if(child == null){
103 | continue;
104 | }
105 |
106 | if (isArray(child)) {
107 | for (var i=0; i < child.length; ++i) {
108 | appendChild(element, child[i]);
109 | }
110 | } else {
111 | appendChild(element, child);
112 | }
113 | }
114 | }
115 |
116 | for(var key in settings){
117 | if(!attributeMap[key]){
118 | element.setAttribute(key, settings[key]);
119 | }else{
120 | var attr = crel.attrMap[key];
121 | if(typeof attr === fn){
122 | attr(element, settings[key]);
123 | }else{
124 | element.setAttribute(attr, settings[key]);
125 | }
126 | }
127 | }
128 |
129 | return element;
130 | }
131 |
132 | // Used for mapping one kind of attribute to the supported version of that in bad browsers.
133 | // String referenced so that compilers maintain the property name.
134 | crel['attrMap'] = {};
135 |
136 | // String referenced so that compilers maintain the property name.
137 | crel["isElement"] = isElement;
138 | crel["isNode"] = isNode;
139 |
140 | return crel;
141 | }));
142 |
--------------------------------------------------------------------------------
/kuaidi.bundle/examples.txt:
--------------------------------------------------------------------------------
1 | kuaidi number(100033892580)
2 |
--------------------------------------------------------------------------------
/kuaidi.bundle/info.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "kuaidi",
3 | "displayName": "Kuaidi",
4 | "displayName_zh": "快递 100",
5 | "description": "Look for express info",
6 | "description_zh": "在快递 100 上搜索快递信息",
7 | "examples": ["kuaidi 100033892580"],
8 | "categories": ["Information", "Search"]
9 | }
10 |
--------------------------------------------------------------------------------
/kuaidi.bundle/kuaidi.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
70 |
129 |
130 |
131 |
132 |
133 |
134 | Loading...
135 |
136 |
137 |
138 |
139 | Oops, failed to load result.
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/kuaidi.bundle/plugin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #!/usr/bin/python
3 |
4 | import sys, os, re
5 | import urllib
6 | import json
7 | import random
8 |
9 | def results(parsed, original_query):
10 | number = parsed.get('number', '')
11 | number = re.sub(r'[^0-9]', '', number)
12 | html = open("kuaidi.html").read().replace("", number)
13 | return {
14 | "title": u'快递 100 搜索 "%s" 结果' % number,
15 | "html": html,
16 | "run_args": [number],
17 | "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
18 | "webview_links_open_in_browser": True,
19 | }
20 |
21 | def run(number):
22 | if number:
23 | os.system('open "http://m.kuaidi100.com/result.jsp?nu={0}"'.format(urllib.quote(number)))
24 |
--------------------------------------------------------------------------------
/timestamp.bundle/examples.txt:
--------------------------------------------------------------------------------
1 | ts
2 | ts timestamp(1400000000)
3 | timestamp
4 | timestamp timestamp(1400000000)
5 |
--------------------------------------------------------------------------------
/timestamp.bundle/info.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "timestamp",
3 | "displayName": "Timestamp",
4 | "description": "Convert timestamp to readable string",
5 | "examples": ["timestamp", "timestamp 1400000000", "ts", "ts 1400000000"],
6 | "categories": ["Utilities"]
7 | }
8 |
--------------------------------------------------------------------------------
/timestamp.bundle/plugin.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import sys, urllib, os, time, datetime
4 |
5 | def results(parsed, original_query):
6 | timestamp = int(parsed.get('timestamp', time.time()))
7 | date = datetime.datetime.utcfromtimestamp(timestamp)
8 | timestring = date.strftime('%Y-%m-%d %H:%M:%S UTC')
9 | style = '''
10 |
49 | '''
50 | return {
51 | "title": '"%s" (%d) - Press ENTER to copy' % (timestring, timestamp),
52 | "html": "%s%s" % (style, "" % (timestamp, timestring)),
53 | "run_args": ['"%s" (%d)' % (timestring, timestamp)]
54 | }
55 |
56 | def run(string):
57 | os.system('echo "{0}" | pbcopy'.format(string.replace("\"", "\\\"")))
58 |
--------------------------------------------------------------------------------
/youdaodic.bundle/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/allenhsu/FlashlightPlugins/19fe703e6217243013e3907ac37e8c24d64f1f66/youdaodic.bundle/Icon.png
--------------------------------------------------------------------------------
/youdaodic.bundle/examples.txt:
--------------------------------------------------------------------------------
1 | yd ~string(hello world)
2 | youdao ~string(call me why)
3 | 有道 ~string(why)
4 |
--------------------------------------------------------------------------------
/youdaodic.bundle/info.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "youdaodic",
3 | "displayName": "YouDao Dictionary",
4 | "description": "Translation between English and Chinese based on dic.youdao.com",
5 | "examples": ["yd why", "youdao why", "有道 why"],
6 | "categories": ["Language"]
7 | }
8 |
--------------------------------------------------------------------------------
/youdaodic.bundle/plugin.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #!/usr/bin/python
3 |
4 | import sys, os, re
5 | import urllib2
6 | import json
7 | import urllib
8 |
9 | def run(word):
10 | import os
11 | import webbrowser
12 | url = 'http://dict.youdao.com/search?q=%s' % urllib.quote(word.encode('utf-8'))
13 | webbrowser.open_new_tab(url)
14 |
15 |
16 | def results(parsed, original_query):
17 | word = parsed['~string'].encode('utf-8')
18 | html = open("youdao.html").read().replace("", word)
19 | return {
20 | 'title': u'%s 的翻译 - 回车打开网页查看' % word.decode('utf-8'),
21 | "html": html,
22 | 'run_args': [word],
23 | "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
24 | "webview_links_open_in_browser": True,
25 | }
26 |
--------------------------------------------------------------------------------
/youdaodic.bundle/youdao.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
82 |
83 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | Loading...
161 |
162 |
163 |
164 |
165 |
166 |
167 | Oops, failed to load result.
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------