Commit e4407f4f authored by Christopher Guess's avatar Christopher Guess
Browse files

minor touches

parent 35a76333
......@@ -26,21 +26,19 @@ function Marka(target) {
}
this.match();
// this.doConversions();
this.doConversions();
}
Marka.prototype.match = function() {
// docs: https://github.com/padolsey/findAndReplaceDOMText
// this.currencySymbols = "[€$¢¥₹₨]";
var opts = [];
this.currencySymbols = "[€$¢¥₹₨]";
/* var opts = [];
for (sym in currency_info) {
var sbl = currency_info[sym].symbol_native.replace("/", "\\/")
if (sbl == "$") { sbl = "\\$" }
opts.push(sbl)
opts.push(currency_info[sym].symbol_native)
}
this.currencySymbols = "(" + opts.join("|") + ")"
console.log(this.currencySymbols)
*/
var currencySymbols = this.currencySymbols;
var currencyWords = "(" + currencySymbols + "|kr|[Dd]ollars|[Cc]ents on the dollar|[Cc]ents|[Ee]uros|[Pp]ounds|[Rr]upees|[Zz]loty)";
var numbers = "[\\d,.]+";
......@@ -71,17 +69,13 @@ Marka.prototype.doConversions = function() {
} else {
var node = $(value);
node.data("original_value", node.text());
var children = node.children()
self.getValueInSetCurrency(res.number, res.symbol, function(value, converted) {
if (converted) {
console.log(self.getCurrentCurrency())
node.text(value.toFixed(2) + " " + self.getCurrentCurrency());
node.text(value + " " + self.getCurrentCurrency());
} else {
node.text(node.data("original_value"))
}
node.append(children);
node.children(".marka-results").html("<span class=\"marka-result\">" + node.data("original_value") + "</span>")
})
}
});
......@@ -98,6 +92,7 @@ Marka.prototype.splitSymbols = function(text) {
realnumber = parseFloat(number);
if (!realnumber) { return false; }
var residual = text.replace(numbers, "")
for(var property in dollar_multiplier_lookup_table){
value = dollar_multiplier_lookup_table[property];
var index = residual.search(property);
......@@ -184,7 +179,7 @@ Marka.prototype.getCurrentCurrency = function(){
}
Marka.prototype.setCurrency = function(currency){
this.setCookie("currency", currency.toUpperCase(), 365);
this.setCookie("currency", currency.toUpperCase(), 365);
}
Marka.prototype.retreiveExchangeRates = function(currency_one, currency_two, callback) {
......
......@@ -45,6 +45,7 @@
<li>$2 lakh</li>
<li>$4 crore</li>
<li>$200 score</li>
<li>$1 hundred million</li>
</ul>
<h2>Should not be caught:</h2>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment