joomla 1.5 : how to open a pdf file in popup window? - joomla

I have placed the following code in my newly created templates index.php in the head section.
<?php JHTML::_('behavior.modal');?>
And this is the link to which I want to show in popup.
<a class="modal" href="images/stories/loyalty-benefits.pdf" rel="{handler: 'iframe', size: {x: 680, y: 370}}">
Anything is wrong there? Or is it because of my newly created template?
Edit
I tried to old templates too, but not showing popup window here too.
Edit2
I came to know when I place the link inside the article it is not showing popup but works in module. Anything to do?

How PDF's are rendered depends entirely on the browser you are using. Up until recently, only WebKit based browsers (and FireFox w/extensions) would even display PDF's in the browser. But even still, there aren't any (that I'm aware of) that will treat a PDF as an image and allow you to open it in a lightbox.
I've actually had to deal with this previously from a client request. They basically demanded to be able to view PDF's in the lightbox we had created for them, and weren't taking "but browsers don't work that way" for an answer. (facepalm) So, what I ended up doing was taking his 75 page PDF and splitting it up into 75 JPG images, and then loading them, full resolution, into the lightbox. It worked, I finally got paid, and then I fired the client.
TL;DR; If you have any control over the decision making process for this site you're doing, don't try to view PDF's in a lightbox. It's a battle you can't win until it's supported by browsers. Let the browser render the PDF natively.

I placed the following code in /templates/my-site/html/com_content/article/default.php and worked.
<?php
JHTML::_('behavior.modal');
?>

Related

How to disable firefox's reader view from my website?

Today i updated my firefox to the latest version and one big feature is the reader view for desktop. We launched a webshop two weeks ago and now there is this tiny "reader view" icon. When i click on it i get an error-message. My team-leader wants me to remove this feature when visiting this site.
is it possible to remove or hide the "reader view" feature from firefox when visiting my site?
There is currently no legit way of disabling Reader View for your website. Reader View is supposed to automatically detect on what pages it should be available and on what pages it should not.
If there is an issue with your website, your best option is probably to report it there: https://github.com/mozilla/readability/issues
You can also find more info about the issues affecting Reader View in Firefox there: https://wiki.mozilla.org/QA/Reader_view
Although I would not recommend it, there might be a way to fool Reader View into thinking it should not parse your website, if you really need to. A quick look at the source code reveals that it will not parse certain type of documents, certain URIs and malformed URLs. You would need to dig in the source to understand how/if your site can safely be adapted to avoid being parsed. The Reader View source code can be found here: https://mxr.mozilla.org/mozilla-release/source/toolkit/components/reader/ReaderMode.jsm or
https://dxr.mozilla.org/mozilla-release/source/toolkit/components/reader/ReaderMode.jsm
This Question shows how to Optimize website to show reader view in Firefox. So you have to ensure that your site is not optimized for the Reader View.
Don't use formatting options that are favoured for the Reader View and so on.
I guess this will suffice:
Don't use the <p> Tag
write all Textblocks in small portions
Here are some more details about the mechanism
Replace p tags with div tags in your page. It worked for me, even when I have div tags with pre tags (preformatted text) on the same page.
There is no way of forcing disabling the Reader View to the user, But if it is important to your site, you can notify the user to disable or not use the reader feature of firefox.
This would be the way to Disable the Reader on the users browser
in the Enter about:config in browser address bar
click the "I'll be careful I promise" box
search for reader.parse-on-load.enabled
toggle preference to false (right click > toggle to false )
close the about:config page > refresh browser > reader view icon has gone
put this code on your css code and you are done !
/* CSS Reset */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,
p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,
img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,
dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,
thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,
footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,
audio,video,adnav,adheader{
margin:0;
padding:0;
border:0;
font-size:100%;
font:inherit;
vertical-align:baseline;
}

Timthumb image thumbnails not appearing on wordpress site

I'm trying to put together a page at http://www.sketch360.com/store/home/ which should show featured products and thumbnails for those products. For some reason the images aren't showing on page load, even though they immediately appear when you either right-click on the image, click on a next/previous arrow, or open 'developer tools' in chrome.
The status of the image styling in css I've noticed, changes from display:none to display:inline-block when you perform any of the above actions to get the images to show.
I've been through the timthumb troubleshooting steps at http://www.binarymoon.co.uk/2010/11/timthumb-hints-tips/ and have changed permissions on all directories according to these instructions. Any help would be much appreciated in getting these images to show up on page load.
The images show up (also using the timthumb method, I believe) on this alternative page: http://www.sketch360.com/store/shop/ but not on the first page (that is going to form the home page for the site: http://www.sketch360.com/store/home/ ).
Any suggestions would be gratefully received.
It isn't a timthumb or wordpress issue. It looks like it is a stylesheet / jQuery issue - where the div that covers the image (used for the highlight on hover) is opaque and covering the images. The funny thing is that when I "Inspect Element", the images all appear.
Double-check your starting styles for class "overdefult" - make sure it has the right opacity or set the background color to transparent. (You could also try removing it temporarily to prove that this div is indeed your issue.)
After many hours banging my head against a brick wall, I have discovered an updated script available that controls the bxSlider used to display these images in li's - and having upgraded the minified script, the problem seems to have resolved itself - just in case there are others needing help on this too.

I can't get the first modal, in the series of modals, to open

Greeting and thanks for your generosity in providing this wonderful forum,
I'm using jQuery Orbit Slider and Reveal Modal. I setup the slider to include content and within the content are hotlinks to a series of modals.
I can't get the first modal, in the series of modals, to open. It appears the plugin is programmatically generating inline CSS that is overriding my CSS stylesheet. Mainly z-index selector is keeping the first modal hidden (or invisible). The subsequent modals in that series work as intended.
When viewed using Chrome Inspect Console shows the inconsistency please note at "featuredContent10" which is where the slide4 resides (it's actually a background image). The data-reveal-id="slide4-1" is the first one in the series of modals. I did not add the inline styles it's in the reveal.js file.
Unfortunately, I don't know enough about reveal and can't find any information regarding a solution. The information I came away with is to ask for assistance on stackoverflow.com. 99.9% of the time I find solution on my own, however, I'm at a lost and my client likes the features of both plugins. Any help you can give me would be very much appreciated.
If it helps here’s a link to the beta site: http://www.partnershipwithearth.com/thecooperationway-1/
Go to Slide 11 lower left link is the culprit. You'll notice the dialog box and close button do appear without the image (slide4-1).
Your expertise is greatly appreciated

Google Chrome escapes WYSIWYG Javascript

So my problem is relatively simple, I've Googled all over to find a solution but I've yet to find one.
The problem is, I've developed a WYSIWYG plugin for Drupal's WYSIWYG module/framework (not sure if this is relevant). The purpose of the plugin is to allow embedding of video files inside the WYSIWYG content. Our client offers a video uploading/editing API which their customers use to embed files on their pages.
To put it simply, my plugin opens up a pop-up where the user selects one of their videos as fetched from their account at the clients site, the plugin then calls the API and is returned with HTML and JavaScript for embedding the video which is then inserted into the WYSIWYG content.
This works like a charm in Firefox, however I have a few problems with it in Chrome. After debugging back and forth I've noticed that the embedded JavaScript inside the WYSIWYG editor gets escaped (IE, quotes turned into &quot etc).
This does not happen with Firefox so it's most likely Chrome which is causing it, or perhaps even Webkit?
I've already checked the HTML and JavaScript that gets returned through the Ajax call and it is fine, it's when it gets embedded inside the WYSIWYG it gets escaped.
The WYSIWYG editor I've tested in is TinyMCE by the way.
Adding as an answer for #tobbr to help other SO users:
i solved this by adding the script to a db table instead and then
loading it using drupal_add_js with hook_nodeapi. works better and
solves another IE related problem

Programatically preventing Firefox to auto-resize images

By default in Firefox every time you open an image it will re-size to fit within the browser window, now if you view a lot of images this can become annoying having to click on the image every time it loads to see it full size.
There is a way to switch off that in about:config, but this is not a solution for a broader public.
Is there a way to switch that off by some JavaScript function, or CSS, or something else?
If you would like to switch off auto-resizing images in your browser, then you can
type about:config
search for property browser.enable_automatic_image_resizing
and set it to false
If you want it for your visitors, I just can repeat what Jeremy Sydik writes in Design Accessible Web Sites,
it’s just their web, we’re building on it.
And in this case, you really shouldn't decide whether your users want Firefox's auto-resizing feature or not. You can always choose a solution that gives better user experience to your visitors. For instance, you may install a Lightbox variant as Daniel A. White already mentioned.
There is also great_llama's solution to open images inside a HTML page.
Point to a dynamic page that uses an IMG tag with the appropriate source, rather than pointing to the raw image. Use the querystring or something similar to pass the image name to the page.
<html><body><img src="yourimage.jpg"></body></html>
I dont think there is anyway to change that behavior, at least using javascript or css.
Why not use a jQuery Lightbox?
http://leandrovieira.com/projects/jquery/lightbox/
Though I have not tried it, I don't see why it would autosize if you wrapped it in html and not link directly to the image.
if that is an option, just wrap it in html:
<style type="text/css">
* { margin:0; }
</style>
<img src="whatever.jpg" />
If you are the owner of the image, embed the image in an HTML document. Firefox resizes an image only if you open it directly in the browser.
If you are talking from a Firefox user's point of view, I think about:config is the appropriate place to disable this functionality.

Resources