Post by Chris on Sept 12, 2006 2:53:38 GMT -8
Purpose: Places a calculator icon at the top and bottom of each board the code is associated with. The icon, when clicked, will open a calculator written in javascript that can be used to MULTIPLY, DIVIDE, ADD and SUBTRACT wizard currency in its native Harry Potter denominations of Galleons, Sickles and Knuts. In addition, the calculator will show the currency in its muggle money equivalent.
Installation:
Tested Browsers:
Screenshot:
Code:
Options:
Known Bugs:
Notes:
Edit:
____________________________________________________
Re: [CB] Wizard Money Calculator
« Reply #2 on September 30, 2006 at 8:08am »
____________________________________________________
It works just fine in my Firefox 1.5 install. Make sure you view the usage by clicking on the words "Wizard Calculator - Eton..." at the top of the calculator. You need to enter a value and denomination (Galleon,sickle,knut) before selecting an operation (+,-,/,*) else the operation is ignored since the magnitude of the number is unknown.
Example:
To multiply 9 Galleons, 0 Sickles, 0 Knuts times three:
[/li][li] >> [3] >> [=] >> [Result: 27 Galleons, 0 Sickles, 0 Knuts][/td][/tr][/table]
[/li][li] >> [3] >> [=] >> [Result: 93]
*The [/li][li] is ignoreed since still awaiting entry of a denomination. Pressing [Galleons] at this point would enter it as 93 galleons then await entry of another denomination value or entry of an operation key[/size]
[/td][/tr][/table]
Conclusion:
The operation is ignored if there is no denomination specified.Perhaps the UI can be improved by disabling the operation keys until a valid denomination is entered the same way the denomination keys are disabled on second operand when a multiplication or division operation is specified. fixed
Installation:
- Place in the board's footer
or - Place in the Global Footer then add the board ID of the boards you wish to have the calculator available (green line)as instructed in the code.
- Make sure to separate each board ID with the "|" character (usually found on the same keyboard key as the "\" character).
- If calculator desired on all boards then simply put "all" (no quotes) as the board ID.
- Make sure to separate each board ID with the "|" character (usually found on the same keyboard key as the "\" character).
Tested Browsers:
- Internet Explorer 6/7
- Firefox 1.5/2
Screenshot:
Code:
<script type="text/javascript">
<!--
// Created by EtonBones at yahoo d o t com
// Do not redistribute without permission
// Feel free to edit provided a notation is
// added to this header stating that fact.
// THIS HEADER MUST REMAIN INTACT.
//Location: board footer or global footer
[color=Red]/*Start of User editable variables section */[/color]
wizCalcSymbol='$' //currency symbol
wizCalcRate=7.33; //conversion rate [ex: $7.33 equal 1 galleon]
wizCalcCurrency='Dollar'; //currency name
wizCalcLogon=true // true means user must be logged in to view and use calculator
[color=Red]/* End of User editable variables section*/[/color]
wcget="?sy="+ encodeURIComponent(wizCalcSymbol)+"&ra="+ encodeURIComponent(wizCalcRate)+"&na="+ encodeURIComponent(wizCalcCurrency)
wizCalcLogon=(wizCalcLogon)?/action=(add|remove)bookmark/i:/searchpopup/i
boards=_boardID=null;
function calcIcon(){
if(!document.postForm){
var iCell = document.getElementsByTagName("td");
for(c = 0; c < iCell.length; c ++){
if( iCell.item(c).width == "50%" && iCell.item(c).innerHTML.match(wizCalcLogon)){
var ts=iCell.item(c).getElementsByTagName('a');
for(a=0;a<ts.length;a++){
if(ts[a].href.match(/searchpopup/i)) break;
}
if(ts[a].href.match(/searchpopup/i)){
var oCalc=document.createElement("a");
oCalc.name="calc";
oCalc.href="javascript:void(0);"
oCalc.onclick= function(){window.open("http://etonbones.co.cc/Proboards/Potter/wizardCalcJS2.htm"+ wcget,"WizardCalc", "toolbar=0,status=0, menubar=0, scrollbars=0, resizable=0, width=355, height=200" );}
var oIcon=document.createElement("img")
oIcon.src= "http://i31./c363/EtonBones/wizardcalc.gif";
oIcon.alt="[open wizard calculator]";
oIcon.border="0";
oIcon.width=16;
oIcon.height=16;
oCalc.appendChild(oIcon);
ts[a].parentNode.insertBefore(oCalc,ts[a]);
}
}
}
}else{
var oBtn=document.createElement("INPUT");
oBtn.name="calc";
oBtn.type="button";
oBtn.value="Calculator";
oBtn.onclick=function(){window.open( "http://etonbones.co.cc/Proboards/Potter/wizardCalcJS2.htm"+ wcget, "WizardCalc", "toolbar=0,status=0, menubar=0, scrollbars=0, resizable=0, width=355, height=200" );}
var oReset=document.getElementsByName("nextaction").item(0)
var nb=oReset.nextSibling.nextSibling.cloneNode(true);
oReset=oReset.parentNode.appendChild(nb);
oReset=oReset.previousSibling;
oReset.parentNode.insertBefore(oBtn,oReset);
oReset.parentNode.insertBefore(nb,oReset);
}
}
[color=Red]// uncomment following line and edit with board names if installed in global footer instead of board footer
[/color][color=Green]// var boards="(board1|board2|boardx)";[/color] [color=Red]//use ALL as board name to put on all boards[/color]
if(location.href.match(/action=display/i) || document.postForm){
__submitBtn=document.getElementsByTagName('input');
for(var count=0;count<__submitBtn.length;count++){
if(__submitBtn[count].name=="board"){_boardID=__submitBtn[count].value; break;}
}
if(_boardID){
if(boards==null || new RegExp('^'+boards+'$',"i").test(_boardID) || new RegExp('^'+boards+'$',"i").test('all'))
calcIcon();
}
}
//-->
</script>
Options:
- You may host the files yourself and change the corresponding urls.
- etonbones.co.cc/Proboards/Potter/JS2.js
- http://i31./c363/EtonBones/wizardcalc.gif
- etonbones.co.cc/Proboards/Potter/wizardCalcJS2.htm
- etonbones.co.cc/Proboards/Potter/JS2.js
Known Bugs:
- Cannot use mouse to copy values from calculator in Firefox (must use keyboard [ctrl+c])
- in Firefox, the usage alert box that opens when you click on "Wizard Calculator - Eton..." at the top of the calculator ignores tabs ("\t") unlike MSIE, subsequently the instructions are unformatted.
Notes:
- All fields on calculator are currently readonly to circumvent input checking. Only copying, no pasting, of values is possible. All entered values are through the provided calculator keys or with their corresponding keyboard shortcuts.
- Keyboard shortcuts and usage can be displayed by clicking the title "Wizard Calculator-etonbones..." at the top of the calculator.
- Sept 30, 2004 21:00:00 GMT -8 @fonts.com/aboutfonts/articles/fyti/10-01-2004.htm said:British Sterling
The British Sterling, commonly referred to as the pound, is still the currency in England, Scotland and the United Kingdom’s territories. The pound symbol looks like a calligraphic capital L with a crossbar through it. It can be typed on a Mac by pressing option+3. In a Windows environment, the pound symbol is accessed with the alt key+0163.
Yen
The yen is the standard monetary unit of Japan. Its symbol looks like a cap Y with a double crossbar through the bottom half. The Mac keystroke for the yen symbol is option+y. Within Windows, the yen symbol is accessed by using the alt key+0165.
Florin
The Dutch florin (also called the guilder or gulden) was the basic unit of money in the Netherlands until it was replaced by the euro. The florin symbol looks like a swash lowercase ‘f’. The keystrokes on a Mac for the florin symbol are option+f. In Windows, use the alt key+0131.
Euro
Since 2002, the euro has been the exclusive currency of 12 European countries, including Austria, Belgium, Finland, France (except Pacific territories using the CFP franc), Germany, Greece, Ireland, Italy, Luxembourg, The Netherlands, Portugal and Spain. The euro symbol looks like a capital C with a double crossbar.
Both Apple and Microsoft have included euro symbols in fonts distributed with their operating systems and applications since 1998, and most fonts released since then contain the euro symbol (it replaces the little-used international currency symbol). The euro symbol can be accessed on a Mac by pressing shift+option+2, and within Windows by using the alt key+0128.
Suggestions for improvements welcomed.
I originally wrote the calculator in VB and decided
to try my hand at converting it to javascript which
I'm still learning.
I originally wrote the calculator in VB and decided
to try my hand at converting it to javascript which
I'm still learning.
Edit:
- implemented firefox friendly methods to make crossbrowser (Tested on IE 6.0 and FF 1.5)
- added width and height values for icon after witnessing MSIE inexplicably enlarging the icon and throwing everything out of alignment.
- added a calculator button for use during creating and modifying posts (located between the spell check and reset buttons)
- IE was throwing an error with no param passed to void();
- added option to moved code to global footer to avoid redundant code in multiple board footers if more than one board desired.
- 9/30/2006: disabled operation keys until a denomination is entered.
- 9/30/2006: fixed bug where using the CE (clear entry) key after entering the second operand on a multiply or divide operation never actually cleared the value.
- changed dollar equivalent display field from disabled to readonly to allow highlighting and copying of contents in Firefox (Microsoft browser allows copying of even disabled fields)
- 1/20/2008: added option to specify currency (default: US dollar) and conversion rate (default: $7.33 = 1 galleon) to be used at install time.
- 4/24/2008: Fixed problem with proboards inserting arbitrary space on long lines of the code in this post which broke an url causing the calc icon to not display.
____________________________________________________
Re: [CB] Wizard Money Calculator
« Reply #2 on September 30, 2006 at 8:08am »
____________________________________________________
peter3 said:
Are you sure this works in Firefox? I just tried it, but some of the basic mathematic operators don't work.It works just fine in my Firefox 1.5 install. Make sure you view the usage by clicking on the words "Wizard Calculator - Eton..." at the top of the calculator. You need to enter a value and denomination (Galleon,sickle,knut) before selecting an operation (+,-,/,*) else the operation is ignored since the magnitude of the number is unknown.
Example:
To multiply 9 Galleons, 0 Sickles, 0 Knuts times three:
Correct Key Sequence |
[9] >> [Galleons] >> |
Incorrect Key Sequence |
[9] >> |
*The [/li][li] is ignoreed since still awaiting entry of a denomination. Pressing [Galleons] at this point would enter it as 93 galleons then await entry of another denomination value or entry of an operation key[/size]
[/td][/tr][/table]
Conclusion:
The operation is ignored if there is no denomination specified.