Skip to content

Commit aa1f870

Browse files
authored
Merge pull request #12 from mamamia5x/update
Update to V.0.2.0
2 parents ecffe72 + a73cfa1 commit aa1f870

File tree

9 files changed

+1323
-62
lines changed

9 files changed

+1323
-62
lines changed

index.html

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,38 @@
55
<meta name="viewport" content="width=device-width">
66
<title>HTML5 Compiler</title>
77
<link rel="shortcut icon" href="img/favicon.png" />
8+
<link href="styles/fontawesome.css" rel="stylesheet" type="text/css" />
89
<link href="styles/style.css" rel="stylesheet" type="text/css" />
10+
<link href="styles/sidebar.css" rel="stylesheet" type="text/css" />
911
</head>
10-
<!-- 24292e -->
11-
<div id="loading" class="shown"><img id="loadingImg" src='img/loading.gif'></div>
12-
<div id='toload' class="hidden">
13-
<div style="color: white" id="topbar">
14-
<button onclick="run ()" class='runbutton'>Run</button>
15-
</div>
16-
<div id="program"></div>
17-
<div id="separator"></div>
18-
<div id="topspace"></div>
19-
<div id="editor"></div>
20-
</div>
2112
<body>
13+
<div id="loading" class="shown"><img id="loadingImg" src='img/loading.gif'></div>
14+
<div id='toload' class="hidden">
15+
<i onclick="sidebar()" class="fa fa-bars options mouse"></i>
16+
<i onclick='addfile()' id="addButton" class="hidden fa fa-plus options mouse"></i>
17+
<div style="color: white" id="topbar">
18+
<div class='topmargin'>
19+
<!-- Unused for now -->
20+
</div>
21+
<button onclick="run ()" class='runbutton'>Run</button>
22+
23+
<!-- Side bar tools, from another project -->
24+
<div id="maker" class="hidden">
25+
<div id="tools" class="sidenav left">
26+
<br>
27+
<button onclick="loadfile(this.innerText)" class="mouse select">index.html</button>
28+
<!-- The first file is index.html -->
29+
<div id="afterFirst">
30+
</div>
31+
</div>
32+
</div>
33+
<!-- End Side Bar -->
34+
</div>
35+
<iframe frameBorder="0" id="program"></iframe>
36+
<div id="separator"></div>
37+
<div id="topspace"></div>
38+
<div id="editor"></div>
39+
</div>
2240
<script data-main="scripts/startup" src="scripts/require.js"></script>
2341
</body>
2442
</html>

readme.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ The one thing I've always wanted to make was a compiler. I first tried with PHP,
33

44
My goal is to make it web based, but also work if you download it. The old one worked online, but the site would write it to the same global file.
55

6+
The Beta site, which is where I test new features, can be found [here](https://HTML-JS-CSS-Compiler.mamamia5x.repl.co).
7+
8+
The lastest relase, which you can use to download and run the project offline, can be found [here](https://github.com/mamamia5x/HTML5-Compiler/releases).
9+
610
## Version History
11+
#### V.0.2.0
12+
* Changed way compiler writes files.
13+
* instead of it just putting the contents into a div, it now writes to a file and puts it into an iframe.
14+
* Ability to create multiple files.
15+
* Biggest update. It went through so many changes before it got to this point.
716
#### V.0.1.0
8-
* Initial Release
17+
* Initial Release

scripts/files.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
var currentfile = 'index.html';
2+
3+
function addfile(){
4+
var filename = prompt("What is the filename?", "index.js");
5+
currentfile = filename;
6+
localStorage.setItem('currentFileName', currentfile);
7+
var setmode = get_url_extension(filename);
8+
var newFile = document.createElement('div');
9+
newFile.innerHTML = '<button onclick="loadfile(this.innerText)" class="mouse select">' + currentfile + '</button>';
10+
document.getElementById('afterFirst').appendChild(newFile);
11+
var filecontent = localStorage.getItem(filename);
12+
if (filecontent === null){
13+
filecontent = 'Type Something';
14+
}
15+
if (setmode == 'js'){
16+
setmode = 'javascript';
17+
}
18+
editor.session.setMode("ace/mode/" + setmode);
19+
editor.setValue(filecontent);
20+
document.getElementById("maker").classList.toggle("hidden");
21+
document.getElementById("addButton").classList.toggle("hidden");
22+
}
23+
24+
function loadfile(filename){
25+
currentfile = filename;
26+
editor.setValue(localStorage.getItem(filename));
27+
document.getElementById("maker").classList.toggle("hidden");
28+
document.getElementById("addButton").classList.toggle("hidden");
29+
}
30+
31+
function get_url_extension( url ) {
32+
return url.split(/[#?]/)[0].split('.').pop().trim();
33+
}
34+
35+
// Sidebar
36+
function sidebar(){
37+
//Some is from an old project
38+
document.getElementById("maker").classList.toggle("hidden");
39+
document.getElementById("addButton").classList.toggle("hidden");
40+
}

0 commit comments

Comments
 (0)