Modified to work with recent Firefox releases.

Added "bookmark all open pages" feature : you need to use my SemanticScuttle fork for this.
This commit is contained in:
yohan 2015-09-18 21:49:32 +02:00
parent b5de22a1fc
commit 1088a8a5f3
21 changed files with 127 additions and 22 deletions

View File

@ -1,6 +1,7 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Marcus Copyright (c) 2014 Marcus
Copyright (c) 2015 Yohan
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,2 +1,6 @@
scuttle-firefox Firefox plugin for SemanticScuttle.
=============== ===================================
Modified to work with recent Firefox releases.
Added "bookmark all open pages" feature : you need to use my SemanticScuttle fork for this.
https://github.com/yohan-b/SemanticScuttle
You can also pick what to bookmark.

1
chrome.manifest Executable file → Normal file
View File

@ -1,5 +1,6 @@
content scuttle chrome/scuttle/content/ content scuttle chrome/scuttle/content/
locale scuttle en-GB chrome/scuttle/locale/en-GB/ locale scuttle en-GB chrome/scuttle/locale/en-GB/
locale scuttle de-DE chrome/scuttle/locale/de-DE/
skin scuttle classic/1.0 chrome/scuttle/skin/classic/ skin scuttle classic/1.0 chrome/scuttle/skin/classic/
overlay chrome://browser/content/browser.xul chrome://scuttle/content/scuttle.xul overlay chrome://browser/content/browser.xul chrome://scuttle/content/scuttle.xul

0
chrome/scuttle/content/contents.rdf Executable file → Normal file
View File

0
chrome/scuttle/content/options.js Executable file → Normal file
View File

0
chrome/scuttle/content/options.xul Executable file → Normal file
View File

76
chrome/scuttle/content/scuttle.js Executable file → Normal file
View File

@ -1,4 +1,4 @@
var scuttle_version = "0.3.1"; var scuttle_version = "0.3.4";
var scuttle_page_my = "login.php"; var scuttle_page_my = "login.php";
var scuttle_page_add = "bookmarks.php"; var scuttle_page_add = "bookmarks.php";
@ -26,24 +26,76 @@ function scuttle_my(e, mouse) {
} }
} }
function scuttle_add(address, title) { function post_to_url(redirectTo, data) {
var scuttle_url = prefs.getCharPref("scuttle.options.url");
var scuttle_width = prefs.getCharPref("scuttle.options.width"); var scuttle_width = prefs.getCharPref("scuttle.options.width");
var scuttle_height = prefs.getCharPref("scuttle.options.height"); var scuttle_height = prefs.getCharPref("scuttle.options.height");
// POST method requests must wrap the encoded text in a MIME stream
var stringStream = Components.classes["@mozilla.org/io/string-input-stream;1"].createInstance(Components.interfaces.nsIStringInputStream);
var _address = (address === undefined) ? window.content.location.href : address; if ("data" in stringStream) {
var _title = (title === undefined) ? window.content.document.title : title; // Gecko 1.9 or newer
var focusedWindow = document.commandDispatcher.focusedWindow; stringStream.data = data;
var description = focusedWindow.getSelection().toString(); } else {
// 1.8 or older
stringStream.setData(data, data.length);
}
description = description.replace(/[\t\n\r\f\v]+/g, " "); var postData = Components.classes["@mozilla.org/network/mime-input-stream;1"].createInstance(Components.interfaces.nsIMIMEInputStream);
description = description.replace(/ {2,}/g, " "); postData.addHeader("Content-Type", "application/x-www-form-urlencoded");
postData.addContentLength = true;
postData.setData(stringStream);
window.openDialog('chrome://browser/content', '_blank', "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, redirectTo, null, null, postData);
}
function scuttle_add(address, title) {
var scuttle_url = prefs.getCharPref("scuttle.options.url");
var _address = (address === undefined) ? new Array(window.content.location.href) : address;
var _title = (title === undefined) ? new Array(window.content.document.title) : title;
if (typeof _address === 'string') {
_address = [ _address ];
}
if (typeof _title === 'string') {
_title = [ _title ];
}
var description = "";
var params = '';
for (var i in _address) {
params += "address["+i+"]=" + encodeURIComponent(_address[i]) + "&";
}
for (var i in _title) {
params += "title["+i+"]=" + encodeURIComponent(_title[i]) + "&";
}
params = params.slice(0, - 1);
var a = encodeURIComponent(_address);
var t = encodeURIComponent(_title);
var d = encodeURIComponent(description); var d = encodeURIComponent(description);
post_to_url(scuttle_url + scuttle_page_add + "?action=add&popup=1" +"&description="+ d +"&src=ffext"+ scuttle_version, params);
}
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_multiadd() {
var address = [];
var title = [];
var e = 0;
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
var browserEnumerator = wm.getEnumerator("navigator:browser");
while (browserEnumerator.hasMoreElements()) {
var browserWin = browserEnumerator.getNext();
var tabbrowser = browserWin.gBrowser;
// Check each tab of this browser instance
var numTabs = tabbrowser.browsers.length;
for (var index = 0; index < numTabs; index++) {
var currentBrowser = tabbrowser.getBrowserAtIndex(index);
address[e] = currentBrowser.currentURI.spec;
title[e] = tabbrowser.tabs[index].label;
e++;
}
}
scuttle_add(address, title);
} }
function scuttle_menu() { function scuttle_menu() {

5
chrome/scuttle/content/scuttle.xul Executable file → Normal file
View File

@ -18,6 +18,11 @@
label="&scuttle.button.add;" label="&scuttle.button.add;"
tooltiptext="&scuttle.button.add;" tooltiptext="&scuttle.button.add;"
oncommand="scuttle_add();"/> oncommand="scuttle_add();"/>
<toolbarbutton id="scuttle-button-multiadd"
class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&scuttle.button.multiadd;"
tooltiptext="&scuttle.button.multiadd;"
oncommand="scuttle_multiadd();"/>
</toolbarpalette> </toolbarpalette>
<popup id="contentAreaContextMenu" onpopupshown="scuttle_menu()"> <popup id="contentAreaContextMenu" onpopupshown="scuttle_menu()">
<menuitem id="scuttle-context-page" <menuitem id="scuttle-context-page"

View File

@ -0,0 +1,19 @@
<!-- Buttons -->
<!ENTITY scuttle.button.my "Mein Scuttle">
<!ENTITY scuttle.button.add "Scuttle diese Seite...">
<!ENTITY scuttle.button.multiadd "Scuttle diese Seite...">
<!-- Context Menu -->
<!ENTITY scuttle.context.link "Scuttle diesen Link...">
<!-- Options -->
<!ENTITY scuttle.options.title "Scuttle Optionen">
<!ENTITY scuttle.options.url.label "Adresse:">
<!ENTITY scuttle.options.url.tooltip "Adresse deiner Scuttle Installation">
<!ENTITY scuttle.options.width.label "Breite:">
<!ENTITY scuttle.options.width.tooltip "Breite des Popup Fensters">
<!ENTITY scuttle.options.height.label "Höhe:">
<!ENTITY scuttle.options.height.tooltip "Höhe des Popup Fensters">

1
chrome/scuttle/locale/en-GB/scuttle.dtd Executable file → Normal file
View File

@ -1,6 +1,7 @@
<!-- Buttons --> <!-- Buttons -->
<!ENTITY scuttle.button.my "My Scuttle"> <!ENTITY scuttle.button.my "My Scuttle">
<!ENTITY scuttle.button.add "Scuttle This Page..."> <!ENTITY scuttle.button.add "Scuttle This Page...">
<!ENTITY scuttle.button.multiadd "Scuttle All Pages...">
<!-- Context Menu --> <!-- Context Menu -->
<!ENTITY scuttle.context.link "Scuttle This Link..."> <!ENTITY scuttle.context.link "Scuttle This Link...">

0
chrome/scuttle/skin/classic/contents.rdf Executable file → Normal file
View File

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
chrome/scuttle/skin/classic/scuttle-button-add.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
chrome/scuttle/skin/classic/scuttle-button-my.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

0
chrome/scuttle/skin/classic/scuttle-icon-small.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 639 B

0
chrome/scuttle/skin/classic/scuttle-icon.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

13
chrome/scuttle/skin/classic/scuttle.css Executable file → Normal file
View File

@ -35,6 +35,19 @@ toolbar[iconsize="small"] #scuttle-button-my[disabled="true"] {
-moz-image-region: rect(48px 24px 72px 0px) !important; -moz-image-region: rect(48px 24px 72px 0px) !important;
} }
/* Scuttle All Pages... */
#scuttle-button-multiadd {
list-style-image: url("chrome://scuttle/skin/scuttle-button-add.png");
-moz-image-region: rect(0px 24px 24px 0px);
}
#scuttle-button-multiadd:hover {
-moz-image-region: rect(24px 24px 48px 0px);
}
#scuttle-button-multiadd[disabled="true"] {
-moz-image-region: rect(48px 24px 72px 0px) !important;
}
toolbar[iconsize="small"] #scuttle-button-add { toolbar[iconsize="small"] #scuttle-button-add {
list-style-image: url("chrome://scuttle/skin/scuttle-button-add-small.png"); list-style-image: url("chrome://scuttle/skin/scuttle-button-add-small.png");
-moz-image-region: rect(0px 16px 16px 0px); -moz-image-region: rect(0px 16px 16px 0px);

0
defaults/preferences/scuttle.js Executable file → Normal file
View File

13
install.rdf Executable file → Normal file
View File

@ -4,7 +4,7 @@
<Description about="urn:mozilla:install-manifest"> <Description about="urn:mozilla:install-manifest">
<em:id>{88c0fe98-8034-efaa-ba61-6d021f798927}</em:id> <em:id>{88c0fe98-8034-efaa-ba61-6d021f798927}</em:id>
<em:version>0.3.2</em:version> <em:version>0.3.4</em:version>
<em:type>2</em:type> <em:type>2</em:type>
<!-- Firefox --> <!-- Firefox -->
@ -12,7 +12,16 @@
<Description> <Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.0</em:minVersion> <em:minVersion>1.0</em:minVersion>
<em:maxVersion>3.6.*</em:maxVersion> <em:maxVersion>4.*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Flock -->
<em:targetApplication>
<Description>
<em:id>{a463f10c-3994-11da-9945-000d60ca027b}</em:id>
<em:minVersion>0.4</em:minVersion>
<em:maxVersion>1.0</em:maxVersion>
</Description> </Description>
</em:targetApplication> </em:targetApplication>

BIN
scuttle_0.3.4.xpi Normal file

Binary file not shown.