1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-10-13 22:41:57 +00:00
* Added: Setting to hide the "LIVE" indicator on live channel pages.
* Added: Setting to invert portrait mode, placing chat at the top rather than the bottom.
* API Added: New icons to the default icon set: `user`, `clip`, `sort-down`, `sort-up`, `sort-alt-up`, `sort-alt-down`, and `language`.
* API Added: All Vue components now have access to a `getReactURL(route, ...)` method for building URLs.
* API Fixed: `<react-link />` will not attempt a React navigation if given a non-relative link.
* API Fixed: Issue with `getTagImmediate` throwing an exception when not given a callback function.
This commit is contained in:
SirStendec 2019-06-17 15:32:38 -04:00
parent 80148e5579
commit 3c00c0946e
19 changed files with 189 additions and 22 deletions

View file

@ -73,11 +73,26 @@ export default class FineRouter extends Module {
this.emit(':route', null, null);
}
getURL(route, data, opts) {
getURL(route, data, opts, ...args) {
const r = this.routes[route];
if ( ! r )
throw new Error(`unable to find route "${route}"`);
if ( typeof data !== 'object' ) {
const parts = [data, opts, ...args];
data = {};
let i = 0;
for(const part of r.parts) {
if ( part && part.name ) {
data[part.name] = parts[i];
i++;
if ( i >= parts.length )
break;
}
}
}
return r.url(data, opts);
}

View file

@ -22,9 +22,11 @@ export function duration_to_string(elapsed, separate_days, days_only, no_hours,
days = days > 0 ? `${days} days, ` : '';
}
const show_hours = (!no_hours || days || hours);
return `${days}${
(!no_hours || days || hours) ? `${days && hours < 10 ? '0' : ''}${hours}:` : ''
}${minutes < 10 ? '0' : ''}${minutes}${
show_hours ? `${days && hours < 10 ? '0' : ''}${hours}:` : ''
}${show_hours && minutes < 10 ? '0' : ''}${minutes}${
no_seconds ? '' : `:${seconds < 10 ? '0' : ''}${seconds}`}`;
}

View file

@ -378,8 +378,11 @@ export default class TwitchData extends Module {
if ( this.tag_cache.has(id) )
out = this.tag_cache.get(id);
if ( ! out || (want_description && ! out.description) )
this.getTag(id, want_description).then(tag => callback(id, tag)).catch(err => callback(id, null, err));
if ( (want_description && (! out || ! out.description)) || (! out && callback) ) {
const promise = this.getTag(id, want_description);
if ( callback )
promise.then(tag => callback(id, tag)).catch(err => callback(id, null, err));
}
return out;
}

View file

@ -170,6 +170,10 @@ export class Vue extends Module {
router.history.push(url);
}
},
getReactURL(route, data, opts, ...args) {
const router = t.resolve('site.router');
return router.getURL(route, data, opts, ...args);
},
t(key, phrase, options) {
return this.$i18n.t_(key, phrase, options);
},