diff --git a/LICENSE b/LICENSE index bb62102..17640fe 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ The MIT License (MIT) Copyright (c) 2014 Marcus +Copyright (c) 2015 Yohan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 58780dc..bf7237a 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/chrome.manifest b/chrome.manifest old mode 100755 new mode 100644 index 172c0b8..bd9ba30 --- a/chrome.manifest +++ b/chrome.manifest @@ -1,6 +1,7 @@ content scuttle chrome/scuttle/content/ 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/ overlay chrome://browser/content/browser.xul chrome://scuttle/content/scuttle.xul -style chrome://global/content/customizeToolbar.xul chrome://scuttle/skin/scuttle.css \ No newline at end of file +style chrome://global/content/customizeToolbar.xul chrome://scuttle/skin/scuttle.css diff --git a/chrome/scuttle/content/contents.rdf b/chrome/scuttle/content/contents.rdf old mode 100755 new mode 100644 diff --git a/chrome/scuttle/content/options.js b/chrome/scuttle/content/options.js old mode 100755 new mode 100644 diff --git a/chrome/scuttle/content/options.xul b/chrome/scuttle/content/options.xul old mode 100755 new mode 100644 diff --git a/chrome/scuttle/content/scuttle.js b/chrome/scuttle/content/scuttle.js old mode 100755 new mode 100644 index 08c50c1..2627da5 --- a/chrome/scuttle/content/scuttle.js +++ b/chrome/scuttle/content/scuttle.js @@ -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_add = "bookmarks.php"; @@ -26,28 +26,80 @@ function scuttle_my(e, mouse) { } } +function post_to_url(redirectTo, data) { + var scuttle_width = prefs.getCharPref("scuttle.options.width"); + 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); + + if ("data" in stringStream) { + // Gecko 1.9 or newer + stringStream.data = data; + } else { + // 1.8 or older + stringStream.setData(data, data.length); + } + + var postData = Components.classes["@mozilla.org/network/mime-input-stream;1"].createInstance(Components.interfaces.nsIMIMEInputStream); + 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 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(); + 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]) + "&"; - description = description.replace(/[\t\n\r\f\v]+/g, " "); - description = description.replace(/ {2,}/g, " "); + } + + 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); + 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() { 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")); -} \ No newline at end of file +} diff --git a/chrome/scuttle/content/scuttle.xul b/chrome/scuttle/content/scuttle.xul old mode 100755 new mode 100644 index 6e1d0bd..9142311 --- a/chrome/scuttle/content/scuttle.xul +++ b/chrome/scuttle/content/scuttle.xul @@ -18,6 +18,11 @@ label="&scuttle.button.add;" tooltiptext="&scuttle.button.add;" oncommand="scuttle_add();"/> + - \ No newline at end of file + diff --git a/chrome/scuttle/locale/de-DE/scuttle.dtd b/chrome/scuttle/locale/de-DE/scuttle.dtd new file mode 100644 index 0000000..f12a85f --- /dev/null +++ b/chrome/scuttle/locale/de-DE/scuttle.dtd @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/chrome/scuttle/locale/en-GB/scuttle.dtd b/chrome/scuttle/locale/en-GB/scuttle.dtd old mode 100755 new mode 100644 index 909a842..d35c8ef --- a/chrome/scuttle/locale/en-GB/scuttle.dtd +++ b/chrome/scuttle/locale/en-GB/scuttle.dtd @@ -1,6 +1,7 @@ + @@ -15,4 +16,4 @@ - \ No newline at end of file + diff --git a/chrome/scuttle/skin/classic/contents.rdf b/chrome/scuttle/skin/classic/contents.rdf old mode 100755 new mode 100644 diff --git a/chrome/scuttle/skin/classic/scuttle-button-add-small.png b/chrome/scuttle/skin/classic/scuttle-button-add-small.png old mode 100755 new mode 100644 diff --git a/chrome/scuttle/skin/classic/scuttle-button-add.png b/chrome/scuttle/skin/classic/scuttle-button-add.png old mode 100755 new mode 100644 diff --git a/chrome/scuttle/skin/classic/scuttle-button-my-small.png b/chrome/scuttle/skin/classic/scuttle-button-my-small.png old mode 100755 new mode 100644 diff --git a/chrome/scuttle/skin/classic/scuttle-button-my.png b/chrome/scuttle/skin/classic/scuttle-button-my.png old mode 100755 new mode 100644 diff --git a/chrome/scuttle/skin/classic/scuttle-icon-small.png b/chrome/scuttle/skin/classic/scuttle-icon-small.png old mode 100755 new mode 100644 diff --git a/chrome/scuttle/skin/classic/scuttle-icon.png b/chrome/scuttle/skin/classic/scuttle-icon.png old mode 100755 new mode 100644 diff --git a/chrome/scuttle/skin/classic/scuttle.css b/chrome/scuttle/skin/classic/scuttle.css old mode 100755 new mode 100644 index 609461a..f0dfa9d --- a/chrome/scuttle/skin/classic/scuttle.css +++ b/chrome/scuttle/skin/classic/scuttle.css @@ -35,6 +35,19 @@ toolbar[iconsize="small"] #scuttle-button-my[disabled="true"] { -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 { list-style-image: url("chrome://scuttle/skin/scuttle-button-add-small.png"); -moz-image-region: rect(0px 16px 16px 0px); @@ -44,4 +57,4 @@ toolbar[iconsize="small"] #scuttle-button-add:hover { } toolbar[iconsize="small"] #scuttle-button-add[disabled="true"] { -moz-image-region: rect(32px 16px 48px 0px) !important; -} \ No newline at end of file +} diff --git a/defaults/preferences/scuttle.js b/defaults/preferences/scuttle.js old mode 100755 new mode 100644 diff --git a/install.rdf b/install.rdf old mode 100755 new mode 100644 index e08edae..531e974 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ {88c0fe98-8034-efaa-ba61-6d021f798927} - 0.3.2 + 0.3.4 2 @@ -12,7 +12,16 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 1.0 - 3.6.* + 4.* + + + + + + + {a463f10c-3994-11da-9945-000d60ca027b} + 0.4 + 1.0 @@ -24,4 +33,4 @@ chrome://scuttle/content/options.xul chrome://scuttle/skin/scuttle-icon.png - \ No newline at end of file + diff --git a/scuttle_0.3.4.xpi b/scuttle_0.3.4.xpi new file mode 100644 index 0000000..e3df846 Binary files /dev/null and b/scuttle_0.3.4.xpi differ