finished integration with islambosna backend

This commit is contained in:
Senad Uka
2013-12-08 07:00:30 +01:00
parent 6d7129d70b
commit 60e86f6cfb
4 changed files with 45 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
# [Flip.io Puzzle Game](http://flip.io)
# [IslamBosna.ba Rijeci](http://www.islambosna.ba/rijeci/)
An HTML5 puzzle app, and puzzle file generator. MIT licensed. Code is running at http://flip.io
An HTML5 puzzle app, and puzzle file generator. MIT licensed. Code is running at http://www.islambosna.ba/rijeci/
Here's a quick rundown of the files:

28
app.js
View File

@@ -4,7 +4,17 @@ var App = {};
App.init = function(){
App.name = 'Flip.io';
App.rijeci_serivce_url = "http://localhost:3000/"
App.forum_service_url = "http://www.islambosna.ba/forum/"
// get the username from islambosna forum
$.get(App.forum_service_url + "rijeci_get_user.php",
function (data) {
App.username = data;
});
App.name = 'IslamBosna Riječi';
$('.title').text(App.name);
App.touch = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
@@ -136,6 +146,7 @@ App.Router = Backbone.Router.extend({
$('.content').html(App.puzzleView.$el);
App.router.currentView = App.puzzleView;
App.puzzleNumber = puzNum;
$('.content').fadeIn();
@@ -277,7 +288,7 @@ App.PuzzleView = Backbone.View.extend({
events = {
'click .shuffle' : 'doShuffle',
'click .sort' : 'doSort',
'click .hint' : 'doHint',
'click .hint' : 'doWin',
'click .square' : 'doSquare',
'click .reset': 'doReset',
'click .restart': 'doRestart',
@@ -476,6 +487,13 @@ App.PuzzleView = Backbone.View.extend({
$(this).fadeIn();
});
var definition = $clue.find('.def').text();
var guess = $.param({ username: App.username , definition: definition });
alert(guess);
$.post(App.rijeci_serivce_url + "guesses.json", guess , function (data) {
} );
$('.square').each(function(index){
$(this).data('guessed','');
});
@@ -506,6 +524,12 @@ App.PuzzleView = Backbone.View.extend({
App.play('sweep');
var solution = $.param({ username: App.username , number: App.puzzleNumber, time: $('.timer').text() });
$.post(App.rijeci_serivce_url + "solutions.json", solution , function (data) {
alert(data);
} );
setTimeout(function() {
$('.squares table').fadeOut();

View File

@@ -24,26 +24,30 @@
<div class="main">
<div class="topnav">
<h1 class="title"></h1>
<h1 class="titlenum"></h1>
</div>
<div class="content">
<iframe id="hiddeniframe" style="visibility: hidden" src="http://www.islambosna.ba/forum/rijeci_get_user.php"></iframe>
</div>
<div class="footer">
Developed by <a href="http://www.russellbeattie.com">Russell Beattie</a>
<a href="http://www.islambosna.ba"><img src="http://www.islambosna.ba/wp-content/uploads/2013/06/logotip_noba_520t.png" /></a>
Developed by <a href="http://www.russellbeattie.com">Russell Beattie</a>, modified by Ahmed Islamovic.
</div>
</div>
<script type="text/template" class="homeTemplate">
<h3>
999 word puzzles.
Dobrodošao <%=App.username%> u 999 islamskih zagonetki.
</h3>
<div class="puzhome">
<form class="puz-form">
Enter a Number: <br>
<input pattern="[0-9]*" name="puznum" class="puznum" value="<%=App.puzzleView.puzNum ? App.puzzleView.puzNum : ''%>">
<button class="go-btn btn">Go</button> <button class="random-btn btn">Random</button>
<button class="go-btn btn">Idi</button> <button class="random-btn btn">Slučajni izbor</button>
</form>
@@ -89,7 +93,7 @@
var clue = clues[i]
%>
<li data-answer="<%=clue['word']%>" title="<%=rot13(clue['word'])%>">
<span class="word"><%=clue['word'].length%> letters</span>:
<span class="word"><%=clue['word'].length%> slova</span>:
<span class="def"><%=clue['def']%></span>
</li>
<%
@@ -99,11 +103,11 @@
</div>
<div class="nav">
<span class="gohome">Home</span>
<span class="restart">Restart</span>
<span class="hint">Hint</span>
<span class="sort">Sort</span>
<span class="shuffle">Shuffle</span>
<span class="gohome">Početna</span>
<span class="restart">Ponovi</span>
<span class="hint">Pomoć</span>
<span class="sort">Sortiraj</span>
<span class="shuffle">Izmješaj</span>
</div>
<div class="squares">
@@ -144,13 +148,13 @@
<%
var params = {
url: document.location.href,
text: 'I solved this Flip.io puzzle in ' + formatTime(App.puzzleView.secs) + ' minutes! ' + document.location.href
text: 'Riješio sam ovu IslamBosna.ba zagonetku za ' + formatTime(App.puzzleView.secs) + ' minuta! ' + document.location.href
}
paramString = $.param(params);
%>
<span><a class="share" target="_blank" href="https://twitter.com/share?url=<%=paramString%>"><i></i> Share on Twitter</a></span>
<span><a class="share" target="_blank" href="https://twitter.com/share?url=<%=paramString%>"><i></i> Podijeli na twitteru</a></span>
</div>
</div>
@@ -166,6 +170,6 @@ $(function () {
App.init();
});
</script>
<a class="forkme" href="https://github.com/russellbeattie/flip"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<a class="forkme" href="https://github.com/senaduka/flip"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
</body>
</html>

View File

@@ -27,7 +27,6 @@ to be used by batch.js puzzle generator.
# batch.js instructions
After creating a words.txt dictionary, run:
$ node batch.js