Skip to content

Commit

Permalink
Move docs to master (part 1/2).
Browse files Browse the repository at this point in the history
  • Loading branch information
vsn4ik committed Jul 11, 2014
1 parent 0699a00 commit 8e32167
Show file tree
Hide file tree
Showing 13 changed files with 525 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore docs files
_gh_pages
1 change: 1 addition & 0 deletions .test_file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Test file
7 changes: 7 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Server
source: docs
destination: _gh_pages

# Custom vars
repo: https://github.com/vsn4ik/bootstrap-checkbox
description: A checkbox component based on Bootstrap framework.
11 changes: 7 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "bootstrap-checkbox",
"version": "1.0.11",
"version": "1.0.12",
"authors": [
"vsn4ik"
],
"homepage": "https://github.com/vsn4ik/bootstrap-checkbox",
"description": "A checkbox component based on bootstrap framework",
"description": "A checkbox component based on Bootstrap framework",
"main": "dist/bootstrap-checkbox.js",
"ignore": [
".test_file",
"_config.yml",
"bower.json",
"docs",
"README.md"
],
"keywords": [
Expand All @@ -18,7 +21,7 @@
],
"license": "MIT",
"dependencies": {
"bootstrap": ">=2.3.2",
"jquery": ">=1.9.0"
"bootstrap": ">= 2.3.2",
"jquery": ">= 1.9.0"
}
}
1 change: 1 addition & 0 deletions dist/.test_file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Test file
16 changes: 16 additions & 0 deletions docs/_includes/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="vsn4ik">
<meta name="description" content="{{ site.description }}">
<meta name="keywords" content="bootstrap checkbox switch">

<title>{{ page.title }}</title>

<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="./assets/css/index.css">
<link rel="stylesheet" href="./assets/css/pygments-manni.css">

<script src="https://code.jquery.com/jquery.min.js" defer></script>
<script src="./dist/bootstrap-checkbox.min.js" defer></script>
<script src="./assets/js/index.js" defer></script>
23 changes: 23 additions & 0 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
{% include header.html %}
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>Bootstrap-checkbox</h1>
<p class="lead">{{ site.description }}</p>
<a class="btn btn-primary btn-lg m-b" href="{{ site.repo }}/archive/master.zip">Download</a>
<a class="btn btn-default btn-lg m-b" href="{{ site.repo }}">View Project on GitHub</a>
</div>

{{ content }}

<hr>
<footer>
<p>Copyright © 2013-2014 vsn4ik</p>
</footer>
</div>
</body>
</html>
20 changes: 20 additions & 0 deletions docs/assets/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
body {
padding-top: 20px;
}

footer {
padding-bottom: 10px;
}

label[for] {
cursor: pointer;
}

pre {
-moz-tab-size: 2;
tab-size: 2;
}

.m-b {
margin-bottom: 15px;
}
66 changes: 66 additions & 0 deletions docs/assets/css/pygments-manni.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.hll { background-color: #ffffcc }
/*{ background: #f0f3f3; }*/
.c { color: #999; } /* Comment */
.err { color: #AA0000; background-color: #FFAAAA } /* Error */
.k { color: #006699; } /* Keyword */
.o { color: #555555 } /* Operator */
.cm { color: #999; } /* Comment.Multiline */ /* Edited to remove italics and make into comment */
.cp { color: #009999 } /* Comment.Preproc */
.c1 { color: #999; } /* Comment.Single */
.cs { color: #999; } /* Comment.Special */
.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #FF0000 } /* Generic.Error */
.gh { color: #003300; } /* Generic.Heading */
.gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */
.go { color: #AAAAAA } /* Generic.Output */
.gp { color: #000099; } /* Generic.Prompt */
.gs { } /* Generic.Strong */
.gu { color: #003300; } /* Generic.Subheading */
.gt { color: #99CC66 } /* Generic.Traceback */
.kc { color: #006699; } /* Keyword.Constant */
.kd { color: #006699; } /* Keyword.Declaration */
.kn { color: #006699; } /* Keyword.Namespace */
.kp { color: #006699 } /* Keyword.Pseudo */
.kr { color: #006699; } /* Keyword.Reserved */
.kt { color: #007788; } /* Keyword.Type */
.m { color: #FF6600 } /* Literal.Number */
.s { color: #d44950 } /* Literal.String */
.na { color: #4f9fcf } /* Name.Attribute */
.nb { color: #336666 } /* Name.Builtin */
.nc { color: #00AA88; } /* Name.Class */
.no { color: #336600 } /* Name.Constant */
.nd { color: #9999FF } /* Name.Decorator */
.ni { color: #999999; } /* Name.Entity */
.ne { color: #CC0000; } /* Name.Exception */
.nf { color: #CC00FF } /* Name.Function */
.nl { color: #9999FF } /* Name.Label */
.nn { color: #00CCFF; } /* Name.Namespace */
.nt { color: #2f6f9f; } /* Name.Tag */
.nv { color: #003333 } /* Name.Variable */
.ow { color: #000000; } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mf { color: #FF6600 } /* Literal.Number.Float */
.mh { color: #FF6600 } /* Literal.Number.Hex */
.mi { color: #FF6600 } /* Literal.Number.Integer */
.mo { color: #FF6600 } /* Literal.Number.Oct */
.sb { color: #CC3300 } /* Literal.String.Backtick */
.sc { color: #CC3300 } /* Literal.String.Char */
.sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */
.s2 { color: #CC3300 } /* Literal.String.Double */
.se { color: #CC3300; } /* Literal.String.Escape */
.sh { color: #CC3300 } /* Literal.String.Heredoc */
.si { color: #AA0000 } /* Literal.String.Interpol */
.sx { color: #CC3300 } /* Literal.String.Other */
.sr { color: #33AAAA } /* Literal.String.Regex */
.s1 { color: #CC3300 } /* Literal.String.Single */
.ss { color: #FFCC33 } /* Literal.String.Symbol */
.bp { color: #336666 } /* Name.Builtin.Pseudo */
.vc { color: #003333 } /* Name.Variable.Class */
.vg { color: #003333 } /* Name.Variable.Global */
.vi { color: #003333 } /* Name.Variable.Instance */
.il { color: #FF6600 } /* Literal.Number.Integer.Long */

.css .o,
.css .o + .nt,
.css .nt + .nt { color: #999; }
7 changes: 7 additions & 0 deletions docs/assets/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

$(function() {
$(':checkbox').checkboxpicker({
style: 'm-b'
});
});
147 changes: 147 additions & 0 deletions docs/dist/bootstrap-checkbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/**
* Bootstrap-checkbox
* http://vsn4ik.github.io/bootstrap-checkbox
*
* Copyright 2013-2014 vsn4ik
* Licensed under the MIT License
*/

'use strict';

if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap-checkbox requires jQuery');
}

(function($) {
function Checkboxpicker(element, options) {
this.element = element;
this.$element = $(element);
this.options = $.extend({}, $.fn.checkboxpicker.defaults, options, this.$element.data());

this.$group = $('<div class="btn-group">');

// .btn-group-justified works with <a> elements as the <button> doesn't pick up the styles
this.$buttons = $('<a><a>').addClass('btn');

this.$off = this.$buttons.eq(0);
this.$on = this.$buttons.eq(1);

this.init();
}

Checkboxpicker.prototype = {
init: function() {
this.$element.prop('hidden', true);
this.$off.html(this.options.offLabel);
this.$on.html(this.options.onLabel);

if (this.element.checked) {
this.$on.addClass('active ' + this.options.onClass);
this.$off.addClass(this.options.defaultClass);
}
else {
this.$off.addClass('active ' + this.options.offClass);
this.$on.addClass(this.options.defaultClass);
}

if (this.options.style) {
this.$group.addClass(this.options.style);
}

// Attribute title (offTitle, onTitle) on this.$buttons not work (native) if this.element.disabled
if (this.element.title) {
this.$group.attr('title', this.element.title);
}
else if (!this.element.disabled) {
if (this.options.offTitle) {
this.$off.attr('title', this.options.offTitle);
}

if (this.options.onTitle) {
this.$on.attr('title', this.options.onTitle);
}
}

if (this.element.disabled) {
this.$buttons.addClass('disabled');
this.$group.css('cursor', 'not-allowed');
}
else {
this.$buttons.click(this.clicked.bind(this));
this.$element.change(this.toggle.bind(this));
this.$group.attr('tabindex', this.element.tabIndex).keydown(this.keydown.bind(this));

if (this.element.autofocus) {
this.$group.focus();
}

if (this.element.id) {
$('label[for="' + this.element.id + '"]').click(this.focus.bind(this));
}

$(this.element.form).on('reset', this.reset.bind(this));
}

this.$group.append(this.$buttons).insertAfter(this.element);
},
toggle: function() {
// this.$group not focus (incorrect on form reset)
this.$buttons.toggleClass('active ' + this.options.defaultClass);
this.$off.toggleClass(this.options.offClass);
this.$on.toggleClass(this.options.onClass);
},
focus: function() {
// Original behavior
this.$group.focus();
},
change: function() {
this.$element.prop('checked', !this.element.checked).change();
},
clicked: function(event) {
if (!$(event.target).hasClass('active')) {
this.change();
}
},
keydown: function(event) {
// 13: Return, 32: Spacebar
if (/^(13|32)$/.test(event.keyCode)) {
// Off scroll on press "Spacebar"
event.preventDefault();

this.change();
}
},
reset: function() {
// this.element.checked not used (incorect on large number of form elements)
if ((this.element.defaultChecked && this.$off.hasClass('active')) || (!this.element.defaultChecked && this.$on.hasClass('active'))) {
this.toggle();
}
}
};

$.fn.checkboxpicker = function(options) {
return this.each(function() {
var $this = $(this);
var data = $this.data('checkboxpicker');

if (!data) {
new Checkboxpicker(this, options);

$this.data('checkboxpicker', true);
}
});
};

// HTML5 data-*.
// <input data-on-label="43"> --> $('input').data('onLabel') == '43'.
$.fn.checkboxpicker.defaults = {
style: false,
defaultClass: 'btn-default',
offClass: 'btn-danger',
onClass: 'btn-success',
offLabel: 'No',
onLabel: 'Yes',
offTitle: false,
onTitle: false
};
})(jQuery);
14 changes: 14 additions & 0 deletions docs/dist/bootstrap-checkbox.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8e32167

Please sign in to comment.