first commit

This commit is contained in:
Sami Samhuri 2010-05-31 23:37:24 -07:00
commit 9f5ab226f6
4 changed files with 79 additions and 0 deletions

53
biggist.user.js Normal file
View file

@ -0,0 +1,53 @@
// ==UserScript==
// @match http://gist.github.com/*
// ==/UserScript==
//
// @_sjs
// isc license
var mapClass = function(klass, fn) {
var els = document.getElementsByClassName(klass)
for (var i = 0, n = els.length; i < n; ++i) fn(els[i])
}
, hideClass = function(klass) {
mapClass(klass, function(el) {
el._previousDisplay = el.style.display
el.style.display = 'none'
})
}
, showClass = function(klass) {
mapClass(klass, function(el) {
el.style.display = el._previousDisplay || 'block'
})
}
, embiggen = function(klass) {
mapClass(klass, function(el) {
['Width', 'Margin', 'Padding'].forEach(function(style) {
el['_previous' + style] = el.style[style.toLowerCase()]
})
el.style.width = 'auto'
el.style.margin = '0'
el.style.padding = '0'
})
}
, unembiggen = function(klass) {
mapClass(klass, function(el) {
['Width', 'Margin', 'Padding'].forEach(function(style) {
el.style[style.toLowerCase()] = el['_previous' + style]
})
})
}
, embiggenClassByHidingClass = function(classToAttach, classToHide) {
mapClass(classToAttach, function(el) {
el.onmouseover = function() {
hideClass(classToHide)
embiggen(classToAttach)
}
el.onmouseout = function() {
showClass(classToHide)
unembiggen(classToAttach)
}
})
}
embiggenClassByHidingClass('main', 'secondary')

BIN
out.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

BIN
over.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

26
readme.md Normal file
View file

@ -0,0 +1,26 @@
= biggist
embiggens gists
(only tested in chrome)
== install
[right here](raw/master/biggist.user.js)
== see
mouse over: ![code is big onmouseover](raw/master/over.png "embiggened")
mouse out: ![author & revision as normal](raw/master/out.png "normal")
== who
sami samhuri <sami.samhuri@gmail.com>
@_sjs
isc license