mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-28 23:48:15 +00:00
Converter demo cleanup.
This commit is contained in:
parent
7850c16e69
commit
044b54df2f
2 changed files with 2 additions and 3 deletions
|
|
@ -14,7 +14,6 @@ $(function() {
|
||||||
$.each(all, function(index, conversion) {
|
$.each(all, function(index, conversion) {
|
||||||
// if last update was less then a minute ago, don't update
|
// 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) {
|
if (conversion.type == "currency" && !conversion.rate || conversion.updated && conversion.updated + 60000 < +new Date) {
|
||||||
console.log(conversion.updated)
|
|
||||||
var self = conversion;
|
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=?";
|
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) {
|
$.getJSON(url, function(result) {
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,15 @@
|
||||||
return JSON.parse(localStorage.getItem("conversions"));
|
return JSON.parse(localStorage.getItem("conversions"));
|
||||||
}
|
}
|
||||||
function set(value) {
|
function set(value) {
|
||||||
console.log("storing conversion: "+ JSON.stringify(value))
|
window.console && console.log && console.log("storing conversion: "+ JSON.stringify(value))
|
||||||
localStorage.setItem("conversions", JSON.stringify(value));
|
localStorage.setItem("conversions", JSON.stringify(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
var conversions = get("conversions");
|
var conversions = get("conversions");
|
||||||
if (!conversions) {
|
if (!conversions) {
|
||||||
conversions = $.extend([], defaults);
|
conversions = $.extend([], defaults);
|
||||||
|
set(conversions);
|
||||||
}
|
}
|
||||||
set(conversions);
|
|
||||||
window.conversions = {
|
window.conversions = {
|
||||||
store: function() {
|
store: function() {
|
||||||
set(conversions);
|
set(conversions);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue