Solved

jar file referring javascript override style

Posted on 2014-01-17
7
720 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Securing Jmx Console and web console 2 64
maven project error 5 48
Java Loop 6 48
servlet example issue 6 29
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

911 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

18 Experts available now in Live!

Get 1:1 Help Now