-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.html
100 lines (95 loc) · 3.19 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE HTML>
<html>
<head>
<title>License Selector</title>
<style>
pre {
display: block;
padding: 9px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
.cc-by {
border-color: #c80000 !important;
}
</style>
</head>
<body>
<h1>License Selector</h1>
<p>If you see this without closing the License Selector please reload the page.</p>
<!-- dependencies -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script>
<!-- implementation -->
<script type="text/javascript">
$(function() {
var clarinLs, ls = $('<p><a href="#!">Click to open selector</a></p>')
.appendTo('body')
.licenseSelector({
showLabels : true,
onLicenseSelected : function (license) {
$('body').append($('<pre></pre>').text(JSON.stringify(license, null, 4)))
console.log(license)
}
});
// Add selector for CLARIN only if it exists
if ($.fn.clarinLicenseSelector) {
clarinLs = $('<p><a href="#!">Click to open selector for CLARIN</a></p>')
.appendTo('body')
.clarinLicenseSelector({
onLicenseSelected : function (license) {
$('body').append($('<pre></pre>').text(JSON.stringify(license, null, 4)))
console.log(license)
}
});
}
if (clarinLs && window.location.hash == '#clarin') {
clarinLs.click();
} else {
ls.click();
}
$('<p><a href="#!">Click to open selector with modified options</a></p>')
.appendTo('body')
.licenseSelector({
licenses: {
'abc-license': {
name: 'ABC license',
priority: 1,
available: true,
url: 'http://www.example.com/abc-license',
description: 'This is ABC license inserted as a test',
template: function($el, license, selectFunction) {
var h = $('<h4 />').text(license.name);
h.append($('<a/>').attr({
href: license.url,
target: '_blank'
}));
//$el.click(selectFunction);
$el.append(h);
$el.append('<p>Custom template function</p>');
$el.append($('<button/>').append('<span>Click here to select license</span>').click(selectFunction));
},
categories: ['data', 'abc']
},
'cc-by': {
description: 'Modified description ...',
cssClass: 'cc-by'
}
},
start: 'DataCopyrightable',
onLicenseSelected : function (license) {
$('body').append($('<pre></pre>').text(JSON.stringify(license, null, 4)))
console.log(license)
}
});
});
</script>
</body>
</html>