Support Safari

This commit is contained in:
Buu Nguyen 2014-05-13 21:22:09 -07:00
parent 306a34c82f
commit 61a9e8af86
23 changed files with 176 additions and 16 deletions

2
.gitignore vendored
View File

@ -0,0 +1,2 @@
node_modules
dist

View File

Before

Width:  |  Height:  |  Size: 401 KiB

After

Width:  |  Height:  |  Size: 401 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

68
gulpfile.js Normal file
View File

@ -0,0 +1,68 @@
var gulp = require('gulp')
, clean = require('gulp-clean')
, replace = require('gulp-replace')
, es = require('event-stream')
, series = require('stream-series')
, rseq = require('gulp-run-sequence')
// helpers
const EXT_BASE = '@EXT_BASE@'
function pipe(src, transforms, dest) {
if (typeof transforms === 'string') {
dest = transforms
transforms = null
}
var stream = gulp.src(src)
transforms && transforms.forEach(function(transform) {
stream = stream.pipe(transform)
})
if (dest) stream = stream.pipe(gulp.dest(dest))
return stream
}
// tasks
gulp.task('clean', function() {
return pipe('./dist', [clean()])
})
gulp.task('chrome:copy', function() {
return es.merge(
pipe('./src/lib/**/*', './dist/chrome/lib'),
pipe('./src/icons/**/*', './dist/chrome/icons'),
pipe(['./src/inject.js', './src/inject.css', './src/manifest.json'], './dist/chrome/')
)
})
gulp.task('chrome', ['chrome:copy'], function() {
return pipe(
'./dist/chrome/**/*.css',
[replace(EXT_BASE, 'chrome-extension://__MSG_@@extension_id__/')],
'./dist/chrome/'
)
})
gulp.task('safari:copy', function() {
return es.merge(
pipe('./src/lib/**/*', './dist/safari/octotree.safariextension/lib'),
pipe('./src/icons/**/*', './dist/safari/octotree.safariextension/icons'),
pipe(['./src/inject.js', './src/inject.css', './src/Info.plist'], './dist/safari/octotree.safariextension/')
)
})
gulp.task('safari', ['safari:copy'], function() {
return es.merge(
pipe('./dist/safari/octotree.safariextension/inject.css', [replace(EXT_BASE, '')],
'./dist/safari/octotree.safariextension/'),
pipe('./dist/safari/octotree.safariextension/lib/css/jstree.css', [replace(EXT_BASE + 'lib/', '../')],
'./dist/safari/octotree.safariextension/lib/css')
)
})
gulp.task('firefox', function() {
// TODO
})
gulp.task('default', function(cb) {
return rseq('clean', ['chrome', 'safari', 'firefox'], cb)
})

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "octotree",
"version": "1.0.0",
"description": "Display GitHub code in tree format",
"main": "inject.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/buunguyen/octotree"
},
"author": "Buu Nguyen <buunguyen@gmail.com> (https://github.com/buunguyen)",
"license": "MIT",
"bugs": {
"url": "https://github.com/buunguyen/octotree/issues"
},
"homepage": "https://github.com/buunguyen/octotree",
"devDependencies": {
"gulp": "^3.6.2",
"gulp-clean": "^0.2.4",
"event-stream": "^3.1.5",
"gulp-run-sequence": "^0.3.2",
"gulp-replace": "^0.3.0",
"stream-series": "^0.1.0"
}
}

63
src/Info.plist Executable file
View File

@ -0,0 +1,63 @@
<?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>Buu Nguyen</string>
<key>Builder Version</key>
<string>9537.75.14</string>
<key>CFBundleDisplayName</key>
<string>octotree</string>
<key>CFBundleIdentifier</key>
<string>com.buunguyen.octotree</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>Chrome</key>
<dict/>
<key>Content</key>
<dict>
<key>Scripts</key>
<dict>
<key>Start</key>
<array>
<string>lib/js/underscore.js</string>
<string>lib/js/jquery.js</string>
<string>lib/js/jstree.js</string>
<string>lib/js/jquery.pjax.js</string>
<string>lib/js/base64.js</string>
<string>lib/js/github.js</string>
<string>inject.js</string>
</array>
</dict>
<key>Stylesheets</key>
<array>
<string>lib/css/jstree.css</string>
<string>inject.css</string>
</array>
</dict>
<key>Description</key>
<string>Display GitHub code in tree format</string>
<key>ExtensionInfoDictionaryVersion</key>
<string>1.0</string>
<key>Permissions</key>
<dict>
<key>Website Access</key>
<dict>
<key>Allowed Domains</key>
<array>
<string>github.com</string>
</array>
<key>Include Secure Pages</key>
<true/>
<key>Level</key>
<string>Some</string>
</dict>
</dict>
<key>Website</key>
<string>https://github.com/buunguyen/octotree</string>
</dict>
</plist>

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -45,13 +45,13 @@ html.octotree {
margin: 5px;
}
.jstree-icon.tree {
background: url('chrome-extension://__MSG_@@extension_id__/lib/images/32px.png') no-repeat -264px -8px;
background: url('@EXT_BASE@lib/images/32px.png') no-repeat -264px -8px;
width: 16px;
height: 16px;
border: 0;
}
.jstree-icon.blob {
background: url('chrome-extension://__MSG_@@extension_id__/lib/images/32px.png') no-repeat -106px -73px;
background: url('@EXT_BASE@lib/images/32px.png') no-repeat -106px -73px;
width: 13px;
height: 16px;
border: 0;

View File

@ -358,7 +358,7 @@
}
#jstree-dnd.jstree-default .jstree-ok,
#jstree-dnd.jstree-default .jstree-er {
background-image: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png");
background-image: url("@EXT_BASE@lib/images/32px.png");
background-repeat: no-repeat;
background-color: transparent;
}
@ -428,7 +428,7 @@
}
.jstree-default .jstree-node,
.jstree-default .jstree-icon {
background-image: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png");
background-image: url("@EXT_BASE@lib/images/32px.png");
}
.jstree-default .jstree-node {
background-position: -292px -4px;
@ -522,13 +522,13 @@
background-position: 0 0;
}
.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("chrome-extension://__MSG_@@extension_id__/lib/images/throbber.gif") center center no-repeat;
background: url("@EXT_BASE@lib/images/throbber.gif") center center no-repeat;
}
.jstree-default .jstree-file {
background: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png") -100px -68px no-repeat;
background: url("@EXT_BASE@lib/images/32px.png") -100px -68px no-repeat;
}
.jstree-default .jstree-folder {
background: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png") -260px -4px no-repeat;
background: url("@EXT_BASE@lib/images/32px.png") -260px -4px no-repeat;
}
.jstree-default.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
@ -564,7 +564,7 @@
}
.jstree-default-small .jstree-node,
.jstree-default-small .jstree-icon {
background-image: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png");
background-image: url("@EXT_BASE@lib/images/32px.png");
}
.jstree-default-small .jstree-node {
background-position: -295px -7px;
@ -658,13 +658,13 @@
background-position: 0 0;
}
.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("throbber.gif") center center no-repeat;
background: url("@EXT_BASE@lib/images/throbber.gif") center center no-repeat;
}
.jstree-default-small .jstree-file {
background: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png") -103px -71px no-repeat;
background: url("@EXT_BASE@lib/images/32px.png") -103px -71px no-repeat;
}
.jstree-default-small .jstree-folder {
background: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png") -263px -7px no-repeat;
background: url("@EXT_BASE@lib/images/32px.png") -263px -7px no-repeat;
}
.jstree-default-small.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");
@ -700,7 +700,7 @@
}
.jstree-default-large .jstree-node,
.jstree-default-large .jstree-icon {
background-image: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png");
background-image: url("@EXT_BASE@lib/images/32px.png");
}
.jstree-default-large .jstree-node {
background-position: -288px 0px;
@ -794,13 +794,13 @@
background-position: 0 0;
}
.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("throbber.gif") center center no-repeat;
background: url("@EXT_BASE@lib/images/throbber.gif") center center no-repeat;
}
.jstree-default-large .jstree-file {
background: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png") -96px -64px no-repeat;
background: url("@EXT_BASE@lib/images/32px.png") -96px -64px no-repeat;
}
.jstree-default-large .jstree-folder {
background: url("chrome-extension://__MSG_@@extension_id__/lib/images/32px.png") -256px 0px no-repeat;
background: url("@EXT_BASE@lib/images/32px.png") -256px 0px no-repeat;
}
.jstree-default-large.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");
@ -816,7 +816,7 @@
*/
}
.jstree-default-responsive .jstree-icon {
background-image: url("chrome-extension://__MSG_@@extension_id__/lib/images/40px.png");
background-image: url("@EXT_BASE@lib/images/40px.png");
}
.jstree-default-responsive .jstree-node,
.jstree-default-responsive .jstree-leaf > .jstree-ocl {

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB