From ed2f813e844b5c428e24d9df2fedffd3b30c8680 Mon Sep 17 00:00:00 2001 From: Jawish Hameed Date: Sun, 20 Apr 2014 10:27:41 +0500 Subject: [PATCH] Initial commit to import code to git --- README.md | 0 jquery.gdocsviewer.js | 34 ++++++++++++++++++++++++ jquery.gdocsviewer.min.js | 9 +++++++ jquery.gdocsviewer_demo.html | 50 ++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 README.md create mode 100644 jquery.gdocsviewer.js create mode 100644 jquery.gdocsviewer.min.js create mode 100644 jquery.gdocsviewer_demo.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/jquery.gdocsviewer.js b/jquery.gdocsviewer.js new file mode 100644 index 0000000..b313d4f --- /dev/null +++ b/jquery.gdocsviewer.js @@ -0,0 +1,34 @@ +/* + * jQuery.gdocViewer - Embed linked documents using Google Docs Viewer + * Licensed under MIT license. + * Date: 2011/01/16 + * + * @author Jawish Hameed + * @version 1.0 + */ +(function($){ + $.fn.gdocsViewer = function(options) { + + var settings = { + width : '600', + height : '700' + }; + + if (options) { + $.extend(settings, options); + } + + return this.each(function() { + var file = $(this).attr('href'); + var ext = file.substring(file.lastIndexOf('.') + 1); + + if (/^(tiff|pdf|ppt|pps|doc|docx)$/.test(ext)) { + $(this).after(function () { + var id = $(this).attr('id'); + var gdvId = (typeof id !== 'undefined' && id !== false) ? id + '-gdocsviewer' : ''; + return '
'; + }) + } + }); + }; +})( jQuery ); \ No newline at end of file diff --git a/jquery.gdocsviewer.min.js b/jquery.gdocsviewer.min.js new file mode 100644 index 0000000..16ecd1c --- /dev/null +++ b/jquery.gdocsviewer.min.js @@ -0,0 +1,9 @@ +/* + * jQuery.gdocViewer - Embed linked documents using Google Docs Viewer + * Licensed under MIT license. + * Date: 2011/01/16 + * + * @author Jawish Hameed + * @version 1.0 + */ +(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'
'})}})}})(jQuery); \ No newline at end of file diff --git a/jquery.gdocsviewer_demo.html b/jquery.gdocsviewer_demo.html new file mode 100644 index 0000000..da5b380 --- /dev/null +++ b/jquery.gdocsviewer_demo.html @@ -0,0 +1,50 @@ + + +gDocsViewer Demo + + + + + + +
+

gDocsViewer jQuery plugin v1.0 Demo

+
+

By Jawish Hameed

+ +

See documentation and usage guide

+ +
+
+
+

Examples

+

URLs with class: embed

+ PDF test georgetown.edu + PDF at mozdev.org + +

URLs with id: embedURL

+ Sample PDF at samplepdf.com +
+
+ + \ No newline at end of file