Initial commit
This commit is contained in:
commit
b1814b7ce4
3
README
Normal file
3
README
Normal 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
22
freshbooks-resizer.js
Normal 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()">▼</span>';
|
||||
|
||||
bodyTag.appendChild(resizerDiv);
|
||||
}
|
||||
|
||||
insertFreshbooksResizer();
|
19
injected.js
Normal file
19
injected.js
Normal 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 = "▲";
|
||||
}
|
||||
else{
|
||||
window.resizeTo(window.normalWidth,window.normalHeight);
|
||||
resizeButton.innerHTML = "▼";
|
||||
}
|
||||
}
|
15
manifest.json
Normal file
15
manifest.json
Normal 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"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user