Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

jar file referring javascript override style

Posted on 2014-01-17
7
730 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
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

837 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