Skip to content

Commit

Permalink
Merge pull request #2 from collective/issue_1
Browse files Browse the repository at this point in the history
Remove browser layer and registered javascripts / add extra javascript files from cycle2
  • Loading branch information
hvelarde committed May 25, 2015
2 parents a0b37c5 + b10476e commit f5942ef
Show file tree
Hide file tree
Showing 36 changed files with 949 additions and 50 deletions.
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ There's a frood who really knows where his towel is.
1.0a2 (unreleased)
------------------

- Nothing changed yet.
- Remove browser layer and JS resource registry registrations.
Include all Cycle2 and plugins code as browser resources (closes `#1`_).
[rodfersou]


1.0a1 (2014-10-20)
------------------

- Initial release.

.. _`#1`: https://github.com/collective/collective.js.cycle2/issues/1
14 changes: 11 additions & 3 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ parts+=

[code-analysis]
directory = ${buildout:directory}/src/collective/js/cycle2
pre-commit-hook = False
jshint = True
jshint-bin = bin/jshint
clean-lines = True
clean-lines-exclude = ${buildout:directory}/src/collective/js/cycle2/resources/
deprecated-aliases = True
flake8-extensions =
flake8-blind-except
flake8-coding
flake8-debugger
flake8-quotes
flake8-ignore = E501
multiprocessing = True
return-status-codes = True
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
include_package_data=True,
zip_safe=False,
install_requires=[
'plone.api',
'Products.CMFPlone >=4.2',
'Products.GenericSetup',
'setuptools',
Expand Down
1 change: 1 addition & 0 deletions src/collective/js/cycle2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
4 changes: 3 additions & 1 deletion src/collective/js/cycle2/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<browser:resourceDirectory name="collective.js.cycle2" directory="static" />
<browser:resourceDirectory name="collective.js.cycle2" directory="resources" />

<include package=".upgrades" />

</configure>
7 changes: 0 additions & 7 deletions src/collective/js/cycle2/profiles/default/browserlayer.xml

This file was deleted.

12 changes: 0 additions & 12 deletions src/collective/js/cycle2/profiles/default/jsregistry.xml

This file was deleted.

2 changes: 1 addition & 1 deletion src/collective/js/cycle2/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<metadata>
<version>1000</version>
<version>1001</version>
</metadata>
71 changes: 71 additions & 0 deletions src/collective/js/cycle2/resources/jquery.cycle2.caption2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*! caption2 plugin for Cycle2; version: 20130708 */
(function($) {
"use strict";

$.extend($.fn.cycle.defaults, {
captionFxOut: 'fadeOut',
captionFxIn: 'fadeIn',
captionFxSel: undefined,
overlayFxOut: 'fadeOut',
overlayFxIn: 'fadeIn',
overlayFxSel: undefined
});

$(document).on( 'cycle-bootstrap', function(e, opts) {
opts.container.on( 'cycle-update-view-before', update );
opts.container.one( 'cycle-update-view-after', init );
});

// $(document).on( 'cycle-destroy', function(e, opts) {
// opts.container.off( 'cycle-update-view-before', update );
// });

function update( e, opts, slideOpts, currSlide, isAfter ) {
if ( opts.captionPlugin !== 'caption2' )
return;
$.each(['caption','overlay'], function() {
var fxBase = this + 'Fx',
fx = opts[fxBase + 'Out'] || 'hide',
template = slideOpts[this+'Template'],
el = opts.API.getComponent( this ),
sel = opts[fxBase+'Sel'],
speed = opts.speed,
animEl;

if ( opts.sync )
speed = speed/2;

animEl = sel ? el.find( sel ) : el;

if( el.length && template ) {
if ( fx == 'hide')
speed = 0;
animEl[fx]( speed, function() {
var content = opts.API.tmpl( template, slideOpts, opts, currSlide );
el.html( content );
animEl = sel ? el.find( sel ) : el;
if ( sel )
animEl.hide();
fx = opts[ fxBase + 'In'] || 'show';
animEl[fx]( speed );
});
}
else {
el.hide();
}
});
}

function init( e, opts, slideOpts, currSlide, isAfter ) {
if ( opts.captionPlugin !== 'caption2' )
return;
$.each(['caption','overlay'], function() {
var template = slideOpts[this+'Template'],
el = opts.API.getComponent( this );

if( el.length && template )
el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) );
});
}

})(jQuery);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f5942ef

Please sign in to comment.