Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
xblock-drag-and-drop-v2
Commits
6bad7a48
Commit
6bad7a48
authored
Sep 24, 2014
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add touch device support
parent
5a04b713
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
12 deletions
+27
-12
drag_and_drop_v2/drag_and_drop_v2.py
+15
-12
drag_and_drop_v2/public/js/vendor/jquery-ui-touch-punch-0.2.3.min.js
+12
-0
No files found.
drag_and_drop_v2/drag_and_drop_v2.py
View file @
6bad7a48
...
...
@@ -85,18 +85,21 @@ class DragAndDropBlock(XBlock):
fragment
=
Fragment
()
fragment
.
add_content
(
render_template
(
'/templates/html/drag_and_drop.html'
,
context
))
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/vendor/jquery-ui-1.10.4.custom.min.css'
))
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/css/drag_and_drop.css'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vendor/jquery-ui-1.10.4.custom.min.js'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vendor/jquery.html5-placeholder-shim.js'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/vendor/handlebars-v1.1.2.js'
))
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
'public/js/drag_and_drop.js'
))
CSS_URLS
=
(
'public/css/vendor/jquery-ui-1.10.4.custom.min.css'
,
'public/css/drag_and_drop.css'
)
JS_URLS
=
(
'public/js/vendor/jquery-ui-1.10.4.custom.min.js'
,
'public/js/vendor/jquery-ui-touch-punch-0.2.3.min.js'
,
# Makes it work on touch devices
'public/js/vendor/jquery.html5-placeholder-shim.js'
,
'public/js/vendor/handlebars-v1.1.2.js'
,
'public/js/drag_and_drop.js'
,
)
for
css_url
in
CSS_URLS
:
fragment
.
add_css_url
(
self
.
runtime
.
local_resource_url
(
self
,
css_url
))
for
js_url
in
JS_URLS
:
fragment
.
add_javascript_url
(
self
.
runtime
.
local_resource_url
(
self
,
js_url
))
fragment
.
initialize_js
(
'DragAndDropBlock'
)
...
...
drag_and_drop_v2/public/js/vendor/jquery-ui-touch-punch-0.2.3.min.js
0 → 100644
View file @
6bad7a48
/*!
* jQuery UI Touch Punch 0.2.3
*
* Copyright 2011–2014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
!
function
(
a
){
function
f
(
a
,
b
){
if
(
!
(
a
.
originalEvent
.
touches
.
length
>
1
)){
a
.
preventDefault
();
var
c
=
a
.
originalEvent
.
changedTouches
[
0
],
d
=
document
.
createEvent
(
"MouseEvents"
);
d
.
initMouseEvent
(
b
,
!
0
,
!
0
,
window
,
1
,
c
.
screenX
,
c
.
screenY
,
c
.
clientX
,
c
.
clientY
,
!
1
,
!
1
,
!
1
,
!
1
,
0
,
null
),
a
.
target
.
dispatchEvent
(
d
)}}
if
(
a
.
support
.
touch
=
"ontouchend"
in
document
,
a
.
support
.
touch
){
var
e
,
b
=
a
.
ui
.
mouse
.
prototype
,
c
=
b
.
_mouseInit
,
d
=
b
.
_mouseDestroy
;
b
.
_touchStart
=
function
(
a
){
var
b
=
this
;
!
e
&&
b
.
_mouseCapture
(
a
.
originalEvent
.
changedTouches
[
0
])
&&
(
e
=!
0
,
b
.
_touchMoved
=!
1
,
f
(
a
,
"mouseover"
),
f
(
a
,
"mousemove"
),
f
(
a
,
"mousedown"
))},
b
.
_touchMove
=
function
(
a
){
e
&&
(
this
.
_touchMoved
=!
0
,
f
(
a
,
"mousemove"
))},
b
.
_touchEnd
=
function
(
a
){
e
&&
(
f
(
a
,
"mouseup"
),
f
(
a
,
"mouseout"
),
this
.
_touchMoved
||
f
(
a
,
"click"
),
e
=!
1
)},
b
.
_mouseInit
=
function
(){
var
b
=
this
;
b
.
element
.
bind
({
touchstart
:
a
.
proxy
(
b
,
"_touchStart"
),
touchmove
:
a
.
proxy
(
b
,
"_touchMove"
),
touchend
:
a
.
proxy
(
b
,
"_touchEnd"
)}),
c
.
call
(
b
)},
b
.
_mouseDestroy
=
function
(){
var
b
=
this
;
b
.
element
.
unbind
({
touchstart
:
a
.
proxy
(
b
,
"_touchStart"
),
touchmove
:
a
.
proxy
(
b
,
"_touchMove"
),
touchend
:
a
.
proxy
(
b
,
"_touchEnd"
)}),
d
.
call
(
b
)}}}(
jQuery
);
\ No newline at end of file
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