Initial source commit
This commit is contained in:
parent
9cd02a2f15
commit
fb36363993
7 changed files with 53277 additions and 0 deletions
11
manifest.webapp
Normal file
11
manifest.webapp
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"version": "19.½_RC1_beta9",
|
||||
"name": "HelYe",
|
||||
"description": "RiddleKiller's official Mind Derailer",
|
||||
"launch_path": "/",
|
||||
"developer": {
|
||||
"name": "RiddleKiller Ltd. in cooperation wit infu",
|
||||
"url": "http://inf.re"
|
||||
},
|
||||
"installs_allowed_from": ["*"]
|
||||
}
|
47
srv.py
Normal file
47
srv.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
from flask import (Flask, request, redirect, render_template)
|
||||
import flask
|
||||
import json
|
||||
import random
|
||||
|
||||
from output import array
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
def jsonify(data):
|
||||
return flask.Markup(json.dumps(data))
|
||||
|
||||
app.jinja_env.filters['jsonify'] = jsonify
|
||||
|
||||
@app.route('/<int:first_id>/<int:second_id>/<int:third_id>')
|
||||
@app.route('/')
|
||||
def home(first_id=None, second_id=None, third_id=None):
|
||||
'''
|
||||
print len(array)
|
||||
while first_id == None:
|
||||
rand_int = randint(0, len(array)-1)
|
||||
value = array[rand_int]
|
||||
if len(value) > 0:
|
||||
first_id = rand_int
|
||||
while second_id == None:
|
||||
rand_int = randint(0, len(array)-1)
|
||||
value = array[rand_int]
|
||||
if len(value) > 0:
|
||||
second_id = rand_int
|
||||
'''
|
||||
def get_words(words):
|
||||
ret = []
|
||||
for word_id in words:
|
||||
word = array[word_id] if word_id != None and word_id < len(array) else random.choice(array)
|
||||
ret.append(word.decode('utf-8'))
|
||||
|
||||
return ret
|
||||
|
||||
words = get_words([first_id, second_id, third_id])
|
||||
return render_template('home.html', words=words)
|
||||
|
||||
@app.route('/manifest.webapp')
|
||||
def manifest():
|
||||
return open('manifest.webapp').read()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
BIN
static/img/ico.png
Normal file
BIN
static/img/ico.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 245 KiB |
4
static/js/jquery-1.7.2.min.js
vendored
Normal file
4
static/js/jquery-1.7.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
static/js/penis.js
Normal file
16
static/js/penis.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
$(function() {
|
||||
$.getJSON('https://ajax.googleapis.com/ajax/services/search/images?v=1.0&callback=?', {'q':words.join(' || ')}, function(data) {
|
||||
results = data.responseData.results;
|
||||
//for(var i in results)
|
||||
{
|
||||
var i = 0; // hardcore
|
||||
$img = $('<img>');
|
||||
$img.attr('src', results[i].url);
|
||||
$img.appendTo($('#image_wrapper'));
|
||||
return;
|
||||
}
|
||||
})
|
||||
$(document).click(function(e) {
|
||||
window.location.reload()
|
||||
});
|
||||
});
|
30
templates/home.html
Normal file
30
templates/home.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>HellYeah mind derailer</title>
|
||||
<style>
|
||||
span {
|
||||
font-size: 25px;
|
||||
color: #eee;
|
||||
}
|
||||
body {
|
||||
background: #2b2b2b;
|
||||
}
|
||||
img { width: 300px; }
|
||||
.foot {
|
||||
font-size: 8px;
|
||||
color: #666;
|
||||
margin-top: 50px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<span id="word1">{{ words[0]|e }}</span><br />
|
||||
<script>words = {{ words|jsonify }}; </script>
|
||||
<div id="image_wrapper"></div>
|
||||
<span id="word2">{{ words[1]|e }}</span>
|
||||
<div class="foot">Copyright © RiddleKiller Ltd.</div>
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery-1.7.2.min.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ url_for('static', filename='js/penis.js') }}"></script>
|
||||
<!--<script type="text/javascript" src="{{ url_for('static', filename='js/home.js') }}"></script>-->
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue