Removing Bootstrap

This commit is contained in:
Mattias Erming 2014-04-22 19:57:16 +02:00
parent 32e486bfb8
commit 413e48818b
6 changed files with 195 additions and 1820 deletions

1346
client/css/bootstrap.css vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,247 +0,0 @@
html,
body {
font: 13px "Consolas", monospace;
height: 100%;
}
a:focus {
outline: 0;
}
h1,
h2 {
font: inherit;
margin: 0;
}
.nav a[data-toggle]:hover {
background: #f9f9f9;
}
.user {
color: #f00;
cursor: pointer;
}
.user:hover {
color: #999;
}
#wrap,
#viewport {
height: 100%;
width: 100%;
}
#chat .toggle {
display: none;
}
#sidebar {
background: #f7f7f9;
border-right: 1px solid #e1e1e8;
float: left;
height: 100%;
width: 200px;
}
#sidebar .header {
background: #fff;
height: 43px;
position: relative;
}
#sidebar .header .nav {
bottom: 0;
margin: 0;
padding-left: 10px;
position: absolute;
width: 100%;
}
#sidebar .header .nav a {
line-height: 1em;
}
#sidebar .header .nav .active a {
background: #f7f7f9;
}
#sidebar .list-group {
margin: 10px 0;
padding: 0 10px;
}
#sidebar .list-group-item {
padding: 10px 12px;
}
#sidebar .list-group-item .badge {
font-size: 11px;
font-weight: normal;
margin-top: -1px;
}
#sidebar .panel {
margin: 10px;
}
#sidebar .panel label {
display: inline-block;
cursor: pointer;
margin-left: 5px;
padding: 5px 0;
width: 60px;
}
#sidebar .panel label.first {
margin-top: 10px;
}
#sidebar .panel input[type=checkbox] {
float: left;
margin-top: 1px;
margin-right: 10px;
}
#chat {
bottom: 0;
left: 200px;
line-height: 16px;
position: absolute;
right: 0;
top: 0;
}
#chat a {
color: inherit;
}
#chat form {
border-top: 1px solid #ddd;
bottom: 1px;
height: 30px;
left: 0;
position: absolute;
right: 0;
}
#chat form input {
border: 0;
font: inherit;
height: 30px;
margin: 0;
outline: none;
padding: 0 10px;
width: 100%;
}
#chat .join,
#chat .part,
#chat .nick,
#chat .quit,
#chat .mode,
#chat .kick {
/* Hidden by default */
display: none;
}
#chat.show-join .join,
#chat.show-part .part,
#chat.show-nick .nick,
#chat.show-quit .quit,
#chat.show-mode .mode,
#chat.show-kick .kick {
display: block;
}
#chat .window {
background: #fff;
height: 100%;
position: absolute;
width: 100%;
}
#chat .window.active {
display: block;
}
#chat .network .close,
#chat .network .users {
display: none;
}
#chat .network .title,
#chat .network .messages {
right: 0;
}
#chat .query .users {
display: none;
}
#chat .query .title,
#chat .query .messages {
right: 0;
}
#chat .title {
border-bottom: 1px solid #ddd;
height: 43px;
left: 0;
overflow: hidden;
padding-left: 10px;
position: absolute;
right: 160px;
top: 0;
}
#chat .title h1 {
color: #333;
display: inline-block;
font-size: 18px;
line-height: 43px;
}
#chat .title .btn {
float: right;
margin: 6px 6px 0 0;
}
#chat .title .btn:focus {
outline: none;
}
#chat .users {
background: #fff;
border-left: 1px solid #ddd;
bottom: 30px;
line-height: 1.4em;
overflow-y: auto;
padding: 4px 0;
position: absolute;
right: 0;
top: 0;
width: 160px;
}
#chat .users .count {
color: #bbb;
padding: 0 8px;
}
#chat .users .user {
padding: 0 8px;
}
#chat .messages {
box-shadow: inset 8px 0 0 #f7f7f9;
bottom: 30px;
left: 0;
overflow-y: auto;
padding: 4px 0;
position: absolute;
right: 160px;
top: 43px;
word-wrap: break-word;
z-index: 0;
}
#chat .message {
border-left: 8px solid #f7f7f9;
line-height: 1.4em;
padding: 0 8px;
}
#chat .message div {
display: inline;
}
#chat .message .time {
color: #bbb;
}
#chat .message .type,
#chat .message .text {
color: inherit;
}
#chat .join,
#chat .part,
#chat .nick,
#chat .quit,
#chat .notice,
#chat .error {
color: #999;
}
#chat .highlight,
#chat .topic {
background: #fcf8e3;
border-left-color: #faebcc;
color: #8a6d3b;
}
#chat .highlight .type {
display: none;
}
#chat .topic .type {
opacity: 0.5;
}
#chat .topic .type:after {
content: ":";
}

View File

@ -7,8 +7,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" href="/css/bootstrap.css"> <link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="/css/style.css">
</head> </head>
<body> <body>
@ -16,57 +15,27 @@
<div id="wrap"> <div id="wrap">
<div id="viewport"> <div id="viewport">
<aside id="sidebar"> <aside id="sidebar"></aside>
<header class="header"> <div id="chat"></div>
<ul class="nav nav-tabs">
<li class="active"><a href="#list" data-toggle="tab">Channels</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li>
</ul>
</header>
<div class="tab-content">
<div id="list" class="tab-pane active"></div>
<div id="settings" class="tab-pane">
<div class="panel panel-default">
<div class="panel-heading">
Show/hide events
</div>
<div class="panel-body">
<input type="checkbox" value="join"/>
<input type="checkbox" value="part"/>
<input type="checkbox" value="nick"/>
<input type="checkbox" value="quit"/>
<input type="checkbox" value="mode"/>
<input type="checkbox" value="kick"/>
</div>
</div>
</div>
</div>
</aside>
<div id="chat">
</div>
</div> </div>
</div> </div>
<script type="text/x-handlebars-template" id="networks"> <script type="text/x-handlebars-template" id="networks">
{{#each networks}} {{#each networks}}
<div id="network-{{id}}" class="network list-group"> <ul id="network-{{id}}" class="network">
{{partial "#channels"}} {{partial "#channels"}}
</div> </ul>
{{/each}} {{/each}}
</script> </script>
<script type="text/x-handlebars-template" id="channels"> <script type="text/x-handlebars-template" id="channels">
{{#each channels}} {{#each channels}}
<a href="{{name}}" id="channel-{{id}}" class="channel list-group-item"> <li>
<span class="badge pull-right"></span> <button id="channel-{{id}}" class="channel">
{{name}} {{name}}
</a> </button>
</li>
{{/each}} {{/each}}
</script> </script>
@ -95,19 +64,29 @@
Users: {{users.length}} Users: {{users.length}}
</div> </div>
{{#each users}} {{#each users}}
<div class="user"> <button class="user">
{{name}} {{name}}
</div> </button>
{{/each}} {{/each}}
</script> </script>
<script type="text/x-handlebars-template" id="messages"> <script type="text/x-handlebars-template" id="messages">
{{#each messages}} {{#each messages}}
<div class="message {{type}}"> <div class="{{type}}">
<div class="time">{{time}}</div> <span class="time">
<div class="user">{{from}}</div> {{time}}
<div class="type">{{type}}</div> </span>
<div class="text">{{{uri text}}}</div> <button class="user">
{{from}}
</button>
{{#if type}}
<span class="type">
{{type}}
</span>
{{/if}}
<span class="text">
{{{uri text}}}
</span>
</div> </div>
{{/each}} {{/each}}
</script> </script>
@ -117,7 +96,6 @@
<script src="/js/uri.js"></script> <script src="/js/uri.js"></script>
<script src="/js/handlebars.js"></script> <script src="/js/handlebars.js"></script>
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/chat.js"></script> <script src="/js/chat.js"></script>
</body> </body>

125
client/js/bootstrap.js vendored
View File

@ -1,125 +0,0 @@
/* ========================================================================
* Bootstrap: tab.js v3.1.1
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
this.element = $(element)
}
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var previous = $ul.find('.active:last a')[0]
var e = $.Event('show.bs.tab', {
relatedTarget: previous
})
$this.trigger(e)
if (e.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.parent('li'), $ul)
this.activate($target, $target.parent(), function () {
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: previous
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu')) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active
.one($.support.transition.end, next)
.emulateTransitionEnd(150) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
var old = $.fn.tab
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
}(jQuery);

View File

@ -46,7 +46,7 @@ $(function() {
}); });
chat[0].innerHTML = html; chat[0].innerHTML = html;
sidebar.find("#list").html( sidebar.html(
render("#networks", {networks: data}) render("#networks", {networks: data})
).find(".channel") ).find(".channel")
.first() .first()
@ -136,7 +136,7 @@ $(function() {
sidebar.on("click", ".channel", function(e) { sidebar.on("click", ".channel", function(e) {
e.preventDefault(); e.preventDefault();
sidebar.find("#list .active").removeClass("active"); sidebar.find(".active").removeClass("active");
$("#viewport").removeClass(); $("#viewport").removeClass();
var item = $(this) var item = $(this)
.addClass("active") .addClass("active")
@ -147,52 +147,6 @@ $(function() {
.bringToTop(); .bringToTop();
}); });
sidebar.find("input[type=checkbox]").each(function() {
var input = $(this);
var value = input.val();
var checked = true;
if (($.cookie("hidden") || []).indexOf(value) !== -1) {
checked = false;
}
input.prop("checked", checked)
.wrap("<label>")
.parent()
.append(value);
if (checked) {
chat.addClass("show-" + value);
}
input.on("change", function() {
var hidden = $.cookie("hidden") || "";
if (input.prop("checked")) {
hidden = hidden.replace(value, "");
} else {
hidden += value;
}
$.cookie("hidden", hidden);
chat.toggleClass(
"show-" + value,
input.prop("checked")
);
});
});
chat.on("append", ".messages", function(e) {
var item = $(this);
var last = item.find(".message:last");
var type = last[0].classList[1];
if (type && !chat.hasClass("show-" + type)) {
return;
}
var id = item.parent()
.attr("id")
.replace("window-", "");
var badge = sidebar
.find("#channel-" + id + ":not(.active)")
.find(".badge");
var num = (parseInt(badge.html()) + 1) || "1";
badge.html(num);
});
chat.on("submit", "form", function() { chat.on("submit", "form", function() {
var input = $(this).find(".input"); var input = $(this).find(".input");
var text = input.val(); var text = input.val();
@ -206,10 +160,6 @@ $(function() {
}); });
}); });
chat.on("mousedown", ".user", function(e) {
return false;
});
chat.on("dblclick", ".user", function() { chat.on("dblclick", ".user", function() {
var link = $(this); var link = $(this);
var id = parseInt(link.closest(".window").attr("id").replace("window-", "")); var id = parseInt(link.closest(".window").attr("id").replace("window-", ""));

165
client/style.css Normal file
View File

@ -0,0 +1,165 @@
* {
box-sizing: border-box;
}
html,
body {
font: 12px "Consolas", monospace;
height: 100%;
margin: 0;
}
a:focus,
button:focus {
outline: 0;
}
h1,
h2 {
font: inherit;
margin: 0;
}
ul,
li {
list-style: none;
margin: 0;
padding: 0;
}
.user {
background: none;
border: 0;
font: inherit;
margin: 0;
padding: 0;
}
.user:hover {
color: #f00;
cursor: pointer;
}
#wrap,
#viewport {
height: 100%;
min-width: 640px;
position: relative;
width: 100%;
}
#sidebar {
border-right: 1px solid #e1e1e8;
float: left;
height: 100%;
width: 200px;
}
#sidebar .network {
margin: 20px;
}
#sidebar li {
margin-left: 10px;
}
#sidebar li:first-child {
margin-left: 0;
}
#chat {
bottom: 0;
left: 200px;
line-height: 16px;
position: absolute;
right: 0;
top: 0;
}
#chat a {
color: inherit;
}
#chat form {
border-top: 1px solid #ddd;
bottom: 1px;
height: 30px;
left: 0;
position: absolute;
right: 0;
}
#chat form input {
border: 0;
font: inherit;
height: 30px;
margin: 0;
outline: none;
padding: 0 10px;
width: 100%;
}
#chat .network .users {
display: none;
}
#chat .network .title,
#chat .network .messages {
right: 0;
}
#chat .window {
background: #fff;
height: 100%;
position: absolute;
width: 100%;
}
#chat .title {
border-bottom: 1px solid #ddd;
height: 43px;
left: 0;
overflow: hidden;
padding-left: 10px;
position: absolute;
right: 160px;
top: 0;
}
#chat .title h1 {
color: #333;
display: inline-block;
font-size: 18px;
line-height: 43px;
}
#chat .messages {
bottom: 30px;
left: 0;
overflow-y: auto;
padding: 4px 0;
position: absolute;
right: 160px;
top: 43px;
word-wrap: break-word;
z-index: 0;
}
#chat .messages div {
line-height: 1.3em;
padding: 2px 8px;
}
#chat .time {
color: #999;
}
#chat .user {
color: #f00;
}
#chat .error,
#chat .join,
#chat .kick,
#chat .mode,
#chat .nick,
#chat .notice,
#chat .part,
#chat .quit,
#chat .topic {
color: #999;
}
#chat .users {
background: #fff;
border-left: 1px solid #ddd;
bottom: 30px;
line-height: 1.4em;
overflow-y: auto;
padding: 4px 8px;
position: absolute;
right: 0;
top: 0;
width: 160px;
}
#chat .users .count {
color: #999;
}
#chat .users .user {
display: block;
padding: 2px 0;
}