Skip to content

Commit

Permalink
Support Gnome 45
Browse files Browse the repository at this point in the history
Support Gnome 45
  • Loading branch information
omid committed Sep 22, 2023
2 parents 7ecf50b + 0b1fa00 commit 24a5bb0
Show file tree
Hide file tree
Showing 21 changed files with 1,045 additions and 1,028 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,5 @@ globals:
print: readonly
printerr: readonly
parserOptions:
ecmaVersion: 2020
ecmaVersion: latest
sourceType": "module"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ clean:
rm -rf build/

release: export _VERSION=$(shell jq '.version' $(_UUID)/metadata.json)
release: eslint _version_bump _build
release: _version_bump _build
gitg
git commit -v
git tag $(_VERSION)
Expand Down
134 changes: 67 additions & 67 deletions PersianCalendar@oxygenws.com/Calendar.js

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions PersianCalendar@oxygenws.com/Events.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
'use strict';

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();

const {PersianDate, HijriDate} = Me.imports;
const {persian, world, iranSolar, iranLunar, persianPersonage} = Me.imports.events;
const str = Me.imports.utils.str;
import * as PersianDate from './PersianDate.js';
import * as HijriDate from './HijriDate.js';
import {iranLunar} from './events/iranLunar.js';
import {persian} from './events/persian.js';
import {world} from './events/world.js';
import {iranSolar} from './events/iranSolar.js';
import {persianPersonage} from './events/persianPersonage.js';

const calendarToIndex = {
gregorian: 0,
persian: 1,
hijri: 2,
};

var Events = class {
constructor(schema) {
this.schema = schema;
export class Events {
constructor(schema, str) {
this._schema = schema;
this._str = str;
}

getEvents(today) {
Expand All @@ -39,11 +41,11 @@ var Events = class {

// ///
const events = {
'event-iran-solar': () => new iranSolar.iranSolar(),
'event-iran-lunar': () => new iranLunar.iranLunar(),
'event-persian-personage': () => new persianPersonage.persianPersonage(ptoday.year),
'event-world': () => new world.world(),
'event-persian': () => new persian.persian(),
'event-iran-solar': () => new iranSolar(),
'event-iran-lunar': () => new iranLunar(),
'event-persian-personage': () => new persianPersonage(ptoday.year),
'event-world': () => new world(),
'event-persian': () => new persian(),
};

const holidays = {
Expand All @@ -55,15 +57,15 @@ var Events = class {
let holidayList = [];

for (let key in events) {
if (this.schema.get_string(key) !== 'none') {
if (this._schema.get_string(key) !== 'none') {
let e = events[key]();
if (this.schema.get_string(key) === 'holidays-only') {
if (this._schema.get_string(key) === 'holidays-only') {
this._filterHolidays(e);
}
eventsList.push(e);
}

if (holidays[this.schema.get_string('holidays-country')].includes(key)) {
if (holidays[this._schema.get_string('holidays-country')].includes(key)) {
let e = events[key]();
this._filterHolidays(e);
holidayList.push(e);
Expand Down Expand Up @@ -100,7 +102,7 @@ var Events = class {
// if event is available, set event
if (eventsList[i].events[this._today[type][1]][this._today[type][2]]) {
for (let j = 0; j < eventsList[i].events[this._today[type][1]][this._today[type][2]].length; j++) {
this._events += `\n⚫︎ ${str.wordWrap(eventsList[i].events[this._today[type][1]][this._today[type][2]][j][0], 50)}`;
this._events += `\n⚫︎ ${this._str.wordWrap(eventsList[i].events[this._today[type][1]][this._today[type][2]][j][0], 50)}`;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions PersianCalendar@oxygenws.com/HijriDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

const COUNTRY = 'IR';

function fromGregorian(year, month, day) {
export function fromGregorian(year, month, day) {
[year, month, day] = _gregorianToHijri(parseInt(year), parseInt(month), parseInt(day));
return {year, month, day};
}

function toGregorian(year, month, day) {
export function toGregorian(year, month, day) {
[year, month, day] = _hijriToGregorian(parseInt(year), parseInt(month), parseInt(day));
return {year, month, day};
}
Expand Down
6 changes: 3 additions & 3 deletions PersianCalendar@oxygenws.com/PersianDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const g_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const p_days_in_month = [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29];

function toGregorian(py, pm, pd) {
export function toGregorian(py, pm, pd) {
py = parseInt(py) - 979;
pm = parseInt(pm) - 1;
pd = parseInt(pd) - 1;
Expand Down Expand Up @@ -60,7 +60,7 @@ function toGregorian(py, pm, pd) {
return {year: gy, month: i + 1, day: g_day_no + 1};
}

function fromGregorian(gy, gm, gd) {
export function fromGregorian(gy, gm, gd) {
gy = parseInt(gy) - 1600;
gm = parseInt(gm) - 1;
gd = parseInt(gd) - 1;
Expand Down Expand Up @@ -99,6 +99,6 @@ function fromGregorian(gy, gm, gd) {
return {year: py, month: i + 1, day: p_day_no + 1, yearDays: day_in_year};
}

function isLeap(py) {
export function isLeap(py) {
return ((((((py - (py > 0 ? 474 : 473)) % 2820) + 474) + 38) * 682) % 2816) < 682;
}
4 changes: 2 additions & 2 deletions PersianCalendar@oxygenws.com/events/iranLunar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* see https://www.farhang.gov.ir/ershad_content/media/image/2020/09/1004261_orig.pdf
*/

var iranLunar = class {
export class iranLunar {
constructor() {
this.name = 'مناسبت‌های مذهبی ایران';
this.type = 'hijri';
/* [month][day] = [title, isHoliday] */
/* [month][day] = [[title, isHoliday]] */
this.events = [[], [], [], [], [], [], [], [], [], [], [], [], []];

this.events[1][1] = [['آغاز سال جدید هجری قمری', false]];
Expand Down
4 changes: 2 additions & 2 deletions PersianCalendar@oxygenws.com/events/iranSolar.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var iranSolar = class {
export class iranSolar {
constructor() {
this.name = 'مناسبت‌های رسمی ایران';
this.type = 'persian';
/* [month][day] = [title, isHoliday] */
/* [month][day] = [[title, isHoliday]] */
this.events = [[], [], [], [], [], [], [], [], [], [], [], [], []];

this.events[1][1] = [['عید نوروز', true]];
Expand Down
8 changes: 3 additions & 5 deletions PersianCalendar@oxygenws.com/events/persian.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

// copyright پژوهش‌های ایرانی at http://ghiasabadi.com/

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const PersianDate = Me.imports.PersianDate;
import * as PersianDate from '../PersianDate.js';

var persian = class {
export class persian {
constructor(pyear) {
this.name = 'مناسبت‌های ملی';
this.type = 'persian';
/* [month][day] = [title, isHoliday] */
/* [month][day] = [[title, isHoliday]] */
this.events = [[], [], [], [], [], [], [], [], [], [], [], [], []];

this.events[1][1] = [['جشن نوروز', false]];
Expand Down
4 changes: 2 additions & 2 deletions PersianCalendar@oxygenws.com/events/persianPersonage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

// copyright http://www.farhangiran.com

var persianPersonage = class {
export class persianPersonage {
constructor() {
this.name = 'شخصیت‌های ایرانی';
this.type = 'persian';
/* [month][day] = [title, isHoliday] */
/* [month][day] = [[title, isHoliday]] */
this.events = [[], [], [], [], [], [], [], [], [], [], [], [], []];

this.events[1][6] = [['زایش زرتشت', false]];
Expand Down
4 changes: 2 additions & 2 deletions PersianCalendar@oxygenws.com/events/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
* see https://www.farhang.gov.ir/ershad_content/media/image/2020/09/1004261_orig.pdf
*/

var world = class {
export class world {
constructor() {
this.name = 'مناسبت‌های جهانی';
this.type = 'gregorian';
/* [month][day] = [title, isHoliday] */
/* [month][day] = [[title, isHoliday]] */
this.events = [[], [], [], [], [], [], [], [], [], [], [], [], []];

this.events[1][1] = [['جشن آغاز سال نو میلادی', false]];
Expand Down
Loading

0 comments on commit 24a5bb0

Please sign in to comment.