Compatibility out of the box

My current boss wanted to know if the LiveScratcher Script-to-DUI interface would work with Windows Live Messenger 8 too. I’d kept in mind that I wanted it compatible with WLM8, but hadn’t tested it yet. To my suprise, there were only two tiny (non-fatal) errors, and I could get the advertising removal script working with just one extra line.

Behold, the Windows Live Messenger 8 *and* 9 compatible advertisement patch:

//Compact method
function CL_onCreatedElement(resid, root) {
	if (resid=="mainContentResID") {
		var ads=root.FindDescendent("TabsAndAds") || root.FindDescendent("AdBanner");
		ads.LayoutPos=-3;
	}
}

//Verbose method
function Convo_onCreatedElement(resid, root) {
	if (resid=="convframeresid") {
		var adbannergutter=root.FindDescendent("adbannergutter");
		if (adbannergutter)
			adbannergutter.SetValue("LayoutPos",Value.CreateInt(-3));
	}
}

//Patches contained in this file
Patches=[
	{
		id: "ContactListAdvert",
		name: "Remove Contact-list Advertisement",
		version: "1.0",
		author: "A. Nonymous",
		website: "http://www.google.com/",
		onCreatedElement: CL_onCreatedElement
	},
	{
		id: "ConvoTextAdvert",
		name: "Remove Conversation Text Advertising",
		version: "1.0",
		author: "A. Nonymous",
		website: "http://www.google.com/",
		onCreatedElement: Convo_onCreatedElement
	}
];
//Register patches
for (var i in Patches) {
	RegisterPatch(Patches[i].id,Patches[i]);
}

The whole thing started off as an extension to a DUI compatibility layer I wrote for Iminent, but with every hour I stick in I’m falling in love with it more 🙂

2 thoughts on “Compatibility out of the box”

Leave a Reply

Your email address will not be published. Required fields are marked *