Skip to content

Commit

Permalink
new machine, added download OS option
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Feb 23, 2019
1 parent ac19d63 commit e450e1a
Show file tree
Hide file tree
Showing 17 changed files with 774 additions and 258 deletions.
4 changes: 4 additions & 0 deletions .idea/paintbrush.org.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/sqldialects.xml

This file was deleted.

352 changes: 118 additions & 234 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file added Comfortaa-Regular.ttf
Binary file not shown.
Empty file added appdummy.app
Empty file.
Empty file added exedummy.exe
Empty file.
23 changes: 22 additions & 1 deletion index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@font-face {font-family: Comfortaa;src:url(./Comfortaa-Regular.ttf);}

body {
margin-bottom: -.05em;
}
Expand Down Expand Up @@ -154,4 +156,23 @@ body {

.italic {
font-style: italic;
}
}

#osList {
background:black;
padding: 1em;
width: 18em;
float: right;
border-radius: 0 0 0 1em;

}

#osList input {
float: right;
}

#osList label {
color: white;
font-family: sans-serif;
}

115 changes: 104 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
let loginState = 0;
let loginBlock;
let init = true;
$(document).ready(function () {

let displayingOSList = false;

loginBlock = $("#loginBlock");
loginBlock.css("display", "none");
$("#login").click(function () {
Expand All @@ -10,6 +14,9 @@ $(document).ready(function () {
loginState = 0;
loginBlock.css("display", "none");
} else {
if (displayingOSList) {
$("#downloadArrow").click();
}
loginBlock.css("display", "");
$("#login").css("font-style", "italic");
$("#createAcct").css("font-style", "normal");
Expand All @@ -26,6 +33,9 @@ $(document).ready(function () {
loginState = 0;
loginBlock.css("display", "none");
} else {
if (displayingOSList) {
$("#downloadArrow").click();
}
loginBlock.css("display", "");
$("#login").css("font-style", "normal");
$("#createAcct").css("font-style", "italic");
Expand All @@ -35,11 +45,6 @@ $(document).ready(function () {
$("#loginInvalidMessage").css("margin-top", "");
}
});
$(".roundedDL").hover(function () {
$("#downloadText").css("text-decoration", "underline");
}, function () {
$("#downloadText").css("text-decoration", "none");
});

$(".barMenu:not(.loginButton):not(#submitLogin)").click(function () {
const me = $(this);
Expand Down Expand Up @@ -75,7 +80,7 @@ $(document).ready(function () {
} else if (loginState === 2) {
loginState = 0;
let inv = createAccount();
if (inv.length > 0) {
if (inv != null) {
$("#titleBarBorder").stop(true);
loginBlock.css("display", "");
$("#login").css("font-style", "normal");
Expand All @@ -89,6 +94,68 @@ $(document).ready(function () {
}
}
});

$(".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) {
Expand All @@ -112,16 +179,18 @@ function createAccount() {

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

//magic here
return null;
}

function login() {
Expand All @@ -132,6 +201,7 @@ function login() {
}

function flashBar(count) {
console.log("hello!");
if (count === 0) {
$("#scrollBar").css("display", "");
return;
Expand All @@ -142,4 +212,27 @@ function flashBar(count) {
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;
}
27 changes: 21 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
?>

<html>
<head>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>The Paintbrush Project</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>
<script type="text/javascript" src="index.js"></script>
</head>
<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>
<script type="text/javascript" src="index.js"></script>
</head>
<body>
<div id="titleBarWrapper">
<div id="titleBar" class="asRow">
Expand Down Expand Up @@ -58,6 +60,19 @@
<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>
Empty file added rpmdummy.rpm
Empty file.
Binary file added server/Comfortaa-Regular.ttf
Binary file not shown.
Binary file added server/background.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e450e1a

Please sign in to comment.