username@email.com
2023-03-09 26de0696f74e183e3aadad2e9ff1918b40e5c8cc
zhengcaioa/zhengcaioa/wwwroot/js/jquery.wordexport.js
@@ -1,4 +1,4 @@
if (typeof jQuery !== "undefined" && typeof saveAs !== "undefined") {
if (typeof jQuery !== "undefined" && typeof saveAs !== "undefined") {
    (function($) {
        $.fn.wordExport = function(fileName) {
            fileName = typeof fileName !== 'undefined' ? fileName : "jQuery-Word-Export";
@@ -14,14 +14,14 @@
            };
            // Clone selected element before manipulating it
            var markup = $(this).clone();
            // Remove hidden elements from the output
            markup.each(function() {
                var self = $(this);
                if (self.is(':hidden'))
                    self.remove();
            });
            // Embed all images using Data URLs
            var images = Array();
            var img = markup.find('img');
@@ -49,7 +49,7 @@
                    data: uri.substring(uri.indexOf(",") + 1)
                };
            }
            // Prepare bottom of mhtml file with image data
            var mhtmlBottom = "\n";
            for (var i = 0; i < images.length; i++) {
@@ -60,13 +60,13 @@
                mhtmlBottom += images[i].data + "\n\n";
            }
            mhtmlBottom += "--NEXT.ITEM-BOUNDARY--";
            //TODO: load css from included stylesheet
            var styles = "";
            // Aggregate parts of the file together
            var fileContent = static.mhtml.top.replace("_html_", static.mhtml.head.replace("_styles_", styles) + static.mhtml.body.replace("_body_", markup.html())) + mhtmlBottom;
            // Create a Blob with the file contents
            var blob = new Blob([fileContent], {
                type: "application/msword;charset=utf-8"
@@ -81,4 +81,4 @@
    if (typeof saveAs === "undefined") {
        console.error("jQuery Word Export: missing dependency (FileSaver.js)");
    }
}
}