“use strict”;
var positionImage = function positionImage(imageEl) {
var imageDimensions = imageEl.dataset.imageDimensions.split(‘x’);
var originalWidth = imageDimensions[0];
var originalHeight = imageDimensions[1];
var focalPoint = imageEl.dataset.imageFocalPoint.split(‘,’);
var focalPointX = focalPoint[0];
var focalPointY = focalPoint[1];
var parentNode = imageEl.parentNode;
var scale = function () {
var imageRatio = originalWidth / originalHeight;
var parentClientSize = {
height: parentNode.clientHeight,
width: parentNode.clientWidth
};
var parentRatio = parentClientSize.width / parentClientSize.height;
if (imageRatio > parentRatio) {
return parentClientSize.height / originalHeight;
}
return parentClientSize.width / originalWidth;
}();
var getRelativeOffset = function getRelativeOffset() {
var targetWidth = Math.ceil(originalWidth * scale);
var targetHeight = Math.ceil(originalHeight * scale);
var parentDimensionWidth = parentNode.offsetWidth;
var parentDimensionHeight = parentNode.offsetHeight;
var overflowWidth = targetWidth – parentDimensionWidth;
var overflowHeight = targetHeight – parentDimensionHeight;
var valueX;
if (overflowWidth === 0) {
valueX = focalPointX;
} else {
valueX = Math.max(Math.min(targetWidth * focalPointX – parentDimensionWidth * 0.5, overflowWidth), 0) / overflowWidth;
}
var valueY;
if (overflowHeight === 0) {
valueY = focalPointY;
} else {
valueY = Math.max(Math.min(targetHeight * focalPointY – parentDimensionHeight * 0.5, overflowHeight), 0) / overflowHeight;
}
return {
valueX: valueX,
valueY: valueY
};
};
var relativeOffset = getRelativeOffset();
var valueX = relativeOffset.valueX;
var valueY = relativeOffset.valueY;
imageEl.style.objectPosition = “”.concat(valueX * 100, “% “).concat(valueY * 100, “%”);
};

Top 7 Posts of January 2022
-
Our 2022 Endorsements
Last week, we endorsed @chitovela3 for Austin City Council.
Today, we're making a SECOND endorsement in Austin: @zoforaustin!
Zo is a bold leader who will reimagine public safety to put equity and empathy first.
He has a long fight ahead — DONATE today: https://t.co/nBWF9LjZC5 pic.twitter.com/aSgQ4M12kG
— Grassroots Law Project (@grassroots_law) January 12, 2022
2. Ahmaud Arbery
[ content to come ]
3. Fighting against Juvenile Life Without Parole
4. [Baldwin Reel]
5. Pro-police misinformation
Pro-police journalists have infiltrated the news sector to spread misinformation about a rampant crime wave in U.S. cities — a problem that they claim can only be solved by investing in more cops.
6. More Endorsements!
We're excited to endorse @bobforcommish and @susanna4pct4 for Travis County Commissioner!
Bob and Susanna will build on @JosePGarza's work by investing in our communities instead of more jails.
Can you split a contribution to these bold leaders today? https://t.co/yEWzO984SV pic.twitter.com/wQGBcSoQdM
— Grassroots Law Project (@grassroots_law) January 20, 2022
7. Second Chance Legislation
Join the grassroots law team
Sign up here to get email alerts at moments when you can help make a difference: