added site files

This commit is contained in:
gribse 2025-05-16 18:49:08 +02:00
parent a6f70a6c78
commit 329148c253
253 changed files with 30486 additions and 0 deletions

View file

@ -0,0 +1,275 @@
/*!
---
name: GitHub-Buttons for MooTools, jQuery and PHP
description: Unofficial GitHub Buttons based on https://github.com/mdo/github-buttons
license: Apache 2.0 License
version: 2.5.0
build: 54ff1b657e537f8107ee7373e0bfeeeb/May 6 2015
authors:
- Andi Dittrich (author of MooTools/jQuery/PHP based versions)
- Mark Otto (author of original github-buttons styles)
download: https://github.com/AndiDittrich/MooTools.GitHub-Buttons
website: http://github-buttons.andidittrich.de
demo: http://github-buttons.andidittrich.de
requires:
- Core/1.4.5
- More/Number.Format
- More/Request.JSONP
provides: [GitHubButton]
...
*//*
---
name: GitHub-Buttons
description: Unofficial GitHub Buttons inspired by https://github.com/mdo/github-buttons
license: Dual-Licensed under "The MIT License (X11)" and "Apache 2.0 License"
authors:
- Andi Dittrich
requires:
- Core/1.4.5
- More/Number.Format
- More/Request.JSONP
provides: [GitHubButton]
...
*/
var GitHubButton = new Class({
Implements: Options,
// contains the required html structure
buttonContainer: null,
options: {
// large or small button ?
large: false,
// GitHub username
owner: null,
// GitHub repository name
repo: null,
// Button type (star, fork, watch, follow)
type: 'star',
// custom button text
text: null,
// enabled/disable counter - manual set the value
count: true,
// enable/disable caching
cache: true,
// cache lifetime in seconds (2h default)
cacheLifetime: 7200,
// error text/count
errorText: 'NA'
},
initialize: function(options){
this.setOptions(options);
// jsonp rest service url
var url = 'https://api.github.com';
// create repo url
var repoUrl = 'https://github.com/' + this.options.owner + '/' + this.options.repo + '/';
var actionUrl = 'https://github.com/' + this.options.owner + '/';
// text to display
var text = '-';
// response object selector
var responseSelector = '';
// star, fork, follow, watch are supported
switch (this.options.type){
case 'star':
url += '/repos/' + this.options.owner + '/' + this.options.repo;
text = 'Star';
actionUrl = repoUrl + 'stargazers';
responseSelector = 'stargazers_count';
break;
case 'fork':
url += '/repos/' + this.options.owner + '/' + this.options.repo;
text = 'Fork';
actionUrl = repoUrl + 'network';
responseSelector = 'forks_count';
break;
case 'watch':
url += '/repos/' + this.options.owner + '/' + this.options.repo;
actionUrl += this.options.repo + '/watchers';
text = 'Watchers';
responseSelector = 'subscribers_count';
break;
case 'follow':
url += '/users/' + this.options.owner;
text = 'Follow @' + this.options.owner;
repoUrl = actionUrl;
actionUrl += 'followers';
responseSelector = 'followers';
break;
}
// create html structure
// @see https://github.com/mdo/github-buttons/blob/master/github-btn.source.html
// <span class="github-btn" id="github-btn">
// <a class="gh-btn" id="gh-btn" href="#" target="_blank">
// <span class="gh-ico"></span>
// <span class="gh-text" id="gh-text"></span>
// </a>
// <a class="gh-count" id="gh-count" href="#" target="_blank"></a>
// </span>
// create elements
this.buttonContainer = new Element('div', {
'class': 'github-btn ' + (this.options.large ? 'github-btn-large' : '')
});
var count = new Element('a', {
'class': 'gh-count',
href: actionUrl,
target: '_blank'
});
var ico = new Element('span', {
'class': 'gh-ico'
});
var txt = new Element('span', {
'class': 'gh-text',
text: (this.options.text ? this.options.text : text)
});
var button = new Element('a', {
'class': 'gh-btn',
href: repoUrl,
target: '_blank'
});
// create structure
button.grab(ico).grab(txt);
this.buttonContainer.grab(button).grab(count);
// which "count"-mode should be used ?
if (typeof this.options.count == 'boolean'){
// show count and request the data via JSONP ?
if (this.options.count){
// cache instance name
var cacheName = 'GHB_' + this.options.type + '_' + this.options.owner + '_' + this.options.repo + '_' + responseSelector;
// cache version available ?
if (this.options.cache === true){
var cdata = this.retrieveItem(cacheName, this.options.cacheLifetime);
if (cdata){
// update text
count.set('text', cdata.format({group: '.'}));
return;
}
}
// request data
new Request.JSONP({
// the rest service url
url: url,
// jsonp callback get parameter
// @see https://developer.github.com/v3/#json-p-callbacks
callbackKey: 'callback',
// request complete handler
onComplete: function(response){
// valid reponse ? request limit not exceeeded ?
if (response.data && response.data[responseSelector]){
// extract count
var cnt = response.data[responseSelector];
// update text
count.set('text', cnt.format({group: '.'}));
// update cache
if (this.options.cache === true){
this.storeItem(cacheName, cnt);
}
// set error text
}else{
count.set('text', this.options.errorText);
}
}.bind(this)
}).send();
}else{
// hide counter
count.setStyle('display', 'none');
}
}else{
// manually set the value
count.set('text', this.options.count.format({group: '.'}));
}
},
// magic method to use class instance as element
toElement: function(){
return this.buttonContainer;
},
// use local storage as cache
storeItem: function(name, data){
// generate storage data
var d = JSON.encode({
time: (new Date().getTime()),
payload: data
});
// try to use html5 features
if (typeof(Storage) !== "undefined"){
localStorage.setItem(name, d);
}
},
// use local storage as cache
retrieveItem: function(name, cacheLifetime){
// try to use html5 features
if (typeof(Storage) !== "undefined"){
// get item
var ls = localStorage.getItem(name);
// available ?
if (!ls){
return null;
}
// decode json serialized data
ls = JSON.decode(ls);
// lifetime expired ?
if (!ls.time || (ls.time + (cacheLifetime*1000)) < (new Date().getTime())){
return null;
}
// valid payload ?
return (ls.payload ? ls.payload : null);
}else{
return null;
}
}
});
// Native Element extension - jQuery like usage
(function(){
Element.implement({
GitHubButton: function(options){
this.grab(new GitHubButton(options));
}
});
})();

View file

@ -0,0 +1,189 @@
/*!
---
name: GitHub-Buttons for MooTools, jQuery and PHP
description: Unofficial GitHub Buttons based on https://github.com/mdo/github-buttons
license: Apache 2.0 License
version: 2.5.0
build: 5dbc39345334d0b03ad0b90960943efb/May 6 2015
authors:
- Andi Dittrich (author of MooTools/jQuery/PHP based versions)
- Mark Otto (author of original github-buttons styles)
download: https://github.com/AndiDittrich/MooTools.GitHub-Buttons
website: http://github-buttons.andidittrich.de
demo: http://github-buttons.andidittrich.de
requires:
- Core/1.4.5
- More/Number.Format
- More/Request.JSONP
provides: [GitHubButton]
...
*//*
---
description: GitHub-Buttons Styles - Improved for use within own pages
license: Apache 2.0 License
authors:
- Mark Otto
- github-buttons contributors (https://github.com/mdo/github-buttons)
- Andi Dittrich
...
*/
.github-btn {
display: block;
position: relative;
height: 20px;
font: bold 11px/14px "Helvetica Neue", Helvetica, Arial, sans-serif;
overflow: hidden;
}
.gh-btn,.gh-count,.gh-ico {
float: left;
}
.gh-btn,.gh-count {
padding: 2px 5px 2px 4px;
color: #333;
text-decoration: none;
text-shadow: 0 1px 0 #fff;
white-space: nowrap;
cursor: pointer;
border-radius: 3px;
}
.gh-btn {
background-color: #e6e6e6;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fafafa),
to(#eaeaea));
background-image: -webkit-linear-gradient(#fafafa, #eaeaea);
background-image: -moz-linear-gradient(top, #fafafa, #eaeaea);
background-image: -ms-linear-gradient(#fafafa, #eaeaea);
background-image: -o-linear-gradient(#fafafa, #eaeaea);
background-image: linear-gradient(#fafafa, #eaeaea);
background-repeat: no-repeat;
border: 1px solid #d4d4d4;
border-bottom-color: #bcbcbc;
}
.gh-btn:hover,.gh-btn:focus,.gh-btn:active {
color: #fff;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
border-color: #518cc6 #518cc6 #2a65a0;
background-color: #3072b3;
}
.gh-btn:hover,.gh-btn:focus {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#599bdc),
to(#3072b3));
background-image: -webkit-linear-gradient(#599bdc, #3072b3);
background-image: -moz-linear-gradient(top, #599bdc, #3072b3);
background-image: -ms-linear-gradient(#599bdc, #3072b3);
background-image: -o-linear-gradient(#599bdc, #3072b3);
background-image: linear-gradient(#599bdc, #3072b3);
}
.gh-btn:active {
background-image: none;
-webkit-box-shadow: inset 0 2px 5px rgba(0, 0, 0, .10);
-moz-box-shadow: inset 0 2px 5px rgba(0, 0, 0, .10);
box-shadow: inset 0 2px 5px rgba(0, 0, 0, .10);
}
.gh-ico {
width: 14px;
height: 14px;
margin-right: 4px;
vertical-align: 3px;
background-image:
url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uO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WMwLDAuOSwwLjYsMS45LDIuMiwxLjVjMTIuNy00LjIsMjEuOS0xNi4yLDIxLjktMzAuNEMxMzEsMTYuMSwxMTYuNywxLjgsOTksMS44eiIvPg0KPC9zdmc+DQo=);
background-size: 28px 14px;
background-repeat: no-repeat;
background-position: 0 0;
}
.gh-btn:hover .gh-ico,.gh-btn:focus .gh-ico,.gh-btn:active .gh-ico {
background-position: -14px 0;
}
.gh-count {
position: relative;
display: block;
margin-left: 4px;
background-color: #fafafa;
border: 1px solid #d4d4d4;
}
.gh-count:hover,.gh-count:focus {
color: #4183C4;
}
.gh-count:before,.gh-count:after {
content: '';
position: absolute;
display: inline-block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.gh-count:before {
top: 50%;
left: -3px;
margin-top: -4px;
border-width: 4px 4px 4px 0;
border-right-color: #fafafa;
}
.gh-count:after {
top: 50%;
left: -4px;
z-index: -1;
margin-top: -5px;
border-width: 5px 5px 5px 0;
border-right-color: #d4d4d4;
}
.github-btn-large {
height: 30px;
}
.github-btn-large .gh-btn,.github-btn-large .gh-count {
padding: 3px 10px 3px 8px;
font-size: 16px;
line-height: 22px;
border-radius: 4px;
}
.github-btn-large .gh-ico {
width: 20px;
height: 20px;
background-size: 40px 20px;
}
.github-btn-large .gh-btn:hover .gh-ico,.github-btn-large .gh-btn:focus .gh-ico,.github-btn-large .gh-btn:active .gh-ico
{
background-position: -20px 0;
}
.github-btn-large .gh-count {
margin-left: 6px;
}
.github-btn-large .gh-count:before {
left: -5px;
margin-top: -6px;
border-width: 6px 6px 6px 0;
}
.github-btn-large .gh-count:after {
left: -6px;
margin-top: -7px;
border-width: 7px 7px 7px 0;
}

View file

@ -0,0 +1,13 @@
Copyright 2014 Mark Otto, 2014-2015 Andi Dittrich
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.