diff --git a/static/script.js b/static/script.js index 4ec5e25..a25b298 100644 --- a/static/script.js +++ b/static/script.js @@ -1,24 +1,112 @@ -/** - * Copyright 2018, Google LLC - * Licensed under the Apache License, Version 2.0 (the `License`); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an `AS IS` BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +var Typer={ + text: null, + accessCountimer:null, + index:0, + speed:2, + file:"", + accessCount:0, + deniedCount:0, + init: function(){ + accessCountimer=setInterval(function(){Typer.updLstChr();},500); + $.get(Typer.file,function(data){ + Typer.text=data; + Typer.text = Typer.text.slice(0, Typer.text.length-1); + }); + }, -// [START gae_python37_log] -'use strict'; + content:function(){ + return $("#console").html(); + }, + + write:function(str){ + $("#console").append(str); + return false; + }, + + addText:function(key){ + + if(key.keyCode==18){ + Typer.accessCount++; + + if(Typer.accessCount>=3){ + Typer.makeAccess(); + } + } + + else if(key.keyCode==20){ + Typer.deniedCount++; + + if(Typer.deniedCount>=3){ + Typer.makeDenied(); + } + } + + else if(key.keyCode==27){ + Typer.hidepop(); + } + + else if(Typer.text){ + var cont=Typer.content(); + if(cont.substring(cont.length-1,cont.length)=="|") + $("#console").html($("#console").html().substring(0,cont.length-1)); + if(key.keyCode!=8){ + Typer.index+=Typer.speed; + } + else { + if(Typer.index>0) + Typer.index-=Typer.speed; + } + var text=Typer.text.substring(0,Typer.index) + var rtn= new RegExp("\n", "g"); + + $("#console").html(text.replace(rtn,"
")); + window.scrollBy(0,50); + } + + if (key.preventDefault && key.keyCode != 122) { + key.preventDefault() + }; + + if(key.keyCode != 122){ // otherway prevent keys default behavior + key.returnValue = false; + } + }, + + updLstChr:function(){ + var cont=this.content(); + + if(cont.substring(cont.length-1,cont.length)=="|") + $("#console").html($("#console").html().substring(0,cont.length-1)); + + else + this.write("|"); // else write it + } +} + +function replaceUrls(text) { + var http = text.indexOf("http://"); + var space = text.indexOf(".me ", http); + + if (space != -1) { + var url = text.slice(http, space-1); + return text.replace(url, "" + url + ""); + } + + else { + return text + } +} -window.addEventListener('load', function () { - - console.log("Hello World!"); - -}); -// [END gae_python37_log] +Typer.speed=1; +Typer.file="static/dungeondream.txt"; +Typer.init(); + +var timer = setInterval("t();", 30); +function t() { + Typer.addText({"keyCode": 123748}); + + if (Typer.index > Typer.text.length) { + clearInterval(timer); + } +} + diff --git a/static/script2.js b/static/script2.js new file mode 100644 index 0000000..d998c97 --- /dev/null +++ b/static/script2.js @@ -0,0 +1,143 @@ + +
+ diff --git a/static/style.css b/static/style.css index 8401745..3501ede 100644 --- a/static/style.css +++ b/static/style.css @@ -1,4 +1,44 @@ body { - font-family: "helvetica", sans-serif; - text-align: center; + background-color: #000 +} + +#console { + font-family: courier, monospace; + color: #fff; + width:750px; + margin-left:auto; + margin-right:auto; + margin-top:100px; + font-size:14px; +} + +a { + color: #0bc; + text-decoration: none; +} + +#a { + color: #0f0; +} + +#c { + color: #0bc; +} + +#b { + color: #ff0096; +} + +#k { + animation: change 1s; +} + +#op{ + color: #888888 +} + +@keyframes change { + 0% { color: #0f0; } + 50% { color: #0f0; } + 99% { color: black; } } diff --git a/templates/index.html b/templates/index.html index a71af33..b80cb17 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,199 +1,15 @@ - - - -Dungeon Dream - - - - - -
- - - + + + Dungeon + + + + + +
+ + +