Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-08-14 11:48:18

charlynoa
Member
From: Essen/ Germany
Registered: 2008-08-13
Posts: 18

greybox- problem

Hi there!

I’m having a problem with the greybox on my side.

As you can see here the greybox opens and starts loading… but doesn’t load the picture.

I copied the code and built a txp-independet html-site and there it works so I guess it has to be a textpattern internal problem.

So… can anyone figure out where the problem is and how to fix it?

Thanks a lot,
~charly

[edit]
at the moment none of above links work properly after I tried out a bit
I’ll ask later if I have new problems, thank you.

Last edited by charlynoa (2008-08-15 13:32:26)

Offline

#2 2008-08-14 12:07:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: greybox- problem

Hmm, looks like you have some validation / js scope / permissions problems. When I view your TXP page and click an image, I see:

Permission denied to get property Window.GB_CURRENT
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 95

AJS is not defined
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 43

GB is undefined
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 95

No idea what the code is doing, but if I was a betting man I’d say it was possibly the validation errors (you haven’t closed an <img> tag among other things) or something to do with the fact the javascript can’t “see” some directory from where it’s loaded. Can’t say more than that at present without digging into the JS code itself, but since it works on your other site I’d stab at it being invalid markup or permissions.

btw, there are TXP gallery plugins that do lightboxes pretty well unless you have a compelling reason to roll your own :-)

Last edited by Bloke (2008-08-14 12:09:12)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2008-08-14 12:23:18

charlynoa
Member
From: Essen/ Germany
Registered: 2008-08-13
Posts: 18

Re: greybox- problem

Thx for your answer, Bloke.

Well, I didn’t use a plugin because I thought it was easy enough for me :P

Besides I had problems with another plugin not even showing up in my txp admin area, so I didn’t even try

Bloke wrote:

Permission denied to get property Window.GB_CURRENT
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 95

AJS is not defined
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 43

GB is undefined
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 95

This is interesting, it didn’t show that to me.
Too bad I don’t know what do do with it.
Well, probably I should abstain from using the greybox at the moment and first get deeper into other things… unless someone else might help out here.

Offline

#4 2008-08-14 15:51:19

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: greybox- problem

This is a guess but does it work if you move the js files to a directory weblog.charlynoa.de instead of www.charlynoa.de?


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#5 2008-08-14 18:44:44

charlynoa
Member
From: Essen/ Germany
Registered: 2008-08-13
Posts: 18

Re: greybox- problem

Thanks for your suggestion, Matt.
Unfotunately it doesn’t change anything.

Well, this is the code of http://charlynoa.de/greybox/loader_frame.html?s=0

line 43 is var loading = AJS.$('loading');
line 95 to 98 is if(GB.show_loading) { AJS.AEV(window, 'load', function(e) { loaded(); });

… which cause those errors:

Permission denied to get property Window.GB_CURRENT
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 95

AJS is not defined
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 43

GB is undefined
http://charlynoa.de/greybox/loader_frame.html?s=0
Line 95

Do I have to change anything here to fix it?

If needed, here’s the whole code:

<!--
Notice: I feel so dirty doing this, but its the only way to make it cross browser.
-->
<html>
<head>
  <script>
    var GB = parent.GB_CURRENT;
    document.write('<script type="text/javascript" src="AJS.js"><\/script>');
    if(GB.use_fx) {
        document.write('<script type="text/javascript" src="AJS_fx.js"><\/script>');
    }
  </script>
  <style>
    body {
      padding: 0;
      margin: 0;
      overflow: hidden;
    }

    #GB_frame {
      visibility: hidden;
      width: 100%;
      height: 100%;
    }

    #loading {
      padding-top: 50px;
      position: absolute;
      width: 100%;
      top: 0;
      text-align: center;
      vertical-align: middle;
    }
  </style>
</head>
<body>

<div id="loading">
  <img src="indicator.gif">
</div>

<script>
var loading = AJS.$('loading');
var gb_type = GB.type;
var gb_url = GB.url;

//Start loading in the iframe
if(gb_type == "page") {
  document.write('<iframe id="GB_frame" src="' + gb_url + '" frameborder="0"></iframe>');
}
else {
  var img_holder = new Image();
  img_holder.src = gb_url;
  document.write('<img id="GB_frame" src="' + gb_url + '">');
}
var frame = AJS.$('GB_frame');
</script>

</body>
<script>
function setupOuterGB() {
    frame.style.visibility = 'visible';
    GB.setFrameSize();
    GB.setWindowPosition();
}

function loaded() {
    AJS.removeElement(loading);

    GB.overlay.innerHTML += "&nbsp;"; //Safari bugfix

    if(gb_type == "image") {
        if(img_holder.width != 0 && img_holder.height != 0) {
            var width = img_holder.width;
            var height = img_holder.height;

            GB.width = width;
            GB.height = height;

            setupOuterGB();

            if(GB.use_fx) {
                AJS.setOpacity(frame, 0);
                AJS.fx.fadeIn(frame);
            }
        }
    }
    else {
        GB.width = frame.offsetWidth;
        GB.height = frame.offsetHeight;
        setupOuterGB();
    }
}

if(GB.show_loading) {
    AJS.AEV(window, 'load', function(e) {
        loaded();
    });
}
else {
    loaded();
}
</script>
</html>

Btw: textiles suck -.-

Offline

#6 2008-08-14 20:02:03

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: greybox- problem

I googled ‘greybox’ and even the one of the demo sites is giving a similar error. Did you say you had this working somewhere?

At this point I’m tempted to suggest other similar scripts (jquery is included in textpattern!)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#7 2008-08-14 20:05:25

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: greybox- problem

Wait, where is parent.GB_CURRENT; defined?

Maybe try changing var GB = parent.GB_CURRENT; to var GB_ROOT_DIR = "http://charlynoa.de/greybox/";


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#8 2008-08-14 20:05:57

charlynoa
Member
From: Essen/ Germany
Registered: 2008-08-13
Posts: 18

Re: greybox- problem

Yeah, it’s working on this html-site.
Just copied&pasted the code though.

Thanks for the link, I’m gonna try that one out :)

Offline

#9 2008-08-14 23:00:02

charlynoa
Member
From: Essen/ Germany
Registered: 2008-08-13
Posts: 18

Re: greybox- problem

MattD wrote:

Wait, where is parent.GB_CURRENT; defined?

Maybe try changing var GB = parent.GB_CURRENT; to var GB_ROOT_DIR = "http://charlynoa.de/greybox/";

didn’t see your post before.
I tried and changed it but it doesn’t work

I’m gonna try out the other script tomorrow.

Thanks again for your help :)

Last edited by charlynoa (2008-08-14 23:00:25)

Offline

Board footer

Powered by FluxBB