Hi All,
I am writting a script to align the content inside emails when using the email designer canvas. And i Successfully aligned the individual content block and redrawn the canvas. However, when saving the email the designer is putting the email to the API with the following attribute set: "x_e10_clientRequirement":"is overlapping"
How do I get the designer to re-evaluate the content and not set this attribute?
Here are the GreaseMonkey script i am putting together.
// ==UserScript==
// @name Align Eloqua Canvas Content
// @namespace Eloqua
// @include https://secure.p03.eloqua.com/editor*
// @version 1
// @grant none
// ==/UserScript==
setTimeout(loadDelayed, 5000);
function loadDelayed() {
$(document).bind( "mouseup", function( event ) {
var scLocal = SC;
var test = window.Sai;
var contentBlocks = $.makeArray($('.co-border-style').parent());
contentBlocks.sort(SortByTop);
var top = 0;
var view = $(scLocal.ContainerView.views);
for (var i = 0; i < contentBlocks.length; i++) {
contentBlocks[i].style.top = top+"px";
contentBlocks[i].style.left = "0px";
var span = $(contentBlocks[i]).find('.remove-absolute');
var result = span.height();
contentBlocks[i].style.height = result+"px";
var layer = view.attr(contentBlocks[i].id);
layer.layout.height = result;
layer.layout.left = 0;
layer.layout.top = top;
var last = lastSibling(contentBlocks[i]);
last.style.top = top+"px";
last.style.left = "0px";
last.style.height = result+"px";
top = top + result;
}
$.each(view[0], function(i, attrib){
attrib.layerLocationNeedsUpdate = true;
attrib.layerNeedsUpdate = true;
attrib.viewDidResize();
attrib.updateLayerIfNeeded();
attrib.updateLayerLocationIfNeeded();
});
var temp = getElementByClassName('base-layer');
var ctx = temp.getContext("2d");
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, temp.width, temp.height);
ctx.restore();
});
}
function SortByTop(a, b) {
var aName = a.style.top;
var aInt = parseInt(aName.replace("px", ""));
var bName = b.style.top;
var bInt = parseInt(bName.replace("px", ""));
//alert(aInt +" : "+ bInt);
return (aInt - bInt);
}
function lastSibling(node) {
var tempObj = node.parentNode.lastChild;
while (tempObj.nodeType != 1 && tempObj.previousSibling != null) {
tempObj = tempObj.previousSibling;
}
return (tempObj.nodeType == 1) ? tempObj : false;
}
function getElementByClassName(className) {
var elems = document.getElementsByTagName('*');
for (i in elems) {
if ((' ' + elems[i].className + ' ').indexOf(' ' + className + ' ')
> -1) {
return elems[i];
}
}
}