<?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>zethrae.us/blog &#187; web_dev</title>
	<atom:link href="http://zethrae.us/blog/category/web_dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://zethrae.us/blog</link>
	<description>using technology to facilitate awesome.</description>
	<lastBuildDate>Thu, 19 Jan 2012 05:45:35 +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>Website Update</title>
		<link>http://zethrae.us/blog/2011/website-update/</link>
		<comments>http://zethrae.us/blog/2011/website-update/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 00:43:44 +0000</pubDate>
		<dc:creator>zethraeus</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[web_dev]]></category>

		<guid isPermaLink="false">http://zethrae.us/blog/?p=254</guid>
		<description><![CDATA[This holiday I&#8217;ve finally had time to recraft my web presence. Wot! It&#8217;s been a really long time coming. The process of making the layout was truly horrendous. I built the whole thing from a concept that I grew to &#8230; <a href="http://zethrae.us/blog/2011/website-update/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This holiday I&#8217;ve finally had time to recraft my <a href="http://zethrae.us">web presence</a>. Wot! It&#8217;s been a really long time coming.</p>

<p>The process of making the layout was truly horrendous. I built the whole thing from a concept that I grew to despise and eventually scrapped everything but the logical containment. I tore down images and graphics I&#8217;d spent a good few hours on each and replaced them with&#8230; well less. And now I&#8217;m happy. It very concisely does it&#8217;s job.</p>

<p><a href="http://zethrae.us/blog/wp-content/uploads/adam-zethraeus-_-about.png"><img class="aligncenter size-medium wp-image-255" title="homepage" src="http://zethrae.us/blog/wp-content/uploads/adam-zethraeus-_-about-300x234.png" alt="" width="300" height="234" /></a></p>

<p>Writing the content to actually populate the thing took almost as long. I rather dislike writing about myself. Of course there will never be another person reading it with the same detail I did, so perhaps it unnecessary to worry about. Whatever. We are of course our own harshest critics.</p>

<p>I still have to add some images to the work page that I can&#8217;t access/generate without actually being on a Brown CS computer. The things will only ever let one account have access to the GPU at once  and I&#8217;ve yet to have the privilege when logged in over SSH &#8211; so I can&#8217;t run and screenshot my CS123 final. It can wait.</p>

<p>In addition to designing and building the layout, I&#8217;ve returned to my programming roots and had a chance to do some PHP work, whipping up a simple blog engine to run a <a href="http://daringfireball.net">Gruber</a> style commentary thing on. It should let me keep my personal stuff on this blog and not have to resort to using posterous or another service for me to write about tech stuff around me. The engine let&#8217;s you post, edit, and delete and works with a MySQL db. Aside from that it has perma-links, pagination and an rss feed. That&#8217;s it. Oh and so far editing is done in raw HTML, but I might make it use markdown. As I said, simple. -But fun for a few hours of work &#8211; and the first time I&#8217;ve rally looked at PHP since coming to Brown.</p>
]]></content:encoded>
			<wfw:commentRss>http://zethrae.us/blog/2011/website-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing with user scripts</title>
		<link>http://zethrae.us/blog/2010/playing-with-user-scripts/</link>
		<comments>http://zethrae.us/blog/2010/playing-with-user-scripts/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 23:07:09 +0000</pubDate>
		<dc:creator>zethraeus</dc:creator>
				<category><![CDATA[web_dev]]></category>
		<category><![CDATA[4chan]]></category>
		<category><![CDATA[cs016]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[userscript]]></category>

		<guid isPermaLink="false">http://zethrae.us/blog/?p=201</guid>
		<description><![CDATA[I&#8217;m taking a rather fun algorithms course with a website that reddit loves but I do not. I decided to turn this dire, lolcat-overloaded, situation into an opportunity to practice some javascript (without jQuery) and to write my first userscript. &#8230; <a href="http://zethrae.us/blog/2010/playing-with-user-scripts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m taking a rather fun algorithms course with a <a href="http://www.cs.brown.edu/courses/cs016/">website</a> that <a href="http://www.reddit.com/r/funny/comments/azo5c/weve_all_had_that_one_really_eccentric_professor/">reddit loves</a> but I do not. I decided to turn this dire, lolcat-overloaded, situation into an opportunity to practice some javascript (without jQuery) and to write my first userscript.</p>

<p>User scripts are javascript files with the extension &#8216;.user.js&#8217; that are executed client-side to add functionality to a web page. They are natively supported by chrome and opera and are supported via extensions in most other browsers of any note. (Some include Greasemonkey for Firefox, GreaseKit for Safari and Trixie for IE).</p>

<p>I succeeded in reskinning the whole website which was pretty fun. There seems to be a limit to the usefulness of userscripts in that support for the &#8216;@run-at document-start&#8217; flag which I believe should make the script run before any scripts on the page do, is not supported by most browsers. It&#8217;s not all that useful a flag anyway as I imagine you&#8217;d often want the script to run after the DOM has been written so that you can work with the content expected to be on the page. In this case however it would be useful as I attempt to strip out a script on the course page that redirects 1% of all hits to a rickroll (sigh). As such the script still runs before the userscript and so the rickrolling still happens.</p>

<p>I might also put some more time into the replacement style sheet some time soon.</p>

<p style="text-align: center;"><a href="http://zethrae.us/blog/wp-content/uploads/cs16.png"><img class="size-medium wp-image-206 aligncenter" title="cs16" src="http://zethrae.us/blog/wp-content/uploads//cs16-254x300.png" alt="CS16 course site" width="254" height="300" /></a></p>

<p style="text-align: center;">Original<a href="http://zethrae.us/blog/wp-content/uploads//cs16.user_.js.png"><img class="size-medium wp-image-207 aligncenter" title="cs16.user.js" src="http://zethrae.us/blog/wp-content/uploads//cs16.user_.js-300x245.png" alt="CS16 course site with userscript and restyle" width="300" height="245" /></a></p>

<p style="text-align: center;">Reshaped and restyled</p>

<p style="text-align: left;">Code after the break.<span id="more-201"></span></p>

<h3 style="text-align: left;">Final Code:</h3>

<p><pre>﻿// ==UserScript==
// @name           !cs16chan
// @namespace      http://zethrae.us
// @description    Strips mematic content from the cs16 course website
// @include        http://cs.brown.edu/courses/cs016/*
// @include        http://www.cs.brown.edu/courses/cs016/*
// @run-at document-start
// ==/UserScript==</p>

<p>(function() {
 //the following function is from http://snipplr.com/view/1696/get-elements-by-class-name/
 //the internet claims that document.getElementsByClassName() is supported in firefox 3.
 //this doesn't seem to be the case on the CIT machines, so I guess this will have to do.
 //and yes. if i was writing this again, I'd just include and use jquery.
 function getElementsByClassName(classname, node) {
 if(!node) node = document.getElementsByTagName("body")[0];
 var a = [];
 var re = new RegExp('&#92;b' + classname + '&#92;b');
 var els = node.getElementsByTagName("*");
 for(var i=0,j=els.length; i&lt;j; i++)
 if(re.test(els[i].className))a.push(els[i]);
 return a;
 }</p>

<p>function insertAfter(parent, node, referenceNode) {
 parent.insertBefore(node, referenceNode.nextSibling);
}</p>

<p>function strip_css_js(){
 var jsToRemove = document.getElementsByTagName("script");
 for (var i=jsToRemove.length; i&gt;=0; i--){
 if (jsToRemove[i] &amp;&amp; jsToRemove[i].getAttribute("src")!=null){
 jsToRemove[i].parentNode.removeChild(jsToRemove[i]);
 }
 }
 var cssToRemove = document.getElementsByTagName("link")
 for (var i=cssToRemove.length; i&gt;=0; i--){
 if (cssToRemove[i] &amp;&amp; cssToRemove[i].getAttribute("href")!=null){
 cssToRemove[i].parentNode.removeChild(cssToRemove[i]);
 }
 }
 }</p>

<p>function import_css(source) {
 var link = document.createElement("link");
 link.href = source;
 link.rel = "stylesheet";
 link.type = "text/css";
 document.getElementsByTagName("head")[0].appendChild(link);
}</p>

<p>//removes memes that won't be wiped by the fix_markup function
function strip_inline_memes(){
 var tagline = document.getElementById('tagline');
 tagline.parentNode.removeChild(tagline);</p>

<p>var footer = document.getElementById('footer');
 footer.parentNode.removeChild(footer);</p>

<p>var images = document.getElementsByTagName("img")
 for (var i=images.length; i&gt;=0; i--){
 if (images[i]){
 images[i].parentNode.removeChild(images[i]);
 }
 }</p>

<p>var memesbyclass = getElementsByClassName('preH1').concat(getElementsByClassName('postH1'))
 for (var i=memesbyclass.length; i&gt;=0; i--){
 if (memesbyclass[i]){
 memesbyclass[i].parentNode.removeChild(memesbyclass[i]);
 }
 }</p>

<p>}
function fix_markup(){
 var header = document.getElementById('header');
 header.parentNode.removeChild(header);</p>

<p>var head1 = getElementsByClassName('h1')
 for (var i=head1.length; i&gt;=0; i--){
 if (head1[i]){
 var newheader = document.createElement("div");
 newheader.innerHTML = "&lt;h1&gt;CS16 / "+ head1[i].innerHTML +"&lt;/h1&gt;";
 head1[i].parentNode.replaceChild(newheader,head1[i]);
 }
 }</p>

<p>var nav = document.getElementById('nav');
 var navcontent = nav.innerHTML;
 var newnav = document.createElement("div");
 newnav.id = "navigation";
 newnav.innerHTML = navcontent;
 nav.parentNode.removeChild(nav);</p>

<p>var content = document.getElementById('content');
 content.insertBefore(newnav, content.firstChild.nextSibling.nextSibling.nextSibling.nextSibling);</p>

<p>}</p>

<p>strip_css_js();
strip_inline_memes();
fix_markup();
import_css("http://zethrae.us/work/bangCS16chan/style.css");
})();
</pre>
This was all intended to be tongue in cheek. But yes, memes from &#8217;06 are rather annoying to see every day. And there wasn&#8217;t even longcat.</p>
]]></content:encoded>
			<wfw:commentRss>http://zethrae.us/blog/2010/playing-with-user-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Newspaper Layout with JQuery</title>
		<link>http://zethrae.us/blog/2010/news-paper-layout-with-jquery/</link>
		<comments>http://zethrae.us/blog/2010/news-paper-layout-with-jquery/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 03:06:48 +0000</pubDate>
		<dc:creator>zethraeus</dc:creator>
				<category><![CDATA[web_dev]]></category>

		<guid isPermaLink="false">http://zethrae.us/blog/?p=169</guid>
		<description><![CDATA[Is it a good idea to use javascript to completely reshape a website&#8217;s design? Columnizer is a JQuery plugin which makes the long wished for and ever intangible vertical wrap CSS feature come to life. The idea of the feature &#8230; <a href="http://zethrae.us/blog/2010/news-paper-layout-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Is it a good idea to use javascript to completely reshape a website&#8217;s design? <a href="http://welcome.totheinter.net/columnizer-jquery-plugin/">Columnizer</a> is a JQuery plugin which makes the long wished for and ever intangible vertical wrap CSS feature come to life.</p>

<p>The idea of the feature is to allow for dynamic newspaper style columns on a website. Columns have ordinarily been unachievable though any means but manually separating up content (which would still give unpredictable results).</p>

<p>I&#8217;m in the camp that wants the web to be both usable and pretty even with javascript turned off. I&#8217;ve missed lots of neat aspects of websites as a result of browsing behind NoScript in past. I think it would be very difficult to make a website designed with such drastic styling done with javascript degrade gracefully in a browser with the tool disabled. However, from a designer&#8217;s perspective, this is still one of the most interesting JQuery plugins I&#8217;ve seen yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://zethrae.us/blog/2010/news-paper-layout-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

