Initial push...

This commit is contained in:
Maxim Stewart 2018-05-01 19:04:30 -05:00
parent 6e274c35bd
commit 9b8db70b0d
11 changed files with 306 additions and 0 deletions

12
README.md Normal file
View File

@ -0,0 +1,12 @@
# Alt Tab Page
Alt Tab Page allows the user to select their preferred load page for new tabs and defaults to Google's when not in use.
# Download
https://addons.mozilla.org/en-US/firefox/addon/alt-tab-page/
# Version: 1.0.0
Initial release.
# Images
![1 settings](images/pic1.png)
![2 icon logo](images/pic1.png)

171
altTabPage.svg Normal file
View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg3363"
version="1.1"
inkscape:version="0.91 r13725"
viewBox="0 0 64 64"
sodipodi:docname="altTabPage.svg"
inkscape:export-filename="/home/abaddon/Coding/Projects/FireFox_Plugins/000_Usable/AltTabPage/src/icons/altTabPage.png"
inkscape:export-xdpi="135"
inkscape:export-ydpi="135">
<defs
id="defs3365" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.5"
inkscape:cx="-19.636363"
inkscape:cy="46.181818"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="990"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1" />
<metadata
id="metadata3368">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<rect
style="fill:#ececec"
id="rect3377"
width="34.18182"
height="54.727272"
x="14.363637"
y="3.8181818"
ry="7.8181849"
rx="0" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:7.5px;line-height:972.0000267%;font-family:sans-serif;text-align:center;letter-spacing:35.63999939px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="17.272726"
y="17.818182"
id="text3382"
sodipodi:linespacing="972.00003%"><tspan
sodipodi:role="line"
id="tspan3384"
x="17.272726"
y="17.818182" /></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:7.5px;line-height:972.0000267%;font-family:sans-serif;text-align:center;letter-spacing:35.63999939px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="32"
y="20.909092"
id="text3398"
sodipodi:linespacing="972.00003%"><tspan
sodipodi:role="line"
id="tspan3400"
x="32"
y="20.909092" /></text>
<image
y="13.272728"
x="-1.8181822"
id="image3355"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAQAAABpN6lAAAAABGdBTUEAANkE3LLaAgAAB3xJREFU
eNrtmkuMHEcdxn/V0zszu95dB6+8xvbGOMGyRCTztIAcgixFCBQJUA5wQCA5ijjADQ6QCKQggYQT
BOTMJUQKUo6c4ABBQlw4QCQShSAsFFskceS1nWTjfcx0dxWH6e7pR1V1z8wGT8z/G81MdXVPd3/f
/1XVNSAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCAQCgUBwm0NN+Sv1swfVueAjnfv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8PZAwxC4eQHV
5wnuUQEYthsG0LZHZzuWHGDim7DHdNjmvYUY2L0y0mRkji5rfICTrKX/iLvdMeA6l7jMdYZh6hdD
trjKXroGcrsj4m3eZoDOPCCgxzLL9N4jfwScFQkD3mGbATp/JkhI+H9CP5v5x84FRYFAIBAIBAKB
QCAQCAQCgUAgEAgEAoFAIBAIBAKBQCAQCASC2wH/BSAfKW+d6u/CAAAAAElFTkSuQmCC
"
preserveAspectRatio="none"
height="78.363632"
width="67.090904" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:19.98666px;line-height:972.0000267%;font-family:sans-serif;text-align:center;letter-spacing:94.97660065px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="41.20261"
y="62.528061"
id="text3406"
sodipodi:linespacing="972.00003%"
transform="scale(1.1275552,0.88687454)"><tspan
sodipodi:role="line"
id="tspan3408"
x="59.02261"
y="62.528061">T</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:19.20728683px;line-height:972.0000267%;font-family:sans-serif;text-align:center;letter-spacing:91.27302551px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="17.370365"
y="61.147182"
id="text3394"
sodipodi:linespacing="972.00003%"
transform="scale(1.0990507,0.90987616)"><tspan
sodipodi:role="line"
id="tspan3396"
x="35.190365"
y="61.147182">A</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:20.30522728px;line-height:972.0000267%;font-family:sans-serif;text-align:center;letter-spacing:96.49042511px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="27.501137"
y="65.364082"
id="text3402"
sodipodi:linespacing="972.00003%"
transform="scale(1.1786966,0.84839473)"><tspan
sodipodi:role="line"
id="tspan3404"
x="73.916016"
y="65.364082">L</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
images/pic1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
images/pic2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

22
src/manifest.json Normal file
View File

@ -0,0 +1,22 @@
{
"manifest_version": 2,
"name": "Alt Tab Page",
"version": "1.0.0",
"description": "Alt Tab Page helps set the preferred load page for new tabs.",
"applications": {
"gecko": {
"id": "altTabPage@itdominator.com",
"strict_min_version": "54.0"
}
},
"icons": {
"48": "icons/altTabPage_48x48.png",
"96": "icons/altTabPage_96x96.png"
},
"permissions": [ "storage" ],
"options_ui": { "page": "pages/options.html" },
"chrome_url_overrides": { "newtab": "pages/newTab.html" }
}

10
src/pages/newTab.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>New Tab</title>
<meta charset="utf-8"/>
</head>
<body>
<script src="../scripts/loadNewPage.js"></script>
</body>
</html>

26
src/pages/options.html Executable file
View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Alt Tab Page Settings</title>
<meta charset="utf-8"/>
<style media="screen">
button { float: right; }
#tabPageToLoad { width: 100%; margin-bottom: 0.5em; }
</style>
</head>
<body>
<font size="4">
<p>
Alt Tab Page allows the user to select their preferred load page for new tabs and defaults to Google's when not in use.
<br/><br/>
<label>Prefered Tab Page:</label>
<input id="tabPageToLoad" type="text" value="">
<button id="saveButtonAction" type="button" name="ButtonSave">Save</button>
<button id="delButtonAction" type="button" name="ButtonDel">Delete</button>
</p>
</font>
<script src="../scripts/altTabPageSettings.js"></script>
</body>
</html>

View File

@ -0,0 +1,44 @@
// Declare variables.
const browserStorage = browser.storage.local;
const tabPgInput = document.querySelector("#tabPageToLoad");
const saveBttn = document.querySelector("#saveButtonAction");
const delBttn = document.querySelector("#delButtonAction");
/* Asign signal handaling in settings page. */
// Save desired url....
saveBttn.addEventListener('click', () => {
var urlLink = tabPgInput.value;
urlLink = (urlLink.match(/(localhost)\b/)) ? urlLink.replace("localhost", "127.0.0.1") : urlLink;
urlLink = (urlLink.match(/^(http:\/\/|https:\/\/)/)) ? urlLink : "http://" + urlLink;
browserStorage.clear();
browserStorage.set({ userSelectedTabPage : urlLink });
tabPgInput.value = urlLink;
console.log("Saved Alt Tab Page: " + urlLink);
});
// Delete desired url and set Default marker....
delBttn.addEventListener('click', () => {
browserStorage.clear();
tabPgInput.value = "Default";
console.log("Deleted Alt Tab Page...");
});
// On start load from settings
function loadOnStart(restoredSettings) {
var homeTabURL = restoredSettings.userSelectedTabPage;
console.log("Trying to load settings if any...");
if (homeTabURL !== "Default" && homeTabURL !== undefined) {
tabPgInput.value = homeTabURL
} else {
tabPgInput.value = "Default";
}
}
function onError(e) { console.error(e); }
browserStorage.get().then(loadOnStart, onError);

View File

@ -0,0 +1,21 @@
function redirectToPreferedHome() {
var tabPgSettings = browser.storage.local.get();
tabPgSettings.then(finishLoad, onError);
}
function finishLoad(toLoadSettings) {
var loadSelectedPage = browser.tabs;
var pageToLoad = toLoadSettings.userSelectedTabPage;
console.log("Trying to load settings if any...");
if (pageToLoad !== "Default" && pageToLoad !== undefined) {
loadSelectedPage.update({url: pageToLoad});
} else {
loadSelectedPage.update({url: "https://www.google.com/"});
}
}
function onError(error) { console.log(`Error: ${error}`); }
redirectToPreferedHome();