Skip to content

Commit

Permalink
いろいろ準備完了
Browse files Browse the repository at this point in the history
  • Loading branch information
nash committed Aug 10, 2012
1 parent 3e8a0f7 commit 9915516
Show file tree
Hide file tree
Showing 16 changed files with 234 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
icon*
*.sublime-project
*.sublime-workspace
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The MIT License
Copyright (c) 2012 nash

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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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.

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all:
cp src/popup.html bin/popup.html
cp src/popup.css bin/css/popup.css
cat src/wrapper.js src/execute.js src/main.js > bin/js/popup.js
Binary file added bin/.DS_Store
Binary file not shown.
Binary file added bin/css/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions bin/css/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h2 {
margin: 0;
}
6 changes: 6 additions & 0 deletions bin/js/jquery.ddSlick.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions bin/js/jquery.js

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions bin/js/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

// chrome.experimental.processes のラッパ的なもの
function p() {
var args = Array.prototype.slice.call(arguments);

if (args[0].substring(0, 2) == 'on') {
// chrome.experimental.processes[args[0]].addListener.apply(null, args.slice(1));
chrome.experimental.processes[args[0]].addListener(args[1]);
} else {
chrome.experimental.processes[args[0]].apply(null, args.slice(1));
}
}
// chrome.tabs のラッパ的なもの
function t() {
var args = Array.prototype.slice.call(arguments);

if (args[0].substring(0, 2) == 'on') {
// chrome.tabs[args[0]].addListener.apply(null, args.slice(1));
chrome.tabs[args[0]].addListener(args[1]);
} else {
chrome.tabs[args[0]].apply(null, args.slice(1));
}
}
// async.waterfall 的なもの
function execute() {
var funcs = Array.prototype.slice.call(arguments),
last = funcs.pop();

function wrap() {
var args = Array.prototype.slice.call(arguments);

if (funcs.length != 0) {
args.unshift(wrap);
} else {
args.unshift(null);
last.apply(null, args);
return;
}

try {
funcs.shift().apply(null, args);
} catch(e) {
last(e);
}
}

wrap();
}
window.onload = main;

var procs = [
{
text: 'すべてのプロセスを停止',
description: 'タブとプラグインのプロセスを停止します。',
value: 'all',
selected: false
}, {
text: 'プラグインプロセスを停止',
description: 'プラグインのプロセスを停止します。タブのプロセスはそのままです。',
value: 'plugin',
selected: false
}, {
text: 'タブプロセスを停止',
description: 'タブのプロセスを停止します。プラグインのあるタブは停止しません。',
value: 'tab',
selected: false
}
];

function main() {
$('#proc').ddslick({
data: procs,
width: 500
});
}
23 changes: 23 additions & 0 deletions bin/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Process Killer",
"version": "0.1",
"manifest_version": 2,
"description": "Chrome のプロセスを終了させ、メモリを節約する拡張機能です。",
"icons": {
"64": "icon64.png",
"48": "icon48.png",
"128": "icon128.png",
"32": "icon32.png",
"16": "icon16.png"
},
"browser_action": {
"default_icon": "icon128.png",
"default_popup": "popup.html",
"default_title": "Process Killer"
},
"permissions": [
"experimental",
"tabs",
"chrome://favicon/"
]
}
15 changes: 15 additions & 0 deletions bin/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="/js/jquery.js"></script>
<script src="/js/jquery.ddSlick.min.js"></script>
<script src="/js/popup.js"></script>
<link rel="stylesheet" href="/css/popup.css">
</head>
<body>
<h2>Process Killer</h2>
<div id="proc"></div>
</body>
</html>
25 changes: 25 additions & 0 deletions src/execute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// async.waterfall 的なもの
function execute() {
var funcs = Array.prototype.slice.call(arguments),
last = funcs.pop();

function wrap() {
var args = Array.prototype.slice.call(arguments);

if (funcs.length != 0) {
args.unshift(wrap);
} else {
args.unshift(null);
last.apply(null, args);
return;
}

try {
funcs.shift().apply(null, args);
} catch(e) {
last(e);
}
}

wrap();
}
27 changes: 27 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
window.onload = main;

var procs = [
{
text: 'すべてのプロセスを停止',
description: 'タブとプラグインのプロセスを停止します。',
value: 'all',
selected: false
}, {
text: 'プラグインプロセスを停止',
description: 'プラグインのプロセスを停止します。タブのプロセスはそのままです。',
value: 'plugin',
selected: false
}, {
text: 'タブプロセスを停止',
description: 'タブのプロセスを停止します。プラグインのあるタブは停止しません。',
value: 'tab',
selected: false
}
];

function main() {
$('#proc').ddslick({
data: procs,
width: 500
});
}
4 changes: 4 additions & 0 deletions src/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
h2 {
margin: 3px;
letter-spacing: -0.05em;
}
15 changes: 15 additions & 0 deletions src/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="/js/jquery.js"></script>
<script src="/js/jquery.ddSlick.min.js"></script>
<script src="/js/popup.js"></script>
<link rel="stylesheet" href="/css/popup.css">
</head>
<body>
<h2>Process Killer</h2>
<div id="proc"></div>
</body>
</html>
23 changes: 23 additions & 0 deletions src/wrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

// chrome.experimental.processes のラッパ的なもの
function p() {
var args = Array.prototype.slice.call(arguments);

if (args[0].substring(0, 2) == 'on') {
// chrome.experimental.processes[args[0]].addListener.apply(null, args.slice(1));
chrome.experimental.processes[args[0]].addListener(args[1]);
} else {
chrome.experimental.processes[args[0]].apply(null, args.slice(1));
}
}
// chrome.tabs のラッパ的なもの
function t() {
var args = Array.prototype.slice.call(arguments);

if (args[0].substring(0, 2) == 'on') {
// chrome.tabs[args[0]].addListener.apply(null, args.slice(1));
chrome.tabs[args[0]].addListener(args[1]);
} else {
chrome.tabs[args[0]].apply(null, args.slice(1));
}
}

0 comments on commit 9915516

Please sign in to comment.