Reloading parent with GREYBOX

Discussion in 'JavaScript' started by x0x, Dec 21, 2009.

  1. #1
    Greybox is a popup script and a pretty good one. They have a built in function for reloading the parent page, but since I use greybox on more than one page, but want the parent reload to only happen on one page, I can't figure out how to do that...


    Greybox's big js file has got this line:

    this.reload_on_close=false;

    if I change it to true, it will reload the parent on close. How would I get it to only reload one specific parent page? I don't want the reloading to happen on other pages I use greybox.

    Also, if there is an easier way without modifying greybox's source, it would work even better. I've been trying to do this for hours but couldn't.
     
    x0x, Dec 21, 2009 IP
  2. hdewantara

    hdewantara Well-Known Member

    Messages:
    540
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #2
    Have a demo site or script we could see?
     
    hdewantara, Dec 28, 2009 IP
  3. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Sure. Greybox is a free script.

    http://orangoo.com/labs/GreyBox/

    Click "Launch google.com in a 500x500 center window"

    In the new popup when you click "close" I'd need it to refresh the parent page but I don't know how.
     
    x0x, Dec 28, 2009 IP
  4. hdewantara

    hdewantara Well-Known Member

    Messages:
    540
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #4
    Uf, so they call it AJS, another javascript sub framework?
    Hmm, I wonder how many there are: jQuery, Mootols, Prototype, AJS...

    Let us try to apply your hint ;):
    this.reload_on_close=false;
    PHP:
    to AJS customized function (see this link: http://orangoo.com/labs/GreyBox/FAQ/#q5).

    So now you have this function:
    ...
    <script type="text/javascript">
      GB_myShow = function(caption, url, height, width, is_reload_on_close) {
        var options = {
          caption: caption,
          height: height || 500,
          width: width || 500,
          fullscreen: false,
          overlay_click_close: true,
          show_loading: true,
          [COLOR="Red"][B]reload_on_close: is_reload_on_close || false[/B][/COLOR]
        }
      var 
        win = new GB_Window(options);
      return win.show(url);
    }
    </script>
    ...
    
    Code (markup):
    and use it to create a link in your page, without reloading:
    
    <a href="xxx.jpg" 
      onclick="return GB_myShow('xxx', this.href, 300,300, [COLOR="Red"][B]false[/B][/COLOR])" 
      title="xxx">xxx</a>
    Code (markup):
    or this with reloading:
    <a href="xxx.jpg" 
      onclick="return GB_myShow('xxx', this.href, 300,300, [COLOR="Red"][B]true[/B][/COLOR])" 
      title="xxx">xxx</a>
    Code (markup):
    I've tested on my FF only, and seemed ok.
    Let me know the result on your browsers.

    Regards,
     
    Last edited: Dec 29, 2009
    hdewantara, Dec 29, 2009 IP
  5. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Works perfectly. Thank you for taking the time to explain this!
     
    x0x, Dec 29, 2009 IP