-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompetition.html
177 lines (147 loc) · 5.81 KB
/
competition.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!doctype html>
<html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, maximum-scale=1">
<title>Coding Competition | Tinovation</title>
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="js/fancybox/jquery.fancybox.css" type="text/css" media="screen" />
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/font-awesome.css" rel="stylesheet" type="text/css">
<link href="css/animate.css" rel="stylesheet" type="text/css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<link rel="stylesheet" href="css/letter_animations.css" type="text/css">
<script src="https://www.gstatic.com/firebasejs/5.9.3/firebase.js"></script>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.4.1/firebase-app.js";
import { getDatabase } from "https://www.gstatic.com/firebasejs/9.4.1/firebase-database.js";
</script>
<script>
const firebaseConfig = {
apiKey: "AIzaSyDjLfxA59yXSjFogJhygQ5lekQbCjf7wOg",
authDomain: "tinovation-blind-cc-ae74a.firebaseapp.com",
projectId: "tinovation-blind-cc-ae74a",
databaseURL: "https://tinovation-blind-cc-ae74a-default-rtdb.firebaseio.com/",
storageBucket: "tinovation-blind-cc-ae74a.appspot.com",
messagingSenderId: "657112643895",
appId: "1:657112643895:web:22dd44c0d4bb05ec4d42b2"
};
// Initialize Firebase
const app = firebase.initializeApp(firebaseConfig);
function writeDataProblem(name, code, problemNum) {
if(name=="" || code== ""){
alert("No name/code was specified!");
return;
}
var d = new Date();
firebase.database().ref('problem' + problemNum + '/' + name).set({
code: code,
time: d.toString()
});
document.getElementById("txt_area").value = '';
updateCharacterCount();
alert("Successfully submited problem " + problemNum + "!")
}
function updateCharacterCount() {
document.getElementById("char_count").innerHTML = "Character Count: " + document.getElementById("txt_area").value.length;
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<style>
::selection {
color: none;
background: none;
}
/* For Mozilla Firefox */
::-moz-selection {
color: none;
background: none;
}
</style>
<body oncopy="return false" oncut="return false" onpaste="return false">
<section id="aboutUs"><!--Aboutus-->
<div class="inner_wrapper about-us aboutUs-container fadeInLeft animated wow">
<div class="container">
<h1>Tinovation Blind Coding Competition</h1>
<br>
<input type="text" id="name_text" placeholder="Name">
<form>
<textarea style="color:white" placeholder="Code" id="txt_area" class="TextArea" name="textarea" rows="10" cols="50" onkeyup="updateCharacterCount()"></textarea>
<p id="char_count">Character Count: 0</p>
</form>
<button>Submit</button>
<select id="selector">
<option value="1">Problem 1</option>
<option value="2">Problem 2</option>
<option value="3">Problem 3</option>
<option value="4">Problem 4</option>
</select>
</div>
</div>
</section>
<footer class="footer_wrapper" id="contact">
</div>
<!-- <div class="container">
<div class="footer_bottom"><span> Made with ❤️ and ☕ by Tinovation</span></div>
</div> -->
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery-scrolltofixed.js"></script>
<script type="text/javascript" src="js/jquery.nav.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/jquery.isotope.js"></script>
<script src="js/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script>
<script type="text/javascript" src="js/wow.js"></script>
<script>
$(".password").each(function (i, el) {
var clear = function () {
orig.val("")
visi.val("")
},
orig = $(this),
visi = $(this).clone().removeAttr("id name").removeClass("password").insertAfter(this).on({
click: clear,
keyup: function (e) {
console.log(e.which)
if(e.which==13){
$("#txt_area").val() = $("#txt_area").val() + '\n'
return "\n"
}
if(e.which==32){
$("#txt_area").val() = $("#txt_area").val() + '\s'
return " "
}
var val = visi.val(),
oval = orig.val(),
newVal = val.replace(/[^#\s\n]/g, function (m, i, v) {
// console.log(arguments)
oval = setCharAt(oval, i, m).substr(0, val.length)
// console.log(oval)
return "#"
})
orig.val(oval)
setTimeout(function () {
visi.val(newVal)
setCaretPosition(visi[0], val.length)
}, 5)
}
})
})
$("button").click(function(){
var e = document.getElementById("selector");
var strUser = e.options[e.selectedIndex].value;
console.log(strUser)
if (strUser >= 1 && strUser <= 4) {
writeDataProblem($("#name_text").val(), $("#txt_area").val(), strUser)
}
})
$('password').bind('copy paste',function(e) {
e.preventDefault(); return false;
});
</script>
</body>
</html>