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
1 parent
9d097c2
commit ae88c6c
Showing
7 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
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,2 @@ | ||
node_modules | ||
npm-debug.log |
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,22 @@ | ||
module.exports = function (grunt) { | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
uglify: { | ||
options: { | ||
mangle: false | ||
}, | ||
my_target: { | ||
files: { | ||
'angular-gist.min.js': ['angular-gist.js'] | ||
} | ||
} | ||
} | ||
|
||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
// // Tasks | ||
grunt.registerTask('build', ['uglify']); | ||
}; |
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,27 @@ | ||
angular.module('gist') | ||
.directive('gist', function () { | ||
return { | ||
restrict: 'E', | ||
replace: true, | ||
template: '<div></div>', | ||
link: function(scope, elm, attrs) { | ||
var gistId = attrs.id; | ||
|
||
var iframe = document.createElement('iframe'); | ||
iframe.setAttribute('width', '100%'); | ||
iframe.setAttribute('frameborder', '0'); | ||
iframe.id = "gist-" + gistId; | ||
elm[0].appendChild(iframe); | ||
|
||
var iframeHtml = '<html><head><base target="_parent"><style>table{font-size:12px;}</style></head><body onload="parent.document.getElementById(\'' + iframe.id + '\').style.height=document.body.scrollHeight + \'px\'"><scr' + 'ipt type="text/javascript" src="https://gist.github.com/' + gistId + '.js"></sc'+'ript></body></html>'; | ||
|
||
var doc = iframe.document; | ||
if (iframe.contentDocument) doc = iframe.contentDocument; | ||
else if (iframe.contentWindow) doc = iframe.contentWindow.document; | ||
|
||
doc.open(); | ||
doc.writeln(iframeHtml); | ||
doc.close(); | ||
} | ||
}; | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,26 @@ | ||
{ | ||
"name": "angular-gist", | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/scottcorgan/angular-gist", | ||
"authors": [ | ||
"Scott Corgan <scottcorgan@gmail.com>" | ||
], | ||
"description": "AngularJS directive for embedding Github gists", | ||
"main": "dist/angular-gist.min.js", | ||
"keywords": [ | ||
"angular", | ||
"github", | ||
"gist" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests", | ||
"Gruntfile.js", | ||
".gitignore", | ||
"package.json" | ||
] | ||
} |
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,27 @@ | ||
{ | ||
"name": "angular-gist", | ||
"version": "0.1.0", | ||
"description": "AngularJS directive for embedding Github gists", | ||
"main": "Gruntfile.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/scottcorgan/angular-gist.git" | ||
}, | ||
"keywords": [ | ||
"angular", | ||
"gist", | ||
"github" | ||
], | ||
"author": "Scott Corgan", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/scottcorgan/angular-gist/issues" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.4.1", | ||
"grunt-contrib-uglify": "~0.2.7" | ||
} | ||
} |