최초커밋
This commit is contained in:
34
WebContent/js/jquery.gdocsviewer.js
Normal file
34
WebContent/js/jquery.gdocsviewer.js
Normal file
@@ -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|pptx|pps|doc|docx|do)$/.test(ext)) {
|
||||
$(this).after(function () {
|
||||
var id = $(this).attr('id');
|
||||
var gdvId = (typeof id !== 'undefined' && id !== false) ? id + '-gdocsviewer' : '';
|
||||
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>';
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
})( jQuery );
|
||||
Reference in New Issue
Block a user