Sindbad~EG File Manager
// Function to customize the toolbar based on problem number and topic
function needsPointSlope(topic)
{
if (topic <= 19)
return true;
return false;
}
function needs_circular_aspect(topic)
{ if(topic == 29) // polar_graphs
return true;
return false;
}
function needsDirectionField(topic)
{ if(topic == 35) // solve_two_odes
return true;
return false;
}
function customizeToolbar(problemNumber, topic) { // inputs are supposed to be integers
console.log("in customizeToolbar with problem and topic", problemNumber, topic)
// Logic to remove/hide buttons
problemNumber = Number(problemNumber);
topic = Number(topic);
// In case some idiot sends it something like "35", change it to 35 and go on.
if ( needsDirectionField(topic) == false){
var directionFieldButton = document.getElementById('directionField');
if (directionFieldButton) {
console.log("directionFieldButton found and will be invisible ");
directionFieldButton.style.display = 'none';
}
}
if ( needsPointSlope(topic) == false){
var pointSlopeButton = document.getElementById('pointSlopeButton');
if (pointSlopeButton) {
pointSlopeButton.style.display = 'none';
}
}
if (needs_circular_aspect(topic)) {
var shadowODE2Input1IDButton = document.getElementById('horizontalzoomin');
var vzoominButton = document.getElementById('verticalzoomin');
var hzoomoutButton = document.getElementById('horizontalzoomout');
var vzoomoutButton = document.getElementById('verticalzoomout');
if (shadowODE2Input1IDButton) {
shadowODE2Input1IDButton.style.display = 'none';
}
if (vzoominButton) {
vzoominButton.style.display = 'none';
}
if (hzoomoutButton) {
hzoomoutButton.style.display = 'none';
}
if (vzoomoutButton) {
vzoomoutButton.style.display = 'none';
}
}
var commentary = document.getElementById("remarks");
if(!commentary)
{
// remove the Remarks button as there's no remark to display
var remarkButton = document.getElementById("remarksButton");
if (remarkButton){
remarkButton.style.display = "none";
}
}
}
document.addEventListener('DOMContentLoaded', function() {
customizeToolbar(problemNumber, topicNumber);
// These variables should be available in the document that included this file
});
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists