<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>David&#039;s Blog &#187; unlinker</title>
	<atom:link href="http://www.davidmoore.info/tag/unlinker/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidmoore.info</link>
	<description>Computer says no</description>
	<lastBuildDate>Thu, 26 Jan 2012 21:49:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Opera &#8220;Unlinker&#8221; User JavaScript</title>
		<link>http://www.davidmoore.info/2008/11/06/opera-unlinker-user-javascript/</link>
		<comments>http://www.davidmoore.info/2008/11/06/opera-unlinker-user-javascript/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 01:38:27 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[unlinker]]></category>
		<category><![CDATA[userjs]]></category>

		<guid isPermaLink="false">http://davidmoore.info/?p=49</guid>
		<description><![CDATA[<p>It&#8217;s quite common on many websites, particularly forums, to post links to images.</p>
<p>Unlinker is a very popular plugin for Firefox, which allows you to change the links to images in the page to in-line images.</p>
<p>Opera doesn&#8217;t have a fully-fledged plugin system like Firefox (which is a pro just as much as it is a con), but <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.davidmoore.info/2008/11/06/opera-unlinker-user-javascript/">Opera &#8220;Unlinker&#8221; User JavaScript</a></span>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s quite common on many websites, particularly forums, to post links to images.</p>
<p>Unlinker is a very popular plugin for Firefox, which allows you to change the links to images in the page to in-line images.</p>
<p>Opera doesn&#8217;t have a fully-fledged plugin system like Firefox (which is a pro just as much as it is a con), but you can customize it using <a title="Opera User JavaScript" href="http://www.opera.com/support/tutorials/userjs/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.opera.com');" target="_blank">User JavaScript</a>.</p>
<p>I&#8217;ve made a simple script to implement a very basic version of Unlinker. It will scan the page for links to images, and embed the image in the page under the link. It currently also scales the image down while maintaining aspect ratio if it exceeds 640&#215;480.</p>
<p>To use this, create a directory on your machine to store your user javascripts, and save the source there as unlinker.js (or whatever name you like).</p>
<ul>
<li>Now in Opera, go to the Tools &gt; Preferences menu</li>
<li> Go to the <strong>Advanced</strong> tab</li>
<li>Click the <strong>Content</strong> section</li>
<li>Click the <strong>JavaScript Options&#8230;</strong> button</li>
<li>Browse to the User JavaScript files folder where you saved the file, then hit OK</li>
<li>Hit OK</li>
<li>You don&#8217;t have to restart Opera for the changes to take effect</li>
</ul>
<p>The source code is:<br />
<code><br />
</code></p>
<pre><code>addEventListener(
      'load',
      function (e)
      {
          var isImageRegex = new RegExp("\.gif|jpeg|jpg|png|bmp$", "i");

          var allAnchors = document.getElementsByTagName("a");

          for( var i = 0; i &lt; allAnchors.length; i++ )
          {
              var anchorElement = allAnchors[i];
              var link = anchorElement.href;
              if( link &amp;&amp; isImageRegex.test(link) )
              {
                  // The image tooltip will show the full image address
                  anchorElement.title = link;

                  // Create the image, giving it a border and some padding, resetting
                  // some styles and don't make it exceed 640x480 dimensions, auto-scaling it down
                  var image = document.createElement('IMG');
                  image.src = link;
                  image.style.border = 'solid 1px #ccc';
                  image.style.padding = '0px';
                  image.style.margin = '0px';
                  image.style.float = 'none';
                  image.style.maxWidth = '640px';
                  image.style.maxHeight = '480px';

                  anchorElement.appendChild( document.createElement('BR') );
                  anchorElement.appendChild(image);
                  anchorElement.appendChild( document.createElement('BR') );
              }
          }
      },
      false
  );

</code></pre>
<p><code><strong>Edit 2010-05-29: Updated for Opera 10.x</strong><br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidmoore.info/2008/11/06/opera-unlinker-user-javascript/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

