Initial commit

This commit is contained in:
Marcus Campbell 2014-11-03 14:10:36 -08:00
parent 271af4fc02
commit b5de22a1fc
17 changed files with 343 additions and 0 deletions

6
chrome.manifest Executable file
View File

@ -0,0 +1,6 @@
content scuttle chrome/scuttle/content/
locale scuttle en-GB chrome/scuttle/locale/en-GB/
skin scuttle classic/1.0 chrome/scuttle/skin/classic/
overlay chrome://browser/content/browser.xul chrome://scuttle/content/scuttle.xul
style chrome://global/content/customizeToolbar.xul chrome://scuttle/skin/scuttle.css

View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<Seq about="urn:mozilla:package:root">
<li resource="urn:mozilla:package:scuttle"/>
</Seq>
<Description about="urn:mozilla:package:scuttle"
chrome:extension="true"
chrome:name="scuttle"/>
<Seq about="urn:mozilla:overlays">
<li resource="chrome://browser/content/browser.xul"/>
</Seq>
<Seq about="chrome://browser/content/browser.xul">
<li>chrome://scuttle/content/scuttle.xul</li>
</Seq>
</RDF>

View File

@ -0,0 +1,39 @@
var scuttle_url_default = "http://scuttle.org/";
var scuttle_width_default = "730";
var scuttle_height_default = "465";
var scuttle_url;
var scuttle_width;
var scuttle_height;
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
function options_load() {
try {
scuttle_url = document.getElementById("scuttle-url");
scuttle_url.value = prefs.getCharPref("scuttle.options.url");
scuttle_width = document.getElementById("scuttle-width");
scuttle_width.value = prefs.getCharPref("scuttle.options.width");
scuttle_height = document.getElementById("scuttle-height");
scuttle_height.value = prefs.getCharPref("scuttle.options.height");
}
catch(e) {
scuttle_url.value = scuttle_url_default;
scuttle_width.value = scuttle_width_default;
scuttle_height.value = scuttle_height_default;
}
}
function options_accept() {
var url = scuttle_url.value;
if ((url.length > 0) && (url.charAt(url.length - 1) != "/")) {
url = url + "/";
}
prefs.setCharPref("scuttle.options.url", url);
prefs.setCharPref("scuttle.options.width", scuttle_width.value);
prefs.setCharPref("scuttle.options.height", scuttle_height.value);
return true;
}

View File

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://browser/skin/"?>
<!DOCTYPE dialog SYSTEM "chrome://scuttle/locale/scuttle.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="scuttle-options-dialog"
title="&scuttle.options.title;"
centerWindowOnScreen="true"
onload="options_load()"
ondialogaccept="return options_accept()">
<script type="application/x-javascript" src="chrome://scuttle/content/options.js"/>
<groupbox>
<caption label="Installation" />
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row align="center">
<label control="scuttle-url" value="&scuttle.options.url.label;"/>
<textbox id="scuttle-url"
size="35"
tooltiptext="&scuttle.options.url.tooltip;"/>
</row>
</rows>
</grid>
</groupbox>
<groupbox>
<caption label="Pop-up Window" />
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row align="center">
<label control="scuttle-width" value="&scuttle.options.width.label;"/>
<textbox id="scuttle-width"
size="5"
tooltiptext="&scuttle.options.width.tooltip;"/>
<label value="px"/>
</row>
<row align="center">
<label control="scuttle-height" value="&scuttle.options.height.label;"/>
<textbox id="scuttle-height"
size="5"
tooltiptext="&scuttle.options.height.tooltip;"/>
<label value="px"/>
</row>
</rows>
</grid>
</groupbox>
</dialog>

View File

@ -0,0 +1,53 @@
var scuttle_version = "0.3.1";
var scuttle_page_my = "login.php";
var scuttle_page_add = "bookmarks.php";
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
function scuttle_my(e, mouse) {
var scuttle_url = prefs.getCharPref("scuttle.options.url");
var url = scuttle_url + scuttle_page_my;
if (mouse) {
if (e.button == 1) {
var browser = document.getElementById("content");
var tab = browser.addTab(url);
browser.selectedTab = tab;
}
} else {
if (e.ctrlKey) {
var browser = document.getElementById("content");
var tab = browser.addTab(url);
browser.selectedTab = tab;
} else if (e.shiftKey) {
window.open(url, "scuttleMy");
} else {
loadURI(url);
}
}
}
function scuttle_add(address, title) {
var scuttle_url = prefs.getCharPref("scuttle.options.url");
var scuttle_width = prefs.getCharPref("scuttle.options.width");
var scuttle_height = prefs.getCharPref("scuttle.options.height");
var _address = (address === undefined) ? window.content.location.href : address;
var _title = (title === undefined) ? window.content.document.title : title;
var focusedWindow = document.commandDispatcher.focusedWindow;
var description = focusedWindow.getSelection().toString();
description = description.replace(/[\t\n\r\f\v]+/g, " ");
description = description.replace(/ {2,}/g, " ");
var a = encodeURIComponent(_address);
var t = encodeURIComponent(_title);
var d = encodeURIComponent(description);
var scuttle_add_window = window.open(scuttle_url + scuttle_page_add + "?action=add&popup=1&address="+ a +"&title="+ t +"&description="+ d +"&src=ffext"+ scuttle_version, "scuttleBookmark", "status=0, scrollbars=1, toolbar=0, resizable=1, width="+ scuttle_width +", height="+ scuttle_height +", left="+ (screen.width-scuttle_width) / 2 +", top="+ (screen.height-scuttle_height) / 2);
}
function scuttle_menu() {
document.getElementById("scuttle-context-page").setAttribute("hidden", document.getElementById("context-bookmarkpage").getAttribute("hidden"));
document.getElementById("scuttle-context-link").setAttribute("hidden", document.getElementById("context-bookmarklink").getAttribute("hidden"));
document.getElementById("scuttle-context-selection").setAttribute("hidden", document.getElementById("context-searchselect").getAttribute("hidden"));
}

View File

@ -0,0 +1,48 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://scuttle/skin/scuttle.css"?>
<!DOCTYPE overlay SYSTEM "chrome://scuttle/locale/scuttle.dtd">
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="scuttle-overlay"
centerWindowOnScreen="true">
<script type="application/x-javascript" src="chrome://scuttle/content/scuttle.js"/>
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="scuttle-button-my"
class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&scuttle.button.my;"
tooltiptext="&scuttle.button.my;"
onclick="scuttle_my(event, true);"
oncommand="scuttle_my(event);"/>
<toolbarbutton id="scuttle-button-add"
class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&scuttle.button.add;"
tooltiptext="&scuttle.button.add;"
oncommand="scuttle_add();"/>
</toolbarpalette>
<popup id="contentAreaContextMenu" onpopupshown="scuttle_menu()">
<menuitem id="scuttle-context-page"
insertafter="context-bookmarkpage"
class="menuitem-iconic"
label="&scuttle.button.add;"
image="chrome://scuttle/skin/scuttle-icon-small.png"
accesskey="c"
hidden="true"
oncommand="scuttle_add();"/>
<menuitem id="scuttle-context-link"
insertafter="context-bookmarklink"
class="menuitem-iconic"
label="&scuttle.context.link;"
image="chrome://scuttle/skin/scuttle-icon-small.png"
accesskey="c"
hidden="true"
oncommand="scuttle_add(typeof(gContextMenu.linkURL) == 'string' ? gContextMenu.linkURL : gContextMenu.linkURL(), gContextMenu.linkText());"/>
<menuitem id="scuttle-context-selection"
insertafter="context-searchselect"
class="menuitem-iconic"
label="&scuttle.button.add;"
image="chrome://scuttle/skin/scuttle-icon-small.png"
accesskey="c"
hidden="true"
oncommand="scuttle_add();"/>
</popup>
</overlay>

View File

@ -0,0 +1,18 @@
<!-- Buttons -->
<!ENTITY scuttle.button.my "My Scuttle">
<!ENTITY scuttle.button.add "Scuttle This Page...">
<!-- Context Menu -->
<!ENTITY scuttle.context.link "Scuttle This Link...">
<!-- Options -->
<!ENTITY scuttle.options.title "Scuttle Options">
<!ENTITY scuttle.options.url.label "Address:">
<!ENTITY scuttle.options.url.tooltip "The address of your Scuttle installation">
<!ENTITY scuttle.options.width.label "Width:">
<!ENTITY scuttle.options.width.tooltip "Pop-up window width">
<!ENTITY scuttle.options.height.label "Height:">
<!ENTITY scuttle.options.height.tooltip "Pop-up window height">

View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<Seq about="urn:mozilla:skin:root">
<li resource="urn:mozilla:skin:classic/1.0" />
</Seq>
<Description about="urn:mozilla:skin:classic/1.0">
<chrome:packages>
<Seq about="urn:mozilla:skin:classic/1.0:packages">
<li resource="urn:mozilla:skin:classic/1.0:scuttle"/>
</Seq>
</chrome:packages>
</Description>
<Seq about="urn:mozilla:stylesheets">
<li resource="chrome://browser/content/browser.xul"/>
<li resource="chrome://global/content/customizeToolbar.xul"/>
</Seq>
<Seq about="chrome://browser/content/browser.xul">
<li>chrome://scuttle/skin/scuttle.css</li>
</Seq>
<Seq about="chrome://global/content/customizeToolbar.xul">
<li>chrome://scuttle/skin/scuttle.css</li>
</Seq>
</RDF>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,47 @@
/* My Scuttle */
#scuttle-button-my {
list-style-image: url("chrome://scuttle/skin/scuttle-button-my.png");
-moz-image-region: rect(0px 24px 24px 0px);
}
#scuttle-button-my:hover {
-moz-image-region: rect(24px 24px 48px 0px);
}
#scuttle-button-my[disabled="true"] {
-moz-image-region: rect(48px 24px 72px 0px) !important;
}
toolbar[iconsize="small"] #scuttle-button-my {
list-style-image: url("chrome://scuttle/skin/scuttle-button-my-small.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
toolbar[iconsize="small"] #scuttle-button-my:hover {
-moz-image-region: rect(16px 16px 32px 0px);
}
toolbar[iconsize="small"] #scuttle-button-my[disabled="true"] {
-moz-image-region: rect(32px 16px 48px 0px) !important;
}
/* Scuttle This Page... */
#scuttle-button-add {
list-style-image: url("chrome://scuttle/skin/scuttle-button-add.png");
-moz-image-region: rect(0px 24px 24px 0px);
}
#scuttle-button-add:hover {
-moz-image-region: rect(24px 24px 48px 0px);
}
#scuttle-button-add[disabled="true"] {
-moz-image-region: rect(48px 24px 72px 0px) !important;
}
toolbar[iconsize="small"] #scuttle-button-add {
list-style-image: url("chrome://scuttle/skin/scuttle-button-add-small.png");
-moz-image-region: rect(0px 16px 16px 0px);
}
toolbar[iconsize="small"] #scuttle-button-add:hover {
-moz-image-region: rect(16px 16px 32px 0px);
}
toolbar[iconsize="small"] #scuttle-button-add[disabled="true"] {
-moz-image-region: rect(32px 16px 48px 0px) !important;
}

View File

@ -0,0 +1,3 @@
pref("scuttle.options.url", "http://scuttle.org/");
pref("scuttle.options.height", "465");
pref("scuttle.options.width", "730");

27
install.rdf Executable file
View File

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{88c0fe98-8034-efaa-ba61-6d021f798927}</em:id>
<em:version>0.3.2</em:version>
<em:type>2</em:type>
<!-- Firefox -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.0</em:minVersion>
<em:maxVersion>3.6.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Scuttle</em:name>
<em:description>Store, share and tag your bookmarks.</em:description>
<em:creator>Marcus Campbell</em:creator>
<em:homepageURL>http://scuttle.org/</em:homepageURL>
<em:optionsURL>chrome://scuttle/content/options.xul</em:optionsURL>
<em:iconURL>chrome://scuttle/skin/scuttle-icon.png</em:iconURL>
</Description>
</RDF>