Skip to content

Commit 42e648a

Browse files
author
Matthew Roach
committed
0.1.0 - Inital Code
1 parent d26988e commit 42e648a

File tree

21 files changed

+1203
-0
lines changed

21 files changed

+1203
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
'presets': ['es2015', 'stage-2', 'react']
3+
}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# MicroReader
2+
3+
An electron desktop app for [micro.blog](http://micro.blog).
4+
5+
6+
## License
7+
8+
[MIT](LICENSE)

css/bootstrap.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/styles.css

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
body {
2+
font-family: Avenir, "Segoe UI", Verdana;
3+
font-size: 16px;
4+
line-height: 25px;
5+
}
6+
7+
p {
8+
padding-top: 4px;
9+
}
10+
11+
img {
12+
max-width: 100%;
13+
max-height: 500px;
14+
height: auto;
15+
}
16+
17+
.container {
18+
max-width: 650px;
19+
}
20+
21+
.admin_container {
22+
max-width: 1200px;
23+
}
24+
25+
h1 {
26+
height: 60px;
27+
padding-left: 70px;
28+
padding-top: 10px;
29+
background-image: url('../images/logo_640.png');
30+
background-size: 320px 60px;
31+
background-repeat: no-repeat;
32+
}
33+
34+
@media screen and (min-width: 320px) {
35+
h1 {
36+
height: 53px;
37+
background-size: 280px 53px;
38+
}
39+
}
40+
41+
h1 .today {
42+
display: none;
43+
}
44+
45+
h2 {
46+
font-size: 22px;
47+
font-weight: 500;
48+
line-height: 28px;
49+
padding-top: 0px;
50+
padding-bottom: 5px;
51+
margin-top: 10px;
52+
}
53+
54+
h3 {
55+
font-size: 22px;
56+
font-weight: normal;
57+
line-height: 28px;
58+
padding-top: 10px;
59+
padding-bottom: 5px;
60+
margin-top: 0px;
61+
}
62+
63+
#navbar {
64+
padding-top: 8px;
65+
padding-bottom: 10px;
66+
}
67+
68+
69+
#nav {
70+
padding: 0;
71+
}
72+
73+
.nav {
74+
background: white;
75+
border-top: 1px solid rgb(243, 243, 243);
76+
bottom: 0;
77+
left: 0;
78+
position: fixed;
79+
text-align: center;
80+
width: 100%;
81+
}
82+
83+
.nav a {
84+
display: inline-block;
85+
padding: 0.5em;
86+
}
87+
88+
.active {
89+
font-weight: bold;
90+
}
91+
92+
.nav_divider {
93+
display: inline-block;
94+
color: white;
95+
}
96+
97+
.highlight {
98+
background-color: #FFF9D6;
99+
}
100+
101+
#timeline_info {
102+
margin-top: 10px;
103+
}
104+
105+
106+
.posts {
107+
padding: 1.5em 0 8em 0;
108+
}
109+
110+
.post {
111+
padding-top: 0px;
112+
padding-bottom: 20px;
113+
}
114+
115+
.post_avatar {
116+
display: inline-block;
117+
vertical-align: top;
118+
padding-top: 5px;
119+
padding-right: 6px;
120+
}
121+
122+
.post_avatar img {
123+
border-radius: 24px;
124+
}
125+
126+
.post_content {
127+
display: inline-block;
128+
vertical-align: top;
129+
width: 85%;
130+
}
131+
132+
.post_username a {
133+
font-weight: bold;
134+
color: #333333;
135+
}
136+
137+
.post_options {
138+
font-size: 12px;
139+
color: gray;
140+
}
141+
142+
.post_options a:not(:first-child) {
143+
margin: 0 0 0 1em
144+
}
145+
146+
.post_time {
147+
display: inline-block;
148+
}
149+
150+
.post_time a {
151+
color: gray;
152+
}
153+
154+
.post_divider {
155+
display: inline-block;
156+
color: white;
157+
}
158+
159+
.post_reply {
160+
display: inline-block;
161+
}
162+
163+
.post_delete {
164+
display: inline-block;
165+
}
166+
167+
.post_favorite {
168+
display: inline-block;
169+
}
170+
171+
.post_replybox {
172+
padding-top: 10px;
173+
}
174+
175+
.replybox_button {
176+
width: 80px;
177+
margin-left: 8px;
178+
}
179+
180+
181+
182+
#follow_div {
183+
display: inline-block;
184+
}
185+
186+
187+
#post_prompt {
188+
padding-top: 5px;
189+
padding-bottom: 10px;
190+
}
191+
192+
#post_sample {
193+
padding-top: 8px;
194+
padding-bottom: 8px;
195+
}
196+
197+
#posting_alert {
198+
margin-top: 10px;
199+
}
200+
201+
.posting_chars_container {
202+
text-align: center;
203+
font-size: 14px;
204+
padding-top: 6px;
205+
}

images/icon.icns

59.5 KB
Binary file not shown.

images/icon.png

28.4 KB
Loading

images/logo_640.png

34.1 KB
Loading

index.html

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>MicroReader</title>
6+
<link rel="stylesheet" href="css/bootstrap.min.css">
7+
<link rel="stylesheet" href="css/styles.css">
8+
</head>
9+
<body style="-webkit-app-region: drag">
10+
11+
<div class="container">
12+
<div id="app"></div>
13+
</div>
14+
15+
<script>
16+
const shell = require('electron').shell
17+
18+
19+
// Load JS file
20+
const script = document.createElement('script');
21+
script.src = process.env.ENV === 'development' ? 'http://localhost:9000/js/app.js' : './js/app.js'
22+
document.write(script.outerHTML)
23+
24+
// Open links externally by default
25+
let externalLinks = Array.from(document.querySelectorAll('body'))
26+
externalLinks.forEach(function(element) {
27+
element.addEventListener('click', function(e) {
28+
const tagname = e.target.tagName.toLowerCase()
29+
const tagHref = e.target.href
30+
if ( tagname === 'a' && tagHref.indexOf('https://micro.blog') !== -1 && tagHref.split('https://micro.blog/').length === 2 ) {
31+
if ( tagHref.split('https://micro.blog/')[1].indexOf('/') === -1 ) {
32+
e.preventDefault()
33+
window.location.hash = 'user/' + tagHref.split('https://micro.blog/')[1]
34+
return
35+
}
36+
}
37+
if ( tagname === 'a' && tagHref.indexOf('http') !== -1 ) {
38+
e.preventDefault()
39+
shell.openExternal(e.target.href)
40+
}
41+
})
42+
}, this)
43+
44+
</script>
45+
</body>
46+
</html>

main.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
const {app, BrowserWindow, Menu} = require('electron')
2+
const path = require('path')
3+
const url = require('url')
4+
const appVersion = require('./package.json').version;
5+
const os = require('os').platform();
6+
7+
// Keep a global reference of the window object, if you don't, the window will
8+
// be closed automatically when the JavaScript object is garbage collected.
9+
let win
10+
11+
function createWindow() {
12+
13+
// Create the browser window.
14+
win = new BrowserWindow({
15+
width: process.env.ENV === 'development' ? 1200 : 450,
16+
height: 800,
17+
icon: path.join(__dirname, '/images/logo_640.png')
18+
})
19+
20+
// and load the index.html of the app.
21+
win.loadURL(url.format({
22+
pathname: path.join(__dirname, 'index.html'),
23+
protocol: 'file:',
24+
slashes: true
25+
}))
26+
27+
// Emitted when the window is closed.
28+
win.on('closed', () => {
29+
// Dereference the window object, usually you would store windows
30+
// in an array if your app supports multi windows, this is the time
31+
// when you should delete the corresponding element.
32+
win = null
33+
})
34+
35+
// Create the Application's main menu
36+
var template = [{
37+
label: "Application",
38+
submenu: [
39+
{ label: "About Application", selector: "orderFrontStandardAboutPanel:" },
40+
{ type: "separator" },
41+
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit() }}
42+
]}, {
43+
label: "Edit",
44+
submenu: [
45+
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
46+
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
47+
{ type: "separator" },
48+
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
49+
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
50+
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
51+
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
52+
]}
53+
]
54+
55+
// Don't set menu items in development
56+
if ( process.env.ENV !== 'development' ) {
57+
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
58+
}
59+
60+
// Open the DevTools - Only for development env
61+
if ( process.env.ENV === 'development' ) {
62+
win.webContents.openDevTools()
63+
}
64+
65+
}
66+
67+
// This method will be called when Electron has finished
68+
// initialization and is ready to create browser windows.
69+
// Some APIs can only be used after this event occurs.
70+
app.on('ready', createWindow)
71+
72+
// Quit when all windows are closed.
73+
app.on('window-all-closed', () => {
74+
// On macOS it is common for applications and their menu bar
75+
// to stay active until the user quits explicitly with Cmd + Q
76+
if ( process.platform !== 'darwin' ) {
77+
app.quit()
78+
}
79+
})
80+
81+
app.on('activate', () => {
82+
// On macOS it's common to re-create a window in the app when the
83+
// dock icon is clicked and there are no other windows open.
84+
if ( win === null ) {
85+
createWindow()
86+
}
87+
})

package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "microreader",
3+
"version": "0.1.0",
4+
"description": "A desktop application for micro.blog",
5+
"main": "main.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"build": "npm run webpack && npm run app:macosx",
9+
"dev": "npm run start:electron | npm run webpack:dev",
10+
"start:electron": "ENV=development electron .",
11+
"app:macosx": "./node_modules/.bin/electron-packager . MicroReader --ignore=node_modules --icon=images/icon.icns --overwrite --out=release-builds",
12+
"webpack": "./node_modules/.bin/webpack",
13+
"webpack:dev": "./node_modules/.bin/webpack-dev-server --progress --colors --hot --inline --content-base public/"
14+
},
15+
"author": {
16+
"name": "Matthew Roach",
17+
"url": "http//matthewroach.me"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/matthewroach/microreader.git"
22+
},
23+
"license": "MIT",
24+
"dependencies": {
25+
"electron": "^1.7.2",
26+
"electron-config": "^1.0.0",
27+
"react": "^15.5.4",
28+
"react-dom": "^15.5.4",
29+
"react-router-dom": "^4.1.1"
30+
},
31+
"devDependencies": {
32+
"babel-core": "^6.24.1",
33+
"babel-loader": "^6.4.1",
34+
"babel-preset-es2015": "^6.24.1",
35+
"babel-preset-react": "^6.24.1",
36+
"babel-preset-stage-2": "^6.24.1",
37+
"electron-packager": "^8.7.0",
38+
"webpack": "^2.4.1",
39+
"webpack-dev-server": "^2.4.2"
40+
}
41+
}

0 commit comments

Comments
 (0)