Rebuild prod assets.

This commit is contained in:
buddh4 2017-08-01 22:16:37 +02:00
parent 3f741da0a2
commit b81faca5df
55 changed files with 1504 additions and 41 deletions

View File

@ -2,7 +2,7 @@
/**
* This file is generated by the "yii asset" command.
* DO NOT MODIFY THIS FILE DIRECTLY.
* @version 2017-06-16 20:09:02
* @version 2017-08-01 22:12:58
*/
return [
'all' => [
@ -10,7 +10,7 @@ return [
'basePath' => '@webroot-static',
'baseUrl' => '@web-static',
'js' => [
'js/all-eccc32c92bade6b693dae47a4a655e11.js',
'js/all-41d42708f317e2a81704a75f50ab14e5.js',
],
'css' => [
'css/all-59bdfa4c0b50304180be32b3f5b0d157.css',
@ -352,6 +352,14 @@ return [
'all',
],
],
'humhub\\assets\\ImagesLoadedAsset' => [
'sourcePath' => null,
'js' => [],
'css' => [],
'depends' => [
'all',
],
],
'humhub\\assets\\AppAsset' => [
'sourcePath' => null,
'js' => [],
@ -388,6 +396,7 @@ return [
'humhub\\assets\\IEFixesAsset',
'humhub\\assets\\PagedownConverterAsset',
'humhub\\assets\\ClipboardJsAsset',
'humhub\\assets\\ImagesLoadedAsset',
'all',
],
],

View File

@ -54,6 +54,7 @@ HumHub Change Log
- Chg: Added `phpoffice/phpexcel` dependency
- Enh: Added `JsWidget::fadeIn` for smooth widget initialization
- Enh: Enhanced `AccessControl` filter with `ControllerAccess` layer for better testability and flexibility
- Enh: Added `Pending Registrations` admin view with `csv`, `xlsx` support.
1.2.1 (June 17, 2017)
- Fix: Invite error in french language

View File

@ -0,0 +1,3 @@
[29-Jul-2017 17:45:13 UTC] PHP Fatal error: Cannot declare class FunctionalTester, because the name is already in use in E:\codebase\humhub\master\protected\humhub\tests\codeception\_support\FunctionalTester.php on line 20
[29-Jul-2017 17:45:34 UTC] PHP Fatal error: Cannot declare class FunctionalTester, because the name is already in use in E:\codebase\humhub\master\protected\humhub\tests\codeception\_support\FunctionalTester.php on line 20
[29-Jul-2017 17:46:12 UTC] PHP Fatal error: Cannot redeclare user\functional\UserAccessCest::testSeeAdminInformation() in E:\codebase\humhub\master\protected\humhub\modules\user\tests\codeception\functional\UserAccessCest.php on line 32

View File

@ -12,6 +12,7 @@ humhub.module('file', function (module, require, $) {
var string = util.string;
var action = require('action');
var event = require('event');
var view = require('ui.view');
@ -51,6 +52,11 @@ humhub.module('file', function (module, require, $) {
objectModel: this.$.data('upload-model'),
objectId: this.$.data('upload-model-id')
};
if(this.$.data('upload-hide-in-stream')) {
data['hideInStream'] = 1;
}
return {
url: this.$.data('url') || this.$.data('upload-url') || module.config.upload.url,
dropZone: this.getDropZone(),
@ -60,7 +66,9 @@ humhub.module('file', function (module, require, $) {
singleFileUploads: false,
add: function (e, data) {
if (that.options.maxNumberOfFiles && (that.getFileCount() + data.files.length > that.options.maxNumberOfFiles)) {
that.handleMaxFileReached();
that.handleMaxFileReached(that.options.maxNumberOfFilesMessage);
} else if(that.options.phpMaxFileUploads && data.files.length > that.options.phpMaxFileUploads) {
that.handleMaxFileReached(that.options.phpMaxFileUploadsMessage);
} else {
data.process().done(function () {
data.submit();
@ -71,8 +79,8 @@ humhub.module('file', function (module, require, $) {
};
};
Upload.prototype.handleMaxFileReached = function () {
module.log.warn(this.$.data('max-number-of-files-message'), true);
Upload.prototype.handleMaxFileReached = function (message) {
module.log.warn(message, true);
this.$ = $(this.getIdSelector());
if (!this.canUploadMore()) {
this.disable(this.$.data('max-number-of-files-message'));
@ -225,7 +233,8 @@ humhub.module('file', function (module, require, $) {
this.callbacks.done(e, response);
}
this.fire('humhub:file:uploadEnd', [response]);
//deprecated event use uploadEnd
this.fire('humhub:file:uploadEnd', [response]);;
this.fire('uploadEnd', [response]);
};

View File

@ -0,0 +1,362 @@
# imagesLoaded
<p class="tagline">JavaScript is all like "You images done yet or what?"</p>
[imagesloaded.desandro.com](http://imagesloaded.desandro.com)
Detect when images have been loaded.
## Install
### Download
+ [imagesloaded.pkgd.min.js](https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js) minified
+ [imagesloaded.pkgd.js](https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.js) un-minified
### CDN
``` html
<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
<!-- or -->
<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.js"></script>
```
### Package managers
Install via [npm](https://www.npmjs.com/package/imagesloaded): `npm install imagesloaded`
Install via [Bower](http://bower.io): `bower install imagesloaded --save`
## jQuery
You can use imagesLoaded as a jQuery Plugin.
``` js
$('#container').imagesLoaded( function() {
// images have loaded
});
// options
$('#container').imagesLoaded( {
// options...
},
function() {
// images have loaded
}
);
```
`.imagesLoaded()` returns a [jQuery Deferred object](http://api.jquery.com/category/deferred-object/). This allows you to use `.always()`, `.done()`, `.fail()` and `.progress()`.
``` js
$('#container').imagesLoaded()
.always( function( instance ) {
console.log('all images loaded');
})
.done( function( instance ) {
console.log('all images successfully loaded');
})
.fail( function() {
console.log('all images loaded, at least one is broken');
})
.progress( function( instance, image ) {
var result = image.isLoaded ? 'loaded' : 'broken';
console.log( 'image is ' + result + ' for ' + image.img.src );
});
```
## Vanilla JavaScript
You can use imagesLoaded with vanilla JS.
``` js
imagesLoaded( elem, callback )
// options
imagesLoaded( elem, options, callback )
// you can use `new` if you like
new imagesLoaded( elem, callback )
```
+ `elem` _Element, NodeList, Array, or Selector String_
+ `options` _Object_
+ `callback` _Function_ - function triggered after all images have been loaded
Using a callback function is the same as binding it to the `always` event (see below).
``` js
// element
imagesLoaded( document.querySelector('#container'), function( instance ) {
console.log('all images are loaded');
});
// selector string
imagesLoaded( '#container', function() {...});
// multiple elements
var posts = document.querySelectorAll('.post');
imagesLoaded( posts, function() {...});
```
Bind events with vanilla JS with .on(), .off(), and .once() methods.
``` js
var imgLoad = imagesLoaded( elem );
function onAlways( instance ) {
console.log('all images are loaded');
}
// bind with .on()
imgLoad.on( 'always', onAlways );
// unbind with .off()
imgLoad.off( 'always', onAlways );
```
## Background
Detect when background images have loaded, in addition to `<img>`s.
Set `{ background: true }` to detect when the element's background image has loaded.
``` js
// jQuery
$('#container').imagesLoaded( { background: true }, function() {
console.log('#container background image loaded');
});
// vanilla JS
imagesLoaded( '#container', { background: true }, function() {
console.log('#container background image loaded');
});
```
[See jQuery demo](http://codepen.io/desandro/pen/pjVMPB) or [vanilla JS demo](http://codepen.io/desandro/pen/avKooW) on CodePen.
Set to a selector string like `{ background: '.item' }` to detect when the background images of child elements have loaded.
``` js
// jQuery
$('#container').imagesLoaded( { background: '.item' }, function() {
console.log('all .item background images loaded');
});
// vanilla JS
imagesLoaded( '#container', { background: '.item' }, function() {
console.log('all .item background images loaded');
});
```
[See jQuery demo](http://codepen.io/desandro/pen/avKoZL) or [vanilla JS demo](http://codepen.io/desandro/pen/vNrBGz) on CodePen.
## Events
### always
``` js
// jQuery
$('#container').imagesLoaded().always( function( instance ) {
console.log('ALWAYS - all images have been loaded');
});
// vanilla JS
imgLoad.on( 'always', function( instance ) {
console.log('ALWAYS - all images have been loaded');
});
```
Triggered after all images have been either loaded or confirmed broken.
+ `instance` _imagesLoaded_ - the imagesLoaded instance
### done
``` js
// jQuery
$('#container').imagesLoaded().done( function( instance ) {
console.log('DONE - all images have been successfully loaded');
});
// vanilla JS
imgLoad.on( 'done', function( instance ) {
console.log('DONE - all images have been successfully loaded');
});
```
Triggered after all images have successfully loaded without any broken images.
### fail
``` js
$('#container').imagesLoaded().fail( function( instance ) {
console.log('FAIL - all images loaded, at least one is broken');
});
// vanilla JS
imgLoad.on( 'fail', function( instance ) {
console.log('FAIL - all images loaded, at least one is broken');
});
```
Triggered after all images have been loaded with at least one broken image.
### progress
``` js
imgLoad.on( 'progress', function( instance, image ) {
var result = image.isLoaded ? 'loaded' : 'broken';
console.log( 'image is ' + result + ' for ' + image.img.src );
});
```
Triggered after each image has been loaded.
+ `instance` _imagesLoaded_ - the imagesLoaded instance
+ `image` _LoadingImage_ - the LoadingImage instance of the loaded image
<!-- sponsored -->
## Properties
### LoadingImage.img
_Image_ - The `img` element
### LoadingImage.isLoaded
_Boolean_ - `true` when the image has successfully loaded
### imagesLoaded.images
Array of _LoadingImage_ instances for each image detected
``` js
var imgLoad = imagesLoaded('#container');
imgLoad.on( 'always', function() {
console.log( imgLoad.images.length + ' images loaded' );
// detect which image is broken
for ( var i = 0, len = imgLoad.images.length; i < len; i++ ) {
var image = imgLoad.images[i];
var result = image.isLoaded ? 'loaded' : 'broken';
console.log( 'image is ' + result + ' for ' + image.img.src );
}
});
```
## Browserify
imagesLoaded works with [Browserify](http://browserify.org/).
``` bash
npm install imagesloaded --save
```
``` js
var imagesLoaded = require('imagesloaded');
imagesLoaded( elem, function() {...} );
```
Use `.makeJQueryPlugin` to make to use `.imagesLoaded()` jQuery plugin.
``` js
var $ = require('jquery');
var imagesLoaded = require('imagesloaded');
// provide jQuery argument
imagesLoaded.makeJQueryPlugin( $ );
// now use .imagesLoaded() jQuery plugin
$('#container').imagesLoaded( function() {...});
```
## Webpack
Install imagesLoaded with npm.
``` bash
npm install imagesloaded
```
You can then `require('imagesloaded')`.
``` js
// main.js
var imagesLoaded = require('imagesloaded');
imagesLoaded( '#container', function() {
// images have loaded
});
```
Use `.makeJQueryPlugin` to make `.imagesLoaded()` jQuery plugin.
``` js
// main.js
var imagesLoaded = require('imagesloaded');
var $ = require('jquery');
// provide jQuery argument
imagesLoaded.makeJQueryPlugin( $ );
// now use .imagesLoaded() jQuery plugin
$('#container').imagesLoaded( function() {...});
```
Run webpack.
``` bash
webpack main.js bundle.js
```
## RequireJS
imagesLoaded works with [RequireJS](http://requirejs.org).
You can require [imagesloaded.pkgd.js](http://imagesloaded.desandro.com/imagesloaded.pkgd.js).
``` js
requirejs( [
'path/to/imagesloaded.pkgd.js',
], function( imagesLoaded ) {
imagesLoaded( '#container', function() { ... });
});
```
Use `.makeJQueryPlugin` to make `.imagesLoaded()` jQuery plugin.
``` js
requirejs( [
'jquery',
'path/to/imagesloaded.pkgd.js',
], function( $, imagesLoaded ) {
// provide jQuery argument
imagesLoaded.makeJQueryPlugin( $ );
// now use .imagesLoaded() jQuery plugin
$('#container').imagesLoaded( function() {...});
});
```
You can manage dependencies with [Bower](http://bower.io). Set `baseUrl` to `bower_components` and set a path config for all your application code.
``` js
requirejs.config({
baseUrl: 'bower_components/',
paths: { // path to your app
app: '../'
}
});
requirejs( [
'imagesloaded/imagesloaded',
'app/my-component.js'
], function( imagesLoaded, myComp ) {
imagesLoaded( '#container', function() { ... });
});
```
## Browser support
+ IE9+
+ Android 2.3+
+ iOS Safari 4+
+ All other modern browsers
Use [imagesLoaded v3](http://imagesloaded.desandro.com/v3/) for IE8 support.
## MIT License
imagesLoaded is released under the [MIT License](http://desandro.mit-license.org/). Have at it.

View File

@ -0,0 +1,36 @@
{
"name": "imagesloaded",
"description": "JavaScript is all like _You images done yet or what?_",
"main": "imagesloaded.js",
"dependencies": {
"ev-emitter": "^1.0.0"
},
"devDependencies": {
"jquery": ">=1.9 <4.0",
"qunit": "~1.20.0"
},
"ignore": [
"**/.*",
"test",
"package.json",
"composer.json",
"node_modules",
"bower_components",
"tests",
"sandbox/",
"contributing.md"
],
"homepage": "http://imagesloaded.desandro.com",
"authors": [
"David DeSandro"
],
"moduleType": [
"amd",
"globals",
"node"
],
"keywords": [
"images"
],
"license": "MIT"
}

View File

@ -0,0 +1,128 @@
/*jshint node: true, strict: false */
var fs = require('fs');
var gulp = require('gulp');
var rename = require('gulp-rename');
var replace = require('gulp-replace');
// ----- hint ----- //
var jshint = require('gulp-jshint');
gulp.task( 'hint-js', function() {
return gulp.src('imagesloaded.js')
.pipe( jshint() )
.pipe( jshint.reporter('default') );
});
gulp.task( 'hint-test', function() {
return gulp.src('test/unit/*.js')
.pipe( jshint() )
.pipe( jshint.reporter('default') );
});
gulp.task( 'hint-task', function() {
return gulp.src('gulpfile.js')
.pipe( jshint() )
.pipe( jshint.reporter('default') );
});
var jsonlint = require('gulp-json-lint');
gulp.task( 'jsonlint', function() {
return gulp.src( '*.json' )
.pipe( jsonlint() )
.pipe( jsonlint.report('verbose') );
});
gulp.task( 'hint', [ 'hint-js', 'hint-test', 'hint-task', 'jsonlint' ]);
// -------------------------- RequireJS makes pkgd -------------------------- //
// refactored from gulp-requirejs-optimize
// https://www.npmjs.com/package/gulp-requirejs-optimize/
var gutil = require('gulp-util');
var chalk = require('chalk');
var rjsOptimize = require('gulp-requirejs-optimize');
// regex for banner comment
var reBannerComment = new RegExp('^\\s*(?:\\/\\*[\\s\\S]*?\\*\\/)\\s*');
function getBanner() {
var src = fs.readFileSync( 'imagesloaded.js', 'utf8' );
var matches = src.match( reBannerComment );
var banner = matches[0].replace( 'imagesLoaded', 'imagesLoaded PACKAGED' );
return banner;
}
function addBanner( str ) {
return replace( /^/, str );
}
gulp.task( 'requirejs', function() {
var banner = getBanner();
// HACK src is not needed
// should refactor rjsOptimize to produce src
return gulp.src('imagesloaded.js')
.pipe( rjsOptimize({
baseUrl: 'bower_components',
optimize: 'none',
include: [
'../imagesloaded'
]
}) )
// remove named module
.pipe( replace( "'../imagesloaded',", '' ) )
// add banner
.pipe( addBanner( banner ) )
.pipe( rename('imagesloaded.pkgd.js') )
.pipe( gulp.dest('.') );
});
// ----- uglify ----- //
var uglify = require('gulp-uglify');
gulp.task( 'uglify', [ 'requirejs' ], function() {
var banner = getBanner();
gulp.src('imagesloaded.pkgd.js')
.pipe( uglify() )
// add banner
.pipe( addBanner( banner ) )
.pipe( rename('imagesloaded.pkgd.min.js') )
.pipe( gulp.dest('.') );
});
// ----- version ----- //
// set version in source files
var minimist = require('minimist');
// use gulp version -t 1.2.3
gulp.task( 'version', function() {
var args = minimist( process.argv.slice(3) );
var version = args.t;
if ( !version || !/\d+\.\d+\.\d+/.test( version ) ) {
gutil.log( 'invalid version: ' + chalk.red( version ) );
return;
}
gutil.log( 'ticking version to ' + chalk.green( version ) );
gulp.src('imagesloaded.js')
.pipe( replace( /imagesLoaded v\d+\.\d+\.\d+/, 'imagesLoaded v' + version ) )
.pipe( gulp.dest('.') );
gulp.src( [ 'bower.json', 'package.json' ] )
.pipe( replace( /"version": "\d+\.\d+\.\d+"/, '"version": "' + version + '"' ) )
.pipe( gulp.dest('.') );
});
// ----- default ----- //
gulp.task( 'default', [
'hint',
'uglify'
]);

View File

@ -0,0 +1,370 @@
/*!
* imagesLoaded v4.1.3
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
( function( window, factory ) { 'use strict';
// universal module definition
/*global define: false, module: false, require: false */
if ( typeof define == 'function' && define.amd ) {
// AMD
define( [
'ev-emitter/ev-emitter'
], function( EvEmitter ) {
return factory( window, EvEmitter );
});
} else if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
require('ev-emitter')
);
} else {
// browser global
window.imagesLoaded = factory(
window,
window.EvEmitter
);
}
})( typeof window !== 'undefined' ? window : this,
// -------------------------- factory -------------------------- //
function factory( window, EvEmitter ) {
'use strict';
var $ = window.jQuery;
var console = window.console;
// -------------------------- helpers -------------------------- //
// extend objects
function extend( a, b ) {
for ( var prop in b ) {
a[ prop ] = b[ prop ];
}
return a;
}
// turn element or nodeList into an array
function makeArray( obj ) {
var ary = [];
if ( Array.isArray( obj ) ) {
// use object if already an array
ary = obj;
} else if ( typeof obj.length == 'number' ) {
// convert nodeList to array
for ( var i=0; i < obj.length; i++ ) {
ary.push( obj[i] );
}
} else {
// array of single index
ary.push( obj );
}
return ary;
}
// -------------------------- imagesLoaded -------------------------- //
/**
* @param {Array, Element, NodeList, String} elem
* @param {Object or Function} options - if function, use as callback
* @param {Function} onAlways - callback function
*/
function ImagesLoaded( elem, options, onAlways ) {
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
if ( !( this instanceof ImagesLoaded ) ) {
return new ImagesLoaded( elem, options, onAlways );
}
// use elem as selector string
if ( typeof elem == 'string' ) {
elem = document.querySelectorAll( elem );
}
this.elements = makeArray( elem );
this.options = extend( {}, this.options );
if ( typeof options == 'function' ) {
onAlways = options;
} else {
extend( this.options, options );
}
if ( onAlways ) {
this.on( 'always', onAlways );
}
this.getImages();
if ( $ ) {
// add jQuery Deferred object
this.jqDeferred = new $.Deferred();
}
// HACK check async to allow time to bind listeners
setTimeout( function() {
this.check();
}.bind( this ));
}
ImagesLoaded.prototype = Object.create( EvEmitter.prototype );
ImagesLoaded.prototype.options = {};
ImagesLoaded.prototype.getImages = function() {
this.images = [];
// filter & find items if we have an item selector
this.elements.forEach( this.addElementImages, this );
};
/**
* @param {Node} element
*/
ImagesLoaded.prototype.addElementImages = function( elem ) {
// filter siblings
if ( elem.nodeName == 'IMG' ) {
this.addImage( elem );
}
// get background image on element
if ( this.options.background === true ) {
this.addElementBackgroundImages( elem );
}
// find children
// no non-element nodes, #143
var nodeType = elem.nodeType;
if ( !nodeType || !elementNodeTypes[ nodeType ] ) {
return;
}
var childImgs = elem.querySelectorAll('img');
// concat childElems to filterFound array
for ( var i=0; i < childImgs.length; i++ ) {
var img = childImgs[i];
this.addImage( img );
}
// get child background images
if ( typeof this.options.background == 'string' ) {
var children = elem.querySelectorAll( this.options.background );
for ( i=0; i < children.length; i++ ) {
var child = children[i];
this.addElementBackgroundImages( child );
}
}
};
var elementNodeTypes = {
1: true,
9: true,
11: true
};
ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) {
var style = getComputedStyle( elem );
if ( !style ) {
// Firefox returns null if in a hidden iframe https://bugzil.la/548397
return;
}
// get url inside url("...")
var reURL = /url\((['"])?(.*?)\1\)/gi;
var matches = reURL.exec( style.backgroundImage );
while ( matches !== null ) {
var url = matches && matches[2];
if ( url ) {
this.addBackground( url, elem );
}
matches = reURL.exec( style.backgroundImage );
}
};
/**
* @param {Image} img
*/
ImagesLoaded.prototype.addImage = function( img ) {
var loadingImage = new LoadingImage( img );
this.images.push( loadingImage );
};
ImagesLoaded.prototype.addBackground = function( url, elem ) {
var background = new Background( url, elem );
this.images.push( background );
};
ImagesLoaded.prototype.check = function() {
var _this = this;
this.progressedCount = 0;
this.hasAnyBroken = false;
// complete if no images
if ( !this.images.length ) {
this.complete();
return;
}
function onProgress( image, elem, message ) {
// HACK - Chrome triggers event before object properties have changed. #83
setTimeout( function() {
_this.progress( image, elem, message );
});
}
this.images.forEach( function( loadingImage ) {
loadingImage.once( 'progress', onProgress );
loadingImage.check();
});
};
ImagesLoaded.prototype.progress = function( image, elem, message ) {
this.progressedCount++;
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
// progress event
this.emitEvent( 'progress', [ this, image, elem ] );
if ( this.jqDeferred && this.jqDeferred.notify ) {
this.jqDeferred.notify( this, image );
}
// check if completed
if ( this.progressedCount == this.images.length ) {
this.complete();
}
if ( this.options.debug && console ) {
console.log( 'progress: ' + message, image, elem );
}
};
ImagesLoaded.prototype.complete = function() {
var eventName = this.hasAnyBroken ? 'fail' : 'done';
this.isComplete = true;
this.emitEvent( eventName, [ this ] );
this.emitEvent( 'always', [ this ] );
if ( this.jqDeferred ) {
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';
this.jqDeferred[ jqMethod ]( this );
}
};
// -------------------------- -------------------------- //
function LoadingImage( img ) {
this.img = img;
}
LoadingImage.prototype = Object.create( EvEmitter.prototype );
LoadingImage.prototype.check = function() {
// If complete is true and browser supports natural sizes,
// try to check for image status manually.
var isComplete = this.getIsImageComplete();
if ( isComplete ) {
// report based on naturalWidth
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
return;
}
// If none of the checks above matched, simulate loading on detached element.
this.proxyImage = new Image();
this.proxyImage.addEventListener( 'load', this );
this.proxyImage.addEventListener( 'error', this );
// bind to image as well for Firefox. #191
this.img.addEventListener( 'load', this );
this.img.addEventListener( 'error', this );
this.proxyImage.src = this.img.src;
};
LoadingImage.prototype.getIsImageComplete = function() {
return this.img.complete && this.img.naturalWidth !== undefined;
};
LoadingImage.prototype.confirm = function( isLoaded, message ) {
this.isLoaded = isLoaded;
this.emitEvent( 'progress', [ this, this.img, message ] );
};
// ----- events ----- //
// trigger specified handler for event type
LoadingImage.prototype.handleEvent = function( event ) {
var method = 'on' + event.type;
if ( this[ method ] ) {
this[ method ]( event );
}
};
LoadingImage.prototype.onload = function() {
this.confirm( true, 'onload' );
this.unbindEvents();
};
LoadingImage.prototype.onerror = function() {
this.confirm( false, 'onerror' );
this.unbindEvents();
};
LoadingImage.prototype.unbindEvents = function() {
this.proxyImage.removeEventListener( 'load', this );
this.proxyImage.removeEventListener( 'error', this );
this.img.removeEventListener( 'load', this );
this.img.removeEventListener( 'error', this );
};
// -------------------------- Background -------------------------- //
function Background( url, element ) {
this.url = url;
this.element = element;
this.img = new Image();
}
// inherit LoadingImage prototype
Background.prototype = Object.create( LoadingImage.prototype );
Background.prototype.check = function() {
this.img.addEventListener( 'load', this );
this.img.addEventListener( 'error', this );
this.img.src = this.url;
// check if image is already complete
var isComplete = this.getIsImageComplete();
if ( isComplete ) {
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
this.unbindEvents();
}
};
Background.prototype.unbindEvents = function() {
this.img.removeEventListener( 'load', this );
this.img.removeEventListener( 'error', this );
};
Background.prototype.confirm = function( isLoaded, message ) {
this.isLoaded = isLoaded;
this.emitEvent( 'progress', [ this, this.element, message ] );
};
// -------------------------- jQuery -------------------------- //
ImagesLoaded.makeJQueryPlugin = function( jQuery ) {
jQuery = jQuery || window.jQuery;
if ( !jQuery ) {
return;
}
// set local variable
$ = jQuery;
// $().imagesLoaded()
$.fn.imagesLoaded = function( options, callback ) {
var instance = new ImagesLoaded( this, options, callback );
return instance.jqDeferred.promise( $(this) );
};
};
// try making plugin
ImagesLoaded.makeJQueryPlugin();
// -------------------------- -------------------------- //
return ImagesLoaded;
});

View File

@ -0,0 +1,493 @@
/*!
* imagesLoaded PACKAGED v4.1.3
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
/**
* EvEmitter v1.1.0
* Lil' event emitter
* MIT License
*/
/* jshint unused: true, undef: true, strict: true */
( function( global, factory ) {
// universal module definition
/* jshint strict: false */ /* globals define, module, window */
if ( typeof define == 'function' && define.amd ) {
// AMD - RequireJS
define( 'ev-emitter/ev-emitter',factory );
} else if ( typeof module == 'object' && module.exports ) {
// CommonJS - Browserify, Webpack
module.exports = factory();
} else {
// Browser globals
global.EvEmitter = factory();
}
}( typeof window != 'undefined' ? window : this, function() {
function EvEmitter() {}
var proto = EvEmitter.prototype;
proto.on = function( eventName, listener ) {
if ( !eventName || !listener ) {
return;
}
// set events hash
var events = this._events = this._events || {};
// set listeners array
var listeners = events[ eventName ] = events[ eventName ] || [];
// only add once
if ( listeners.indexOf( listener ) == -1 ) {
listeners.push( listener );
}
return this;
};
proto.once = function( eventName, listener ) {
if ( !eventName || !listener ) {
return;
}
// add event
this.on( eventName, listener );
// set once flag
// set onceEvents hash
var onceEvents = this._onceEvents = this._onceEvents || {};
// set onceListeners object
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
// set flag
onceListeners[ listener ] = true;
return this;
};
proto.off = function( eventName, listener ) {
var listeners = this._events && this._events[ eventName ];
if ( !listeners || !listeners.length ) {
return;
}
var index = listeners.indexOf( listener );
if ( index != -1 ) {
listeners.splice( index, 1 );
}
return this;
};
proto.emitEvent = function( eventName, args ) {
var listeners = this._events && this._events[ eventName ];
if ( !listeners || !listeners.length ) {
return;
}
var i = 0;
var listener = listeners[i];
args = args || [];
// once stuff
var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
while ( listener ) {
var isOnce = onceListeners && onceListeners[ listener ];
if ( isOnce ) {
// remove listener
// remove before trigger to prevent recursion
this.off( eventName, listener );
// unset once flag
delete onceListeners[ listener ];
}
// trigger listener
listener.apply( this, args );
// get next listener
i += isOnce ? 0 : 1;
listener = listeners[i];
}
return this;
};
proto.allOff =
proto.removeAllListeners = function() {
delete this._events;
delete this._onceEvents;
};
return EvEmitter;
}));
/*!
* imagesLoaded v4.1.3
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
( function( window, factory ) { 'use strict';
// universal module definition
/*global define: false, module: false, require: false */
if ( typeof define == 'function' && define.amd ) {
// AMD
define( [
'ev-emitter/ev-emitter'
], function( EvEmitter ) {
return factory( window, EvEmitter );
});
} else if ( typeof module == 'object' && module.exports ) {
// CommonJS
module.exports = factory(
window,
require('ev-emitter')
);
} else {
// browser global
window.imagesLoaded = factory(
window,
window.EvEmitter
);
}
})( typeof window !== 'undefined' ? window : this,
// -------------------------- factory -------------------------- //
function factory( window, EvEmitter ) {
var $ = window.jQuery;
var console = window.console;
// -------------------------- helpers -------------------------- //
// extend objects
function extend( a, b ) {
for ( var prop in b ) {
a[ prop ] = b[ prop ];
}
return a;
}
// turn element or nodeList into an array
function makeArray( obj ) {
var ary = [];
if ( Array.isArray( obj ) ) {
// use object if already an array
ary = obj;
} else if ( typeof obj.length == 'number' ) {
// convert nodeList to array
for ( var i=0; i < obj.length; i++ ) {
ary.push( obj[i] );
}
} else {
// array of single index
ary.push( obj );
}
return ary;
}
// -------------------------- imagesLoaded -------------------------- //
/**
* @param {Array, Element, NodeList, String} elem
* @param {Object or Function} options - if function, use as callback
* @param {Function} onAlways - callback function
*/
function ImagesLoaded( elem, options, onAlways ) {
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
if ( !( this instanceof ImagesLoaded ) ) {
return new ImagesLoaded( elem, options, onAlways );
}
// use elem as selector string
if ( typeof elem == 'string' ) {
elem = document.querySelectorAll( elem );
}
this.elements = makeArray( elem );
this.options = extend( {}, this.options );
if ( typeof options == 'function' ) {
onAlways = options;
} else {
extend( this.options, options );
}
if ( onAlways ) {
this.on( 'always', onAlways );
}
this.getImages();
if ( $ ) {
// add jQuery Deferred object
this.jqDeferred = new $.Deferred();
}
// HACK check async to allow time to bind listeners
setTimeout( function() {
this.check();
}.bind( this ));
}
ImagesLoaded.prototype = Object.create( EvEmitter.prototype );
ImagesLoaded.prototype.options = {};
ImagesLoaded.prototype.getImages = function() {
this.images = [];
// filter & find items if we have an item selector
this.elements.forEach( this.addElementImages, this );
};
/**
* @param {Node} element
*/
ImagesLoaded.prototype.addElementImages = function( elem ) {
// filter siblings
if ( elem.nodeName == 'IMG' ) {
this.addImage( elem );
}
// get background image on element
if ( this.options.background === true ) {
this.addElementBackgroundImages( elem );
}
// find children
// no non-element nodes, #143
var nodeType = elem.nodeType;
if ( !nodeType || !elementNodeTypes[ nodeType ] ) {
return;
}
var childImgs = elem.querySelectorAll('img');
// concat childElems to filterFound array
for ( var i=0; i < childImgs.length; i++ ) {
var img = childImgs[i];
this.addImage( img );
}
// get child background images
if ( typeof this.options.background == 'string' ) {
var children = elem.querySelectorAll( this.options.background );
for ( i=0; i < children.length; i++ ) {
var child = children[i];
this.addElementBackgroundImages( child );
}
}
};
var elementNodeTypes = {
1: true,
9: true,
11: true
};
ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) {
var style = getComputedStyle( elem );
if ( !style ) {
// Firefox returns null if in a hidden iframe https://bugzil.la/548397
return;
}
// get url inside url("...")
var reURL = /url\((['"])?(.*?)\1\)/gi;
var matches = reURL.exec( style.backgroundImage );
while ( matches !== null ) {
var url = matches && matches[2];
if ( url ) {
this.addBackground( url, elem );
}
matches = reURL.exec( style.backgroundImage );
}
};
/**
* @param {Image} img
*/
ImagesLoaded.prototype.addImage = function( img ) {
var loadingImage = new LoadingImage( img );
this.images.push( loadingImage );
};
ImagesLoaded.prototype.addBackground = function( url, elem ) {
var background = new Background( url, elem );
this.images.push( background );
};
ImagesLoaded.prototype.check = function() {
var _this = this;
this.progressedCount = 0;
this.hasAnyBroken = false;
// complete if no images
if ( !this.images.length ) {
this.complete();
return;
}
function onProgress( image, elem, message ) {
// HACK - Chrome triggers event before object properties have changed. #83
setTimeout( function() {
_this.progress( image, elem, message );
});
}
this.images.forEach( function( loadingImage ) {
loadingImage.once( 'progress', onProgress );
loadingImage.check();
});
};
ImagesLoaded.prototype.progress = function( image, elem, message ) {
this.progressedCount++;
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
// progress event
this.emitEvent( 'progress', [ this, image, elem ] );
if ( this.jqDeferred && this.jqDeferred.notify ) {
this.jqDeferred.notify( this, image );
}
// check if completed
if ( this.progressedCount == this.images.length ) {
this.complete();
}
if ( this.options.debug && console ) {
console.log( 'progress: ' + message, image, elem );
}
};
ImagesLoaded.prototype.complete = function() {
var eventName = this.hasAnyBroken ? 'fail' : 'done';
this.isComplete = true;
this.emitEvent( eventName, [ this ] );
this.emitEvent( 'always', [ this ] );
if ( this.jqDeferred ) {
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';
this.jqDeferred[ jqMethod ]( this );
}
};
// -------------------------- -------------------------- //
function LoadingImage( img ) {
this.img = img;
}
LoadingImage.prototype = Object.create( EvEmitter.prototype );
LoadingImage.prototype.check = function() {
// If complete is true and browser supports natural sizes,
// try to check for image status manually.
var isComplete = this.getIsImageComplete();
if ( isComplete ) {
// report based on naturalWidth
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
return;
}
// If none of the checks above matched, simulate loading on detached element.
this.proxyImage = new Image();
this.proxyImage.addEventListener( 'load', this );
this.proxyImage.addEventListener( 'error', this );
// bind to image as well for Firefox. #191
this.img.addEventListener( 'load', this );
this.img.addEventListener( 'error', this );
this.proxyImage.src = this.img.src;
};
LoadingImage.prototype.getIsImageComplete = function() {
return this.img.complete && this.img.naturalWidth !== undefined;
};
LoadingImage.prototype.confirm = function( isLoaded, message ) {
this.isLoaded = isLoaded;
this.emitEvent( 'progress', [ this, this.img, message ] );
};
// ----- events ----- //
// trigger specified handler for event type
LoadingImage.prototype.handleEvent = function( event ) {
var method = 'on' + event.type;
if ( this[ method ] ) {
this[ method ]( event );
}
};
LoadingImage.prototype.onload = function() {
this.confirm( true, 'onload' );
this.unbindEvents();
};
LoadingImage.prototype.onerror = function() {
this.confirm( false, 'onerror' );
this.unbindEvents();
};
LoadingImage.prototype.unbindEvents = function() {
this.proxyImage.removeEventListener( 'load', this );
this.proxyImage.removeEventListener( 'error', this );
this.img.removeEventListener( 'load', this );
this.img.removeEventListener( 'error', this );
};
// -------------------------- Background -------------------------- //
function Background( url, element ) {
this.url = url;
this.element = element;
this.img = new Image();
}
// inherit LoadingImage prototype
Background.prototype = Object.create( LoadingImage.prototype );
Background.prototype.check = function() {
this.img.addEventListener( 'load', this );
this.img.addEventListener( 'error', this );
this.img.src = this.url;
// check if image is already complete
var isComplete = this.getIsImageComplete();
if ( isComplete ) {
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
this.unbindEvents();
}
};
Background.prototype.unbindEvents = function() {
this.img.removeEventListener( 'load', this );
this.img.removeEventListener( 'error', this );
};
Background.prototype.confirm = function( isLoaded, message ) {
this.isLoaded = isLoaded;
this.emitEvent( 'progress', [ this, this.element, message ] );
};
// -------------------------- jQuery -------------------------- //
ImagesLoaded.makeJQueryPlugin = function( jQuery ) {
jQuery = jQuery || window.jQuery;
if ( !jQuery ) {
return;
}
// set local variable
$ = jQuery;
// $().imagesLoaded()
$.fn.imagesLoaded = function( options, callback ) {
var instance = new ImagesLoaded( this, options, callback );
return instance.jqDeferred.promise( $(this) );
};
};
// try making plugin
ImagesLoaded.makeJQueryPlugin();
// -------------------------- -------------------------- //
return ImagesLoaded;
});

File diff suppressed because one or more lines are too long

View File

@ -123,7 +123,8 @@ humhub.module('content', function (module, require, $) {
modal.global.set({
header: options.head,
body: string.template(module.templates.permalinkBody, options),
footer: string.template(module.templates.permalinkFooter, options)
footer: string.template(module.templates.permalinkFooter, options),
size: 'normal'
}).show();
modal.global.$.find('textarea').focus().select();

View File

@ -1,6 +1,6 @@
{
"name": "At.js",
"version": "1.5.3",
"version": "1.5.4",
"main": [
"dist/js/jquery.atwho.js",
"dist/css/jquery.atwho.css"

View File

@ -2,7 +2,7 @@
"name": "At.js",
"repo": "ichord/At.js",
"description": "Add Github like mentions autocomplete to your application.",
"version": "1.5.3",
"version": "1.5.4",
"demo": "http://ichord.github.com/At.js",
"dependencies": {
"ichord/Caret.js": "~0.2.2",

View File

@ -1,5 +1,5 @@
/**
* at.js - 1.5.3
* at.js - 1.5.4
* Copyright (c) 2017 chord.luo <chord.luo@gmail.com>;
* Homepage: http://ichord.github.com/At.js
* License: MIT
@ -809,7 +809,7 @@ EditableController = (function(superClass) {
EditableController.prototype.rect = function() {
var $iframe, iframeOffset, rect;
rect = this.query.el.offset();
if (!rect) {
if (!(rect && this.query.el[0].getClientRects().length)) {
return;
}
if (this.app.iframe && !this.app.iframeAsRoot) {
@ -822,10 +822,14 @@ EditableController = (function(superClass) {
};
EditableController.prototype.insert = function(content, $li) {
var data, range, suffix, suffixNode;
var data, overrides, range, suffix, suffixNode;
if (!this.$inputor.is(':focus')) {
this.$inputor.focus();
}
overrides = this.getOpt('functionOverrides');
if (overrides.insert) {
return overrides.insert.call(this, content, $li);
}
suffix = (suffix = this.getOpt('suffix')) === "" ? suffix : suffix || "\u00A0";
data = $li.data('item-data');
this.query.el.removeClass('atwho-query').addClass('atwho-inserted').html(content).attr('data-atwho-at-query', "" + data['atwho-at'] + this.query.text).attr('contenteditable', "false");
@ -1183,6 +1187,7 @@ $.fn.atwho["default"] = {
insertTpl: "${atwho-at}${name}",
headerTpl: null,
callbacks: DEFAULT_CALLBACKS,
functionOverrides: {},
searchKey: "name",
suffix: void 0,
hideWithoutSuffix: false,

View File

@ -43,7 +43,7 @@ gulp.task('umd', function() {
gulp.task('bump', function() {
gulp.src(['bower.json', 'component.json', 'package.json'])
.pipe(bump({version: "1.5.3"}))
.pipe(bump({version: "1.5.4"}))
.pipe(gulp.dest('./'));
});

View File

@ -7,7 +7,7 @@
},
"homepage": "http://ichord.github.com/At.js",
"license": "MIT",
"version": "1.5.3",
"version": "1.5.4",
"repository": {
"type": "git",
"url": "https://github.com/ichord/At.js"
@ -19,7 +19,7 @@
"test": "gulp test"
},
"peerDependencies": {
"jquery": "^1.7.0"
"jquery": ">=1.7.0 <4.0.0"
},
"devDependencies": {
"gulp": "^3.9.0",

View File

@ -37,6 +37,7 @@ $.fn.atwho.default =
insertTpl: "${atwho-at}${name}"
headerTpl: null
callbacks: DEFAULT_CALLBACKS
functionOverrides: {}
searchKey: "name"
suffix: undefined
hideWithoutSuffix: no

View File

@ -138,7 +138,9 @@ class EditableController extends Controller
# @return [Hash] the offset which look likes this: {top: y, left: x, bottom: bottom}
rect: ->
rect = @query.el.offset()
return unless rect
# do not use {top: 0, left: 0} from jQuery when element is hidden
# happens every other time the menu is displayed on click in contenteditable
return unless rect and @query.el[0].getClientRects().length
if @app.iframe and not @app.iframeAsRoot
iframeOffset = ($iframe = $ @app.iframe).offset()
rect.left += iframeOffset.left - @$inputor.scrollLeft()
@ -151,6 +153,9 @@ class EditableController extends Controller
# @param content [String] string to insert
insert: (content, $li) ->
@$inputor.focus() unless @$inputor.is ':focus'
overrides = @getOpt 'functionOverrides'
if overrides.insert
return overrides.insert.call this, content, $li
suffix = if (suffix = @getOpt 'suffix') == "" then suffix else suffix or "\u00A0"
data = $li.data('item-data')
@query.el

View File

@ -69,9 +69,9 @@ Supports plain strings, `text/html`, and DOM nodes | Only supports plain strings
1.5KB minimized + gzipped | 2.9KB minimized + gzipped
Doesn't change document selection | Clears document selection
Only an imperative API (`clipboard.copy()`) | Declarative DOM-based API
Uses `Promise`s | -
Supports paste (in IE) | -
- | Offers a fallback prompt (`Press Ctrl+C to copy`)
Uses `Promise`s | ---
Supports paste (in IE) | ---
--- | Offers a fallback prompt (`Press Ctrl+C to copy`)
## This is way too complicated!

View File

@ -1,7 +1,7 @@
{
"name": "clipboard.js",
"main": "clipboard.js",
"version": "0.3.3",
"version": "0.3.5",
"homepage": "https://github.com/lgarron/clipboard.js",
"authors": [
"code@garron.net"

View File

@ -67,8 +67,10 @@
_data = {"text/plain": data};
} else if (data instanceof Node) {
_data = {"text/html": new XMLSerializer().serializeToString(data)};
} else {
} else if (data instanceof Object){
_data = data;
} else {
reject("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings.")
}
function triggerCopy(tryBogusSelect) {
@ -84,6 +86,7 @@
bogusSelect();
triggerCopy(true);
} else {
cleanup();
throw new Error("Unable to copy. Perhaps it's not available in your browser?");
}
}

View File

@ -0,0 +1,9 @@
(function(e,c){"undefined"!==typeof module?module.exports=c():"function"===typeof define&&"object"===typeof define.amd?define(c):this[e]=c()})("clipboard",function(){if("undefined"===typeof document||!document.addEventListener)return null;var e={};e.copy=function(){function c(){d=!1;b=null;g&&window.getSelection().removeAllRanges();g=!1}var d=!1,b=null,g=!1;document.addEventListener("copy",function(c){if(d){for(var g in b)c.clipboardData.setData(g,b[g]);c.preventDefault()}});return function(f){return new Promise(function(m,
e){function k(b){try{if(document.execCommand("copy"))c(),m();else{if(b)throw c(),Error("Unable to copy. Perhaps it's not available in your browser?");var d=document.getSelection();if(!document.queryCommandEnabled("copy")&&d.isCollapsed){var f=document.createRange();f.selectNodeContents(document.body);d.removeAllRanges();d.addRange(f);g=!0}k(!0)}}catch(a){c(),e(a)}}d=!0;"string"===typeof f?b={"text/plain":f}:f instanceof Node?b={"text/html":(new XMLSerializer).serializeToString(f)}:f instanceof Object?
b=f:e("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings.");k(!1)})}}();e.paste=function(){var c=!1,d,b;document.addEventListener("paste",function(g){if(c){c=!1;g.preventDefault();var f=d;d=null;f(g.clipboardData.getData(b))}});return function(g){return new Promise(function(f,e){c=!0;d=f;b=g||"text/plain";try{document.execCommand("paste")||(c=!1,e(Error("Unable to paste. Pasting only works in Internet Explorer at the moment.")))}catch(h){c=!1,e(Error(h))}})}}();
"undefined"===typeof ClipboardEvent&&"undefined"!==typeof window.clipboardData&&"undefined"!==typeof window.clipboardData.setData&&(function(c){function d(a,b){return function(){a.apply(b,arguments)}}function b(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._value=this._state=null;this._deferreds=[];l(a,d(f,this),d(e,this))}function g(a){var b=this;return null===this._state?void this._deferreds.push(a):
void n(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function f(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var b=a.then;if("function"==typeof b)return void l(d(b,a),d(f,this),d(e,this))}this._state=!0;this._value=a;h.call(this)}catch(c){e.call(this,c)}}function e(a){this._state=
!1;this._value=a;h.call(this)}function h(){for(var a=0,b=this._deferreds.length;b>a;a++)g.call(this,this._deferreds[a]);this._deferreds=null}function k(a,b,c,d){this.onFulfilled="function"==typeof a?a:null;this.onRejected="function"==typeof b?b:null;this.resolve=c;this.reject=d}function l(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){d||(d=!0,c(e))}}var n=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},p=Array.isArray||
function(a){return"[object Array]"===Object.prototype.toString.call(a)};b.prototype["catch"]=function(a){return this.then(null,a)};b.prototype.then=function(a,c){var d=this;return new b(function(b,e){g.call(d,new k(a,c,b,e))})};b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&p(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,
a)},c)}a[f]=g;0===--e&&b(a)}catch(k){c(k)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})};b.resolve=function(a){return a&&"object"==typeof a&&a.constructor===b?a:new b(function(b){b(a)})};b.reject=function(a){return new b(function(b,c){c(a)})};b.race=function(a){return new b(function(b,c){for(var d=0,e=a.length;e>d;d++)a[d].then(b,c)})};"undefined"!=typeof module&&module.exports?module.exports=b:c.Promise||(c.Promise=b)}(this),e.copy=function(c){return new Promise(function(d,
b){if("string"!==typeof c&&!("text/plain"in c))throw Error("You must provide a text/plain type.");window.clipboardData.setData("Text","string"===typeof c?c:c["text/plain"])?d():b(Error("Copying was rejected."))})},e.paste=function(){return new Promise(function(c,d){var b=window.clipboardData.getData("Text");b?c(b):d(Error("Pasting was rejected."))})});return e});

View File

@ -1,6 +1,6 @@
{
"name": "clipboard-js",
"version": "0.3.3",
"version": "0.3.5",
"description": "A web shim to handle clipboard APIs across browsers using a simple Promise API.",
"main": "clipboard.js",
"dependencies": {

View File

@ -1,9 +0,0 @@
(function(f,c){"undefined"!==typeof module?module.exports=c():"function"===typeof define&&"object"===typeof define.amd?define(c):this[f]=c()})("clipboard",function(){if("undefined"===typeof document||!document.addEventListener)return null;var f={};f.copy=function(){function c(){d=!1;b=null;e&&window.getSelection().removeAllRanges();e=!1}var d=!1,b=null,e=!1;document.addEventListener("copy",function(c){if(d){for(var e in b)c.clipboardData.setData(e,b[e]);c.preventDefault()}});return function(g){return new Promise(function(k,
f){d=!0;b="string"===typeof g?{"text/plain":g}:g instanceof Node?{"text/html":(new XMLSerializer).serializeToString(g)}:g;try{var n=document.getSelection();if(!document.queryCommandEnabled("copy")&&n.isCollapsed){var l=document.createRange();l.selectNodeContents(document.body);n.addRange(l);e=!0}if(document.execCommand("copy"))c(),k();else throw Error("Unable to copy. Perhaps it's not available in your browser?");}catch(p){c(),f(p)}})}}();f.paste=function(){var c=!1,d,b;document.addEventListener("paste",
function(e){if(c){c=!1;e.preventDefault();var g=d;d=null;g(e.clipboardData.getData(b))}});return function(e){return new Promise(function(g,f){c=!0;d=g;b=e||"text/plain";try{document.execCommand("paste")||(c=!1,f(Error("Unable to paste. Pasting only works in Internet Explorer at the moment.")))}catch(m){c=!1,f(Error(m))}})}}();"undefined"===typeof ClipboardEvent&&"undefined"!==typeof window.clipboardData&&"undefined"!==typeof window.clipboardData.setData&&(function(c){function d(a,b){return function(){a.apply(b,
arguments)}}function b(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._value=this._state=null;this._deferreds=[];l(a,d(f,this),d(k,this))}function e(a){var b=this;return null===this._state?void this._deferreds.push(a):void p(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var h;try{h=c(b._value)}catch(d){return void a.reject(d)}a.resolve(h)})}
function f(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var b=a.then;if("function"==typeof b)return void l(d(b,a),d(f,this),d(k,this))}this._state=!0;this._value=a;m.call(this)}catch(c){k.call(this,c)}}function k(a){this._state=!1;this._value=a;m.call(this)}function m(){for(var a=0,b=this._deferreds.length;b>a;a++)e.call(this,this._deferreds[a]);this._deferreds=null}function n(a,b,c,h){this.onFulfilled="function"==
typeof a?a:null;this.onRejected="function"==typeof b?b:null;this.resolve=c;this.reject=h}function l(a,b,c){var h=!1;try{a(function(a){h||(h=!0,b(a))},function(a){h||(h=!0,c(a))})}catch(d){h||(h=!0,c(d))}}var p=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},q=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};b.prototype["catch"]=function(a){return this.then(null,a)};b.prototype.then=function(a,c){var d=this;return new b(function(b,
f){e.call(d,new n(a,c,b,f))})};b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&q(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(e,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var k=g.then;if("function"==typeof k)return void k.call(g,function(a){d(e,a)},c)}a[e]=g;0===--f&&b(a)}catch(l){c(l)}}if(0===a.length)return b([]);for(var f=a.length,e=0;e<a.length;e++)d(e,a[e])})};b.resolve=function(a){return a&&"object"==typeof a&&a.constructor===
b?a:new b(function(b){b(a)})};b.reject=function(a){return new b(function(b,c){c(a)})};b.race=function(a){return new b(function(b,c){for(var d=0,e=a.length;e>d;d++)a[d].then(b,c)})};"undefined"!=typeof module&&module.exports?module.exports=b:c.Promise||(c.Promise=b)}(this),f.copy=function(c){return new Promise(function(d,b){if("string"!==typeof c&&!("text/plain"in c))throw Error("You must provide a text/plain type.");window.clipboardData.setData("Text","string"===typeof c?c:c["text/plain"])?d():b(Error("Copying was rejected."))})},
f.paste=function(){return new Promise(function(c,d){var b=window.clipboardData.getData("Text");b?c(b):d(Error("Pasting was rejected."))})});return f});

View File

@ -30,6 +30,11 @@ humhub.module('ui.widget', function(module, require, $) {
var initData = this.$.data('ui-init');
this.fire('beforeInit', [this, initData]);
this.init(initData);
if(this.options.widgetFadeIn) {
this.$.fadeIn(this.options.widgetFadeIn);
}
this.fire('afterInit', [this]);
}
};

View File

@ -67,6 +67,20 @@ humhub.module('util', function(module, require, $) {
});
};
},
debounce: function(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
},
inherits: function(Sub, Parent) {
for(var i in Parent) {
Sub[i] = Parent[i];