Merge remote-tracking branch 'upstream/develop' into develop

dbm::is_result() calls needed merge

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2016-12-30 21:33:41 +01:00
commit d2280d4120
No known key found for this signature in database
GPG Key ID: B72F8185C6C7BD78
18 changed files with 503 additions and 429 deletions

View File

@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus'); define ( 'FRIENDICA_CODENAME', 'Asparagus');
define ( 'FRIENDICA_VERSION', '3.5.1-dev' ); define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1209 ); define ( 'DB_UPDATE_VERSION', 1210 );
/** /**
* @brief Constant with a HTML line break. * @brief Constant with a HTML line break.
@ -809,7 +809,7 @@ class App {
function get_baseurl($ssl = false) { function get_baseurl($ssl = false) {
// Is the function called statically? // Is the function called statically?
if (!is_object($this)) { if (!(isset($this) && get_class($this) == __CLASS__)) {
return self::$a->get_baseurl($ssl); return self::$a->get_baseurl($ssl);
} }
@ -1053,7 +1053,7 @@ class App {
function remove_baseurl($orig_url){ function remove_baseurl($orig_url){
// Is the function called statically? // Is the function called statically?
if (!is_object($this)) { if (!(isset($this) && get_class($this) == __CLASS__)) {
return(self::$a->remove_baseurl($orig_url)); return(self::$a->remove_baseurl($orig_url));
} }

View File

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 3.5.1-dev (Asparagus) -- Friendica 3.5.1-dev (Asparagus)
-- DB_UPDATE_VERSION 1208 -- DB_UPDATE_VERSION 1210
-- ------------------------------------------ -- ------------------------------------------
@ -54,11 +54,11 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
-- TABLE cache -- TABLE cache
-- --
CREATE TABLE IF NOT EXISTS `cache` ( CREATE TABLE IF NOT EXISTS `cache` (
`k` varchar(255) NOT NULL, `k` varbinary(255) NOT NULL,
`v` text, `v` text,
`expire_mode` int(11) NOT NULL DEFAULT 0, `expire_mode` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`k`(191)), PRIMARY KEY(`k`),
INDEX `updated` (`updated`), INDEX `updated` (`updated`),
INDEX `expire_mode_updated` (`expire_mode`,`updated`) INDEX `expire_mode_updated` (`expire_mode`,`updated`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -94,11 +94,11 @@ CREATE TABLE IF NOT EXISTS `clients` (
-- --
CREATE TABLE IF NOT EXISTS `config` ( CREATE TABLE IF NOT EXISTS `config` (
`id` int(10) unsigned NOT NULL auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
`cat` varchar(255) NOT NULL DEFAULT '', `cat` varbinary(255) NOT NULL DEFAULT '',
`k` varchar(255) NOT NULL DEFAULT '', `k` varbinary(255) NOT NULL DEFAULT '',
`v` text, `v` text,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
UNIQUE INDEX `cat_k` (`cat`(30),`k`(30)) UNIQUE INDEX `cat_k` (`cat`,`k`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -200,7 +200,7 @@ CREATE TABLE IF NOT EXISTS `conv` (
-- --
CREATE TABLE IF NOT EXISTS `deliverq` ( CREATE TABLE IF NOT EXISTS `deliverq` (
`id` int(10) unsigned NOT NULL auto_increment, `id` int(10) unsigned NOT NULL auto_increment,
`cmd` varchar(32) NOT NULL DEFAULT '', `cmd` varbinary(32) NOT NULL DEFAULT '',
`item` int(11) NOT NULL DEFAULT 0, `item` int(11) NOT NULL DEFAULT 0,
`contact` int(11) NOT NULL DEFAULT 0, `contact` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
@ -682,10 +682,10 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
-- TABLE oembed -- TABLE oembed
-- --
CREATE TABLE IF NOT EXISTS `oembed` ( CREATE TABLE IF NOT EXISTS `oembed` (
`url` varchar(255) NOT NULL, `url` varbinary(255) NOT NULL,
`content` text, `content` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`(191)), PRIMARY KEY(`url`),
INDEX `created` (`created`) INDEX `created` (`created`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -693,12 +693,12 @@ CREATE TABLE IF NOT EXISTS `oembed` (
-- TABLE parsed_url -- TABLE parsed_url
-- --
CREATE TABLE IF NOT EXISTS `parsed_url` ( CREATE TABLE IF NOT EXISTS `parsed_url` (
`url` varchar(255) NOT NULL, `url` varbinary(255) NOT NULL,
`guessing` tinyint(1) NOT NULL DEFAULT 0, `guessing` tinyint(1) NOT NULL DEFAULT 0,
`oembed` tinyint(1) NOT NULL DEFAULT 0, `oembed` tinyint(1) NOT NULL DEFAULT 0,
`content` text, `content` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`(191),`guessing`,`oembed`), PRIMARY KEY(`url`,`guessing`,`oembed`),
INDEX `created` (`created`) INDEX `created` (`created`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -708,11 +708,11 @@ CREATE TABLE IF NOT EXISTS `parsed_url` (
CREATE TABLE IF NOT EXISTS `pconfig` ( CREATE TABLE IF NOT EXISTS `pconfig` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`uid` int(11) NOT NULL DEFAULT 0, `uid` int(11) NOT NULL DEFAULT 0,
`cat` varchar(255) NOT NULL DEFAULT '', `cat` varbinary(255) NOT NULL DEFAULT '',
`k` varchar(255) NOT NULL DEFAULT '', `k` varbinary(255) NOT NULL DEFAULT '',
`v` mediumtext, `v` mediumtext,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
UNIQUE INDEX `uid_cat_k` (`uid`,`cat`(30),`k`(30)) UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -786,7 +786,7 @@ CREATE TABLE IF NOT EXISTS `poll_result` (
-- --
CREATE TABLE IF NOT EXISTS `process` ( CREATE TABLE IF NOT EXISTS `process` (
`pid` int(10) unsigned NOT NULL, `pid` int(10) unsigned NOT NULL,
`command` varchar(32) NOT NULL DEFAULT '', `command` varbinary(32) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`pid`), PRIMARY KEY(`pid`),
INDEX `command` (`command`) INDEX `command` (`command`)
@ -920,7 +920,7 @@ CREATE TABLE IF NOT EXISTS `search` (
-- --
CREATE TABLE IF NOT EXISTS `session` ( CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL auto_increment, `id` bigint(20) unsigned NOT NULL auto_increment,
`sid` varchar(255) NOT NULL DEFAULT '', `sid` varbinary(255) NOT NULL DEFAULT '',
`data` text, `data` text,
`expire` int(10) unsigned NOT NULL DEFAULT 0, `expire` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),

View File

@ -324,7 +324,7 @@ class Probe {
!isset($parts["path"])) !isset($parts["path"]))
return false; return false;
// todo: Ports? /// @todo: Ports?
$host = $parts["host"]; $host = $parts["host"];
if ($host == 'twitter.com') if ($host == 'twitter.com')

View File

@ -464,13 +464,13 @@ function db_definition($charset) {
); );
$database["cache"] = array( $database["cache"] = array(
"fields" => array( "fields" => array(
"k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"), "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"v" => array("type" => "text"), "v" => array("type" => "text"),
"expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("k".db_index_suffix($charset)), "PRIMARY" => array("k"),
"updated" => array("updated"), "updated" => array("updated"),
"expire_mode_updated" => array("expire_mode", "updated"), "expire_mode_updated" => array("expire_mode", "updated"),
) )
@ -504,13 +504,13 @@ function db_definition($charset) {
$database["config"] = array( $database["config"] = array(
"fields" => array( "fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"v" => array("type" => "text"), "v" => array("type" => "text"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"cat_k" => array("UNIQUE", "cat(30)","k(30)"), "cat_k" => array("UNIQUE", "cat", "k"),
) )
); );
$database["contact"] = array( $database["contact"] = array(
@ -610,7 +610,7 @@ function db_definition($charset) {
$database["deliverq"] = array( $database["deliverq"] = array(
"fields" => array( "fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""), "cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
"item" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
), ),
@ -1092,25 +1092,25 @@ function db_definition($charset) {
); );
$database["oembed"] = array( $database["oembed"] = array(
"fields" => array( "fields" => array(
"url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"), "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"content" => array("type" => "text"), "content" => array("type" => "text"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("url".db_index_suffix($charset)), "PRIMARY" => array("url"),
"created" => array("created"), "created" => array("created"),
) )
); );
$database["parsed_url"] = array( $database["parsed_url"] = array(
"fields" => array( "fields" => array(
"url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"), "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"), "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"), "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"content" => array("type" => "text"), "content" => array("type" => "text"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"), "PRIMARY" => array("url", "guessing", "oembed"),
"created" => array("created"), "created" => array("created"),
) )
); );
@ -1118,13 +1118,13 @@ function db_definition($charset) {
"fields" => array( "fields" => array(
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"v" => array("type" => "mediumtext"), "v" => array("type" => "mediumtext"),
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"), "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
) )
); );
$database["photo"] = array( $database["photo"] = array(
@ -1196,7 +1196,7 @@ function db_definition($charset) {
$database["process"] = array( $database["process"] = array(
"fields" => array( "fields" => array(
"pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"), "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
"command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""), "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"), "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
), ),
"indexes" => array( "indexes" => array(
@ -1330,7 +1330,7 @@ function db_definition($charset) {
$database["session"] = array( $database["session"] = array(
"fields" => array( "fields" => array(
"id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"), "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"data" => array("type" => "text"), "data" => array("type" => "text"),
"expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"), "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
), ),

View File

@ -596,21 +596,25 @@ class ostatus {
$last = get_config('system','ostatus_last_poll'); $last = get_config('system','ostatus_last_poll');
$poll_interval = intval(get_config('system','ostatus_poll_interval')); $poll_interval = intval(get_config('system','ostatus_poll_interval'));
if(! $poll_interval) if (!$poll_interval) {
$poll_interval = OSTATUS_DEFAULT_POLL_INTERVAL; $poll_interval = self::OSTATUS_DEFAULT_POLL_INTERVAL;
}
// Don't poll if the interval is set negative // Don't poll if the interval is set negative
if (($poll_interval < 0) AND !$override) if (($poll_interval < 0) AND !$override) {
return; return;
}
if (!$mentions) { if (!$mentions) {
$poll_timeframe = intval(get_config('system','ostatus_poll_timeframe')); $poll_timeframe = intval(get_config('system','ostatus_poll_timeframe'));
if (!$poll_timeframe) if (!$poll_timeframe) {
$poll_timeframe = OSTATUS_DEFAULT_POLL_TIMEFRAME; $poll_timeframe = self::OSTATUS_DEFAULT_POLL_TIMEFRAME;
}
} else { } else {
$poll_timeframe = intval(get_config('system','ostatus_poll_timeframe')); $poll_timeframe = intval(get_config('system','ostatus_poll_timeframe'));
if (!$poll_timeframe) if (!$poll_timeframe) {
$poll_timeframe = OSTATUS_DEFAULT_POLL_TIMEFRAME_MENTIONS; $poll_timeframe = self::OSTATUS_DEFAULT_POLL_TIMEFRAME_MENTIONS;
}
} }
@ -626,15 +630,16 @@ class ostatus {
$start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60)); $start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60));
if ($mentions) if ($mentions) {
$conversations = q("SELECT `term`.`oid`, `term`.`url`, `term`.`uid` FROM `term` $conversations = q("SELECT `term`.`oid`, `term`.`url`, `term`.`uid` FROM `term`
STRAIGHT_JOIN `thread` ON `thread`.`iid` = `term`.`oid` AND `thread`.`uid` = `term`.`uid` STRAIGHT_JOIN `thread` ON `thread`.`iid` = `term`.`oid` AND `thread`.`uid` = `term`.`uid`
WHERE `term`.`type` = 7 AND `term`.`term` > '%s' AND `thread`.`mention` WHERE `term`.`type` = 7 AND `term`.`term` > '%s' AND `thread`.`mention`
GROUP BY `term`.`url`, `term`.`uid` ORDER BY `term`.`term` DESC", dbesc($start)); GROUP BY `term`.`url`, `term`.`uid` ORDER BY `term`.`term` DESC", dbesc($start));
else } else {
$conversations = q("SELECT `oid`, `url`, `uid` FROM `term` $conversations = q("SELECT `oid`, `url`, `uid` FROM `term`
WHERE `type` = 7 AND `term` > '%s' WHERE `type` = 7 AND `term` > '%s'
GROUP BY `url`, `uid` ORDER BY `term` DESC", dbesc($start)); GROUP BY `url`, `uid` ORDER BY `term` DESC", dbesc($start));
}
foreach ($conversations AS $conversation) { foreach ($conversations AS $conversation) {
self::completion($conversation['url'], $conversation['uid']); self::completion($conversation['url'], $conversation['uid']);

View File

@ -1188,7 +1188,7 @@ function update_suggestions() {
$done = array(); $done = array();
/// TODO Check if it is really neccessary to poll the own server /// @TODO Check if it is really neccessary to poll the own server
poco_load(0,0,0,App::get_baseurl() . '/poco'); poco_load(0,0,0,App::get_baseurl() . '/poco');
$done[] = App::get_baseurl() . '/poco'; $done[] = App::get_baseurl() . '/poco';

View File

@ -161,10 +161,12 @@
// fancyboxes // fancyboxes
$("a.popupbox").colorbox({ $("a.popupbox").colorbox({
'inline' : true, 'inline' : true,
'transition' : 'elastic' 'transition' : 'elastic',
'maxWidth' : '100%'
}); });
$("a.ajax-popupbox").colorbox({ $("a.ajax-popupbox").colorbox({
'transition' : 'elastic' 'transition' : 'elastic',
'maxWidth' : '100%'
}); });
/* notifications template */ /* notifications template */

View File

@ -52,16 +52,26 @@ It's cool, isn't it?
## Install ## Install
#### NPM
The best way to install and use perfect-scrollbar is with NPM. The best way to install and use perfect-scrollbar is with NPM.
It's registered on [npm](https://www.npmjs.org/package/perfect-scrollbar) as `perfect-scrollbar`. It's registered on [npm](https://www.npmjs.com/package/perfect-scrollbar) as `perfect-scrollbar`.
``` ```
$ npm install perfect-scrollbar $ npm install perfect-scrollbar
``` ```
#### Rails
In the case you would like to have perfect-scrollbar in your Rails application, there is the [perfect-scrollbar-rails gem](https://github.com/YourCursus/perfect-scrollbar-rails).
#### Manually
You can download the latest stable version with download links [here](http://noraesae.github.io/perfect-scrollbar/). You can download the latest stable version with download links [here](http://noraesae.github.io/perfect-scrollbar/).
You also can find all releases on [Releases](https://github.com/noraesae/perfect-scrollbar/releases). You also can find all releases on [Releases](https://github.com/noraesae/perfect-scrollbar/releases).
#### From sources
If you want to use the development version of the plugin, use the If you want to use the development version of the plugin, use the
source files which are not minified. They're in the `src` directory. source files which are not minified. They're in the `src` directory.
The development version may be unstable, but some known bugs may The development version may be unstable, but some known bugs may
@ -74,6 +84,7 @@ $ npm install
$ gulp # will lint and build the source code. $ gulp # will lint and build the source code.
``` ```
#### Bower
There is a Bower package for perfect-scrollbar as well. It is managed There is a Bower package for perfect-scrollbar as well. It is managed
under the [perfect-scrollbar-bower](https://github.com/noraesae/perfect-scrollbar-bower) under the [perfect-scrollbar-bower](https://github.com/noraesae/perfect-scrollbar-bower)
@ -83,26 +94,38 @@ repository. The plugin is registered as `perfect-scrollbar`.
$ bower install perfect-scrollbar $ bower install perfect-scrollbar
``` ```
#### CDNs
You can also load it from [cdnjs](http://cdnjs.com/). * [cdnjs](http://www.cdnjs.com/libraries/jquery.perfect-scrollbar)
It is registered as [`jquery.perfect-scrollbar`](http://www.cdnjs.com/libraries/jquery.perfect-scrollbar). * [JSDelivr](https://www.jsdelivr.com/projects/perfect-scrollbar)
## Requirements #### JSFiddle
To make this plugin *perfect*, some requirements were unavoidable. You can fork the following JSFiddles for testing and experimenting purposes:
But, they're all very trivial and there is nothing to worry about.
* [Perfect Scrollbar](https://jsfiddle.net/DanielApt/xv0rrxv3/)
* [Perfect Scrollbar (jQuery)](https://jsfiddle.net/DanielApt/gbfLazpx/)
## Before using perfect-scrollbar
The following requirements should meet. The following requirements should meet.
* the container must have a 'position' css style. * the container must have a 'position' css style.
* the container must be a normal container element.
* PS may not work well in `body`, `textarea`, `iframe` or flexbox.
The following requirements are included in the basic CSS, but please The following requirements are included in the basic CSS, but please
keep in mind when you'd like to change the CSS files. keep in mind when you'd like to change the CSS files.
* the container must have an 'overflow:hidden' css style. * the container must have an 'overflow: hidden' css style.
* the scrollbar's position must be 'absolute'. * the scrollbar's position must be 'absolute'.
* the scrollbar-x must have a 'bottom' css style, and the scrollbar-y * the scrollbar-x must have a 'bottom' css style, and the scrollbar-y
must have a 'right' css style. must have a 'right' css style.
Please keep in mind that perfect-scrollbar won't completely emulate native
scrolls. Scroll hooking is generally considered as bad practice, and
perfect-scrollbar should be used with care. Unless custom scroll is really needed,
please consider using native scrolls.
## How to use ## How to use
@ -155,7 +178,7 @@ If the size of your container or content changes, call `update`.
Ps.update(container); Ps.update(container);
``` ```
If you want to destory the scrollbar, use `destroy`. If you want to destroy the scrollbar, use `destroy`.
```javascript ```javascript
Ps.destroy(container); Ps.destroy(container);
@ -238,12 +261,12 @@ define([
'perfectScrollbarJquery' 'perfectScrollbarJquery'
], ],
function (angular) { function (angular) {
var myApp = angular.module('myApp', []) var app = angular.module('myApp', []);
.run(function() { app.run(function () {
window.Ps = require('perfectScrollbar'); window.Ps = require('perfectScrollbar');
require('perfectScrollbarJQuery'); require('perfectScrollbarJQuery');
}) });
return myApp; return app;
}); });
``` ```
@ -256,7 +279,7 @@ Ps.initialize(container);
Ps.update(container); Ps.update(container);
// or by jQuery: // or by jQuery:
var imgLoader = $("#imgLoader") var imgLoader = $('#imgLoader')
imgLoader.perfectScrollbar(); imgLoader.perfectScrollbar();
``` ```
@ -264,57 +287,80 @@ imgLoader.perfectScrollbar();
perfect-scrollbar supports optional parameters. perfect-scrollbar supports optional parameters.
### handlers
It is a list of handlers to use to scroll the element.
**Default**: `['click-rail', 'drag-scrollbar', 'keyboard', 'wheel', 'touch']`
**Disabled by default**: `'selection'`
### wheelSpeed ### wheelSpeed
The scroll speed applied to mousewheel event. The scroll speed applied to mousewheel event.
**Default: 1** **Default**: `1`
### wheelPropagation ### wheelPropagation
If this option is true, when the scroll reaches the end of the side, mousewheel event will be propagated to parent element. If this option is true, when the scroll reaches the end of the side, mousewheel event will be propagated to parent element.
**Default: false** **Default**: `false`
### swipePropagation ### swipePropagation
If this option is true, when the scroll reaches the end of the side, touch scrolling will be propagated to parent element. If this option is true, when the scroll reaches the end of the side, touch scrolling will be propagated to parent element.
**Default: true** **Default**: `true`
### minScrollbarLength ### minScrollbarLength
When set to an integer value, the thumb part of the scrollbar will not shrink below that number of pixels. When set to an integer value, the thumb part of the scrollbar will not shrink below that number of pixels.
**Default: null** **Default**: `null`
### maxScrollbarLength ### maxScrollbarLength
When set to an integer value, the thumb part of the scrollbar will not expand over that number of pixels. When set to an integer value, the thumb part of the scrollbar will not expand over that number of pixels.
**Default: null** **Default**: `null`
### useBothWheelAxes ### useBothWheelAxes
When set to true, and only one (vertical or horizontal) scrollbar is visible then both vertical and horizontal scrolling will affect the scrollbar. When set to true, and only one (vertical or horizontal) scrollbar is visible then both vertical and horizontal scrolling will affect the scrollbar.
**Default: false** **Default**: `false`
### useKeyboard
When set to true, the scroll works with arrow keys on the keyboard. The element is scrolled only when the mouse cursor hovers the element.
**Default: true**
### suppressScrollX ### suppressScrollX
When set to true, the scroll bar in X axis will not be available, regardless of the content width. When set to true, the scroll bar in X axis will not be available, regardless of the content width.
**Default: false** **Default**: `false`
### suppressScrollY ### suppressScrollY
When set to true, the scroll bar in Y axis will not be available, regardless of the content height. When set to true, the scroll bar in Y axis will not be available, regardless of the content height.
**Default: false** **Default**: `false`
### scrollXMarginOffset ### scrollXMarginOffset
The number of pixels the content width can surpass the container width without enabling the X axis scroll bar. Allows some "wiggle room" or "offset break", so that X axis scroll bar is not enabled just because of a few pixels. The number of pixels the content width can surpass the container width without enabling the X axis scroll bar. Allows some "wiggle room" or "offset break", so that X axis scroll bar is not enabled just because of a few pixels.
**Default: 0** **Default**: `0`
### scrollYMarginOffset ### scrollYMarginOffset
The number of pixels the content height can surpass the container height without enabling the Y axis scroll bar. Allows some "wiggle room" or "offset break", so that Y axis scroll bar is not enabled just because of a few pixels. The number of pixels the content height can surpass the container height without enabling the Y axis scroll bar. Allows some "wiggle room" or "offset break", so that Y axis scroll bar is not enabled just because of a few pixels.
**Default: 0** **Default**: `0`
### stopPropagationOnClick ### theme
When set to false, when clicking on a rail, the click event will be allowed to propagate. A string. It's a class name added to the container element. The class name is prepended with `ps-theme-`. So default theme class name is `ps-theme-default`. In order to create custom themes with scss use `ps-container($theme)` mixin, where `$theme` is a scss map.
**Default: true** **Default**: `'default'`
**Example 1:**
Add `theme` parameter:
```javascript
Ps.initialize(container, {
theme: 'my-theme-name'
});
```
Create a class name prefixed with `.ps-theme-`. Include `ps-container()` mixin. It's recommended to use `map-merge()` to extend `$ps-theme-default` map with your custom styles.
```scss
.ps-theme-my-theme-name {
@include ps-container(map-merge($ps-theme-default, (
border-radius: 0,
scrollbar-x-rail-height: 20px,
scrollbar-x-height: 20px,
scrollbar-y-rail-width: 20px,
scrollbar-y-width: 20px
)));
}
```
**Example 2:**
Alternatively, if you don't want to create your own themes, but only modify the default one, you could simply overwrite `$ps-*` variables with your own values. In this case `theme` parameter is not required when calling `.initialize()` method. Remember do define your own variables before the `theme.scss` file is imported.
### useSelectionScroll
When set to true, you can scroll the container by selecting text and move the cursor.
**Default: false**
## Events ## Events
@ -363,24 +409,20 @@ $(document).on('ps-scroll-x', function () {
}) })
``` ```
## Contribution ## Tips
#### Please read [Contributing](https://github.com/noraesae/perfect-scrollbar/wiki/Contributing) in the wiki before making any contribution. ### Scrolling children inside perfect-scrollbar
You can natively scroll children inside `perfect-scrollbar` with the mouse-wheel. Scrolling automatically works if
I *really* welcome contributions! Please feel free to fork and issue pull requests when... the child is a `textarea`. All other elements need to have the `ps-child` class. This is demonstrated in [`/examples/children-native-scroll.html`](examples/children-native-scroll.html)
* You have a very nice idea to improve this plugin!
* You found a bug!
* You're good at English and can help my bad English!
For IE problems, please refer to [IE Support](https://github.com/noraesae/perfect-scrollbar#ie-support).
## IE Support ## IE Support
The plugin would work in IEs >= IE9 (not well, though). The plugin is designed to work in modern browsers, including the very latest
version of IE and Edge. Specifically, it should work in IEs >= IE10. If there
is any issue in the browsers, please [file it](https://github.com/noraesae/perfect-scrollbar/issues).
**The patches to fix problems in IE<=8 won't be accepted.** **The patches to fix problems in IE<=9 won't be accepted.**
When old IEs should be supported, please fork the project and When old IEs should be supported, please fork the project and
make patches personally. make patches personally.
@ -396,7 +438,7 @@ For common problems there is a
## License ## License
The MIT License (MIT) Copyright (c) 2015 Hyunje Alex Jun and other contributors. The MIT License (MIT) Copyright (c) 2016 Hyunje Alex Jun and other contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -1,7 +1,7 @@
/* perfect-scrollbar v0.6.10 */ /* perfect-scrollbar v0.6.15 */
.ps-container { .ps-container {
-ms-touch-action: none; -ms-touch-action: auto;
touch-action: none; touch-action: auto;
overflow: hidden !important; overflow: hidden !important;
-ms-overflow-style: none; } -ms-overflow-style: none; }
@supports (-ms-overflow-style: none) { @supports (-ms-overflow-style: none) {
@ -14,88 +14,90 @@
.ps-container.ps-active-y > .ps-scrollbar-y-rail { .ps-container.ps-active-y > .ps-scrollbar-y-rail {
display: block; display: block;
background-color: transparent; } background-color: transparent; }
.ps-container.ps-in-scrolling { .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
pointer-events: none; } background-color: #eee;
.ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail { opacity: 0.9; }
background-color: #eee; .ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
opacity: 0.9; } background-color: #999;
.ps-container.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x { height: 11px; }
background-color: #999; } .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
.ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail { background-color: #eee;
background-color: #eee; opacity: 0.9; }
opacity: 0.9; } .ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
.ps-container.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y { background-color: #999;
background-color: #999; } width: 11px; }
.ps-container > .ps-scrollbar-x-rail { .ps-container > .ps-scrollbar-x-rail {
display: none; display: none;
position: absolute; position: absolute;
/* please don't change 'position' */ /* please don't change 'position' */
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
opacity: 0; opacity: 0;
-webkit-transition: background-color .2s linear, opacity .2s linear; -webkit-transition: background-color .2s linear, opacity .2s linear;
-moz-transition: background-color .2s linear, opacity .2s linear;
-o-transition: background-color .2s linear, opacity .2s linear; -o-transition: background-color .2s linear, opacity .2s linear;
-moz-transition: background-color .2s linear, opacity .2s linear;
transition: background-color .2s linear, opacity .2s linear; transition: background-color .2s linear, opacity .2s linear;
bottom: 3px; bottom: 0px;
/* there must be 'bottom' for ps-scrollbar-x-rail */ /* there must be 'bottom' for ps-scrollbar-x-rail */
height: 8px; } height: 15px; }
.ps-container > .ps-scrollbar-x-rail > .ps-scrollbar-x { .ps-container > .ps-scrollbar-x-rail > .ps-scrollbar-x {
position: absolute; position: absolute;
/* please don't change 'position' */ /* please don't change 'position' */
background-color: #aaa; background-color: #aaa;
-webkit-border-radius: 4px; -webkit-border-radius: 6px;
-moz-border-radius: 4px; -moz-border-radius: 6px;
border-radius: 4px; border-radius: 6px;
-webkit-transition: background-color .2s linear; -webkit-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
-moz-transition: background-color .2s linear; transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
-o-transition: background-color .2s linear; -o-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
transition: background-color .2s linear; -moz-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
bottom: 0; transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
bottom: 2px;
/* there must be 'bottom' for ps-scrollbar-x */ /* there must be 'bottom' for ps-scrollbar-x */
height: 8px; } height: 6px; }
.ps-container > .ps-scrollbar-x-rail:hover > .ps-scrollbar-x, .ps-container > .ps-scrollbar-x-rail:active > .ps-scrollbar-x {
height: 11px; }
.ps-container > .ps-scrollbar-y-rail { .ps-container > .ps-scrollbar-y-rail {
display: none; display: none;
position: absolute; position: absolute;
/* please don't change 'position' */ /* please don't change 'position' */
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
opacity: 0; opacity: 0;
-webkit-transition: background-color .2s linear, opacity .2s linear; -webkit-transition: background-color .2s linear, opacity .2s linear;
-moz-transition: background-color .2s linear, opacity .2s linear;
-o-transition: background-color .2s linear, opacity .2s linear; -o-transition: background-color .2s linear, opacity .2s linear;
-moz-transition: background-color .2s linear, opacity .2s linear;
transition: background-color .2s linear, opacity .2s linear; transition: background-color .2s linear, opacity .2s linear;
right: 3px; right: 0;
/* there must be 'right' for ps-scrollbar-y-rail */ /* there must be 'right' for ps-scrollbar-y-rail */
width: 8px; } width: 15px; }
.ps-container > .ps-scrollbar-y-rail > .ps-scrollbar-y { .ps-container > .ps-scrollbar-y-rail > .ps-scrollbar-y {
position: absolute; position: absolute;
/* please don't change 'position' */ /* please don't change 'position' */
background-color: #aaa; background-color: #aaa;
-webkit-border-radius: 4px; -webkit-border-radius: 6px;
-moz-border-radius: 4px; -moz-border-radius: 6px;
border-radius: 4px; border-radius: 6px;
-webkit-transition: background-color .2s linear; -webkit-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
-moz-transition: background-color .2s linear; transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;
-o-transition: background-color .2s linear; -o-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
transition: background-color .2s linear; -moz-transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
right: 0; transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;
transition: background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;
right: 2px;
/* there must be 'right' for ps-scrollbar-y */ /* there must be 'right' for ps-scrollbar-y */
width: 8px; } width: 6px; }
.ps-container:hover.ps-in-scrolling { .ps-container > .ps-scrollbar-y-rail:hover > .ps-scrollbar-y, .ps-container > .ps-scrollbar-y-rail:active > .ps-scrollbar-y {
pointer-events: none; } width: 11px; }
.ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail { .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail {
background-color: #eee; background-color: #eee;
opacity: 0.9; } opacity: 0.9; }
.ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x { .ps-container:hover.ps-in-scrolling.ps-x > .ps-scrollbar-x-rail > .ps-scrollbar-x {
background-color: #999; } background-color: #999;
.ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail { height: 11px; }
background-color: #eee; .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail {
opacity: 0.9; } background-color: #eee;
.ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y { opacity: 0.9; }
background-color: #999; } .ps-container:hover.ps-in-scrolling.ps-y > .ps-scrollbar-y-rail > .ps-scrollbar-y {
background-color: #999;
width: 11px; }
.ps-container:hover > .ps-scrollbar-x-rail, .ps-container:hover > .ps-scrollbar-x-rail,
.ps-container:hover > .ps-scrollbar-y-rail { .ps-container:hover > .ps-scrollbar-y-rail {
opacity: 0.6; } opacity: 0.6; }

View File

@ -1,16 +1,9 @@
/* perfect-scrollbar v0.6.10 /* perfect-scrollbar v0.6.15 */
*
* Copyright (c) 2015 Hyunje Alex Jun and other contributors
* Licensed under the MIT License
*
* Source: https://github.com/noraesae/perfect-scrollbar
*/
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict'; 'use strict';
var ps = require('../main') var ps = require('../main');
, psInstances = require('../plugin/instances'); var psInstances = require('../plugin/instances');
function mountJQuery(jQuery) { function mountJQuery(jQuery) {
jQuery.fn.perfectScrollbar = function (settingOrCommand) { jQuery.fn.perfectScrollbar = function (settingOrCommand) {
@ -33,8 +26,6 @@ function mountJQuery(jQuery) {
ps.destroy(this); ps.destroy(this);
} }
} }
return jQuery(this);
}); });
}; };
} }
@ -272,20 +263,22 @@ module.exports = (function () {
},{}],6:[function(require,module,exports){ },{}],6:[function(require,module,exports){
'use strict'; 'use strict';
var cls = require('./class') var cls = require('./class');
, d = require('./dom'); var dom = require('./dom');
exports.toInt = function (x) { var toInt = exports.toInt = function (x) {
return parseInt(x, 10) || 0; return parseInt(x, 10) || 0;
}; };
exports.clone = function (obj) { var clone = exports.clone = function (obj) {
if (obj === null) { if (!obj) {
return null; return null;
} else if (obj.constructor === Array) {
return obj.map(clone);
} else if (typeof obj === 'object') { } else if (typeof obj === 'object') {
var result = {}; var result = {};
for (var key in obj) { for (var key in obj) {
result[key] = this.clone(obj[key]); result[key] = clone(obj[key]);
} }
return result; return result;
} else { } else {
@ -294,18 +287,18 @@ exports.clone = function (obj) {
}; };
exports.extend = function (original, source) { exports.extend = function (original, source) {
var result = this.clone(original); var result = clone(original);
for (var key in source) { for (var key in source) {
result[key] = this.clone(source[key]); result[key] = clone(source[key]);
} }
return result; return result;
}; };
exports.isEditable = function (el) { exports.isEditable = function (el) {
return d.matches(el, "input,[contenteditable]") || return dom.matches(el, "input,[contenteditable]") ||
d.matches(el, "select,[contenteditable]") || dom.matches(el, "select,[contenteditable]") ||
d.matches(el, "textarea,[contenteditable]") || dom.matches(el, "textarea,[contenteditable]") ||
d.matches(el, "button,[contenteditable]"); dom.matches(el, "button,[contenteditable]");
}; };
exports.removePsClasses = function (element) { exports.removePsClasses = function (element) {
@ -319,11 +312,11 @@ exports.removePsClasses = function (element) {
}; };
exports.outerWidth = function (element) { exports.outerWidth = function (element) {
return this.toInt(d.css(element, 'width')) + return toInt(dom.css(element, 'width')) +
this.toInt(d.css(element, 'paddingLeft')) + toInt(dom.css(element, 'paddingLeft')) +
this.toInt(d.css(element, 'paddingRight')) + toInt(dom.css(element, 'paddingRight')) +
this.toInt(d.css(element, 'borderLeftWidth')) + toInt(dom.css(element, 'borderLeftWidth')) +
this.toInt(d.css(element, 'borderRightWidth')); toInt(dom.css(element, 'borderRightWidth'));
}; };
exports.startScrolling = function (element, axis) { exports.startScrolling = function (element, axis) {
@ -355,9 +348,9 @@ exports.env = {
},{"./class":2,"./dom":3}],7:[function(require,module,exports){ },{"./class":2,"./dom":3}],7:[function(require,module,exports){
'use strict'; 'use strict';
var destroy = require('./plugin/destroy') var destroy = require('./plugin/destroy');
, initialize = require('./plugin/initialize') var initialize = require('./plugin/initialize');
, update = require('./plugin/update'); var update = require('./plugin/update');
module.exports = { module.exports = {
initialize: initialize, initialize: initialize,
@ -369,17 +362,15 @@ module.exports = {
'use strict'; 'use strict';
module.exports = { module.exports = {
handlers: ['click-rail', 'drag-scrollbar', 'keyboard', 'wheel', 'touch'],
maxScrollbarLength: null, maxScrollbarLength: null,
minScrollbarLength: null, minScrollbarLength: null,
scrollXMarginOffset: 0, scrollXMarginOffset: 0,
scrollYMarginOffset: 0, scrollYMarginOffset: 0,
stopPropagationOnClick: true,
suppressScrollX: false, suppressScrollX: false,
suppressScrollY: false, suppressScrollY: false,
swipePropagation: true, swipePropagation: true,
useBothWheelAxes: false, useBothWheelAxes: false,
useKeyboard: true,
useSelectionScroll: false,
wheelPropagation: false, wheelPropagation: false,
wheelSpeed: 1, wheelSpeed: 1,
theme: 'default' theme: 'default'
@ -388,9 +379,9 @@ module.exports = {
},{}],9:[function(require,module,exports){ },{}],9:[function(require,module,exports){
'use strict'; 'use strict';
var d = require('../lib/dom') var _ = require('../lib/helper');
, h = require('../lib/helper') var dom = require('../lib/dom');
, instances = require('./instances'); var instances = require('./instances');
module.exports = function (element) { module.exports = function (element) {
var i = instances.get(element); var i = instances.get(element);
@ -400,11 +391,11 @@ module.exports = function (element) {
} }
i.event.unbindAll(); i.event.unbindAll();
d.remove(i.scrollbarX); dom.remove(i.scrollbarX);
d.remove(i.scrollbarY); dom.remove(i.scrollbarY);
d.remove(i.scrollbarXRail); dom.remove(i.scrollbarXRail);
d.remove(i.scrollbarYRail); dom.remove(i.scrollbarYRail);
h.removePsClasses(element); _.removePsClasses(element);
instances.remove(element); instances.remove(element);
}; };
@ -412,54 +403,33 @@ module.exports = function (element) {
},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){ },{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){
'use strict'; 'use strict';
var h = require('../../lib/helper') var instances = require('../instances');
, instances = require('../instances') var updateGeometry = require('../update-geometry');
, updateGeometry = require('../update-geometry') var updateScroll = require('../update-scroll');
, updateScroll = require('../update-scroll');
function bindClickRailHandler(element, i) { function bindClickRailHandler(element, i) {
function pageOffset(el) { function pageOffset(el) {
return el.getBoundingClientRect(); return el.getBoundingClientRect();
} }
var stopPropagation = window.Event.prototype.stopPropagation.bind; var stopPropagation = function (e) { e.stopPropagation(); };
if (i.settings.stopPropagationOnClick) { i.event.bind(i.scrollbarY, 'click', stopPropagation);
i.event.bind(i.scrollbarY, 'click', stopPropagation);
}
i.event.bind(i.scrollbarYRail, 'click', function (e) { i.event.bind(i.scrollbarYRail, 'click', function (e) {
var halfOfScrollbarLength = h.toInt(i.scrollbarYHeight / 2); var positionTop = e.pageY - window.pageYOffset - pageOffset(i.scrollbarYRail).top;
var positionTop = i.railYRatio * (e.pageY - window.pageYOffset - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength); var direction = positionTop > i.scrollbarYTop ? 1 : -1;
var maxPositionTop = i.railYRatio * (i.railYHeight - i.scrollbarYHeight);
var positionRatio = positionTop / maxPositionTop;
if (positionRatio < 0) { updateScroll(element, 'top', element.scrollTop + direction * i.containerHeight);
positionRatio = 0;
} else if (positionRatio > 1) {
positionRatio = 1;
}
updateScroll(element, 'top', (i.contentHeight - i.containerHeight) * positionRatio);
updateGeometry(element); updateGeometry(element);
e.stopPropagation(); e.stopPropagation();
}); });
if (i.settings.stopPropagationOnClick) { i.event.bind(i.scrollbarX, 'click', stopPropagation);
i.event.bind(i.scrollbarX, 'click', stopPropagation);
}
i.event.bind(i.scrollbarXRail, 'click', function (e) { i.event.bind(i.scrollbarXRail, 'click', function (e) {
var halfOfScrollbarLength = h.toInt(i.scrollbarXWidth / 2); var positionLeft = e.pageX - window.pageXOffset - pageOffset(i.scrollbarXRail).left;
var positionLeft = i.railXRatio * (e.pageX - window.pageXOffset - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength); var direction = positionLeft > i.scrollbarXLeft ? 1 : -1;
var maxPositionLeft = i.railXRatio * (i.railXWidth - i.scrollbarXWidth);
var positionRatio = positionLeft / maxPositionLeft;
if (positionRatio < 0) { updateScroll(element, 'left', element.scrollLeft + direction * i.containerWidth);
positionRatio = 0;
} else if (positionRatio > 1) {
positionRatio = 1;
}
updateScroll(element, 'left', ((i.contentWidth - i.containerWidth) * positionRatio) - i.negativeScrollAdjustment);
updateGeometry(element); updateGeometry(element);
e.stopPropagation(); e.stopPropagation();
@ -471,14 +441,14 @@ module.exports = function (element) {
bindClickRailHandler(element, i); bindClickRailHandler(element, i);
}; };
},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(require,module,exports){ },{"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(require,module,exports){
'use strict'; 'use strict';
var d = require('../../lib/dom') var _ = require('../../lib/helper');
, h = require('../../lib/helper') var dom = require('../../lib/dom');
, instances = require('../instances') var instances = require('../instances');
, updateGeometry = require('../update-geometry') var updateGeometry = require('../update-geometry');
, updateScroll = require('../update-scroll'); var updateScroll = require('../update-scroll');
function bindMouseScrollXHandler(element, i) { function bindMouseScrollXHandler(element, i) {
var currentLeft = null; var currentLeft = null;
@ -496,7 +466,7 @@ function bindMouseScrollXHandler(element, i) {
i.scrollbarXLeft = newLeft; i.scrollbarXLeft = newLeft;
} }
var scrollLeft = h.toInt(i.scrollbarXLeft * (i.contentWidth - i.containerWidth) / (i.containerWidth - (i.railXRatio * i.scrollbarXWidth))) - i.negativeScrollAdjustment; var scrollLeft = _.toInt(i.scrollbarXLeft * (i.contentWidth - i.containerWidth) / (i.containerWidth - (i.railXRatio * i.scrollbarXWidth))) - i.negativeScrollAdjustment;
updateScroll(element, 'left', scrollLeft); updateScroll(element, 'left', scrollLeft);
} }
@ -508,14 +478,14 @@ function bindMouseScrollXHandler(element, i) {
}; };
var mouseUpHandler = function () { var mouseUpHandler = function () {
h.stopScrolling(element, 'x'); _.stopScrolling(element, 'x');
i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
}; };
i.event.bind(i.scrollbarX, 'mousedown', function (e) { i.event.bind(i.scrollbarX, 'mousedown', function (e) {
currentPageX = e.pageX; currentPageX = e.pageX;
currentLeft = h.toInt(d.css(i.scrollbarX, 'left')) * i.railXRatio; currentLeft = _.toInt(dom.css(i.scrollbarX, 'left')) * i.railXRatio;
h.startScrolling(element, 'x'); _.startScrolling(element, 'x');
i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
@ -541,7 +511,7 @@ function bindMouseScrollYHandler(element, i) {
i.scrollbarYTop = newTop; i.scrollbarYTop = newTop;
} }
var scrollTop = h.toInt(i.scrollbarYTop * (i.contentHeight - i.containerHeight) / (i.containerHeight - (i.railYRatio * i.scrollbarYHeight))); var scrollTop = _.toInt(i.scrollbarYTop * (i.contentHeight - i.containerHeight) / (i.containerHeight - (i.railYRatio * i.scrollbarYHeight)));
updateScroll(element, 'top', scrollTop); updateScroll(element, 'top', scrollTop);
} }
@ -553,14 +523,14 @@ function bindMouseScrollYHandler(element, i) {
}; };
var mouseUpHandler = function () { var mouseUpHandler = function () {
h.stopScrolling(element, 'y'); _.stopScrolling(element, 'y');
i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
}; };
i.event.bind(i.scrollbarY, 'mousedown', function (e) { i.event.bind(i.scrollbarY, 'mousedown', function (e) {
currentPageY = e.pageY; currentPageY = e.pageY;
currentTop = h.toInt(d.css(i.scrollbarY, 'top')) * i.railYRatio; currentTop = _.toInt(dom.css(i.scrollbarY, 'top')) * i.railYRatio;
h.startScrolling(element, 'y'); _.startScrolling(element, 'y');
i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
@ -579,11 +549,11 @@ module.exports = function (element) {
},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],12:[function(require,module,exports){ },{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],12:[function(require,module,exports){
'use strict'; 'use strict';
var h = require('../../lib/helper') var _ = require('../../lib/helper');
, d = require('../../lib/dom') var dom = require('../../lib/dom');
, instances = require('../instances') var instances = require('../instances');
, updateGeometry = require('../update-geometry') var updateGeometry = require('../update-geometry');
, updateScroll = require('../update-scroll'); var updateScroll = require('../update-scroll');
function bindKeyboardHandler(element, i) { function bindKeyboardHandler(element, i) {
var hovered = false; var hovered = false;
@ -619,12 +589,12 @@ function bindKeyboardHandler(element, i) {
} }
i.event.bind(i.ownerDocument, 'keydown', function (e) { i.event.bind(i.ownerDocument, 'keydown', function (e) {
if (e.isDefaultPrevented && e.isDefaultPrevented()) { if ((e.isDefaultPrevented && e.isDefaultPrevented()) || e.defaultPrevented) {
return; return;
} }
var focused = d.matches(i.scrollbarX, ':focus') || var focused = dom.matches(i.scrollbarX, ':focus') ||
d.matches(i.scrollbarY, ':focus'); dom.matches(i.scrollbarY, ':focus');
if (!hovered && !focused) { if (!hovered && !focused) {
return; return;
@ -632,11 +602,15 @@ function bindKeyboardHandler(element, i) {
var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement; var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement;
if (activeElement) { if (activeElement) {
// go deeper if element is a webcomponent if (activeElement.tagName === 'IFRAME') {
while (activeElement.shadowRoot) { activeElement = activeElement.contentDocument.activeElement;
activeElement = activeElement.shadowRoot.activeElement; } else {
// go deeper if element is a webcomponent
while (activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement;
}
} }
if (h.isEditable(activeElement)) { if (_.isEditable(activeElement)) {
return; return;
} }
} }
@ -646,16 +620,40 @@ function bindKeyboardHandler(element, i) {
switch (e.which) { switch (e.which) {
case 37: // left case 37: // left
deltaX = -30; if (e.metaKey) {
deltaX = -i.contentWidth;
} else if (e.altKey) {
deltaX = -i.containerWidth;
} else {
deltaX = -30;
}
break; break;
case 38: // up case 38: // up
deltaY = 30; if (e.metaKey) {
deltaY = i.contentHeight;
} else if (e.altKey) {
deltaY = i.containerHeight;
} else {
deltaY = 30;
}
break; break;
case 39: // right case 39: // right
deltaX = 30; if (e.metaKey) {
deltaX = i.contentWidth;
} else if (e.altKey) {
deltaX = i.containerWidth;
} else {
deltaX = 30;
}
break; break;
case 40: // down case 40: // down
deltaY = -30; if (e.metaKey) {
deltaY = -i.contentHeight;
} else if (e.altKey) {
deltaY = -i.containerHeight;
} else {
deltaY = -30;
}
break; break;
case 33: // page up case 33: // page up
deltaY = 90; deltaY = 90;
@ -707,9 +705,9 @@ module.exports = function (element) {
},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],13:[function(require,module,exports){ },{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],13:[function(require,module,exports){
'use strict'; 'use strict';
var instances = require('../instances') var instances = require('../instances');
, updateGeometry = require('../update-geometry') var updateGeometry = require('../update-geometry');
, updateScroll = require('../update-scroll'); var updateScroll = require('../update-scroll');
function bindMouseWheelHandler(element, i) { function bindMouseWheelHandler(element, i) {
var shouldPrevent = false; var shouldPrevent = false;
@ -759,23 +757,30 @@ function bindMouseWheelHandler(element, i) {
deltaY = e.wheelDelta; deltaY = e.wheelDelta;
} }
if (e.shiftKey) {
// reverse axis with shift key
return [-deltaY, -deltaX];
}
return [deltaX, deltaY]; return [deltaX, deltaY];
} }
function shouldBeConsumedByTextarea(deltaX, deltaY) { function shouldBeConsumedByChild(deltaX, deltaY) {
var hoveredTextarea = element.querySelector('textarea:hover'); var child = element.querySelector('textarea:hover, select[multiple]:hover, .ps-child:hover');
if (hoveredTextarea) { if (child) {
var maxScrollTop = hoveredTextarea.scrollHeight - hoveredTextarea.clientHeight; if (!window.getComputedStyle(child).overflow.match(/(scroll|auto)/)) {
// if not scrollable
return false;
}
var maxScrollTop = child.scrollHeight - child.clientHeight;
if (maxScrollTop > 0) { if (maxScrollTop > 0) {
if (!(hoveredTextarea.scrollTop === 0 && deltaY > 0) && if (!(child.scrollTop === 0 && deltaY > 0) && !(child.scrollTop === maxScrollTop && deltaY < 0)) {
!(hoveredTextarea.scrollTop === maxScrollTop && deltaY < 0)) {
return true; return true;
} }
} }
var maxScrollLeft = hoveredTextarea.scrollLeft - hoveredTextarea.clientWidth; var maxScrollLeft = child.scrollLeft - child.clientWidth;
if (maxScrollLeft > 0) { if (maxScrollLeft > 0) {
if (!(hoveredTextarea.scrollLeft === 0 && deltaX < 0) && if (!(child.scrollLeft === 0 && deltaX < 0) && !(child.scrollLeft === maxScrollLeft && deltaX > 0)) {
!(hoveredTextarea.scrollLeft === maxScrollLeft && deltaX > 0)) {
return true; return true;
} }
} }
@ -789,7 +794,7 @@ function bindMouseWheelHandler(element, i) {
var deltaX = delta[0]; var deltaX = delta[0];
var deltaY = delta[1]; var deltaY = delta[1];
if (shouldBeConsumedByTextarea(deltaX, deltaY)) { if (shouldBeConsumedByChild(deltaX, deltaY)) {
return; return;
} }
@ -843,8 +848,8 @@ module.exports = function (element) {
},{"../instances":18,"../update-geometry":19,"../update-scroll":20}],14:[function(require,module,exports){ },{"../instances":18,"../update-geometry":19,"../update-scroll":20}],14:[function(require,module,exports){
'use strict'; 'use strict';
var instances = require('../instances') var instances = require('../instances');
, updateGeometry = require('../update-geometry'); var updateGeometry = require('../update-geometry');
function bindNativeScrollHandler(element, i) { function bindNativeScrollHandler(element, i) {
i.event.bind(element, 'scroll', function () { i.event.bind(element, 'scroll', function () {
@ -860,10 +865,10 @@ module.exports = function (element) {
},{"../instances":18,"../update-geometry":19}],15:[function(require,module,exports){ },{"../instances":18,"../update-geometry":19}],15:[function(require,module,exports){
'use strict'; 'use strict';
var h = require('../../lib/helper') var _ = require('../../lib/helper');
, instances = require('../instances') var instances = require('../instances');
, updateGeometry = require('../update-geometry') var updateGeometry = require('../update-geometry');
, updateScroll = require('../update-scroll'); var updateScroll = require('../update-scroll');
function bindSelectionHandler(element, i) { function bindSelectionHandler(element, i) {
function getRangeNode() { function getRangeNode() {
@ -897,7 +902,7 @@ function bindSelectionHandler(element, i) {
clearInterval(scrollingLoop); clearInterval(scrollingLoop);
scrollingLoop = null; scrollingLoop = null;
} }
h.stopScrolling(element); _.stopScrolling(element);
} }
var isSelected = false; var isSelected = false;
@ -915,6 +920,12 @@ function bindSelectionHandler(element, i) {
stopScrolling(); stopScrolling();
} }
}); });
i.event.bind(window, 'keyup', function () {
if (isSelected) {
isSelected = false;
stopScrolling();
}
});
i.event.bind(window, 'mousemove', function (e) { i.event.bind(window, 'mousemove', function (e) {
if (isSelected) { if (isSelected) {
@ -928,10 +939,10 @@ function bindSelectionHandler(element, i) {
if (mousePosition.x < containerGeometry.left + 3) { if (mousePosition.x < containerGeometry.left + 3) {
scrollDiff.left = -5; scrollDiff.left = -5;
h.startScrolling(element, 'x'); _.startScrolling(element, 'x');
} else if (mousePosition.x > containerGeometry.right - 3) { } else if (mousePosition.x > containerGeometry.right - 3) {
scrollDiff.left = 5; scrollDiff.left = 5;
h.startScrolling(element, 'x'); _.startScrolling(element, 'x');
} else { } else {
scrollDiff.left = 0; scrollDiff.left = 0;
} }
@ -942,14 +953,14 @@ function bindSelectionHandler(element, i) {
} else { } else {
scrollDiff.top = -20; scrollDiff.top = -20;
} }
h.startScrolling(element, 'y'); _.startScrolling(element, 'y');
} else if (mousePosition.y > containerGeometry.bottom - 3) { } else if (mousePosition.y > containerGeometry.bottom - 3) {
if (mousePosition.y - containerGeometry.bottom + 3 < 5) { if (mousePosition.y - containerGeometry.bottom + 3 < 5) {
scrollDiff.top = 5; scrollDiff.top = 5;
} else { } else {
scrollDiff.top = 20; scrollDiff.top = 20;
} }
h.startScrolling(element, 'y'); _.startScrolling(element, 'y');
} else { } else {
scrollDiff.top = 0; scrollDiff.top = 0;
} }
@ -971,9 +982,10 @@ module.exports = function (element) {
},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],16:[function(require,module,exports){ },{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],16:[function(require,module,exports){
'use strict'; 'use strict';
var instances = require('../instances') var _ = require('../../lib/helper');
, updateGeometry = require('../update-geometry') var instances = require('../instances');
, updateScroll = require('../update-scroll'); var updateGeometry = require('../update-geometry');
var updateScroll = require('../update-scroll');
function bindTouchHandler(element, i, supportsTouch, supportsIePointer) { function bindTouchHandler(element, i, supportsTouch, supportsIePointer) {
function shouldPreventDefault(deltaX, deltaY) { function shouldPreventDefault(deltaX, deltaY) {
@ -1058,6 +1070,9 @@ function bindTouchHandler(element, i, supportsTouch, supportsIePointer) {
} }
} }
function touchMove(e) { function touchMove(e) {
if (!inLocalTouch && i.settings.swipePropagation) {
touchStart(e);
}
if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) { if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) {
var touch = getTouch(e); var touch = getTouch(e);
@ -1095,6 +1110,11 @@ function bindTouchHandler(element, i, supportsTouch, supportsIePointer) {
return; return;
} }
if (!speed.x && !speed.y) {
clearInterval(easingLoop);
return;
}
if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) { if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
clearInterval(easingLoop); clearInterval(easingLoop);
return; return;
@ -1133,27 +1153,33 @@ function bindTouchHandler(element, i, supportsTouch, supportsIePointer) {
} }
} }
module.exports = function (element, supportsTouch, supportsIePointer) { module.exports = function (element) {
if (!_.env.supportsTouch && !_.env.supportsIePointer) {
return;
}
var i = instances.get(element); var i = instances.get(element);
bindTouchHandler(element, i, supportsTouch, supportsIePointer); bindTouchHandler(element, i, _.env.supportsTouch, _.env.supportsIePointer);
}; };
},{"../instances":18,"../update-geometry":19,"../update-scroll":20}],17:[function(require,module,exports){ },{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],17:[function(require,module,exports){
'use strict'; 'use strict';
var cls = require('../lib/class') var _ = require('../lib/helper');
, h = require('../lib/helper') var cls = require('../lib/class');
, instances = require('./instances') var instances = require('./instances');
, updateGeometry = require('./update-geometry'); var updateGeometry = require('./update-geometry');
// Handlers // Handlers
var clickRailHandler = require('./handler/click-rail') var handlers = {
, dragScrollbarHandler = require('./handler/drag-scrollbar') 'click-rail': require('./handler/click-rail'),
, keyboardHandler = require('./handler/keyboard') 'drag-scrollbar': require('./handler/drag-scrollbar'),
, mouseWheelHandler = require('./handler/mouse-wheel') 'keyboard': require('./handler/keyboard'),
, nativeScrollHandler = require('./handler/native-scroll') 'wheel': require('./handler/mouse-wheel'),
, selectionHandler = require('./handler/selection') 'touch': require('./handler/touch'),
, touchHandler = require('./handler/touch'); 'selection': require('./handler/selection')
};
var nativeScrollHandler = require('./handler/native-scroll');
module.exports = function (element, userSettings) { module.exports = function (element, userSettings) {
userSettings = typeof userSettings === 'object' ? userSettings : {}; userSettings = typeof userSettings === 'object' ? userSettings : {};
@ -1163,50 +1189,40 @@ module.exports = function (element, userSettings) {
// Create a plugin instance. // Create a plugin instance.
var i = instances.add(element); var i = instances.add(element);
i.settings = h.extend(i.settings, userSettings); i.settings = _.extend(i.settings, userSettings);
cls.add(element, 'ps-theme-' + i.settings.theme); cls.add(element, 'ps-theme-' + i.settings.theme);
clickRailHandler(element); i.settings.handlers.forEach(function (handlerName) {
dragScrollbarHandler(element); handlers[handlerName](element);
mouseWheelHandler(element); });
nativeScrollHandler(element); nativeScrollHandler(element);
if (i.settings.useSelectionScroll) {
selectionHandler(element);
}
if (h.env.supportsTouch || h.env.supportsIePointer) {
touchHandler(element, h.env.supportsTouch, h.env.supportsIePointer);
}
if (i.settings.useKeyboard) {
keyboardHandler(element);
}
updateGeometry(element); updateGeometry(element);
}; };
},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(require,module,exports){ },{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(require,module,exports){
'use strict'; 'use strict';
var cls = require('../lib/class') var _ = require('../lib/helper');
, d = require('../lib/dom') var cls = require('../lib/class');
, defaultSettings = require('./default-setting') var defaultSettings = require('./default-setting');
, EventManager = require('../lib/event-manager') var dom = require('../lib/dom');
, guid = require('../lib/guid') var EventManager = require('../lib/event-manager');
, h = require('../lib/helper'); var guid = require('../lib/guid');
var instances = {}; var instances = {};
function Instance(element) { function Instance(element) {
var i = this; var i = this;
i.settings = h.clone(defaultSettings); i.settings = _.clone(defaultSettings);
i.containerWidth = null; i.containerWidth = null;
i.containerHeight = null; i.containerHeight = null;
i.contentWidth = null; i.contentWidth = null;
i.contentHeight = null; i.contentHeight = null;
i.isRtl = d.css(element, 'direction') === "rtl"; i.isRtl = dom.css(element, 'direction') === "rtl";
i.isNegativeScroll = (function () { i.isNegativeScroll = (function () {
var originalScrollLeft = element.scrollLeft; var originalScrollLeft = element.scrollLeft;
var result = null; var result = null;
@ -1227,67 +1243,55 @@ function Instance(element) {
cls.remove(element, 'ps-focus'); cls.remove(element, 'ps-focus');
} }
i.scrollbarXRail = d.appendTo(d.e('div', 'ps-scrollbar-x-rail'), element); i.scrollbarXRail = dom.appendTo(dom.e('div', 'ps-scrollbar-x-rail'), element);
i.scrollbarX = d.appendTo(d.e('div', 'ps-scrollbar-x'), i.scrollbarXRail); i.scrollbarX = dom.appendTo(dom.e('div', 'ps-scrollbar-x'), i.scrollbarXRail);
i.scrollbarX.setAttribute('tabindex', 0); i.scrollbarX.setAttribute('tabindex', 0);
i.event.bind(i.scrollbarX, 'focus', focus); i.event.bind(i.scrollbarX, 'focus', focus);
i.event.bind(i.scrollbarX, 'blur', blur); i.event.bind(i.scrollbarX, 'blur', blur);
i.scrollbarXActive = null; i.scrollbarXActive = null;
i.scrollbarXWidth = null; i.scrollbarXWidth = null;
i.scrollbarXLeft = null; i.scrollbarXLeft = null;
i.scrollbarXBottom = h.toInt(d.css(i.scrollbarXRail, 'bottom')); i.scrollbarXBottom = _.toInt(dom.css(i.scrollbarXRail, 'bottom'));
i.isScrollbarXUsingBottom = i.scrollbarXBottom === i.scrollbarXBottom; // !isNaN i.isScrollbarXUsingBottom = i.scrollbarXBottom === i.scrollbarXBottom; // !isNaN
i.scrollbarXTop = i.isScrollbarXUsingBottom ? null : h.toInt(d.css(i.scrollbarXRail, 'top')); i.scrollbarXTop = i.isScrollbarXUsingBottom ? null : _.toInt(dom.css(i.scrollbarXRail, 'top'));
i.railBorderXWidth = h.toInt(d.css(i.scrollbarXRail, 'borderLeftWidth')) + h.toInt(d.css(i.scrollbarXRail, 'borderRightWidth')); i.railBorderXWidth = _.toInt(dom.css(i.scrollbarXRail, 'borderLeftWidth')) + _.toInt(dom.css(i.scrollbarXRail, 'borderRightWidth'));
// Set rail to display:block to calculate margins // Set rail to display:block to calculate margins
d.css(i.scrollbarXRail, 'display', 'block'); dom.css(i.scrollbarXRail, 'display', 'block');
i.railXMarginWidth = h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight')); i.railXMarginWidth = _.toInt(dom.css(i.scrollbarXRail, 'marginLeft')) + _.toInt(dom.css(i.scrollbarXRail, 'marginRight'));
d.css(i.scrollbarXRail, 'display', ''); dom.css(i.scrollbarXRail, 'display', '');
i.railXWidth = null; i.railXWidth = null;
i.railXRatio = null; i.railXRatio = null;
i.scrollbarYRail = d.appendTo(d.e('div', 'ps-scrollbar-y-rail'), element); i.scrollbarYRail = dom.appendTo(dom.e('div', 'ps-scrollbar-y-rail'), element);
i.scrollbarY = d.appendTo(d.e('div', 'ps-scrollbar-y'), i.scrollbarYRail); i.scrollbarY = dom.appendTo(dom.e('div', 'ps-scrollbar-y'), i.scrollbarYRail);
i.scrollbarY.setAttribute('tabindex', 0); i.scrollbarY.setAttribute('tabindex', 0);
i.event.bind(i.scrollbarY, 'focus', focus); i.event.bind(i.scrollbarY, 'focus', focus);
i.event.bind(i.scrollbarY, 'blur', blur); i.event.bind(i.scrollbarY, 'blur', blur);
i.scrollbarYActive = null; i.scrollbarYActive = null;
i.scrollbarYHeight = null; i.scrollbarYHeight = null;
i.scrollbarYTop = null; i.scrollbarYTop = null;
i.scrollbarYRight = h.toInt(d.css(i.scrollbarYRail, 'right')); i.scrollbarYRight = _.toInt(dom.css(i.scrollbarYRail, 'right'));
i.isScrollbarYUsingRight = i.scrollbarYRight === i.scrollbarYRight; // !isNaN i.isScrollbarYUsingRight = i.scrollbarYRight === i.scrollbarYRight; // !isNaN
i.scrollbarYLeft = i.isScrollbarYUsingRight ? null : h.toInt(d.css(i.scrollbarYRail, 'left')); i.scrollbarYLeft = i.isScrollbarYUsingRight ? null : _.toInt(dom.css(i.scrollbarYRail, 'left'));
i.scrollbarYOuterWidth = i.isRtl ? h.outerWidth(i.scrollbarY) : null; i.scrollbarYOuterWidth = i.isRtl ? _.outerWidth(i.scrollbarY) : null;
i.railBorderYWidth = h.toInt(d.css(i.scrollbarYRail, 'borderTopWidth')) + h.toInt(d.css(i.scrollbarYRail, 'borderBottomWidth')); i.railBorderYWidth = _.toInt(dom.css(i.scrollbarYRail, 'borderTopWidth')) + _.toInt(dom.css(i.scrollbarYRail, 'borderBottomWidth'));
d.css(i.scrollbarYRail, 'display', 'block'); dom.css(i.scrollbarYRail, 'display', 'block');
i.railYMarginHeight = h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom')); i.railYMarginHeight = _.toInt(dom.css(i.scrollbarYRail, 'marginTop')) + _.toInt(dom.css(i.scrollbarYRail, 'marginBottom'));
d.css(i.scrollbarYRail, 'display', ''); dom.css(i.scrollbarYRail, 'display', '');
i.railYHeight = null; i.railYHeight = null;
i.railYRatio = null; i.railYRatio = null;
} }
function getId(element) { function getId(element) {
if (typeof element.dataset === 'undefined') { return element.getAttribute('data-ps-id');
return element.getAttribute('data-ps-id');
} else {
return element.dataset.psId;
}
} }
function setId(element, id) { function setId(element, id) {
if (typeof element.dataset === 'undefined') { element.setAttribute('data-ps-id', id);
element.setAttribute('data-ps-id', id);
} else {
element.dataset.psId = id;
}
} }
function removeId(element) { function removeId(element) {
if (typeof element.dataset === 'undefined') { element.removeAttribute('data-ps-id');
element.removeAttribute('data-ps-id');
} else {
delete element.dataset.psId;
}
} }
exports.add = function (element) { exports.add = function (element) {
@ -1309,11 +1313,11 @@ exports.get = function (element) {
},{"../lib/class":2,"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){ },{"../lib/class":2,"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){
'use strict'; 'use strict';
var cls = require('../lib/class') var _ = require('../lib/helper');
, d = require('../lib/dom') var cls = require('../lib/class');
, h = require('../lib/helper') var dom = require('../lib/dom');
, instances = require('./instances') var instances = require('./instances');
, updateScroll = require('./update-scroll'); var updateScroll = require('./update-scroll');
function getThumbSize(i, thumbSize) { function getThumbSize(i, thumbSize) {
if (i.settings.minScrollbarLength) { if (i.settings.minScrollbarLength) {
@ -1337,7 +1341,7 @@ function updateCss(element, i) {
} else { } else {
xRailOffset.top = i.scrollbarXTop + element.scrollTop; xRailOffset.top = i.scrollbarXTop + element.scrollTop;
} }
d.css(i.scrollbarXRail, xRailOffset); dom.css(i.scrollbarXRail, xRailOffset);
var yRailOffset = {top: element.scrollTop, height: i.railYHeight}; var yRailOffset = {top: element.scrollTop, height: i.railYHeight};
if (i.isScrollbarYUsingRight) { if (i.isScrollbarYUsingRight) {
@ -1353,10 +1357,10 @@ function updateCss(element, i) {
yRailOffset.left = i.scrollbarYLeft + element.scrollLeft; yRailOffset.left = i.scrollbarYLeft + element.scrollLeft;
} }
} }
d.css(i.scrollbarYRail, yRailOffset); dom.css(i.scrollbarYRail, yRailOffset);
d.css(i.scrollbarX, {left: i.scrollbarXLeft, width: i.scrollbarXWidth - i.railBorderXWidth}); dom.css(i.scrollbarX, {left: i.scrollbarXLeft, width: i.scrollbarXWidth - i.railBorderXWidth});
d.css(i.scrollbarY, {top: i.scrollbarYTop, height: i.scrollbarYHeight - i.railBorderYWidth}); dom.css(i.scrollbarY, {top: i.scrollbarYTop, height: i.scrollbarYHeight - i.railBorderYWidth});
} }
module.exports = function (element) { module.exports = function (element) {
@ -1369,30 +1373,30 @@ module.exports = function (element) {
var existingRails; var existingRails;
if (!element.contains(i.scrollbarXRail)) { if (!element.contains(i.scrollbarXRail)) {
existingRails = d.queryChildren(element, '.ps-scrollbar-x-rail'); existingRails = dom.queryChildren(element, '.ps-scrollbar-x-rail');
if (existingRails.length > 0) { if (existingRails.length > 0) {
existingRails.forEach(function (rail) { existingRails.forEach(function (rail) {
d.remove(rail); dom.remove(rail);
}); });
} }
d.appendTo(i.scrollbarXRail, element); dom.appendTo(i.scrollbarXRail, element);
} }
if (!element.contains(i.scrollbarYRail)) { if (!element.contains(i.scrollbarYRail)) {
existingRails = d.queryChildren(element, '.ps-scrollbar-y-rail'); existingRails = dom.queryChildren(element, '.ps-scrollbar-y-rail');
if (existingRails.length > 0) { if (existingRails.length > 0) {
existingRails.forEach(function (rail) { existingRails.forEach(function (rail) {
d.remove(rail); dom.remove(rail);
}); });
} }
d.appendTo(i.scrollbarYRail, element); dom.appendTo(i.scrollbarYRail, element);
} }
if (!i.settings.suppressScrollX && i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth) { if (!i.settings.suppressScrollX && i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth) {
i.scrollbarXActive = true; i.scrollbarXActive = true;
i.railXWidth = i.containerWidth - i.railXMarginWidth; i.railXWidth = i.containerWidth - i.railXMarginWidth;
i.railXRatio = i.containerWidth / i.railXWidth; i.railXRatio = i.containerWidth / i.railXWidth;
i.scrollbarXWidth = getThumbSize(i, h.toInt(i.railXWidth * i.containerWidth / i.contentWidth)); i.scrollbarXWidth = getThumbSize(i, _.toInt(i.railXWidth * i.containerWidth / i.contentWidth));
i.scrollbarXLeft = h.toInt((i.negativeScrollAdjustment + element.scrollLeft) * (i.railXWidth - i.scrollbarXWidth) / (i.contentWidth - i.containerWidth)); i.scrollbarXLeft = _.toInt((i.negativeScrollAdjustment + element.scrollLeft) * (i.railXWidth - i.scrollbarXWidth) / (i.contentWidth - i.containerWidth));
} else { } else {
i.scrollbarXActive = false; i.scrollbarXActive = false;
} }
@ -1401,8 +1405,8 @@ module.exports = function (element) {
i.scrollbarYActive = true; i.scrollbarYActive = true;
i.railYHeight = i.containerHeight - i.railYMarginHeight; i.railYHeight = i.containerHeight - i.railYMarginHeight;
i.railYRatio = i.containerHeight / i.railYHeight; i.railYRatio = i.containerHeight / i.railYHeight;
i.scrollbarYHeight = getThumbSize(i, h.toInt(i.railYHeight * i.containerHeight / i.contentHeight)); i.scrollbarYHeight = getThumbSize(i, _.toInt(i.railYHeight * i.containerHeight / i.contentHeight));
i.scrollbarYTop = h.toInt(element.scrollTop * (i.railYHeight - i.scrollbarYHeight) / (i.contentHeight - i.containerHeight)); i.scrollbarYTop = _.toInt(element.scrollTop * (i.railYHeight - i.scrollbarYHeight) / (i.contentHeight - i.containerHeight));
} else { } else {
i.scrollbarYActive = false; i.scrollbarYActive = false;
} }
@ -1439,29 +1443,14 @@ module.exports = function (element) {
var instances = require('./instances'); var instances = require('./instances');
var upEvent = document.createEvent('Event') var lastTop;
, downEvent = document.createEvent('Event') var lastLeft;
, leftEvent = document.createEvent('Event')
, rightEvent = document.createEvent('Event')
, yEvent = document.createEvent('Event')
, xEvent = document.createEvent('Event')
, xStartEvent = document.createEvent('Event')
, xEndEvent = document.createEvent('Event')
, yStartEvent = document.createEvent('Event')
, yEndEvent = document.createEvent('Event')
, lastTop
, lastLeft;
upEvent.initEvent('ps-scroll-up', true, true); var createDOMEvent = function (name) {
downEvent.initEvent('ps-scroll-down', true, true); var event = document.createEvent("Event");
leftEvent.initEvent('ps-scroll-left', true, true); event.initEvent(name, true, true);
rightEvent.initEvent('ps-scroll-right', true, true); return event;
yEvent.initEvent('ps-scroll-y', true, true); };
xEvent.initEvent('ps-scroll-x', true, true);
xStartEvent.initEvent('ps-x-reach-start', true, true);
xEndEvent.initEvent('ps-x-reach-end', true, true);
yStartEvent.initEvent('ps-y-reach-start', true, true);
yEndEvent.initEvent('ps-y-reach-end', true, true);
module.exports = function (element, axis, value) { module.exports = function (element, axis, value) {
if (typeof element === 'undefined') { if (typeof element === 'undefined') {
@ -1478,24 +1467,38 @@ module.exports = function (element, axis, value) {
if (axis === 'top' && value <= 0) { if (axis === 'top' && value <= 0) {
element.scrollTop = value = 0; // don't allow negative scroll element.scrollTop = value = 0; // don't allow negative scroll
element.dispatchEvent(yStartEvent); element.dispatchEvent(createDOMEvent('ps-y-reach-start'));
} }
if (axis === 'left' && value <= 0) { if (axis === 'left' && value <= 0) {
element.scrollLeft = value = 0; // don't allow negative scroll element.scrollLeft = value = 0; // don't allow negative scroll
element.dispatchEvent(xStartEvent); element.dispatchEvent(createDOMEvent('ps-x-reach-start'));
} }
var i = instances.get(element); var i = instances.get(element);
if (axis === 'top' && value >= i.contentHeight - i.containerHeight) { if (axis === 'top' && value >= i.contentHeight - i.containerHeight) {
element.scrollTop = value = i.contentHeight - i.containerHeight; // don't allow scroll past container // don't allow scroll past container
element.dispatchEvent(yEndEvent); value = i.contentHeight - i.containerHeight;
if (value - element.scrollTop <= 1) {
// mitigates rounding errors on non-subpixel scroll values
value = element.scrollTop;
} else {
element.scrollTop = value;
}
element.dispatchEvent(createDOMEvent('ps-y-reach-end'));
} }
if (axis === 'left' && value >= i.contentWidth - i.containerWidth) { if (axis === 'left' && value >= i.contentWidth - i.containerWidth) {
element.scrollLeft = value = i.contentWidth - i.containerWidth; // don't allow scroll past container // don't allow scroll past container
element.dispatchEvent(xEndEvent); value = i.contentWidth - i.containerWidth;
if (value - element.scrollLeft <= 1) {
// mitigates rounding errors on non-subpixel scroll values
value = element.scrollLeft;
} else {
element.scrollLeft = value;
}
element.dispatchEvent(createDOMEvent('ps-x-reach-end'));
} }
if (!lastTop) { if (!lastTop) {
@ -1507,29 +1510,29 @@ module.exports = function (element, axis, value) {
} }
if (axis === 'top' && value < lastTop) { if (axis === 'top' && value < lastTop) {
element.dispatchEvent(upEvent); element.dispatchEvent(createDOMEvent('ps-scroll-up'));
} }
if (axis === 'top' && value > lastTop) { if (axis === 'top' && value > lastTop) {
element.dispatchEvent(downEvent); element.dispatchEvent(createDOMEvent('ps-scroll-down'));
} }
if (axis === 'left' && value < lastLeft) { if (axis === 'left' && value < lastLeft) {
element.dispatchEvent(leftEvent); element.dispatchEvent(createDOMEvent('ps-scroll-left'));
} }
if (axis === 'left' && value > lastLeft) { if (axis === 'left' && value > lastLeft) {
element.dispatchEvent(rightEvent); element.dispatchEvent(createDOMEvent('ps-scroll-right'));
} }
if (axis === 'top') { if (axis === 'top') {
element.scrollTop = lastTop = value; element.scrollTop = lastTop = value;
element.dispatchEvent(yEvent); element.dispatchEvent(createDOMEvent('ps-scroll-y'));
} }
if (axis === 'left') { if (axis === 'left') {
element.scrollLeft = lastLeft = value; element.scrollLeft = lastLeft = value;
element.dispatchEvent(xEvent); element.dispatchEvent(createDOMEvent('ps-scroll-x'));
} }
}; };
@ -1537,11 +1540,11 @@ module.exports = function (element, axis, value) {
},{"./instances":18}],21:[function(require,module,exports){ },{"./instances":18}],21:[function(require,module,exports){
'use strict'; 'use strict';
var d = require('../lib/dom') var _ = require('../lib/helper');
, h = require('../lib/helper') var dom = require('../lib/dom');
, instances = require('./instances') var instances = require('./instances');
, updateGeometry = require('./update-geometry') var updateGeometry = require('./update-geometry');
, updateScroll = require('./update-scroll'); var updateScroll = require('./update-scroll');
module.exports = function (element) { module.exports = function (element) {
var i = instances.get(element); var i = instances.get(element);
@ -1554,14 +1557,14 @@ module.exports = function (element) {
i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0; i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0;
// Recalculate rail margins // Recalculate rail margins
d.css(i.scrollbarXRail, 'display', 'block'); dom.css(i.scrollbarXRail, 'display', 'block');
d.css(i.scrollbarYRail, 'display', 'block'); dom.css(i.scrollbarYRail, 'display', 'block');
i.railXMarginWidth = h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight')); i.railXMarginWidth = _.toInt(dom.css(i.scrollbarXRail, 'marginLeft')) + _.toInt(dom.css(i.scrollbarXRail, 'marginRight'));
i.railYMarginHeight = h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom')); i.railYMarginHeight = _.toInt(dom.css(i.scrollbarYRail, 'marginTop')) + _.toInt(dom.css(i.scrollbarYRail, 'marginBottom'));
// Hide scrollbars not to affect scrollWidth and scrollHeight // Hide scrollbars not to affect scrollWidth and scrollHeight
d.css(i.scrollbarXRail, 'display', 'none'); dom.css(i.scrollbarXRail, 'display', 'none');
d.css(i.scrollbarYRail, 'display', 'none'); dom.css(i.scrollbarYRail, 'display', 'none');
updateGeometry(element); updateGeometry(element);
@ -1569,8 +1572,8 @@ module.exports = function (element) {
updateScroll(element, 'top', element.scrollTop); updateScroll(element, 'top', element.scrollTop);
updateScroll(element, 'left', element.scrollLeft); updateScroll(element, 'left', element.scrollLeft);
d.css(i.scrollbarXRail, 'display', ''); dom.css(i.scrollbarXRail, 'display', '');
d.css(i.scrollbarYRail, 'display', ''); dom.css(i.scrollbarYRail, 'display', '');
}; };
},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19,"./update-scroll":20}]},{},[1]); },{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19,"./update-scroll":20}]},{},[1]);

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/* perfect-scrollbar v0.6.10 */ /* perfect-scrollbar v0.6.15 */
.ps-container{-ms-touch-action:none;touch-action:none;overflow:hidden !important;-ms-overflow-style:none}@supports (-ms-overflow-style: none){.ps-container{overflow:auto !important}}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){.ps-container{overflow:auto !important}}.ps-container.ps-active-x>.ps-scrollbar-x-rail,.ps-container.ps-active-y>.ps-scrollbar-y-rail{display:block;background-color:transparent}.ps-container.ps-in-scrolling{pointer-events:none}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:0.9}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:0.9}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999}.ps-container>.ps-scrollbar-x-rail{display:none;position:absolute;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;bottom:3px;height:8px}.ps-container>.ps-scrollbar-x-rail>.ps-scrollbar-x{position:absolute;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-transition:background-color .2s linear;-moz-transition:background-color .2s linear;-o-transition:background-color .2s linear;transition:background-color .2s linear;bottom:0;height:8px}.ps-container>.ps-scrollbar-y-rail{display:none;position:absolute;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;right:3px;width:8px}.ps-container>.ps-scrollbar-y-rail>.ps-scrollbar-y{position:absolute;background-color:#aaa;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-transition:background-color .2s linear;-moz-transition:background-color .2s linear;-o-transition:background-color .2s linear;transition:background-color .2s linear;right:0;width:8px}.ps-container:hover.ps-in-scrolling{pointer-events:none}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:0.9}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:0.9}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999}.ps-container:hover>.ps-scrollbar-x-rail,.ps-container:hover>.ps-scrollbar-y-rail{opacity:0.6}.ps-container:hover>.ps-scrollbar-x-rail:hover{background-color:#eee;opacity:0.9}.ps-container:hover>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x{background-color:#999}.ps-container:hover>.ps-scrollbar-y-rail:hover{background-color:#eee;opacity:0.9}.ps-container:hover>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y{background-color:#999} .ps-container{-ms-touch-action:auto;touch-action:auto;overflow:hidden !important;-ms-overflow-style:none}@supports (-ms-overflow-style: none){.ps-container{overflow:auto !important}}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){.ps-container{overflow:auto !important}}.ps-container.ps-active-x>.ps-scrollbar-x-rail,.ps-container.ps-active-y>.ps-scrollbar-y-rail{display:block;background-color:transparent}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:.9}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999;height:11px}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:.9}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999;width:11px}.ps-container>.ps-scrollbar-x-rail{display:none;position:absolute;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;bottom:0px;height:15px}.ps-container>.ps-scrollbar-x-rail>.ps-scrollbar-x{position:absolute;background-color:#aaa;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;-o-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;-moz-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;bottom:2px;height:6px}.ps-container>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x,.ps-container>.ps-scrollbar-x-rail:active>.ps-scrollbar-x{height:11px}.ps-container>.ps-scrollbar-y-rail{display:none;position:absolute;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;right:0;width:15px}.ps-container>.ps-scrollbar-y-rail>.ps-scrollbar-y{position:absolute;background-color:#aaa;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;-o-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;-moz-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;right:2px;width:6px}.ps-container>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y,.ps-container>.ps-scrollbar-y-rail:active>.ps-scrollbar-y{width:11px}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:.9}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999;height:11px}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:.9}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999;width:11px}.ps-container:hover>.ps-scrollbar-x-rail,.ps-container:hover>.ps-scrollbar-y-rail{opacity:.6}.ps-container:hover>.ps-scrollbar-x-rail:hover{background-color:#eee;opacity:.9}.ps-container:hover>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x{background-color:#999}.ps-container:hover>.ps-scrollbar-y-rail:hover{background-color:#eee;opacity:.9}.ps-container:hover>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y{background-color:#999}

View File

@ -285,14 +285,14 @@ function admin_page_federation(App &$a) {
// get a total count for the platform, the name and version of the // get a total count for the platform, the name and version of the
// highest version and the protocol tpe // highest version and the protocol tpe
$c = qu('SELECT COUNT(*) AS `total`, `platform`, `network`, `version` FROM `gserver` $c = qu('SELECT COUNT(*) AS `total`, `platform`, `network`, `version` FROM `gserver`
WHERE `platform` LIKE "%s" AND `last_contact` > `last_failure` WHERE `platform` LIKE "%s" AND `last_contact` >= `last_failure`
ORDER BY `version` ASC;', $p); ORDER BY `version` ASC;', $p);
$total = $total + $c[0]['total']; $total = $total + $c[0]['total'];
// what versions for that platform do we know at all? // what versions for that platform do we know at all?
// again only the active nodes // again only the active nodes
$v = qu('SELECT COUNT(*) AS `total`, `version` FROM `gserver` $v = qu('SELECT COUNT(*) AS `total`, `version` FROM `gserver`
WHERE `last_contact` > `last_failure` AND `platform` LIKE "%s" WHERE `last_contact` >= `last_failure` AND `platform` LIKE "%s"
GROUP BY `version` GROUP BY `version`
ORDER BY `version`;', $p); ORDER BY `version`;', $p);

View File

@ -208,6 +208,9 @@ function photos_post(App &$a) {
dbesc($album), dbesc($album),
intval($page_owner_uid) intval($page_owner_uid)
); );
// Update the photo albums cache
photo_albums($page_owner_uid, true);
$newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']); $newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']);
goaway($newurl); goaway($newurl);
return; // NOTREACHED return; // NOTREACHED
@ -294,7 +297,11 @@ function photos_post(App &$a) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id); proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
} }
} }
// Update the photo albums cache
photo_albums($page_owner_uid, true);
} }
goaway('photos/' . $a->data['user']['nickname']); goaway('photos/' . $a->data['user']['nickname']);
return; // NOTREACHED return; // NOTREACHED
} }
@ -359,6 +366,9 @@ function photos_post(App &$a) {
$url = App::get_baseurl(); $url = App::get_baseurl();
$drop_id = intval($i[0]['id']); $drop_id = intval($i[0]['id']);
// Update the photo albums cache
photo_albums($page_owner_uid, true);
if ($i[0]['visible']) if ($i[0]['visible'])
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id); proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
} }
@ -370,10 +380,11 @@ function photos_post(App &$a) {
if (($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { if (($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : ''); $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0); $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
$albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : ''); $albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
$origaname = ((x($_POST,'origaname')) ? notags(trim($_POST['origaname'])) : '');
$str_group_allow = perms2str($_POST['group_allow']); $str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']); $str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']); $str_group_deny = perms2str($_POST['group_deny']);
@ -457,6 +468,10 @@ function photos_post(App &$a) {
dbesc($resource_id), dbesc($resource_id),
intval($page_owner_uid) intval($page_owner_uid)
); );
// Update the photo albums cache if album name was changed
if ($albname !== $origaname) {
photo_albums($page_owner_uid, true);
}
} }
/* Don't make the item visible if the only change was the album name */ /* Don't make the item visible if the only change was the album name */
@ -913,6 +928,8 @@ function photos_post(App &$a) {
. '[/url]'; . '[/url]';
$item_id = item_store($arr); $item_id = item_store($arr);
// Update the photo albums cache
photo_albums($page_owner_uid, true);
if ($visible) if ($visible)
proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id); proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);

View File

@ -1,6 +1,6 @@
<?php <?php
define('UPDATE_VERSION' , 1209); define('UPDATE_VERSION' , 1210);
/** /**
* *

View File

@ -43,7 +43,7 @@
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script> <script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script> <script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script> <script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script> <script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script> <script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script> <script type="text/javascript" src="js/webtoolkit.base64.js" ></script>
<script type="text/javascript" src="js/main.js" ></script> <script type="text/javascript" src="js/main.js" ></script>

View File

@ -3,6 +3,7 @@
<form action="photos/{{$nickname}}/{{$resource_id}}" method="post" id="photo_edit_form" > <form action="photos/{{$nickname}}/{{$resource_id}}" method="post" id="photo_edit_form" >
<input type="hidden" name="item_id" value="{{$item_id}}" /> <input type="hidden" name="item_id" value="{{$item_id}}" />
<input type="hidden" name="origaname" value="{{$album.2}}" />
{{include file="field_input.tpl" field=$album}} {{include file="field_input.tpl" field=$album}}
{{include file="field_input.tpl" field=$caption}} {{include file="field_input.tpl" field=$caption}}

View File

@ -66,7 +66,7 @@
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script> <script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script> <script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script> <script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script> <script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script> <script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script> <script type="text/javascript" src="js/webtoolkit.base64.js" ></script>
<script type="text/javascript" src="js/main.js" ></script> <script type="text/javascript" src="js/main.js" ></script>