I'm sorry to have to post my entire plugin here, but I can't seem to identify the problem. It works as expected in Firefox as well as in IE 8 when I turn on "compatibility view." When I turn off compatibility view, however, I get a blank page--with no errors whatsoever from IE's debug mode.
- jQuery.fn.photonGallery = function(url, options)
- {
- jQuery(this).attr("id", "photon-gallery_"+(Math.random()*new Date().getTime()));
- var gallery = jQuery(this);
- // Give the gallery a unique identifier
-
- var options = jQuery.extend(
- {
- albumNotes: "<1> child(ren), <2> picture(s)",
- // Notes that describe an album: <1> = number of sub-albums, <2> = number of pictures
- crumbSeparator: " › ",
- // Separator for breadcrumbs
- css: "default.css",
- // Stylesheet (relative to location of jquery.photonGallery.js)
- pictureNotes: "<1>×<2>, <3> kb",
- // Notes that describe a picture: <1> = width (pixels), <2> = height (pixels), <3> = size (sizeUnits)
- scriptId: "_photon-gallery",
- // id attribute of the <script> tag that calls jQuery.photonGallery.js
- sizeUnits: "kb",
- // Units to describe a picture's size in: "kb" or "mb"
- upOneLevel: ".."
- // Caption to represent traversing up in the directory tree
- }, options);
-
- jQuery(document).ajaxError(function(e, request, settings, exception)
- {
- alert("AJAX encountered an error whilst loading \""+settings.url+"\".\r\nError: \""+exception+"\"");
- // Alert client if AJAX experiences an error
- });
-
- jQuery.ajax(
- {
- type: "GET",
- url: url,
- dataType: "text",
- success: function(data)
- {
- jQuery(gallery).empty();
- // Remove photon-gallery_loading div
- var hash = document.location.hash.substr(1);
- // Acquire hash (minus the # sign)
- generateTree(buildTree(data, hash));
- // Build an album tree structure
- generateGallery(buildGallery(data));
- // Build a picture gallery
- }
- });
- // Initialize a request to load XML file
-
- jQuery(gallery).addClass("photon-gallery");
- // Apply class for CSS properties
- jQuery(gallery).html("<div class=\"photon-gallery_loading\"></div>");
- // While we wait for the request, include a loading animation
-
- var album = null;
- function buildTree(data, hash)
- {
- var arr = [];
- jQuery(gallery).html("<div class=\"photon-gallery_xml\">"+data+"</div>");
- // Temporarily add a div to contain the XML content so we can parse it
- jQuery(gallery).children(".photon-gallery_xml").last().find("album").each(function()
- {
- // Selects the photon-gallery_xml of the current gallery
- var x = {};
- x.name = jQuery(this).attr("name");
- // Obtain name of album
- x.path = (jQuery(this).parents("album").map(function(){return jQuery(this).attr("path");}).get().reverse().join("/")+"/"+jQuery(this).attr("path")).substr(1);
- // Obtain a path to the album, stepping up the tree
- if(x.path == hash)
- album = arr.length - 1;
- // If the album is the current album, store its index for later reference
- x.desc = jQuery(this).children("description").first().text();
- // Obtain the description of the album
- x.albs = jQuery(this).children("album").length;
- // Obtain the number of albums in this album
- x.imgs = jQuery(this).children("picture").length;
- // Obtain the number of pictures in this album
- arr.push(x);
- });
-
- return arr;
- };
-
- function buildGallery(data)
- {
- var arr = {};
- jQuery(gallery).children(".photon-gallery_xml").last().remove();
- // No need to keep the XML on the page, now that it has been parsed
- return arr;
- };
-
- function generateTree(branches)
- {
- for(i in branches)
- {var x = branches[i];
- jQuery(gallery).append("<p>name = "+x.name+", path = "+x.path+", desc = "+x.desc+", albs = "+x.albs+", imgs = "+x.imgs+"</p>");
- }
- };
-
- function generateGallery(images, location)
- {
- };
- };