Skip to content

Commit

Permalink
Removed some obsolete comments and updated the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Stevens committed Oct 20, 2014
1 parent c94440f commit f0271a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
slacky
======

Simple Slack app for Chrome I created because I hate having it open in another tab :)
[![Build Status](https://travis-ci.org/trjast/slacky.svg)](https://travis-ci.org/trjast/slacky)

Slacky is a simple Slack app for Chrome created because I hated having it open in another tab :)
27 changes: 8 additions & 19 deletions app/slacky.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ chrome.app.runtime.onLaunched.addListener(function() {

function createWindow(destUrl) {
chrome.app.window.create(
// We're allowed to just render the same view for all pages because we can
// just change the webview src to reflect the requested page
//
// Other benefits include having the same document store of cookies and sessions
// so everything persists accross new windows -- sweet!
view, {
// Set the height and width and then rander it in the middle of the screen
bounds: {
Expand All @@ -39,21 +34,15 @@ function createWindow(destUrl) {
webview.style.height = bounds.height;
webview.style.width = bounds.width;
});
// Render the page requested inside the webviuew
// Render the page requested inside the webview
webview.src = destUrl;
// Set links opened off the base page to open in a new window
// but ones opened off child windows to open in the same window
windowEventHandlers(webview, (destUrl === baseUrl));
webview.addEventListener('newwindow', function(event) {
// Event handler for when external links are clicked because of
// the Chrome packaged app security restriction on opening links in the regular browser
event.preventDefault();
window.open(event.targetUrl);
});
};
}
);
}

function windowEventHandlers(webview, _blank) {
webview.addEventListener('newwindow', function(event) {
// Event handler for when external links are clicked because of
// the Chrome packaged app security restriction on opening links in the regular browser
event.preventDefault();
window.open(event.targetUrl);
});
}
}

0 comments on commit f0271a2

Please sign in to comment.