Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
merged! we did it boys
Browse files Browse the repository at this point in the history
  • Loading branch information
soops committed Apr 30, 2016
2 parents b49c5c2 + 44f94e2 commit 15f549f
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 83 deletions.
45 changes: 45 additions & 0 deletions assets/WA.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions gulpfile.js
@@ -1,6 +1,7 @@
var gulp = require('gulp'),
sass = require('gulp-sass'),
packager = require('electron-packager');
sass = require('gulp-sass'),
packager = require('electron-packager'),
rimraf = require("gulp-rimraf");

require('shelljs/global');

Expand All @@ -11,7 +12,9 @@ gulp.task('sass', function() {
})

gulp.task('default', ['sass']);
//create gulp task "production"/"prod" for both package and build

// don't work too good
// gulp.task('produce', ['package', 'build']);

gulp.task('package', function() {7
var opts = {
Expand All @@ -23,7 +26,9 @@ gulp.task('package', function() {7
"out": "./",
"version": "0.36.5",
"prune": true, // prunes development packages off
"overwrite": true
}
gulp.src("./options.json").pipe(rimraf());
return packager(opts, function done (err, appPath) {
if (err) throw err;
console.log("Nimble packaged at " + appPath);
Expand Down
30 changes: 14 additions & 16 deletions index.js
Expand Up @@ -39,26 +39,24 @@ ipc.on('resize', function(event, arg) {
width: null
};

if (arg.height > 500) {
if (arg.height > 533) {
// if height is way too big, then just set it short and scroll
mb.window.setBounds({
x: mb.window.getPosition()[0],
y: mb.window.getPosition()[1],
width: arg.width,
height: 500,
animate: true
});
height: 533
}, true);

finalDim.height = 500;
finalDim.height = 533;
finalDim.width = arg.width;
} else {
mb.window.setBounds({
x: mb.window.getPosition()[0],
y: mb.window.getPosition()[1],
width: arg.width,
height: arg.height,
animate: true
});
height: arg.height
}, true);

finalDim.height = arg.height;
finalDim.width = arg.width;
Expand All @@ -78,17 +76,16 @@ ipc.on("toggleview", function(event) {
mb.showWindow();
}

mb.window.setPosition(position[0], position[1]);
})
mb.window.setPosition(position[0], position[1], true);
});

ipc.on("reset-window", function(event) {
mb.window.setBounds({
x: mb.window.getPosition()[0],
y: mb.window.getPosition()[1],
width: 380,
height: 42,
animate: true
});
}, true);

optfunc.position();
});
Expand Down Expand Up @@ -149,7 +146,9 @@ var optfunc = {
}
}


ipc.on("quit", function(){
app.quit();
})

mb.on('after-create-window', function() {
mb.window.setResizable(false);
Expand All @@ -160,8 +159,7 @@ mb.on('after-create-window', function() {
y: mb.window.getPosition()[1],
width: 380,
height: 42,
animate: true
});
}, true);

mb.tray
.on('click', click)
Expand All @@ -178,7 +176,7 @@ mb.on('after-create-window', function() {
}

function rightClick(e, bounds) {
app.quit();
mb.window.webContents.send("tray-rightclick");
}

// global hotkey to toggle nimble
Expand Down
5 changes: 3 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "Nimble",
"version": "1.0.2",
"version": "1.1.0",
"description": "A Wolfram|Alpha® menu bar app",
"main": "index.js",
"dependencies": {
Expand All @@ -21,6 +21,7 @@
"electron-packager": "^5.2.1",
"electron-prebuilt": "^0.36.0",
"gulp": "^3.9.0",
"gulp-rimraf": "^0.2.0",
"gulp-sass": "^2.1.0"
},
"scripts": {
Expand All @@ -37,7 +38,7 @@
"menubar"
],
"author": "Bright, Co.",
"license": "MIT",
"license": "CC by-nc",
"bugs": {
"url": "https://github.com/madebybright/nimble/issues"
},
Expand Down
20 changes: 19 additions & 1 deletion src/css/style.sass
Expand Up @@ -21,6 +21,24 @@ div.interpret
width: calc(100% - 32px)
color: white

div#wolfram-credit
background: $nimble-orange
font-family: $font-family
font-size: 14px
color: white
padding: 6px 16px
height: 18px
display: block

span
float: right
height: 100%
opacity: 0.8
span, img
vertical-align: middle
span img
height: 100%

// is it too late now to say sorry
div.sorry
font: normal normal normal 14px/1 FontAwesome
Expand Down Expand Up @@ -123,4 +141,4 @@ hr
-webkit-transform: rotate(0deg)

to
-webkit-transform: rotate(360deg)
-webkit-transform: rotate(360deg)
119 changes: 69 additions & 50 deletions src/index.html
Expand Up @@ -16,12 +16,21 @@
<i class="fa fa-search"></i>
</button>
</div>

<div class="interpret">
<em>Interpreted as:</em> <span id="queryInterpretation">query interpretation</span>
</div>
<div class="output">
<!-- temporary -->

<div class="output" id="outputParent">
<div id="output">
<!-- this is where output goes -->
</div>
</div>

<div id="wolfram-credit">
<span>powered by <a href="#" id="wolframlink"><img id="wolframlogo" src="../assets/WA.svg"></span></a>
</div>

<script src="../node_modules/loaders.css/loaders.css.js">
</script>
<script>
Expand Down Expand Up @@ -75,28 +84,22 @@
label: 'Select All',
accelerator: 'CmdOrCtrl+A',
role: 'selectall'
}, {
type: "separator"
}, {
label: "Plain Text Result",
accelerator: "CmdOrCtrl+Shift+C",
click: function() {
clipboardCopy.text()
}
}, {
label: 'Wolfram|Alpha Link',
accelerator: "CmdOrCtrl+Shift+L",
click: function() {
clipboardCopy.link()
}
}, {
label: "Image (in progress...)",
enabled: false,
accelerator: "CmdOrCtrl+Shift+I",
click: function() {
clipboardCopy.image()
}],
}, {
label: 'Help',
role: 'help',
submenu: [{
label: 'Learn More',
click: function() {
require('electron').shell.openExternal('http://madebybright.com')
}
}, {
label: 'Contact Support',
click: function() {
require('electron').shell.openExternal('mailto:info@madebybright.com')
}
}
}]
]
}, {
label: 'Window',
role: 'window',
Expand All @@ -107,13 +110,8 @@
}, {
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close'
}, {
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click: function(item, focusedWindow) {
if (focusedWindow)
focusedWindow.reload();
click: function() {
ipcRenderer.send("quit");
}
}, {
label: "Toggle Nimble (Global)",
Expand All @@ -122,24 +120,6 @@
ipcRenderer.send("toggleview");
}
}]
}, {
label: 'Help',
role: 'help',
submenu: [{
label: 'Learn More',
click: function() {
require('electron').shell.openExternal('http://madebybright.com')
}
}]
}, {
label: "Share",
submenu: [{
label: "Twitter",
accelerator: "CmdOrCtrl+Shift+T",
click: function() {
shareButton.twitter()
}
}]
}, {
label: "Preferences",
submenu: [{
Expand Down Expand Up @@ -173,13 +153,52 @@
}]
}];

var outputMenuItems = [{
label: "Share",
submenu: [{
label: "Twitter",
accelerator: "CmdOrCtrl+Shift+T",
click: function() {
shareButton.twitter()
}
}, {
label: "Copy Plain Text Result",
accelerator: "CmdOrCtrl+Shift+C",
click: function() {
clipboardCopy.text()
}
}, {
label: 'Copy Wolfram|Alpha® Link',
accelerator: "CmdOrCtrl+Shift+L",
click: function() {
clipboardCopy.link()
}
}, {
label: "Image (in progress...)",
enabled: false,
accelerator: "CmdOrCtrl+Shift+I",
click: function() {
clipboardCopy.image()
}
}]
}, {
type: "separator"
}];

var outputMenu = new Menu.buildFromTemplate(outputMenuItems.concat(menuItems));
var menuthing = new Menu.buildFromTemplate(menuItems);
var menuthingGlobal = Menu.setApplicationMenu(menuthing);

var body = document.getElementById("body-thing-idk");
body.addEventListener('contextmenu', function(e) {
var output = document.getElementById("outputParent");

$(".input, .interpret, #wolfram-credit").bind('contextmenu', function(e) {
e.preventDefault();
menuthing.popup(remote.getCurrentWindow());
});

output.addEventListener('contextmenu', function(e) {
e.preventDefault();
outputMenu.popup(remote.getCurrentWindow());
}, false);
</script>
</body>
Expand Down

0 comments on commit 15f549f

Please sign in to comment.