mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
support firefox 3.6 - 4.0
and clean up some css
This commit is contained in:
parent
f8be865184
commit
b01096280d
5 changed files with 205 additions and 88 deletions
111
proj/gitter.js
111
proj/gitter.js
|
|
@ -9,6 +9,107 @@
|
|||
// - authentication and write APIs
|
||||
|
||||
(function() {
|
||||
var inherits
|
||||
if ('create' in Object) {
|
||||
// util.inherits from node
|
||||
inherits = function(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
inherits = function(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype.__proto__ = superCtor.prototype
|
||||
ctor.prototype.constructor = ctor
|
||||
}
|
||||
}
|
||||
|
||||
if (!Array.isArray) {
|
||||
Array.isArray = function(x) {
|
||||
return Object.prototype.toString.call(x) === '[object Array]'
|
||||
}
|
||||
}
|
||||
|
||||
// Object.defineProperty and Object.keys from Kris Kowal's es5-shim
|
||||
// https://github.com/kriskowal/es5-shim
|
||||
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
|
||||
// ES5 15.2.3.6
|
||||
if (!Object.defineProperty) {
|
||||
Object.defineProperty = function(object, property, descriptor) {
|
||||
if (typeof descriptor == "object" && object.__defineGetter__) {
|
||||
if (has.call(descriptor, "value")) {
|
||||
if (!object.__lookupGetter__(property) && !object.__lookupSetter__(property))
|
||||
// data property defined and no pre-existing accessors
|
||||
object[property] = descriptor.value;
|
||||
if (has.call(descriptor, "get") || has.call(descriptor, "set"))
|
||||
// descriptor has a value property but accessor already exists
|
||||
throw new TypeError("Object doesn't support this action");
|
||||
}
|
||||
// fail silently if "writable", "enumerable", or "configurable"
|
||||
// are requested but not supported
|
||||
else if (typeof descriptor.get == "function")
|
||||
object.__defineGetter__(property, descriptor.get);
|
||||
if (typeof descriptor.set == "function")
|
||||
object.__defineSetter__(property, descriptor.set);
|
||||
}
|
||||
return object;
|
||||
};
|
||||
}
|
||||
// ES5 15.2.3.14
|
||||
// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
|
||||
if (!Object.keys) {
|
||||
(function() {
|
||||
var hasDontEnumBug = true,
|
||||
dontEnums = [
|
||||
'toString',
|
||||
'toLocaleString',
|
||||
'valueOf',
|
||||
'hasOwnProperty',
|
||||
'isPrototypeOf',
|
||||
'propertyIsEnumerable',
|
||||
'constructor'
|
||||
],
|
||||
dontEnumsLength = dontEnums.length;
|
||||
|
||||
for (var key in {"toString": null})
|
||||
hasDontEnumBug = false;
|
||||
|
||||
Object.keys = function (object) {
|
||||
|
||||
if (
|
||||
typeof object !== "object" && typeof object !== "function"
|
||||
|| object === null
|
||||
)
|
||||
throw new TypeError("Object.keys called on a non-object");
|
||||
|
||||
var keys = [];
|
||||
for (var name in object) {
|
||||
if (has.call(object, name)) {
|
||||
keys.push(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDontEnumBug) {
|
||||
for (var i = 0, ii = dontEnumLength; i < ii; i++) {
|
||||
var dontEnum = dontEnums[i];
|
||||
if (has.call(o, dontEnum)) {
|
||||
keys.push(dontEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
}())
|
||||
}
|
||||
|
||||
var global = this
|
||||
, isBrowser = 'document' in global
|
||||
// when running in the browser request is set later
|
||||
|
|
@ -317,16 +418,6 @@
|
|||
Object.defineProperty(obj, prop, opts)
|
||||
}
|
||||
|
||||
// util.inherits from node
|
||||
function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false
|
||||
}
|
||||
})
|
||||
}
|
||||
// get an only property, if any
|
||||
function onlyProp(obj) {
|
||||
if (obj && typeof obj === 'object') {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<link rel=stylesheet href=../style.css>
|
||||
<style>
|
||||
#gh { text-align: center }
|
||||
#gh img { border: 0 }
|
||||
span { padding: 5px }
|
||||
</style>
|
||||
<script>
|
||||
|
|
@ -23,29 +24,42 @@
|
|||
<script src=gitter.js></script>
|
||||
<script src=store.js></script>
|
||||
<script>
|
||||
(function() {
|
||||
function addClass(el, name) {
|
||||
var c = el.className || name
|
||||
if (!c.match(new RegExp('\b' + name + '\b', 'i'))) c += ' ' + name
|
||||
}
|
||||
function text(id, text) {
|
||||
document.getElementById(id).innerText = text
|
||||
}
|
||||
function highlight(id) {
|
||||
document.getElementById(id).style.className = ' highlight'
|
||||
}
|
||||
function textHighlight(id, text) {
|
||||
var el = document.getElementById(id)
|
||||
el.innerText = text
|
||||
el.className = ' highlight'
|
||||
}
|
||||
function updateN(name, things) {
|
||||
textHighlight('n' + name, things.length)
|
||||
}
|
||||
if (typeof console === 'undefined') {
|
||||
console = {log:function(){}}
|
||||
}
|
||||
|
||||
(function() {
|
||||
document.addEventListener('DOMContentLoaded', ready, false)
|
||||
|
||||
function ready() {
|
||||
function addClass(el, name) {
|
||||
var c = el.className || name
|
||||
if (!c.match(new RegExp('\b' + name + '\b', 'i'))) c += ' ' + name
|
||||
}
|
||||
|
||||
var body = document.getElementsByTagName('body')[0]
|
||||
, text
|
||||
if ('innerText' in body) {
|
||||
text = function(id, text) {
|
||||
document.getElementById(id).innerText = text
|
||||
}
|
||||
} else {
|
||||
text = function(id, text) {
|
||||
document.getElementById(id).textContent = text
|
||||
}
|
||||
}
|
||||
|
||||
function highlight(id) {
|
||||
document.getElementById(id).style.className = ' highlight'
|
||||
}
|
||||
function textHighlight(id, t) {
|
||||
text(id, t)
|
||||
document.getElementById(id).className = ' highlight'
|
||||
}
|
||||
function updateN(name, things) {
|
||||
textHighlight('n' + name, things.length)
|
||||
}
|
||||
|
||||
var t = ObjectStore.get('t-proj')
|
||||
, names = ['followers', 'following', 'repos', 'watched']
|
||||
if (!t || +new Date() - t > 86400000) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
#forkme { position: absolute
|
||||
; top: 0
|
||||
; right: 0
|
||||
}
|
||||
|
||||
#info { text-align: center
|
||||
; margin: 1em auto
|
||||
; padding: 1em
|
||||
|
|
@ -30,7 +25,7 @@ h4 { margin: 0.5em 0 0.7em }
|
|||
|
||||
#info div:last-child { clear: both
|
||||
; float: none
|
||||
; border: none
|
||||
; border: 0
|
||||
; height: 0
|
||||
; width: 0
|
||||
; padding: 0
|
||||
|
|
|
|||
113
proj/proj.js
113
proj/proj.js
|
|
@ -1,61 +1,74 @@
|
|||
(function() {
|
||||
function addClass(el, name) {
|
||||
var c = el.className || name
|
||||
if (!c.match(new RegExp('\b' + name + '\b', 'i'))) c += ' ' + name
|
||||
if (typeof console === 'undefined') {
|
||||
console = {log:function(){}}
|
||||
}
|
||||
function html(id, h) {
|
||||
document.getElementById(id).innerHTML = h
|
||||
}
|
||||
function text(id, text) {
|
||||
document.getElementById(id).innerText = text
|
||||
}
|
||||
function highlight(id) {
|
||||
document.getElementById(id).style.className = ' highlight'
|
||||
}
|
||||
function textHighlight(id, text) {
|
||||
var el = document.getElementById(id)
|
||||
el.innerText = text
|
||||
el.className = ' highlight'
|
||||
}
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none'
|
||||
}
|
||||
|
||||
function langsByUsage(langs) {
|
||||
return Object.keys(langs).sort(function(a, b) {
|
||||
return langs[a] < langs[b] ? -1 : 1
|
||||
})
|
||||
}
|
||||
|
||||
function updateBranches(name, branches) {
|
||||
function branchLink(b) {
|
||||
return '<a href=https://github.com/samsonjs/' + name + '/tree/' + b + '>' + b + '</a>'
|
||||
}
|
||||
html('branches', Object.keys(branches).map(branchLink).join('<br>'))
|
||||
}
|
||||
|
||||
function updateContributors(contributors) {
|
||||
function userLink(u) {
|
||||
return '<a href=https://github.com/' + u.login + '>' + u.name + '</a>'
|
||||
}
|
||||
html('contributors', contributors.map(userLink).join('<br>'))
|
||||
}
|
||||
|
||||
function updateLangs(langs) {
|
||||
html('langs', langsByUsage(langs).join('<br>'))
|
||||
}
|
||||
|
||||
function updateN(name, things) {
|
||||
textHighlight('n' + name, things.length)
|
||||
if (things.length === 1) hide(name.charAt(0) + 'plural')
|
||||
}
|
||||
|
||||
|
||||
var global = this
|
||||
global.SJS = {
|
||||
proj: function(name) {
|
||||
var data = createObjectStore(name)
|
||||
document.addEventListener('DOMContentLoaded', ready, false)
|
||||
function ready() {
|
||||
function addClass(el, name) {
|
||||
var c = el.className || name
|
||||
if (!c.match(new RegExp('\b' + name + '\b', 'i'))) c += ' ' + name
|
||||
}
|
||||
function html(id, h) {
|
||||
document.getElementById(id).innerHTML = h
|
||||
}
|
||||
|
||||
var body = document.getElementsByTagName('body')[0]
|
||||
, text
|
||||
if ('innerText' in body) {
|
||||
text = function(id, text) {
|
||||
document.getElementById(id).innerText = text
|
||||
}
|
||||
} else {
|
||||
text = function(id, text) {
|
||||
document.getElementById(id).textContent = text
|
||||
}
|
||||
}
|
||||
|
||||
function highlight(id) {
|
||||
document.getElementById(id).style.className = ' highlight'
|
||||
}
|
||||
function textHighlight(id, t) {
|
||||
text(id, t)
|
||||
document.getElementById(id).className = ' highlight'
|
||||
}
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none'
|
||||
}
|
||||
|
||||
function langsByUsage(langs) {
|
||||
return Object.keys(langs).sort(function(a, b) {
|
||||
return langs[a] < langs[b] ? -1 : 1
|
||||
})
|
||||
}
|
||||
|
||||
function updateBranches(name, branches) {
|
||||
function branchLink(b) {
|
||||
return '<a href=https://github.com/samsonjs/' + name + '/tree/' + b + '>' + b + '</a>'
|
||||
}
|
||||
html('branches', Object.keys(branches).map(branchLink).join('<br>'))
|
||||
}
|
||||
|
||||
function updateContributors(contributors) {
|
||||
function userLink(u) {
|
||||
return '<a href=https://github.com/' + u.login + '>' + u.name + '</a>'
|
||||
}
|
||||
html('contributors', contributors.map(userLink).join('<br>'))
|
||||
}
|
||||
|
||||
function updateLangs(langs) {
|
||||
html('langs', langsByUsage(langs).join('<br>'))
|
||||
}
|
||||
|
||||
function updateN(name, things) {
|
||||
textHighlight('n' + name, things.length)
|
||||
if (things.length === 1) hide(name.charAt(0) + 'plural')
|
||||
}
|
||||
|
||||
var t = data.get('t-' + name)
|
||||
if (!t || +new Date() - t > 86400000) {
|
||||
console.log('stale ' + String(t))
|
||||
|
|
|
|||
10
style.css
10
style.css
|
|
@ -24,7 +24,7 @@ a { color: #22a
|
|||
; border-bottom: dashed 1px #22a
|
||||
}
|
||||
|
||||
a.img { border: none }
|
||||
a.img { border: 0 }
|
||||
|
||||
#breadcrumbs { font-size: 1.5em
|
||||
; color: #222
|
||||
|
|
@ -35,7 +35,7 @@ a.img { border: none }
|
|||
|
||||
#breadcrumbs a { text-shadow: none
|
||||
; color: #222
|
||||
; border: none
|
||||
; border: 0
|
||||
; text-decoration: underline
|
||||
}
|
||||
|
||||
|
|
@ -56,6 +56,7 @@ li { display: inline
|
|||
; margin: 0
|
||||
; padding: 0
|
||||
}
|
||||
|
||||
li:after { content: ' •' }
|
||||
li:last-child:after { content: '' }
|
||||
|
||||
|
|
@ -80,12 +81,15 @@ li a:active { color: #000
|
|||
#forkme { position: absolute
|
||||
; top: 0
|
||||
; right: 0
|
||||
; border: 0
|
||||
}
|
||||
|
||||
p#promote-js { margin-top: 3em
|
||||
#promote-js { margin-top: 3em
|
||||
; text-align: center
|
||||
}
|
||||
|
||||
#promote-js img { border: 0 }
|
||||
|
||||
td { font-size: 1.5em
|
||||
; line-height: 1.6em
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue