googledocviewer 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec512dbf54982a42ca909754f03e8205d29b051
|
4
|
+
data.tar.gz: 44b0ecb96eefbe95b94e2c3f83e776f4fd25faaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a8ec90713de254d05596d209bbb5bf188a94c2124ff9b1ef48aa9f0722f8c29611115504b3fe124b4aa64de21f76fd40970423616e29fdd302932725e9cf51
|
7
|
+
data.tar.gz: 8bc04416a25e5a4940b40380a3de0c898f41f0b5c901a4f4591a183e90a90906ee00d05c9ed61f544cc73b70306d8ad829b78eeea00baf3c4e20b197d7116c3e
|
data/README.md
CHANGED
@@ -30,14 +30,24 @@ You will need to add global jquery_mb_extruder object in your application.js:
|
|
30
30
|
|
31
31
|
|
32
32
|
Set some class name or id to the anchor tag for all URLs to files that you want to be displayed using the Google Docs Viewer. E.g. "embed"
|
33
|
+
|
34
|
+
```html
|
33
35
|
<a href="url/to/file.pdf" class="embed">Download file</a>
|
36
|
+
```
|
34
37
|
or
|
38
|
+
```html
|
35
39
|
<a href="url/to/file.pdf" id="embedURL">Download file</a>
|
40
|
+
```
|
36
41
|
|
37
42
|
Initialize gDocsViewer and set it to process the URL with id or all URLs with the class name set in the previous step.
|
43
|
+
|
44
|
+
```html
|
38
45
|
$('a.embed').gdocsViewer();
|
46
|
+
```
|
39
47
|
or
|
48
|
+
```html
|
40
49
|
$('#embedURL').gdocsViewer();
|
50
|
+
```
|
41
51
|
|
42
52
|
## Contributing
|
43
53
|
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require jquery.gdocsviewer.min
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery.gdocViewer - Embed linked documents using Google Docs Viewer
|
3
|
+
* Licensed under MIT license.
|
4
|
+
* Date: 2011/01/16
|
5
|
+
*
|
6
|
+
* @author Jawish Hameed
|
7
|
+
* @version 1.0
|
8
|
+
*/
|
9
|
+
(function($){
|
10
|
+
$.fn.gdocsViewer = function(options) {
|
11
|
+
|
12
|
+
var settings = {
|
13
|
+
width : '600',
|
14
|
+
height : '700'
|
15
|
+
};
|
16
|
+
|
17
|
+
if (options) {
|
18
|
+
$.extend(settings, options);
|
19
|
+
}
|
20
|
+
|
21
|
+
return this.each(function() {
|
22
|
+
var file = $(this).attr('href');
|
23
|
+
var ext = file.substring(file.lastIndexOf('.') + 1);
|
24
|
+
|
25
|
+
if (/^(tiff|pdf|ppt|pps|doc|docx)$/.test(ext)) {
|
26
|
+
$(this).after(function () {
|
27
|
+
var id = $(this).attr('id');
|
28
|
+
var gdvId = (typeof id !== 'undefined' && id !== false) ? id + '-gdocsviewer' : '';
|
29
|
+
return '<div id="' + gdvId + '" class="gdocsviewer"><iframe src="http://docs.google.com/viewer?embedded=true&url=' + encodeURIComponent(file) + '" width="' + settings.width + '" height="' + settings.height + '" style="border: none;"></iframe></div>';
|
30
|
+
})
|
31
|
+
}
|
32
|
+
});
|
33
|
+
};
|
34
|
+
})( jQuery );
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery.gdocViewer - Embed linked documents using Google Docs Viewer
|
3
|
+
* Licensed under MIT license.
|
4
|
+
* Date: 2011/01/16
|
5
|
+
*
|
6
|
+
* @author Jawish Hameed
|
7
|
+
* @version 1.0
|
8
|
+
*/
|
9
|
+
(function(a){a.fn.gdocsViewer=function(b){var c={width:"600",height:"700"};if(b){a.extend(c,b)}return this.each(function(){var d=a(this).attr("href");var e=d.substring(d.lastIndexOf(".")+1);if(/^(tiff|pdf|ppt|pps|doc|docx)$/.test(e)){a(this).after(function(){var g=a(this).attr("id");var f=(typeof g!=="undefined"&&g!==false)?g+"-gdocsviewer":"";return'<div id="'+f+'" class="gdocsviewer"><iframe src="http://docs.google.com/viewer?embedded=true&url='+encodeURIComponent(d)+'" width="'+c.width+'" height="'+c.height+'" style="border: none;"></iframe></div>'})}})}})(jQuery);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googledocviewer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Mitchell
|
@@ -67,6 +67,9 @@ files:
|
|
67
67
|
- googledocviewer.gemspec
|
68
68
|
- lib/googledocviewer.rb
|
69
69
|
- lib/googledocviewer/version.rb
|
70
|
+
- vendor/assets/javascripts/googledocviewer.js
|
71
|
+
- vendor/assets/javascripts/jquery.gdocsviewer.js
|
72
|
+
- vendor/assets/javascripts/jquery.gdocsviewer.min.js
|
70
73
|
homepage: https://github.com/scy0846/googledocviewer
|
71
74
|
licenses:
|
72
75
|
- MIT
|