<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Discussion on Website Styler | Userscripts.org</title>
    <link>http://userscripts.org/scripts/show/28868</link>
    <description>Recent comments on userscript: Website Styler</description>
    <language>en-us</language>
    <ttl>60</ttl>
    <item>
      <title>Archived Comments, replied by avg @ Sun, 28 Sep 2008 14:16:01 -0500</title>
      <description>&lt;p&gt;Hey joe I improved my function:&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;
$x=function() {
	for (var i=0;i&amp;lt;arguments.length;i++) {
		switch(typeof arguments[i]) {
			case &quot;string&quot;:var x=arguments[i];break;
			case &quot;number&quot;:var type=arguments[i];break;
			case &quot;object&quot;:var node=arguments[i];break;
		}
	}
	return (!type) ? document.evaluate(x,(!node?document:node),null,9,null).singleNodeValue : document.evaluate(x,(!node?document:node),null,type,null)
};
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;It's overloaded and accepts arguments on type, not order. So &lt;code&gt;$x(&quot;.//text()&quot;, document.links[0])&lt;/code&gt; or &lt;code&gt;$x(document.links[0],&quot;.//text()&quot;)&lt;/code&gt; would work.&lt;/p&gt;

&lt;p&gt;Tell me if it works / needs more features please.&lt;/p&gt;

&lt;p&gt;&lt;h3&gt;Assumptions:&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;That if the Result Type isn't supplied, you want to get the first result.&lt;/li&gt;&lt;li&gt;That if the Node isn't supplied, it will be checked against the document.&lt;/li&gt;&lt;/ol&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 28 Sep 2008 14:16:01 -0500</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44708</guid>
      <author>avg</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
    <item>
      <title>Archived Comments, replied by JoeSimmons @ Sun, 28 Sep 2008 12:50:32 -0500</title>
      <description>&lt;p&gt;Thanks. but actually I have one...
&lt;br /&gt;&lt;pre&gt;
// XPath by JoeSimmons
function xp(_exp, t, n) {
var exp = _exp || &amp;quot;//*&amp;quot;; // XPath Expression
var type = t || 6; // XPath type (e.g., 6=unordered node snapshot)
var node = n || document; // XPath search node (only for advanced users; research it)
return(type==9)?document.evaluate(exp, node, null, 9, null).singleNodeValue:document.evaluate(exp, node, null, type, null);
}
&lt;/pre&gt;
&lt;br /&gt;So if I want one result, I can just do &lt;code&gt;xp(&amp;quot;id('some_id')&amp;quot;,9);&lt;/code&gt;
&lt;br /&gt;If I want text inside of the first link, I do &lt;code&gt;xp(&amp;quot;.//text()&amp;quot;, 9, document.links[0]);&lt;/code&gt;
&lt;br /&gt;If I want all tags, I just do &lt;code&gt;xp();&lt;/code&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 28 Sep 2008 12:50:32 -0500</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44709</guid>
      <author>JoeSimmons</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
    <item>
      <title>Archived Comments, replied by avg @ Sun, 28 Sep 2008 10:52:11 -0500</title>
      <description>&lt;p&gt;Joe, I made an overloaded XPath function, wanted to share it with you. Here it is:&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;
$x=function(x,type) {
	return (!type) ? document.evaluate(x,document,null,9,null).singleNodeValue : document.evaluate(x,document,null,type,null)
};
&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;So if you want only the first result, don't supply the second part:
&lt;br /&gt;&lt;pre&gt;$x(&quot;//div[@class='header']&quot;)&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;or if you want all the results, just specify the type:
&lt;br /&gt;&lt;pre&gt;$x(&quot;//div[@id='footer']//a&quot;,7)&lt;/pre&gt;&lt;/p&gt;</description>
      <pubDate>Sun, 28 Sep 2008 10:52:11 -0500</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44710</guid>
      <author>avg</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
    <item>
      <title>Archived Comments, replied by JoeSimmons @ Mon, 01 Sep 2008 10:48:31 -0500</title>
      <description>&lt;p&gt;I want to do both. but I don't have much time lately. I will sometime.&lt;/p&gt;</description>
      <pubDate>Mon, 01 Sep 2008 10:48:31 -0500</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44711</guid>
      <author>JoeSimmons</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
    <item>
      <title>Archived Comments, replied by avg @ Mon, 01 Sep 2008 08:36:38 -0500</title>
      <description>&lt;p&gt;Yeah, instead of writing a greasemonkey script, you should just write the CSS for &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/2108&quot;&gt;Stylish&lt;/a&gt;, then post it up on &lt;a href=&quot;http://userstyles.org/&quot;&gt;UserStyles&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 01 Sep 2008 08:36:38 -0500</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44712</guid>
      <author>avg</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
    <item>
      <title>Archived Comments, replied by Sebastian Paaske @ Sun, 27 Jul 2008 15:53:32 -0500</title>
      <description>&lt;p&gt;You should take a look at &lt;a href=&quot;http://userstyles.org/&quot;&gt;Stylish&lt;/a&gt;. ;)&lt;/p&gt;</description>
      <pubDate>Sun, 27 Jul 2008 15:53:32 -0500</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44713</guid>
      <author>Sebastian Paaske</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
    <item>
      <title>Archived Comments, replied by nathaniel_higgins @ Wed, 25 Jun 2008 05:09:28 -0500</title>
      <description>&lt;p&gt;Seems nice! Thanks!&lt;/p&gt;</description>
      <pubDate>Wed, 25 Jun 2008 05:09:28 -0500</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44714</guid>
      <author>nathaniel_higgins</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
    <item>
      <title>Archived Comments, replied by Jesse Andrews @ Tue, 16 Nov 2004 19:05:13 -0600</title>
      <description>&lt;p&gt;The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)&lt;/p&gt;</description>
      <pubDate>Tue, 16 Nov 2004 19:05:13 -0600</pubDate>
      <guid isPermaLink="false">userscripts.org:13621:44707</guid>
      <author>Jesse Andrews</author>
      <link>http://userscripts.org/topics/13621</link>
    </item>
  </channel>
</rss>
