<?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>Everything In Between &#187; JavaScript</title>
	<atom:link href="http://maymay.net/blog/category/programming/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://maymay.net/blog</link>
	<description>The brutally honest, first-person account of Meitar Moscovitz&#039;s life.</description>
	<lastBuildDate>Thu, 19 Jan 2012 08:54:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Cross-post: Edenfantasys&#8217;s unethical technology is a self-referential black hole</title>
		<link>http://maymay.net/blog/2010/05/19/web-merchants-inc-edenfantasys-unethical-technology/</link>
		<comments>http://maymay.net/blog/2010/05/19/web-merchants-inc-edenfantasys-unethical-technology/#comments</comments>
		<pubDate>Wed, 19 May 2010 23:20:04 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Business & E-Commerce]]></category>
		<category><![CDATA[Content Syndication]]></category>
		<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Maybe Maimed]]></category>
		<category><![CDATA[Search Engine Optimization]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=1217</guid>
		<description><![CDATA[This entry was originally published at my other blog. I&#8217;m cross-posting it here in order to make sure it gets copied to more servers, as some people have suggested I&#8217;ll face a cease and desist order for publishing it in the first place. Please help distribute this important information by freely copying and republishing this [...]]]></description>
			<content:encoded><![CDATA[<p><em>This entry was originally published at <a href="http://maybemaimed.com/2010/05/19/edenfantasyss-unethical-technology-is-a-self-referential-black-hole/">my other blog</a>. I&#8217;m cross-posting it here in order to make sure it gets copied to more servers, as some people have suggested I&#8217;ll face a cease and desist order for publishing it in the first place. Please help distribute this important information by freely copying and republishing this post under the conditions of my <acronym title="Columbia College">CC</acronym>-BY-NC-ND license: provide me with attribution and a (real) back link, and you are free to republish an unaltered version of this post wherever you like. Thanks.</em></p>
<p>A few nights ago, I received an email from Editor of EdenFantasys&#8217;s SexIs Magazine, Judy Cole, asking me to modify <a href="http://kinkontap.com/?p=676">this Kink On Tap brief</a> I published that cites Lorna D. Keach&#8217;s writing. Judy asked me to &#8220;provide attribution and a link back to&#8221; SexIs Magazine. An ordinary enough request soon proved extraordinarily unethical when I discovered that <strong>EdenFantasys has invested a staggering amount of time and money to develop and implement a technology platform that actively denies others the courtesy of link reciprocity</strong>, <a href="http://www.ted.com/talks/jonathan_zittrain_the_web_is_a_random_act_of_kindness.html">a courtesy on which the ethical Internet is based</a>.</p>
<p>While what they&#8217;re doing may not be illegal, EdenFantasys has proven itself to me to be an unethical and unworthy partner, in business or otherwise. Its actions are blatantly hypocritical, as I intend to show in detail in this post. Taking willful and self-serving advantage of those not technically savvy is a form of inexcusable oppression, and none of us should tolerate it from companies who purport to be well-intentioned resources for a community of sex-positive individuals.</p>
<p>For busy or non-technical readers, see the next section, <a href="#executive-summary">Executive Summary</a>, to quickly understand what EdenFantasys is doing, why it&#8217;s unethical, and <a href="#how-this-affects-you">how it affects you</a> whether you&#8217;re a customer, a contributor, or a syndication partner. For the technical reader, the <a href="#technical-details">Technical Details</a> section should provide ample evidence in the form of a walkthrough and sample code describing the unethical Search Engine Optimization (<acronym title="Search Engine Optimization">SEO</acronym>) and Search Engine Marketing (<acronym title="Search Engine Marketing">SEM</acronym>) techniques EdenFantasys, <acronym title="Also Known As">aka</acronym>. Web Merchants, Inc., is engaged in. For anyone who wants to read further, I provide an <a href="#editorial">Editorial</a> section in which I share some thoughts about what you can do to help combat these practices and bring transparency and trust&mdash;not the sabotage of trust EdenFantasys enacts&mdash;to the market.</p>
<h2 id="executive-summary">EXECUTIVE SUMMARY</h2>
<p>Internet sex toy retailer Web Merchants, Inc., which bills itself as the &#8220;sex shop you can trust&#8221; and does business under the name EdenFantasys, has implemented technology on their websites that actively interferes with contributors&#8217; content, intercepts outgoing links, and alters republished content so that links in the original work are redirected to themselves. Using techniques widely acknowledged as unethical by Internet professionals and that are arguably in violation of major search engines&#8217; policies, EdenFantasys&#8217;s publishing platform has effectively outsourced the task of <a href="http://en.wikipedia.org/wiki/Spamdexing#Types_of_Link_Spam">&#8220;link farming&#8221; (a questionable Search Engine Marketing [<acronym title="Search Engine Marketing">SEM</acronym>] technique)</a> to sites with which they have &#8220;an ongoing relationship,&#8221; such as <a href="http://AlterNet.org/">AlterNet.org</a>, other large news hubs, and individual bloggers&#8217; blogs.</p>
<p>Articles published on EdenFantasys websites, such as the &#8220;community&#8221; website SexIs Magazine, contain <acronym title="HyperText Markup Language">HTML</acronym> crafted to look like links, but aren&#8217;t. When visited by a typical human user, a program written in JavaScript and included as part of the web pages is automatically downloaded and intercepts clicks on these &#8220;link-like&#8221; elements, fetching their intended destination from the server and redirecting users there. Due to the careful and deliberate implementation, the browser&#8217;s status bar is made to appear as though the link is legitimate, and that a destination is provided as expected.</p>
<p>For non-human visitors, including automated search engine indexing programs such as Googlebot, the &#8220;link&#8221; remains non-functional, making the article a search engine&#8217;s dead-end or &#8220;orphan&#8221; page whose only functional links are those whose destination is EdenFantasys&#8217;s own web presence. <strong>This makes EdenFantasys&#8217; website(s) a self-referential black hole that provides no reciprocity for contributors who author content, nor for any website ostensibly &#8220;linked&#8221; to from article content.</strong> At the same time, EdenFantasys editors actively solicit inbound links from individuals and organizations through &#8220;link exchanges&#8221; and incentive programs such as &#8220;awards&#8221; and &#8220;free&#8221; sex toys, as well as syndicating SexIs Magazine content such that the content is programmatically altered in order to create multiple (real) inbound links to EdenFantasys&#8217;s websites after republication on their partner&#8217;s media channels.</p>
<h3 id="how-this-affects-you">How EdenFantasys&#8217;s unethical practices have an impact on you</h3>
<p>Regardless of who you are, EdenFantasys&#8217;s unethical practices have a negative impact on you and, indeed, on the Internet as a whole.</p>
<div class="admonition tip" style="float: right; width: 33%; margin: 0 0 1em 1em;">
<strong>See for yourself</strong>: First, <em>log out of any and all EdenFantasys websites</em> or, preferably, use a different browser, or even a proxy service such as <a href="http://torproject.org/">the Tor network</a> for greater anonymity. Due to EdenFantasys&#8217;s technology, <em>you cannot trust that what you are seeing on your screen is what someone else will see on theirs.</em> Next, temporarily disable JavaScript (<a href="http://www.tucows.com/article/1690">read instructions for your browser</a>) and then try clicking on the links in SexIs Magazine articles. If clicking the intended off-site &#8220;links&#8221; doesn&#8217;t work, you know that your article&#8217;s links are being hidden from Google and that your content is being used for shady practices. In contrast, with JavaScript still disabled, navigate to another website (such as this blog), try clicking on the links, and note that the links still work as intended.</p>
<p><strong>Here&#8217;s another verifiable example</strong> from the EdenFantasys site showing that many other parts of Web Merchants, Inc. pages, not merely SexIs Magazine, are affected as well: With JavaScript disabled, visit the <a href="http://www.edenfantasys.com/sex-community/companies/aslan-leather/" rel="nofollow">EdenFantasys company page on Aslan Leather</a> (note, for the sake of comparison, the link in this sentence will work, even with JavaScript off). Try clicking on the link in the &#8220;Contact Information&#8221; section in the lower-right hand column of the page (shown in the screenshot, below). This &#8220;link&#8221; <em>should</em> take you to the Aslan Leather homepage but in fact it does not. So much for that &#8220;link exchange.&#8221;<br />
<a href="http://maybemaimed.com/wp-content/uploads/2010/05/edenfantasys-company-contact-information.png"><img src="http://maybemaimed.com/wp-content/uploads/2010/05/edenfantasys-company-contact-information-300x266.png" alt="" title="edenfantasys-company-contact-information" width="300" height="266" class="size-medium wp-image-1752" /></a><br />
(Click to enlarge.)
</div>
<ul>
<li><strong>If you&#8217;re an EdenFantasys employee</strong>, people will demand answers from you regarding the unethical practices of your (hopefully former) employer. While you are working for EdenFantasys, you&#8217;re seriously soiling your reputation in the eyes of ethical Internet professionals. Ignorance is no excuse for the lack of ethics on the programmers&#8217; part, and it&#8217;s a shoddy one for everyone else; you should be aware of your company&#8217;s business practices because you represent them and they, in turn, represent you.</li>
<li><strong>If you&#8217;re a partner or contributor</strong> (reviewer, affiliate, blogger), while you&#8217;re providing EdenFantasys with inbound links or writing articles for them and thereby propping them up higher in search results, EdenFantasys is not returning the favor to you (when they are supposed to be doing so). Moreover, they&#8217;re attaching your handle, pseudonym, or real name <em>directly</em> to all of their link farming (i.e., spamming) efforts. They <em>look</em> like they&#8217;re linking to you and they <em>look</em> like their content is syndicated fairly, but they&#8217;re actually playing dirty. They&#8217;re going the extra mile to ensure search engines like Google do not recognize the links in articles you write. They&#8217;re trying remarkably hard to make certain that all roads lead to EdenFantasys, but none lead outside of it; no matter what the &#8220;link,&#8221; search engines see it as stemming from and leading to EdenFantasys. The technically savvy executives of Web Merchants, Inc. are using you without giving you a fair return on your efforts. Moreover, EdenFantasys is doing this in a way that preys upon people&#8217;s lack of technical knowledge—potentially your own as well as your readership&#8217;s. Do you want to keep doing business with people like that?</li>
<li><strong>If you&#8217;re a customer</strong>, you&#8217;re monetarily supporting a company that essentially amounts to a glorified yet subtle spammer. If you hate spam, you should hate the unethical practices that lead to spam&#8217;s perpetual reappearance, including the practices of companies like Web Merchants, Inc. EdenFantasys&#8217;s unethical practices may not be illegal, but they are unabashedly a hair&#8217;s width away from it, just like many spammers&#8217;. If you want to keep companies honest and transparent, if you really want a &#8220;sex shop you can trust,&#8221; this is relevant to you because EdenFantasys is not it. If you want to purchase from a retailer that truly strives to offer a welcoming, trustworthy community for those interested in sex positivity and sexuality, pay close attention and take action. For ideas about what you can do, please see <a href="#what-you-can-do">the &#8220;What you can do&#8221; section, below</a>.</li>
<li><strong>If you&#8217;ve never heard about EdenFantasys before</strong>, but you care about a fair and equal-opportunity Internet, this is relevant to you because what EdenFantasys is doing takes advantage of non-tech-savvy people in order to slant the odds of winning the search engine game in their favor. They could have done this fairly, and I personally believe that they would have succeeded. Their sites are user-friendly, well-designed, and solidly implemented. However, they chose to behave maliciously by not providing credit where credit is due, failing to follow through on agreements with their own community members and contributors, and sneakily utilizing other publishers&#8217; web presences to play a very sad zero-sum game that they need not have entered in the first place. In the Internet I want, nobody takes malicious advantage of those less skilled than they are because their own skill should speak for itself. Isn&#8217;t that the Internet and, indeed, the future you want, too?</li>
</ul>
<h2 id="technical-details">TECHNICAL DETAILS</h2>
<p>What follows is a technical exploration of the way the EdenFantasys technology works. It is my best-effort evaluation of the process in as much detail as I can manage within strict self-imposed time constraints. If any of this information is incorrect, I&#8217;d welcome any and all clarifications provided by the EdenFantasys CTO and technical team in an appropriately transparent, public, and ethical manner. (You&#8217;re welcome—nay, <em>encouraged</em>—to leave a comment.)</p>
<p>Although I&#8217;m unconvinced that EdenFantasys understands this, it is the case that honesty is the best policy&mdash;especially on the Internet, where <em>everyone</em> has the power of &#8220;View source.&#8221;</p>
<h3>The &#8220;EF Framework&#8221; for obfuscating links</h3>
<p>Article content written by contributors on SexIs Magazine pages is published after all links are replaced with a <code>&lt;span&gt;</code> element bearing the <code>class</code> of <code>linklike</code> and a unique <code>id</code> attribute value. This apparently happens across any and all content published by Web Merchants, Inc.&#8217;s content management system, but I&#8217;ll be focusing on Lorna D. Keach&#8217;s post entitled <cite>SexFeed:Anti-Porn Activists Now Targeting Female Porn Addicts</cite> for the sake of example.</p>
<p>These fake links look like this in HTML:</p>
<pre><code class="html">And according to Theresa Flynt, vice president of marketing for Hustler video, &lt;span class="linklike" ID="EFLink_68034_fe64d2"&gt;female consumers make up 56% of video sales.&lt;/span&gt;</code></pre>
<p>This originally published <acronym title="HyperText Markup Language">HTML</acronym> is what visitors without JavaScript enabled (and what search engine indexers) see when they access the page. Note that the <code>&lt;span&gt;</code> is not a real link, even though it is made to look like one. (See Figure 1; click it to enlarge.)</p>
<p><strong>Figure 1:</strong></p>
<p><a href="http://maybemaimed.com/wp-content/uploads/2010/05/figure-11.png"><img src="http://maybemaimed.com/wp-content/uploads/2010/05/figure-11-300x241.png" alt="" title="figure-1" width="300" height="241" class="alignnone size-medium wp-image-1759" /></a></p>
<p>In a typical user&#8217;s browser, when this page is loaded, a JavaScript program is executed that mutates these &#8220;linklike&#8221; elements into <code>&lt;a&gt;</code> elements, retaining the &#8220;linklike&#8221; <code>class</code> and the unique <code>id</code> attribute values. However, no value is provided in the <code>href</code> (link destination) attribute of the <code>&lt;a&gt;</code> element. See Figure 2.</p>
<p><strong>Figure 2:</strong></p>
<p><a href="http://maybemaimed.com/wp-content/uploads/2010/05/figure-2.png"><img src="http://maybemaimed.com/wp-content/uploads/2010/05/figure-2-300x241.png" alt="" title="figure-2" width="300" height="241" class="alignnone size-medium wp-image-1760" /></a></p>
<p>The JavaScript program is downloaded in two parts from the endpoint at <code>http://cdn3.edenfantasys.com/Scripts/Handler/jsget.ashx</code>. The first part, retrieved in this example by accessing the <acronym title="Uniform Resource Identifier">URI</acronym> at <code>http://cdn3.edenfantasys.com/Scripts/Handler/jsget.ashx?i=jq132_cnf_jdm12_cks_cm_ujsn_udm_stt_err_jsdm_stul_ael_lls_ganl_jqac_jtv_smg_assf_agrsh&#038;v_14927484.12.0</code>, loads the popular <a href="http://jquery.org/">jQuery JavaScript framework</a> as well as custom code called the &#8220;EF Framework&#8221;.</p>
<p>The EF Framework contains code called the <code>DBLinkHandler</code>, an object that parses the <code>&lt;span&gt;</code> &#8220;linklike&#8221; elements (called &#8220;pseudolinks&#8221; in the EF Framework code) and retrieves the real destination. The entirety of the <code>DBLinkHandler</code> object is shown in <a href="#code-listing-1">code listing 1</a>, below. Note the code contains a function called <code>handle</code> that performs the mutation of the <code>&lt;span&gt;</code> &#8220;linklike&#8221; elements (seen primarily on lines 8 through 16) and, based on the prefix of each elements&#8217; <code>id</code> attribute value, two key functions (<code>BuildUrlForElement</code> and <code>GetUrlByUrlID</code>, whose signatures are on lines 48 and 68, respectively) interact to set up the browser navigation after responding to clicks on the fake links.</p>
<pre id="code-listing-1"><code class="javascript">var DBLinkHandler = {
    pseudoLinkPrefix: "EFLink_",
    generatedAHrefPrefix: "ArtLink_",
    targetBlankClass: "target_blank",
    jsLinksCssLinkLikeClass: "linklike",
    handle: function () {
        var pseudolinksSpans = $("span[id^='" + DBLinkHandler.pseudoLinkPrefix + "']");
        pseudolinksSpans.each(function () {
            var psLink = $(this);
            var cssClass = $.trim(psLink.attr("class"));
            var target = "";
            var id = psLink.attr("id").replace(DBLinkHandler.pseudoLinkPrefix, DBLinkHandler.generatedAHrefPrefix);
            var href = $("&lt;a&gt;&lt;/a&gt;").attr({
                id: id,
                href: ""
            }).html(psLink.html());
            if (psLink.hasClass(DBLinkHandler.targetBlankClass)) {
                href.attr({
                    target: "_blank"
                });
                cssClass = $.trim(cssClass.replace(DBLinkHandler.targetBlankClass, ""))
            }
            if (cssClass != "") {
                href.attr({
                    "class": cssClass
                })
            }
            psLink.before(href).remove()
        });
        var pseudolinksAHrefs = $("a[id^='" + DBLinkHandler.generatedAHrefPrefix + "']");
        pseudolinksAHrefs.live("mouseup", function (event) {
            DBLinkHandler.ArtLinkClick(this)
        });
        pseudolinksSpans = $("span[id^='" + DBLinkHandler.pseudoLinkPrefix + "']");
        pseudolinksSpans.live("click", function (event) {
            if (event.button != 0) {
                return
            }
            var psLink = $(this);
            var url = DBLinkHandler.BuildUrlForElement(psLink, DBLinkHandler.pseudoLinkPrefix);
            if (!psLink.hasClass(DBLinkHandler.targetBlankClass)) {
                RedirectTo(url)
            } else {
                OpenNewWindow(url)
            }
        })
    },
    BuildUrlForElement: function (psLink, prefix) {
        var psLink = $(psLink);
        var sufix = psLink.attr("id").toString().substring(prefix.length);
        var id = (sufix.indexOf("_") != -1) ? sufix.substring(0, sufix.indexOf("_")) : sufix;
        var url = DBLinkHandler.GetUrlByUrlID(id);
        if (url == "") {
            url = EF.Constants.Links.Url
        }
        var end = sufix.substring(sufix.indexOf("_") + 1);
        var anchor = "";
        if (end.indexOf("_") != -1) {
            anchor = "#" + end.substring(0, end.lastIndexOf("_"))
        }
        url += anchor;
        return url
    },
    ArtLinkClick: function (psLink) {
        var url = DBLinkHandler.BuildUrlForElement(psLink, DBLinkHandler.generatedAHrefPrefix);
        $(psLink).attr("href", url)
    },
    GetUrlByUrlID: function (UrlID) {
        var url = "";
        UrlRequest = $.ajax({
            type: "POST",
            url: "/LinkLanguage/AjaxLinkHandling.aspx",
            dataType: "json",
            async: false,
            data: {
                urlid: UrlID
            },
            cache: false,
            success: function (data) {
                if (data.status == "Success") {
                    url = data.url;
                    return url
                }
            },
            error: function (xhtmlObj, status, error) {}
        });
        return url
    }
};</code></pre>
<p>Once the mutation is performed and all the content &#8220;links&#8221; are in the state shown in Figure 2, above, an event listener has been bound to the anchors that captures a click event. This is done using prototypal extension, <acronym title="Also Known As">aka</acronym>. classic prototypal inheritance, in another part of the code, the <code>live</code> function on line 2,280 of the (de-minimized) <code>jsget.ashx</code> program, as shown in code listing 2, here:</p>
<pre id="code-listing-2"><code class="javascript">        live: function (G, F) {
            var E = o.event.proxy(F);
            E.guid += this.selector + G;
            o(document).bind(i(G, this.selector), this.selector, E);
            return this
        },
</code></pre>
<p>At this point, clicking on one of the &#8220;pseudolinks&#8221; triggers the EF Framework to call code set up by the <code>GetUrlByUrlID</code> function from within the <code>DBLinkHandler</code> object, initiating an <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest (XHR)</a> connection to the <code>AjaxLinkHandling.aspx</code> server-side application. The request is an <acronym title="HyperText Transfer Protocol">HTTP</acronym> POST containing only one parameter, called <code>urlid</code>, and its value matches a substring from within the <code>id</code> value of the &#8220;pseudolinks.&#8221; In this example, the <code>id</code> attribute contains a value of <code>EFLink_68034_fe64d2</code>, which means that the unique ID POST&#8217;ed to the server is <code>68034</code>. This is shown in Figure 3, below.</p>
<p><strong>Figure 3:</strong></p>
<p><a href="http://maybemaimed.com/wp-content/uploads/2010/05/figure-3.png"><img src="http://maybemaimed.com/wp-content/uploads/2010/05/figure-3-300x199.png" alt="" title="figure-3" width="300" height="199" class="alignnone size-medium wp-image-1761" /></a></p>
<p>The response from the server, shown in Figure 4, is also simple. If successful, the intended destination is retrieved by the <code>GetUrlByUrlID</code> object&#8217;s <code>success</code> function (on line 79 of <a href="#code-listing-1">Code Listing 1</a>, above) and the user is redirected to that web address, as if the link was a real one all along. The real destination, in this case to CNN.com, is thereby only revealed after the XHR request returns a successful reply.</p>
<p><strong>Figure 4:</strong></p>
<p><a href="http://maybemaimed.com/wp-content/uploads/2010/05/figure-4.png"><img src="http://maybemaimed.com/wp-content/uploads/2010/05/figure-4-300x199.png" alt="" title="figure-4" width="300" height="199" class="alignnone size-medium wp-image-1762" /></a></p>
<p>All of this obfuscation effectively blinds machines such as the Googlebot who are not JavaScript-capable from seeing and following these links. It deliberately provides no increased Pagerank for the link destination (as a real link would normally do) despite being &#8220;linked to&#8221; from EdenFantasys&#8217;s SexIs Magazine article. While the intended destination in this example link was at CNN.com, it could just as easily have been—and is, in other examples—links to the blogs of EdenFantasys community members and, indeed, everyone else linked to from a SexIs Magazine article or potentially any website operated by Web Merchants, Inc. that makes use of this technology.</p>
<h3>The EdenFantasys Outsourced Link-Farm</h3>
<p>In addition to creating a self-referential black hole with no gracefully degrading outgoing links, EdenFantasys also actively performs link-stuffing through its syndicated content &#8220;relationships,&#8221; underhandedly creating an outsourced and distributed link-farm, just like a spammer. The difference is that this spammer (Web Merchants, Inc. <acronym title="Also Known As">aka</acronym> EdenFantasys) is cleverly crowd-sourcing high-value, high-quality content from its own &#8220;community.&#8221;</p>
<p>Articles published at SexIs Magazine are syndicated in full to other large hub sites, such as AlterNet.org. Continuing with the above example post by Lorna D. Keach, <cite>Anti-Porn Activists Now Targeting Female Porn Addicts</cite>, we can see that <a href="http://www.alternet.org/story/146774/christian_anti-porn_activists_now_targeting_female_">this content was republished on AlterNet.org</a> shortly after original publication through EdenFantasys&#8217; website on May 3<sup>rd</sup> at <code>http://www.alternet.org/story/146774/christian_anti-porn_activists_now_targeting_female_</code>. However, a closer look at the <acronym title="HyperText Markup Language">HTML</acronym> code of the republication shows that each and every link contained within the article points to the same destination: the same article published on SexIs Magazine, as shown in Figure 5.</p>
<p><strong>Figure 5:</strong></p>
<p><a href="http://maybemaimed.com/wp-content/uploads/2010/05/figure-5.png"><img src="http://maybemaimed.com/wp-content/uploads/2010/05/figure-5-300x199.png" alt="" title="figure-5" width="300" height="199" class="alignnone size-medium wp-image-1763" /></a></p>
<p>Naturally, these syndicated links provided to third-party sites by EdenFantasys are real and function as expected to both human visitors and to search engines indexing the content. The result is &#8220;natural,&#8221; high-value links to the EdenFantasys website from these third-party sites; EdenFantasys doesn&#8217;t merely scrounge pagerank from harvesting the sheer number of incoming links, but as each link&#8217;s anchor text is different, they are setting themselves up to match more keywords in search engine results, keywords that the original author likely did not intend to direct to them. Offering search engines the implication that EdenFantasys.com contains the content described in the anchor text, when in fact EdenFantasys merely acts as an intermediary to the information, is very shady, to say the least.</p>
<p>In addition to syndication, EdenFantasys employs human editors to do community outreach. These editors follow up with publishers, including individual bloggers (such as myself), and request that any references to published material <q>provide attribution and a link back to us</q>, to use the words of Judy Cole, Editor of SexIs Magazine in an email she sent to me (see below), and presumably many others. EdenFantasys has also been known to request &#8220;link exchanges,&#8221; and offer incentive programs that encouraged bloggers to add the EdenFantasys website to their blogroll or sidebar in order to help raise both parties search engine ranking, when in fact EdenFantasys is not actually providing reciprocity.</p>
<p><a href="http://aagblog.com/2005/10/17/problems-with-edenfantasyscom/">More information about EdenFantasys&#8217;s unethical practices</a>, which are not limited to technical subterfuge, can be <a href="http://aagblog.com/?s=edenfantasys">obtained via AAGBlog.com</a>.</p>
<h3 id="editorial">EDITORIAL</h3>
<p>It is unsurprising that the distributed, subtle, and carefully crafted way EdenFantasys has managed to crowd-source links has (presumably) remained unpenalized by search engines like Google. It is similarly unsurprising that nontechnical users such as the contributors to SexIs Magazine would be unaware of these deceptive practices, or that they are complicit in promoting them.</p>
<p>This is no mistake on the part of EdenFantasys, nor is it a one-off occurrence. The amount of work necessary to implement the elaborate system I&#8217;ve described is also not even remotely feasible for a rogue programmer to accomplish, far less accomplish covertly. No, this is the result of a calculated and decidedly underhanded strategy that originated from the direction of top executives at Web Merchants, Inc. <acronym title="Also Known As">aka</acronym> EdenFantasys.</p>
<p>It is unfortunate that technically privileged people would be so willing to take advantage of the technically uneducated, particularly under the guise of providing a <em>trusted</em> place for the community which they claim to serve. These practices are exactly the ones that &#8220;the sex shop you can trust&#8221; should in no way support, far less be actively engaged in. And yet, here is unmistakable evidence that EdenFantasys is doing <em>literally</em> everything it can not only to bolster its own web presence at the cost of others&#8217;, but to hide this fact from its understandably non-tech-savvy contributors.</p>
<p>On a personal note, I am angered that I would be contacted by the Editor of SexIs Magazine, and asked to properly &#8220;attribute&#8221; and provide a link to <em>them</em> when it is precisely that reciprocity which SexIs Magazine would clearly deny me (and everyone else) in return. It was this request originally received over email from Judy Cole, that sparked my investigation outlined above and enabled me to uncover this hypocrisy. The email I received from Judy Cole is republished, in full, here:</p>
<blockquote><p>From: Judy Cole &lt;luxuryholmes@gmail.com&gt;<br />
Subject: Repost mis-attributed<br />
Date: May 17, 2010 2:42:00 PM PDT<br />
To: kinkontap+viewermail@gmail.com<br />
Cc: Laurel &lt;laurelb@edenfantasys.com&gt;</p>
<p>Hello Emma and maymay,</p>
<p>I am the Editor of the online adult magazine SexIs (http://www.edenfantasys.com/sexis/). You recently picked up and re-posted a story of ours by Lorna Keach that Alternet had already picked up: </p>
<p>http://kinkontap.com/?s=alternet</p>
<p>We were hoping that you might provide attribution and a link back to us, citing us as the original source (as is done on Alternet, with whom we have an ongoing relationship), should you pick up something of ours to re-post in the future.</p>
<p>If you would be interested in having us send you updates on stories that might be of interest, I would be happy to arrange for a member of our editorial staff to do so. (Like your site, by the way. TBK is one of our regular contributors.)</p>
<p>Thanks and Best Regards,</p>
<p>Judy Cole<br />
Editor, SexIs</p></blockquote>
<p>Judy&#8217;s email <em>probably</em> intended to reference the new <a href="http://kinkontap.com/?cat=11">Kink On Tap briefs</a> that my co-host Emma and I publish, not a search result page on the Kink On Tap website. Specifically, she was talking about this brief: <a href="http://KinkOnTap.com/?p=676">http://KinkOnTap.com/?p=676</a>. I said as much in my reply to Judy:</p>
<blockquote><p>Hi Judy,</p>
<p>The <acronym title="Uniform Resource Locator">URL</acronym> in your email doesn&#8217;t actually link to a post. We pick up many stories from AlterNet, as well as a number from SexIs, because we follow both those sources, among others. So, did you mean this following entry?</p>
<p>   <a href="http://KinkOnTap.com/?p=676">http://KinkOnTap.com/?p=676</a></p>
<p>If so, you should know that we write briefs as we find them and provide links to where we found them. We purposefully do not republish or re-post significant portions of stories and we limit our briefs to short summaries in deference to the source. In regards to the brief in question, we do provide attribution to Lorna Keach, and our publication process provides links automatically to, again, the source where we found the article. :) As I&#8217;m sure you understand, this is the nature of the Internet. Its distribution capability is remarkable, isn&#8217;t it?</p>
<p>Also, while we&#8217;d absolutely be thrilled to have you send us updates on stories that might be of interest, we would prefer that you do so in the same way the rest of our community does: by contributing to the community links feed. You can find detailed instructions for the many ways you can do that on our wiki:</p>
<p>   <a href="http://wiki.kinkontap.com/wiki/Community_links_feed">http://wiki.kinkontap.com/wiki/Community_links_feed</a></p>
<p>Congratulations on the continued success of SexIs.</p>
<p>Cheers,<br />
-maymay</p></blockquote>
<p>At the time when I wrote the email replying to Judy, I was perturbed but could not put my finger on why. Her email upset me because she seemed to be suggesting that our briefs are wholesale &#8220;re-posts,&#8221; when in fact Emma and I have thoroughly discussed attribution policies and, as mentioned in my reply, settled on a number of practices including a length limit, automated back linking (yes, with real links, go <a href="http://kinkontap.com/?cat=11">see some Kink On Tap briefs for yourself</a>), and clearly demarcating quotes from the source article in our editorializing to ensure we play fair. Clearly, my somewhat snarky reply betrays my annoyance.</p>
<p>In any event, this exchange prompted me to take a closer look at the Kink On Tap brief I wrote, at the original article, and at the cross-post on AlterNet.org. I never would have imagined that EdenFantasys&#8217;s technical subterfuge would be as pervasive as it has proven to be. It&#8217;s so deeply embedded in the EdenFantasys publishing platform that I&#8217;m willing to give Judy the benefit of the doubt regarding this hypocrisy because she doesn&#8217;t seem to understand the difference between a search query and a permalink (something any laymen blogger would grok). This is apparent from her reply to my response:</p>
<blockquote><p>From: Judy Cole &lt;luxuryholmes@gmail.com&gt;<br />
Subject: Re: Repost mis-attributed<br />
Date: May 18, 2010 4:57:59 AM PDT<br />
[&hellip;redundant email headers clipped&hellip;]</p>
<p>Funny, the <acronym title="Uniform Resource Locator">URL</acronym> in my email opens the same link as the one you sent me when I click on it. </p>
<p>Maybe if you pick up one of our stories in future, you could just say something like &#8220;so and so wrote for SexIs.&#8221; ?</p>
<p>As it stands, it looks as if Lorna wrote the piece for Alternet. Thanks.</p>
<p>Judy</p></blockquote>
<p>That is the end of our email exchange, and will be for good, unless and until EdenFantasys changes its ways. I will from this point forward endeavor never to publish links to any web property that I know to be owned by Web Merchants, Inc., including EdenFantasys.com. I will also do my best to avoid citing any and all SexIs Magazine articles from here on out, and I encourage <em>everyone</em> who has an interest in seeing honesty on the Internet to follow my lead here.</p>
<p>As some of my friends are currently contributors to SexIs Magazine, I would like all of you to know that <strong>I sincerely hope you immediately sever all ties with any and all Web Merchants, Inc. properties, suppliers, and business partners</strong>, especially because you are friends and I think your work is too important to be sullied by such a disreputable company. Similarly, I hope you encourage your friends to do the same. I understand that the economy is rough and that some of you may have business contracts bearing legal penalties for breaking them, but I urge you to nevertheless consider looking at this as a cost-benefit analysis: the sooner you break up with EdenFantasys, the happier everyone on the Internet, including you, will be (and besides, you can loose just as much of your reputation, money, and pagerank while being happy as you can being sad).</p>
<h4 id="what-you-can-do">What you can do</h4>
<ul>
<li>If you are an EdenFantasys reviewer, a SexIs Magazine contributor, or have any other arrangement with Web Merchants, Inc., <strong><a href="mailto: luxuryholmes@gmail.com?subject=EdenFantasys%20and%20SexIs%20Magazine%20must%20conduct%20themselves%20ethically%20or%20I%20quit%20now">write to Judy Cole</a></strong> and demand that content you produce for SexIs Magazine adheres to ethical Internet publication standards. Sever business ties with this company immediately upon receipt of any non-response, or any response that does not adequately address every concern raised in this blog post. (Feel free to leave comments on this post with technical questions, and I&#8217;ll do my best to help you sort out any l33t answers.)</li>
<li>EdenFantasys wants to stack the deck in Google. They do this by misusing your content and harvesting your links. To combat this effort, <strong>immediately remove any and all links to EdenFantasys websites and web presences</strong> from your websites. Furthermore, do not&mdash;I repeat&mdash;do not publish new links to EdenFantasys websites, not even in direct reference to this post. Instead, provide enough information, as I have done, so visitors to your blog posts can find their website themselves. In lieu of links to EdenFantasys, link to other bloggers&#8217; posts about this issue. (Such posts will probably be mentioned in <a href="#comments">the comments section of this post</a>.)</li>
<li><strong>Boycott EdenFantasys</strong>: the technical prowess their website displays does provide a useful shopping experience for some people. However, that in no way obligates you to purchase from their website. If you enjoy using their interface, use it to get information about products you&#8217;re interested in, but then go buy those products elsewhere, perhaps from the manufacturers directly.
<ul>
<li>On the recommendation of my friend <a href="http://charlieglickman.com/">Dr. Charlie Glickman</a>, I suggest <a href="http://www.goodvibes.com/">Good Vibrations</a>.</p>
<li>On the recommendation of <a href="http://maybemaimed.com/2010/04/26/femquaker-shanna-katz-sex-positive-sexuality-educator/">my friend Shanna Katz</a>, I also recommend <a href="http://funlove.com/">Fascinations</a>.</li>
</ul>
</li>
<li><strong>Watch for &#8220;improved&#8221; technical subterfuge from Web Merchants, Inc.</strong> As a professional web developer, I can identify several things EdenFantasys could do to make their unethical practices even harder to spot, and harder to stop. If you have any technical knowledge at all, even if you&#8217;re &#8220;just&#8221; a savvy blogger, you can keep a close watch on EdenFantasys and, if you notice <em>anything</em> that doesn&#8217;t sit well with you, speak up about it like I did. Get a professional programmer to look into things for you if you need help; yes, you can make a difference just by remaining vigilant as long as you share what you know and act honestly, and transparently.</li>
</ul>
<p>If you have additional ideas or recommendations regarding how more people can help keep sex toy retailers honest, please suggest them in the comments.</p>
<p><ins datetime="2010-05-19T20:32:44+00:00"><strong>Update:</strong> To report website spamming or any kind of fraud to Google, use the <a href="https://www.google.com/webmasters/tools/spamreport?pli=1">authenticated Spam Report tool</a>.</ins></p>
<p><ins datetime="2010-05-20T00:07:22+00:00">Update: Google provides much more information about why the kinds of practices EdenFantasys is engaged in degrade the overall web experience for you and me. Read <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=66355">Cloaking, sneaky Javascript redirects, and doorway pages</a> at the Google Webmaster Tools help site for additional <acronym title="Search Engine Optimization">SEO</acronym> information. Using Google&#8217;s terminology, EdenFantasys&#8217;s unethical technology is a very skilled mix of social engineering and &#8220;sneaky JavaScript redirects.&#8221;</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2010/05/19/web-merchants-inc-edenfantasys-unethical-technology/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Why CSS needs delegation capabilities and not &#8220;variables&#8221;</title>
		<link>http://maymay.net/blog/2008/12/14/why-css-needs-delegation-capabilities-and-not-variables/</link>
		<comments>http://maymay.net/blog/2008/12/14/why-css-needs-delegation-capabilities-and-not-variables/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 07:55:04 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=815</guid>
		<description><![CDATA[It&#8217;s been too long since I joined the fun, if amazingly heated, debates over the direction that Web standards are moving in. Recently, given the &#8220;free&#8221; time to do so, I decided to dive head first into what is (sadly) an almost 14 year old debate. The result is this blog post, which is mostly [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been too long since I joined the fun, if amazingly heated, debates over the direction that Web standards are moving in. Recently, given the &#8220;free&#8221; time to do so, I decided to dive head first into what is (sadly) an almost 14 year old debate. The result is this blog post, which is mostly a response to Bert Bos&#8217;s essay <cite><a href="http://www.w3.org/People/Bos/CSS-variables">Why &#8220;variables&#8221; in <acronym title="Cascading Style Sheets">CSS</acronym> are harmful</a></cite> and Matt Wilcox&#8217;s opposing response to that essay, <cite><a href="http://mattwilcox.net/archive/entry/id/991/">Why <acronym title="Cascading Style Sheets">CSS</acronym> needs to borrow from programming languages</a></cite>. Their articles are each worthy of a read, possibly before this one.</p>
<p>Here&#8217;s <strong>the summary</strong> of my argument.</p>
<p class="summary">Adding many &#8220;programmatic&#8221; features to the <acronym title="Cascading Style Sheets">CSS</acronym> language such as variables, macros, or flow control <em>is</em> a mistake. However, <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s failure to simply encode visual <em>relationships</em> (instead of merely typographic properties)&mdash;a severe deficiency in the core language itself&mdash;requires the addition of delegation features. With the additional capability to reference an arbitrary element&#8217;s computed value regardless of its hierarchical context, <acronym title="Cascading Style Sheets">CSS</acronym> will be more accessible to both amateur and professional web designers, more capable, and will more forcefully promote the semantic Web and its ideals.</p>
<h3>In this corner: <acronym title="Cascading Style Sheets">CSS</acronym> variables are harmful</h3>
<p>Bert does a great job of summarizing the conclusion of his argument himself. In his essay, Bert says:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>Adding any form of macros or additional scopes and indirections, including symbolic constants, is not just redundant, but changes <acronym title="Cascading Style Sheets">CSS</acronym> in ways that make it unsuitable for its intended audience. Given that there is currently no alternative to <acronym title="Cascading Style Sheets">CSS</acronym>, these things must not be added.</p></blockquote>
<p>As we all know, one of the wonderful things about <acronym title="Cascading Style Sheets">CSS</acronym> is that the core language itself is remarkably simple. (What&#8217;s <em>not</em> simple is the spectacular way browser manufacturers have destroyed everyone&#8217;s hope that implementing <acronym title="Cascading Style Sheets">CSS</acronym>-based designs in the real world will ever be easy, but that&#8217;s a whole different can of worms.) Fundamentally, <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s syntax can be explained with a mere three major components: property/value pairs, declaration blocks, and rule sets.</p>
<p>What this means is that <acronym title="Cascading Style Sheets">CSS</acronym> <em>as a language</em> is stupidly easy to learn. I think everyone would agree that it&#8217;s certainly easier to learn than, say, JavaScript or <a href="//en.wikipedia.org/wiki/Extensible_Stylesheet_Language"><acronym title="eXtensible Stylesheet Language">XSL</acronym></a>. Now, that&#8217;s important because, without putting too fine a point on it, Bert mentions multiple times that <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s &#8220;intended audience&#8221; are the diverse and likely relatively technically ignorant content authors that are responsible for the overwhelming majority of web pages on the public Internet today.</p>
<p>He makes the very good point that <q cite="http://www.w3.org/People/Bos/CSS-variables">The value of the semantic Web isn&#8217;t defined by how well structured the best documents are, but by how well structured the vast majority of documents</q> are. In other words, <acronym title="Cascading Style Sheets">CSS</acronym> needs to remain instantly useable <em>and reusable</em> to these untrained, amateur web content publishers for the benefits of self-describing documents (i.e., the semantic Web) to see mass adoption.</p>
<p>To wit:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>reusing other people&#8217;s style sheets is more difficult if those style sheets contain user-defined names. Class names are an example. Their names may suggest why the author created them (assuming they are in a language you understand), but typically you will have to look at the document to see where they occur and why. Symbolic constants make that problem worse.</p></blockquote>
<p>And, later:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>For many people, style sheets with constants will thus simply not be usable. It is too difficult to look in two places at once, the place where a value is used and the place where it is defined, if you don&#8217;t know why the rule is split in this way. Many people are confused by indirection anyway and adding an extra one, in addition to the element and class names, has the same effect as obfuscating the style sheet.</p></blockquote>
<p>Whether or not you believe Bert Bos is underestimating the average web designer, it&#8217;s pretty clear that these are really good points. Nobody wants <acronym title="Cascading Style Sheets">CSS</acronym> to be obfuscated, hard to learn, or hard to reuse. That&#8217;d just be crazy talk.</p>
<h3>In the other corner: <acronym title="Cascading Style Sheets">CSS</acronym> variables are a real-world requirement</h3>
<p>The more features you add to an application, a programming language, or indeed any software, the more difficult it becomes to grok it. As the Python people would say, the larger a language gets the more difficult it is to hold all of it in your head. Nevertheless, adding &#8220;features&#8221; is sometimes the only way to add <em>capabilities</em>, and I don&#8217;t think anyone in their right mind would argue that, once written, software should never change. (That&#8217;d just be crazy talk, too.)</p>
<p>In his opposing arguments, Matt Wilcox recognizes this when he says, <q cite="http://mattwilcox.net/archive/entry/id/991/">Yes, the syntax should be simple, but the capabilities of <acronym title="Cascading Style Sheets">CSS</acronym> should not.</q> What he&#8217;s alluding to without verbalizing it is the balance between adding necessary capabilities without unnecessarily growing the &#8220;size of the language.&#8221;</p>
<p>However, Matt says that modern web design <em>methodologies</em> (e.g., separation of concerns between structure, presentation, and behavior) dictate that <acronym title="Cascading Style Sheets">CSS</acronym> needs more capabilities than it currently has:</p>
<blockquote cite="http://mattwilcox.net/archive/entry/id/991/"><p><acronym title="Cascading Style Sheets">CSS</acronym> lacks capabilities to allow truly flexible design, requiring layer upon layer of ‘tricks’ to accomplish certain objectives, requiring content to be structured ‘just so’ to achieve a display objective, or in the case of some designs proving instead to be completely incapable.</p>
<p>[…]</p>
<p><acronym title="Cascading Style Sheets">CSS</acronym>’s positioning is a cludge. It’s a cludge because you can only position relative to the last positioned parent container. Well, that limitation in itself dictates that all positioning relies upon how the content is structured. And that means the presentation and the content are not truly separable.</p></blockquote>
<p>To align <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s capabilities with the requirements of real-world web design objectives, he says, <acronym title="Cascading Style Sheets">CSS</acronym> needs to be capable of describing relationships between semantically and structurally arbitrary but visually related elements.</p>
<blockquote cite="http://mattwilcox.net/archive/entry/id/991/"><p>Visual design is fundamentally about relationships between elements. For all of the artistic flourishes and creativity, it’s about relationships. ‘That yellow’ only grabs your attention because of its contrasting relationship with ‘that blue’. ‘This heading’ only works as a heading because of it’s exaggerated relationship to the size of the body text. […] <acronym title="Cascading Style Sheets">CSS</acronym> has no clue about relationships, period. And that’s why <acronym title="Cascading Style Sheets">CSS</acronym> as it stands right now, is not good enough. That’s why <acronym title="Cascading Style Sheets">CSS</acronym> without variables (true variables), without basic logic, without maths, can never be as flexible as we need it to be.</p></blockquote>
<p>This is what web designers have been complaining about for (what feels like hundreds of) years. The fact that <acronym title="Cascading Style Sheets">CSS</acronym> has no capability to describe <em>presentational relationships</em> between elements in addition to directly describing an individual element&#8217;s presentational properties is a gaping hole that sorely degrades its ability to be a media-agnostic styling language. Every single web designer I&#8217;ve worked with has gasped at this omission, and though at first I didn&#8217;t understand why, the more I understood the principles behind graphic design the more I came to realize how fundamentally problematic this omission really is.</p>
<h3>Adding delegation makes <acronym title="Cascading Style Sheets">CSS</acronym> <em>easier</em> for designers</h3>
<p>As Matt eloquently stated, design is all about relationships. Good web designers create designs by constructing visual elements that have strong, often exacting relationships with other visual elements. There are many names and examples for this: visual language, visual hierarchy, the golden ratio, the grid, visual balance, the typographer&#8217;s scale, and so on.</p>
<p>What happens when the designer tries to define <em>a relationship</em> between elements? &#8220;How do I say that the whitespace between element A and element B should always be the same? How do I define element A&#8217;s height as half of element B&#8217;s?&#8221; These definitions, which are natural and necessary to the way designers work in both their mind and their mediums, are impossible to encode in <acronym title="Cascading Style Sheets">CSS</acronym>.</p>
<p>The closest you can get is declaring the same values to each element&#8217;s properties, not describing the relationship itself. This suffices only so long as these values are known ahead of time and are the same as one another, which severely limits the design possibilities we are capable of (without resorting to what Matt calls &#8220;tricks&#8221;). <em>That&#8217;s</em> why achieving simple visual effects are actually very complex and so, sadly, <em>that&#8217;s</em> where you&#8217;ll find the majority of indirection and obfuscation in <acronym title="Cascading Style Sheets">CSS</acronym> today. (I&#8217;m looking at you, <a href="http://www.alistapart.com/articles/fauxcolumns/">faux columns</a>.)</p>
<h3>So who wins?</h3>
<p>Both Bert Bos and Matt Wilcox have made some great points. Bert rightfully wishes to keep <acronym title="Cascading Style Sheets">CSS</acronym> lean and simple, even at the expense of some arguably beneficial styling power. Matt, on the other hand, argues that our needs as web designers have evolved faster than the technology to the point where <acronym title="Cascading Style Sheets">CSS</acronym> is <em>too</em> limited, fundamentally so.</p>
<p>The truth is, they&#8217;re both right. And they&#8217;re both wrong. Or rather, they are each taking a position that is too extreme. Bert&#8217;s absolutely correct when says that many of these proposed extensions are redundant and harmful, and yet Matt&#8217;s also correct that <acronym title="Cascading Style Sheets">CSS</acronym> lacks some fundamental capabilities that designers <em>expect</em> to be present.</p>
<p>Bert says that the <acronym title="Cascading Style Sheets">CSS</acronym> capabilities everyone&#8217;s asking for can be implemented using techniques that don&#8217;t rely on <acronym title="Cascading Style Sheets">CSS</acronym> whatsoever. These techniques, he says, make things like true <acronym title="Cascading Style Sheets">CSS</acronym> variables &#8220;redundant.&#8221;</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>There are examples of <acronym title="Cascading Style Sheets">CSS</acronym> with constants to satisfy all styles of programming, e.g.: <a href="http://davidwalsh.name/css-variables-php-dynamic">David Walsh</a> (in <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>), <a href="http://sperling.com/examples/pcss/">Tedd Sperling</a> (in <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>), <a href="http://www.digital-web.com/articles/generating_dynamic_css_with_php/">Digital Web Magazine</a> (in <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>), <a href="http://ecoconsulting.co.uk/training/css_includes.shtml">Eco Consulting</a> (in <acronym title="Server Side Include">SSI</acronym>), and <a href="http://icant.co.uk/articles/cssconstants/">Christian Heilmann</a> (<acronym title="Server Side Include">SSI</acronym> and <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>).</p></blockquote>
<p>Quite simply, he&#8217;s correct in stating that programmatic features need not be added to <acronym title="Cascading Style Sheets">CSS</acronym> proper to achieve desired results, but he&#8217;s incorrect in his apparent thinking that designers will be able to use these other tools to leverage <acronym title="Cascading Style Sheets">CSS</acronym>. Take, for instance, the probably more familiar (though not linked above) notion of using JavaScript to manipulate <acronym title="Cascading Style Sheets">CSS</acronym> values.</p>
<pre><code class="javascript">var x = document.getElementById('SideBar'); // get #SideBar element
var y = document.getElementById('MainColumn'); // get #MainColumn
var z = document.defaultView.getComputedStyle(y, '').getPropertyValue('height'); // get computed height of #MainColumn
x.style.height = ( parseInt(z) / 2 ) + 'px'; // set #SideBar's height 1/2 of #MainColumn's</code></pre>
<p>This is an example of programmatic code that uses variables and expressions. It sets the element with the ID of <code>SideBar</code> to half the pixel height of the element with the ID of <code>MainColumn</code>. It does this by obtaining the <code>MainColumn</code>&#8216;s height (at the time this code runs) and saving it in a variable, then performs some trivial math to half the value and use the result as the pixel height of the <code>SideBar</code>.</p>
<p>Doing this is currently impossible with <acronym title="Cascading Style Sheets">CSS</acronym> alone, yet it&#8217;s something that clearly belongs with whatever other &#8220;presentational&#8221; code exists and not in &#8220;programmatic&#8221; scripts that would otherwise be charged with defining &#8220;functionality.&#8221; As Matt states, using JavaScript to &#8220;script&#8221; solutions to <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s shortcomings like this is not an acceptable answer.</p>
<blockquote cite="http://mattwilcox.net/archive/entry/id/991/"><p><acronym title="Cascading Style Sheets">CSS</acronym> doesn’t have [basic logic or maths]. Nor is it the job of JavaScript to make up for this lack of abilities. JavaScript is about interaction behaviour, and what we are talking about here is pure display logic. Not interaction logic.</p></blockquote>
<p>Moreover, the <em>place</em> designers expect to put code like this is, of course, into a <acronym title="Cascading Style Sheets">CSS</acronym> style sheet. The <em>way</em> designers expect to put code like this into <acronym title="Cascading Style Sheets">CSS</acronym> is by adding delegation features. Requiring designers to learn JavaScript (or any other programming language) to encode such design relationships is nothing short of ridiculous. In what world is that easier for untrained laymen to understand than <acronym title="Cascading Style Sheets">CSS</acronym>?</p>
<h3>Adding delegation to <acronym title="Cascading Style Sheets">CSS</acronym> is worth the effort</h3>
<p>One of Bert&#8217;s arguments against such additions to <acronym title="Cascading Style Sheets">CSS</acronym> is that implementations would become harder to create, and that we&#8217;ll (almost certainly) see more bugs.</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>extending <acronym title="Cascading Style Sheets">CSS</acronym> makes implementing more difficult and programs bigger, which leads to fewer implementations and more bugs. That has to be balanced against the usefulness of the extension.</p></blockquote>
<p>Although I do agree with his statement that an extension&#8217;s usefulness has to be balanced against its potential costs, I think something so fundamental to design methodology as delegation greatly overcompensates for the cost of such implementation efforts. Moreover, if I understand Bert correctly and as he also discusses, the majority of implementations that would need to implement such delegation already have relatively complex internal structures to make the implementation effort somewhat easier:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>There is no scoping [in proposals that only define <em>global</em> constants]. That means that an implementation needs a symbol table, but no stack. A stack would require a little bit more memory, but mostly it would make implementations more complex. (Although every programmer has, one hopes, learnt to program a symbol table with lexical scope during his training.) Constants in <acronym title="Cascading Style Sheets">CSS</acronym> are thus easier than, e.g., <a href="http://www.w3.org/TR/xml-names/"><acronym title="eXtensible Markup Language">XML</acronym> Namespaces,</a> which <em>are</em> lexically scoped.</p>
<p>It is different for those <acronym title="Cascading Style Sheets">CSS</acronym> implementations that provide a <a href="http://www.w3.org/TR/DOM-Level-2-Style/"><acronym title="Cascading Style Sheets">CSS</acronym> Object Model</a> (an <acronym title="Application Programming Interface">API</acronym> for manipulating a style sheet in memory). Those implementations <em>do</em> need to keep track of scope in some way, because adding or removing a line of the style sheet can make a previously redundant definition become meaningful.</p></blockquote>
<p>In order to use JavaScript to solve many of the shortcomings of <acronym title="Cascading Style Sheets">CSS</acronym>, as <em>huge</em> numbers of professional web developers do routinely, we use the very <acronym title="Cascading Style Sheets">CSS</acronym> Object Model whose prior implementation already exists for us to build upon.</p>
<h3><acronym title="Cascading Style Sheets">CSS</acronym> delegation doesn&#8217;t grow the size of the language</h3>
<p>For the sake of argument, let&#8217;s simplify our requirement somewhat so that our somewhat contrived example of design intent is to <em>create a relationship</em> between the <code>MainColumn</code> and the <code>SideBar</code> elements such that they are of equal height. This is more informally known as &#8220;making columns.&#8221;</p>
<p>Here&#8217;s what a natural, hypothetical snippet of <acronym title="Cascading Style Sheets">CSS</acronym> would look like if the language supported delegation features such that it could encode visual relationships.</p>
<pre><code class="css">#SideBar { height: #MainColumn; }</code></pre>
<p>This code theoretically says almost the exact same thing as the JavaScript shown earlier (save for the division, of course); it takes the computed value of the <code>MainColumn</code> element&#8217;s height property and applies that value to the <code>SideBar</code> element&#8217;s height property. In other words, &#8220;The SideBar&#8217;s (element B&#8217;s) height is always the same as the MainColumn&#8217;s (element A&#8217;s).&#8221; (Of course, this is a parse error in reality today.)</p>
<p>This extremely trivial example has some remarkably far-reaching implications, and yet there is really nothing radical about its syntax. Making this a reality significantly expands the capabilities of <acronym title="Cascading Style Sheets">CSS</acronym> without dramatically increasing the size of the language. This capability would not only <a href="http://mattwilcox.net/archive/entry/id/1030/" title="Why you should not use display:table; for layout.">beat the pants off</a> &#8220;<a href="http://www.sitepoint.com/blogs/2008/10/22/everything-you-know-about-css-is-wrong/" title="SitePoint's featuring articles and books about browser support for this."><acronym title="Cascading Style Sheets">CSS</acronym> tables</a>,&#8221; it also potentially obsoletes the arguably <a href="http://ejohn.org/blog/css3-template-layout/" title="Just because John Resig likes it doesn't mean it's good.">misguided efforts of the <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym> Advanced Layout</a> and Grid Positioning modules, too.</p>
<p>We&#8217;ve long since abandoned <code>table</code> layouts because they force us to use presentational markup. That&#8217;s still what &#8220;<acronym title="Cascading Style Sheets">CSS</acronym> tables&#8221; force us to do, too. In other words, with <code>display: table</code>, the <code>SideBar</code> needs to be a child of the <code>MainColumn</code> element or, maybe worse and more likely, a child of a semantically meaningless wrapper element.</p>
<p><acronym title="Cascading Style Sheets">CSS</acronym> positioning was introduced with the promise of freeing us from source-order-dependent styling, without which there is no hope of efficiently abstracting presentation away from structure. Moreover, <strong>abstracting presentation away from structure is the single most important prerequisite needed to improve document reusability and strengthen the semantic Web</strong>. Absolute positioning works, but limitations elsewhere in <acronym title="Cascading Style Sheets">CSS</acronym> mean its use is problematic for many designs, so in practice it doesn&#8217;t gain widespread adoption.</p>
<p>Here&#8217;s a theoretical solution to a two-column and a footer layout using <acronym title="Cascading Style Sheets">CSS</acronym> delegation with this semantic HTML:</p>
<pre><code class="html">&lt;body&gt;
    &lt;div id="MainColumn"&gt;I'm the main column.&lt;/div&gt;
    &lt;div id="SideBar"&gt;I'm the right-hand sidebar.&lt;/div&gt;
    &lt;div id="Legalese"&gt;No one will read me.&lt;/div&gt;
&lt;/body&gt;
</code></pre>
<p>The <acronym title="Cascading Style Sheets">CSS</acronym> would look extremely familiar, possibly like this:</p>
<pre><code class="css">#MainColumn { margin: 0 25% 1em 0; float: left; }
#SideBar { width: 25%; min-height: #MainColumn; }</code></pre>
<p>Using the same <acronym title="HyperText Markup Language">HTML</acronym>, the same solution using the <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym> Advanced Layout module would look something more like this, although to be frank I&#8217;m not certain I fully understand this syntax even after staring at it for months:</p>
<pre><code class="css">body {
    display: "a  b"
             ".  ." /1em
             "c  c"
             75% 25%
}
#MainColumn { position: a; }
#SideBar { position: b; }
#Legalese { position: c; }
</code></pre>
<p>Not only does there seem to me to be far more indirection in this method than there would be using <acronym title="Cascading Style Sheets">CSS</acronym> delegation, there is also an enormous increase to the size of the <acronym title="Cascading Style Sheets">CSS</acronym> language: a new (ASCII-art?!) value to the display property whose syntax is clunky at best. A similar story can be <a href="http://ajaxian.com/archives/w3c-css-grid-positioning" title="Ajaxian reports on a rumor that Internet Explorer 8 will add support for Grid Positioning and shows what that might look like in code.">said of the <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym> Grid Positioning module</a>, which does lots more than just add a new (already complex) <code>gr</code> <acronym title="Cascading Style Sheets">CSS</acronym> unit.</p>
<p>The upshot is that the Advanced Layout and the Grid Positioning modules are doing <em>some</em> of the right things in <em>many</em> of the wrong ways. Both those modules add unnecessary complexity to <acronym title="Cascading Style Sheets">CSS</acronym> without giving designers a natural way to say what they mean. They do more to introduce obfuscation and indirection than simple delegation would, and they aren&#8217;t as broadly capable. Both of them try to solve a specific problem instead of dealing with fundamental deficiencies in the <em>toolset</em> designer&#8217;s have to work with.</p>
<h3>Designers want relationships via delegation, not variables</h3>
<p>Adding delegation such as that I&#8217;ve just shown is a natural, necessary addition to <acronym title="Cascading Style Sheets">CSS</acronym> because it is how designers create visual components&mdash;such as grids&mdash;in their designs. Variables (and constants, and macros, etc.), which simply reuse and modify pre-defined statements aren&#8217;t what designers care about. Adding them <em>will</em> bloat <acronym title="Cascading Style Sheets">CSS</acronym> without adding useful functionality.</p>
<p>&#8220;Okay,&#8221; you may be saying to yourself, &#8220;but delegation is itself a kind of variable, isn&#8217;t it?&#8221; Technically yes, however adding delegation resolves the core deficiency in the <acronym title="Cascading Style Sheets">CSS</acronym> language that designers need to use every day. Yes, it&#8217;s technically a form of variable, but that&#8217;s not how designers think of it. To say that one element&#8217;s visual properties is like another makes a variable only by creating a logical and visually appropriate mapping from the first element&#8217;s property to the second independent of markup, thereby avoiding indirection in the form of a variable name or other unfamiliar symbol.</p>
<p>Delegation like this doesn&#8217;t require the addition of anything other than what already exists in <acronym title="Cascading Style Sheets">CSS</acronym>. Class names and ID values are identifiers whose indirection people <em>already</em> have to deal with. Using them for delegation (to reference another element&#8217;s <em>style</em>) doesn&#8217;t increase the cognitive load any more than using them to reference <em><acronym title="HyperText Markup Language">HTML</acronym> elements</em> does. Though untested, the cognitive load might actually be even less since the <acronym title="Cascading Style Sheets">CSS</acronym> delegation&#8217;s references could be in the same (style sheet) file.</p>
<p>Moreover, delegation will increase the likelihood of document reusability by enabling style sheets to be more self-describing, more self-referential, in a similar way as good markup is. It satisfies a very fundamental need that designers have to define graphical relationships between elements. At the same time, it does so in a way that is natural to both their way of thinking and beneficial to the separation of concerns principle on which the &#8220;web stack&#8221; (the trifecta of <acronym title="HyperText Markup Language">HTML</acronym>, <acronym title="Cascading Style Sheets">CSS</acronym>, and JavaScript) is based.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/12/14/why-css-needs-delegation-capabilities-and-not-variables/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>How web designers can do their own HTML/CSS: Read Foundation Website Creation</title>
		<link>http://maymay.net/blog/2008/07/21/how-web-designers-can-do-their-own-htmlcss/</link>
		<comments>http://maymay.net/blog/2008/07/21/how-web-designers-can-do-their-own-htmlcss/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 14:22:19 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hypertext Copywriting]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Maymay Media]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[Writing and blogging]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=476</guid>
		<description><![CDATA[Last month, 37signals published a short but sweet post about why web designers should do the HTML/CSS implementations for their own designs. The bottom line is, as we&#8217;ve all been saying for a long time now, that the Web is not the same kind of medium as other mediums like print. It is a fundamentally [...]]]></description>
			<content:encoded><![CDATA[<p>Last month, 37signals published a short but sweet post about why <a href="//www.37signals.com/svn/posts/1066-web-designers-should-do-their-own-htmlcss">web designers should do the <acronym title="HyperText Markup Language">HTML</acronym>/CSS implementations for their own designs</a>. The bottom line is, as we&#8217;ve all been saying for a long time now, that the Web is not the same kind of medium as other mediums like print. It is a fundamentally different kind of canvas than most web designers are used to using. As a result, if you as a web designer are not intimately familiar with it, you&#8217;re not going to do great work.</p>
<blockquote cite="//www.37signals.com/svn/posts/1066-web-designers-should-do-their-own-htmlcss"><p>designing for the web is a lot less about making something dazzle and a lot more about making it work. The design decisions that matter pertain directly to the constraints of the materials. What form elements to use. What font sizes. What composition. What flow. Those decisions are poorly made at an arm’s length.</p>
<p>I’ve worked with many web designers in the past who only did abstractions and then handed over pictures to be chopped and implemented by “<acronym title="HyperText Markup Language">HTML</acronym> monkeys”. It never really gelled well. The things that got strong attention were all the things that Photoshop did well. Imagery, curvy lines, and the frame. All the <em>around</em> stuff, never the <em>it</em> stuff.</p></blockquote>
<p>In other words, to do great web design you have to design <em>in</em> the Web, not in some other medium <em>for</em> the Web. I mean, serious magazine firm employs designers who don&#8217;t understand how to work with page layout programs like InDesign. Why, then, do so many web design agencies employ designers who don&#8217;t know how to work with web technologies, or even how to use programs like Dreamweaver? It doesn&#8217;t really make any sense, and it&#8217;s no wonder that the resulting implementation is rarely top-notch work.</p>
<p>But if you&#8217;re a graphic designer who doesn&#8217;t know much about Web technologies, what are you to do? Well, as a first step, I think you should pick up my new book, <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.com%2FFoundation-Website-Creation-XHTML-JavaScript%2Fdp%2F1430209917%2F&#038;tag=maymaydotnet-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=9325">Foundation Website Creation</a><img src="http://www.assoc-amazon.com/e/ir?t=maymaydotnet-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />. It&#8217;s available from all good booksellers (and probably some crappy ones) as of today. The book is targeted towards all manner of web professionals, including graphic designers and website producers, who want to learn more about what it takes to actually implement a site.</p>
<p>If I do say so myself, the chapters on <acronym title="eXtensible HyperText Markup Language; HTML reformulated as XML">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> are exceptionally thorough. The book <em>doesn&#8217;t</em> try to turn you into an exceptional programmer. Instead, it will explain the foundational concepts you need to know to <em>understand how <acronym title="eXtensible HyperText Markup Language; HTML reformulated as XML">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> actually work</em>, and in so doing will enable you to use the tools you already know to solve problems and get things done.</p>
<p>I think this book will be an excellent starting point for lots of designers and other web professionals. However, it is not going to take you from zero to hero—no book can. That&#8217;s why I recommend that, after you read <cite>Foundation Website Creation</cite> and have a solid grasp of what the technology can do for you and how it actually does it, you next take a look at these excellent books:</p>
<ul>
<li><a href="http://domscripting.com/book/"><acronym title="Document Object Model">DOM</acronym> Scripting by Jeremy Keith</a> — if you&#8217;re a designer that needs to add a behavioral layer with JavaScript and Ajax to your pages, you need to read this book next.</li>
<li><a href="http://www.amazon.com/Mastering-Dreamweaver-Voices-That-Matter/dp/0321508971">Mastering <acronym title="Cascading Style Sheets">CSS</acronym> with Dreamweaver CS3</a> &#8211; if you&#8217;re familiar with Dreamweaver and want to keep using it to create standards-based web sites, then I recommend you follow <cite>Foundation Website Creation</cite> with this book by <a href="//w3conversions.com/">Stephanie Sullivan</a> and Greg Rewis to take your Dreamweaver skills to the next level.</li>
</ul>
<p>As always, most of all, have fun. Because if you&#8217;re not having fun, you&#8217;re not going to make good web sites no matter what you know.</p>
<p><strong>Note:</strong> As of this writing, the book listing on Amazon still publishes the wrong author list, which is very frustrating but out of my hands. At least the image of our book&#8217;s front cover lists the correct authors.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/07/21/how-web-designers-can-do-their-own-htmlcss/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Ridiculously simple JavaScript version string to object parser</title>
		<link>http://maymay.net/blog/2008/06/15/ridiculously-simple-javascript-version-string-to-object-parser/</link>
		<comments>http://maymay.net/blog/2008/06/15/ridiculously-simple-javascript-version-string-to-object-parser/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 10:39:52 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=468</guid>
		<description><![CDATA[In any kind of development, you often have to deal with version strings. Typically, these version strings are just a dot-separated list of numbers that represent different versions of the software. I recently had a need to compare two version numbers against one another to determine which one was newer. This is useful if, say, [...]]]></description>
			<content:encoded><![CDATA[<p>In any kind of development, you often have to deal with version strings. Typically, these version strings are just a dot-separated list of numbers that represent different versions of the software. I recently had a need to compare two version numbers against one another to determine which one was newer. This is useful if, say, you&#8217;re building an application that wants to check its current version against the &#8220;latest&#8221; available version.</p>
<p>In JavaScript, this is thankfully pretty trivial. My solution is to just parse the version strings with a simple function and return them as objects with appropriate properties whose values are integers. Once in this form, we can compare them with simple math.</p>
<pre class="javascript">function parseVersionString (str) {
    if (typeof(str) != 'string') { return false; }
    var x = str.split('.');
    // parse from string or default to 0 if can't parse
    var maj = parseInt(x[0]) || 0;
    var min = parseInt(x[1]) || 0;
    var pat = parseInt(x[2]) || 0;
    return {
        major: maj,
        minor: min,
        patch: pat
    }
}</pre>
<p>Using this new object, we can now compare two versions really simply:</p>
<pre class="javascript">var running_version = parseVersionString('3.5.2');
var latest_version = parseVersionString('3.4.5');
if (running_version.major < latest_version.major) {
    // A major new update is available!
} else if (running_version.minor < latest_version.minor || running_version.patch < latest_version.patch) {
    // A new minor or patch update is available.
} else {
    // We are running the latest version! No need to update.
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/06/15/ridiculously-simple-javascript-version-string-to-object-parser/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>I&#8217;m getting a book published and it&#8217;s called Foundation Website Creation</title>
		<link>http://maymay.net/blog/2008/05/19/im-getting-a-book-published-and-its-called-foundation-web-standards/</link>
		<comments>http://maymay.net/blog/2008/05/19/im-getting-a-book-published-and-its-called-foundation-web-standards/#comments</comments>
		<pubDate>Mon, 19 May 2008 13:50:36 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Maybe Maimed]]></category>
		<category><![CDATA[Maymay Media]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[Writing and blogging]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=436</guid>
		<description><![CDATA[For those who have been wondering what is keeping me so busy these days, the answer is that I&#8217;m working on the final stages of a book that is getting published as one of three co-authors. Not only am contributing three chapters (the technical chapters on (X)HTML and CSS, specifically), but I am also technically [...]]]></description>
			<content:encoded><![CDATA[<p>For those who have been wondering what is keeping me so busy these days, the answer is that I&#8217;m working on the final stages of a book that is getting published as one of three co-authors. Not only am contributing three chapters (the technical chapters on (X)<acronym title="HyperText Markup Language">HTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym>, specifically), but I am also technically reviewing the entire book.</p>
<p>My co-authors on the book, called <a href="//www.friendsofed.com/book.html?isbn=9781430209911"><cite><del datetime="2008-06-15T10:43:08+00:00">Foundation Web Standards</del> <ins datetime="2008-06-15T10:43:08+00:00">Foundation Website Creation</ins></cite></a> (you can <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.com%2FFoundation-Website-Creation-XHTML-JavaScript%2Fdp%2F1430209917%2F&#038;tag=maymaydotnet-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=9325" title="Buy on Amazon.com.">pre-order now</a>) and published by <a href="//friendsofed.com/">Friends of ED</a>, an <a href="//apress.com/">Apress</a> company, are <a href="//industryinteractive.net/">Jonathan Lane of Industry Interactive, Inc.</a> and <a href="//www.sanbeiji.com/">Joe Lewis, who blogs at Sanbeiji.com</a>. I&#8217;m not going to say much more until after the book is released in late July.</p>
<p>For the eager, here&#8217;s the description of the book posted on the Friends of ED website:</p>
<blockquote cite="//www.friendsofed.com/book.html?isbn=9781430209911"><p>Foundation Website Creation explores the process of constructing a web site from start to finish. There is more to the process than just knowing <acronym title="HyperText Markup Language">HTML</acronym>! Designers and developers must follow a proper process to flush out goals and objectives and determine requirements both prior to, and during project development.</p>
<p>Large Web projects are rarely completed by a single person. Producers, project managers, designers, developers, writers, and editors all play critical parts in a project&#8217;s evolution. This book provides an overview of the entire process, and also shows project development from the perspective of these different roles. It introduces the key concepts and duties performed by every member of such a team, and gives you the skills necessary to tackle projects like a professional.</p></blockquote>
<p>It&#8217;s quite exciting getting a book out, and it&#8217;s quite a bit more work than I&#8217;d have ever originally thought. That being said, it&#8217;s extremely rewarding. There&#8217;s a lot more work I need to do on it between now and the time it gets released to publishing, so, well…back to work I go.</p>
<p>Now you all know where I&#8217;ve been spending my time writing.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/05/19/im-getting-a-book-published-and-its-called-foundation-web-standards/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The 10 Geekiest Leopard Features I Will Probably Love</title>
		<link>http://maymay.net/blog/2007/10/18/the-10-geekiest-leopard-features-i-will-probably-love/</link>
		<comments>http://maymay.net/blog/2007/10/18/the-10-geekiest-leopard-features-i-will-probably-love/#comments</comments>
		<pubDate>Thu, 18 Oct 2007 15:45:59 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Security & Privacy]]></category>
		<category><![CDATA[Tech News]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/archives/2007/10/18/the-10-geekiest-leopard-features-i-will-probably-love/</guid>
		<description><![CDATA[This is already horribly old news, and by old I mean several days ago since that&#8217;s about as fast as it takes technology news to grow old, but Apple is releasing Mac OS X 10.5 &#8220;Leopard&#8221; at the end of this month. Apple is calling this release a &#8220;major upgrade,&#8221; and indeed Apple has rarely [...]]]></description>
			<content:encoded><![CDATA[<p>This is already horribly old news, and by old I mean several days ago since that&#8217;s about as fast as it takes technology news to grow old, but Apple is releasing Mac <acronym title="Operating System">OS</acronym> X 10.5 &#8220;Leopard&#8221; at the end of this month. Apple is calling this release a &#8220;major upgrade,&#8221; and indeed Apple has rarely made its users wait so long between operating system releases as they have done between Tiger (Mac <acronym title="Operating System">OS</acronym> X 10.4) and Leopard. So, I&#8217;m already excited.</p>
<p>But then today I was glossing over <a href="//apple.com/macosx/features/300.html">Apple&#8217;s featured features list</a> and I got even more excited. There are the usual, largely meaningless, fluff updates that are nice for Joe Schmo or his mother, but that power users simply don&#8217;t care about, like the new iChat support for animated buddy icons, but the list is also chock-full of really cool, really <em>useful</em> features.</p>
<p>What&#8217;s interesting is that a good deal of these features aren&#8217;t really new features at all. For instance, if you knew how to manipulate the NetInfo database on your Mac, you could already share any folder via Apple&#8217;s &#8220;Personal File Sharing&#8221; feature. (Here&#8217;s a <a href="http://www.macosxhints.com/article.php?story=20011108161839416">Mac <acronym title="Operating System">OS</acronym> X Hints hint explaining how to do it</a>.) In Leopard, however, Apple claims that this functionality is now integrated straight into a folder&#8217;s Get Info… window. If it works as smoothly as Apple claims, this is finally going to bring Mac <acronym title="Operating System">OS</acronym> X (client) into decent competition with Windows XP Professional in terms of <acronym title="Graphical User Interface">GUI</acronym>-level power-user features.</p>
<p>However, while all of these features are really cool, here&#8217;s a list of the ten geekiest features I will probably absolutely love, for one reason or another.</p>
<ul>
<li id="li-1"><strong>Ruby on Rails, out of the box</strong> — <em>The</em> hot thing in web development right now is Ruby on Rails. Macs have already been the best personal desktop and web development platform because they have built-in support for the Apache web server and a host of other features, but now they will come with a ready-to-roll installation of Ruby on Rails, sporting Mongrel and (better yet) Capistrano! Specifically with the addition of Capistrano, which is terribly undersold as simply a Ruby on Rails deployment platform, these UNIX-y &#8220;toolbox&#8221; items are bound to make Macs that much more useful right out of the box.</li>
<li id="li-2"><strong>Safari&#8217;s full history search</strong> — As their recent public partnerships with Google have shown, Apple is very clearly invested in search technologies. Spotlight gets a huge number of improvements in Leopard, but none which I think are going to be more useful to more people than this one: spotlight searches on the full text of each web page in your visited history list. That&#8217;s just awesome. Also awesome: using spotlight as a calculator and as a dictionary, which also shows just how Google-like Apple is trying to be. (<a href="http://www.google.com/help/cheatsheet.html">Google also lets you ask it arithmetic questions and a dictionary</a>.)</li>
<li id="li-3"><strong>Wikipedia articles in Dictionary.app</strong> — I <em>love</em> Wikipedia because it&#8217;s one of the fastest ways to get (relatively) reliable information quickly. Now that Dictionary.app has built-in integration with Wikipedia, imagine the possibilities for getting that knowledge instant-gratification craving fixed. Apple has not yet announced this capability, but I can easily envision a scenario where all Cocoa text fields are instantly &#8220;wikified&#8221; (with text that matches Wikipedia articles highlighted) much in the same way that current Cocoa text fields allow you to right-click on a misspelled word and have it corrected by Dictionary.app.</li>
<li id="li-4"><strong><a href="http://www.apple.com/macosx/features/300.html#security">Application-based firewall</a></strong> — In classic Apple fashion, functionality that was previously available via third-party additions is now available from Apple itself. In this case, I have to wonder how well Apple&#8217;s updates to its firewall will obviate the need for <a href="http://www.obdev.at/products/littlesnitch/index.html">Little Snitch</a>, which is basically an application-based firewall, too, and a good one at that.</li>
<li id="li-5"><strong>Built-in <em>guest</em> log-in account</strong> — If you&#8217;re as paranoid about security as I am, you&#8217;ve already created a special, limited-access user on your system (called Guest or Visitor or whatever) and whenever friends are over, you tell them to use that account instead of your own. Now in Leopard, Apple has gone through the trouble of setting this up for us already. A small change that is going to have a big impact.</li>
<li id="li-6"><strong>Scriptable System Preferences &amp; applications</strong> — With AppleScript, you can automate the things your computer does with scripts, as long as those things are &#8220;scriptable.&#8221; In previous versions of Mac <acronym title="Operating System">OS</acronym> X, huge gaping holes of what things shipped by Apple were scriptable existed, causing me (personally) some really annoying headaches. AppleScript <acronym title="Graphical User Interface">GUI</acronym> scripting helped me get around many of those roadblocks, but now it seems Apple is finally filling in some of the most notorious gaps in this functionality with scriptable System Preferences. Yay!</li>
<li id="li-7"><strong>Automator workflow variables</strong> — Automator brings the power of AppleScript I just mentioned to more people with a completely graphic programming environment. There is no need to open up a text document and write AppleScript code because Automator lets you create a script (called a Workflow in Automator jargon) using your mouse by dragging and dropping <dfn>actions</dfn> into the order you want them to be performed. It&#8217;s very slick, but until now it&#8217;s been very limited. With Leopard, Apple is beefing up Automator so that it includes things like variables, basic programmatic capability that was sorely lacking before. (Also majorly cool: a command-line utility to access Automator!)</li>
<li id="li-8"><strong><a href="http://www.apple.com/macosx/features/300.html#finder">Finder.app&#8217;s path bar</a></strong> — Every serious Mac user knows that the Finder needs a lot of help. Now, it&#8217;s getting some. Something the Windows Explorer has had forever (as had every desktop environment for Linux, of course) is a visual cue to show you where in your filesystem tree a given folder is located when you are viewing said folder. Now the Finder gains this capability (though Apple&#8217;s description implies that it&#8217;s going to be off by default) with what Apple is calling a &#8220;Path Bar&#8221;. Finally!</li>
<li id="li-9"><strong>Cocoa and scripting bridges</strong> — Even though no one really seems to know about it, it has long been possible for languages other than AppleScript to do things like send Apple Events to Mac <acronym title="Operating System">OS</acronym> X applications. Specifically, Ruby and JavaScript, two of the most well-known web development languages in existence, can already do this with a single ScriptingAddition (OSAX). But now Apple is making this functionality a central feature <em>and</em> fully extending it to their Objective-C (and Cocoa) language and applications such as Xcode and Interface Builder. This means people like me will have a shallower learning curve before we&#8217;re able to create full-fledged, native Mac <acronym title="Operating System">OS</acronym> X applications. Now <em>that&#8217;s</em> exciting!</li>
<li id="li-10"><strong>Xcode 3 refactoring</strong> — This is something you kind of have to see to believe. I got the opportunity to see it demoed at Apple&#8217;s Leopard Tech Talks last year and I was really excited by it. With the new Xcode, Apple&#8217;s development <acronym title="Integrated Drive Electronics">IDE</acronym>, you can do away with find-and-replace searches for things like renaming functions because Xcode understands what parts of your code are what structures and, when you tell it to &#8220;change the function named myFunction to myNewFunction,&#8221; it&#8217;ll only find-and-replace <em>function names</em> instead of every instance of the string &#8220;myFunction.&#8221; That&#8217;s pretty big, and if it were available for more languages, it&#8217;s <em>almost</em> enough to make me ditch <code>vim</code>.</li>
</ul>
<p>So there you have it. Ten features you might not have already known about that are some of the most promising features I can see in Leopard. And I didn&#8217;t even get into Wide-Area Bonjour, which could make services like DynDNS or No-<acronym title="Internet Protocol">IP</acronym> a thing of the past (and which I still want to learn more about), or the new Terminal application (finally with tabs!), or even the multiple user certificates for S/MIME encrypted email.</p>
<p><ins datetime="2007-10-24T15:04-0500"><strong>Note:</strong> One of the least known security features available on Mac <acronym title="Operating System">OS</acronym> X is also possibly one of the best, and the simplest. Evidently, <a href="http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_diffs/chapter_3_section_6.html">all Intel-based Macs are shipped with the <acronym title="eXecute Disable; a feature of modern Intel chipsets that prevent execution of memory from the stack">XD</acronym> (<acronym title="Also Known As">aka</acronym>. <acronym title="No eXecute; a feature of AMD's modern chipsets that prevent execution of memory from the stack">NX</acronym>, <acronym title="Also Known As">aka</acronym>. <acronym title="Data Execution Prevention; Micosoft Windows's supporting implementation of Intel's Execute Disable bit">DEP</acronym>) bit turned on</a>—and thankfully there doesn&#8217;t seem to be any way for users to turn it off. However, this isn&#8217;t a silver bullet and if you want to learn why you should check out this excellent <a href="//anandtech.com/cpuchipsets/showdoc.aspx?i=2239">Anandtech article: <cite>A Bit About the <acronym title="No eXecute; a feature of AMD's modern chipsets that prevent execution of memory from the stack">NX</acronym> Bit</cite></a>.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2007/10/18/the-10-geekiest-leopard-features-i-will-probably-love/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Window and Element Resizing Annoyances in Internet Explorer</title>
		<link>http://maymay.net/blog/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/</link>
		<comments>http://maymay.net/blog/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/#comments</comments>
		<pubDate>Thu, 24 May 2007 22:30:21 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/archives/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/</guid>
		<description><![CDATA[This has been an interesting day. In less than 8 hours, I&#8217;ve had to tackle the following IE nuisances: document.body vs. document.documentElement In IE 6, in order to access the current width of the window in JavaScript you need to get document.body.clientWidth only if you&#8217;re in quirks mode. If you&#8217;re in standards mode, this property [...]]]></description>
			<content:encoded><![CDATA[<p>This has been an interesting day. In less than 8 hours, I&#8217;ve had to tackle the following <acronym title="Internet Explorer">IE</acronym> nuisances:</p>
<h3><code>document.body</code> vs. <code>document.documentElement</code></h3>
<p>In <acronym title="Internet Explorer">IE</acronym> 6, in order to access the current width of the window in JavaScript you need to get <code>document.body.clientWidth</code> only if you&#8217;re in quirks mode. If you&#8217;re in standards mode, this property not only still exists, but it means something entirely different! It instead refers to the width of the <code>body</code> element.</p>
<p>This causes real trouble for some scripts when the value of the this variable seems to suddenly become frozen or fixed at a single value instead of changing appropriately on a window resize event. Instead of <code>document.body.clientWidth</code>, in standards mode, use <code>document.documentElement.clientWidth</code>. (<a href="http://www.quirksmode.org/js/doctypes.html" title="View QuirksMode's compatibility table.">Reference table at QuirksMode.org</a>)</p>
<h3>Internet Explorer crashes when attempting <code>min-width</code></h3>
<p>If you use <acronym title="Internet Explorer">IE</acronym>&#8216;s proprietary <code>expression()</code> syntax to script a <acronym title="Cascading Style Sheets">CSS</acronym> value, beware of calculating widths or heights that exactly match the value you&#8217;d like to set. If you do something like the following to set a minimum width on <code>#someElement</code>, <acronym title="Internet Explorer">IE</acronym> will crash when you actually resize that element to be 500 pixels wide.</p>
<pre>#someElement { width: expression(document.body.clientWidth &lt; <var>500</var> ? "500px" : "auto"); }</pre>
<p>Instead of doing the above, you should check for <em>almost</em> exactly the size you want, like so:</p>
<pre>#someElement { width: expression(document.body.clientWidth &lt; <var>501</var> ? "500px" : "auto"); }</pre>
<p>However, the really important thing to keep in mind is that the minimum width you&#8217;re testing (<em>501</em> in that second case) needs to be at least one pixel greater than the <strong>total content <em>and</em> padding width</strong> of the element. So if you have an element that needs to be no less than 500 pixels wide but also has 10 pixels of left and right padding, you need to check not for 501 pixels in width, but rather for 521 pixels in width. (<a href="http://www.cameronmoll.com/archives/000892.html" title="Fixed: IE 6 min/max width hack">Reference on CameronMoll.com.</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Web is My Computer To Go</title>
		<link>http://maymay.net/blog/2007/04/24/the-web-is-my-computer-to-go/</link>
		<comments>http://maymay.net/blog/2007/04/24/the-web-is-my-computer-to-go/#comments</comments>
		<pubDate>Tue, 24 Apr 2007 16:50:54 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Human-Computer Interaction]]></category>
		<category><![CDATA[Information & Communication]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/archives/2007/04/24/the-web-is-my-computer-to-go/</guid>
		<description><![CDATA[The other day my friend bought her first Mac. She was clearly excited but also clearly a little worried. This, she knew, was going to be a really big change. Or was it? It occured to me while thinking about what this experience must be like for her, a smart but not technically experienced individual, [...]]]></description>
			<content:encoded><![CDATA[<p>The other day my friend bought <a href="http://support.apple.com/specs/macbookpro/MacBook_Pro_Late_2006.html" title="Tech specs for the Apple MacBook Pro (Late 2006)">her first Mac</a>. She was clearly excited but also clearly a little worried. This, she knew, was going to be a really big change. Or was it?</p>
<p>It occured to me while thinking about what this experience must be like for her, a smart but not technically experienced individual, that in fact a lot of what would be easy on the Mac would be the Web. Why? Because the Web is everywhere and, increasingly, every <em>thing</em>. The Web is the interface most people think about these days when they think about using computers.</p>
<p>Just take a look around. Almost everything you can do on a standard desktop application you can do on web pages these days. Instant Messaging was one of the first applications I can think of (off the top of my head) that was taken to the Web with <acronym title="America OnLine">AOL</acronym> Instant Messenger&#8217;s AIM Express. Yahoo! quickly followed. I remember the days when hanging around in Yahoo Clubs Chat Rooms (now Yahoo Groups, and no longer involved with the Chat Rooms feature) used to be all the rage. I played a ton of Go and Battleship back then.</p>
<p>These days, more and more information is being put online and is becoming easier (and more consistent) to access. Twitter is all the rage, I do all my banking online (over verified <code><acronym title="HyperText Transfer Protocol Secured; HTTP over SSL">HTTPS</acronym></code> connections, of course), and Google has integrated GoogleTalk right into the GMail window. In fact, most of my friends never close their GMail window anymore. The browser is the new <acronym title="Instant Message">IM</acronym> client.</p>
<p>Of course, there&#8217;s a fascinating paradox that&#8217;s worth examining in all of this. Simultaneously, the Web provides a consistent interface to my stuff (like email or banking information) and yet all of my information is consistently displayed differently. The Web is my computer&mdash;to go.</p>
<p>So if the Web is my computer on a take-out menu, the web browser is more and more like its own little computer inside the bigger one. Indeed, AJAX has proven itself in an ever increasing number of applications, and intelligent JavaScript is finally getting the attention it deserves. If you&#8217;ll forgive the exceptionally Mac-centric analogy, JavaScript is to the Web as AppleScript is to the Mac. Case in point, here&#8217;s a JavaScript bookmarklet that will give you a &#8220;full screen&#8221; button in any compliant Web browser:</p>
<pre>javascript:self.moveTo(0,0);self.resizeTo(screen.availwidth,screen.availHeight);</pre>
<p>This illustrates the point that the Web browser is becoming an ever more complex platform in its own right. People have already taken this concept further and more than a dozen <a href="http://en.wikipedia.org/wiki/Web_operating_system">Web Operating Systems</a> are already in development. When these mature, computing, for many people, will have finally come full circle and returned to the days of dumb terminals.</p>
<p>By the way, my friend&#8217;s doing quite well with her Mac today. She&#8217;s even using Safari instead of Firefox these days.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2007/04/24/the-web-is-my-computer-to-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greasemonkey Scriptlet for WordPress Comment Moderation</title>
		<link>http://maymay.net/blog/2005/06/25/greasemonkey-scriptlet-for-wordpress-comment-moderation/</link>
		<comments>http://maymay.net/blog/2005/06/25/greasemonkey-scriptlet-for-wordpress-comment-moderation/#comments</comments>
		<pubDate>Sat, 25 Jun 2005 05:22:39 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">/?p=256</guid>
		<description><![CDATA[WP-Delete Moderated Comments is a <a href="http://greasemonkey.mozdev.org/" title="A Firefox extension which lets you add scripts to web pages to change their behavior.">Greasemonkey</a> script that makes it easy to delete spam comments caught in WordPress 1.2's moderation system.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s Spam Season again, apparently. This means lots of annoying spam comments on my blogs and more time than I&#8217;d have liked trying to get rid of them. One little nuisance in particular had been a pain in my neck for two days, and yesterday I finally decided to ease the burden.</p>
<p>When <a href="http://wordpress.org/" title="Semantic personal web publishing software.">WordPress</a> 1.2&#8242;s built-in comment moderation system catches comments it thinks are spam, it sends these comments off into the moderation queue. There the comment can be reviewed, and appropriate action (accept the comment, delete the comment, or ignore the comment and leave it in the moderation queue) can be taken. In order to act on multiple comments at a time (since spam travel in packs), a &ldquo;bulk action&rdquo; radio button can be pressed for each comment one wants to peform the selected action upon. Trouble is, when there are 229 spam comments in your moderation queue, this means you have to press 229 radio buttons.</p>
<p>There has to be a better way. Enter <a href="http://greasemonkey.mozdev.org/" title="A Firefox extension which lets you add scripts to web pages to change their behavior.">Greasemonkey</a>, stage left. From its web site:</p>
<blockquote cite="http://greasemonkey.mozdev.org/"><p>Greasemonkey is a Firefox extension which lets you to add bits of DHTML (&ldquo;user scripts&rdquo;) to any web page to change its behavior. In much the same way that user <acronym title="Cascading Style Sheets">CSS</acronym> lets you take control of a web page&#8217;s style, user scripts let you easily control any aspect of a web page&#8217;s design or interaction.</p>
</blockquote>
<p>Long story short, I wrote a tiny Greasemonkey scriptlet called WP-Delete Moderated Comments which will automatically set WordPress&#8217;s comment moderation radio buttons to &ldquo;delete&rdquo; rather than &ldquo;do nothing.&rdquo; As a result, instead of clicking the mouse 229 times, I merely have to click <em>once</em> on the submit button. Here it is:</p>
<pre>// ==UserScript==
// @name           WP-Delete Moderated Comments
// @description    Sets all moderated comments caught in WordPress to be deleted. (Tested with WordPress 1.2 Mingus.)
// @author         Meitar Moscovitz ( http://maymay.net/ ) Copyright 2005
// @include        Change this to your WordPress blog's comment moderation page.
// ==/UserScript==

(function () {
    var <var>e</var> = document.getElementsByTagName('input');
    for (var <var>i</var>=0; <var>i</var>&lt;<var>e</var>.length; <var>i</var>++)
    {
        if (<var>e</var>[<var>i</var>].type == 'radio' &amp;&amp; <var>e</var>[<var>i</var>].value == 'delete' &amp;&amp; <var>e</var>[<var>i</var>].defaultChecked == false)
        {
            <var>e</var>[<var>i</var>].checked = true;
        }
    }
})();</pre>
<p>For those of you who already have Greasemonkey installed, you can <a href="http://www.maymay.net/tests/javascript/wp-delete-mod-comments.user.js" title="Right-click and select 'Install User Script&hellip;' to install into Greasemonkey.">install WP-Delete Moderated Comments</a> right now. (Right-click on the link and select &ldquo;Install User Script&hellip;&rdquo; from the contextual menu. Then change the included page to the appropriate address, as instructed.)</p>
<p>Questions, comments, suggestions and any other feedback are all welcome.</p>
<p><ins datetime="2005-12-22T16:07-0500">
<p>Note: This scriptlet only works for WordPress 1.2 Mingus. No future updates are planned because this functionality is already available in the WordPress core for versions 1.5 and greater.</p>
<p></ins></p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/06/25/greasemonkey-scriptlet-for-wordpress-comment-moderation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Baffling IE Behavior with PNG Opacity Fix</title>
		<link>http://maymay.net/blog/2004/10/22/baffling-ie-behavior-with-png-opacity-fix/</link>
		<comments>http://maymay.net/blog/2004/10/22/baffling-ie-behavior-with-png-opacity-fix/#comments</comments>
		<pubDate>Fri, 22 Oct 2004 06:57:55 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">/?p=92</guid>
		<description><![CDATA[This has been baffling me to no end for the past few days. I&#8217;ve exhausted my own skill to figure the problem out, so I&#8217;m putting it up here in the hopes that someone more knowledgeable than I can solve the puzzle. The other day I was browsing message board posts and someone was asking [...]]]></description>
			<content:encoded><![CDATA[<p>This has been baffling me to no end for the past few days. I&#8217;ve exhausted my own skill to figure the problem out, so I&#8217;m putting it up here in the hopes that someone more knowledgeable than I can solve the puzzle.</p>
<p>The other day I was browsing message board posts and someone was asking for information on how to get Internet Explorer to play nice with variable opacity <acronym title="Portable Network Graphics">PNG</acronym> images. I suggested that she try <a href="http://www.scss.com.au/family/andrew/">Andrew Gregory</a>&#8216;s <a href="http://www.scss.com.au/family/andrew/webdesign/pngbehavior/">Improved <acronym title="Portable Network Graphics">PNG</acronym> Behavior file for <acronym title="Internet Explorer">IE</acronym></a> which the poster did. However, she reported the most unusual thing: when implemented on her page, <em>all of her images vanished from view!</em></p>
<p>Puzzled, I made my own (very ugly) test pages for three different versions of the behavior file. Surprisingly, when I tested Andrew&#8217;s behavior file the <acronym title="Portable Network Graphics">PNG</acronym> image on my page vanished too! So I dove into the the code and traced the problem down to line 54 of his file, which reads: <code>element.runtimeStyle.filter = ''; // remove filter</code>.</p>
<p>Commenting that line out solved the disappearing image problem, but it seemed like a messy hack more than a fix. I had to assume he put the line in there for a reason. So I decided to litter the functions in the file with <code>alert()</code>&#8216;s to help me visualize the problem. Then I noticed the most bizarre thing. Inside the <code>fixImage()</code> function, <strong>both the <code>if</code> block <em>and</em> the <code>else</code> block were executing procedurally.</strong> That is, first the statements in the if block executed and applied the appropriate <acronym title="Internet Explorer">IE</acronym> filter to the <acronym title="Portable Network Graphics">PNG</acronym> image, but then the else block was executing right afterwards and was removing the filter <em>even though the if block had evaluated to a boolean true!</em></p>
<p>Here is the relevant code I was working with (some comments, and the <code>alert()</code>s added by me):</p>
<pre>function fixImage() {
  // check for real change
  if (realSrc &amp;&amp; (element.src == realSrc) &amp;&amp; IS_PNG.test(element.src)) {
    element.src = blankSrc;
    alert("element.src set to " + blankSrc); // help debug
  } else {
    if (element.src != blankSrc) {
      // backup old src
      realSrc = element.src;
    }
    // test for png
    if (realSrc &amp;&amp; IS_PNG.test(realSrc)) {
      alert("fixImage() 'test for png' IF statement executing"); // help debug
      element.src = blankSrc;
      element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + realSrc + "',sizingMethod='scale')";
    } else {
/*
?? It apparently causes any fix[ed]Image() to disappear! Not sure why it even executes,
?? because the if block above executes too...and doesn't that mean that the else
?? statement should not execute?!?!
*/
      alert("Inside fixImage() 'test for png' else statement: removing filter..."); // help debug
      element.runtimeStyle.filter = ''; // remove filter
    }
  }
}</pre>
<p>So now I&#8217;m really puzzled. What&#8217;s going on? I emailed Andrew on the matter and he said that he couldn&#8217;t replicate this behavior. I am testing this in the latest Internet Explorer 6 on Windows XP Home with Service Pack 2 installed. (Or, to be completely anally retentive, version 6.0.2900.2180.xpsp_sp2_rtm.040803-2158 as reported by Help &rarr; About Internet Explorer.) He was using the latest <acronym title="Internet Explorer">IE</acronym> 6 on Windows 2000, however, so maybe the two versions are different somehow.</p>
<p>All the code is in my <a href="http://www.maymay.net/tests/pngbg/"><acronym title="Portable Network Graphics">PNG</acronym> test directory</a> and the relevant page is the <a href="http://www.maymay.net/tests/pngbg/improved_pngtest.html">improved_pngtest.html</a> document. The .htc file is called from within that document. If anyone out there is bored or wants to try figuring out what&#8217;s happening in <acronym title="Internet Explorer">IE</acronym>, I&#8217;d be very interested to hear about your findings.</p>
<p>I should also point out that Andrew has updated and re-written some parts of this function his new file works without any problems even on my configuration. I&#8217;d still like to figure out why <acronym title="Internet Explorer">IE</acronym> is executing else statements after their respective if blocks have executed though.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/10/22/baffling-ie-behavior-with-png-opacity-fix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keeping Presentation out of Behavioral JavaScripting</title>
		<link>http://maymay.net/blog/2004/09/22/keeping-presentation-out-of-behavioral-javascripting/</link>
		<comments>http://maymay.net/blog/2004/09/22/keeping-presentation-out-of-behavioral-javascripting/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">/?p=67</guid>
		<description><![CDATA[Lately I&#8217;ve been working on a personal project of mine, redesigning and revitilizing my website about Bipolar Disorder. It&#8217;s still deeply entrenched in the redesign and I&#8217;m not even done with the site templates yet, but I was anxious to get some content rolling out quickly so I went ahead with it anyway. Some elements [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been working on a personal project of mine, redesigning and revitilizing <a href="http://www.maymay.net/bpd/">my website about Bipolar Disorder</a>. It&#8217;s still deeply entrenched in the redesign and I&#8217;m not even done with the site templates yet, but I was anxious to get some content rolling out quickly so I went ahead with it anyway.</p>
<p>Some elements of the design, however, relied on dynamic scripting to style appropriately. The key thing here, however, is that I wanted to avoid accessing or manipulating style elements from within the JavaScript script. In other words, I wanted to ensure that all my style rules, the visual declarations for the presentation of these links, would be kept in the site&#8217;s <acronym title="Cascading Style Sheets">CSS</acronym>.</p>
<p>There were several reasons for this:</p>
<ol>
<li>To keep presentation clearly separated from behavior and structure.</li>
<li>To keep the JavaScript unobtrusive and portable.</li>
<li>To ensure that both aspects, presentation <em>and</em> behavior could be easily updated or altered in the future.</li>
<li>To allow for various styling without touching the script.</li>
</ol>
<p>Typically, a JavaScript script with a line similar to <code>elem.style.property = 'value';</code> is used to create so-called &ldquo;dynamic styles.&rdquo; Unfortunately, this would not do for me.</p>
<p>So I fiddled and found that the best way to go about this was to simply tag links that I wanted to style by adding a word to their <code>class</code> name and then write styles for the selected elements inside my stylesheets. In effect, links in my page will be transformed from <code>&lt;a href=&quot;http://some.other.site/&quot;&gt;&lt;/a&gt;</code> to <code>&lt;a <strong>class=&quot;external&quot;</strong> href="http://some.other.site/"&gt;&lt;/a&gt;</code> So I sat down and wrote this little plug-and-play JavaScript to tag the links I wanted. Let&#8217;s go over it line-by-line. (If you&#8217;re antsy, here&#8217;s <a href="#fullExtlinksScript">the whole script</a>.)</p>
<p>First, we define a function named <code>catchExternalLinks</code>. Then we set a variable, <var>extClassName</var>, to hold the class name we&#8217;re going to add to the links. While not strictly necessary to hold in a variable, it does make for easy editing later. Don&#8217;t like the word &ldquo;external&rdquo; for a class name? Change it to something else.</p>
<pre>function catchExternalLinks()
{
    var extClassName = 'external';</pre>
<p>Next, we do some <a href="http://www.quirksmode.org/js/support.html">object detection</a>. This is to ensure that the browser can handle what we&#8217;re going to ask of it. Browsers that can&#8217;t handle it won&#8217;t try to, which is good because it means visitors won&#8217;t see an error when they visit the site. They just won&#8217;t see the dynamic styling.</p>
<pre>if (document.links &amp;&amp; document.getElementById) {</pre>
<p>Now that we know we&#8217;re talking only to browsers which can handle our instructions, we define a variable, <var>h</var> (for <strong>h</strong>ost), which will store the beginning of the web address that we&#8217;re at. On www.maymay.net, <var>h</var> now contains the string <code>http://www.maymay.net</code>.</p>
<pre>var h = window.location.protocol + '//' + window.location.host;</pre>
<p>Next, we need to gather all the links in our page. We assign the links array to the variable <var>l</var>.</p>
<pre>var l = document.links;</pre>
<p>We need to work with each link separately, so we loop through the links&hellip;</p>
<pre>for (var i = 0; i &lt; l.length; i++) {</pre>
<p>&hellip;and assign the value of the <code>href</code> property to the <var>target</var> variable after turning the string <code>toLowerCase</code> text.</p>
<pre>var target = l[i].href.toLowerCase();</pre>
<p>We only want to work with real links, so first we make sure we&#8217;re not dealing with <code>javascript:</code> directives.</p>
<pre>if (target.substr(0, 11) != 'javascript:') {</pre>
<p>Then we search the <var>target</var> string of the link for the <var>h</var> string. If we don&#8217;t find it&hellip;</p>
<pre>if (target.substr(0, h.length).indexOf(h) == -1) {</pre>
<p>&hellip;then this link is an external link so we tag it as such by adding the <var>extClassName</var> to its <code>className</code> preceded by a space. We do this instead of using <code>setAttribute()</code> because this way we can keep any pre-existing values for the <code>class</code> attribute already in the link. The key here is to know that <code>className</code> accesses the <code>class</code> attribute of an element.</p>
<pre>    l[i].className += ' ' + extClassName;}</pre>
<p>Finally, after closing all our blocks properly, we set the <code>catchExternalLinks</code> function to execute <code>onload</code>.</p>
<pre>            }
        }
    }
}
window.onload = catchExternalLinks;</pre>
<p>Of course, as per the requirements for this script being as unobtrusive as possible, it won&#8217;t do anything to the style properties of the link. All it did was add a <code>class</code> value, so we&#8217;ll need to declare our styles in our stylesheet. In my <acronym title="Cascading Style Sheets">CSS</acronym> page, I write the following to display a little icon for these links.</p>
<pre>a.external {
    padding-right: 15px;
    background: transparent url(extlink.gif) center right no-repeat;
}</pre>
<p>The styling possibilities are really rather endless now. Since I can instantly identify external links via the class <code>external</code>, I can also write context-specific styles. For instance, I can limit my styles to only one part of the page with a selector such as</p>
<pre>#main a.external { ... }</pre>
<p>or I could write different styles for external links for the sidebar and a comment  on my entry with</p>
<pre>#sidebar a.external { ... }
.blogComment a.external { ... }</pre>
<p>or any other styling I see fit. In addition, from the script, it&#8217;s very easy to test for links that meet a specific criteria, say, Google definition searches, simply by adding another <code>if</code> clause inside the main loop. Here&#8217;s a version that does just that.</p>
<p><a name="fullExtlinksScript"></a>All together, it goes like this:</p>
<pre>function catchExternalLinks()
{
    var extClassName = 'external';  // the class to set for external links
    var defClassName = 'defSearch'; // the class to set for definition searches
    if (document.links &amp;&amp; document.getElementById)
    {
        var h = window.location.protocol + '//' + window.location.host;
        var l = document.links;
        for (var i = 0; i &lt; l.length; i++)
        {
            var target = l[i].href.toLowerCase();
            if (target.substr(0, 11) != 'javascript:') // only work on links that aren't JavaScript directives
            {
                // tag external links
                if (target.substr(0, h.length).indexOf(h) == -1)
                {
                    l[i].className += ' ' + extClassName;
                }
                // tag Google definition search links
                var anchor = l[i].childNodes[0].nodeValue; // anchor now contains the anchor text of the link
                var s = '?q=define:' + anchor;
                if (target.substr(0, target.length).indexOf(s) != -1) // use != to ensure that the string (var s) EXISTS in target
                {
                    l[i].className += ' ' + defClassName;
                    l[i].title = 'Definitions for ' + anchor + ' on the Web.'; // for the link tooltip
                }
            }
        }
    }
}
window.onload = catchExternalLinks;</pre>
<p>Feel free to steal this snippet. Just remember to write your styles in a stylesheet that you connect to your page, or the script won&#8217;t have any noticeable effect. Of course, that&#8217;s the whole point. Enjoy! ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/09/22/keeping-presentation-out-of-behavioral-javascripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

