Pārlūkot izejas kodu

修复了代数工厂重名模块

Huan 5 gadi atpakaļ
vecāks
revīzija
7002d832cd

+ 4 - 0
Hello.py

@@ -10,8 +10,12 @@ import os
 import tkinter.messagebox
 import webbrowser
 import random
+<<<<<<< Updated upstream
 
 from newtkinter import DragWindow, center_windows
+=======
+import flask
+>>>>>>> Stashed changes
 
 img = None
 SCREEN = None

+ 2 - 2
algebraicfactory/gui.py

@@ -1272,7 +1272,7 @@ class API(UIAPI):
 
     @staticmethod
     @exception_catch()
-    def standardization():
+    def simplify_standardization():
         inverse, name, radio, rat = API.get_standardization_gui()
         try:
             get = algebra_controller.simplify(name, radio, rat=rat, inv=inverse)
@@ -3016,7 +3016,7 @@ tkinter.Button(
     bg=buttom_color,
     fg=word_color,
     text="化简标准化",
-    command=standardization,
+    command=API.simplify_standardization,
     font=FONT,
     width=gui_width,
     height=gui_height,

+ 2 - 2
algebraicfactory/template.py

@@ -359,7 +359,7 @@ class AlgebraMerge(AlgebraExpBase, metaclass=ABCMeta):
 @plugin_class_loading(get_path(r"template/algebraicfactory"))
 class AlgebraBase(AlgebraSymbol, AlgebraFormat, AlgebraPrint, AlgebraSplit, AlgebraMerge):
 
-    def simplify(self, alg, radio=1.7, func=None, rat=True, inv=False):  # 函数简化
+    def the_simplify(self, alg, radio=1.7, func=None, rat=True, inv=False):  # 函数简化
         if func is None:
             func = count_ops
         self.out_status("正在标准化")
@@ -804,7 +804,7 @@ class Digitization(AlgebraBase):
 class AlgebraSimplify(AlgebraBase):
     def simplify(self, name, ratdio=1.7, func=None, rat=True, inv=False):
         alg = self.get_expression(name)
-        self.simplify(alg, ratdio, func, rat, inv)
+        return self.the_simplify(alg, ratdio, func, rat, inv)
 
 
 @plugin_class_loading(get_path(r"template/algebraicfactory"))

+ 54 - 0
static/Communication.css

@@ -0,0 +1,54 @@
+div.screen{
+    background: #ffffff;
+    width:1200px;
+    height:800px;
+    position:absolute;
+    left:50%;
+    top:50%;
+    margin:-400px 0 0 -600px;
+    z-index:10;
+}
+
+canvas.bg_canvas{
+    background: #000000;
+    display: block;
+    width: 99%;
+    height: 99%;
+    position:absolute;
+    z-index: 1;}
+
+.font{
+    font-size: 20px;
+}
+
+div.nothing{
+    height: 5px;
+    width: 0;
+}
+
+div.form{
+    text-align:center;
+}
+input.text{
+    width: 520px;
+}
+
+#sentfunc{
+    width: 180px;
+}
+
+button.button{
+    width: 100px;
+}
+
+#queue_list{
+    width: 500px;
+}
+
+#var_list{
+    width: 690px;
+}
+
+select.box{
+    height: 750px;
+}

+ 84 - 0
static/Communication.html

@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html lang="zh">
+    <head>
+        <link rel="stylesheet" type="text/css" href="Communication.css">
+        <meta charset="UTF-8">
+        <title>Hello</title>
+        <script src="gui.js"></script>
+        <script src="requests.js"></script>
+    </head>
+    <body>
+        <script>
+            let host = 'http://127.0.0.1:5000/'
+        </script>
+        <canvas id="canvas" class="bg_canvas"></canvas>
+        <div class="screen" id="screen">
+            <div class="nothing"></div>
+            <div class="form" id="form">
+                <div>
+                    <label for="sentfunc" class="font" id="sentfunc_labe">选定发送方式:</label>
+                    <select id="sentfunc" class="font">
+                        <option value="done ">执行python</option>
+                        <option value="get_var ">获取变量</option>
+                        <option value="get var_* ">获取所有变量</option>
+                        <option value="get * ">获取通信变量</option>
+                        <option value="get_eval ">返回代码</option>
+                        <option value="put_var ">发送变量</option>
+                        <option value="put_eval ">发送代码</option>
+                        <option value="file ">发送文件</option>
+                    </select>
+                    <input type="file" id="get_file" style="display:none;"/>
+                    <label for="message" class="font">输入发送对象:</label>
+                    <input id="message" class="font text" type="text">
+                    <button class="font button" onclick="sent()">发送消息</button>
+                    <button class="font button" onclick="document.getElementById('get_file').click()">选择文件</button>
+                    <script>
+                            let the_file = document.getElementById("get_file");
+                            the_file.addEventListener("change",function () {
+                            let message_input = document.getElementById("message");
+                            message_input.value = message_input.value + the_file.value;
+                        });
+                    </script>
+                </div>
+                <div class="nothing"></div>
+                <div>
+                    <label for="queue_list"></label>
+                    <select id="queue_list" class="font box" size=30>
+                    </select>
+                    <label for="var_list"></label>
+                    <select id="var_list" class="font box" size=30>
+                    </select>
+                </div>
+            </div>
+        </div>
+        <script>
+            function sent() {
+                let sent_box = document.getElementById("sentfunc");
+                let queue_list = document.getElementById("queue_list");
+                let index = String(queue_list.options[queue_list.selectedIndex].value);
+                let message = sent_box.options[sent_box.selectedIndex].value + document.getElementById("message").value;
+                let sent_func = function () {};  // Nothing
+                request_get(sent_func, "sent?message=" + message + '&index=' + index);
+            }
+                function get_update(is_must) {
+                    update_func = function () {
+                        if (xhr.status === 200) {
+                            let json = JSON.parse(xhr.responseText);
+                            if (json['status'] === 'YES') {
+                                let p_box = document.getElementById("queue_list");
+                                let var_box = document.getElementById("var_list");
+                                update_box(p_box, json['queue']);
+                                update_box(var_box, json['var']);
+                                p_box.innerHTML = '';
+                            }
+                        }
+                    };
+                    request_get(update_func, "update" + '?must=' + is_must);
+                }
+
+                get_update('must');  // 第一次通信,必须获取
+                window.setInterval("get_update('No')", 1000);
+        </script>
+        <script src="bg.js"></script>
+    </body>
+</html>

+ 91 - 0
static/Hello.html

@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html lang="zh">
+    <head>
+        <link rel="stylesheet" type="text/css" href="hello.css">
+        <meta charset="UTF-8">
+        <title>Hello</title>
+        <script src="requests.js"></script>
+    </head>
+    <body>
+        <script>
+            let host = 'http://127.0.0.1:5000/'
+        </script>
+        <canvas id="canvas" class="bg_canvas"></canvas>
+        <div class="screen" id="screen">
+            <script>
+                img_func = function () {
+                    let screen_div = document.getElementById('screen');
+                    screen_div.style.backgroundImage = 'url("Pic/match.png")';
+                    };
+                request_get(img_func, "img")
+            </script>
+            <div id='cotanTitle' class="cotan_title">
+            </div>
+            <div id="method" class="mode">
+                <h1 class="mode">CoTan<br>科学计算系统</h1>
+                <h2 class="mode">CoTan工具</h2>
+                <script>
+                    function start(mode_url){
+                        start_func = function () {
+                            console.log('run');
+                            if (xhr.status === 200) {
+                                current_circle.remove();
+                            }};
+                        current_circle.add();
+                        request_get(start_func, mode_url)
+                    }
+                </script>
+                <button type="button" id="board" class="button white big" onclick="start('draftboard')">CoTan草稿板</button>
+                <div class="nothing"></div>
+                <button type="button" id="selenium" class="button white big" onclick="start('crawler')">自动化网页</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="git" class="button white small" onclick="start('git')">git仓库控制器</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="website" class="button white small" onclick="window.open('https://cotan.songzh.website');">CoTan社区</button>
+
+                <h2 class="mode">数学系统</h2>
+
+                <button type="button" id="alg" class="button white big" onclick="start('algebraicfactory')">代数工厂</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="machine" class="button white big" onclick="start('machinelearner')">机器学习</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="data" class="button white big" onclick="start('datascience')">数据科学</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="func" class="button white small" onclick="start('functionfactory')">函数工厂</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="geometric" class="button white small" onclick="start('functionmapping')">函数实验室</button>
+
+                <h2 class="mode">物化系统</h2>
+
+                <button type="button" id="physical" class="button white big">几何车间</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="chemistry" class="button white big">物理车间</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="laboratory" class="button white small">化学车间</button>
+
+                <h2 class="mode">系统工具</h2>
+
+                <button type="button" id="plugin" class="button white small" onclick="start('system')">系统管理</button>
+
+                <div class="nothing"></div>
+                <button type="button" id="process" class="button white small"  onclick="window.open(host + '/communication');">通信管理器</button>
+            </div>
+            <script>
+                let screen_width = 1200;
+                let screen_height = 800;
+                console.log(screen_height);
+                document.getElementById("cotanTitle").style.width = String(screen_width -
+                    document.getElementById("method").offsetWidth - 1) + 'px';
+            </script>
+            <script src="bg.js"></script>
+        </div>
+    </body>
+</html>

+ 56 - 0
static/Map.css

@@ -0,0 +1,56 @@
+div.screen{
+    background: #ffffff;
+    width:962px;
+    height:824px;
+    position:absolute;
+    left:50%;
+    top:50%;
+    margin:-412px 0 0 -481px;
+    z-index:10;
+}
+
+canvas.bg_canvas{
+    background: #000000;
+    display: block;
+    width: 99%;
+    height: 99%;
+    position:absolute;
+    z-index: 1;}
+
+label.no_label{
+    width: 0;
+}
+
+label{
+    display:inline-block;
+    width: 100px;
+    }
+
+label{
+    display:inline-block;
+    width: 100px;
+    }
+
+input{
+    width: 200px;
+    }
+
+button{
+    width: 100px;
+    height: 30px;
+    }
+
+div.horizontal{
+    float:left;
+    width: 320px;
+    text-align:center;
+}
+
+select{
+    width: 309px;
+}
+
+div.select{
+    width: 320px;
+    text-align:center;
+}

+ 111 - 0
static/Map.html

@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<html lang="zh">
+    <head>
+        <link rel="stylesheet" type="text/css" href="Map.css">
+        <meta charset="UTF-8">
+        <title>Hello</title>
+        <script src="gui.js"></script>
+        <script src="requests.js"></script>
+    </head>
+    <body>
+        <script>
+            let host = 'http://127.0.0.1:5000/'
+        </script>
+        <canvas id="canvas" class="bg_canvas"></canvas>
+        <div class="screen" id="screen">
+            <div class="nothing"></div>
+            <div class="form" id="form">
+                <div class="horizontal">
+                    <label for="func_exp" class='tips'>函数表达式</label>
+                    <input id="func_exp">
+                    <br>
+                    <label for="definition_domain" class='tips'>函数定义域</label>
+                    <input id="definition_domain">
+                    <br>
+                    <label for="func_name" class='tips'>函数符号</label>
+                    <input id="func_name">
+                    <br>
+                    <label for="func_style" class='tips'>函数绘图样式</label>
+                    <input id="func_style">
+                    <div>
+                    <button>添加新函数</button>
+                    <button>删除选择函数</button>
+                    <button>清除所有函数</button>
+                    </div>
+                    <div class='select'>
+                        <label for="func_box" class='no_label'></label>
+                        <select id="func_box" class="font box" style='height: 700px' size=20>
+                        </select>
+                    </div>
+                </div>
+                <div class="horizontal">
+                        <label for="x_value" class='tips'>计算(y)</label>
+                        <input id="x_value">
+                        <br>
+                        <label for="y_value" class='tips'>二分法计算(x)</label>
+                        <input id="y_value">
+                        <br>
+                        <label for="dicon_parameters" class='tips'>二分法参数</label>
+                        <input id="dicon_parameters">
+                        <br>
+                        <label for="y_value_gradient" class='tips'>梯度法计算(x)</label>
+                        <input id="y_value_gradient">
+                        <div>
+                        <button>计算</button>
+                        <button>二分法计算</button>
+                        <button>梯度法计算</button>
+                        </div>
+                        <div>
+                        <button>查看记忆</button>
+                        <button>隐藏记忆</button>
+                        <button>清空记忆</button>
+                        </div>
+                        <div class='select'>
+                            <label for="result_box" class='no_label'></label>
+                            <select id="result_box" class="font box"  style='height: 300px' size=20>
+                        </select>
+                        <label for="x_axis" class='tips'>x轴刻度</label>
+                        <input id="x_axis">
+                        <br>
+                        <label for="y_axis" class='tips'>y轴刻度</label>
+                        <input id="y_axis">
+                        <br>
+                        <label for="x_limit" class='tips'>x轴极限</label>
+                        <input id="x_limit">
+                        <br>
+                        <label for="y_limit" class='tips'>y轴极限</label>
+                        <input id="y_limit">
+                        <div>
+                        <button>绘制函数</button>
+                        <button>计算性质</button>
+                        <button>函数求导</button>
+                        </div>
+                        <div class='select'>
+                            <label for="prediction_box" class='no_label'></label>
+                            <select id="prediction_box" class="font box"  style='height: 150px' size=20>
+                            </select>
+                        </div>
+                        <div class='select'>
+                            <label for="new_box" class='no_label'></label>
+                            <select id="new_box" class="font box"  style='height: 100px' size=20>
+                            </select>
+                        </div>
+                    </div>
+                    </div>
+                <div class="horizontal">
+                    <div>
+                        <button>导入表格</button>
+                        <button>生成表格</button>
+                        <button>导出表格</button>
+                    </div>
+                    <div class='select'>
+                        <label for="sheet_box" class='no_label'></label>
+                        <select id="sheet_box" class="font box"  style='height: 791px' size=20>
+                        </select>
+                        </div>
+            </div>
+            </div>
+	    </div>
+        <script src="bg.js"></script>
+    </body>
+</html>

+ 181 - 0
static/bg.js

@@ -0,0 +1,181 @@
+class Circle {
+    constructor(x, y) {
+        this.x = x;
+        this.y = y;
+        this.r = Math.random() * 10 ;
+        this._mr = Math.random();
+        this._mx = (Math.random() - 0.5) * 2;
+        this._my = (Math.random() - 0.5) * 2 ;
+        this.ax = 0;
+        this.ay = 0;
+    }
+
+    drawCircle(ctx) {
+        ctx.beginPath();  // 开始绘制
+        ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI);  // 画弧线
+        ctx.closePath();  // 结束绘制
+        ctx.fillStyle = 'rgba(204, 204, 204, 0.3)';
+        ctx.fill();
+    }
+
+    drawLine(ctx, _circle) {
+        let dx = this.x - _circle.x;  // 差距
+        let dy = this.y - _circle.y;  // 差距
+        let d = Math.sqrt(dx * dx + dy * dy);  // 勾股距离
+        if (d < 180) {
+            ctx.beginPath();
+            //开始一条路径,移动到位置 this.x,this.y。创建到达位置 _circle.x,_circle.y 的一条线:
+            ctx.moveTo(this.x, this.y);   //起始点
+            ctx.lineTo(_circle.x, _circle.y);   //终点
+            ctx.closePath();
+            ctx.strokeStyle = 'rgba(204, 204, 204, ' + String(1 - (d/180)) + ')';
+            ctx.stroke();
+        }
+    }
+
+    set_a(ax, ay){
+        this.ax += ax;
+        this.ax /= 2;
+        this.ay += ay;
+        this.ay /= 2;
+    }
+
+    set_a_first(){
+        if (Math.abs(this._mx) > 3) {
+            this.ax = 0;
+            this._mx = (Math.random() - 0.5) * 2;
+        }
+        if (Math.abs(this._my) > 3) {
+            this.ay = 0;
+            this._my = (Math.random() - 0.5) * 2;
+        }
+    }
+
+    move(w, h) {
+        this._mx += this.ax;
+        this._my += this.ay;
+
+        this._mx = (this.x < w && this.x > 1) ? this._mx : (-this._mx);
+        this._my = (this.y < h && this.y > 1) ? this._my : (-this._my);
+        this._mr = (this.r < 10 && this.r > 1) ? this._mr : (-this._mr);
+        this.x += this._mx / 2;
+        this.y += this._my / 2;
+        this.r += this._mr / 2;
+        if (this.r <= 0){
+            this._mr = -this._mr;
+            this.r = -this.r;
+        }
+        }}
+
+class currentCirle extends Circle {
+    constructor(x, y) {
+        super(x, y);
+        this.r = 8;
+        this.R = 30;
+        this.rad = 0;
+        this.circle = [];
+    }
+
+    add() {
+        console.log('add');
+        document.getElementsByTagName('title').item(0).innerHTML = 'loading...';
+        this.circle.push('rgba(204, 204, 204, 0.8)');
+    }
+
+    remove() {
+        console.log('remove');
+        this.circle.shift();
+        if (this.circle.length === 0){
+            document.getElementsByTagName('title').item(0).innerHTML = 'Hello';
+        }
+    }
+
+    drawLine(ctx, _circle) {
+        let dx = this.x - _circle.x;  // 差距
+        let dy = this.y - _circle.y;  // 差距
+        let d = Math.sqrt(dx * dx + dy * dy);  // 勾股距离
+        if (d < 180){
+            ctx.beginPath();
+            ctx.moveTo(this.x, this.y);   //起始点
+            ctx.lineTo(_circle.x, _circle.y);   //终点
+            ctx.closePath();
+            ctx.strokeStyle = 'rgba(204, 0, 0, ' + String(1 - (d / 180)) + ')';
+            ctx.stroke();
+            _circle.set_a(dx / 1800, dy / 1800);
+        }else{
+            _circle.set_a_first()
+        }
+    }
+
+    drawCircle(ctx) {
+        let l = this.circle.length;
+        for (let i of this.circle){
+            let dx = this.R * Math.cos(this.rad);
+            let dy = this.R * Math.sin(this.rad);
+            ctx.beginPath();  // 开始绘制
+            ctx.arc(this.x + dx, this.y + dy, this.r, 0, 2 * Math.PI);  // 画弧线
+            ctx.closePath();  // 结束绘制
+            ctx.fillStyle = i;
+            ctx.fill();
+            this.rad += 2 * Math.PI * (1 / l);
+            if (this.rad >= 2 * Math.PI){
+                this.rad -= 2 * Math.PI}
+        }
+        this.rad += Math.PI * (15 / 180);
+    }
+}
+//更新页面用requestAnimationFrame替代setTimeout
+window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
+
+let canvas = document.getElementById('canvas');
+let ctx = canvas.getContext('2d');
+let w = canvas.width = canvas.offsetWidth;
+let h = canvas.height = canvas.offsetHeight;
+let circles = [];
+let current_circle = new currentCirle(0, 0);  // 鼠标位置
+let update_times = 0;
+let draw = function () {
+    ctx.clearRect(0, 0, w, h);  // 清空
+    for (let i = 0; i < circles.length; i++) {
+        circles[i].move(w, h);
+        circles[i].drawCircle(ctx);
+        for (j = i + 1; j < circles.length; j++) {
+            circles[i].drawLine(ctx, circles[j])
+        }
+    }
+    if (current_circle.x) {
+        current_circle.drawCircle(ctx);
+        for (let k = 1; k < circles.length; k++) {
+            current_circle.drawLine(ctx, circles[k])
+        }
+    }else{
+        for (let k = 1; k < circles.length; k++) {
+            current_circle.set_a_first()
+        }
+    }
+    update_times += 1;
+    if (update_times >= 100) {
+        circles.push(new Circle(Math.random() * w, Math.random() * h));
+        circles.shift();
+        update_times = 0
+    }
+    requestAnimationFrame(draw)
+};
+
+let init = function (num) {
+    for (var i = 0; i < num; i++) {
+        circles.push(new Circle(Math.random() * w, Math.random() * h));
+    }
+    draw();
+};
+window.addEventListener('load', init(220));
+window.onmousemove = function (e) {  // 鼠标进入范围
+    // e = e || window.event;
+    current_circle.x = e.clientX;
+    current_circle.y = e.clientY;
+};
+window.onmouseout = function () {  // 鼠标移出反围
+    current_circle.x = null;
+    current_circle.y = null;
+
+};

+ 9 - 0
static/gui.js

@@ -0,0 +1,9 @@
+function update_box(box, json) {
+    box.innerHTML='';
+    for (i of json){
+        let y=document.createElement('option');
+        y.text=String(i);
+        y.value=String(i);
+        box.add(y, null)
+    }
+}

+ 391 - 0
static/hello.css

@@ -0,0 +1,391 @@
+/*h style*/
+canvas.bg_canvas{
+    background: #000000;
+    display: block;
+    width: 99%;
+    height: 99%;
+    position:absolute;
+    z-index: 1;}
+
+
+h1.mode{
+    font-size: 35px;
+    text-align:center
+}
+
+h2.mode{
+    font-size: 25px;
+    text-align:center
+}
+
+/*div style*/
+
+div.progressbar{
+    background: #00adee;
+    width:100px;
+    height:100px;
+    position:absolute;
+    z-index:20;
+}
+
+div.screen{
+    /*background: url("Pic/boat.png") repeat;*/
+    width:1200px;
+    height:800px;
+    position:absolute;
+    left:50%;
+    top:50%;
+    margin:-400px 0 0 -600px;
+    z-index:10;
+}
+
+div.nothing{
+    height: 5px;
+    width: 0;
+}
+
+div.cotan_title{
+    height: 30px;
+    width: 50%;
+    float:right;
+}
+
+div.mode{
+    background: #ffffff;
+    float:right;
+    height: 100%;
+    overflow: auto;
+}
+
+/*button style*/
+
+button.button {
+
+    display: inline-block;
+
+    zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */
+
+    *display: inline;
+
+    vertical-align: baseline;
+
+    margin: 0 2px;
+
+    outline: none;
+
+    cursor: pointer;
+
+    text-align: center;
+
+    text-decoration: none;
+
+    padding: .5em 2em .55em;
+
+    text-shadow: 0 1px 1px rgba(0,0,0,.3);
+
+    -webkit-border-radius: .5em;
+
+    -moz-border-radius: .5em;
+
+    border-radius: .5em;
+
+    -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
+
+    -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
+
+    box-shadow: 0 1px 2px rgba(0,0,0,.2);
+
+}
+
+.button:hover {
+
+    text-decoration: none;
+
+}
+
+.button:active {
+
+    position: relative;
+
+    top: 1px;
+
+}
+
+.big {
+    font: 18px/100% Arial, Helvetica, sans-serif;
+    height: 50px;
+    width: 300px;
+}
+
+.small {
+    font: 15px/100% Arial, Helvetica, sans-serif;
+    height: 40px;
+    width: 300px;
+}
+
+/* color styles
+
+---------------------------------------------- */
+
+
+/* white */
+
+.white {
+
+    color: #606060;
+
+    border: solid 1px #b7b7b7;
+
+    background: #fff;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
+
+    background: -moz-linear-gradient(top,  #fff,  #ededed);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
+
+}
+
+.white:hover {
+
+    background: #ededed;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc));
+
+    background: -moz-linear-gradient(top,  #fff,  #dcdcdc);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc');
+
+}
+
+.white:active {
+
+    color: #999;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff));
+
+    background: -moz-linear-gradient(top,  #ededed,  #fff);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff');
+
+}
+
+/* red */
+
+.red {
+
+    color: #faddde;
+
+    border: solid 1px #980c10;
+
+    background: #d81b21;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#ed1c24), to(#aa1317));
+
+    background: -moz-linear-gradient(top,  #ed1c24,  #aa1317);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
+
+}
+
+.red:hover {
+
+    background: #b61318;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#c9151b), to(#a11115));
+
+    background: -moz-linear-gradient(top,  #c9151b,  #a11115);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#c9151b', endColorstr='#a11115');
+
+}
+
+.red:active {
+
+    color: #de898c;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#aa1317), to(#ed1c24));
+
+    background: -moz-linear-gradient(top,  #aa1317,  #ed1c24);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#aa1317', endColorstr='#ed1c24');
+
+}
+
+
+
+/* blue */
+
+.blue {
+
+    color: #d9eef7;
+
+    border: solid 1px #0076a3;
+
+    background: #0095cd;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
+
+    background: -moz-linear-gradient(top,  #00adee,  #0078a5);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
+
+}
+
+.blue:hover {
+
+    background: #007ead;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
+
+    background: -moz-linear-gradient(top,  #0095cc,  #00678e);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#0095cc', endColorstr='#00678e');
+
+}
+
+.blue:active {
+
+    color: #80bed6;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#0078a5), to(#00adee));
+
+    background: -moz-linear-gradient(top,  #0078a5,  #00adee);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#0078a5', endColorstr='#00adee');
+
+}
+
+
+
+/* rosy */
+
+.rosy {
+
+    color: #fae7e9;
+
+    border: solid 1px #b73948;
+
+    background: #da5867;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#f16c7c), to(#bf404f));
+
+    background: -moz-linear-gradient(top,  #f16c7c,  #bf404f);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f16c7c', endColorstr='#bf404f');
+
+}
+
+.rosy:hover {
+
+    background: #ba4b58;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#cf5d6a), to(#a53845));
+
+    background: -moz-linear-gradient(top,  #cf5d6a,  #a53845);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#cf5d6a', endColorstr='#a53845');
+
+}
+
+.rosy:active {
+
+    color: #dca4ab;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#bf404f), to(#f16c7c));
+
+    background: -moz-linear-gradient(top,  #bf404f,  #f16c7c);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#bf404f', endColorstr='#f16c7c');
+
+}
+
+
+
+/* green */
+
+.green {
+
+    color: #e8f0de;
+
+    border: solid 1px #538312;
+
+    background: #64991e;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
+
+    background: -moz-linear-gradient(top,  #7db72f,  #4e7d0e);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#7db72f', endColorstr='#4e7d0e');
+
+}
+
+.green:hover {
+
+    background: #538018;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));
+
+    background: -moz-linear-gradient(top,  #6b9d28,  #436b0c);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');
+
+}
+
+.green:active {
+
+    color: #a9c08c;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#4e7d0e), to(#7db72f));
+
+    background: -moz-linear-gradient(top,  #4e7d0e,  #7db72f);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#4e7d0e', endColorstr='#7db72f');
+
+}
+
+
+
+/* pink */
+
+.pink {
+
+    color: #feeef5;
+
+    border: solid 1px #d2729e;
+
+    background: #f895c2;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#feb1d3), to(#f171ab));
+
+    background: -moz-linear-gradient(top,  #feb1d3,  #f171ab);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#feb1d3', endColorstr='#f171ab');
+
+}
+
+.pink:hover {
+
+    background: #d57ea5;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#f4aacb), to(#e86ca4));
+
+    background: -moz-linear-gradient(top,  #f4aacb,  #e86ca4);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4aacb', endColorstr='#e86ca4');
+
+}
+
+.pink:active {
+
+    color: #f3c3d9;
+
+    background: -webkit-gradient(linear, left top, left bottom, from(#f171ab), to(#feb1d3));
+
+    background: -moz-linear-gradient(top,  #f171ab,  #feb1d3);
+
+    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f171ab', endColorstr='#feb1d3');
+
+}
+
+

+ 6 - 0
static/requests.js

@@ -0,0 +1,6 @@
+function request_get(func, url) {
+    let xhr = new XMLHttpRequest();
+    xhr.onloadend = func;
+    xhr.open('get',host + url,true);
+    xhr.send();
+}