Skip to content

Instantly share code, notes, and snippets.

@hallvors
Created January 22, 2014 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hallvors/8555662 to your computer and use it in GitHub Desktop.
Save hallvors/8555662 to your computer and use it in GitHub Desktop.
some of the code that runs the lightbox feature on flickr.com
function k(aC, aG, aJ) {
var aI, aD, aO, aM, aP, aF = true, aL, Y;
if (aC) {
aI = K(aC)
} else {
return
}
var aN = at().width;
if (aC.get("needs_interstitial")) {
aF = true
} else {
aF = false
}
++aw;
aD = "img-" + aw;
aO = ac.create('<div id="' + aD + '" data-position="' + aG + '" style="width:' + aN + 'px;" class="slide-wrap"></div>');
aP = aO.create('<div role="img" aria-label="' + U.Escape.html(aC.get("title")) + '" class="img"></div>');
aO.appendChild(aP);
aM = Math.round(0.5 * (at().height - aI.scaled_height));
aM += H ? 5 : 0;
aO.setStyle("height", at().height + "px").setStyle("top", aM + "px");
aP.setStyle("height", aI.scaled_height + "px").setStyle("width", aI.scaled_width + "px");
Y = "url(" + aC.get("sizes").t.url + ")";
if (!aF) {
aP.setStyle("background-image", Y).setStyle("background-size", "100%")
} else {
aP.setStyle("background-image", "url(http://l.yimg.com/g/images/fuzzy/photo-fuzzy-t.png)").setStyle("background-size", "200%");
aP.set("innerHTML", "<h4>" + U.transjax.get("lightbox", "outside_safesearch") + "</h4>")
}
ac.appendChild(aO);
if (aG > O) {
aO.setStyle("transform", "translate3d(" + o + "px, 0px, 0px)")
} else {
aO.setStyle("transform", "translate3d(-" + o + "px, 0px, 0px)")
}
au.setParam(aG, "id", aD);
au.setParam(aG, "top", aM);
au.setParam(aG, "orientation", window.orientation);
if (!aF) {
aL = aI.url
} else {
aL = "http://l.yimg.com/g/images/fuzzy/photo-fuzzy-z.png"
}
var aK = new Image();
var aH = aC;
var aE = function() {
if (q && aH.get("sizes").l && at().width <= 480) {
var aR = aH.get("sizes").l.url;
var aQ = new Image();
aQ.onload = function() {
aP.setStyle("background-image", "url(" + aR + ")")
};
aQ.src = aR
}
};
aK.onload = function() {
if (this.height != aI.height && this.width != aI.width) {
aP.setStyle("background-image", "url(" + aH.get("sizes").l.url + ")")
} else {
aP.setStyle("background-image", "url(" + aL + ")")
}
aE();
aK = null
};
U.later(20, this, function() {
if (aK) {
aP.setStyle("background-image", "url(" + aL + "), " + Y);
aE()
}
});
aK.src = aI.url;
if (aJ) {
aO.setStyle("transform", "translate(0px, 0px)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment