?
Solved

jar file referring javascript override style

Posted on 2014-01-17
7
Medium Priority
?
745 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
[X]
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
  • 3
  • 2
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
Mahesh Bhutkar earned 1200 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 800 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
Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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 …
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 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