1818 < h1 > mobile-drag-drop - Polyfill for HTML5 drag'n'drop on touch devices</ h1 >
1919 </ header >
2020 < article >
21+ < p id ="appliedMessage "> </ p >
22+
2123 < p > Drag the list items over the dustbin, and drop them to have the bin eat the item</ p >
2224
2325 < div id ="bin ">
@@ -72,7 +74,8 @@ <h1>mobile-drag-drop - Polyfill for HTML5 drag'n'drop on touch devices</h1>
7274 < hr />
7375 < h4 > box-sizing: border-box</ h4 >
7476 < ul class ="border-boxed ">
75- < li > < a href ="# " id ="eleven "> < span style ="display: inline-block; background: lightblue "> eleven</ span > </ a > </ li >
77+ < li > < a href ="# " id ="eleven "> < span style ="display: inline-block; background: lightblue "> eleven</ span > </ a >
78+ </ li >
7679 < li > < a href ="# " id ="twelve "> twelve</ a > </ li >
7780 < li > < a href ="# " id ="thirteen "> thirteen</ a > </ li >
7881 < li > < a href ="# " id ="fourteen "> fourteen</ a > </ li >
@@ -175,7 +178,9 @@ <h4>nested flex-box</h4>
175178 < hr />
176179 < h4 > Notes</ h4 >
177180 < ol >
178- < li > The blue bordered item ('one') is a child inside a draggable element. If you drag the child, we should still drag the whole element.</ li >
181+ < li > The blue bordered item ('one') is a child inside a draggable element. If you drag the child, we should
182+ still drag the whole element.
183+ </ li >
179184 </ ol >
180185 < hr />
181186 < div >
@@ -206,7 +211,8 @@ <h3>New Elements</h3>
206211 < figcaption >
207212 < div > Institute Of Contemporary Arts #2</ div >
208213 </ figcaption >
209- < img class ="oic-image " draggable ="true " src ="http://placehold.it/350x350 " onclick ="alert('clicked image'); ">
214+ < img class ="oic-image " draggable ="true " src ="http://placehold.it/350x350 "
215+ onclick ="alert('clicked image'); ">
210216 </ figure >
211217 </ div >
212218 </ div >
@@ -374,7 +380,7 @@ <h3>Custom Drag Image</h3>
374380 </ article >
375381 < script >
376382
377- // var DEBUG = false;
383+ // var DEBUG = false;
378384
379385 var allowDragWithTwoFingersOnly = function ( event ) {
380386
@@ -398,7 +404,7 @@ <h3>Custom Drag Image</h3>
398404 }
399405
400406 var deltaX = Math . abs ( startX - touch . clientX ) ,
401- deltaY = Math . abs ( startY - touch . clientY ) ;
407+ deltaY = Math . abs ( startY - touch . clientY ) ;
402408
403409 console . log ( "startX: " + startX ) ;
404410 console . log ( "startY: " + startY ) ;
@@ -437,7 +443,7 @@ <h3>Custom Drag Image</h3>
437443 return true ;
438444 } ;
439445
440- MobileDragDrop . polyfill ( {
446+ var polyfillApplied = MobileDragDrop . polyfill ( {
441447// dragImageCenterOnTouch: true,
442448// dragImageOffset: {
443449// x: 0,
@@ -448,6 +454,14 @@ <h3>Custom Drag Image</h3>
448454 dragImageTranslateOverride : MobileDragDrop . scrollBehaviourDragImageTranslateOverride
449455 } ) ;
450456
457+ var appliedMessageEl = document . getElementById ( "appliedMessage" ) ;
458+ var appliedMessage = "Polyfill inactive: Current browser was detected to handle drag'n'drop quite well on its own ;)" ;
459+ if ( polyfillApplied ) {
460+
461+ appliedMessage = "Polyfill activated: Detected current browser not capable of HTML5 drag'n'drop (or somebody set forceApply is to true)" ;
462+ }
463+ appliedMessageEl . innerHTML = appliedMessage ;
464+
451465 /**
452466 * ---------------------------------------------------------------------------------------------------------
453467 */
@@ -877,11 +891,14 @@ <h3>Custom Drag Image</h3>
877891 // }
878892
879893 // tmp fix for iOS10 touchmove bug (https://github.com/timruffles/ios-html5-drag-drop-shim/issues/77)
880- window . addEventListener ( 'touchmove' , function ( ) { } )
894+ window . addEventListener ( 'touchmove' , function ( ) {
895+ } )
881896
882897 </ script >
883898 < footer >
884- < a id ="author " href ="http://twitter.com/timruffles "> @timruffles made this shim</ a > /< a id ="built " href ="http://twitter.com/rem "> original demo by
899+ < a id ="author " href ="http://twitter.com/timruffles "> @timruffles made this shim</ a > /< a id ="built "
900+ href ="http://twitter.com/rem "> original
901+ demo by
885902 @rem</ a > /< a href ="#view-source "> source</ a >
886903 </ footer >
887904</ section >
0 commit comments