Bug fix: Context lines slider can now update diff views in real time.

NOTE: Using this feature needs cookies enabled, which may sub-optimal in
corporate controlled environments.

TODO: The dependency on jQuery is overkill for something as simple as
updating tracking mouse-ups on a input element.
This commit is contained in:
André Berg
2009-10-20 03:34:07 +02:00
parent a256210880
commit a7ce2abb06
5 changed files with 90 additions and 11 deletions
+4 -2
View File
@@ -14,7 +14,8 @@
.diff .file .diffContent {
white-space: pre;
font-family: Monaco;
font-family: Meslo, "Andale Mono", Menlo, Monaco;
font-size: 11px;
}
.diff .file .diffcontent .lineno {
@@ -48,7 +49,8 @@
}
.diff .file .diffcontent .lines .whitespace {
background-color: rgba(255,0,0,0.5);
/* background-color: rgba(255,0,0,0.5); */
background-color: transparent;
}
#CurrentHunk {
+19
View File
File diff suppressed because one or more lines are too long
+43
View File
@@ -55,3 +55,46 @@ var notify = function(text, state) {
var hideNotification = function() {
$("notification").style.display = "none";
}
//cookie functions from quirksmode
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// cookie functions from W3C Schools
function setCookie(c_name, value, expiredays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays);
document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) c_end = document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
}
}
return "";
};
+1 -2
View File
@@ -1,8 +1,7 @@
/* Commit: Interface for selecting, staging, discarding, and unstaging
hunks, individual lines, or ranges of lines. */
var contextLines = 5;
contextLines = getCookie("GitXContextLines");
var showNewFile = function(file)
{
setTitle("New file: " + file.path);
+23 -7
View File
@@ -8,20 +8,36 @@
<script src="../../lib/keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="commit.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="commit.js" type="text/javascript" chahrset="utf-8"></script>
<script src="multipleSelection.js" type="text/javascript" chahrset="utf-8"></script>
<script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script>
<script src="multipleSelection.js" type="text/javascript" charset="utf-8"></script>
<script src="commit.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
jQuery(document).ready(function() {
var fadeInTime = 15;
var timeoutTime = 25;
setTimeout(function(){
jQuery('body').css("visibility", "visible").hide().fadeIn(fadeInTime);
}, timeoutTime);
document.getElementById("contextSize").value = getCookie("GitXContextLines");
jQuery('#contextSize').mouseup(function(){
setCookie("GitXContextLines", document.getElementById("contextSize").value, 10);
document.location.reload();
});
});
</script>
</head>
<body>
<body style="visibility: hidden;">
<h1 id='title'>
<input type="range" min="1" max="8" value="3" id="contextSize">
<input type="range" min="1" value="2" max="10" id="contextSize" onLoad="this.value = getCookie('GitXContextLines');">
<span id="contextTitle">Context:</span>
<span id="status">Nothing to commit</span>
</h1>
<div id="notification" style="display:none">
<img src="../../images/spinner.gif" alt="Spinner" id="spinner"></img>
<div id="notification" style="display: none;">
<img src="../../images/spinner.gif" alt="Spinner" id="spinner"/>
<div id="notification_message"></div>
</div>