Skip to content

Commit

Permalink
r0b08x [chore] 4/29/2021, 11:55:13 AM
Browse files Browse the repository at this point in the history
  • Loading branch information
p3x-robot committed Apr 29, 2021
1 parent dc4b826 commit f00619f
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

@license p3x-onenote v2021.4.173
@license p3x-onenote v2021.4.175

📚 P3X OneNote Linux

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@



# 📚 P3X OneNote Linux v2021.4.173
# 📚 P3X OneNote Linux v2021.4.175



Expand Down Expand Up @@ -228,7 +228,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://

---

[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.173
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.175

[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)

Expand Down
2 changes: 1 addition & 1 deletion artifacts/arm.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://

---

[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.173
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.175

[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)

Expand Down
2 changes: 1 addition & 1 deletion artifacts/new-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://

---

[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.173
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.175

[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)

Expand Down
2 changes: 1 addition & 1 deletion artifacts/npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://

---

[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.173
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.175

[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)

Expand Down
5 changes: 4 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

## Change log

### v2021.4.175
* FEATURE: The bookmarks are sorted by alphabetically.

### v2021.4.173
* FEATURE: Enhanced dark mode by keeping the original colors (a bit shift, but not invert like before).

Expand Down Expand Up @@ -264,7 +267,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://

---

[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.173
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2021.4.175

[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "p3x-onenote",
"version": "2021.4.173",
"version": "2021.4.175",
"description": "📚 P3X OneNote Linux",
"main": "src/electron/app.js",
"corifeus": {
Expand Down Expand Up @@ -62,7 +62,7 @@
"electron-updater": "^4.3.8",
"opencollective": "^1.0.3",
"semver": "^7.3.5",
"electron": "^12.0.4"
"electron": "^12.0.5"
},
"devDependencies": {
"corifeus-builder": "^2021.4.124",
Expand Down
28 changes: 28 additions & 0 deletions src/electron/lib/natural-compare-document.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = ({ byProperty }) => {
return (a, b) => {
if (byProperty !== undefined) {
a = a[byProperty]
b = b[byProperty]
}
const regexTemplate = /(\d+)|(\D+)/g;
const ax = [], bx = [];

a.replace(regexTemplate, function (_, $1, $2) {
ax.push([$1 || Infinity, $2 || ""])
});
b.replace(regexTemplate, function (_, $1, $2) {
bx.push([$1 || Infinity, $2 || ""])
});

while (ax.length && bx.length) {
const an = ax.shift();
const bn = bx.shift();
const nn = (parseFloat(an[0]) - parseFloat(bn[0])) || an[1].localeCompare(bn[1]);
if (nn) {
return nn;
}
}

return ax.length - bx.length;
}
}
8 changes: 6 additions & 2 deletions src/electron/main/create/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ function mainMenu() {
})
}

for(let bookmarkIndex in bookmarks) {
const bookmark = bookmarks[bookmarkIndex]
const naturalCompareDocument = require('../../lib/natural-compare-document')
let bookmarksSort = bookmarks.sort(naturalCompareDocument({
byProperty: 'title'
}))
for(let bookmarkIndex in bookmarksSort) {
const bookmark = bookmarksSort[bookmarkIndex]
const thisBookmarkIndex = bookmarkIndex
bookmarksMenu.push({
label: bookmark.title,
Expand Down
11 changes: 9 additions & 2 deletions src/electron/main/ipc-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ ipcMain.on('p3x-onenote-save', function (event, data) {

ipcMain.on('p3x-onenote-action-bookmark-result', function (event, data) {
//console.log('p3x-onenote-action-bookmark-result', data)
const bookmarks = global.p3x.onenote.conf.get('bookmarks') || []
const bookmarksOriginal = global.p3x.onenote.conf.get('bookmarks') || []

const naturalCompareDocument = require('../lib/natural-compare-document')
const sort = naturalCompareDocument({
byProperty: 'title'
})
let bookmarks = bookmarksOriginal.sort(sort)

if (data.opts.edit !== true) {
bookmarks.push(data.model)
} else {
Expand All @@ -23,7 +30,7 @@ ipcMain.on('p3x-onenote-action-bookmark-result', function (event, data) {
}
}

global.p3x.onenote.conf.set('bookmarks', bookmarks)
global.p3x.onenote.conf.set('bookmarks', bookmarks.sort(sort))

global.p3x.onenote.mainMenu();
global.p3x.onenote.mainTray()
Expand Down

0 comments on commit f00619f

Please sign in to comment.