From 45f76942ef60fe7cb51d08cb7ca9a0c4b432fc80 Mon Sep 17 00:00:00 2001 From: unstop Date: Sun, 27 Jul 2014 12:04:27 +0800 Subject: [PATCH] typo and Mac OS detect --- static/index.jade | 27 ++++++++++++++++++++------- static/styles/index.less | 22 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/static/index.jade b/static/index.jade index 9e7e815..cb37068 100644 --- a/static/index.jade +++ b/static/index.jade @@ -2,23 +2,24 @@ doctype html html head meta(charset="utf-8") - title commitCal + title CommitCal link(rel='icon', href='/favicon.png', type='image/png') link(rel='stylesheet', href='/styles/index.css', type='text/css', media='screen') meta(name='viewport', content='width=device-width, initial-scale=1') body .header .container - h1.title.highlight commitCal - h3 View your commit history in Calendar + h1.title.highlight CommitCal + h3 View your commit history in calendar p.star iframe(src="http://ghbtns.com/github-btn.html?user=HackPlan&repo=github-commit-ical&type=watch&size=large", allowtransparency="true", frameborder="0", scrolling="0", width="72", height="30") - .body .container.clearfix - form(onsubmit="subscribe()") + form.clearfix(onsubmit="return subscribe()") input#username(type="text", placeholder="Enter your GitHub username") button(type="submit") Subscribe to Calendar + #subscription.clearfix(style="display:none") + #subscription_url .footer .container.copyright.clearfix .left @@ -27,9 +28,21 @@ html p A a(href="http://hackplan.com") Hackplan | Project - script. function subscribe() { username = document.getElementById('username').value; - window.open("webcal://commit-calendar.newsbee.io/" + username); + if (!username) { + return false; + } + url = "commit-calendar.newsbee.io/" + username; + if (window.navigator.platform.toUpperCase().indexOf('MAC') >= 0){ + window.open("webcal://" + url); + }else{ + link = document.getElementById('subscription_url') + link.innerHTML = "http://" + url; + + subscription = document.getElementById('subscription') + subscription.style.display = "block"; + } + return false; } \ No newline at end of file diff --git a/static/styles/index.less b/static/styles/index.less index a22022b..24a551b 100644 --- a/static/styles/index.less +++ b/static/styles/index.less @@ -102,7 +102,7 @@ input[type=text], input[type=password], textarea { } -button{ +button, .button{ display: inline-block; margin-bottom: 0; font-weight: bold; @@ -126,12 +126,30 @@ button{ } .container{ + #subscription{ + margin-top: 1em; + background: #5B9DD1; + border-radius: 3px; + padding: 0.5em 1em; + color: #fff; + } + #subscription_url{ + line-height: 2em; + float: left; + } + #sub_link{ + width: auto; + background: #2173B6; + border-color: #1E73B6; + padding: 3px 10px; + } + input{ width: 57%; float: left; box-sizing: border-box; } - button { + button, .button { width: 40%; float: right; box-sizing: border-box;