VRTW#80244 mobile bulkacties (gui) savepoint 0.1

svn path=/Website/trunk/; revision=64319
This commit is contained in:
2024-04-18 15:28:59 +00:00
parent bec9b67b92
commit e2b75eb362
3 changed files with 70 additions and 2 deletions

View File

@@ -553,8 +553,12 @@ div.dbezet .plantime {
font-weight: 400;
}
.bulkable > a {
transition: filter 150ms ease-out;
}
.active:not(label) {
background-color: rgba(0, 0, 0, 0.1);
filter: brightness(0.8);
}
.active-page {
box-shadow: inset 0 0 5px var(--fclt-border-color);

View File

@@ -99,10 +99,11 @@ $(function() {
$(this).remove();
});
// Swipe
let touchstart = { "x": 0, "y": 0 };
const SWIPE_THRESHOLD = {
"x": window.innerWidth / 2,
"y": window.innerHeight / 2
"x": window.innerWidth / 2.5,
"y": window.innerHeight / 2.5
}
let touchmoveHandler = e => {
let translateX = (e.touches[0].screenX - touchstart.x);
@@ -168,6 +169,63 @@ $(function() {
}
});
});
// Bulk select
let bulkables = document.getElementsByClassName("bulkable");
var bulkEventHandler = e => {
e.stopPropagation();
if (e.currentTarget.dataset.bulkActive == 1) {
e.currentTarget.dataset.bulkActive = 0;
e.currentTarget.classList.remove("active");
} else {
e.currentTarget.dataset.bulkActive = 1;
e.currentTarget.classList.add("active");
}
if ($("[data-role='content']").find(".bulkable.active").length === 0) {
toggleBulkAction("off");
}
}
function toggleBulkAction(state) {
if (state === "on") {
if (!$("[data-role='content']").hasClass("bulk-active")) {
$("[data-role='content']").addClass("bulk-active");
$(".bulkable > a.ui-btn").each((i, el) => {
$(el).data("href", $(el).attr("href")).attr({
"href": null,
"aria-disabled": true
});
});
$(".bulkable").on("click", bulkEventHandler);
}
} else if (state === "off") {
$(".bulkable").off("click", bulkEventHandler);
setTimeout(() => {
$(".bulkable > a.ui-btn").each((i, el) => {
$(el).attr({
"href": $(el).data("href"),
"aria-disabled": false
}).removeData("href");
});
}, 0); // Wait for the click event to finish
}
}
[...bulkables].forEach(element => {
$(element).on("taphold", e => { // jQuery Mobile taphold event
e.stopPropagation();
toggleBulkAction("on");
if (e.currentTarget.dataset.bulkActive == 1) {
e.currentTarget.dataset.bulkActive = 0;
e.currentTarget.classList.remove("active");
} else {
e.currentTarget.dataset.bulkActive = 1;
e.currentTarget.classList.add("active");
}
});
});
});
function removeCardAnimated(elem) {

View File

@@ -95,6 +95,9 @@ function __rsProcessResultset(processParams)
this.extraClass = this.extraClass + (this.extraClass ? " " : "") + "swipeable";
}
}
if (this.bulkable) {
this.extraClass = this.extraClass + (this.extraClass ? " " : "") + "bulkable";
}
for (cnt = 0; (cnt < (S("qp_maxrows_mobile")) || this.showAll ) &&
(cnt < S("qp_maxrows2")) &&
@@ -386,6 +389,9 @@ function __rsMakeTableRow(oRs, cnt)
thisrowclassattribute += __fnContent(this.rowClass)(oRs, this.processParams);
if (addedI)
thisrowclassattribute += " ui-li-has-thumb";
if (this.extraClass)
thisrowclassattribute += " " + this.extraClass;
thisrowclassattribute += "'" ; //close
var dataicon = "";