Skip to content

Commit

Permalink
Merge pull request #668 from KhalisFoundation/dev
Browse files Browse the repository at this point in the history
Update 5.2 Beta
  • Loading branch information
tsingh777 authored Jun 25, 2019
2 parents 7d9e572 + bf66247 commit fbe001c
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 46 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
## New Updates

### 5.2 - _190611_
### 5.2 - _190617_

### Added:

- We've made it easier than ever to have every shabad you need for an Anand Kaaraj in one place! Check out the new Ceremonies tab!
![](./assets/img/help_images/desktop-ceremonies.png)

- Did you know SikhiToTheMax has keyboard shortcuts?
- CTRL (or CMD for Mac) + / = Search bar
- CTRL (or CMD for Mac) + 1 = Waheguru Slide
Expand All @@ -15,6 +12,10 @@
- CTRL (or CMD for Mac) + 4 = Anand Sahib (Bhog)
- CTRL (or CMD for Mac) + 5 = Help Menu
- CTRL (or CMD for Mac) + 6 = Shortcut Legend


- Check out the new Ceremonies tab - we've put every Shabad you need for an Anand Kaaraj in one place!
![](./assets/img/help_images/desktop-ceremonies.png)

- Make your live streams stand out with all new Bani Overlay themes!
![](./assets/img/help_images/desktop-overlay-themes.png)
Expand All @@ -23,6 +24,7 @@
### Improved:

- Expanded Vishraams to be supported on all themes
- If you switch back and forth between Shabads (or Banis), history will now remember where you left off
- Fixed several bugs when using Chromecast
- Bug fixes & UI enhancements

Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,31 @@ Acknowledgements: Bhai Tarsem Singh UK, SHARE UK, Khalis Foundation, Khalsa Foun

Powered by [<img height="30" src="http://www.banidb.com/wp-content/uploads/2018/03/full-banidb-logo.png">](http://banidb.com)


[![Build Status](https://api.travis-ci.org/KhalisFoundation/sttm-desktop.svg?branch=release)](https://travis-ci.org/KhalisFoundation/sttm-desktop) [![Build Status](https://ci.appveyor.com/api/projects/status/github/khalisfoundation/sttm-desktop?branch=release&svg=true)](https://ci.appveyor.com/project/navdeepsinghkhalsa/sttm-desktop)

## Prerequisites
1. [Node](https://nodejs.org/en/download/)
2. [Github SSH Key Setup](https://help.github.com/articles/connecting-to-github-with-ssh/)

1. [Node](https://nodejs.org/en/download/)
2. [Github SSH Key Setup](https://help.github.com/articles/connecting-to-github-with-ssh/)

## Installation
* Clone repository
* Run `npm install` in the repository root

- Clone repository
- Run `npm install` in the repository root

## Running
* Run `npm start` in the repository root

- Run `npm start` in the repository root

## Packaging

Create the app package for your system:

* **macOS** - Run `npm run pack:mac`
* **Windows 64-bit** - Run `npm run pack:win`
* **Windows 32-bit** - Run `npm run pack:win32`
* **Linux/Ubuntu 64-bit** - Run `npm run pack:linux`
- **macOS** - Run `npm run pack:mac`
- **Windows 64-bit** - Run `npm run pack:win`
- **Windows 32-bit** - Run `npm run pack:win32`
- **Linux/Ubuntu 64-bit** - Run `npm run pack:linux`

## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)

Please see [CONTRIBUTING.md](CONTRIBUTING.md)
11 changes: 11 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,17 @@ ipcMain.on('show-text', (event, arg) => {
}
});

ipcMain.on('presenter-view', (event, arg) => {
if (viewerWindow) {
if (!arg) {
viewerWindow.hide();
} else {
viewerWindow.show();
viewerWindow.setFullScreen(true);
}
}
});

ipcMain.on('scroll-from-main', (event, arg) => {
if (viewerWindow) {
viewerWindow.webContents.send('send-scroll', arg);
Expand Down
3 changes: 2 additions & 1 deletion www/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ function checkPresenterView() {
document.querySelector('#presenter-view-toggle').checked = inPresenterView;
// hide header-tabs for non presenter view
document.querySelector('.nav-header-tabs').classList.toggle('hidden', !inPresenterView);
global.platform.ipc.send('presenter-view', inPresenterView);
}

function reloadBani(resume = false) {
Expand Down Expand Up @@ -553,7 +554,7 @@ module.exports = {
if (document.body.classList.contains('livefeed')) {
showLinePayload.live = true;
}
if (start === 0 || start === undefined) {
if (start === 0 || start === undefined || mode === 'append') {
global.platform.ipc.send('show-line', showLinePayload);
}
},
Expand Down
108 changes: 84 additions & 24 deletions www/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const allowedKeys = [
46, // Delete
];
const sessionList = [];
const sessionStatesList = {};
const currentShabad = [];
const kbPages = [];
let currentMeta = {};
Expand Down Expand Up @@ -575,35 +576,62 @@ module.exports = {
}
},

clickResult(e, ShabadID, LineID, Line) {
document.body.classList.remove('home');
this.closeGurmukhiKB();
addToHistory(SearchID, MainLineID, SearchTitle, type = 'shabad') {
const sessionKey = `${type}-${SearchID}`;
const sessionItem = h(
`li#session-${ShabadID}`,
`li#session-${type}-${SearchID}`,
{},
h(
'a.panktee.current',
{
onclick: ev => this.clickSession(ev, ShabadID, LineID),
onclick: ev => {
const $panktee = ev.target;
const { resumePanktee } = sessionStatesList[sessionKey];
switch (type) {
case 'bani':
this.loadBani(SearchID, resumePanktee, true);
break;
case 'ceremony':
this.loadCeremony(SearchID, resumePanktee, true);
break;
default:
this.loadShabad(SearchID, resumePanktee);
}
const sessionLines = this.$session.querySelectorAll('a.panktee');
Array.from(sessionLines).forEach(el => el.classList.remove('current'));
$panktee.classList.add('current');
this.navPage('shabad');
},
},
Line.Gurmukhi,
SearchTitle,
),
);
// get all the lines in the session block and remove the .current class from them
const sessionLines = this.$session.querySelectorAll('a.panktee');
Array.from(sessionLines).forEach(el => el.classList.remove('current'));
// if the ShabadID of the clicked Panktee isn't in the sessionList variable,
// add it to the variable
if (sessionList.indexOf(ShabadID) < 0) {
sessionList.push(ShabadID);
if (sessionList.indexOf(sessionKey) < 0) {
sessionList.push(sessionKey);
sessionStatesList[sessionKey] = {
resumePanktee: null,
mainPanktee: MainLineID,
seenPanktees: new Set(),
};
} else {
// if the ShabadID is already in the session, just remove the HTMLElement,
// and leave the sessionList
const line = this.$session.querySelector(`#session-${ShabadID}`);
const line = this.$session.querySelector(`#session-${type}-${SearchID}`);
this.$session.removeChild(line);
}
// add the line to the top of the session block
this.$session.insertBefore(sessionItem, this.$session.firstChild);
},

clickResult(e, ShabadID, LineID, Line) {
document.body.classList.remove('home');
this.closeGurmukhiKB();
this.addToHistory(ShabadID, LineID, Line.Gurmukhi);
// are we in APV
const apv = document.body.classList.contains('akhandpaatt');
// load the Shabad into the controller
Expand Down Expand Up @@ -647,7 +675,7 @@ module.exports = {
}
},

async loadCeremony(ceremonyID) {
async loadCeremony(ceremonyID, LineID = null, historyReload = false) {
const $shabadList = this.$shabad || document.getElementById('shabad');
$shabadList.innerHTML = '';
$shabadList.dataset.bani = '';
Expand All @@ -674,17 +702,22 @@ module.exports = {
row = banidb.loadVerses(rowDb.VerseIDRangeStart, rowDb.VerseIDRangeEnd);
}

row.sessionKey = `ceremony-${ceremonyID}`;
return row;
}),
);
const flatRows = [].concat(...rows);
return this.printShabad(flatRows);
const nameOfCeremony = rowsDb[0].Ceremony.Gurmukhi;
if (!historyReload) {
this.addToHistory(ceremonyID, null, nameOfCeremony, 'ceremony');
}
return this.printShabad(flatRows, null, LineID);
} catch (error) {
throw error;
}
},

loadBani(BaniID, LineID = null) {
loadBani(BaniID, LineID = null, historyReload = false) {
const $shabadList = this.$shabad || document.getElementById('shabad');
const baniLength = store.get('userPrefs.toolbar.gurbani.bani-length');
const mangalPosition = store.get('userPrefs.toolbar.gurbani.mangal-position');
Expand All @@ -708,6 +741,10 @@ module.exports = {
banidb.loadBani(BaniID, baniLengthCols[baniLength]).then(rowsDb => {
// create a unique shabadID for whole bani, and append it with length
const shabadID = `${rowsDb[0].Token || rowsDb[0].Bani.Token}-${baniLength}`;
const nameOfBani = rowsDb[0].Gurmukhi || rowsDb[0].Bani.Gurmukhi;
if (!historyReload) {
this.addToHistory(BaniID, null, nameOfBani, 'bani');
}
const rows = rowsDb
.filter(rowDb => rowDb.MangalPosition !== blackListedMangalPosition)
.map(rowDb => {
Expand All @@ -722,6 +759,8 @@ module.exports = {
row.shabadID = rowDb.Bani.Token;
}

row.sessionKey = `bani-${BaniID}`;

return row;
});
return this.printShabad(rows, shabadID, LineID);
Expand Down Expand Up @@ -770,15 +809,29 @@ module.exports = {
return false;
}

let seenClasses = '';
const shabadState = sessionStatesList[line.sessionKey || `shabad-${line.ShabadID}`];
if (shabadState && shabadState.resumePanktee) {
if (shabadState.seenPanktees.has(line.ID)) {
seenClasses = '.seen_check';
}
if (shabadState.resumePanktee === line.ID) {
seenClasses += '.current';
}
if (shabadState.mainPanktee === line.ID && !mainLineExists) {
seenClasses += '.main.seen_check';
}
} else if (line.mainLine && !mainLineExists) {
seenClasses += '.main.current.seen_check';
}

const shabadLine = h(
`li#li_${line.lineCount}`,
{
'data-line-count': line.lineCount,
},
h(
`a#line${line.ID}.panktee.${englishHeading ? 'roman' : 'gurmukhi'}${
line.mainLine && !mainLineExists ? '.current.main.seen_check' : ''
}`,
`a#line${line.ID}.panktee.${englishHeading ? 'roman' : 'gurmukhi'}${seenClasses}`,
{
'data-line-id': line.ID,
'data-main-letters': line.MainLetters,
Expand All @@ -791,6 +844,7 @@ module.exports = {
},

printShabad(rows, ShabadID, LineID, start = 0) {
const shabadState = sessionStatesList[rows[0].sessionKey || `shabad-${ShabadID}`];
let lineID = LineID || rows[0].ID;
const shabadID =
ShabadID || rows[0].shabadID || (rows[0].Shabads ? rows[0].Shabads[0].ShabadID : '');
Expand Down Expand Up @@ -872,10 +926,17 @@ module.exports = {
}
});

if (shabadState && !shabadState.mainPanktee) {
shabadState.mainPanktee = mainLine.ID;
}

// if there is a lineIDConflict make lineID the very first line in shabad.
if (lineIDConflict) {
lineID = document.querySelector(`#shabad > li:first-child > a`).dataset.lineId;
shabad.querySelector(`#line${lineID}`).classList.add('current', 'main', 'seen_check');
if (sessionStatesList[shabadID]) {
sessionStatesList[shabadID].seenPanktees.add(lineID);
}
}

const totalLines = rows.length;
Expand Down Expand Up @@ -918,18 +979,13 @@ module.exports = {
while (this.$session.firstChild) {
this.$session.removeChild(this.$session.firstChild);
sessionList.splice(0, sessionList.length);
// clear object and its properties
Object.getOwnPropertyNames(sessionStatesList).forEach(shabadID => {
delete sessionStatesList[shabadID];
});
}
},

clickSession(e, ShabadID, LineID) {
const $panktee = e.target;
this.loadShabad(ShabadID, LineID);
const sessionLines = this.$session.querySelectorAll('a.panktee');
Array.from(sessionLines).forEach(el => el.classList.remove('current'));
$panktee.classList.add('current');
this.navPage('shabad');
},

checkAutoPlay(LineID = null) {
clearTimeout(autoplaytimer);
if (LineID === null && document.body.querySelector('#shabad li')) {
Expand Down Expand Up @@ -957,11 +1013,13 @@ module.exports = {
}
*/
const lines = this.$shabad.querySelectorAll('a.panktee');
const shabadState = sessionStatesList[Line.sessionKey || `shabad-${ShabadID}`];
if (e.target.classList.contains('fa-home')) {
// Change main line
const $panktee = e.target.parentNode;
Array.from(lines).forEach(el => el.classList.remove('main'));
$panktee.classList.add('main', 'seen_check');
shabadState.seenPanktees.add(LineID);
} else if (e.target.classList.contains('panktee')) {
// Change line to click target
const $panktee = e.target;
Expand All @@ -971,6 +1029,8 @@ module.exports = {
Array.from(lines).forEach(el => el.classList.remove('current'));
// Add 'current' and 'seen-check' to selected Panktee
$panktee.classList.add('current', 'seen_check');
shabadState.seenPanktees.add(LineID);
shabadState.resumePanktee = LineID;
}
this.checkAutoPlay(LineID);
},
Expand Down
2 changes: 1 addition & 1 deletion www/js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const getEnglishExp = token => {

const printCeremonies = rows => {
rows.forEach(row => {
if (row.Token !== 'anand' && row.Token !== 'death') {
if (row.Token === 'anandkaraj') {
const $ceremony = h(
`div.ceremony-pane#${row.Token}`,
{
Expand Down
12 changes: 7 additions & 5 deletions www/js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ const castShabadLine = lineID => {
});
castToReceiver();

const activeSlide = document.querySelector('.deck.active .slide.active').children;
Array.prototype.forEach.call(activeSlide, element => {
const icons = iconsetHtml(`icons-${element.classList[0]}`, element.innerHTML);
if (icons) document.querySelector('.viewer-controls').appendChild(icons);
});
const activeSlide = document.querySelector('.deck.active .slide.active');
if (activeSlide) {
Array.prototype.forEach.call(activeSlide.children, element => {
const icons = iconsetHtml(`icons-${element.classList[0]}`, element.innerHTML);
if (icons) document.querySelector('.viewer-controls').appendChild(icons);
});
}
}
};

Expand Down

0 comments on commit fbe001c

Please sign in to comment.