Permalink
Browse files

removed the converter experiment

  • Loading branch information...
1 parent 3c07bef commit 8ba1506510a2f44297d1dcb91fd1e6e7563ce2cd scottjehl committed Jan 26, 2012
@@ -1 +0,0 @@
-AddType text/cache-manifest .manifest
@@ -1,80 +0,0 @@
-$(function() {
- var symbols = {
- "USD": "$",
- "EUR": "€",
- "GBP": "£",
- "Miles": "m",
- "Kilometer": "km",
- "inch": "\"",
- "centimeter": "cm"
- };
-
- function list() {
- var ul = $( "#conversions" ).empty(),
- ulEdit = $( "#edit-conversions" ).empty();
- $.each( all, function( index, conversion ) {
- // if last update was less then a minute ago, don't update
- if ( conversion.type === "currency" && !conversion.rate || conversion.updated && conversion.updated + 60000 < +new Date) {
- var self = conversion;
- var url = "http://query.yahooapis.com/v1/public/yql?q=select%20rate%2Cname%20from%20csv%20where%20url%3D'http%3A%2F%2Fdownload.finance.yahoo.com%2Fd%2Fquotes%3Fs%3D" + conversion.from + conversion.to + "%253DX%26f%3Dl1n'%20and%20columns%3D'rate%2Cname'&format=json&diagnostics=true&callback=?";
- $.getJSON( url, function( result ) {
- self.rate = parseFloat( result.query.results.row.rate );
- $( "#term" ).keyup();
- self.updated = +new Date;
- conversions.store();
- });
- }
- $( "#conversion-field" ).tmpl( conversion, {
- symbols: symbols
- }).appendTo( ul );
- $( "#conversion-edit-field" ).tmpl( conversion, {
- symbols: symbols
- }).appendTo( ulEdit );
- });
- ul.add(ulEdit).listview("refresh");
- $( "#term" ).keyup();
- }
- var all = conversions.all();
- $( "#term" ).keyup(function() {
- var value = this.value;
- $.each( all, function( index, conversion ) {
- $( "#" + conversion.from + conversion.to ).text( conversion.rate
- ? Math.ceil( value * conversion.rate * 100 ) / 100
- : "Rate not available, yet."
- );
- });
- }).focus();
- list();
- $( "form" ).submit(function() {
- $( "#term" ).blur();
- return false;
- });
- $( "#add" ).click(function() {
- all.push({
- type: "currency",
- from: $( "#currency-options-from" ).val(),
- to: $( "#currency-options-to" ).val()
- });
- conversions.store();
- list();
- });
- $( "#clear" ).click(function() {
- conversions.clear();
- list();
- return false;
- });
- $( "#restore" ).click(function() {
- conversions.restore();
- list();
- return false;
- });
-
- $( "#edit-conversions" ).click(function( event ) {
- var target = $( event.target ).closest( ".deletebutton" );
- if ( target.length ) {
- conversions.remove( target.prev( "label" ).attr( "for" ) );
- list();
- }
- return false;
- });
-});
@@ -1,5 +0,0 @@
-CACHE MANIFEST
-index.html
-../../css/themes/default
-../../js/
-jquery.tmpl.js
@@ -1,14 +0,0 @@
-ul li { clear:both; }
-li p.currency-from { padding-top:23px; font-size: 180%; font-weight:bold; }
-li p.currency-from a:link, li p.units a:visited { padding-top:26px; font-size: 90%; }
-span.unit { opacity:0.5; }
-
-li p.subtext { margin-top:2px; }
-li p.ui-li-aside { font-size:190%; width:60%; }
-
-
-
-form#curr-form { border-width: 0; overflow: hidden; margin: 2px -15px 2px -15px }
-form#curr-form .ui-input-search { margin: 5px; width: auto; display: block; }
-
-.add-row { font-weight:bold; font-size:110%; }
@@ -1,101 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>jQuery Mobile Framework - Converter Demo Application</title>
- <link rel="stylesheet" href="../../css/themes/default/jquery.mobile.css" />
- <link rel="stylesheet" href="converter.css" />
- <script src="../../js/jquery.js"></script>
- <script src="../../js/"></script>
-
-</head>
-<body>
-
-<div data-role="page" id="start" data-theme="a">
-
- <script src="jquery.tmpl.js"></script>
- <script src="storage.js"></script>
- <script src="application.js"></script>
- <style>
- .field { padding: 15px; }
- </style>
- <script id="conversion-field" type="text/x-jquery-tmpl">
- <li>
- <p class="currency-from">${$item.symbols[from]} <span class="unit">${from}</span></p>
- <p class="currency-to ui-li-aside">${$item.symbols[to]} <span id="${from}${to}" class="rate">NaN</span> <span class="unit">${to}</span></p>
- </li>
- </script>
- <script id="conversion-edit-field" type="text/x-jquery-tmpl">
- <li>
- <label for="${from}${to}" class="ui-input-text conversion-${type}" title="From ${from} to ${to}">${$item.symbols[from]} to ${$item.symbols[to]}</label>
- <a href="#" class="deletebutton ui-aux">Delete</a>
- </li>
- </script>
-
- <div data-role="header" data-theme="e">
- <a href="#customize" data-rel="dialog" data-transition="pop" data-icon="gear" class="ui-btn-right">Edit</a>
- <h1>Currency converter</h1>
- </div>
- <div class="ui-bar ui-bar-a">
- <form method="get" action="" data-role="autoform" id="curr-form">
- <label for="term" data-role="nojs">Search:</label>
- <input type="search" name="term" id="term" placeholder="Type a value..." value="25" data-theme="a" />
- </form>
- </div>
- <div data-role="content">
- <ul id="conversions" data-role="listview" data-theme="a">
- </ul>
- </div>
-</div>
-
-<div data-role="page" id="customize" class="ui-body-b">
-
- <div data-role="header" data-theme="b">
- <h1>Edit conversions</h1>
- <a href="#start" data-transition="fade" data-theme="b" data-icon="check" class="ui-btn-right">Done</a>
- </div>
-
- <div data-role="content">
- <ul id="edit-conversions" data-role="listview" data-theme="c" data-inset="true">
- </ul>
- </div>
- <div class="ui-body">
- <a href="#add-currency-dialog" data-role="button">Add new...</a>
- <a id="restore" href="#" data-role="button" data-theme="c">Restore defaults</a>
- </div>
-</div>
-
-<div data-role="page" id="add-currency-dialog" class="ui-body-b">
- <div data-role="header" data-theme="a">
- <h1>Add new</h1>
- <a href="#customize" class="ui-back" data-icon="arrow-l">Cancel</a>
- </div>
-
- <div data-role="content">
- <h2>Select currencies to convert:</h2>
- <div data-role="fieldcontain">
- <label for="currency-options-from">From</label>
- <select name="currency-options" id="currency-options-from" data-theme="c">
- <option value="EUR">EUR to Euro</option>
- <option value="USD">USD to US Dollar</option>
- <option value="GBP">GBP to Great Britain Pound</option>
- </select>
- </div>
- <div data-role="fieldcontain">
- <label for="currency-options-to">To</label>
- <select name="currency-options" id="currency-options-to" data-theme="c">
- <option value="EUR">EUR to Euro</option>
- <option value="USD">USD to US Dollar</option>
- <option value="GBP">GBP to Great Britain Pound</option>
- </select>
- </div>
- <div data-role="fieldcontain">
- <a id="cancel" href="#customize" data-role="button" data-theme="c" data-inline="true">Cancel</a>
- <a id="add" href="#customize" data-role="button" data-theme="b" data-inline="true">Add conversion</a>
- </div>
- </div>
-</div>
-
-</body>
-</html>
Oops, something went wrong.

0 comments on commit 8ba1506

Please sign in to comment.