Solved

jar file referring javascript override style

Posted on 2014-01-17
7
715 Views
Last Modified: 2014-01-29
Hi,

I opened unjarred primefaces-3.4 jar.

I see code like
package org.primefaces.component.behavior.printer;

import javax.faces.FacesException;
import javax.faces.application.ResourceDependencies;
import javax.faces.component.UIComponent;
import javax.faces.component.behavior.ClientBehaviorBase;
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.context.FacesContext;

@ResourceDependencies({@javax.faces.application.ResourceDependency(library="primefaces", name="jquery/jquery.js"), @javax.faces.application.ResourceDependency(library="primefaces",
name="printer/printer.js"), @javax.faces.application.ResourceDependency(library="primefaces", name="primefaces.js")})
public class PrinterBehavior extends ClientBehaviorBase
{
  private String target;

Open in new window


My question is where to see

name="printer/printer.js")

printer.js java script code to override one of the style to suit the print requirement of printing in one page instead of printing in two pages(weird thing is print preview in IE and mozilla shows only one page). But when I click the UI button built using jsf primefaces it some reason prints in two pages which is not what i want. How to see printer.js file and how to override the style so that it prints only in 1 page.

please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
Mahesh Bhutkar earned 300 total points
ID: 39793696
As said, you have unjarred primefaces-3.4 jar.
Just try to open the jar using winzip.
Right click the jar -> select Open with -> choose winzip.
It will show you all the files present inside jar. Sort them based on type. You must get printer.js file.
0
 
LVL 12

Assisted Solution

by:Sharon Seth
Sharon Seth earned 200 total points
ID: 39793855
Once the  page is loaded , right click on it and select 'viewsource' , you may see the js there as well.
0
 
LVL 7

Author Comment

by:gudii9
ID: 39797835
I see code as  below
(function(b){var a;b.fn.jqprint=function(d){a=b.extend({},b.fn.jqprint.defaults,d);var c=(this instanceof jQuery)?this:b(this);if(a.operaSupport&&b.browser.opera){var e=window.open("","jqPrint-preview");e.document.open();var g=e.document}else{var f=b("<iframe  />");(!a.debug){f.css({position:"absolute",width:"0px",height:"0px",left:"-600px",top:"-600px"})}f.appendTo("body");var g=f[0].contentWindow.document}if(a.importCSS){if(b("link[media=print]").length>0){b("link[media=print]").each(function(){g.write("<link type='text/css' rel='stylesheet' href='"+b(this).attr("href")+"' media='print' />")})}else{b("link").each(function(){g.write("<link type='text/css' rel='stylesheet' href='"+b(this).attr("href")+"' />")})}}if(a.printContainer){g.write(c.outer())}else{c.each(function(){g.write(b(this).html())})}g.close();(a.operaSupport&&b.browser.opera?e:f[0].contentWindow).focus();setTimeout(function(){(a.operaSupport&&b.browser.opera?e:f[0].contentWindow).print();if(e){e.close()}},1000)};b.fn.jqprint.defaults={debug:false,importCSS:true,printContainer:true,operaSupport:true};jQuery.fn.outer=function(){return b(b("<div></div>").html(this.clone())).html()}})(jQuery);

Open in new window

I found the printer.js in the primefaces-3.4 jar..not sure where the default print behaviour of printing in 2 pages instead of one page is coming from to fix it
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:Mahesh Bhutkar
ID: 39799266
It seems the code is Obfuscated. You can not modify the code.
Check out if this is the correct source code or not?
0
 
LVL 12

Expert Comment

by:Sharon Seth
ID: 39799636
jqprint in that script is the actual function that prints . The only way to specify your own style seems thru the importCSS feature of jqprint . Try to debug thru that.

http://webscripts.softpedia.com/script/Modules/jQuery-Plugins/jqPrint-68448.html
0
 
LVL 7

Author Comment

by:gudii9
ID: 39816111
It seems the code is Obfuscated. You can not modify the code.

How do we know if it is obfuscated. Please advise
0
 
LVL 6

Expert Comment

by:Mahesh Bhutkar
ID: 39817032
How do we know if it is obfuscated. Please advise

If you see the code it is not easilly readable/understandable.
There are variables used like a,b,c,d,e.... for obfuscation.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now