Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e16872c8
Commit
e16872c8
authored
Nov 19, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated angular-dragdrop to fix issue with IE9, Fixes #1087
parent
0c6618d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
16 deletions
+56
-16
src/app/app.js
+1
-1
src/vendor/angular/angular-dragdrop.js
+55
-15
No files found.
src/app/app.js
View file @
e16872c8
...
...
@@ -62,7 +62,7 @@ function (angular, $, _, appLevelRequire, config) {
var
apps_deps
=
[
'ngRoute'
,
'$strap.directives'
,
'
ngDragD
rop'
,
'
ang-drag-d
rop'
,
'grafana'
,
'pasvaz.bindonce'
];
...
...
src/vendor/angular/angular-dragdrop.js
View file @
e16872c8
...
...
@@ -6,13 +6,14 @@
* To change this template use File | Settings | File Templates.
*/
(
function
(){
(
function
(
angular
){
function
isDnDsSupported
(){
return
'
draggable'
in
document
.
createElement
(
"span
"
);
return
'
ondrag'
in
document
.
createElement
(
"a
"
);
}
if
(
!
isDnDsSupported
()){
angular
.
module
(
"ang-drag-drop"
,
[]);
return
;
}
...
...
@@ -22,7 +23,7 @@ if (window.jQuery && (-1 == window.jQuery.event.props.indexOf("dataTransfer")))
var
currentData
;
angular
.
module
(
"
ngDragD
rop"
,[])
angular
.
module
(
"
ang-drag-d
rop"
,[])
.
directive
(
"uiDraggable"
,
[
'$parse'
,
'$rootScope'
,
...
...
@@ -71,13 +72,13 @@ angular.module("ngDragDrop",[])
if
(
e
.
dataTransfer
&&
e
.
dataTransfer
.
dropEffect
!==
"none"
)
{
if
(
attrs
.
onDropSuccess
)
{
var
fn
=
$parse
(
attrs
.
onDropSuccess
);
scope
.
$
apply
(
function
()
{
scope
.
$
evalAsync
(
function
()
{
fn
(
scope
,
{
$event
:
e
});
});
}
else
{
if
(
attrs
.
onDropFailure
)
{
var
fn
=
$parse
(
attrs
.
onDropFailure
);
scope
.
$
apply
(
function
()
{
scope
.
$
evalAsync
(
function
()
{
fn
(
scope
,
{
$event
:
e
});
});
}
...
...
@@ -101,7 +102,7 @@ angular.module("ngDragDrop",[])
if
(
dragImage
)
{
var
dragImageFn
=
$parse
(
attrs
.
dragImage
);
scope
.
$
apply
(
function
()
{
scope
.
$
evalAsync
(
function
()
{
var
dragImageParameters
=
dragImageFn
(
scope
,
{
$event
:
e
});
if
(
dragImageParameters
)
{
if
(
angular
.
isString
(
dragImageParameters
))
{
...
...
@@ -116,10 +117,10 @@ angular.module("ngDragDrop",[])
});
}
e
.
dataTransfer
.
setData
(
"
Text
"
,
sendData
);
e
.
dataTransfer
.
setData
(
"
dataToSend
"
,
sendData
);
currentData
=
angular
.
fromJson
(
sendData
);
e
.
dataTransfer
.
effectAllowed
=
"copyMove"
;
$rootScope
.
$broadcast
(
"ANGULAR_DRAG_START"
,
sendChannel
);
$rootScope
.
$broadcast
(
"ANGULAR_DRAG_START"
,
sendChannel
,
currentData
.
data
);
}
else
{
e
.
preventDefault
();
...
...
@@ -138,6 +139,8 @@ angular.module("ngDragDrop",[])
var
dragChannel
=
""
;
var
dragEnterClass
=
attr
.
dragEnterClass
||
"on-drag-enter"
;
var
dragHoverClass
=
attr
.
dragHoverClass
||
"on-drag-hover"
;
var
customDragEnterEvent
=
$parse
(
attr
.
onDragEnter
);
var
customDragLeaveEvent
=
$parse
(
attr
.
onDragLeave
);
function
onDragOver
(
e
)
{
if
(
e
.
preventDefault
)
{
...
...
@@ -148,20 +151,57 @@ angular.module("ngDragDrop",[])
e
.
stopPropagation
();
}
var
fn
=
$parse
(
attr
.
uiOnDragOver
);
scope
.
$evalAsync
(
function
()
{
fn
(
scope
,
{
$event
:
e
,
$channel
:
dropChannel
});
});
e
.
dataTransfer
.
dropEffect
=
e
.
shiftKey
?
'copy'
:
'move'
;
return
false
;
}
function
onDragLeave
(
e
)
{
dragging
--
;
if
(
dragging
==
0
)
{
element
.
removeClass
(
dragHoverClass
);
}
if
(
e
.
preventDefault
)
{
e
.
preventDefault
();
}
if
(
e
.
stopPropagation
)
{
e
.
stopPropagation
();
}
dragging
--
;
if
(
dragging
==
0
)
{
scope
.
$evalAsync
(
function
()
{
customDragEnterEvent
(
scope
,
{
$event
:
e
});
});
element
.
removeClass
(
dragHoverClass
);
}
var
fn
=
$parse
(
attr
.
uiOnDragLeave
);
scope
.
$evalAsync
(
function
()
{
fn
(
scope
,
{
$event
:
e
,
$channel
:
dropChannel
});
});
}
function
onDragEnter
(
e
)
{
if
(
e
.
preventDefault
)
{
e
.
preventDefault
();
}
if
(
e
.
stopPropagation
)
{
e
.
stopPropagation
();
}
dragging
++
;
var
fn
=
$parse
(
attr
.
uiOnDragEnter
);
scope
.
$evalAsync
(
function
()
{
fn
(
scope
,
{
$event
:
e
,
$channel
:
dropChannel
});
});
$rootScope
.
$broadcast
(
"ANGULAR_HOVER"
,
dragChannel
);
scope
.
$evalAsync
(
function
()
{
customDragLeaveEvent
(
scope
,
{
$event
:
e
});
});
element
.
addClass
(
dragHoverClass
);
}
...
...
@@ -173,11 +213,11 @@ angular.module("ngDragDrop",[])
e
.
stopPropagation
();
// Necessary. Allows us to drop.
}
var
sendData
=
e
.
dataTransfer
.
getData
(
"
Text
"
);
var
sendData
=
e
.
dataTransfer
.
getData
(
"
dataToSend
"
);
sendData
=
angular
.
fromJson
(
sendData
);
var
fn
=
$parse
(
attr
.
uiOnDrop
);
scope
.
$
apply
(
function
()
{
scope
.
$
evalAsync
(
function
()
{
fn
(
scope
,
{
$data
:
sendData
.
data
,
$event
:
e
,
$channel
:
sendData
.
channel
});
});
element
.
removeClass
(
dragEnterClass
);
...
...
@@ -338,4 +378,4 @@ angular.module("ngDragDrop",[])
}
]);
}());
}(
angular
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment