Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Quack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
commul
Zeit.shift
Quack
Commits
a13c9403
Commit
a13c9403
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Closes #38 (Changing sort order in table should change thumbnail order too)
parent
2cb17605
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
web/quack_folder.js
+55
-3
55 additions, 3 deletions
web/quack_folder.js
with
55 additions
and
3 deletions
web/quack_folder.js
+
55
−
3
View file @
a13c9403
...
...
@@ -29,9 +29,61 @@ function toggleHistograms() {
}
}
function
thclick
()
{
// Consider a timeout if there is a race condition with the table sort
// Locates an inner div with a link to the given href, then moved it to the last
// position in the given div
function
moveToEnd
(
div
,
href
)
{
var
inners
=
div
.
getElementsByTagName
(
'
div
'
);
for
(
var
i
=
0
;
i
<
inners
.
length
;
i
++
)
{
var
inner
=
inners
[
i
];
var
tlinks
=
inner
.
getElementsByTagName
(
'
a
'
);
if
(
tlinks
.
length
>
0
)
{
var
tlink
=
tlinks
[
0
];
if
(
tlink
.
href
==
href
)
{
inner
.
parentNode
.
appendChild
(
inner
);
return
;
}
}
}
}
// Iterates the rows in the table, collecting links to image pages.
// For each link, moveToEnd is called for the thumbs and the histograms div,
// thereby synchronicing the thumbnails and histograms to the order of the
// images in the table.
function
thClick
()
{
var
thumbss
=
document
.
getElementsByClassName
(
'
thumbs
'
);
if
(
thumbss
.
length
!=
1
)
{
console
.
log
(
'
thClick: Expected 1 div.thumbs but got
'
+
thumbss
.
length
);
return
;
}
var
thumbs
=
thumbss
[
0
];
var
histss
=
document
.
getElementsByClassName
(
'
histograms
'
);
if
(
histss
.
length
!=
1
)
{
console
.
log
(
'
thClick: Expected 1 div.histograms but got
'
+
histss
.
length
);
return
;
}
var
hists
=
histss
[
0
];
// TODO: Order the image divs like the table links are ordered
var
tables
=
document
.
getElementsByClassName
(
'
sortable
'
);
for
(
var
i
=
0
;
i
<
tables
.
length
;
i
++
)
{
var
stable
=
tables
[
i
];
var
trows
=
stable
.
getElementsByTagName
(
'
tr
'
);
for
(
var
t
=
0
;
t
<
trows
.
length
;
t
++
)
{
var
trow
=
trows
[
t
];
var
tcells
=
trow
.
getElementsByTagName
(
'
td
'
);
if
(
tcells
.
length
>
0
)
{
var
tcell
=
tcells
[
0
];
var
tlinks
=
tcell
.
getElementsByTagName
(
'
a
'
);
if
(
tlinks
.
length
>
0
)
{
var
tlink
=
tlinks
[
0
];
moveToEnd
(
thumbs
,
tlink
.
href
);
moveToEnd
(
hists
,
tlink
.
href
);
}
}
}
}
}
var
oldOnload
=
window
.
onload
;
...
...
@@ -62,7 +114,7 @@ function initialSetup() {
var
theads
=
stable
.
getElementsByTagName
(
'
th
'
);
for
(
var
h
=
0
;
h
<
theads
.
length
;
h
++
)
{
thead
=
theads
[
h
];
thead
.
onclick
=
th
c
lick
;
thead
.
onclick
=
th
C
lick
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment