Skip to content

Commit

Permalink
refactor as edulogic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Torok committed Feb 24, 2019
1 parent e450e1a commit 0642852
Show file tree
Hide file tree
Showing 47 changed files with 533 additions and 51 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
File renamed without changes.
Empty file modified .idea/misc.xml
100644 → 100755
Empty file.
Empty file modified .idea/modules.xml
100644 → 100755
Empty file.
Empty file modified .idea/paintbrush.org.iml
100644 → 100755
Empty file.
Empty file modified .idea/vcs.xml
100644 → 100755
Empty file.
Empty file modified .idea/workspace.xml
100644 → 100755
Empty file.
Binary file added el_logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added el_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added el_purple.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,22 @@ body {

#title {
color: white;
display: inline-block;
margin-left: .4em;
font-size: 36pt;
font-family: Comfortaa, sans-serif;
font-style: normal;
margin-right: 0;
}

.titles {
color: #bd64d6;
display: inline-block;
margin-left: .4em;
font-size: 36pt;
font-family: Comfortaa, sans-serif;
font-style: normal;
margin-left: 0;
}

#subtitle {
Expand All @@ -37,6 +49,16 @@ body {
align-items: flex-start;
}

#elLogo {
width: 4em;
margin-top:2em;
border:0;
}

#elLink {
margin-left: 45em;
}

#barMenus {
margin-top: 3.5em;
margin-left: 10em;
Expand Down
File renamed without changes.
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ $(document).ready(function () {
});


$("#elLogo").hover(function () {
$(this).attr("src", "el_purple.gif");
}, function() {
$(this).attr("src", "el_logo.gif");
});


$("#downloadArrow").click(function () {
if (loginState === 1) {
$("#login").click();
Expand Down Expand Up @@ -235,4 +242,4 @@ function getOS() {
}

return os;
}
}
59 changes: 9 additions & 50 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>The Paintbrush Project</title>
<title>Home - Edulogic</title>
<link rel="stylesheet" href="index.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
Expand All @@ -15,64 +15,23 @@
<div id="titleBarWrapper">
<div id="titleBar" class="asRow">
<div>
<p id="title">paintbrush.</p>
<p id="subtitle">Let's get something done today.</p>
<p id="title">edu</p>
<p id="title2" class="titles">logic</p>
<p id="subtitle">Let's get something done today.</p>
</div>
<div id="barMenus" class="asRow">
<p class="barMenu">About</p>
<p class="barMenu">For Students</p>
<p class="barMenu">For Teachers</p>
<p class="barMenu">For Schools</p>
</div>
<div id="loginButtons" class="asRow" style="float: right;">
<p id="login" class="barMenu loginButton">Sign In</p>
<p style="color: white">|</p>
<p id="createAcct" class="barMenu loginButton">Sign Up</p>
</div>
<div id="downloadButton" class="roundedDL">
<p id="downloadText">Download</p>
</div>
<div id="downloadArrow" class="roundedDL">
<p id="downloadArrowText">&#xfe40;</p>
</div>
<p class="barMenu">Paintbrush</p>
<p class="barMenu">Community</p>
<p class="barMenu">What We Do</p>
</div>
<a id="elLink" href="index.php"><img src="el_logo.gif" id ="elLogo"/></a>
</div>
<div id="titleBarBorder">
<div id="scrollBar"></div>
</div>
</div>
<div id="mainBody">
<div id="loginBlock">
<div id="loginScrollBar"></div>
<form id="loginForm">
<label for="usernameField">Username</label><br>
<input id="usernameField" type="text" name="username"><br>
<label for="passwordField">Password</label><br>
<input id="passwordField" type="password" name="password"><br>
<label class="createAcctOnly" for="firstNameField">First Name</label><br>
<input class="createAcctOnly" id="firstNameField" type="text" name="firstName"><br>
<label class="createAcctOnly" for="lastNameField">Last Name</label><br>
<input class="createAcctOnly" id="lastNameField" type="text" name="lastName"><br>
<label class="createAcctOnly" for="emailField">Email</label><br>
<input class="createAcctOnly" id="emailField" type="text" name="email"><br>
<label class="createAcctOnly" for="schoolCodeField">School Code (Optional)</label><br>
<input class="createAcctOnly" id="schoolCodeField" type="text" name="schoolCode"><br>
<p id="loginInvalidMessage">&nbsp;</p>
<p id="submitLogin" class="barMenu">Submit</p>
</form>
</div>

<div id = 'osList'>
<form id = pickOSRadios>
<label for="winR">Microsoft Windows (.exe)</label>
<input id="winR" type="radio" name="os" value="win"><br>
<label for="macR">Mac OS X (.app)</label>
<input id="macR" type="radio" name="os" value="mac"><br>
<label for="linuxtarR">Debian/Ubuntu Linux (.tar.gz) </label>
<input id="linuxtarR" type="radio" name="os" value="tar"><br>
<label for="linuxrpmR">Red Hat/Fedora Linux (.rpm) </label>
<input id="linuxrpmR" type="radio" name="os" value="rpm"><br>
</form>
</div>
</div>
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Empty file added paintbrush/index.html
Empty file.
238 changes: 238 additions & 0 deletions paintbrush/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
let loginState = 0;
let loginBlock;
let init = true;
$(document).ready(function () {

let displayingOSList = false;

loginBlock = $("#loginBlock");
loginBlock.css("display", "none");
$("#login").click(function () {
setInvalidMsg("");
if (loginState === 1) {
$("#login").css("font-style", "normal");
loginState = 0;
loginBlock.css("display", "none");
} else {
if (displayingOSList) {
$("#downloadArrow").click();
}
loginBlock.css("display", "");
$("#login").css("font-style", "italic");
$("#createAcct").css("font-style", "normal");
loginState = 1;
$(".createAcctOnly").css("display", "none");
loginBlock.css("height", "12em");
$("#loginInvalidMessage").css("margin-top", "-9.5em");
}
});
$("#createAcct").click(function () {
setInvalidMsg("");
if (loginState === 2) {
$("#createAcct").css("font-style", "normal");
loginState = 0;
loginBlock.css("display", "none");
} else {
if (displayingOSList) {
$("#downloadArrow").click();
}
loginBlock.css("display", "");
$("#login").css("font-style", "normal");
$("#createAcct").css("font-style", "italic");
$(".createAcctOnly").css("display", "");
loginState = 2;
loginBlock.css("height", "");
$("#loginInvalidMessage").css("margin-top", "");
}
});

$(".barMenu:not(.loginButton):not(#submitLogin)").click(function () {
const me = $(this);
$( "#scrollBar" ).animate({
left: me.offset().left,
width: me.width()
}, 400, function() {
// Animation complete.
});
});

$("#submitLogin").click(function () {
flashBar(50);
$("#login").css("font-style", "normal");
$("#createAcct").css("font-style", "normal");
$("#loginInvalidMessage").css("color", "transparent");
loginBlock.css("display", "none");
if (loginState === 1) {
loginState = 0;
let inv = login();
if (inv.length > 0) {
$("#titleBarBorder").stop(true);
loginBlock.css("display", "");
$("#login").css("font-style", "italic");
$("#createAcct").css("font-style", "normal");
loginState = 1;
$(".createAcctOnly").css("display", "none");
loginBlock.css("height", "12em");
$("#loginInvalidMessage").css("margin-top", "-9.5em");
setInvalidMsg(inv);
$("#loginInvalidMessage").css("color", "white");
}
} else if (loginState === 2) {
loginState = 0;
let inv = createAccount();
if (inv != null) {
$("#titleBarBorder").stop(true);
loginBlock.css("display", "");
$("#login").css("font-style", "normal");
$("#createAcct").css("font-style", "italic");
$(".createAcctOnly").css("display", "");
loginState = 2;
$("#loginInvalidMessage").css("margin-top", "");
setInvalidMsg(inv);
$("#loginInvalidMessage").css("color", "white");
loginBlock.css("height", "");
}
}
});

$(".roundedDL:not(#downloadArrow)").hover(function () {
$("#downloadText").css("text-decoration", "underline");
}, function () {
$("#downloadText").css("text-decoration", "none");
});


$("#downloadArrow").click(function () {
if (loginState === 1) {
$("#login").click();
} else if (loginState === 2) {
$("#createAcct").click();
}
if (displayingOSList) {
$('#osList').css("display", "none");
} else {
$('#osList').css("display", "");
}
displayingOSList = !displayingOSList;
});

$('#osList').css("display", "none");

//initialize OS radios
let system = getOS();
switch (system) {
case "Windows":
$("#winR").click();
break;
case "Mac OS":
$("#macR").click();
break;
case "Linux":
$("#linuxtarR").click();
break;
case "Android":
break;
case "iOS":
break;
default:
break;
}

$("#downloadButton").click(function () {
let addr;
let platform = $('input[name=os]:checked', '#pickOSRadios').val();
console.log(platform);
switch (platform) {
case "win": window.open("./exedummy.exe"); break;
case "mac": window.open("./appdummy.app"); break;
case "tar": window.open("./tardummy.tar.gz"); break;
case "rpm": window.open("./rpmdummy.rpm"); break;
}
});

let url = new URL(window.location);
let scroll = url.searchParams.get("scroll");
if (scroll !== undefined && scroll !== null)
$("#barMenus").children().eq(scroll).click();

init = false;
});

function setInvalidMsg(s) {
if (s.length === 0) {
$("#loginInvalidMessage").css("color", "transparent");
$("#loginInvalidMessage").text("&nbsp;");
} else {
$("#loginInvalidMessage").css("color", "white");
$("#loginInvalidMessage").text(s);
}
}


function createAccount() {
let username = $("#usernameField").val(),
password = $("#passwordField").val(),
firstName= $("#firstNameField").val(),
lastName = $("#lastNameField").val(),
email = $("#emailField").val(),
schoolCode = $("#schoolCodeField").val();

//check for emptiness
if (username.length === 0)
return "Please enter a username.";
if (password.length === 0)
return "Please enter a password.";
if (firstName.length === 0)
return "Please enter your first name.";
if (lastName.length === 0)
return "Please enter your last name.";
if (email.length === 0)
return "Please enter an email address..";

//magic here
return null;
}

function login() {
let username = $("#usernameField").text(),
password = $("#passwordField").text();

return "Invalid username or password"
}

function flashBar(count) {
console.log("hello!");
if (count === 0) {
$("#scrollBar").css("display", "");
return;
}
$("#scrollBar").css("display", "none");
$("#titleBarBorder").animate({backgroundColor: "#aa55aa"}, 100, function () {
$("#titleBarBorder").animate({backgroundColor: "#663366"}, 100, function () {
flashBar(count - 1);
});
});
}

function getOS() {
var userAgent = window.navigator.userAgent,
platform = window.navigator.platform,
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'],
iosPlatforms = ['iPhone', 'iPad', 'iPod'],
os = null;

if (macosPlatforms.indexOf(platform) !== -1) {
os = 'Mac OS';
} else if (iosPlatforms.indexOf(platform) !== -1) {
os = 'iOS';
} else if (windowsPlatforms.indexOf(platform) !== -1) {
os = 'Windows';
} else if (/Android/.test(userAgent)) {
os = 'Android';
} else if (!os && /Linux/.test(platform)) {
os = 'Linux';
}

return os;
}
Loading

0 comments on commit 0642852

Please sign in to comment.