forked from DebaucheryLibrarian/traxxx
Added PornCZ.
This commit is contained in:
@@ -170,6 +170,28 @@ function date(context, selector, format, match, attr = 'textContent') {
|
||||
return extractDate(dateString, format, match);
|
||||
}
|
||||
|
||||
function dateAgo(context, selector, match = /(\d+)\s*(\w+)/, attr = 'textContent') {
|
||||
const timeString = q(context, selector, attr, 'textContent');
|
||||
|
||||
if (!timeString) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const timeMatch = timeString.match(match);
|
||||
|
||||
if (timeMatch) {
|
||||
const [n, period] = timeMatch.slice(1);
|
||||
const thenDate = moment.utc().subtract(Number(n), period);
|
||||
|
||||
return {
|
||||
date: thenDate.toDate(),
|
||||
precision: period.replace(/s$/, ''),
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function image(context, selector = 'img', attr, { origin, protocol = 'https' } = {}) {
|
||||
const imageEl = (attr && q(context, selector, attr))
|
||||
|| q(context, selector, 'data-src')
|
||||
@@ -286,6 +308,7 @@ const quFuncs = {
|
||||
cnt: content,
|
||||
cnts: contents,
|
||||
date,
|
||||
dateAgo,
|
||||
dur: duration,
|
||||
duration,
|
||||
element: q,
|
||||
|
||||
Reference in New Issue
Block a user