Mattthew
commited on
Commit
•
676d28d
1
Parent(s):
e5f6923
adds ability to move the partition
Browse files- index.css +46 -4
- index.html +1 -1
- index.js +56 -1
index.css
CHANGED
@@ -50,14 +50,56 @@ h4 {
|
|
50 |
|
51 |
#gutter {
|
52 |
position: fixed;
|
|
|
53 |
top: 0;
|
54 |
left: 40%;
|
55 |
-
width:
|
56 |
height: calc(100% - 40px);
|
57 |
flex-shrink: 0;
|
58 |
background: black;
|
59 |
-
background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1)
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
#image-container {
|
@@ -66,7 +108,7 @@ h4 {
|
|
66 |
flex-wrap: wrap;
|
67 |
align-items: flex-start;
|
68 |
justify-content: space-around;
|
69 |
-
margin-left: calc(40% +
|
70 |
margin-top: 20px;
|
71 |
margin-bottom: 20px;
|
72 |
width: 100%;
|
|
|
50 |
|
51 |
#gutter {
|
52 |
position: fixed;
|
53 |
+
z-index: 1;
|
54 |
top: 0;
|
55 |
left: 40%;
|
56 |
+
width: 50px;
|
57 |
height: calc(100% - 40px);
|
58 |
flex-shrink: 0;
|
59 |
background: black;
|
60 |
+
background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 40%);
|
61 |
+
}
|
62 |
+
|
63 |
+
#gutter:hover {
|
64 |
+
background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 40%)
|
65 |
+
}
|
66 |
+
|
67 |
+
#gutter div {
|
68 |
+
position: relative;
|
69 |
+
width: 20px;
|
70 |
+
height: 100%;
|
71 |
+
position: relative;
|
72 |
+
left: 20px;
|
73 |
+
border-right: 1px solid rgba(255,255,255,0.2);
|
74 |
+
cursor: col-resize;
|
75 |
+
}
|
76 |
+
|
77 |
+
#gutter:hover div {
|
78 |
+
border-right: 1px solid rgba(255,255,255,0.4);
|
79 |
+
}
|
80 |
+
|
81 |
+
#gutter div[data-tooltip]::before {
|
82 |
+
content: attr(data-tooltip);
|
83 |
+
opacity: 0;
|
84 |
+
transition: opacity 0ms 0ms linear;
|
85 |
+
}
|
86 |
+
|
87 |
+
#gutter div[data-tooltip]:hover::before {
|
88 |
+
content: attr(data-tooltip);
|
89 |
+
position: absolute;
|
90 |
+
top: 20px;
|
91 |
+
left: 50%;
|
92 |
+
transform: translateX(-40%);
|
93 |
+
background-color: #555;
|
94 |
+
padding: 4px 8px;
|
95 |
+
border-radius: 4px;
|
96 |
+
box-shadow: 0 5px 10px black;
|
97 |
+
white-space: nowrap;
|
98 |
+
font-size: 12px;
|
99 |
+
color: white;
|
100 |
+
opacity: 1;
|
101 |
+
transition: opacity 100ms 500ms linear;
|
102 |
+
pointer-events: none; /* Make sure the tooltip doesn't interfere with other interactions */
|
103 |
}
|
104 |
|
105 |
#image-container {
|
|
|
108 |
flex-wrap: wrap;
|
109 |
align-items: flex-start;
|
110 |
justify-content: space-around;
|
111 |
+
margin-left: calc(40% + 50px);
|
112 |
margin-top: 20px;
|
113 |
margin-bottom: 20px;
|
114 |
width: 100%;
|
index.html
CHANGED
@@ -164,7 +164,7 @@
|
|
164 |
<span id="edit_most_used" class="hidden">edit</span>
|
165 |
<!-- JS will insert checkboxes here -->
|
166 |
</div>
|
167 |
-
<div id="gutter"></div>
|
168 |
<div id="image-container">
|
169 |
<div id="filtersHidingAll">
|
170 |
these filters hide every image<br>
|
|
|
164 |
<span id="edit_most_used" class="hidden">edit</span>
|
165 |
<!-- JS will insert checkboxes here -->
|
166 |
</div>
|
167 |
+
<div id="gutter"><div data-tooltip="drag slowly"></div></div>
|
168 |
<div id="image-container">
|
169 |
<div id="filtersHidingAll">
|
170 |
these filters hide every image<br>
|
index.js
CHANGED
@@ -9,6 +9,8 @@ var imgTypeShown = 0;
|
|
9 |
var log = '';
|
10 |
var editMode = false;
|
11 |
var windowWidth = 0;
|
|
|
|
|
12 |
|
13 |
//
|
14 |
//
|
@@ -32,6 +34,7 @@ function startUp() {
|
|
32 |
loadMostUsedTags();
|
33 |
updateArtistsCountPerCategory();
|
34 |
showHideLowCountTags();
|
|
|
35 |
}
|
36 |
|
37 |
function updateFooter() {
|
@@ -994,6 +997,9 @@ function enterExitEditMostUsedMode(doExit) {
|
|
994 |
// clean up classes added to track moved tags during edit mode
|
995 |
label.classList.remove('was_moved');
|
996 |
})
|
|
|
|
|
|
|
997 |
updateArtistsCountPerCategory();
|
998 |
} else {
|
999 |
// enter edit mode
|
@@ -1003,6 +1009,9 @@ function enterExitEditMostUsedMode(doExit) {
|
|
1003 |
inputs.forEach(function(input) {
|
1004 |
input.disabled = true;
|
1005 |
});
|
|
|
|
|
|
|
1006 |
}
|
1007 |
}
|
1008 |
|
@@ -1286,6 +1295,41 @@ function cleanupEventListener(imageItem) {
|
|
1286 |
layout.removeEventListener('mousemove', imageItem.boundMouseMoveFunc);
|
1287 |
}
|
1288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1289 |
//
|
1290 |
//
|
1291 |
//
|
@@ -1434,7 +1478,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
1434 |
highlightSelectedOption('sortAR');
|
1435 |
storeOptionsState();
|
1436 |
});
|
1437 |
-
//
|
1438 |
var mostUsed = document.getElementById('edit_most_used');
|
1439 |
mostUsed.addEventListener('click', function(e) {
|
1440 |
enterExitEditMostUsedMode();
|
@@ -1489,6 +1533,17 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
1489 |
// toggleThisArtistsTags(this.textContent);
|
1490 |
});
|
1491 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1492 |
// add footer event listeners
|
1493 |
var closeFooter = document.getElementById('close_footer');
|
1494 |
closeFooter.addEventListener('click', function(e) {
|
|
|
9 |
var log = '';
|
10 |
var editMode = false;
|
11 |
var windowWidth = 0;
|
12 |
+
var gutterStartPosX, mouseStartPosX, gutterEndPercentX
|
13 |
+
var style, stylesheet, imgHoverRule;
|
14 |
|
15 |
//
|
16 |
//
|
|
|
34 |
loadMostUsedTags();
|
35 |
updateArtistsCountPerCategory();
|
36 |
showHideLowCountTags();
|
37 |
+
getStyleRuleForDrag();
|
38 |
}
|
39 |
|
40 |
function updateFooter() {
|
|
|
997 |
// clean up classes added to track moved tags during edit mode
|
998 |
label.classList.remove('was_moved');
|
999 |
})
|
1000 |
+
document.getElementById('toggles').style.width = 'calc(' + gutterEndPercentX + '% - 20px)';
|
1001 |
+
document.getElementById('gutter').style.left = gutterEndPercentX + '%';
|
1002 |
+
document.getElementById('image-container').style.marginLeft = 'calc(' + gutterEndPercentX + '% + 50px)';
|
1003 |
updateArtistsCountPerCategory();
|
1004 |
} else {
|
1005 |
// enter edit mode
|
|
|
1009 |
inputs.forEach(function(input) {
|
1010 |
input.disabled = true;
|
1011 |
});
|
1012 |
+
document.getElementById('toggles').style.width = '';
|
1013 |
+
document.getElementById('gutter').style.left = '';
|
1014 |
+
document.getElementById('image-container').style.marginLeft = '';
|
1015 |
}
|
1016 |
}
|
1017 |
|
|
|
1295 |
layout.removeEventListener('mousemove', imageItem.boundMouseMoveFunc);
|
1296 |
}
|
1297 |
|
1298 |
+
function getStyleRuleForDrag() {
|
1299 |
+
style = document.createElement('style');
|
1300 |
+
document.head.appendChild(style);
|
1301 |
+
stylesheet = style.sheet;
|
1302 |
+
let index = stylesheet.insertRule('.image-item:hover .imgBox { width: 40%; }', 0);
|
1303 |
+
imgHoverRule = stylesheet.cssRules[index];
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
function movePartition(e) {
|
1307 |
+
let newPos = gutterStartPosX + e.pageX - mouseStartPosX;
|
1308 |
+
if(newPos < 240) {
|
1309 |
+
newPos = 240;
|
1310 |
+
} else if(newPos > window.innerWidth - 350) {
|
1311 |
+
newPos = window.innerWidth - 350;
|
1312 |
+
}
|
1313 |
+
gutterEndPercentX = (newPos / window.innerWidth) * 100;
|
1314 |
+
document.getElementById('toggles').style.width = 'calc(' + gutterEndPercentX + '% - 20px)';
|
1315 |
+
document.getElementById('gutter').style.left = gutterEndPercentX + '%';
|
1316 |
+
document.getElementById('image-container').style.marginLeft = 'calc(' + gutterEndPercentX + '% + 50px)';
|
1317 |
+
imgHoverRule.style.width = gutterEndPercentX + '%';
|
1318 |
+
// prevent text from being selected during drag
|
1319 |
+
if (window.getSelection) {
|
1320 |
+
if (window.getSelection().empty) {
|
1321 |
+
// Chrome
|
1322 |
+
window.getSelection().empty();
|
1323 |
+
} else if (window.getSelection().removeAllRanges) {
|
1324 |
+
// Firefox
|
1325 |
+
window.getSelection().removeAllRanges();
|
1326 |
+
}
|
1327 |
+
} else if (document.selection) {
|
1328 |
+
// IE?
|
1329 |
+
document.selection.empty();
|
1330 |
+
}
|
1331 |
+
}
|
1332 |
+
|
1333 |
//
|
1334 |
//
|
1335 |
//
|
|
|
1478 |
highlightSelectedOption('sortAR');
|
1479 |
storeOptionsState();
|
1480 |
});
|
1481 |
+
// most used mode
|
1482 |
var mostUsed = document.getElementById('edit_most_used');
|
1483 |
mostUsed.addEventListener('click', function(e) {
|
1484 |
enterExitEditMostUsedMode();
|
|
|
1533 |
// toggleThisArtistsTags(this.textContent);
|
1534 |
});
|
1535 |
});
|
1536 |
+
// add gutter event listener
|
1537 |
+
var gutter = document.getElementById('gutter');
|
1538 |
+
gutter.addEventListener('mousedown', function(e) {
|
1539 |
+
e.preventDefault();
|
1540 |
+
gutterStartPosX = this.offsetLeft;
|
1541 |
+
mouseStartPosX = e.pageX;
|
1542 |
+
this.addEventListener('mousemove', movePartition, false);
|
1543 |
+
window.addEventListener('mouseup', function() {
|
1544 |
+
gutter.removeEventListener('mousemove', movePartition, false);
|
1545 |
+
}, false);
|
1546 |
+
}, false);
|
1547 |
// add footer event listeners
|
1548 |
var closeFooter = document.getElementById('close_footer');
|
1549 |
closeFooter.addEventListener('click', function(e) {
|