Commit 6a7f027a authored by Emanuele Santoro's avatar Emanuele Santoro

Imported bootstrap theme, index page customized

parent ea7b5272
......@@ -48,7 +48,7 @@ def page(path) :
@musho.route("/")
def index() :
return page("templates/index.html")
return render_template("index.html")
@musho.route("/save", methods=['POST'])
def saveLink() :
......@@ -78,5 +78,12 @@ def resolveLink(short_url):
else :
return redirect("/")
@musho.route('/static/<path:path>')
def static_proxy(path):
# send_static_file will guess the correct MIME type
println("Got request for path: " + path)
return musho.send_static_file(path)
if __name__ == "__main__" :
musho.run(port=port)
This diff is collapsed.
/*
HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
* */
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
\ No newline at end of file
(function(){
var $button = $("<div id='source-button' class='btn btn-primary btn-xs'>&lt; &gt;</div>").click(function(){
var html = $(this).parent().html();
html = cleanSource(html);
$("#source-modal pre").text(html);
$("#source-modal").modal();
});
$('.bs-component [data-toggle="popover"]').popover();
$('.bs-component [data-toggle="tooltip"]').tooltip();
$(".bs-component").hover(function(){
$(this).append($button);
$button.show();
}, function(){
$button.hide();
});
function cleanSource(html) {
var lines = html.split(/\n/);
lines.shift();
lines.splice(-1, 1);
var indentSize = lines[0].length - lines[0].trim().length,
re = new RegExp(" {" + indentSize + "}");
lines = lines.map(function(line){
if (line.match(re)) {
line = line.substring(indentSize);
}
return line;
});
lines = lines.join("\n");
return lines;
}
})();
This diff is collapsed.
This diff is collapsed.
body{padding-top:50px}#banner{border-bottom:none}.page-header h1{font-size:4em}.bs-docs-section{margin-top:8em}.bs-component{position:relative}.bs-component .modal{position:relative;top:auto;right:auto;left:auto;bottom:auto;z-index:1;display:block}.bs-component .modal-dialog{width:90%}.bs-component .popover{position:relative;display:inline-block;width:220px;margin:20px}#source-button{position:absolute;top:0;right:0;z-index:100;font-weight:bold}.progress{margin-bottom:10px}footer{margin:5em 0}footer li{float:left;margin-right:1.5em;margin-bottom:1.5em}footer p{clear:left;margin-bottom:0}.splash{padding:4em 0 2em;background-color:#1c2533;background:-webkit-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:-o-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:-ms-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:-moz-linear-gradient(70deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background:linear-gradient(20deg, #080f1f 30%, #2b4b5a 87%, #435e67 100%);background-attachment:fixed;color:#fff;text-align:center}.splash h1{font-size:4em}.splash #social{margin:2em 0}.splash .alert{margin:2em 0}.splash .bsa{max-width:350px;margin:0 auto;background:none}.splash .bsa .one .bsa_it_ad{border:1px solid #3e4653 !important;border-color:rgba(255,255,255,0.2) !important}.splash .bsa a{color:#fff}.section-tout{padding:4em 0 3em;border-top:1px solid rgba(255,255,255,0.1);border-bottom:1px solid rgba(0,0,0,0.1);background-color:#eaf1f1}.section-tout .fa{margin-right:.5em}.section-tout p{margin-bottom:3em}.section-preview{padding:4em 0 4em}.section-preview .preview{margin-bottom:4em;background-color:#eaf1f1;border:1px solid rgba(0,0,0,0.1);border-radius:6px}.section-preview .preview .image{padding:5px}.section-preview .preview .image img{border:1px solid rgba(0,0,0,0.1)}.section-preview .preview .options{text-align:center;padding:0 2em 2em}.section-preview .preview .options p{margin-bottom:2em}.section-preview .dropdown-menu{text-align:left}.section-preview .lead{margin-bottom:2em}@media (max-width:767px){.section-preview .image img{width:100%}}.sponsor img{border:1px solid rgba(0,0,0,0.1);border-radius:4px}.sponsor a:hover{text-decoration:none}.bsa{padding:0}.bsa .one .bsa_it_ad{border:none !important;background-color:transparent !important}.bsa .one .bsa_it_ad .bsa_it_t,.bsa .one .bsa_it_ad .bsa_it_d{color:inherit !important}.bsa .one .bsa_it_ad .bsa_it_i{margin-bottom:0 !important}.bsa .one .bsa_it_p{display:none}
\ No newline at end of file
// Yeti 3.1.1
// Bootswatch
// -----------------------------------------------------
@import url("//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700");
// Navbar =====================================================================
.navbar {
border: none;
font-size: 13px;
font-weight: 300;
.navbar-toggle:hover .icon-bar {
background-color: #b3b3b3;
}
&-collapse {
border-top-color: @dropdown-divider-bg;
.box-shadow(none);
}
.btn {
padding-top: 6px;
padding-bottom: 6px;
}
.dropdown {
&-menu {
border: none;
> li > a,
> li > a:focus {
background-color: transparent;
font-size: 13px;
font-weight: 300;
}
}
&-header {
color: rgba(255, 255, 255, 0.5);
}
}
&-default {
.dropdown-menu {
background-color: @navbar-default-bg;
> li > a,
> li > a:focus {
color: @navbar-default-color;
}
> li > a:hover,
> .active > a,
> .active > a:hover {
background-color: @navbar-default-link-hover-bg;
}
}
}
&-inverse {
.dropdown-menu {
background-color: @navbar-inverse-bg;
> li > a,
> li > a:focus {
color: @navbar-inverse-color;
}
> li > a:hover,
> .active > a,
> .active > a:hover {
background-color: @navbar-inverse-link-hover-bg;
}
}
}
}
// Buttons ====================================================================
.btn {
padding: 14px 28px;
&-lg {
padding: 16px 32px;
}
&-sm {
padding: 8px 16px;
}
&-xs {
padding: 4px 8px;
}
}
.btn-group {
.btn ~ .dropdown-toggle {
padding-left: 16px;
padding-right: 16px;
}
.dropdown-menu {
border-top-width: 0;
}
&.dropup .dropdown-menu {
border-top-width: 1px;
border-bottom-width: 0;
margin-bottom: 0;
}
.dropdown-toggle {
&.btn-default ~ .dropdown-menu {
background-color: @btn-default-bg;
border-color: @btn-default-border;
> li > a {
color: @btn-default-color;
}
> li > a:hover {
background-color: darken(@btn-default-bg, 8%);
}
}
&.btn-primary ~ .dropdown-menu {
background-color: @btn-primary-bg;
border-color: @btn-primary-border;
> li > a {
color: @btn-primary-color;
}
> li > a:hover {
background-color: darken(@btn-primary-bg, 8%);
}
}
&.btn-success ~ .dropdown-menu {
background-color: @btn-success-bg;
border-color: @btn-success-border;
> li > a {
color: @btn-success-color;
}
> li > a:hover {
background-color: darken(@btn-success-bg, 8%);
}
}
&.btn-info ~ .dropdown-menu {
background-color: @btn-info-bg;
border-color: @btn-info-border;
> li > a {
color: @btn-info-color;
}
> li > a:hover {
background-color: darken(@btn-info-bg, 8%);
}
}
&.btn-warning ~ .dropdown-menu {
background-color: @btn-warning-bg;
border-color: @btn-warning-border;
> li > a {
color: @btn-warning-color;
}
> li > a:hover {
background-color: darken(@btn-warning-bg, 8%);
}
}
&.btn-danger ~ .dropdown-menu {
background-color: @btn-danger-bg;
border-color: @btn-danger-border;
> li > a {
color: @btn-danger-color;
}
> li > a:hover {
background-color: darken(@btn-danger-bg, 8%);
}
}
}
}
// Typography =================================================================
.lead {
color: @gray;
}
cite {
font-style: italic;
}
blockquote {
border-left-width: 1px;
color: @gray;
&.pull-right {
border-right-width: 1px;
}
small {
font-size: @font-size-small;
font-weight: 300;
}
}
// Tables =====================================================================
table {
font-size: @font-size-small;
}
// Forms ======================================================================
input,
.form-control {
padding: 7px;
}
label,
.control-label,
.help-block,
.checkbox,
.radio {
font-size: @font-size-small;
font-weight: normal;
}
.input-group-addon,
.input-group-btn .btn {
padding: 8px 14px;
font-size: @font-size-small;
}
// Navs =======================================================================
.nav {
.open > a,
.open > a:hover,
.open > a:focus {
border-color: transparent;
}
}
.nav-tabs {
> li > a {
background-color: @btn-default-bg;
color: @text-color;
}
.caret {
border-top-color: @text-color;
border-bottom-color: @text-color;
}
}
.nav-pills {
font-weight: 300;
}
.breadcrumb {
border: 1px solid @table-border-color;
border-radius: 3px;
font-size: 10px;
font-weight: 300;
text-transform: uppercase;
}
.pagination {
font-size: @font-size-small;
font-weight: 300;
color: @gray-light;
> li {
> a,
> span {
margin-left: 4px;
color: @gray-light;
}
}
> .active {
> a,
> span {
color: #fff;
}
}
> li,
> li:first-child,
> li:last-child {
> a,
> span {
border-radius: 3px;
}
}
&-lg > li > a {
padding-left: 22px;
padding-right: 22px;
}
&-sm > li > a {
padding: 0 5px;
}
}
.pager {
font-size: @font-size-small;
font-weight: 300;
color: @gray-light;
}
.list-group {
font-size: @font-size-small;
font-weight: 300;
}
// Indicators =================================================================
.close {
opacity: 0.4;
&:hover,
&:focus {
opacity: 1;
}
}
.alert {
font-size: @font-size-small;
font-weight: 300;
a,
.alert-link {
font-weight: normal;
color: #fff;
text-decoration: underline;
}
.close {
color: #fff;
text-decoration: none;
&:hover,
&:focus {
color: #fff;
}
}
}
.label {
padding-left: 1em;
padding-right: 1em;
border-radius: 0;
font-weight: 300;
&-default {
background-color: @btn-default-bg;
color: @btn-default-color;
}
}
.badge {
font-weight: 300;
}
// Progress bars ==============================================================
.progress {
height: 22px;
padding: 2px;
background-color: #f6f6f6;
border: 1px solid #ccc;
.box-shadow(none);
}
// Containers =================================================================
.dropdown {
&-menu {
padding: 0;
margin-top: 0;
font-size: @font-size-small;
> li > a {
padding: 12px 15px;
}
}
&-header {
padding-left: 15px;
padding-right: 15px;
font-size: 9px;
text-transform: uppercase;
}
}
.popover {
color: #fff;
font-size: 12px;
font-weight: 300;
}
.panel {
&-heading,
&-footer {
border-top-right-radius: 0;
border-top-left-radius: 0;
}
}
This diff is collapsed.
<!doctype html>
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Musho: a simple micro-url-shortener</title>
<meta charset="utf-8">
<title>Musho: the micro url shortener!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/static/theme/bootstrap.css" media="screen">
<link rel="stylesheet" href="/static/theme/usebootstrap.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="bootstrap/html5shiv.js"></script>
<script src="bootstrap/respond.min.js"></script>
<![endif]-->
<style type="text/css">
#nolongurls {
margin: 0px auto;
width: 450px;
}
div#form-well {
margin-top: 125px;
}
</style>
</head>
<body>
<center>
<h1>Shorten a new url</h1>
<form name="url_shorten" action="/save" method="POST">
<table>
<tr>
<td>Url:</td>
<td><input name="url" type="text" placeholder="your url here"></td>
<td><input type="submit" value="Shorten!"></td>
</table>
</form>
</center>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a href="http://musho.herokuapp.com" class="navbar-brand">Musho</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="navbar-main">
<!--
<ul class="nav navbar-nav navbar-right">
<li><a href="#" target="_blank">Shorten a new url</a></li>
</ul>
-->
</div>
</div>
</div>
<div class="container">
<!-- Forms
================================================== -->
<div class="bs-docs-section">
<div class="row">
<div class="col-lg-6">
<img class="img-responsive img-circle" id="nolongurls" src="http://santoro.tk/~manu/musho.jpg">
</div>