Skip to content

Commit

Permalink
Merge branch 'refs/heads/feature/notification'
Browse files Browse the repository at this point in the history
Conflicts:
	background.html

Signed-off-by: Rifat Nabi <to.rifat@gmail.com>
  • Loading branch information
torifat committed Mar 30, 2012
2 parents b467eb9 + ca82984 commit 9c515d5
Show file tree
Hide file tree
Showing 8 changed files with 712 additions and 43 deletions.
42 changes: 1 addition & 41 deletions background.html
Expand Up @@ -2,47 +2,7 @@
<html>
<head>
<title>Background Page</title>
<script>
chrome.extension.onRequest.addListener(
function (request, sender, sendResponse) {
'use strict';
if (!!request.status) {
chrome.pageAction.setIcon({tabId: sender.tab.id, path: 'images/icon-16.png'});
} else {
chrome.pageAction.setIcon({tabId: sender.tab.id, path: 'images/icon-16-dim.png'});
}
chrome.pageAction.show(sender.tab.id);
sendResponse({});
}
);

// http://stackoverflow.com/questions/2399389/chrome-extension-first-run
function onInstall() {
console.log("Extension Installed");
}

function onUpdate() {
console.log("Extension Updated");
}

function getVersion() {
var details = chrome.app.getDetails();
return details.version;
}

// Check if the version has changed.
var currVersion = getVersion();
var prevVersion = localStorage['version']
if (currVersion != prevVersion) {
// Check if we just installed this extension.
if (typeof prevVersion == 'undefined') {
onInstall();
} else {
onUpdate();
}
localStorage['version'] = currVersion;
}
</script>
<script src="js/background.js"></script>
</head>
<body>
</body>
Expand Down
102 changes: 102 additions & 0 deletions css/jquery.noty.css
@@ -0,0 +1,102 @@

/* CORE STYLES */

/* noty bar */
.noty_bar {
position: fixed;
display: none;
z-index: 9999999;
}

/* noty_message */
.noty_bar .noty_message {

}

/* noty_buttons */
.noty_bar .noty_message .noty_buttons {

}

/* noty_button */
.noty_bar .noty_message .noty_buttons button {

}

/* noty close button */
.noty_bar .noty_close {
cursor: pointer;
}

/* noty modal */
.noty_modal {
position: fixed;
width: 100%;
height: 100%;
background-color: #000;
z-index: 10000;
opacity: 0.6;
display: none;
left: 0;
top: 0;
}

/* noty container for noty_layout_topLeft & noty_layout_topRight */
ul.noty_container {
position: fixed;
z-index: 9999999;
margin: 0px;
padding: 0px;
list-style: none;
width: 300px;
}
ul.noty_container li {
position: relative;
float: left;
clear: both;
list-style: none;
padding: 0px;
margin: 10px 0 0 0;
width: 300px; /* Fix for: http://bugs.jquery.com/ticket/2278 */
}
ul.noty_container.noty_layout_topLeft {left:20px; top:20px;}
ul.noty_container.noty_layout_topRight {right:40px; top:20px;}
ul.noty_container.noty_layout_bottomLeft {left:20px; bottom:20px}
ul.noty_container.noty_layout_bottomRight {right:40px; bottom:20px}
ul.noty_container.noty_layout_topRight li {float:right}

/* LAYOUTS */

/* noty_layout_top */
.noty_bar.noty_layout_top {
top: 0;
left: 0;
width: 100%;
}

/* noty_layout_bottom */
.noty_bar.noty_layout_bottom {
bottom: 0;
left: 0;
width: 100%;
}

/* noty_layout_center */
.noty_bar.noty_layout_center {
top: 40%;
}

/* noty_layout_topLeft & noty_layout_topRight */
.noty_bar.noty_layout_topLeft,
.noty_bar.noty_layout_topRight,
.noty_bar.noty_layout_bottomLeft,
.noty_bar.noty_layout_bottomRight {
width: 100%;
clear: both;
position: relative;
}

/* noty_layout_topCenter */
.noty_bar.noty_layout_topCenter {
top: 20px;
}
159 changes: 159 additions & 0 deletions css/noty_theme_default.css
@@ -0,0 +1,159 @@

/* CORE STYLES*/

/* noty bar */
.noty_bar.noty_theme_default {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAoCAYAAAAPOoFWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAPZJREFUeNq81tsOgjAMANB2ov7/7ypaN7IlIwi9rGuT8QSc9EIDAsAznxvY4pXPKr05RUE5MEVB+TyWfCEl9LZApYopCmo9C4FKSMtYoI8Bwv79aQJU4l6hXXCZrQbokJEksxHo9KMOgc6w1atHXM8K9DVC7FQnJ0i8iK3QooGgbnyKgMDygBWyYFZoqx4qS27KqLZJjA1D0jK6QJcYEQEiWv9PGkTsbqxQ8oT+ZtZB6AkdsJnQDnMoHXHLGKOgDYuCWmYhEERCI5gaamW0bnHdA3k2ltlIN+2qKRyCND0bhqSYCyTB3CAOc4WusBEIpkeBuPgJMAAX8Hs1NfqHRgAAAABJRU5ErkJggg==') repeat-x scroll left top #fff;
}

/* noty_message */
.noty_bar.noty_theme_default .noty_message {
padding: 10px 30px;
font-size: 16px;
font-weight: bold;
width: auto;
}

/* noty_buttons */
.noty_bar.noty_theme_default .noty_message .noty_buttons {
float: right;
font-size: 13px;
margin-top: -4px;
margin-left: 4px;
}

/* noty_button */
.noty_bar.noty_theme_default .noty_message .noty_buttons button {
margin-left: 5px;
}

/* noty close button */
.noty_bar.noty_theme_default .noty_close {
position: absolute;
top: 10px;
right: 10px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAORJREFUeNq0lU0OgjAQhRm5gUl3rLyBB3BDQjwI4TDcgmu4NqwNJGxdueqWA4zzCJoxtvxoeckLzbz2C5ShEDNHDiXis/gkPooPY/0uvomv4ov48bUSQGUSF+Ka51WPc0kzNGwvLnm9ynHtB5B+hGkoaWDB/6t4AZOFe7ZkTxMAc1dqreU0TbnrunetbVvOsmzIPMoBrFwJYGgCY8wAgjFGDZlHFYCNK9EAXPUYmUcNgL0v1dAFMKjfRSsVx/H0hC0eOfhLmWwbfTcYozbXNsEbO/int8nhEPz4CnbAUuhfwFOAAQAA48KKOuexjwAAAABJRU5ErkJggg==');
width: 20px;
height: 20px;
}

/* noty modal */
.noty_modal.noty_theme_default {
opacity: 0.7;
}

/* LAYOUTS */

/* noty_layout_top */
.noty_bar.noty_theme_default.noty_layout_top {
border-bottom: 3px solid #eee;
}

/* noty_layout_bottom */
.noty_bar.noty_theme_default.noty_layout_bottom {
border-top: 3px solid #eee;
}

/* noty_layout_center */
.noty_bar.noty_theme_default.noty_layout_center {
width: auto;
padding: 4px;
border: 3px solid #eee;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.noty_bar.noty_theme_default.noty_layout_center .noty_close {
right: -9px;
top: -10px;
}

/* noty_layout_topLeft & noty_layout_topRight */
.noty_bar.noty_theme_default.noty_layout_topLeft,
.noty_bar.noty_theme_default.noty_layout_topRight,
.noty_bar.noty_theme_default.noty_layout_bottomLeft,
.noty_bar.noty_theme_default.noty_layout_bottomRight {
padding: 4px;
border: 3px solid #eee;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.noty_bar.noty_theme_default.noty_layout_topLeft .noty_close,
.noty_bar.noty_theme_default.noty_layout_topRight .noty_close,
.noty_bar.noty_theme_default.noty_layout_bottomLeft .noty_close,
.noty_bar.noty_theme_default.noty_layout_bottomRight .noty_close {
right: -9px;
top: -10px;
}
.noty_bar.noty_theme_default.noty_layout_topLeft .noty_message .noty_buttons,
.noty_bar.noty_theme_default.noty_layout_topRight .noty_message .noty_buttons,
.noty_bar.noty_theme_default.noty_layout_bottomLeft .noty_message .noty_buttons,
.noty_bar.noty_theme_default.noty_layout_bottomRight .noty_message .noty_buttons {
float: none;
font-size: 13px;
border-top: 1px solid #CCCCCC;
margin-left: 0;
margin-top: 10px;
padding-top: 10px;
text-align: right;
}

/* noty_layout_topCenter */
.noty_bar.noty_theme_default.noty_layout_topCenter {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.noty_bar.noty_theme_default.noty_layout_topCenter .noty_message {
font-weight: normal;
font-size: 13px;
width: auto;
padding: 10px 15px;
}
.noty_bar.noty_theme_default.noty_layout_topCenter.noty_error .noty_message {
font-weight: bold;
}
.noty_bar.noty_theme_default.noty_layout_topCenter .noty_close {
top: 50%;
margin-top: -10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
right: -10px;
}
.noty_bar.noty_theme_default.noty_layout_topCenter.noty_success {
border: 1px solid #50C24E;
}
.noty_bar.noty_theme_default.noty_layout_topCenter .noty_message .noty_buttons {
margin-left: 15px;
margin-top: 0px
}
.noty_bar.noty_theme_default.noty_layout_topCenter .noty_message .noty_buttons button {
font: bold 12px/12px HelveticaNeue, Arial;
padding: 3px 4px;
color: #555;
background: none;
border: none;
}

/* NOTIFICATION TYPES */

/* noty_alert */
.noty_bar.noty_theme_default.noty_alert {
background-color: #fff;
border-color: #ccc;
}
/* noty_error */
.noty_bar.noty_theme_default.noty_error {
background-color: red;
color: #fff;
border-color: darkred;
}
/* noty_success */
.noty_bar.noty_theme_default.noty_success {
background-color: lightgreen;
color: darkgreen;
border-color: darkgreen;
}
104 changes: 104 additions & 0 deletions css/noty_theme_mitgux.css

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions js/background.js
@@ -0,0 +1,77 @@
/*
=============================================================================
*****************************************************************************
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is Avro Keyboard for Google Chrome
The Initial Developer of the Original Code is
Rifat Nabi <to.rifat@gmail.com>
Copyright (C) OmicronLab (http://www.omicronlab.com). All Rights Reserved.
Contributor(s): ______________________________________.
*****************************************************************************
=============================================================================
*/
/*global jQuery, chrome, console, document, window, localStorage */
chrome.extension.onRequest.addListener(
function (request, sender, sendResponse) {
'use strict';
switch(request.method) {
case 'handleStatus':
if (!!request.status) {
chrome.pageAction.setIcon({tabId: sender.tab.id, path: 'images/icon-16.png'});
} else {
chrome.pageAction.setIcon({tabId: sender.tab.id, path: 'images/icon-16-dim.png'});
}
chrome.pageAction.show(sender.tab.id);
sendResponse({});
break;
case 'popupCount':
if(typeof localStorage.popupCount === 'undefined') {
localStorage.popupCount = 0;
}
localStorage.popupCount++;
sendResponse({popupCount: localStorage.popupCount});
break;
}
}
);

// http://stackoverflow.com/questions/2399389/chrome-extension-first-run
function onInstall() {
console.log("Extension Installed");
}

function onUpdate() {
console.log("Extension Updated");
}

function getVersion() {
var details = chrome.app.getDetails();
return details.version;
}

// Check if the version has changed.
var currVersion = getVersion(),
prevVersion = localStorage.version;
if (currVersion != prevVersion) {
// Check if we just installed this extension.
if (typeof prevVersion == 'undefined') {
onInstall();
} else {
onUpdate();
}
localStorage.version = currVersion;
}

0 comments on commit 9c515d5

Please sign in to comment.