EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #03388


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Script to open a.ep_document_link in pop-up


Thank you John for adding that.

I should have mentioned though, that only want the previews to open in a lightbox and the actual documents in a pop up.

The reason for this browser compatibility. First of all, I have had problems to get Adobe Reader to load in the light box (in Internet Explorer of course), so clicking PDF links some times just results in an empty light box window.

Secondly I have lots of different video, audio, archive and document files, and I prefer not to rely on Flash or Quicktime to deliver them, because the first is unavailable in iOS, and the second is a pain on windows.

The solution you guided me towards handles just about every file format I throw at it in a recent browser and lets the user decide which plugins to install when needed. For example most recent browsers streams MP4 natively, but IE closes the new window and streams the file in WMP which is just fine.

I know I could implement different viewers, but most handles large PDF documents badly, and I would have to somehow sort out all the unsupported document links, so I prefer nudging my user towards updating their browsers, since most browsers auto-update nowadays anyway.

I say this after fiddling with shadowbox on my wordpress based site though. I don't know about the lightbox EPrints uses. Does it handle large PDF's and what browser plugins does it rely on?

All the best!
/Jacob

On 13-08-2014 14:00, John Salter wrote:

:o)

 

If you want something more like your example (this type of interface device is sometimes called a ‘modal window’, or ‘lightbox’), then take a look at:

~/lib/static/_javascript_/auto/40_lightbox.js (this gets compiled into e.g. auto-3.3.12.js).

 

I think you can force this behaviour in the EPrints interface by adding a rel=”lightbox” to your link:

<a href="" class="moz-txt-link-rfc2396E" href="http://your.repo/1/1.haslightboxThumbnailVersion/file.pdf">"http://your.repo/1/1.haslightboxThumbnailVersion/file.pdf" rel="lightbox">Preview</a>

 

- which will open the ‘lightbox’ size thumbnail – from the href of the link.

 

Hope that helps too!

Cheers,

John

 

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Jacob Wenzel
Sent: 13 August 2014 12:41
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Script to open a.ep_document_link in pop-up

 

Ups, sorry John, never mind :)

I just needed:

document.observe("dom:loaded", function() {
    links = $$("a.ep_document_link");
    links.each(function(link){
        link.observe("click", function(event){
            window.open(link.href,'','height=575,width=720');
            event.stop();
        });
    });
});

Thanks, it is perfect now!

/Jacob.

On 13-08-2014 13:32, Jacob Wenzel wrote:

Thanks a lot John, both do work!

Unfortunately they open a new tab and not a pop up, which can be confusing for less tech-savvy users.

Do you know, how I can pass attributes to the  new window, so I can specify height and width to the new window and perhaps remove the menu bars?

Preferably I would like my pop-ups to look like the one seen on the embedded eprint at the bottom of the linked post below, but any solution where the user sees the new window popping up on top of the main site instead of switching tabs would be acceptable.
http://energiakademiet.dk/en/eve-fisher-lovmaessige-begraensninger-for-borgerstyret-energi/

Thanks again in advance! And I am sorry if this is basic stuff, I am not very good with _javascript_ in general, but I really appreciate your help.

/Jacob

On 12-08-2014 13:59, John Salter wrote:

Hi Jacob,

From the snippet of Prototype below, it looks like you’re defining a function ‘new_window_links’, but never actually calling it?

 

Does this work (anonymous function):

document.observe("dom:loaded", function() {

    links = $$("a.ep_document_link");

    links.each(function(link){

        link.observe("click", function(event){

            window.open(link.href);

            event.stop();

        });

    });

});

 

or this (same named function, specifically called):

document.observe("dom:loaded", function() {

    function new_window_links(){

      links = $$("a.ep_document_link");

      links.each(function(link){

        link.observe("click", function(event){

          window.open(link.href);

          event.stop();

        });

      });

    }

    new_window_links();

});

 

I haven’t tested either!

Cheers,

John

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Jacob Wenzel
Sent: 12 August 2014 12:35
To: 'eprints-tech@ecs.soton.ac.uk'
Subject: [EP-tech] Script to open a.ep_document_link in pop-up

 

Hi guys!

Im trying to open document links - '<a class="ep_ducument_link" href=""color:#3366FF">jQuery(document).ready(function($) {
    jQuery('a.ei_popup').live('click', function(){
        newwindow=window.open($(this).attr('href'),'','height=575,width=720');
        if (window.focus) {newwindow.focus()}
        return false;
    });
});

which does the trick.

I am totally new to prototype, but I found this snippet, that is supposed to do the same:

document.observe("dom:loaded", function() {
    function new_window_links(){
      links = $$("a.ep_document_link");
      links.each(function(link){
        link.observe("click", function(event){
          window.open(link.href);
          event.stop();
        });
      });
    }
});


But it doesn't do anything. I checked the source code, and the code does load fine from 90_local.js.

Thanks in advance, help and pointers will be greatly appreciated.

Have a nice day!

--

Med venlig hilsen/Best regards

JACOB WENZEL
Projektleder

ENERGIAKADEMIET
Strandengen 1
8305 SAMSØ
+45 60 61 15 97
jw@energiakademiet.dk
www.energiakademiet.dk




*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

 

 



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/