Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka

Sebuah userscript untuk mengecek status data SPTJM & Surat Rekomenasi (SR) Kampus Merdeka
https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka

chrome chrome-extension extension extension-chrome extensions greasemonkey javascript kampus-merdeka kampusmerdeka magang msib studi-independen studiindependen stupen tampermonkey tampermonkey-extension tampermonkey-plugin tampermonkey-script tampermonkey-userscript userscript

Last synced: 26 days ago
JSON representation

Sebuah userscript untuk mengecek status data SPTJM & Surat Rekomenasi (SR) Kampus Merdeka

Awesome Lists containing this project

README

        

![image](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/assets/64502893/3a58788e-7083-4e28-840f-f2360c8fef3c)

Cek Status SPTJM & Surat Rekomendasi (SR) Kampus Merdeka Batch 5 Tahun 2023

### Sebuah Userscript yang Ditulis Menggunakan `Javascript`
⚠️ *Akurasi Status Data yang Ditampilkan Tidak Selalu Dapat Dijadikan Acuan* ⚠️

[![](https://img.shields.io/badge/Author-okkidwi-green.svg)](https://github.com/okkidwi)
[![](https://img.shields.io/github/license/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka?color=blue)](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/blob/main/LICENSE)
[![](https://img.shields.io/github/v/release/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka?color=orange)](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/releases/latest)
[![](https://img.shields.io/badge/Support-Chrome/Firefox/Mircosoft-Edge/Opera/Brave/Vivaldi/Safari-989898.svg)](#compatibility)
[![](https://img.shields.io/github/commit-activity/m/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka?label=Commits)](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/commits/main)
[![](https://img.shields.io/github/last-commit/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka?label=last%20commit)](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/commits)
[![](https://img.shields.io/static/v1?label=%20&message=GreasyFork&style=flat-square&labelColor=7B0000&color=960000&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3ggEBCQHM3fXsAAAAVdJREFUOMudkz2qwkAUhc/goBaGJBgUtBCZyj0ILkpwAW7Bws4yO3AHLiCtEFD8KVREkoiFxZzX5A2KGfN4F04zMN+ce+5c4LMUgDmANYBnrnV+plBSi+FwyHq9TgA2LQpvCiEiABwMBtzv95RSfoNEHy8DYBzHrNVqVEr9BWKcqNFoxF6vx3a7zc1mYyC73a4MogBg7vs+z+czO50OW60Wt9stK5UKp9Mpj8cjq9WqDTBHnjAdxzGQZrPJw+HA31oulzbAWgLoA0CWZVBKIY5jzGYzdLtdE9DlcrFNrY98zobqOA6TJKHW2jg4nU5sNBpFDp6mhVe5rsvVasUwDHm9Xqm15u12o+/7Hy0gD8KatOd5vN/v1FozTVN6nkchxFuI6hsAAIMg4OPxMJCXdtTbR7JJCMEgCJhlGUlyPB4XfumozInrupxMJpRSRtZlKoNYl+m/6/wDuWAjtPfsQuwAAAAASUVORK5CYII=)](https://greasyfork.org/scripts/470178-cek-status-data-sptjm-sr-kampus-merdeka-batch-5-2023/code/Cek%20Status%20Data%20SPTJM%20%20SR%20%7C%20Kampus%20Merdeka%20Batch%205%202023.user.js)
[![](https://img.shields.io/static/v1?label=%20&message=https%3A%2F%2Flinktr.ee/okkidwi&labelColor=464747&color=black&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAz9JREFUeJyNVUtIW1EQff4WggvRhfjbmEUjNo2LBIrQggsRWl0JIliKIC4E3YikSIW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ErkJggg==)](https://linktr.ee/okkidwi)

##

### Instal

Instal Melalui Console Browser
Instal Melalui Usercript

##

[✨ Fitur](#-fitur)   |   [⚒️ Instalasi](#-instalasi)   |   [📜 Riwayat Perubahan](#-riwayat-perubahan)   |   [⭐ Star History](#-star-history)

##

## ✨ Fitur

- Menampilkan status data SPTJM & Surat Rekomendasi (SR) Kampus Merdeka yang telah anda upload di website kampusmerdeka.kemdikbud.go.id seperti:

* Status `KESALAHAN, SKRIP GAGAL MENGURAI DATA ANDA`: Skrip tidak berjalan dengan sempurna, instal kembali skrip diatas
* Status `Data SPTJM atau SURAT REKOMENDASI tidak ditemukan`: Data SPTJM & Surat Rekomendasi (SR) belum anda upload
* `(Hari, Tanggal Bulan Tahun pukul [Jam.Menit] Zona Waktu)` Status SPTJM anda adalah `(Status Data)`
* `(Hari, Tanggal Bulan Tahun pukul [Jam.Menit] Zona Waktu)` Status Surat Rekomendasi anda adalah `(Status Data)`

| `(Hari, Tanggal Bulan Tahun pukul [Jam & Menit]` | `(Status Data)` |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `Hari`: Numeric, contoh: Rabu | `ON_REVIEW`: Data SPTJM & Surat Rekomendasi (SR) anda sedang dalam proses review |
| `Tanggal`: Numeric, contoh: 5 | `VERIFIED`: Data SPTJM & Surat Rekomendasi (SR) anda telah terverifikasi |
| `Bulan`: Long, contoh: Juli | `REJECTED`: Data SPTJM & Surat Rekomendasi (SR) anda ditolak |
| `Tahun`: Numerik, contoh: 2023 | |
| `Jam.Menit`: Numerik, 04.49 | |
| `Zona Waktu`: Indonesia/Asia/Jakarta (WIB) | |

## ⚒️ Instalasi

### Console Browser

TEKAN UNTUK MELIHAT

1. Buka website kampusmerdeka.kemdikbud.go.id melalui browser Desktop PC / Laptop berikut:
* `Windows`: *Chrome / Firefox / Microsoft Edge / Opera / Brave / Vivaldi*

* `macOS`: *Safari*
2. Pastikan anda telah login
3. Buka devtools pada browser anda dengan cara:
* `Windows`: Gunakan shortcut keyboard `CTRL + SHIFT + J` / `Klik Kanan > Inspect > Console`

* `macOS`: Gunakan shortcut keyboard `CMD + OPTION + J`

4. Copy & paste kode yang dilampirkan dibawah, kemudian tekan Enter

![Screenshot 2023-07-05 043823](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/assets/64502893/9e9ab4e6-b951-41df-ab3a-4a57dafe67af)

TEKAN UNTUK MELIHAT KODE

```
const printErrorShouldLoginBefore = () => {
console.log(
'%cKESALAHAN, SKRIP GAGAL MENGURAI DATA ANDA',
'font-size: 18px; color: #f00; background: #000;'
);
throw new Error('NOT_LOGGED_IN');
};

const printGenericError = (err) => {
console.log(
`%cError: ${err}`,
'font-size: 18px; color: #f00; background: #000;'
);
throw err;
};

const currentCycle = 5;

const userLocalKey = `@mkbm/manager/user`;
const storageData = localStorage.getItem(userLocalKey);
if (!storageData) {
printErrorShouldLoginBefore();
}
const storageDataParsed = JSON.parse(storageData);
if (!storageDataParsed) {
printErrorShouldLoginBefore();
}
const token = storageDataParsed?.value?.token;
if (!token) {
printErrorShouldLoginBefore();
}

const abortController = new AbortController();

const getActiveDocuments = async () => {
const resp = await fetch(
'https://api.kampusmerdeka.kemdikbud.go.id/v1alpha1/documents?type=SPTJM,SURAT_REKOMENDASI&programs=Magang',
{
signal: abortController.signal,
headers: {
Authorization: `Bearer ${token}`,
},
}
).then((resp) => resp.json());
const docs = resp.data;
const mapDocumentByType = {};
docs.forEach((doc) => {
if (!(doc.type in mapDocumentByType)) {
mapDocumentByType[doc.type] = [];
}

doc.cycle_int = Number.parseInt(doc.cycle);
mapDocumentByType[doc.type].push(doc);
});

return mapDocumentByType;
};

const getDocumentLatestCycle = (currentCycle, data) => {
const sortedData = [...data].sort(
(docA, docB) => docB.cycle_int - docA.cycle_int
);
return sortedData.find((doc) => doc.cycle_int <= currentCycle);
};

const getUserDocumentStatus = async (docId, docType) => {
const resp = await fetch(
`https://api.kampusmerdeka.kemdikbud.go.id/v1alpha1/documents/${docId}/users`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
).then((resp) => resp.json());

const status = resp?.data?.status;
if (!status) {
return `DATA ${docType} TIDAK DAPAT DITEMUKAN`;
}

return status;
};

const getCurrentDateTimeWIB = () => {
const date = new Date();
const options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
timeZone: 'Asia/Jakarta',
};
return date.toLocaleString('id-ID', options);
};

const main = async () => {
try {
const documentMapped = await getActiveDocuments();
const docsSPTJM = documentMapped['SPTJM'];
const docsSR = documentMapped['SURAT_REKOMENDASI'];

if (!docsSPTJM || !docsSR) {
throw 'Data SPTJM atau SURAT REKOMENDASI tidak ditemukan';
}

const validDocSPTJM = getDocumentLatestCycle(currentCycle, docsSPTJM);
const validDocsSR = getDocumentLatestCycle(currentCycle, docsSR);

if (!validDocSPTJM || !validDocsSR) {
throw 'Data SPTJM atau SURAT REKOMENDASI tidak ditemukan';
}

const sptjmId = validDocSPTJM.id;
const srId = validDocsSR.id;
const statusUserSptjm = await getUserDocumentStatus(sptjmId, 'SPTJM');
const statusUserSr = await getUserDocumentStatus(srId, 'SURAT REKOMENDASI');

const dateTimeWIB = getCurrentDateTimeWIB();

console.log(
`%c[${dateTimeWIB} WIB] Status SPTJM anda adalah %c${statusUserSptjm}`,
'font-size: 24px; color: black; background: white;',
`font-size: 30px; background: ${
statusUserSptjm === 'VERIFIED'
? 'green'
: statusUserSptjm === 'REJECTED'
? 'red'
: 'blue'
}; color: white;`
);
console.log(
`%c[${dateTimeWIB} WIB] Status SURAT REKOMENDASI anda adalah %c${statusUserSr}`,
'font-size: 24px; color: black; background: white;',
`font-size: 30px; background: ${
statusUserSr === 'VERIFIED'
? 'green'
: statusUserSr === 'REJECTED'
? 'red'
: 'blue'
}; color: white;`
);
} catch (err) {
printGenericError(err);
}
};

main();
```

5. Silahkan tunggu sebentar, dan baca status data yang ditampilkan pada console tersebut



*Contoh ketika status data SPTJM & Surat Rekomendasi (SR) anda sedang dalam proses review*

![image](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/assets/64502893/3a58788e-7083-4e28-840f-f2360c8fef3c)

### Userscript

TEKAN UNTUK MELIHAT

1. Instal ekstensi Tampermonkey
2. Instal userscript Cek Status Data SPTJM & SR | Kampus Merdeka Batch 5 2023 (akan dimuat secara otomatis di pengelola skrip pengguna)
3. Buka website kampusmerdeka.kemdikbud.go.id melalui browser Desktop PC / Laptop berikut:
* `Windows`: *Chrome / Firefox / Microsoft Edge / Opera / Brave / Vivaldi*

* `macOS`: *Safari*
4. Pastikan anda telah login
5. Buka devtools pada browser anda dengan cara:
* `Windows`: Gunakan shortcut keyboard `CTRL + SHIFT + J` / `Klik Kanan > Inspect > Console`

* `macOS`: Gunakan shortcut keyboard `CMD + OPTION + J`

6. Silahkan tunggu sebentar, dan terlihat status data yang ditampilkan secara otomatis pada console tersebut

*Contoh ketika status data SPTJM & Surat Rekomendasi (SR) anda sedang dalam proses review*

![image](https://github.com/okkidwi/cek-status-data-sptjm-sr-kampus-merdeka/assets/64502893/201aecf6-849c-4bbb-b41a-51610e34aaef)

## 📜 Riwayat Perubahan

- v1.0 - Menambahkan dukungan untuk Kampus Merdeka Batch 5 Tahun 2023

## ⭐ Star History

Star History Chart