You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
XPPL/app/templates/base.html

86 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>XPPL</title>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="/static/css/style.css">
{% block css %} {% endblock%}
</head>
<body>
{% block header %}
<header>
{% include "header.html" %}
</header>
{% endblock %}
<main>
<div class="container">
{% block main %}{% endblock %}
</div>
</main>
<footer>
<div class="container">
{% include "footer.html" %}
</div>
</footer>
{% block js %} {% endblock%}
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="{{ url_for("static", filename="js/app.js") }}"></script>
<script>
$( ".no_cover" ).each(function() {
var string = $(this).children("p").html()
var randomColor = colorHash(string).rgb
$(this).css({
'background-color' : randomColor,
});
}
)
function colorHash(inputString){
var sum = 0;
for(var i in inputString){
sum += inputString.charCodeAt(i);
}
r = ~~(('0.'+Math.sin(sum+1).toString().substr(6))*256);
g = ~~(('0.'+Math.sin(sum+2).toString().substr(6))*256);
b = ~~(('0.'+Math.sin(sum+3).toString().substr(6))*256);
var rgb = "rgb("+r+", "+g+", "+b+")";
var hex = "#";
hex += ("00" + r.toString(16)).substr(-2,2).toUpperCase();
hex += ("00" + g.toString(18)).substr(-2,2).toUpperCase();
hex += ("00" + b.toString(20)).substr(-2,2).toUpperCase();
return {
r: r
,g: g
,b: b
,rgb: rgb
,hex: hex
};
}
</script>
</body>
</html>