PHP Classes

File: public/js/tinymce/src/themes/mobile/src/main/js/ios/scroll/Scrollables.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/themes/mobile/src/main/js/ios/scroll/Scrollables.js   Download  
File: public/js/tinymce/src/themes/mobile/src/main/js/ios/scroll/Scrollables.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,893 bytes
 

Contents

Class file image Download
define( 'tinymce.themes.mobile.ios.scroll.Scrollables', [ 'ephox.katamari.api.Fun', 'ephox.sugar.api.events.DomEvent', 'ephox.sugar.api.properties.Attr', 'ephox.sugar.api.search.SelectorFind', 'tinymce.themes.mobile.style.Styles' ], function (Fun, DomEvent, Attr, SelectorFind, Styles) { var dataHorizontal = 'data-' + Styles.resolve('horizontal-scroll'); var canScrollVertically = function (container) { container.dom().scrollTop = 1; var result = container.dom().scrollTop !== 0; container.dom().scrollTop = 0; return result; }; var canScrollHorizontally = function (container) { container.dom().scrollLeft = 1; var result = container.dom().scrollLeft !== 0; container.dom().scrollLeft = 0; return result; }; var hasVerticalScroll = function (container) { return container.dom().scrollTop > 0 || canScrollVertically(container); }; var hasHorizontalScroll = function (container) { return container.dom().scrollLeft > 0 || canScrollHorizontally(container); }; var markAsHorizontal = function (container) { Attr.set(container, dataHorizontal, 'true'); }; var hasScroll = function (container) { return Attr.get(container, dataHorizontal) === 'true' ? hasHorizontalScroll : hasVerticalScroll; }; /* * Prevents default on touchmove for anything that is not within a scrollable area. The * scrollable areas are defined by selector. */ var exclusive = function (scope, selector) { return DomEvent.bind(scope, 'touchmove', function (event) { SelectorFind.closest(event.target(), selector).filter(hasScroll).fold(function () { event.raw().preventDefault(); }, Fun.noop); }); }; return { exclusive: exclusive, markAsHorizontal: markAsHorizontal }; } );