forked from pieter/gitx
-
Notifications
You must be signed in to change notification settings - Fork 205
/
Copy pathdragtest.html
196 lines (174 loc) · 5.69 KB
/
dragtest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<html>
<head>
<link rel="stylesheet" href="css/GitX.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="css/diff.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="../../lib/jquery-2.0.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/GitX.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css" media="screen">
#lijstmetdingen {
font-size: 50%;
}
.line {
}
#selected {
background-color: #B5D5FE !important;
-webkit-border-radius: 3px;
-webkit-box-sizing: border-box;
width: 100%;
/* border: 1px solid red;*/
padding-left: 3px !important;
padding-right: 3px !important;
/* margin-left: -3px !important;
margin-right: -3px !important;
*/ }
#selected div {
background-color: #B5D5FE;
}
#stageButton {
float: right;
display: block;
height: 12px;
padding: 4px;
-webkit-border-radius: 4px;
background-color: white !important;
border: 1px solid blue;
margin-top: 4px;
z-index: -100;
}
</style>
<script type="text/javascript" charset="utf-8">
var nodeIndex = function(list, element)
{
for (i = 0; i < list.childNodes.length; ++i)
if (list.childNodes[i] == element)
return i;
return -1
}
var deselect = function()
{
var selection = document.getElementById("selected");
if (selection) {
while (selection.childNodes[1])
selection.parentNode.insertBefore(selection.childNodes[1], selection);
selection.parentNode.removeChild(selection);
}
}
var showSelection = function(list, from, to)
{
deselect();
var startIndex = nodeIndex(list, from);
var endIndex = nodeIndex(list, to);
if (startIndex == -1 || endIndex == -1)
return;
if (startIndex > endIndex)
{
var tmp = endIndex;
endIndex = startIndex;
startIndex = tmp;
tmp = to;
to = from;
from = tmp;
}
// new Array().slice() doesn't work with elementnodes :(
// So we create an array ourselves
var elementList = [];
for (i = startIndex; i <= endIndex; ++i)
elementList.push(from.parentNode.childNodes[i]);
var selection = document.createElement("div");
selection.setAttribute("id", "selected");
var button = document.createElement("div");
button.setAttribute("id", "stageButton");
button.appendChild(document.createTextNode("Stage lines"));
button.onmousedown = function() {
while (selection.firstChild)
selection.removeChild(selection.firstChild);
return false;
}
selection.appendChild(button);
list.insertBefore(selection, from);
var element;
for (i = 0; i < elementList.length; i++)
selection.appendChild(elementList[i]);
}
var load = function()
{
document.onmousedown = function(event) {
var cur = event.target;
while (cur) {
if (cur.getAttribute && cur.getAttribute("class") && cur.getAttribute("class").indexOf("lines") != -1)
return;
cur = cur.parentNode;
}
deselect();
}
highlightDiff($("orig_diff").value,
$("lijstmetdingen"),
{ }
);
var list = document.getElementsByClassName("lines");
for (i = 0; i < list.length; ++i) {
file = list[i];
file.onmousedown = function(event) {
file.onmouseover = function(event2) {
showSelection(file, event.srcElement, event2.target);
return false;
};
file.onmouseup = function(event2) {
file.onmouseover = null;
file.onmouseup = null;
};
showSelection(file, event.srcElement, event.srcElement);
return false;
}
}
}
</script>
</head>
<body onload="load()">
<textarea style='display:none' id="orig_diff" rows="8" cols="40">
diff --git a/.gitignore b/.gitignore
index b89b7b7..3367a4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
build
+build/revision
*.xcodeproj/*.pbxuser
*.xcodeproj/*.perspectivev3
*.xcodeproj/*.mode1v3
diff --git a/ApplicationController.m b/ApplicationController.m
index 86252cd..3a86d38 100644
--- a/ApplicationController.m
+++ b/ApplicationController.m
@@ -21,7 +21,7 @@ @implementation ApplicationController
- (ApplicationController*)init
{
-#ifndef NDEBUG
+#ifdef DEBUG_BUILD
[NSApp activateIgnoringOtherApps:YES];
#endif
@@ -92,12 +92,16 @@ - (IBAction)openPreferencesWindow:(id)sender
- (IBAction)installCliTool:(id)sender;
{
BOOL success = NO;
- NSString* installationPath = @"/usr/local/bin/gitx";
+ NSString* installationPath = @"/usr/local/bin/";
+ NSString* installationName = @"gitx";
NSString* toolPath = [[NSBundle mainBundle] pathForResource:@"gitx" ofType:@""];
if (toolPath) {
AuthorizationRef auth;
if (AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth) == errAuthorizationSuccess) {
- char const* arguments[] = { "-f", "-s", [toolPath UTF8String], [installationPath UTF8String], NULL };
+ char const* mkdir_arg[] = { "-p", [installationPath UTF8String], NULL};
+ char const* mkdir = "/bin/mkdir";
+ AuthorizationExecuteWithPrivileges(auth, mkdir, kAuthorizationFlagDefaults, (char**)mkdir_arg, NULL);
+ char const* arguments[] = { "-f", "-s", [toolPath UTF8String], [[installationPath stringByAppendingString: installationName] UTF8String], NULL };
char const* helperTool = "/bin/ln";
if (AuthorizationExecuteWithPrivileges(auth, helperTool, kAuthorizationFlagDefaults, (char**)arguments, NULL) == errAuthorizationSuccess) {
int status;
</textarea>
<div id='lijstmetdingen'></div>
</body>
</body>
</html>