Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

112 lines (91 sloc) 3.719 kb
<!doctype html>
<head>
<meta charset="utf-8">
<title>Test - Online Excel Formula Beautifier</title>
<style type="text/css">/*<![CDATA[*/
#formula_input{width:90%}
/*]]>*/</style>
<!--[if gte IE 9]>
<style type="text/css">
.gradient {
filter: none;
}
</style>
<![endif]-->
</head>
<body>
<!-- Side Content -->
<div id="sideContent" class="span-6 last">
<p>
<label class="span-2" for="mode">Mode: </label>
<div class="span-4 last">
<select id="mode" class="span-4 last" onchange="window.beautifier.changeMode_update(this.value)">
<option value="beautify">Beautify</option>
<option value="js" selected="selected">Formula to JavaScript</option>
</select>
</div>
</p>
</div>
<!-- Main Content -->
<div id="container" class="span-12 colborder">
<div id="main" role="main" class="span-12 last">
<div id="inputArea">
<label for="formula_input">Enter your formula here. The leading = is optional.</label><br />
<input type="text" id="formula_input" onkeyup="window.beautifier.txtFormula_Update()" />
</div>
<div class="formula">
<!--h2>excelFormulaUtilities.formatFormulaHTML( "<span id="fomatFormula_2"></span>" );</h2-->
<pre id="fomatFormula_2_out"></pre>
</div>
</div>
</div>
<script src="src/core.js"></script>
<script src="src/ExcelFormulaUtilities.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
(function(){
var MODE_BEAUTIFY = "beautify"
,MODE_JS = "js"
, txtFormula
, formulaOut
, selMode
, trim = window.excelFormulaUtilities.string.trim;
window.beautifier = {}
// Convert the input fields text to the out
function convertFormula( inputElement, outputElement, mode ) {
switch(mode){
case MODE_BEAUTIFY:
try{
outputElement.innerHTML = excelFormulaUtilities.formatFormula( trim(inputElement.value) );
outputElement.style.background = "transparent";
} catch (ex){
outputElement.style.background = "red";
}
break;
case MODE_JS:
try{
outputElement.innerHTML = excelFormulaUtilities.formula2JavaScript( trim(inputElement.value) );
outputElement.style.background = "transparent";
} catch (ex){
outputElement.style.background = "red";
}
break;
}
}
window.onload = function(){
txtFormula = document.getElementById('formula_input'),
formulaOut = document.getElementById('fomatFormula_2_out');
selMode = document.getElementById('mode');
// Handle when the formula input changes value
window.beautifier.txtFormula_Update = function(){
convertFormula(txtFormula, formulaOut, selMode.value);
}
// Handle when the mode input changes value
window.beautifier.changeMode_update = function(){
}
}
}());
/*]]>*/
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.