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
{ | |
"manifest_version": 2, | |
"name": "Awwe", | |
"description": "Makes the new tab some cute pups!", | |
"version": "0.0.1", | |
"permissions": [ | |
"storage" | |
], | |
"chrome_url_overrides": { | |
"newtab": "newtab.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
<html> | |
<head> | |
<title>Awwe Tab</title> | |
<link rel="stylesheet" type="text/css" href="styles.css" /> | |
</head> | |
<body> | |
<main class="main"> | |
<h1 class="greeting">HELLO WORLD!</h1> | |
</main> | |
<script type="text/javascript" src="script.js"></script> |
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
html, | |
body { | |
margin: 0; | |
padding: 0; | |
height: 100%; | |
width: 100%; | |
} | |
.main { | |
background-position: 50% 50%; | |
background-repeat: no-repeat; |
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
// QUESTION 1 | |
var combineArgs = function( a, b ){ | |
alert(a + b); | |
}; | |
combineArgs("This question ", "is easy"); | |
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
// array of cute pups! | |
var pups = [ | |
"http://bit.ly/1JfFy1x", | |
"http://bit.ly/1I0JoPI", | |
"http://bit.ly/1gA0nhg", | |
"http://bit.ly/1HtUxEP", | |
"http://bit.ly/1M8w9ix" | |
]; | |
// randomly selects a pup image url and returns the string with the "url" stuff attached | |
var bgPlz = function(){ |
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
/// look in chrome.storage for an item "name" | |
chrome.storage.sync.get( 'name', function( val ){ | |
// check if we have a name | |
if( !val.name ){ | |
// get, set & store a new name | |
getSetAndStoreName(); | |
}else{ | |
// use the name found to set .greeting | |
document.querySelector(".greeting").innerHTML = "Hey there "+val.name+"!"; | |
} |
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
{ | |
"manifest_version": 2, | |
"name": "Awwe", | |
"description": "Makes the new tab some cute pups!", | |
"version": "0.0.1", | |
"permissions": [ | |
"storage" | |
], | |
"chrome_url_overrides": { | |
"newtab": "newtab.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
//[BROKEN] | |
var IceCream = { | |
flavors: [ 'vanilla', 'chocolate', 'bubblegum' ], | |
newFlavor: 'banana', | |
addNewFlavor: function( ){ | |
var safeToAdd = true; | |
// check if we've added it already | |
this.flavors.forEach(function(flavor){ | |
if(flavor === this.newFlavor) // <- this throws an error |
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
// [WORKS FINE BUT NOT IDEAL] | |
addNewFlavor: function( ){ | |
var safeToAdd = true, | |
context = this; | |
// check if we've added it already | |
this.flavors.forEach(function(flavor){ | |
if(flavor === context.newFlavor) | |
safeToAdd = false; | |
}); |
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
addNewFlavor: function( ){ | |
var safeToAdd = true | |
// check if we've added it already | |
this.flavors.forEach(function(flavor){ | |
if(flavor === this.newFlavor) | |
safeToAdd = false; | |
}.bind(this)); | |
if(safeToAdd) | |
this.flavors.push(this.newFlavor); | |
} |