diff --git a/clipperz-firefox-extension/chrome.manifest b/clipperz-firefox-extension/chrome.manifest
new file mode 100644
index 0000000..b357507
--- /dev/null
+++ b/clipperz-firefox-extension/chrome.manifest
@@ -0,0 +1,6 @@
+content clipperzbutton chrome/clipperzbutton/content/
+skin clipperzbutton classic/1.0 chrome/clipperzbutton/skin/global/
+style chrome://global/content/customizeToolbar.xul chrome://clipperzbutton/skin/clipperzMain.css
+
+locale clipperzbutton en-US chrome/clipperzbutton/locale/en-US/
+overlay chrome://browser/content/browser.xul chrome://clipperzbutton/content/clipperzMain.xul
\ No newline at end of file
diff --git a/clipperz-firefox-extension/chrome/clipperzbutton/content/clipperzMain.js b/clipperz-firefox-extension/chrome/clipperzbutton/content/clipperzMain.js
new file mode 100644
index 0000000..cf750d3
--- /dev/null
+++ b/clipperz-firefox-extension/chrome/clipperzbutton/content/clipperzMain.js
@@ -0,0 +1,170 @@
+const CLIPPERZ_PREF_PREFIX = "clipperzbutton.";
+const CLIPPERZ_PREF_TB_ITEM_INSTALLED = CLIPPERZ_PREF_PREFIX + "toolbariteminstalled";
+const CLIPPERZ_TOOLBAR_BUTTON_ID = "clipperz-toolbar-button";
+
+var clipperz_panel = null;
+var clipperz_pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+var clipperz_panel_top = "50";
+var clipperz_panel_left = "50";
+var clipperz_panel_width = "330";
+var clipperz_panel_height = "500";
+
+function saveParams(){
+ if(clipperz_panel != null){
+ if(clipperz_panel.closed){
+ clipperz_pref.setCharPref("clipperz.window-opened", "0");
+ }
+ else{
+ clipperz_panel_top = clipperz_panel.screenY;
+ clipperz_panel_left = clipperz_panel.screenX;
+ clipperz_panel_width = clipperz_panel.innerWidth;
+ clipperz_panel_height = clipperz_panel.innerHeight;
+ clipperz_pref.setCharPref("clipperz.position-top", clipperz_panel_top);
+ clipperz_pref.setCharPref("clipperz.position-left", clipperz_panel_left);
+ clipperz_pref.setCharPref("clipperz.position-width", clipperz_panel_width);
+ clipperz_pref.setCharPref("clipperz.position-height", clipperz_panel_height);
+ }
+ }
+}
+
+function initClipperz(){
+ installClipperzButton();
+ clipperz_pref.setCharPref("clipperz.window-opened", "0");
+ var modifiers = clipperz_pref.getCharPref("clipperz.shortcut-modifiers");
+ var letter = clipperz_pref.getCharPref("clipperz.shortcut-letter");
+ var shortcut = document.getElementById("open-clipperz");
+ shortcut.setAttribute("modifiers", modifiers);
+ shortcut.setAttribute("key", letter);
+ clipperz_panel_top = clipperz_pref.getCharPref("clipperz.position-top");
+ clipperz_panel_left = clipperz_pref.getCharPref("clipperz.position-left");
+ clipperz_panel_width = clipperz_pref.getCharPref("clipperz.position-width");
+ clipperz_panel_height = clipperz_pref.getCharPref("clipperz.position-height");
+ params = setInterval(saveParams, 1000);
+ if (navigator.appVersion.indexOf("Mac")!=-1){
+ document.getElementById("ctrl").setAttribute("hidden","true");
+ }
+}
+
+function restartFirefox(){
+ a=Components.interfaces.nsIAppStartup,Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(a).quit(a.eRestart | a.eAttemptQuit);
+}
+
+function keyChanged(){
+ if (confirm("Shortcut changed. Restart Firefox now?"))
+ restartFirefox();
+}
+
+function modChanged(val){
+ if(val != clipperz_pref.getCharPref("clipperz.shortcut-modifiers")){
+ if (confirm("Shortcut changed. Restart Firefox now?"))
+ restartFirefox();
+ }
+}
+
+function resetWindow(){
+ clipperz_pref.setCharPref("clipperz.position-top", "50");
+ clipperz_pref.setCharPref("clipperz.position-left", "50");
+ clipperz_pref.setCharPref("clipperz.position-width", "330");
+ clipperz_pref.setCharPref("clipperz.position-height", "500");
+ clipperz_panel_top = "50";
+ clipperz_panel_left = "50";
+ clipperz_panel_width = "330";
+ clipperz_panel_height = "500";
+
+ if (confirm("Window properties resetted. Restart Firefox now?"))
+ restartFirefox();
+}
+
+//click handler
+var clipperzButton = {
+ openPanel: function () {
+ if (clipperz_pref.getCharPref("clipperz.window-opened") == "0"){
+ clipperz_panel = window.open("https://www.clipperz.com/beta/index.html?compact", "Clipperz", "toolbar=no,resizable=yes,scrollbars=no,titlebar=yes,location=no,menubar=no,status=no,top="+clipperz_panel_top+",left="+clipperz_panel_left+",width="+clipperz_panel_width+",height="+clipperz_panel_height);
+ clipperz_pref.setCharPref("clipperz.window-opened", "1");
+ }
+ else{
+ clipperz_panel.blur();
+ clipperz_panel.focus();
+ }
+ },
+
+ openPreferences : function() {
+ if (null == this._preferencesWindow || this._preferencesWindow.closed) {
+ let instantApply = Application.prefs.get("browser.preferences.instantApply");
+ let features = "chrome,titlebar,toolbar,centerscreen" + (instantApply.value ? ",dialog=no" : ",modal");
+ this._preferencesWindow = window.openDialog( "chrome://clipperzbutton/content/options.xul", "preferences-window", features);
+ }
+ this._preferencesWindow.focus();
+ }
+}
+
+//install button
+function installClipperzButton() {
+ var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefService);
+ var db = prefs.getBranch(null);
+
+ try {
+ if (db.getBoolPref(CLIPPERZ_PREF_TB_ITEM_INSTALLED)) return;
+ }
+ catch(e) {
+ }
+
+ var buttonId = CLIPPERZ_TOOLBAR_BUTTON_ID;
+ var afterId;
+ var toolbarId;
+
+ // check toolbar
+ toolbarId = "nav-bar";
+ var tb = document.getElementById(toolbarId);
+ if (tb) {
+ afterId = "home-button";
+ } else {
+ toolbarId = "mail-bar";
+ tb = document.getElementById(toolbarId);
+ if (tb) {
+ afterId = "button-stop";
+ } else {
+ toolbarId = "composeToolbar";
+ tb = document.getElementById(toolbarId);
+ if (tb) {
+ afterId = "button-save";
+ } else {
+ return;
+ }
+ }
+ }
+
+ // check button
+ var currentSet = tb.getAttribute(tb.hasAttribute("currentset") ? "currentset" : "defaultset");
+ if (!currentSet) return;
+ db.setBoolPref(CLIPPERZ_PREF_TB_ITEM_INSTALLED, true);
+ var ids = currentSet.split(",");
+ var len = ids.length;
+ var j = -1;
+ for (var i = 0; i < len; i++) {
+ if (ids[i] == buttonId) return;
+ if (ids[i] == afterId) j = i;
+ }
+
+ // not found - add
+ var newSet;
+ if (j == -1) {
+ newSet = currentSet + "," + buttonId;
+ } else {
+ var k = 0;
+ for (var n = 0; n <= j ; n++) {
+ k = currentSet.indexOf(",", k) + 1;
+ }
+ newSet = currentSet.slice(0, k) + buttonId + "," + currentSet.slice(k);
+ }
+ tb.setAttribute("currentset", newSet);
+ tb.currentSet = newSet;
+ document.persist(toolbarId, "currentset");
+
+ try {
+ BrowserToolboxCustomizeDone(true);
+ }
+ catch (e) { }
+}
+
+window.addEventListener("load", initClipperz, false);
\ No newline at end of file
diff --git a/clipperz-firefox-extension/chrome/clipperzbutton/content/clipperzMain.xul b/clipperz-firefox-extension/chrome/clipperzbutton/content/clipperzMain.xul
new file mode 100644
index 0000000..e6d6fb3
--- /dev/null
+++ b/clipperz-firefox-extension/chrome/clipperzbutton/content/clipperzMain.xul
@@ -0,0 +1,29 @@
+
+
+
+
+ %clipperzDTD;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/clipperz-firefox-extension/chrome/clipperzbutton/content/options.xul b/clipperz-firefox-extension/chrome/clipperzbutton/content/options.xul
new file mode 100644
index 0000000..0df2cce
--- /dev/null
+++ b/clipperz-firefox-extension/chrome/clipperzbutton/content/options.xul
@@ -0,0 +1,58 @@
+
+
+
+
+
+ %clipperzDTD;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/clipperz-firefox-extension/chrome/clipperzbutton/locale/en-US/clipperzbutton.dtd b/clipperz-firefox-extension/chrome/clipperzbutton/locale/en-US/clipperzbutton.dtd
new file mode 100644
index 0000000..c16e262
--- /dev/null
+++ b/clipperz-firefox-extension/chrome/clipperzbutton/locale/en-US/clipperzbutton.dtd
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/clipperzMain.css b/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/clipperzMain.css
new file mode 100644
index 0000000..592e6a1
--- /dev/null
+++ b/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/clipperzMain.css
@@ -0,0 +1,9 @@
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+#clipperz-toolbar-button
+{list-style-image: url("chrome://clipperzbutton/skin/favicon.png");}
+
+.srl{
+ font-size:11px;
+ color: #acacac;
+}
\ No newline at end of file
diff --git a/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/favicon.png b/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/favicon.png
new file mode 100644
index 0000000..5c14ff2
Binary files /dev/null and b/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/favicon.png differ
diff --git a/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/logo.png b/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/logo.png
new file mode 100644
index 0000000..29d356e
Binary files /dev/null and b/clipperz-firefox-extension/chrome/clipperzbutton/skin/global/logo.png differ
diff --git a/clipperz-firefox-extension/defaults/preferences/defaults.js b/clipperz-firefox-extension/defaults/preferences/defaults.js
new file mode 100644
index 0000000..51f84f2
--- /dev/null
+++ b/clipperz-firefox-extension/defaults/preferences/defaults.js
@@ -0,0 +1,7 @@
+pref("clipperz.shortcut-modifiers", "control");
+pref("clipperz.shortcut-letter", "T");
+pref("clipperz.position-top", "50");
+pref("clipperz.position-left", "50");
+pref("clipperz.position-width", "330");
+pref("clipperz.position-height", "500");
+pref("clipperz.window-opened", "0");
\ No newline at end of file
diff --git a/clipperz-firefox-extension/install.rdf b/clipperz-firefox-extension/install.rdf
new file mode 100644
index 0000000..077ad34
--- /dev/null
+++ b/clipperz-firefox-extension/install.rdf
@@ -0,0 +1,20 @@
+
+
+ info@clipperz.com
+ Clipperz
+ Clipperz Firefox extension
+ 1.0.4
+
+
+ {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+ 3.5
+ 8.*
+
+
+ Clipperz S.r.l.
+ http://www.clipperz.com
+
+ chrome://clipperzbutton/skin/logo.png
+ chrome://clipperzbutton/content/options.xul
+
+
\ No newline at end of file