mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-28 02:00:04 +00:00
Lots of stuff
This commit is contained in:
49
client/templates/index.jade
Normal file
49
client/templates/index.jade
Normal file
@@ -0,0 +1,49 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
#main-section.clearfix
|
||||
#chat-section.window.chat_window.hidden
|
||||
.chat
|
||||
.main_buttons
|
||||
.section
|
||||
.button.big.find_battle
|
||||
span.find-icon.icon-earth
|
||||
| Find battle
|
||||
.find_battle_select_team
|
||||
.section
|
||||
.button.teambuilder_button
|
||||
span.icon-pencil
|
||||
| Teambuilder
|
||||
.section
|
||||
.button.display_credits Credits
|
||||
#teambuilder-section.window.hidden
|
||||
#battle-list-section.window.hidden
|
||||
#messages.z2
|
||||
|
||||
block footer
|
||||
.loading-container
|
||||
.loading-message Loading...
|
||||
script(src=asset_path('js/data.js'))
|
||||
script(src=asset_path('js/vendor.js'))
|
||||
script(src=asset_path('js/templates.js'))
|
||||
script(src=asset_path('js/app.js'))
|
||||
script.
|
||||
// Autogenerated client version
|
||||
PokeBattle.CLIENT_VERSION = "#{CLIENT_VERSION}";
|
||||
// quicker click response on mobile devices
|
||||
$(document).ready(function() {
|
||||
FastClick.attach(document.body);
|
||||
});
|
||||
|
||||
//- Authentication
|
||||
(function() {
|
||||
var TOKEN = "#{user.token}";
|
||||
var ID = #{user.id};
|
||||
var USERNAME = "#{user.name}"
|
||||
|
||||
PokeBattle.userId = ID;
|
||||
PokeBattle.username = USERNAME;
|
||||
PokeBattle.primus.on('open', function() {
|
||||
PokeBattle.primus.send('login', ID, TOKEN);
|
||||
});
|
||||
}).call(this);
|
||||
31
client/templates/layout.jade
Normal file
31
client/templates/layout.jade
Normal file
@@ -0,0 +1,31 @@
|
||||
!!!
|
||||
html
|
||||
head
|
||||
meta(http-equiv="X-UA-Compatible", content="IE=Edge")
|
||||
meta(name="viewport", content="width=device-width, initial-scale=1.0, user-scalable=0")
|
||||
title PokeBattle
|
||||
link(rel="icon", type="image/png", href="//media.pokebattle.com/img/favicon.png")
|
||||
link(rel="stylesheet", href=asset_path("css/vendor.css"))
|
||||
link(rel="stylesheet", href=asset_path("css/main.css"))
|
||||
body(class = bodyClass)
|
||||
#navigation
|
||||
#content
|
||||
#header
|
||||
#main-nav
|
||||
#leftmenu.left
|
||||
a(href="#").show-navigation
|
||||
span.icon.icon-menu
|
||||
#logo
|
||||
img(id="logoimg", src="../Sprites/logo.png", height="120px", alt="pokebattle.com")
|
||||
nav#sections
|
||||
ul
|
||||
li
|
||||
a(href="../") Simulator
|
||||
li
|
||||
a(href="//91.121.152.74/", target="_blank") Forums
|
||||
li
|
||||
a(href="../leaderboard", target="_blank") Leaderboard
|
||||
#sub-nav
|
||||
block content
|
||||
block footer
|
||||
script.
|
||||
58
client/templates/leaderboard.jade
Normal file
58
client/templates/leaderboard.jade
Normal file
@@ -0,0 +1,58 @@
|
||||
style
|
||||
body {
|
||||
font-family: Verdana;
|
||||
font-size: 13px;
|
||||
background: #eee;
|
||||
}
|
||||
td {
|
||||
padding: 10px;
|
||||
}
|
||||
tr {
|
||||
background-color: #d3d3d3;
|
||||
}
|
||||
table {
|
||||
border: 2px solid gray;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border-collapse: collapse;
|
||||
border-style: hidden;
|
||||
box-shadow: 0 0 0 1px #666;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #c3c3c3;
|
||||
}
|
||||
th{
|
||||
width: 200px;
|
||||
border-bottom: 1px solid gray;
|
||||
}
|
||||
table tr:first-child th:first-child,
|
||||
table.Info tr:first-child td:first-child {
|
||||
border-top-left-radius: 10px;
|
||||
}
|
||||
table tr:first-child th:last-child,
|
||||
table.Info tr:first-child td:last-child {
|
||||
border-top-right-radius: 10px;
|
||||
}
|
||||
|
||||
table tr:last-child td:first-child {
|
||||
border-bottom-left-radius: 10px;
|
||||
}
|
||||
|
||||
table tr:last-child td:last-child {
|
||||
border-bottom-right-radius: 10px;
|
||||
}
|
||||
div
|
||||
table
|
||||
thead
|
||||
tr
|
||||
th Rank
|
||||
th Player
|
||||
th Score
|
||||
tbody
|
||||
each member, i in players
|
||||
tr
|
||||
td #{i + 1}
|
||||
td #{member.username}
|
||||
td #{member.score}
|
||||
1
client/templates/modify.jade
Normal file
1
client/templates/modify.jade
Normal file
@@ -0,0 +1 @@
|
||||
a(href="../modify/formes") Change Pokemon Data
|
||||
138
client/templates/modify/formes.html
Normal file
138
client/templates/modify/formes.html
Normal file
@@ -0,0 +1,138 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Advanced JSON Editor Example</title>
|
||||
|
||||
<script src="https://raw.githubusercontent.com/jdorn/json-editor/master/dist/jsoneditor.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Advanced JSON Editor Example</h1>
|
||||
|
||||
<p>This example demonstrates the following:</p>
|
||||
<ul>
|
||||
<li>Loading external schemas via ajax (using $ref)</li>
|
||||
<li>Setting the editor's value from javascript (try the Restore to Default button)</li>
|
||||
<li>Validating the editor's contents (try setting name to an empty string)</li>
|
||||
<li>Macro templates (try changing the city or state fields and watch the citystate field update automatically)</li>
|
||||
<li>Enabling and disabling editor fields</li>
|
||||
</ul>
|
||||
|
||||
<button id='submit'>Submit (console.log)</button>
|
||||
<button id='restore'>Restore to Default</button>
|
||||
<button id='enable_disable'>Disable/Enable Form</button>
|
||||
<span id='valid_indicator'></span>
|
||||
|
||||
<div id='editor_holder'></div>
|
||||
|
||||
<script>
|
||||
// This is the starting value for the editor
|
||||
// We will use this to seed the initial editor
|
||||
// and to provide a "Restore to Default" button.
|
||||
var starting_value = [
|
||||
{
|
||||
name: "John Smith",
|
||||
age: 35,
|
||||
gender: "male",
|
||||
location: {
|
||||
city: "San Francisco",
|
||||
state: "California",
|
||||
citystate: ""
|
||||
},
|
||||
pets: [
|
||||
{
|
||||
name: "Spot",
|
||||
type: "dog",
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
name: "Whiskers",
|
||||
type: "cat",
|
||||
fixed: false
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
// Initialize the editor
|
||||
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
||||
// Enable fetching schemas via ajax
|
||||
ajax: true,
|
||||
|
||||
// The schema for the editor
|
||||
schema: {
|
||||
type: "array",
|
||||
title: "People",
|
||||
format: "tabs",
|
||||
items: {
|
||||
title: "Person",
|
||||
headerTemplate: "{{i}} - {{self.name}}",
|
||||
oneOf: [
|
||||
{
|
||||
$ref: "basic_person.json",
|
||||
title: "Basic Person"
|
||||
},
|
||||
{
|
||||
$ref: "person.json",
|
||||
title: "Complex Person"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// Seed the form with a starting value
|
||||
startval: starting_value,
|
||||
|
||||
// Disable additional properties
|
||||
no_additional_properties: true,
|
||||
|
||||
// Require all properties by default
|
||||
required_by_default: true
|
||||
});
|
||||
|
||||
// Hook up the submit button to log to the console
|
||||
document.getElementById('submit').addEventListener('click',function() {
|
||||
// Get the value from the editor
|
||||
console.log(editor.getValue());
|
||||
});
|
||||
|
||||
// Hook up the Restore to Default button
|
||||
document.getElementById('restore').addEventListener('click',function() {
|
||||
editor.setValue(starting_value);
|
||||
});
|
||||
|
||||
// Hook up the enable/disable button
|
||||
document.getElementById('enable_disable').addEventListener('click',function() {
|
||||
// Enable form
|
||||
if(!editor.isEnabled()) {
|
||||
editor.enable();
|
||||
}
|
||||
// Disable form
|
||||
else {
|
||||
editor.disable();
|
||||
}
|
||||
});
|
||||
|
||||
// Hook up the validation indicator to update its
|
||||
// status whenever the editor changes
|
||||
editor.on('change',function() {
|
||||
// Get an array of errors from the validator
|
||||
var errors = editor.validate();
|
||||
|
||||
var indicator = document.getElementById('valid_indicator');
|
||||
|
||||
// Not valid
|
||||
if(errors.length) {
|
||||
indicator.style.color = 'red';
|
||||
indicator.textContent = "not valid";
|
||||
}
|
||||
// Valid
|
||||
else {
|
||||
indicator.style.color = 'green';
|
||||
indicator.textContent = "valid";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
17
client/templates/modify/formes.jade
Normal file
17
client/templates/modify/formes.jade
Normal file
@@ -0,0 +1,17 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
title Advanced JSON Editor Example
|
||||
|
||||
body
|
||||
script(src="../js/jsoneditor.js")
|
||||
button#submit Submit (console.log)
|
||||
button#restore Restore to Default
|
||||
button#enable_disable Disable/Enable Form
|
||||
span#valid_indicator
|
||||
#editor_holder
|
||||
script(type='text/javascript').
|
||||
var pokedata = !{JSON.stringify(data)};
|
||||
script(src="../js/modify.js").
|
||||
|
||||
15
client/templates/replays/index.jade
Normal file
15
client/templates/replays/index.jade
Normal file
@@ -0,0 +1,15 @@
|
||||
extends ../layout
|
||||
|
||||
block content
|
||||
.m4.mt-header.pt1
|
||||
h2 Your replays
|
||||
#all-replays.row-fluid
|
||||
|
||||
block footer
|
||||
script(src=asset_path('js/data.js'))
|
||||
script(src=asset_path('js/vendor.js'))
|
||||
script(src=asset_path('js/templates.js'))
|
||||
script(src=asset_path('js/replays.js'))
|
||||
script.
|
||||
var replays = new Replays(!{JSON.stringify(replays)});
|
||||
new ReplayView({el: '#all-replays', collection: replays}).render();
|
||||
39
client/templates/replays/show.jade
Normal file
39
client/templates/replays/show.jade
Normal file
@@ -0,0 +1,39 @@
|
||||
extends ../layout
|
||||
|
||||
block content
|
||||
.fill.flex-center.flex-column
|
||||
unless replay
|
||||
p No replay found.
|
||||
else
|
||||
h1.mt-header.mb1
|
||||
= replay.getFormat()
|
||||
= ": " + replay.getName()
|
||||
#replay.relative(style = 'width: 100%; height: 100%;')
|
||||
|
||||
block footer
|
||||
if replay
|
||||
script(src=asset_path('js/data.js', {fingerprint: replay.version('js/data.js')}))
|
||||
script(src=asset_path('js/vendor.js', {fingerprint: replay.version('js/vendor.js')}))
|
||||
script(src=asset_path('js/templates.js', {fingerprint: replay.version('js/templates.js')}))
|
||||
script(src=asset_path('js/replays.js', {fingerprint: replay.version('js/replays.js')}))
|
||||
script.
|
||||
var replay = !{JSON.stringify(replay.toJSON())};
|
||||
var battle = new Battle({
|
||||
id: replay.id,
|
||||
format: replay.format,
|
||||
numActive: replay.numActive,
|
||||
playerIds: replay.players
|
||||
});
|
||||
var $battleWindow = $(window.JST['battle_window']({
|
||||
battle: battle,
|
||||
window: window
|
||||
}));
|
||||
|
||||
$('#replay').html($battleWindow);
|
||||
|
||||
battle.view = new BattleView({
|
||||
el: $battleWindow,
|
||||
model: battle
|
||||
});
|
||||
|
||||
battle.update(replay.contents);
|
||||
Reference in New Issue
Block a user