scaron / prettyphoto

prettyPhoto is a jQuery based lightbox clone. Not only does it support images, it also add support for videos, flash, YouTube, iFrames. It’s a full blown media lightbox. The setup is easy and quick, plus the script is compatible in every major browser.
http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/
553 stars 281 forks source link

The bang in shebang breaks Facebook Like #84

Open seyDoggy opened 12 years ago

seyDoggy commented 12 years ago

the (!) in (#!) breaks the Facebook Like button for Gallery pages. Removing the bang fixes this. Here is the DIFF:

--- jquery.prettyPhoto.js
+++ (clipboard)
@@ -885,17 +885,17 @@

    function getHashtag(){
        url = location.href;
-       hashtag = (url.indexOf('#!') !== -1) ? decodeURI(url.substring(url.indexOf('#!')+2,url.length)) : false;
+       hashtag = (url.indexOf('#') !== -1) ? decodeURI(url.substring(url.indexOf('#')+2,url.length)) : false;
        return hashtag;
    };

    function setHashtag(){
        if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
-       location.hash = '!' + theRel + '/'+rel_index+'/';
+       location.hash = theRel + '/'+rel_index+'/';
    };

    function clearHashtag(){
-       if ( location.href.indexOf('#!prettyPhoto') !== -1 ) location.hash = "!prettyPhoto";
+       if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
    }

    function getParam(name,url){
s1nn3r commented 12 years ago

I tried your code, the ! is correctly removed but deeplinking of files doesn't work anymore. When I manually access the full pp URL only the gallery is shown, the image is not opened automatically as it is done with the original code. Seems there is one codechange missing...

seyDoggy commented 12 years ago

Yes you are correct. I'll have to dig deeper.