-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Displays a insightful quote in your chrome tab.
- Loading branch information
0 parents
commit a431290
Showing
11 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@import url(https://fonts.googleapis.com/css?family=Kalam:400,300); | ||
|
||
body { | ||
background: white | ||
} | ||
|
||
section { | ||
background: #e2e2e2; | ||
color: #000000; | ||
border-radius: 2em; | ||
padding: 1em; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
margin-right: -50%; | ||
transform: translate(-50%, -50%); | ||
width:600px; | ||
max-width:650px; | ||
font-size:160%; | ||
} | ||
|
||
.fortune { | ||
} | ||
|
||
.quote { | ||
font-family: 'Kalam', cursive; | ||
} | ||
|
||
.author { | ||
font-size: smaller; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var getRandomFortune = function () { | ||
var fortuneDiv = ".fortune"; | ||
var quotesUrl = "http://quotes-1271.appspot.com/json"; | ||
var defaultQuote = "There are far, far better things ahead than any we leave behind."; | ||
var defaultAuthor = "C.S.Lewis"; | ||
|
||
var getQuote = function() { | ||
var quotes = $("#quotes").html(); | ||
var template = Handlebars.compile(quotes); | ||
|
||
$.get(quotesUrl, function(response) { | ||
if (response) { | ||
$(fortuneDiv).append(template(response)); | ||
} | ||
}).fail(function(_) { | ||
$(fortuneDiv).append(template({quote:defaultQuote, author:defaultAuthor})) | ||
}); | ||
}; | ||
|
||
return { | ||
init: function () { | ||
getQuote(); | ||
} | ||
}; | ||
}; | ||
|
||
$(function () { | ||
var fortune = new getRandomFortune(); | ||
fortune.init(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<link rel="stylesheet" href="assets/css/style.css"> | ||
<link href="assets/img/icon16.png" rel="icon" sizes="16x16" type="image/png"> | ||
<title></title> | ||
</head> | ||
|
||
<body> | ||
|
||
<div class="fortune"> | ||
<script id="quotes" type="text/x-handlebars-template"> | ||
<section> | ||
<p class="quote">{{quote}}</p> | ||
<p class="quote author" align="right">{{author}}</p> | ||
</section> | ||
</script> | ||
</div> | ||
|
||
|
||
<script src="assets/js/jquery.js"></script> | ||
<script src="assets/js/handlebar.js"></script> | ||
<script src="assets/js/quotes.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"manifest_version" : 2, | ||
"name" : "fortune", | ||
"short_name": "fortune", | ||
"description": "insightful quote every time you open a new tab.", | ||
"version" : "0.1.0", | ||
"permissions": [ | ||
"tabs", | ||
"webNavigation", | ||
"*://quotes-1271.appspot.com/*", | ||
"http://quotes-1271.appspot.com/json", | ||
"https://fonts.googleapis.com/*" | ||
], | ||
"icons": { | ||
"16" : "assets/img/icon16.png", | ||
"48" : "assets/img/icon48.png", | ||
"128": "assets/img/icon128.png" | ||
}, | ||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", | ||
"homepage_url": "http://www.xtoinfinity.com/posts/fortune.html", | ||
"chrome_url_overrides": { | ||
"newtab": "fortune.html" | ||
}, | ||
"browser_action": { | ||
"default_title": "", | ||
"default_icon": "assets/img/icon256.png" | ||
} | ||
} | ||
|