(function (a) {
if (!a.browser) {
a.browser = {};
a.browser.mozilla = !1;
a.browser.webkit = !1;
a.browser.opera = !1;
a.browser.msie = !1;
var b = navigator.userAgent;
a.browser.name = navigator.appName;
a.browser.fullVersion = "" + parseFloat(navigator.appVersion);
a.browser.majorVersion = parseInt(navigator.appVersion, 10);
var f, c; - 1 != (c = b.indexOf("Opera")) ? (a.browser.opera = !0, a.browser.name = "Opera", a.browser.fullVersion = b.substring(c + 6), -1 != (c = b.indexOf("Version")) && (a.browser.fullVersion = b.substring(c + 8))) : -1 != (c = b.indexOf("MSIE")) ? (a.browser.msie = !0, a.browser.name = "Microsoft Internet Explorer", a.browser.fullVersion = b.substring(c + 5)) : -1 != (c = b.indexOf("Chrome")) ? (a.browser.webkit = !0, a.browser.name = "Chrome", a.browser.fullVersion = b.substring(c + 7)) : -1 != (c = b.indexOf("Safari")) ? (a.browser.webkit = !0, a.browser.name = "Safari", a.browser.fullVersion = b.substring(c + 7), -1 != (c = b.indexOf("Version")) && (a.browser.fullVersion = b.substring(c + 8))) : -1 != (c = b.indexOf("Firefox")) ? (a.browser.mozilla = !0, a.browser.name = "Firefox", a.browser.fullVersion = b.substring(c + 8)) : (f = b.lastIndexOf(" ") + 1) < (c = b.lastIndexOf("/")) && (a.browser.name = b.substring(f, c), a.browser.fullVersion = b.substring(c + 1), a.browser.name.toLowerCase() == a.browser.name.toUpperCase() && (a.browser.name = navigator.appName)); - 1 != (b = a.browser.fullVersion.indexOf(";")) && (a.browser.fullVersion = a.browser.fullVersion.substring(0, b)); - 1 != (b = a.browser.fullVersion.indexOf(" ")) && (a.browser.fullVersion = a.browser.fullVersion.substring(0, b));
a.browser.majorVersion = parseInt("" + a.browser.fullVersion, 10);
isNaN(a.browser.majorVersion) && (a.browser.fullVersion = "" + parseFloat(navigator.appVersion), a.browser.majorVersion = parseInt(navigator.appVersion, 10));
a.browser.version = a.browser.majorVersion
}
})(jQuery);
(function (a) {
var b;
a.fn.jqprint = function (f) {
b = a.extend({}, a.fn.jqprint.defaults, f);
f = this instanceof jQuery ? this : a(this);
if (b.operaSupport && a.browser.opera) {
var c = window.open("", "jqPrint-preview");
c.document.open();
var d = c.document
} else {
var e = a("");
b.debug || e.css({
position: "absolute",
width: "0px",
height: "0px",
left: "-600px",
top: "-600px"
});
e.appendTo("body");
d = e[0].contentWindow.document
}
d.write("
");
b.importCSS && (0 < a("link[media=print]").length ? a("link[media=print]").each(function () {
d.write("")
}) : a("link").each(function () {
d.write("")
}), d.write(""));
b.printContainer ? d.write(f.outer()) : f.each(function () {
d.write(a(this).html())
});
d.close();
(b.operaSupport && a.browser.opera ? c : e[0].contentWindow).focus();
setTimeout(function () {
(b.operaSupport && a.browser.opera ? c : e[0].contentWindow).print();
c && c.close()
}, 1E3)
};
a.fn.outer = function () {
for (var b = this.clone(), c = a(this), b = a(b), d = 0; 100 > d; d++) {
var e = c.parent().prop("nodeName").toLowerCase(),
b = a("<" + e + ">" + e + ">").attr("style", c.parent().attr("style")).addClass(c.parent().attr("class")).html(b.clone());
if ("body" == e) break;
c = c.parent()
}
a(this).find('input').each(function () {
var $this = $(this);
var type = $this.attr('type');
var _id = $(this).attr('id');
if (type == 'radio') {
if ($this.is(':checked')) {
var _name = $(this).attr('name');
var _value = $(this).attr('value');
b.find('[name="' + _name + '"][value="' + _value + '"]').attr('checked', 'checked');
}
}
else {
b.find('#' + _id).attr('value', $(this).val());
}
});
return a(a("").html(b)).html()
}
// 信息扩展
a.fn.jqprintTable = function (f) {
b = a.extend({}, a.fn.jqprint.defaults, f);
f = this instanceof jQuery ? this : a(this);
if (b.operaSupport && a.browser.opera) {
var c = window.open("", "jqPrint-preview");
c.document.open();
var d = c.document
} else {
var e = a("");
b.debug || e.css({
position: "absolute",
width: "0px",
height: "0px",
left: "-600px",
top: "-600px"
});
e.appendTo("body");
d = e[0].contentWindow.document
}
d.write("");
d.write('');
b.importCSS && (0 < a("link[media=print]").length ? a("link[media=print]").each(function () {
d.write("")
}) : a("link").each(function () {
d.write("")
}),
d.write(""));
b.printContainer ? d.write(f.outerTable(b)) : f.each(function () {
d.write(a(this).html())
});
d.close();
(b.operaSupport && a.browser.opera ? c : e[0].contentWindow).focus();
setTimeout(function () {
(b.operaSupport && a.browser.opera ? c : e[0].contentWindow).print();
c && c.close()
}, 1E3)
};
a.fn.outerTable = function (b) {
var $div = a('');
if (!!b.title)
{
$div.html('' + b.title+'
');
}
$div.append(a(this).jfGridPrint());
return a('').html($div).html();
};
a.fn.jqprint.defaults = {
debug: !1,
importCSS: !0,
printContainer: !0,
operaSupport: !0
};
})(jQuery);