Labs/Bespin/Commands/Calculate

From MozillaWiki
< Labs‎ | Bespin‎ | Commands
Revision as of 19:47, 27 February 2009 by Dalmaer (talk | contribs) (New page: Dion Almaer has this simple little silly calculator: { name: 'calculate', takes: ['expr'], preview: 'calculate some simple math', execute: function(self, expr) { i...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Dion Almaer has this simple little silly calculator:

 {
   name: 'calculate',
   takes: ['expr'],
   preview: 'calculate some simple math',
   execute: function(self, expr) {
     if (!expr) {
       self.showInfo('Please give me something to calculate dood!');
     } else {
       self.showInfo('Calculating ' + expr + '

Result: ' + eval(expr)); } } }