Friday, November 28, 2008

Super-Sharable, Self-Installing Widget

There are not many people that will appreciate this, but I just finished coding up a widget form that will install itself on other blogger blogs automatically. Then after it's been installed on someone else's blog it contains the same form so that their readers can add the widget. See it in action on my sidebar for the petit elefant. Here's the code:

<form id="supersharingwidget" action="" method="post"><!-- This is the beginning of the real widget content /--><a href=""><img border="0" src=""/></a><br/>
<div>To add this button to your blog, copy and paste the text below into the HTML/JavaScript page element on your blog or simply press the button below.<br/><textarea onclick="">&lt;a href=""&gt;&lt;img border="0" src=""/&gt;&lt;/a&gt;&lt;br/&gt;</textarea> </div><!-- This is the end of the real widget content /--><input value="" name="infoUrl" type="hidden"/> <input name="widget.title" type="hidden"/> <!-- Do Not Change anything below this line /--><input id="pewc" name="widget.content" type="hidden"/> <input value="&lt;data:content/&gt;" name="widget.template" type="hidden"/> <input style="border: 0px none ; background: rgb(255, 255, 255) url( repeat scroll center center; width: 104px; height: 17px; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" value=" " onclick="var wc = (document.getElementById('supersharingwidget').outerHTML)?document.getElementById('supersharingwidget').outerHTML + '<!--endssw/-->':document.getElementById('supersharingwidget').parentNode.innerHTML.match(/<form id=\u0022supersharingwidget\u0022(.|\n)+<\!--endssw\/-->/)[0].toString();document.getElementById('pewc').value = wc" type="submit"/> </form><!--endssw/-->

No comments: