Solved

jar file referring javascript override style

Posted on 2014-01-17
7
728 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Arrays.asList  VS  ArrayList 4 60
Groovy problem when using SOAPUI : DispatchException occurred 7 45
even odd program using while loop 3 41
jdbc error in jsp application 20 46
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

810 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