﻿/*
* Zoomable Type: Mac OS X's "Show in Large Type" for jQuery
* @version 1.0.1
* @require jQuery >= v1.4.2 
*
* Zoomable Type is a jQuery plugin for reading small text on a
* display from far away.
*
* Distributed under the MIT licence:
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright (c) 2010 Tate Johnson <tate@tatey.com>
*/
(function(b) { function j() { if (e.zoomedElement) { f(); return false } var a = b("<span>", { id: "zoomed" + +new Date, "class": "zoomed" }); a.text(b(this).text()); a.appendTo("body"); a.data.unzoomedWidth = a.width(); a.data.unzoomedHeight = a.height(); g(a); e.zoomedElement = a; b(document).click(f); b(window).resize(h); return false } function f() { b(document).unbind("click", f); b(window).unbind("resize", h); e.zoomedElement.remove(); e.zoomedElement = null } function h() { g(e.zoomedElement) } function g(a) { var d = b(window), c = (d.width() - d.width() * 0.1) / a.data.unzoomedWidth, i = (d.height() - d.height() * 0.1) / a.data.unzoomedHeight; a.css("font-size", (c < i ? c : i) * 100 + "%"); c = a.outerWidth() * 0.02; a.css({ padding: c, "-moz-border-radius": c, "-webkit-border-radius": c, "border-radius": c, "text-shadow": "#000 2px 2px " + parseFloat(a.css("fontSize")) * 0.01 + "px" }); a.css({ left: (d.width() - a.outerWidth()) / 2, top: d.height() / 2 - a.outerHeight() / 2 }) } b.zoomableType = function(a) { b(a || ".zoomable").each(function() { b(this).click(j) }) }; var e = b.zoomableType })(jQuery);
