Initial commit

This commit is contained in:
Will Bradley 2013-05-02 16:44:27 -07:00
commit b1814b7ce4
4 changed files with 59 additions and 0 deletions

3
README Normal file
View File

@ -0,0 +1,3 @@
This Chrome extension puts a resize button inside the Freshbooks Timer so you can quickly resize the window and continue working with it in the corner of your screen.
Written by Will Bradley, 2013, released to the public domain.

22
freshbooks-resizer.js Normal file
View File

@ -0,0 +1,22 @@
function injectJs(link) {
var scr = document.createElement('script');
scr.type="text/javascript";
scr.src=link;
document.getElementsByTagName('head')[0].appendChild(scr)
//document.body.appendChild(scr);
}
injectJs(chrome.extension.getURL('injected.js'));
function insertFreshbooksResizer() {
var bodyTag = document.getElementsByTagName('body')[0];
var resizerDiv = document.createElement('div');
resizerDiv.setAttribute('id',"freshbooks-resizer");
resizerDiv.setAttribute('style',"position:absolute;top: 0;right: 0;z-index: 1000;font-size: 16px;color: white;border: 1px solid white;line-height: 1em;");
resizerDiv.innerHTML = '<span id="freshbooks-resize-button" style="cursor:pointer" onclick="freshbooksResize()">&#x25BC</span>';
bodyTag.appendChild(resizerDiv);
}
insertFreshbooksResizer();

19
injected.js Normal file
View File

@ -0,0 +1,19 @@
window.normalWidth = window.outerWidth;
window.normalHeight = window.outerHeight;
window.minWidth = 250;
window.minHeight = 160;
function freshbooksResize(){
var resizeButton = document.getElementById("freshbooks-resize-button");
if(window.outerHeight == window.normalHeight){
window.resizeTo(window.minWidth,window.minHeight);
resizeButton.innerHTML = "&#x25B2;";
}
else{
window.resizeTo(window.normalWidth,window.normalHeight);
resizeButton.innerHTML = "&#x25BC;";
}
}

15
manifest.json Normal file
View File

@ -0,0 +1,15 @@
{
"manifest_version": 2,
"name": "Freshbooks Timer Resizer",
"description": "This extension lets you easily minimize the Freshbooks Timesheet timer window.",
"version": "1.0",
"content_scripts": [
{
"matches": ["https://*.freshbooks.com/internal.php*"],
"js": ["freshbooks-resizer.js","injected.js"]
}
],
"web_accessible_resources": ["injected.js"]
}