|
1 | 1 | (function () { |
2 | 2 | 'use strict'; |
3 | 3 |
|
4 | | - var APP_VERSION = '0.3.0'; |
| 4 | + var APP_VERSION = '0.3.1'; |
5 | 5 | var DEMO_MODE = new URLSearchParams(location.search).get('demo') === '1' || location.pathname.replace(/\/+$/, '').endsWith('/demo'); |
6 | 6 | var STORAGE = DEMO_MODE ? 'ote-reader-demo-state-v1' : 'ote-reader-state-v1'; |
7 | 7 | var INSTALL_DISMISSED = 'ote-reader-install-dismissed-v1'; |
|
645 | 645 | $('options-title').textContent = feed.title || 'Feed OTE'; |
646 | 646 | $('options-name').value = feed.title || ''; |
647 | 647 | fillFolderOptions(feed.url); |
648 | | - document.querySelectorAll('.feed-only').forEach(function (node) { node.hidden = false; }); |
649 | | - document.querySelectorAll('.folder-only').forEach(function (node) { node.hidden = true; }); |
650 | | - openModal('options-modal'); |
651 | | - } |
652 | | - |
653 | | - function openCategoryOptions(category) { |
654 | | - optionsContext = { type: 'category', id: category.id }; |
655 | | - $('options-title').textContent = category.name; |
656 | | - $('options-name').value = category.name; |
657 | | - document.querySelectorAll('.feed-only').forEach(function (node) { node.hidden = true; }); |
658 | | - document.querySelectorAll('.folder-only').forEach(function (node) { node.hidden = false; }); |
659 | 648 | openModal('options-modal'); |
660 | 649 | } |
661 | 650 |
|
|
673 | 662 |
|
674 | 663 | function saveOptions() { |
675 | 664 | if (!optionsContext) return; |
| 665 | + var feed = findFeed(optionsContext.id); |
| 666 | + if (!feed) return; |
676 | 667 | var name = $('options-name').value.trim(); |
677 | | - if (optionsContext.type === 'feed') { |
678 | | - var feed = findFeed(optionsContext.id); |
679 | | - if (!feed) return; |
680 | | - if (name) { |
681 | | - feed.customTitle = name; |
682 | | - feed.title = name; |
683 | | - } |
684 | | - moveFeedToCategoryId(feed.url, $('options-folder').value); |
685 | | - } else { |
686 | | - var category = findCategory(optionsContext.id); |
687 | | - if (category && name) category.name = name; |
| 668 | + if (name) { |
| 669 | + feed.customTitle = name; |
| 670 | + feed.title = name; |
688 | 671 | } |
| 672 | + moveFeedToCategoryId(feed.url, $('options-folder').value); |
689 | 673 | closeModal('options-modal'); |
690 | 674 | persist(); |
691 | 675 | render(); |
|
721 | 705 | if (context.type === 'all') { |
722 | 706 | return [ |
723 | 707 | { icon: '✓', label: 'Mark as Read', action: markVisibleFeedsRead }, |
724 | | - { icon: '+', label: 'Create New Folder', action: createFolder }, |
725 | | - { icon: '↻', label: 'Refresh feeds', action: function () { state.feeds.forEach(loadFeed); } }, |
726 | | - { icon: '⚙', label: 'Manage Feeds', action: openSources } |
| 708 | + { icon: '↻', label: 'Refresh feeds', action: function () { state.feeds.forEach(loadFeed); } } |
727 | 709 | ]; |
728 | 710 | } |
729 | 711 | if (context.type === 'category') { |
730 | 712 | var category = findCategory(context.id); |
731 | 713 | return [ |
732 | 714 | { icon: '✓', label: 'Mark as Read', action: function () { markCategoryRead(category); } }, |
733 | 715 | { icon: '⟷', label: 'Rename', action: function () { startCategoryRename(category); } }, |
734 | | - { icon: '☊', label: 'Manage Feeds', action: openSources }, |
735 | | - { icon: '⚙', label: 'Folder settings', action: function () { openCategoryOptions(category); } }, |
736 | 716 | 'separator', |
737 | 717 | { icon: '⌫', label: 'Delete', danger: true, action: function () { deleteCategoryWithConfirm(category); } } |
738 | 718 | ]; |
|
749 | 729 | var feed = findFeed(context.id); |
750 | 730 | return [ |
751 | 731 | { icon: '✓', label: 'Mark as Read', action: function () { markFeedRead(feed); } }, |
752 | | - { icon: '⟷', label: 'Rename', action: function () { openFeedOptions(feed); } }, |
753 | | - { icon: '⚙', label: 'Manage Feed', action: function () { openFeedOptions(feed); } }, |
| 732 | + { icon: '⚙', label: 'Edit', action: function () { openFeedOptions(feed); } }, |
754 | 733 | { icon: '↻', label: 'Refresh', action: function () { loadFeed(feed); } }, |
755 | 734 | 'separator', |
756 | 735 | { icon: '⌫', label: 'Delete', danger: true, action: function () { deleteFeedWithConfirm(feed); } } |
|
1565 | 1544 | $('demo-exit').addEventListener('click', exitDemo); |
1566 | 1545 | $('subscribe-open-side').addEventListener('click', function () { openModal('subscribe-modal'); }); |
1567 | 1546 | $('find-sources-open').addEventListener('click', openSources); |
| 1547 | + $('create-folder-open-side').addEventListener('click', createFolder); |
1568 | 1548 | $('sidebar-toggle').addEventListener('click', toggleSidebar); |
1569 | 1549 | $('sidebar-collapse').addEventListener('click', toggleSidebar); |
1570 | 1550 | $('sidebar-restore').addEventListener('click', toggleSidebar); |
|
1635 | 1615 | }); |
1636 | 1616 | $('options-delete').addEventListener('click', function () { |
1637 | 1617 | if (!optionsContext || !confirm('Eliminar?')) return; |
1638 | | - if (optionsContext.type === 'feed') deleteFeed(findFeed(optionsContext.id)); |
1639 | | - if (optionsContext.type === 'category') removeCategory(optionsContext.id); |
| 1618 | + deleteFeed(findFeed(optionsContext.id)); |
1640 | 1619 | closeModal('options-modal'); |
1641 | 1620 | persist(); |
1642 | 1621 | render(); |
|
0 commit comments