Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-01-03 17:51:12

doni
New Member
From: Switzerland
Registered: 2006-04-26
Posts: 9
Website

[request] Websnapr: Preview Links in a Bubble

It would be cool if there would be a plugin for textpattern that added easy support for WebSnapr to my posts.

Different options: either enable it for all the outgoing (not on your site) links in my posts (maybe with restrictions for special sections) OR make it easy to add it only to special links, something like this:

"my test link to google":websnaprhttp://www.google.com

would create a link with a WebSnapr preview bubble…

thanks very much
doni

Offline

#2 2007-01-03 22:34:24

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: [request] Websnapr: Preview Links in a Bubble

You could just do it with javascript. Go to this page and download the zip. Make the changes stated (path to images) and upload. Then in your template, add this:

<script type="text/javascript">
function snap_ini () {
	var links = document.getElementsByTagName('a');
	for (var i=0; i<links.length; i++) {
		var link = links[i];
		if (link.getAttribute('href').match('http://')) {
			link.className = 'previewlink';
		}
	}
}

window.onload = snap_ini;
</script>
<script src="previewbubble.js" type="text/javascript"></script>

If you have any other scripts, you’ll need to use addLoadEvent. You can also place the contents of the above JS into an external file.

I didn’t test this extensively or in IE, but I think it’ll work. The script assumes you don’t link absolutely (http://) to your own pages/sections too (you don’t want Websnapr on internal pages, right?).

Last edited by jm (2007-01-03 22:39:18)

Offline

Board footer

Powered by FluxBB