mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 04:40:09 +01:00
commit
906b750e23
3
.gitignore
vendored
3
.gitignore
vendored
@ -166,4 +166,5 @@ pip-log.txt
|
||||
.config
|
||||
|
||||
#jekyll
|
||||
_site
|
||||
_site
|
||||
node_modules
|
@ -11,5 +11,16 @@
|
||||
</footer>
|
||||
|
||||
</div><!-- /container -->
|
||||
|
||||
<script type="text/javascript" src="/javascripts/jquery-1.7.1.min.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/jquery.qtip.min.js"></script>
|
||||
|
||||
{% if page.layout == "license" %}
|
||||
<script type="text/javascript" src="/javascripts/ZeroClipboard.js"></script>
|
||||
{% endif %}
|
||||
|
||||
<script type="text/javascript" src="/javascripts/annotations.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/app.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,24 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang='en'>
|
||||
<head>
|
||||
|
||||
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title}}</title>
|
||||
|
||||
<meta charset='utf-8'>
|
||||
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
|
||||
|
||||
<link href='/favicon.ico' rel='shortcut icon' type='image/x-icon'>
|
||||
<link href='http://fonts.googleapis.com/css?family=Chivo:900' rel='stylesheet' type='text/css'>
|
||||
<link type="text/css" href="/css/application.css" media="screen" rel="stylesheet">
|
||||
<link type="text/css" href="/css/jquery.qtip.css" media="screen" rel="stylesheet">
|
||||
<script type="text/javascript" src="/javascripts/jquery-1.7.1.min.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/annotations.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/app.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/jquery.qtip.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="/javascripts/modernizr.js"></script>
|
||||
|
||||
{% if page.layout == "license" %}
|
||||
<script type="text/javascript" src="/javascripts/clipboard.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/ZeroClipboard.js"></script>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<!--[if (gte IE 6)&(lte IE 8)]>
|
||||
<script src='/javascripts/selectivizr-min.js' type='text/javascript'></script>
|
||||
<![endif]-->
|
||||
@ -31,4 +26,4 @@
|
||||
|
||||
{% if page.title %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
File diff suppressed because one or more lines are too long
62
javascripts/app.coffee
Normal file
62
javascripts/app.coffee
Normal file
@ -0,0 +1,62 @@
|
||||
class Choosealicense
|
||||
|
||||
# Qtip position attributes for tooltips
|
||||
qtip_position:
|
||||
my: "top center"
|
||||
at: "bottom center"
|
||||
|
||||
# Annotation categories as defined in `_config.yml`
|
||||
categories:
|
||||
required: "Required"
|
||||
permitted: "Permitted"
|
||||
forbidden: "Forbidden"
|
||||
|
||||
# fire on document.ready
|
||||
constructor: ->
|
||||
@initTooltips()
|
||||
@initClipboard() if ZeroClipboard?
|
||||
|
||||
# Init tooltip action
|
||||
initTooltips: ->
|
||||
|
||||
# Dynamically add annotations as title attribute to rule list items
|
||||
for category, rules of annotations
|
||||
for label, text of rules
|
||||
$(".license-rules ul.license-#{category} li.#{label}").attr "title", text
|
||||
|
||||
# Init tooltips on all rule list items
|
||||
for category, label of @categories
|
||||
$(".license-#{category} li").qtip
|
||||
content:
|
||||
text: false
|
||||
title:
|
||||
text: label
|
||||
position: @qtip_position
|
||||
style:
|
||||
classes: "qtip-shadow qtip-#{category}"
|
||||
|
||||
false
|
||||
|
||||
# if Zero Clipboard is present, bind to button and init
|
||||
initClipboard: ->
|
||||
|
||||
# Backup the clipboard button's original text.
|
||||
$(".js-clipboard-button").data "clipboard-prompt", $(".js-clipboard-button").text()
|
||||
|
||||
# Hook up copy to clipboard buttons
|
||||
clip = new ZeroClipboard $(".js-clipboard-button"),
|
||||
moviePath: "/javascripts/ZeroClipboard.swf"
|
||||
clip.on "mouseout", @clipboardMouseout
|
||||
clip.on "complete", @clipboardComplete
|
||||
clip
|
||||
|
||||
# Callback to restore the clipboard button's original text
|
||||
clipboardMouseout: (client, args) ->
|
||||
@innerText = $(this).data("clipboard-prompt")
|
||||
|
||||
# Post-copy user feedback callback
|
||||
clipboardComplete: (client, args) ->
|
||||
@innerText = "Copied!"
|
||||
|
||||
$ ->
|
||||
new Choosealicense()
|
@ -1,52 +1,81 @@
|
||||
var qtip_position = {
|
||||
my: 'top center',
|
||||
at: 'bottom center'
|
||||
};
|
||||
// Generated by CoffeeScript 1.6.2
|
||||
(function() {
|
||||
var Choosealicense;
|
||||
|
||||
$(document).ready(function() {
|
||||
for (var category in annotations) {
|
||||
var categoryAnnotations = annotations[category];
|
||||
for (var annotation in categoryAnnotations) {
|
||||
$('.license-rules ul.license-' + category + ' li.' + annotation).attr('title', categoryAnnotations[annotation]);
|
||||
}
|
||||
}
|
||||
Choosealicense = (function() {
|
||||
Choosealicense.prototype.qtip_position = {
|
||||
my: "top center",
|
||||
at: "bottom center"
|
||||
};
|
||||
|
||||
$('.license-required li').qtip({
|
||||
content: {
|
||||
text: false,
|
||||
title: {
|
||||
text: 'Required'
|
||||
Choosealicense.prototype.categories = {
|
||||
required: "Required",
|
||||
permitted: "Permitted",
|
||||
forbidden: "Forbidden"
|
||||
};
|
||||
|
||||
function Choosealicense() {
|
||||
this.initTooltips();
|
||||
if (typeof ZeroClipboard !== "undefined" && ZeroClipboard !== null) {
|
||||
this.initClipboard();
|
||||
}
|
||||
},
|
||||
position: qtip_position,
|
||||
style: {
|
||||
classes: 'qtip-shadow qtip-required'
|
||||
}
|
||||
|
||||
Choosealicense.prototype.initTooltips = function() {
|
||||
var category, label, rules, text, _ref;
|
||||
|
||||
for (category in annotations) {
|
||||
rules = annotations[category];
|
||||
for (label in rules) {
|
||||
text = rules[label];
|
||||
$(".license-rules ul.license-" + category + " li." + label).attr("title", text);
|
||||
}
|
||||
}
|
||||
_ref = this.categories;
|
||||
for (category in _ref) {
|
||||
label = _ref[category];
|
||||
$(".license-" + category + " li").qtip({
|
||||
content: {
|
||||
text: false,
|
||||
title: {
|
||||
text: label
|
||||
}
|
||||
},
|
||||
position: this.qtip_position,
|
||||
style: {
|
||||
classes: "qtip-shadow qtip-" + category
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Choosealicense.prototype.initClipboard = function() {
|
||||
var clip;
|
||||
|
||||
$(".js-clipboard-button").data("clipboard-prompt", $(".js-clipboard-button").text());
|
||||
clip = new ZeroClipboard($(".js-clipboard-button"), {
|
||||
moviePath: "/javascripts/ZeroClipboard.swf"
|
||||
});
|
||||
clip.on("mouseout", this.clipboardMouseout);
|
||||
clip.on("complete", this.clipboardComplete);
|
||||
return clip;
|
||||
};
|
||||
|
||||
Choosealicense.prototype.clipboardMouseout = function(client, args) {
|
||||
return this.innerText = $(this).data("clipboard-prompt");
|
||||
};
|
||||
|
||||
Choosealicense.prototype.clipboardComplete = function(client, args) {
|
||||
return this.innerText = "Copied!";
|
||||
};
|
||||
|
||||
return Choosealicense;
|
||||
|
||||
})();
|
||||
|
||||
$(function() {
|
||||
return new Choosealicense();
|
||||
});
|
||||
|
||||
$('.license-permitted li').qtip({
|
||||
content: {
|
||||
text: false,
|
||||
title: {
|
||||
text: 'Permitted'
|
||||
}
|
||||
},
|
||||
position: qtip_position,
|
||||
style: {
|
||||
classes: 'qtip-shadow qtip-permitted'
|
||||
}
|
||||
});
|
||||
|
||||
$('.license-forbidden li').qtip({
|
||||
content: {
|
||||
text: false,
|
||||
title: {
|
||||
text: 'Forbidden'
|
||||
}
|
||||
},
|
||||
position: qtip_position,
|
||||
style: {
|
||||
classes: 'qtip-shadow qtip-forbidden'
|
||||
}
|
||||
});
|
||||
});
|
||||
}).call(this);
|
||||
|
@ -1,20 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
// Backup the clipboard button's original text.
|
||||
$(".js-clipboard-button").data('clipboard-prompt', $('.js-clipboard-button').text());
|
||||
|
||||
// Hook up copy to clipboard buttons
|
||||
var clip = new ZeroClipboard($(".js-clipboard-button"), {
|
||||
moviePath: "../../javascripts/ZeroClipboard.swf"
|
||||
});
|
||||
|
||||
clip.on('mouseover', function(client, args) {
|
||||
// Restore the clipboard button's original text.
|
||||
this.innerText = $(this).data('clipboard-prompt');
|
||||
});
|
||||
|
||||
clip.on('complete', function(client, args) {
|
||||
this.innerText = 'Copied!';
|
||||
});
|
||||
|
||||
});
|
@ -5,5 +5,8 @@ set -e
|
||||
echo "bundling installin'"
|
||||
bundle install
|
||||
|
||||
echo "npm installin'"
|
||||
npm install coffee-script
|
||||
|
||||
echo
|
||||
echo "You're all set. Just run script/server and you can play license roulette!"
|
@ -2,6 +2,9 @@
|
||||
|
||||
set -e
|
||||
|
||||
echo "compiling javascript..."
|
||||
coffee -c javascripts/app.coffee
|
||||
|
||||
echo "spinning up the server..."
|
||||
bundle exec jekyll serve -w
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user