mirror of
				https://github.com/notion-enhancer/notion-enhancer.git
				synced 2025-11-05 00:28:07 +11:00 
			
		
		
		
	weekly view working, app relaunch btn in menu modified alert
This commit is contained in:
		
							parent
							
								
									bb660a6bbb
								
							
						
					
					
						commit
						0af0e5026f
					
				@ -24,16 +24,16 @@ complete rewrite with node.js.
 | 
				
			|||||||
- extension: "emoji sets" = pick from a variety of emoji styles to use.
 | 
					- extension: "emoji sets" = pick from a variety of emoji styles to use.
 | 
				
			||||||
- extension: "night shift" = sync dark/light theme with the system (overrides normal theme setting).
 | 
					- extension: "night shift" = sync dark/light theme with the system (overrides normal theme setting).
 | 
				
			||||||
- extension: "right-to-left" = enables auto rtl/ltr text direction detection. (ported from [github.com/obahareth/notion-rtl](https://github.com/obahareth/notion-rtl).)
 | 
					- extension: "right-to-left" = enables auto rtl/ltr text direction detection. (ported from [github.com/obahareth/notion-rtl](https://github.com/obahareth/notion-rtl).)
 | 
				
			||||||
 | 
					- extension: "weekly view" = calendar views named "weekly" will show only the 7 days of this week. (ported from [github.com/adihd/notionweeklyview](https://github.com/adihd/notionweeklyview).)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//todo
 | 
					//todo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- extension: "weekly view" = view 7-day calendars. (ported from [github.com/adihd/notionweeklyview](https://github.com/adihd/notionweeklyview).)
 | 
					 | 
				
			||||||
- extension: "property layout" = auto-collapse page properties that usually push down page content. (ported from [github.com/alexander-kazakov/notion-layout-extension](https://github.com/alexander-kazakov/notion-layout-extension).)
 | 
					- extension: "property layout" = auto-collapse page properties that usually push down page content. (ported from [github.com/alexander-kazakov/notion-layout-extension](https://github.com/alexander-kazakov/notion-layout-extension).)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### v0.7.0 (2020-07-09)
 | 
					### v0.7.0 (2020-07-09)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- new: tray option to use system default emojis (instead of twitter's emojiset).
 | 
					- new: tray option to use system default emojis (instead of twitter's emojiset).
 | 
				
			||||||
- new: mac support (identical functionality to others platforms with the
 | 
					- new: mac support (identical functionality to other platforms with the
 | 
				
			||||||
  exception of the native minimise/maximise/close buttons being kept, as they integrate
 | 
					  exception of the native minimise/maximise/close buttons being kept, as they integrate
 | 
				
			||||||
  better with the OS while not being out-of-place in notion).
 | 
					  better with the OS while not being out-of-place in notion).
 | 
				
			||||||
- new: notion-deb-builder support for linux.
 | 
					- new: notion-deb-builder support for linux.
 | 
				
			||||||
 | 
				
			|||||||
@ -158,6 +158,11 @@ s {
 | 
				
			|||||||
  background: var(--theme--bg_green);
 | 
					  background: var(--theme--bg_green);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[data-relaunch] {
 | 
				
			||||||
 | 
					  text-decoration: underline dotted;
 | 
				
			||||||
 | 
					  cursor: pointer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* search */
 | 
					/* search */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#search {
 | 
					#search {
 | 
				
			||||||
 | 
				
			|||||||
@ -270,8 +270,14 @@ window['__start'] = async () => {
 | 
				
			|||||||
    if (modified_notice) return;
 | 
					    if (modified_notice) return;
 | 
				
			||||||
    modified_notice = createAlert(
 | 
					    modified_notice = createAlert(
 | 
				
			||||||
      'info',
 | 
					      'info',
 | 
				
			||||||
      `changes may not fully apply until app restart.`
 | 
					      `changes may not fully apply until <span data-relaunch>app relaunch</span>.`
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					    modified_notice.el
 | 
				
			||||||
 | 
					      .querySelector('[data-relaunch]')
 | 
				
			||||||
 | 
					      .addEventListener('click', (event) => {
 | 
				
			||||||
 | 
					        electron.remote.app.relaunch();
 | 
				
			||||||
 | 
					        electron.remote.app.quit();
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
    modified_notice.append();
 | 
					    modified_notice.append();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,62 +11,98 @@ module.exports = {
 | 
				
			|||||||
  id: '4c7acaea-6596-4590-85e5-8ac5a1455e8f',
 | 
					  id: '4c7acaea-6596-4590-85e5-8ac5a1455e8f',
 | 
				
			||||||
  tags: ['extension'],
 | 
					  tags: ['extension'],
 | 
				
			||||||
  name: 'weekly view',
 | 
					  name: 'weekly view',
 | 
				
			||||||
  desc: 'view 7-day calendars.',
 | 
					  desc: 'calendar views named "weekly" will show only the 7 days of this week.',
 | 
				
			||||||
  version: '0.5.0',
 | 
					  version: '0.5.0',
 | 
				
			||||||
  author: 'adihd',
 | 
					  author: 'adihd',
 | 
				
			||||||
  hacks: {
 | 
					  hacks: {
 | 
				
			||||||
    'renderer/preload.js'(store, __exports) {
 | 
					    'renderer/preload.js'(store, __exports) {
 | 
				
			||||||
      document.addEventListener('readystatechange', (event) => {
 | 
					      document.addEventListener('readystatechange', (event) => {
 | 
				
			||||||
        if (document.readyState !== 'complete') return false;
 | 
					        if (document.readyState !== 'complete') return false;
 | 
				
			||||||
        let queue = [];
 | 
					        const attempt_interval = setInterval(enhance, 500);
 | 
				
			||||||
        const observer = new MutationObserver((list, observer) => {
 | 
					        function enhance() {
 | 
				
			||||||
          if (!queue.length) requestAnimationFrame(process);
 | 
					          const notion_elem = document.querySelector('.notion-frame');
 | 
				
			||||||
          queue.push(...list);
 | 
					          if (!notion_elem) return;
 | 
				
			||||||
        });
 | 
					          clearInterval(attempt_interval);
 | 
				
			||||||
        observer.observe(document, {
 | 
					          process([{ target: notion_elem }]);
 | 
				
			||||||
 | 
					          const observer = new MutationObserver(process);
 | 
				
			||||||
 | 
					          observer.observe(notion_elem, {
 | 
				
			||||||
            childList: true,
 | 
					            childList: true,
 | 
				
			||||||
            subtree: true,
 | 
					            subtree: true,
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        function process() {
 | 
					          function process(list, observer) {
 | 
				
			||||||
          queue = [];
 | 
					            const collection_view = document.querySelector(
 | 
				
			||||||
 | 
					              '.notion-collection-view-select'
 | 
				
			||||||
          for (let elem of document.getElementsByClassName(
 | 
					            );
 | 
				
			||||||
            'notion-collection-view-select'
 | 
					            if (!collection_view || collection_view.innerText != 'weekly')
 | 
				
			||||||
          )) {
 | 
					              return;
 | 
				
			||||||
            // console.log("this is working2");
 | 
					            const days = collection_view.parentElement.parentElement.parentElement.parentElement.getElementsByClassName(
 | 
				
			||||||
            if (elem.innerText === 'weekly') {
 | 
					 | 
				
			||||||
              // console.log("this is working3");
 | 
					 | 
				
			||||||
              var days_list = elem.parentElement.parentElement.parentElement.parentElement.getElementsByClassName(
 | 
					 | 
				
			||||||
              'notion-calendar-view-day'
 | 
					              'notion-calendar-view-day'
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
              for (let index = 0; index < days_list.length; index++) {
 | 
					            for (let day of days)
 | 
				
			||||||
                // const element = array[index];
 | 
					              day.parentElement.parentElement.style.height = 0;
 | 
				
			||||||
                if (days_list[index].style.background) {
 | 
					            if (days.length) {
 | 
				
			||||||
                  days_list[index].parentElement.parentElement.classList.add(
 | 
					              const today = [...days].find((day) => day.style.background);
 | 
				
			||||||
                    'this_week'
 | 
					              if (today)
 | 
				
			||||||
                  );
 | 
					                today.parentElement.parentElement.style.height = '124px';
 | 
				
			||||||
                  // console.log("yay");
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
              var weeks = document.getElementsByClassName('this_week')[0]
 | 
					 | 
				
			||||||
                .parentElement.children;
 | 
					 | 
				
			||||||
              // delete al div that not contain a class of "this_week"
 | 
					 | 
				
			||||||
              while (weeks.length > 1) {
 | 
					 | 
				
			||||||
                for (let index = 0; index < weeks.length; index++) {
 | 
					 | 
				
			||||||
                  // const element = array[index];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                  if (weeks[index].classList.contains('this_week')) {
 | 
					 | 
				
			||||||
                    console.log('yes');
 | 
					 | 
				
			||||||
                  } else {
 | 
					 | 
				
			||||||
                    // console.log(index);
 | 
					 | 
				
			||||||
                    weeks[index].remove();
 | 
					 | 
				
			||||||
                  }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // document.addEventListener('readystatechange', (event) => {
 | 
				
			||||||
 | 
					      //   if (document.readyState !== 'complete') return false;
 | 
				
			||||||
 | 
					      //   let queue = [];
 | 
				
			||||||
 | 
					      //   const observer = new MutationObserver((list, observer) => {
 | 
				
			||||||
 | 
					      //     if (!queue.length) requestAnimationFrame(() => process(queue));
 | 
				
			||||||
 | 
					      //     queue.push(...list);
 | 
				
			||||||
 | 
					      //   });
 | 
				
			||||||
 | 
					      //   observer.observe(document, {
 | 
				
			||||||
 | 
					      //     // subtree: true,
 | 
				
			||||||
 | 
					      //   });
 | 
				
			||||||
 | 
					      //   function process(list) {
 | 
				
			||||||
 | 
					      //     queue = [];
 | 
				
			||||||
 | 
					      //     if (
 | 
				
			||||||
 | 
					      //       list.find((e) => e.target.matches('.notion-collection-view-select'))
 | 
				
			||||||
 | 
					      //     )
 | 
				
			||||||
 | 
					      //       console.log(list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // for (let elem of document.getElementsByClassName(
 | 
				
			||||||
 | 
					      //   'notion-collection-view-select'
 | 
				
			||||||
 | 
					      // )) {
 | 
				
			||||||
 | 
					      //   // console.log("this is working2");
 | 
				
			||||||
 | 
					      //   if (elem.innerText === 'weekly') {
 | 
				
			||||||
 | 
					      //     // console.log("this is working3");
 | 
				
			||||||
 | 
					      //     var days_list = elem.parentElement.parentElement.parentElement.parentElement.getElementsByClassName(
 | 
				
			||||||
 | 
					      //       'notion-calendar-view-day'
 | 
				
			||||||
 | 
					      //     );
 | 
				
			||||||
 | 
					      //     for (let index = 0; index < days_list.length; index++) {
 | 
				
			||||||
 | 
					      //       // const element = array[index];
 | 
				
			||||||
 | 
					      //       if (days_list[index].style.background) {
 | 
				
			||||||
 | 
					      //         days_list[index].parentElement.parentElement.classList.add(
 | 
				
			||||||
 | 
					      //           'this_week'
 | 
				
			||||||
 | 
					      //         );
 | 
				
			||||||
 | 
					      //         // console.log("yay");
 | 
				
			||||||
 | 
					      //       }
 | 
				
			||||||
 | 
					      //     }
 | 
				
			||||||
 | 
					      //     var weeks = document.getElementsByClassName('this_week')[0]
 | 
				
			||||||
 | 
					      //       .parentElement.children;
 | 
				
			||||||
 | 
					      //     // delete al div that not contain a class of "this_week"
 | 
				
			||||||
 | 
					      //     while (weeks.length > 1) {
 | 
				
			||||||
 | 
					      //       for (let index = 0; index < weeks.length; index++) {
 | 
				
			||||||
 | 
					      //         // const element = array[index];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      //         if (weeks[index].classList.contains('this_week')) {
 | 
				
			||||||
 | 
					      //           console.log('yes');
 | 
				
			||||||
 | 
					      //         } else {
 | 
				
			||||||
 | 
					      //           // console.log(index);
 | 
				
			||||||
 | 
					      //           weeks[index].style.display = 'none';
 | 
				
			||||||
 | 
					      //         }
 | 
				
			||||||
 | 
					      //       }
 | 
				
			||||||
 | 
					      //     }
 | 
				
			||||||
 | 
					      //   }
 | 
				
			||||||
 | 
					      // }
 | 
				
			||||||
 | 
					      //   }
 | 
				
			||||||
 | 
					      // });
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user