summaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2012-12-30 16:44:35 -0500
committerJules Laplace <jules@okfoc.us>2012-12-30 16:44:35 -0500
commitec86b9572b5ed777af6f5cbc443451fe15daeed3 (patch)
tree4883606a5f0a036f455de802340cde5fc6c2083f /static/js
parenteb1668da860f5b3a7076800dc78e0fb982888c5d (diff)
dragging/dropping images in chrome
Diffstat (limited to 'static/js')
-rw-r--r--static/js/pichat.js21
-rw-r--r--static/js/pichat2.js21
-rw-r--r--static/js/src/chat.js2
-rw-r--r--static/js/src/drag.js18
4 files changed, 38 insertions, 24 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js
index 5f20803..ceeb397 100644
--- a/static/js/pichat.js
+++ b/static/js/pichat.js
@@ -445,7 +445,7 @@ function removeOldMessages(){
}
}
-window.TextEnabled = Preferences.getProperty("chat.textEnabled", "true") == "none";
+window.TextEnabled = Preferences.getProperty("chat.textEnabled", "true") == "true";
window.ImgsEnabled = Preferences.getProperty("chat.imgsEnabled", "true") == "true";
function muteSelector() {
@@ -547,6 +547,7 @@ function dragTarget (target, callbacks) {
}
base.enter = function(e){
base.target.classList.add('over');
+ console.log(e.target);
if ('enter' in callbacks) {
callbacks.enter(Drag.url);
}
@@ -577,17 +578,21 @@ function dragTarget (target, callbacks) {
}
base.drop = function(e){
base.target.classList.remove('over');
- if (e.stopPropagation) {
- e.stopPropagation(); // stops the browser from redirecting.
- }
- if (e.preventDefault) {
- e.preventDefault();
- }
+ e.stopPropagation(); // stops the browser from redirecting.
+ e.preventDefault();
if ('drop' in callbacks) {
- callbacks.drop(Drag.url);
+ if (e.dataTransfer) {
+ var url = e.dataTransfer.getData("url");
+ if (url) {
+ callbacks.drop(url);
+ }
+ } else {
+ callbacks.drop(Drag.url);
+ }
}
return false;
}
+
base.init();
};
diff --git a/static/js/pichat2.js b/static/js/pichat2.js
index 5f20803..ceeb397 100644
--- a/static/js/pichat2.js
+++ b/static/js/pichat2.js
@@ -445,7 +445,7 @@ function removeOldMessages(){
}
}
-window.TextEnabled = Preferences.getProperty("chat.textEnabled", "true") == "none";
+window.TextEnabled = Preferences.getProperty("chat.textEnabled", "true") == "true";
window.ImgsEnabled = Preferences.getProperty("chat.imgsEnabled", "true") == "true";
function muteSelector() {
@@ -547,6 +547,7 @@ function dragTarget (target, callbacks) {
}
base.enter = function(e){
base.target.classList.add('over');
+ console.log(e.target);
if ('enter' in callbacks) {
callbacks.enter(Drag.url);
}
@@ -577,17 +578,21 @@ function dragTarget (target, callbacks) {
}
base.drop = function(e){
base.target.classList.remove('over');
- if (e.stopPropagation) {
- e.stopPropagation(); // stops the browser from redirecting.
- }
- if (e.preventDefault) {
- e.preventDefault();
- }
+ e.stopPropagation(); // stops the browser from redirecting.
+ e.preventDefault();
if ('drop' in callbacks) {
- callbacks.drop(Drag.url);
+ if (e.dataTransfer) {
+ var url = e.dataTransfer.getData("url");
+ if (url) {
+ callbacks.drop(url);
+ }
+ } else {
+ callbacks.drop(Drag.url);
+ }
}
return false;
}
+
base.init();
};
diff --git a/static/js/src/chat.js b/static/js/src/chat.js
index 09954de..f24917c 100644
--- a/static/js/src/chat.js
+++ b/static/js/src/chat.js
@@ -166,7 +166,7 @@ function removeOldMessages(){
}
}
-window.TextEnabled = Preferences.getProperty("chat.textEnabled", "true") == "none";
+window.TextEnabled = Preferences.getProperty("chat.textEnabled", "true") == "true";
window.ImgsEnabled = Preferences.getProperty("chat.imgsEnabled", "true") == "true";
function muteSelector() {
diff --git a/static/js/src/drag.js b/static/js/src/drag.js
index b48c365..48b3266 100644
--- a/static/js/src/drag.js
+++ b/static/js/src/drag.js
@@ -45,17 +45,21 @@ function dragTarget (target, callbacks) {
}
base.drop = function(e){
base.target.classList.remove('over');
- if (e.stopPropagation) {
- e.stopPropagation(); // stops the browser from redirecting.
- }
- if (e.preventDefault) {
- e.preventDefault();
- }
+ e.stopPropagation(); // stops the browser from redirecting.
+ e.preventDefault();
if ('drop' in callbacks) {
- callbacks.drop(Drag.url);
+ if (e.dataTransfer) {
+ var url = e.dataTransfer.getData("url");
+ if (url) {
+ callbacks.drop(url);
+ }
+ } else {
+ callbacks.drop(Drag.url);
+ }
}
return false;
}
+
base.init();
};