Adding rudimentary hover anims on history

This commit is contained in:
Eston Bond
2010-10-25 18:49:24 -07:00
parent 67651afb48
commit e0c1ea0ec1
5 changed files with 362 additions and 71 deletions
+177 -47
View File
@@ -42,52 +42,9 @@ a:hover, a:visited {
margin: 0;
padding: 0.08em 0 0 0;
}
#head ul.actions {
display: block;
float: right;
list-style-type: none;
overflow: hidden;
padding: 0;
}
#head ul.actions li {
float: left;
font-size: 1.2em;
margin-left: 0.6em;
}
/* @control minibutton */
.minibutton a {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
display: block;
font-weight: bold;
margin: 0;
padding: 0.4em 1em;
text-shadow: 0 1px 0 #fff;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.minibutton a:hover {
background: #3072b3;
border-color: #518cc6 #518cc6 #2a65a0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
text-decoration: none;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
background: -moz-linear-gradient(top, #599bdc, #3072b3);
}
@@ -242,14 +199,14 @@ a:hover, a:visited {
}
/* @section page-footer */
#footer {
.page #footer {
border-top: 1px solid #ccc;
font-size: 1.2em;
line-height: 1.6em;
margin: 1em 0 7em;
}
#footer p#last-edit {
font-size: 1.2em;
line-height: 1.6em;
color: #999;
margin: 0.9em 0;
}
@@ -257,3 +214,176 @@ a:hover, a:visited {
#footer p#last-edit span.username {
font-weight: bold;
}
/* @section history */
.history h1 {
color: #999;
font-weight: normal;
}
.history h1 strong {
color: #000;
font-weight: bold;
}
#wiki-history {
margin-top: 3em;
}
#wiki-history fieldset {
border: 0;
margin: 0;
padding: 0;
}
#wiki-history table, #wiki-history tbody {
border-collapse: collapse;
padding: 0;
margin: 0;
width: 100%;
}
#wiki-history table tr {
padding: 0;
margin: 0;
}
#wiki-history table tr {
background-color: #ebf2f6;
}
#wiki-history table tr td {
border: 1px solid #c0dce9;
font-size: 1.2em;
line-height: 1.6em;
margin: 0;
padding: 0.6em;
}
#wiki-history table tr td.checkbox input {
cursor: pointer;
display: block;
padding-right: 0;
padding-top: 0.4em;
margin-right: -0.3em;
}
#wiki-history table tr:nth-child(2n),
#wiki-history table tr.alt-row {
background-color: #f3f7fa;
}
#wiki-history table tr.selected {
background-color: #ffffea !important;
z-index: 100;
}
#wiki-history table tr td.commit-name {
border-right: none;
padding-left: 1.2em;
}
#wiki-history table tr td.commit-name span.time-elapsed {
color: #999;
}
#wiki-history table tr td.author {
width: 20%;
}
#wiki-history table tr td.author a {
color: #000;
font-weight: bold;
}
#wiki-history table tr td.author a span.username {
display: block;
padding-top: 3px;
}
#wiki-history table tr td img {
background-color: #fff;
border: 1px solid #999;
display: block;
float: left;
height: 18px;
overflow: hidden;
margin: 0 0.5em 0 0;
width: 18px;
padding: 2px;
}
#wiki-history table tr td.commit-name a {
font-size: 0.9em;
font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
padding: 0 0.2em;
}
#wiki-history table tr td.revert-action {
border-left: 0;
text-align: right;
padding-right: 1.2em;
}
#wiki-history table tr td.revert-action a {
font-weight: bold;
}
#wiki-history table tr td.revert-action a span {
font-size: 0.9em;
font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
}
.history #wiki-history ul.actions li,
.history #footer ul.actions li {
margin: 0 0.6em 0 0;
}
/* @control minibutton */
ul.actions {
display: block;
list-style-type: none;
overflow: hidden;
padding: 0;
}
ul.actions li {
float: left;
font-size: 1.2em;
margin-left: 0.6em;
}
.minibutton a {
background-color: #f7f7f7;
border: 1px solid #d4d4d4;
color: #333;
display: block;
font-weight: bold;
margin: 0;
padding: 0.4em 1em;
text-shadow: 0 1px 0 #fff;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.minibutton a:hover {
background: #3072b3;
border-color: #518cc6 #518cc6 #2a65a0;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
text-decoration: none;
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
background: -moz-linear-gradient(top, #599bdc, #3072b3);
}
+2
View File
@@ -1,6 +1,8 @@
/*
template.css
Wiki content formatting
Keeping this file separate so it can be easily swapped out if you
want to format your wiki content differently from the default.
*/
#template {
+25 -23
View File
@@ -22,32 +22,31 @@
<ul class="actions">
<li class="minibutton"><a href="javascript:void(0);"
class="action-compare-revision">Compare Revisions</a></li>
<li class="minibutton"><a href="javascript:void(0);"
class="action-back-to-top">Back to Top</a></li>
</ul>
<form name="compare-versions" method="post" action="#">
<fieldset>
<table>
<tr>
<td class="checkbox">
<input type="checkbox" name="revision" value="sha1">
</td>
<td class="author">
<a href="javascript:void(0)">
<img src="" alt="avatar: username" class="mini-gravatar">
username
</a>
</td>
<td class="commit-name">
<span class="time-elapsed">3 days ago:</span>&nbsp;
Rewrote home page as Markdown&hellip;
[<a href="javascript:void(0);" title="View commit">a45719f&hellip;</a>]
</td>
<td class="revert-action">
<a href="javascript:void(0);">Revert to <span>a45719f&hellip;</span></a>
</td>
</tr>
<tbody>
<tr>
<td class="checkbox">
<input type="checkbox" name="revision" value="sha1">
</td>
<td class="author">
<a href="javascript:void(0)">
<img src="" alt="avatar: username" class="mini-gravatar">
<span class="username">username</span>
</a>
</td>
<td class="commit-name">
<span class="time-elapsed">3 days ago:</span>&nbsp;
Rewrote home page as Markdown&hellip;
[<a href="javascript:void(0);" title="View commit">a45719f&hellip;</a>]
</td>
<td class="revert-action">
<a href="javascript:void(0);" title="Revert to this change">Revert to <span>a45719f&hellip;</span></a>
</td>
</tr>
<tr class="alt-row">
<td class="checkbox">
@@ -56,7 +55,7 @@
<td class="author">
<a href="javascript:void(0)">
<img src="" alt="avatar: username" class="mini-gravatar">
username
<span class="username">username</span>
</a>
</td>
<td class="commit-name">
@@ -76,7 +75,7 @@
<td class="author">
<a href="javascript:void(0)">
<img src="" alt="avatar: username" class="mini-gravatar">
username
<span class="username">username</span>
</a>
</td>
<td class="commit-name">
@@ -88,6 +87,7 @@
<a href="javascript:void(0);">Revert to <span>a45719f&hellip;</span></a>
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
@@ -103,6 +103,8 @@
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.color.js"></script>
<script type="text/javascript" src="js/gollum.js"></script>
<script type="text/javascript" src="js/gollum.editor.js"></script>
</body>
</html>
+35 -1
View File
@@ -24,4 +24,38 @@ $(document).ready(function() {
);
}
});
if ($('#wiki-wrapper').hasClass('history')) {
$('#wiki-history td.checkbox input').each(highlightChecked);
$('#wiki-history td.checkbox input').click(highlightChecked);
$('#wiki-history td.revert-action a').mouseenter(highlightOn);
$('#wiki-history td.revert-action a').mouseleave(highlightOff);
};
});
function highlightOn() {
$(this).parent().parent().animate({
backgroundColor: '#ffffea',
duration: 400
});
}
function highlightOff() {
var color = '#ebf2f6';
if ($(this).parent().parent().hasClass('alt-row')) {
color = '#f3f7fa';
}
$(this).parent().parent().animate({
backgroundColor: color,
duration: 400
});
}
function highlightChecked() {
if ($(this).is(':checked')) {
$(this).parent().parent().addClass('selected');
} else {
$(this).parent().parent().removeClass('selected');
}
}
+123
View File
@@ -0,0 +1,123 @@
/*
* jQuery Color Animations
* Copyright 2007 John Resig
* Released under the MIT and GPL licenses.
*/
(function(jQuery){
// We override the animation for all of these color styles
jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
jQuery.fx.step[attr] = function(fx){
if ( fx.state == 0 ) {
fx.start = getColor( fx.elem, attr );
fx.end = getRGB( fx.end );
}
fx.elem.style[attr] = "rgb(" + [
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
].join(",") + ")";
}
});
// Color Conversion functions from highlightFade
// By Blair Mitchelmore
// http://jquery.offput.ca/highlightFade/
// Parse strings looking for color tuples [255,255,255]
function getRGB(color) {
var result;
// Check if we're already dealing with an array of colors
if ( color && color.constructor == Array && color.length == 3 )
return color;
// Look for rgb(num,num,num)
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
// Look for rgb(num%,num%,num%)
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
// Look for #a0b1c2
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
// Look for #fff
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
// Otherwise, we're most likely dealing with a named color
return colors[jQuery.trim(color).toLowerCase()];
}
function getColor(elem, attr) {
var color;
do {
color = jQuery.curCSS(elem, attr);
// Keep going until we find an element that has color, or we hit the body
if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
break;
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
// Some named colors to work with
// From Interface by Stefan Petre
// http://interface.eyecon.ro/
var colors = {
aqua:[0,255,255],
azure:[240,255,255],
beige:[245,245,220],
black:[0,0,0],
blue:[0,0,255],
brown:[165,42,42],
cyan:[0,255,255],
darkblue:[0,0,139],
darkcyan:[0,139,139],
darkgrey:[169,169,169],
darkgreen:[0,100,0],
darkkhaki:[189,183,107],
darkmagenta:[139,0,139],
darkolivegreen:[85,107,47],
darkorange:[255,140,0],
darkorchid:[153,50,204],
darkred:[139,0,0],
darksalmon:[233,150,122],
darkviolet:[148,0,211],
fuchsia:[255,0,255],
gold:[255,215,0],
green:[0,128,0],
indigo:[75,0,130],
khaki:[240,230,140],
lightblue:[173,216,230],
lightcyan:[224,255,255],
lightgreen:[144,238,144],
lightgrey:[211,211,211],
lightpink:[255,182,193],
lightyellow:[255,255,224],
lime:[0,255,0],
magenta:[255,0,255],
maroon:[128,0,0],
navy:[0,0,128],
olive:[128,128,0],
orange:[255,165,0],
pink:[255,192,203],
purple:[128,0,128],
violet:[128,0,128],
red:[255,0,0],
silver:[192,192,192],
white:[255,255,255],
yellow:[255,255,0]
};
})(jQuery);