mirror of
https://github.com/samsonjs/biggist.git
synced 2026-03-25 09:15:48 +00:00
first commit
This commit is contained in:
commit
9f5ab226f6
4 changed files with 79 additions and 0 deletions
53
biggist.user.js
Normal file
53
biggist.user.js
Normal 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
BIN
out.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 262 KiB |
BIN
over.png
Normal file
BIN
over.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 256 KiB |
26
readme.md
Normal file
26
readme.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
= biggist
|
||||
|
||||
embiggens gists
|
||||
|
||||
(only tested in chrome)
|
||||
|
||||
|
||||
== install
|
||||
|
||||
[right here](raw/master/biggist.user.js)
|
||||
|
||||
|
||||
== see
|
||||
|
||||
mouse over: 
|
||||
|
||||
mouse out: 
|
||||
|
||||
|
||||
== who
|
||||
|
||||
sami samhuri <sami.samhuri@gmail.com>
|
||||
|
||||
@_sjs
|
||||
|
||||
isc license
|
||||
Loading…
Reference in a new issue