From 6737a0c673051f3ec9407605ae8f0bd75644f2ff Mon Sep 17 00:00:00 2001 From: alban Date: Sun, 22 Sep 2019 18:37:24 +0200 Subject: [PATCH] [fix] wip --- client/common-client-plugin.js | 86 +--------------------------------- 1 file changed, 2 insertions(+), 84 deletions(-) diff --git a/client/common-client-plugin.js b/client/common-client-plugin.js index ea916c1..93a4173 100644 --- a/client/common-client-plugin.js +++ b/client/common-client-plugin.js @@ -1,90 +1,8 @@ function register ({ registerHook, peertubeHelpers }) { - registerHook({ - target: 'action:application.init', - handler: () => onApplicationInit(peertubeHelpers) - }) - - // Videos list - - registerHook({ - target: 'filter:api.trending-videos.videos.list.params', - handler: params => Object.assign({}, params, { sort: '-views' }) - }) - - registerHook({ - target: 'filter:api.trending-videos.videos.list.result', - handler: result => addSymbolToVideoNameResult(result, '<3') - }) - - registerHook({ - target: 'filter:api.local-videos.videos.list.params', - handler: params => Object.assign({}, params, { sort: '-views' }) - }) - - registerHook({ - target: 'filter:api.local-videos.videos.list.result', - handler: result => addSymbolToVideoNameResult(result, ':)') - }) - - registerHook({ - target: 'filter:api.recently-added-videos.videos.list.params', - handler: params => Object.assign({}, params, { filter: 'all-local' }) - }) - - registerHook({ - target: 'filter:api.recently-added-videos.videos.list.result', - handler: result => addSymbolToVideoNameResult(result, 'o/') - }) - - registerHook({ - target: 'filter:api.user-subscriptions-videos.videos.list.params', - handler: params => Object.assign({}, params, { sort: '-views' }) - }) - - registerHook({ - target: 'filter:api.user-subscriptions-videos.videos.list.result', - handler: result => addSymbolToVideoNameResult(result, ':D') - }) - - // Router hooks - - registerHook({ - target: 'action:router.navigation-end', - handler: params => console.log('New URL! %s.', params.path) - }) - - // Fake hook - - registerHook({ - target: 'fakeHook', - handler: () => console.log('fake hook') - }) - + const favicon = document.querySelector('link[rel="icon"]') + favicon.href = peertubeHelpers.getBaseStaticRoute() + '/images/interhack-logo.png' } export { register } - -function onApplicationInit (peertubeHelpers) { - console.log('Hello application world') - - const baseStaticUrl = peertubeHelpers.getBaseStaticRoute() - const imageUrl = baseStaticUrl + '/images/chocobo.png' - - const topLeftBlock = document.querySelector('.top-left-block') - - topLeftBlock.style.backgroundImage = 'url(' + imageUrl + ')' - - peertubeHelpers.translate('User name') - .then(translation => console.log('Translated User name by ' + translation)) -} - -function addSymbolToVideoNameResult (result, symbol) { - result.data.forEach(v => v.name += ' ' + symbol) - - return { - data: result.data, - total: result.total - } -}