From d912d7946d5b3d6245d03de511ddb299fb7907a7 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 26 Oct 2017 09:50:58 +0200 Subject: [PATCH] Revert Pandora home template with featured lists described in #11, fixes #130 This reverts commit 44df9deae20d17facdb7f66b90bd1f2fe36fdf16. --- 50-pandora.sh | 3 +- pandora/srv/pandora/static/js/home.js | 287 -------------------------- 2 files changed, 1 insertion(+), 289 deletions(-) delete mode 100644 pandora/srv/pandora/static/js/home.js diff --git a/50-pandora.sh b/50-pandora.sh index 296409d..27c6b3c 100755 --- a/50-pandora.sh +++ b/50-pandora.sh @@ -15,8 +15,7 @@ git clone --depth 1 https://git.0x2620.org/pandora.git /srv/pandora git clone --depth 1 https://git.0x2620.org/oxjs.git /srv/pandora/static/oxjs git clone --depth 1 https://git.0x2620.org/oxtimelines.git /srv/pandora/src/oxtimelines -# Copy template and Czech translataion -cp ${SOURCE_DIR}/pandora/srv/pandora/static/js/home.js /srv/pandora/static/js/home.js +# Copy Czech translataion cp ${SOURCE_DIR}/pandora/srv/pandora/static/json/locale.0xdb.cs.json /srv/pandora/static/json/locale.0xdb.cs.json cp ${SOURCE_DIR}/pandora/srv/pandora/static/json/locale.pandora.cs.json /srv/pandora/static/json/locale.pandora.cs.json cp ${SOURCE_DIR}/pandora/srv/pandora/static/oxjs/source/Ox/js/Constants.js /srv/pandora/static/oxjs/source/Ox/js/Constants.js diff --git a/pandora/srv/pandora/static/js/home.js b/pandora/srv/pandora/static/js/home.js deleted file mode 100644 index 0964980..0000000 --- a/pandora/srv/pandora/static/js/home.js +++ /dev/null @@ -1,287 +0,0 @@ -// vim: et:ts=4:sw=4:sts=4:ft=javascript - -'use strict'; - -pandora.ui.home = function() { - - var self = {}, - - that = $('
') - .addClass('OxScreen') - .css({ - position: 'absolute', - width: '100%', - height: '100%', - opacity: 0, - overflowY: 'auto', - zIndex: 1001 - }), - - $box = $('
') - .css({ - position: 'absolute', - left: 0, - top: '80px', - right: 0, - width: '560px', - margin: '0 auto 0 auto' - }) - .appendTo(that), - - $logo = Ox.Element({ - element: '', - tooltip: function() { - return Ox._('Enter {0}', [pandora.site.site.name]); - } - }) - .attr({ - id: 'logo', - src: '/static/png/logo.png' - }) - .css({ - position: 'absolute', - left: 0, - right: 0, - width: '180px', - height: 'auto', - margin: '0 auto 0 auto', - cursor: 'pointer' - }) - .bindEvent({ - anyclick: function() { - $browseButton.triggerEvent('click'); - } - }) - .appendTo($box), - - $findInput = Ox.Input({ - width: 252 - }) - .css({ - position: 'absolute', - left: 0, - top: '104px', - right: '260px', - bottom: 0, - margin: '0 auto 0 auto', - opacity: 0 - }) - .on({ - click: function(e) { - // fixme: why? - e.stopPropagation(); - } - }) - .bindEvent({ - submit: function(data) { - if (data.value) { - $findButton.triggerEvent('click'); - } else { - $browseButton.triggerEvent('click'); - } - } - }) - .appendTo($box), - - $findButton = Ox.Button({ - title: Ox._('Find'), - width: 122 - }) - .css({ - position: 'absolute', - left: '130px', - top: '104px', - right: 0, - bottom: 0, - margin: '0 auto 0 auto', - opacity: 0 - }) - .bindEvent({ - click: function() { - var folder = pandora.getListData().folder, - value = $findInput.value(); - folder && pandora.$ui.folderList[folder].options({selected: []}); - that.fadeOutScreen(); - pandora.UI.set({ - page: '', - find: { - conditions: value === '' - ? [] - : [{key: '*', value: value, operator: '='}], - operator: '&' - }, - section: 'items' - }); - pandora.$ui.findSelect && pandora.$ui.findSelect.value('*'); - pandora.$ui.findInput && pandora.$ui.findInput.value(value); - } - }) - .appendTo($box), - - $browseButton = Ox.Button({ - title: Ox._('Browse'), - width: 122 - }) - .css({ - position: 'absolute', - left: '390px', - top: '104px', - right: 0, - bottom: 0, - margin: '0 auto 0 auto', - opacity: 0 - }) - .bindEvent({ - click: function() { - pandora.UI.set({ - page: pandora.user.ui.page == 'home' ? '' : pandora.user.ui.page, - section: 'items' - }); - that.fadeOutScreen(); - } - }) - .appendTo($box), - - $footer = Ox.Element().css({ - clear: 'both', - height: '64px', - paddingTop: '12px' - }), - - $signupButton = Ox.Button({ - title: Ox._('Sign Up'), - width: 122 - }) - .css({ - }) - .bindEvent({ - click: function() { - pandora.UI.set({page: 'signup'}); - that.fadeOutScreen(); - } - }), - - $signinButton = Ox.Button({ - title: Ox._('Sign In'), - width: 122 - }) - .css({ - marginLeft: '8px', - }) - .bindEvent({ - click: function() { - pandora.UI.set({page :'signin'}); - that.fadeOutScreen(); - } - }), - - $preferencesButton = Ox.Button({ - title: Ox._('Preferences'), - width: 252 - }) - .css({ - }) - .bindEvent({ - click: function() { - pandora.UI.set({page: 'preferences'}); - that.fadeOutScreen(); - } - }), - - $aboutButton = Ox.Button({ - title: Ox._('About {0}', [pandora.site.site.name]), - width: 252 - }) - .css({ - marginLeft: '8px' - }) - .bindEvent({ - click: function() { - pandora.UI.set({page: 'about'}); - that.fadeOutScreen(); - } - }), - - $features = $('
') - .attr({id: 'lists'}) - .css({ - position: 'absolute', - left: 0, - top: '152px', - right: 0, - bottom: 0, - width: '512px', - margin: '0 auto 0 auto', - opacity: 0 - }) - .appendTo($box); - - if (pandora.user.level == 'guest') { - $signupButton.appendTo($footer); - $signinButton.appendTo($footer); - } else { - $preferencesButton.appendTo($footer); - } - $aboutButton.appendTo($footer); - - function showFeatures() { - pandora.api.getHomeItems({active: true}, function(result) { - var items = result.data.items.filter(pandora.isCompleteHomeItem), - $texts; - $features.empty(); - if (items.length) { - $texts = Ox.Element().appendTo($features); - items.forEach(function(item) { - var $item = pandora.renderHomeItem({ - data: item - }).appendTo($texts); - }); - } else { - $features.css({ - top: '132px' - }); - } - $features.append($footer); - $features.animate({opacity: 1}, 250); - }); - } - - that.fadeInScreen = function() { - that.appendTo(Ox.$body).animate({opacity: 1}, 500, function() { - that.find('*').animate({opacity: 1}, 250, function() { - $findInput.focusInput(true); - showFeatures(); - }); - }); - return that; - }; - - that.fadeOutScreen = function() { - $('.OxTooltip').remove(); - that.animate({opacity: 0}, 500, function() { - that.remove(); - }); - pandora.$ui.tv && pandora.$ui.tv.unmute().find('.OxControls.OxVolume').hide(); - self.keydown && Ox.$document.off({keydown: self.keydown}); - return that; - }; - - that.showScreen = function(callback) { - var $elements = that.find('*'), count = 0; - $box.css({top: window.innerHeight / 2 - 80 + 'px'}); - that.css({opacity: 1}).appendTo(Ox.$body); - $findInput.focusInput(true); - $box.animate({top: '80px'}, 500, function() { - $elements.animate({opacity: 1}, 250, function() { - if (++count == $elements.length) { - showFeatures(); - callback && callback(); - } - }); - }); - return that; - }; - - return that; - -};