From 61a9e8af864365df4ece208f213a3d49d241de0e Mon Sep 17 00:00:00 2001 From: Buu Nguyen Date: Tue, 13 May 2014 21:22:09 -0700 Subject: [PATCH] Support Safari --- .gitignore | 2 + screen_ext.png => docs/screen_ext.png | Bin screen_token.png => docs/screen_token.png | Bin gulpfile.js | 68 ++++++++++++++++++++++ package.json | 27 +++++++++ src/Info.plist | 63 ++++++++++++++++++++ {icons => src/icons}/icon128.png | Bin {icons => src/icons}/icon16.png | Bin {icons => src/icons}/icon19.png | Bin {icons => src/icons}/icon48.png | Bin inject.css => src/inject.css | 4 +- inject.js => src/inject.js | 0 {lib => src/lib}/css/jstree.css | 28 ++++----- {lib => src/lib}/images/32px.png | Bin {lib => src/lib}/images/40px.png | Bin {lib => src/lib}/images/throbber.gif | Bin {lib => src/lib}/js/base64.js | 0 {lib => src/lib}/js/github.js | 0 {lib => src/lib}/js/jquery.js | 0 {lib => src/lib}/js/jquery.pjax.js | 0 {lib => src/lib}/js/jstree.js | 0 {lib => src/lib}/js/underscore.js | 0 manifest.json => src/manifest.json | 0 23 files changed, 176 insertions(+), 16 deletions(-) rename screen_ext.png => docs/screen_ext.png (100%) rename screen_token.png => docs/screen_token.png (100%) create mode 100644 gulpfile.js create mode 100644 package.json create mode 100755 src/Info.plist rename {icons => src/icons}/icon128.png (100%) rename {icons => src/icons}/icon16.png (100%) rename {icons => src/icons}/icon19.png (100%) rename {icons => src/icons}/icon48.png (100%) rename inject.css => src/inject.css (91%) rename inject.js => src/inject.js (100%) rename {lib => src/lib}/css/jstree.css (95%) rename {lib => src/lib}/images/32px.png (100%) rename {lib => src/lib}/images/40px.png (100%) rename {lib => src/lib}/images/throbber.gif (100%) rename {lib => src/lib}/js/base64.js (100%) rename {lib => src/lib}/js/github.js (100%) rename {lib => src/lib}/js/jquery.js (100%) rename {lib => src/lib}/js/jquery.pjax.js (100%) rename {lib => src/lib}/js/jstree.js (100%) rename {lib => src/lib}/js/underscore.js (100%) rename manifest.json => src/manifest.json (100%) diff --git a/.gitignore b/.gitignore index e69de29b..76add878 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/screen_ext.png b/docs/screen_ext.png similarity index 100% rename from screen_ext.png rename to docs/screen_ext.png diff --git a/screen_token.png b/docs/screen_token.png similarity index 100% rename from screen_token.png rename to docs/screen_token.png diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..e8aae849 --- /dev/null +++ b/gulpfile.js @@ -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) +}) \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 00000000..57926569 --- /dev/null +++ b/package.json @@ -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 (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" + } +} diff --git a/src/Info.plist b/src/Info.plist new file mode 100755 index 00000000..fb58d08a --- /dev/null +++ b/src/Info.plist @@ -0,0 +1,63 @@ + + + + + Author + Buu Nguyen + Builder Version + 9537.75.14 + CFBundleDisplayName + octotree + CFBundleIdentifier + com.buunguyen.octotree + CFBundleInfoDictionaryVersion + 6.0 + CFBundleShortVersionString + 1.0.0 + CFBundleVersion + 1 + Chrome + + Content + + Scripts + + Start + + lib/js/underscore.js + lib/js/jquery.js + lib/js/jstree.js + lib/js/jquery.pjax.js + lib/js/base64.js + lib/js/github.js + inject.js + + + Stylesheets + + lib/css/jstree.css + inject.css + + + Description + Display GitHub code in tree format + ExtensionInfoDictionaryVersion + 1.0 + Permissions + + Website Access + + Allowed Domains + + github.com + + Include Secure Pages + + Level + Some + + + Website + https://github.com/buunguyen/octotree + + \ No newline at end of file diff --git a/icons/icon128.png b/src/icons/icon128.png similarity index 100% rename from icons/icon128.png rename to src/icons/icon128.png diff --git a/icons/icon16.png b/src/icons/icon16.png similarity index 100% rename from icons/icon16.png rename to src/icons/icon16.png diff --git a/icons/icon19.png b/src/icons/icon19.png similarity index 100% rename from icons/icon19.png rename to src/icons/icon19.png diff --git a/icons/icon48.png b/src/icons/icon48.png similarity index 100% rename from icons/icon48.png rename to src/icons/icon48.png diff --git a/inject.css b/src/inject.css similarity index 91% rename from inject.css rename to src/inject.css index f6cd5374..05ca0f62 100755 --- a/inject.css +++ b/src/inject.css @@ -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; diff --git a/inject.js b/src/inject.js similarity index 100% rename from inject.js rename to src/inject.js diff --git a/lib/css/jstree.css b/src/lib/css/jstree.css similarity index 95% rename from lib/css/jstree.css rename to src/lib/css/jstree.css index 7f5fe3c8..c32605ac 100755 --- a/lib/css/jstree.css +++ b/src/lib/css/jstree.css @@ -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 { diff --git a/lib/images/32px.png b/src/lib/images/32px.png similarity index 100% rename from lib/images/32px.png rename to src/lib/images/32px.png diff --git a/lib/images/40px.png b/src/lib/images/40px.png similarity index 100% rename from lib/images/40px.png rename to src/lib/images/40px.png diff --git a/lib/images/throbber.gif b/src/lib/images/throbber.gif similarity index 100% rename from lib/images/throbber.gif rename to src/lib/images/throbber.gif diff --git a/lib/js/base64.js b/src/lib/js/base64.js similarity index 100% rename from lib/js/base64.js rename to src/lib/js/base64.js diff --git a/lib/js/github.js b/src/lib/js/github.js similarity index 100% rename from lib/js/github.js rename to src/lib/js/github.js diff --git a/lib/js/jquery.js b/src/lib/js/jquery.js similarity index 100% rename from lib/js/jquery.js rename to src/lib/js/jquery.js diff --git a/lib/js/jquery.pjax.js b/src/lib/js/jquery.pjax.js similarity index 100% rename from lib/js/jquery.pjax.js rename to src/lib/js/jquery.pjax.js diff --git a/lib/js/jstree.js b/src/lib/js/jstree.js similarity index 100% rename from lib/js/jstree.js rename to src/lib/js/jstree.js diff --git a/lib/js/underscore.js b/src/lib/js/underscore.js similarity index 100% rename from lib/js/underscore.js rename to src/lib/js/underscore.js diff --git a/manifest.json b/src/manifest.json similarity index 100% rename from manifest.json rename to src/manifest.json