define('DISALLOW_FILE_EDIT', true);{"id":28,"date":"2007-09-08T02:05:49","date_gmt":"2007-09-08T07:05:49","guid":{"rendered":"http:\/\/www.unfocus.com\/projects\/2007\/09\/08\/share-this-sans-prototypejs\/"},"modified":"2007-09-08T02:05:49","modified_gmt":"2007-09-08T07:05:49","slug":"share-this-sans-prototypejs","status":"publish","type":"post","link":"http:\/\/www.unfocus.com\/2007\/09\/08\/share-this-sans-prototypejs\/","title":{"rendered":"Share This sans-prototype.js"},"content":{"rendered":"

I had a planed to replace the use of Prototype.js<\/a> in the Share This<\/a> WordPress<\/a> plugin, since that was the only plugin using it. Prototype is quite large, and my server isn’t currently set up to gzip javascript files. I started to replace it with jQuery<\/a>, and add an option to switch between the two. I figured it’d be a good way to help make the blog load more quickly if I make sure all the plugins were using the same (smaller) JavaScript framework.<\/p>\n

I found along the way that Share This doesn’t actually use very much of Prototype.js at all. It does a few id based element queries, and uses Prototype’s Position.cumulativeOffset<\/a> once. So I just converted the dollar sign based id query with DOM<\/acronym><\/a> standard getElementById, and replaced the cumulativeOffset method call. Then removed the bits that output a prototype.js header link.<\/p>\n

That’s it. No more bulky prototype.js dependency!<\/p>\n

You can grab the patch<\/a> from the WP Plugins trac<\/a>.<\/p>\n

While I was at it, I also added gzip support for the js, css and static share-this page, along with a new flag to turn gzip on and off.<\/p>\n

Here’s the gzip support patch<\/a>.<\/p>\n

If you’d rather skip all the patching, here is a prepatched share-this.php archive<\/a>. To use it, download the Share This plugin<\/a>, and overwrite share-this.php with the new one (patched against the latest from SVN<\/a> as of this post date).<\/p>\n","protected":false},"excerpt":{"rendered":"

I had a planed to replace the use of Prototype.js in the Share This WordPress plugin, since that was the only plugin using it. Prototype is quite large, and my server isn’t currently set up to gzip javascript files. I started to replace it with jQuery, and add an option to switch between the two. … Continue reading “Share This sans-prototype.js”<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/posts\/28"}],"collection":[{"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":0,"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/posts\/28\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/media?parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/categories?post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.unfocus.com\/wp-json\/wp\/v2\/tags?post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}