function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
for (let i = 1; i <= last; i++) {
if (i == 1 || i == last || i >= left && i < right) {
range.push(i);
}
}
for (let i of range) {
if (l) {
if (i - l === 2) {
rangeWithDots.push(l + 1);
} else if (i - l !== 1) {
rangeWithDots.push('...');
}
}
rangeWithDots.push(i);
l = i;
}
return rangeWithDots;
}
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
for (let i = 1; i <= last; i++) {
if (i == 1 || i == last || i >= left && i < right) {
range.push(i);
}
}
for (let i of range) {
if (l) {
if (i - l === 2) {
rangeWithDots.push(l + 1);
} else if (i - l !== 1) {
rangeWithDots.push('...');
}
}
rangeWithDots.push(i);
l = i;
}
return rangeWithDots;
}
I'm finding the other implement to learning,...
String.prototype.toHHMMSS = function () {
var sec_num = parseInt(this, 10);
var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
var seconds = sec_num - (hours * 3600) - (minutes * 60);
if (hours < 10) {
hours = "0" + hours;
}
if (minutes < 10) {
minutes = "0" + minutes;
}
if (seconds < 10) {
seconds = "0" + seconds;
}
return hours + ":" + minutes + ":" + seconds;
};
let storeTimeOutKey = "timeOut"
let time = new Date();
let minutely = 60 * 1000
var cachedTimeOut = localStorage.getItem(storeTimeOutKey)
if(cachedTimeOut){
time = JSON.parse(cachedTimeOut)
}
else{
time.setTime(time.getTime() + minutely * 6)
localStorage.removeItem(storeTimeOutKey)
localStorage.setItem(storeTimeOutKey, JSON.stringify(time.getTime()))
}
// var timer = setInterval(Countdown(time / 1000), 1000)
function Countdown(startTime) {
return () => {
let curTime = (new Date()).getTime() / 1000;
let result = (`${startTime - curTime}`).toHHMMSS();
console.log(result)
let isTimeOut = parseInt(startTime - curTime, 10) == 0
if(isTimeOut){
clearInterval(timer)
return;
}
}
}
How can I see logic of ellipsis pagination in umb-pagination directive ?
Many thanks!
I'm finding the other implement to learning,...
I'm finding the other implement to learning,...
Hello VoDanh.
If you still look for umbraco umb-pagination directive implemtation, then it is located here https://github.com/umbraco/Umbraco-CMS/blob/v10/contrib/src/Umbraco.Web.UI.Client/src/common/directives/components/umbpagination.directive.js.
Under the Umbraco.Web.UI.Client/src in Github, you can find all logic for the whole backoffice.
is working on a reply...