import os
from flask import Flask
from flask import Response,send_from_directory, render_template, request, jsonify
if (not os.path.isdir("templates")):
os.mkdir("templates")
with open("templates/mytemplate.html","w") as f:
f.write("<script>\n"
"var x = {{ some_value }};\n"
"</script>\n")
f.close()
app = Flask(__name__)
@app.route("/")
@app.route("/mytemplate.html")
def hello():
return render_template('mytemplate.html',some_value=123)
if __name__ == "__main__":
app.run()
var texts = {
1:"test1",
19:"test2"
};
$(document).on('keypress', function(e) {
console.log(e.keyCode); //показать код нажатой кнопки
if ( e.ctrlKey && e.shiftKey && e.keyCode in texts){
console.log(texts[e.keyCode]);
}
});
$("#id_elemet").append(texts[e.keyCode]);
var texts = {
1:"test1",
19:"test2"
};
$(document).on('keypress', function(e) {
console.log(e.keyCode); //показать код нажатой кнопки
if ( e.ctrlKey && e.shiftKey && e.keyCode in texts){
$("textarea.field__input").val($("textarea.field__input").val()+texts[e.keyCode]);
}
});
<link rel="stylesheet" type="text/css" href="/static/css/jquery-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/jquery-ui.structure.min.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/jquery-ui.theme.min.css"/>