성준영

electron 데스크탑 앱 구조 초기화

1 -node_modules/
...\ No newline at end of file ...\ No newline at end of file
1 +node_modules/
......
1 +/desktop-app
1 +<!DOCTYPE html>
2 +<html>
3 +<head>
4 + <meta charset="UTF-8">
5 + <title>KLAS 파일다운로더</title>
6 +
7 + <script>if (typeof module === 'object') {
8 + window.module = module;
9 + module = undefined;
10 + }</script>
11 +
12 + <!-- jquery -->
13 + <script src="public/js/jquery-3.2.1.min.js"></script>
14 +
15 + <script>if (window.module) module = window.module;</script>
16 +
17 +</head>
18 +<body>
19 +<script src="./logics.js"></script>
20 +
21 +<h1>KLAS FILE DOWNLOADER</h1>
22 +
23 +
24 +<button class="testBtn">테스트</button>
25 +</body>
26 +</html>
This diff is collapsed. Click to expand it.
1 +var functions = require('./functions');
2 +
3 +exports.getLectureList = function (id, pw, cb) {
4 + functions.login(id, pw)
5 + .then(functions.getLecture)
6 + .then(functions.getLectureLink)
7 + .then(function(res){
8 + cb(res);
9 + })
10 + .catch(function(err){
11 + cb(err);
12 + })
13 +};
14 +
15 +exports.getLectureFileLinks = function(lectureLink, cb){
16 + functions.getClassPageBody(lectureLink)
17 + .then(functions.findFiles)
18 + .then(function(res){
19 + cb(res);
20 + })
21 + .catch(function(err){
22 + cb(err);
23 + })
24 +};
...\ No newline at end of file ...\ No newline at end of file
1 +/**
2 + * Created by junyoung on 2017. 6. 7..
3 + */
4 +
5 +
6 +var klasFD = require('./klasFD/module');
7 +
8 +
9 +$(document).ready(function(){
10 +
11 + $('.testBtn').click(function(){
12 + klasFD.getLectureList('2012104095', 'Sung167300', function(res){
13 + console.log(res);
14 + var lectureLinkObj = res[2];
15 + klasFD.getLectureFileLinks(lectureLinkObj, function(res){
16 + console.log(res);
17 + })
18 + });
19 + })
20 +
21 +
22 +
23 +});
...\ No newline at end of file ...\ No newline at end of file
1 +const {app, BrowserWindow} = require('electron')
2 +const path = require('path')
3 +const url = require('url')
4 +
5 +// Keep a global reference of the window object, if you don't, the window will
6 +// be closed automatically when the JavaScript object is garbage collected.
7 +let win
8 +
9 +function createWindow () {
10 + // Create the browser window.
11 + win = new BrowserWindow({width: 800, height: 600})
12 +
13 + // and load the index.html of the app.
14 + win.loadURL(url.format({
15 + pathname: path.join(__dirname, 'index.html'),
16 + protocol: 'file:',
17 + slashes: true
18 + }))
19 +
20 + // Open the DevTools.
21 + win.webContents.openDevTools()
22 +
23 + // Emitted when the window is closed.
24 + win.on('closed', () => {
25 + // Dereference the window object, usually you would store windows
26 + // in an array if your app supports multi windows, this is the time
27 + // when you should delete the corresponding element.
28 + win = null
29 + })
30 +}
31 +
32 +// This method will be called when Electron has finished
33 +// initialization and is ready to create browser windows.
34 +// Some APIs can only be used after this event occurs.
35 +app.on('ready', createWindow)
36 +
37 +// Quit when all windows are closed.
38 +app.on('window-all-closed', () => {
39 + // On macOS it is common for applications and their menu bar
40 + // to stay active until the user quits explicitly with Cmd + Q
41 + if (process.platform !== 'darwin') {
42 + app.quit()
43 + }
44 +})
45 +
46 +app.on('activate', () => {
47 + // On macOS it's common to re-create a window in the app when the
48 + // dock icon is clicked and there are no other windows open.
49 + if (win === null) {
50 + createWindow()
51 + }
52 +})
53 +
54 +// In this file you can include the rest of your app's specific main process
55 +// code. You can also put them in separate files and require them here.
1 +{
2 + "name": "klasfd-desktop-app",
3 + "version": "0.1.0",
4 + "main": "main.js",
5 + "devDependencies": {
6 + "electron": "^1.6.10"
7 + },
8 + "dependencies": {
9 + "klas-file-downloader": "^0.2.7"
10 + }
11 +}
No preview for this file type
This diff is collapsed. Click to expand it.
1 +
2 +@font-face {
3 + font-family:'BMDOHYEON';
4 + src: url(/public/fonts/BMDOHYEON.ttf) format('truetype');
5 +}
...\ No newline at end of file ...\ No newline at end of file
1 +var functions = require('./functions');
2 +
3 +exports.getLectureList = function (id, pw) {
4 + console.log(id + " " + pw);
5 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 "name": "klas-file-downloader", 2 "name": "klas-file-downloader",
3 "version": "0.1.7", 3 "version": "0.1.7",
4 "description": "Project that download lecture reference files from Klas", 4 "description": "Project that download lecture reference files from Klas",
5 - "main": "index.js", 5 + "main": "module.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1" 7 "test": "echo \"Error: no test specified\" && exit 1"
8 }, 8 },
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 "url": "https://github.com/sungjunyoung/klas-file-downloader/issues" 22 "url": "https://github.com/sungjunyoung/klas-file-downloader/issues"
23 }, 23 },
24 "bin": { 24 "bin": {
25 - "klasFD": "./index.js" 25 + "klasFD": "./global.js"
26 }, 26 },
27 "homepage": "https://sungjunyoung.github.io", 27 "homepage": "https://sungjunyoung.github.io",
28 "dependencies": { 28 "dependencies": {
......