Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apostrophe

Package Overview
Dependencies
Maintainers
8
Versions
1081
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apostrophe - npm Package Compare versions

Comparing version 0.4.43 to 0.4.44

4

package.json
{
"name": "apostrophe",
"version": "0.4.43",
"version": "0.4.44",
"description": "Apostrophe is a user-friendly content management system. This core module of Apostrophe provides rich content editing and essential facilities to integrate Apostrophe into your Express project. Apostrophe also includes simple facilities for storing your rich content areas in MongoDB and fetching them back again. Additional functionality is available in modules like apostrophe-pages, apostrophe-snippets, apostrophe-blog, apostrophe-events, apostrophe-twitter and apostrophe-rss.",

@@ -62,2 +62,2 @@ "main": "apostrophe.js",

"license": "MIT"
}
}

@@ -129,2 +129,3 @@ /* jshint undef: true */

apos.whenImagesReady = function(sel, imgSel, callback) {
var countlogs = 0;
var $el = $(sel);

@@ -140,58 +141,58 @@ if (!callback) {

}
var tmps = [];
var tmpsLoaded = 0;
$images.each(function(i, item) {
// Great, the image loaded, but CSS may have scaled it and we need
// to know its true dimensions. So jam it into a temporary image element
// and wait for that to be ready. Note that the original and the temporary copy
// may become ready at different times (yes we've seen that happen), so we wait
// for the copy to be ready.
function attempt() {
if (!tmps[i]) {
tmps[i] = new Image();
$(tmps[i]).load(function() {
tmpsLoaded++;
});
tmps[i].src = item.src;
}
});
function wait() {
var ready = true;
// Wait for all temporary images to be loaded according to jQuery's .load()
if (tmpsLoaded !== tmps.length) {
ready = false;
} else {
return finish();
}
setTimeout(wait, 50);
}
function finish() {
// Now we can compute overall stats
var maxWidth = 0;
var maxHeightToWidth = 0 ;
var maxHeight = 0;
var tmps = [];
$images.each(function(i, item) {
if (!item.complete) {
ready = false;
return;
_.each(tmps, function(tmp) {
var width = tmp.width;
var height = tmp.height;
if (width > maxWidth) {
maxWidth = width;
}
var $item = $(item);
// Great, the image loaded, but CSS may have scaled it and we need
// to know its true dimensions. So jam it into a temporary image element
// and wait for that to be ready too. (You'd think this would always be
// ready immediately, but we've seen otherwise.)
if (!tmps[i]) {
tmps[i] = new Image();
tmps[i].src = $item.attr('src');
if (height > maxHeight) {
maxHeight = height;
}
var tmp = tmps[i];
if (!tmp.complete) {
ready = false;
return;
}
function attemptTmp() {
if (!tmp.complete) {
return setTimeout(attemptTmp, 50);
if (width && height) {
var heightToWidth = height / width;
if (heightToWidth > maxHeightToWidth) {
maxHeightToWidth = heightToWidth;
}
var width = tmp.width;
var height = tmp.height;
if (width > maxWidth) {
maxWidth = width;
}
if (height > maxHeight) {
maxHeight = height;
}
if (width && height) {
var heightToWidth = height / width;
if (heightToWidth > maxHeightToWidth) {
maxHeightToWidth = heightToWidth;
}
}
}
attemptTmp();
});
if (ready) {
return callback(maxWidth, maxHeight, maxHeightToWidth);
} else {
setTimeout(attempt, 50);
}
return callback(maxWidth, maxHeight, maxHeightToWidth);
}
attempt();
wait();
};

@@ -198,0 +199,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc