summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Bookmarklet_2.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Bookmarklet_2.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Bookmarklet_2.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/js/Bookmarklet_2.js b/frontend/gamma/js/Bookmarklet_2.js
index 02f7de8..de1bbfa 100644
--- a/frontend/gamma/js/Bookmarklet_2.js
+++ b/frontend/gamma/js/Bookmarklet_2.js
@@ -1,118 +1,116 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26clipperz_copiedContentToClipboard = false; 24clipperz_copiedContentToClipboard = false;
27 25
28//############################################################################# 26//#############################################################################
29 27
30// Simple Set Clipboard System 28// Simple Set Clipboard System
31// Author: Joseph Huckaby 29// Author: Joseph Huckaby
32 30
33var ZeroClipboard = { 31var ZeroClipboard = {
34 32
35 version: "1.0.4", 33 version: "1.0.4",
36 clients: {}, // registered upload clients on page, indexed by id 34 clients: {}, // registered upload clients on page, indexed by id
37 //moviePath: 'ZeroClipboard.swf', // URL to movie 35 //moviePath: 'ZeroClipboard.swf', // URL to movie
38 //moviePath: 'data:application/octet-stream;charset=utf-8;base64,Q1dTCYgGAAB4nH1V61LbRhTeXV2OJNsYczFgIEC4JCGABSRpSy+B2JDQQtWJocl0BqK1tUZqhOSRZAj/8ih9hz5AXsGZTl+ndHUhxU2nO56z3/l05uye7+wc6xr6DeUxqpcUhFCNXF9ffxjNcYhRo8U8NruO0IeRLTkm+BpEa4i8/+t3GRGUrRf5tktDe41dMC8Kpd14Q/DM911GPfHCd6zCLyzwa67Tafo0sAppuOWEHZdeyY1O4ERMbnajyPcKIYteUM+qdYPQD/It12m9jX2XBcSx5EYUON6ZwunOEXsXAY+O94HsAu8iFnjULe1mYN/je5u2WLnvAsnRNGrZ6rnfDZlxwQKxRV1XSd1ulPJ1/9KDBB13pDCiZ2ygEdsGj2WHvsXU3dc7taM3e/tHanjDZVqEV2HEzpUGa3V5dVd4Ocfz+5d1/5w6nnbgU4sF+17bFwPfjzT3k691aEDPGb92KBvNX1krmrOjqLNVrVLLb7K1ln9e3WlsVjd0/Um12XXcyPFy6ZHdyHHDkT5tt1JtF/rJerqn6Wu+F/ErsWCmPyiRjrYi54KlgZP/k2Tq9gPYSh5APZOYBVra2VicAtfyn+4qZwHt2E4rVJvszPH2HNcVD2lkS5eOxW3b9f1AtplzZkeKFdDLl/wkibodmyrUsmq241raYdye5ECpdrBf+2GQf0ncA4c3gJelHRrHjd03xs+7L9UMHh9lZN149aOSwuOfcnFO3qQmbb0V44aoSVEXlHeikXQzz1/bpzek8E50XN6o4r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/Bookmarklet/ZeroClipboard.swf', 37 //moviePath: 'http://localhost:8000/tests/js/tests/Bookmarklet/ZeroClipboard.swf',
40 moviePath: 'http://www.clipperz.com/files/clipperz.com/bookmarklet/0.3.0/ZeroClipboard_1.0.4.swf', 38 moviePath: 'http://www.clipperz.com/files/clipperz.com/bookmarklet/0.3.0/ZeroClipboard_1.0.4.swf',
41 nextId: 1, // ID of next movie 39 nextId: 1, // ID of next movie
42 40
43 $: function(thingy) { 41 $: function(thingy) {
44 // simple DOM lookup utility function 42 // simple DOM lookup utility function
45 if (typeof(thingy) == 'string') thingy = document.getElementById(thingy); 43 if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
46 if (!thingy.addClass) { 44 if (!thingy.addClass) {
47 // extend element with a few useful methods 45 // extend element with a few useful methods
48 thingy.hide = function() { this.style.display = 'none'; }; 46 thingy.hide = function() { this.style.display = 'none'; };
49 thingy.show = function() { this.style.display = ''; }; 47 thingy.show = function() { this.style.display = ''; };
50 thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; }; 48 thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
51 thingy.removeClass = function(name) { 49 thingy.removeClass = function(name) {
52 this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, ''); 50 this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, '');
53 }; 51 };
54 thingy.hasClass = function(name) { 52 thingy.hasClass = function(name) {
55 return !!this.className.match( new RegExp("\\s*" + name + "\\s*") ); 53 return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
56 } 54 }
57 } 55 }
58 return thingy; 56 return thingy;
59 }, 57 },
60 58
61 setMoviePath: function(path) { 59 setMoviePath: function(path) {
62 // set path to ZeroClipboard.swf 60 // set path to ZeroClipboard.swf
63 this.moviePath = path; 61 this.moviePath = path;
64 }, 62 },
65 63
66 dispatch: function(id, eventName, args) { 64 dispatch: function(id, eventName, args) {
67 // receive event from flash movie, send to client 65 // receive event from flash movie, send to client
68 var client = this.clients[id]; 66 var client = this.clients[id];
69 if (client) { 67 if (client) {
70 client.receiveEvent(eventName, args); 68 client.receiveEvent(eventName, args);
71 } 69 }
72 }, 70 },
73 71
74 register: function(id, client) { 72 register: function(id, client) {
75 // register new client to receive events 73 // register new client to receive events
76 this.clients[id] = client; 74 this.clients[id] = client;
77 }, 75 },
78 76
79 getDOMObjectPosition: function(obj) { 77 getDOMObjectPosition: function(obj) {
80 // get absolute coordinates for dom element 78 // get absolute coordinates for dom element
81 var info = { 79 var info = {
82 left: 0, 80 left: 0,
83 top: 0, 81 top: 0,
84 width: obj.width ? obj.width : obj.offsetWidth, 82 width: obj.width ? obj.width : obj.offsetWidth,
85 height: obj.height ? obj.height : obj.offsetHeight 83 height: obj.height ? obj.height : obj.offsetHeight
86 }; 84 };
87 85
88 while (obj) { 86 while (obj) {
89 info.left += obj.offsetLeft; 87 info.left += obj.offsetLeft;
90 info.top += obj.offsetTop; 88 info.top += obj.offsetTop;
91 obj = obj.offsetParent; 89 obj = obj.offsetParent;
92 } 90 }
93 91
94 return info; 92 return info;
95 }, 93 },
96 94
97 Client: function(elem) { 95 Client: function(elem) {
98 // constructor for new simple upload client 96 // constructor for new simple upload client
99 this.handlers = {}; 97 this.handlers = {};
100 98
101 // unique ID 99 // unique ID
102 this.id = ZeroClipboard.nextId++; 100 this.id = ZeroClipboard.nextId++;
103 this.movieId = 'ZeroClipboardMovie_' + this.id; 101 this.movieId = 'ZeroClipboardMovie_' + this.id;
104 102
105 // register client with singleton to receive flash events 103 // register client with singleton to receive flash events
106 ZeroClipboard.register(this.id, this); 104 ZeroClipboard.register(this.id, this);
107 105
108 // create movie 106 // create movie
109 if (elem) this.glue(elem); 107 if (elem) this.glue(elem);
110 } 108 }
111}; 109};
112 110
113ZeroClipboard.Client.prototype = { 111ZeroClipboard.Client.prototype = {
114 112
115 id: 0, // unique ID for us 113 id: 0, // unique ID for us
116 ready: false, // whether movie is ready to receive events or not 114 ready: false, // whether movie is ready to receive events or not
117 movie: null, // reference to movie object 115 movie: null, // reference to movie object
118 clipText: '', // text to copy to clipboard 116 clipText: '', // text to copy to clipboard