-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
318 additions
and
74 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Author</key> | ||
<string>zythum_朱一</string> | ||
<key>Builder Version</key> | ||
<string>10600.3.18</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>mama2</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.zythum.mama2</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>Chrome</key> | ||
<dict> | ||
<key>Global Page</key> | ||
<string>bg.html</string> | ||
<key>Toolbar Items</key> | ||
<array> | ||
<dict> | ||
<key>Command</key> | ||
<string>MAMA2</string> | ||
<key>Identifier</key> | ||
<string>MAMA2</string> | ||
<key>Image</key> | ||
<string>mama2.png</string> | ||
<key>Include By Default</key> | ||
<true/> | ||
<key>Label</key> | ||
<string>MAMA2</string> | ||
<key>Palette Label</key> | ||
<string>MAMA2</string> | ||
<key>Tool Tip</key> | ||
<string>MAMA2</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
<key>Content</key> | ||
<dict> | ||
<key>Scripts</key> | ||
<dict> | ||
<key>Start</key> | ||
<array> | ||
<string>script.js</string> | ||
</array> | ||
</dict> | ||
<key>Whitelist</key> | ||
<array> | ||
<string>http://*/*</string> | ||
<string>https://*/*</string> | ||
</array> | ||
</dict> | ||
<key>Description</key> | ||
<string>妈妈再也不用担心我的macbook发热计划</string> | ||
<key>DeveloperIdentifier</key> | ||
<string>28M925B2TX</string> | ||
<key>ExtensionInfoDictionaryVersion</key> | ||
<string>1.0</string> | ||
<key>Permissions</key> | ||
<dict> | ||
<key>Website Access</key> | ||
<dict> | ||
<key>Include Secure Pages</key> | ||
<true/> | ||
<key>Level</key> | ||
<string>All</string> | ||
</dict> | ||
</dict> | ||
<key>Website</key> | ||
<string>http://zythum.github.io/mama2/</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>MAMA2</title> | ||
</head> | ||
<body> | ||
<script type="text/javascript"> | ||
safari.application.addEventListener("command", function (e) { | ||
if(e.command == 'MAMA2'){ | ||
safari.application.activeBrowserWindow.activeTab.page.dispatchMessage('MAMA2'); | ||
} | ||
}, false); | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var url = 'http://localhost:8000/dest/index.js' | ||
safari.self.addEventListener("message", function(theMessageEvent){ | ||
if(theMessageEvent.name == 'MAMA2'){ | ||
if(window === window.top){ | ||
(function(s){s=document.body.appendChild(document.createElement('script'));s.src=url+'?ts='+Date.now();s.charset='UTF-8';}()) | ||
} | ||
} | ||
}, false); |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* #function ajax# | ||
* < { | ||
* url: String 请求地址 | ||
* param: Object 请求参数.可缺省 | ||
* method: String 请求方法GET,POST,etc. 可缺省,默认是GET | ||
* callback: Function 请求的callback, 如果失败返回-1, 成功返回内容 | ||
* contentType: String 返回内容的格式。如果是JOSN会做JSON Parse, 可缺省,默认是json | ||
* context: Any callback回调函数的this指向。可缺省 | ||
* } | ||
* 用于发起ajax或者jsonp请求 | ||
*/ | ||
|
||
var jsonp = require('./jsonp') | ||
var noop = require('./noop') | ||
var queryString = require('./queryString') | ||
|
||
function defalutOption (option, defalutValue) { | ||
return option === undefined ? defalutValue : option | ||
} | ||
|
||
function queryString (obj) { | ||
var query = [] | ||
for (one in obj) { | ||
if (obj.hasOwnProperty(one)) { | ||
query.push([one, obj[one]].join('=')) | ||
} | ||
} | ||
return query.join('&') | ||
} | ||
|
||
function joinUrl (url, queryString) { | ||
return url + (url.indexOf('?') ? '?' : '&') + queryString | ||
} | ||
|
||
function ajax (options) { | ||
var url = defalutOption(options.url, '') | ||
var query = queryString( defalutOption(options.param, {}) ) | ||
var method = defalutOption(options.method, 'GET') | ||
var callback = defalutOption(options.callback, noop) | ||
var contentType = defalutOption(options.contentType, 'json') | ||
var context = defalutOption(options.context, null) | ||
|
||
if (options.jsonp) { | ||
return jsonp( | ||
joinUrl(url, query), | ||
callback.bind(context), | ||
typeof options.jsonp === 'string' ? options.jsonp : undefined | ||
) | ||
} | ||
|
||
var xhr = new XMLHttpRequest() | ||
if (method === 'get') { | ||
url = joinUrl(url, query) | ||
query = '' | ||
} | ||
xhr.open(method, url, true) | ||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8') | ||
xhr.send(query) | ||
xhr.onreadystatechange = function () { | ||
if (xhr.readyState === 4 ) { | ||
if (xhr.status === 200) { | ||
var data = request.responseText | ||
if (contentType.toLowerCase() === 'json') { | ||
try { | ||
data = JSON.parse(data) | ||
} catch(e) { | ||
data = -1 | ||
} | ||
} | ||
return callback.call(context, data) | ||
} else { | ||
return callback.call(context, -1) | ||
} | ||
} | ||
} | ||
} | ||
module.exports = ajax; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
/* #Bool canPlayM3U8# | ||
* 返回浏览器是否支持m3u8格式的视频播放。 | ||
* 目前chrome,firefox只支持mp4 | ||
*/ | ||
module.exports = !!document.createElement('video').canPlayType('application/x-mpegURL') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.