Function PhotoSwipe
has 2598 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PhotoSwipe = function(template, UiClass, items, options){
/*>>framework-bridge*/
/**
*
File photoswipe.js
has 2611 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*! PhotoSwipe - v4.1.3 - 2019-01-08
* http://photoswipe.com
* Copyright (c) 2019 Dmitry Semenov; */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
Function _onDragRelease
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
_onDragRelease = function(e) {
if(_features.isOldAndroid ) {
if(_oldAndroidTouchEndTimeout && e.type === 'mouseup') {
Function _showOrHide
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
_showOrHide = function(item, img, out, completeFn) {
if(_showOrHideTimeout) {
clearTimeout(_showOrHideTimeout);
}
Function init
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function() {
if(_isOpen || _isDestroying) {
return;
}
Function setContent
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
setContent: function(holder, index) {
if(_options.loop) {
index = _getLoopedId(index);
}
Function _renderMovement
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
_renderMovement = function() {
if(!_currentPoints) {
return;
}
Function _initDragReleaseAnimationData
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initDragReleaseAnimationData = function() {
// temp local vars
var lastFlickDuration,
tempReleasePos;
Function _panOrMoveMainScroll
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
_panOrMoveMainScroll = function(axis, delta) {
var panFriction,
overDiff = 0,
newOffset = _panOffset[axis] + delta[axis],
Function detectFeatures
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
detectFeatures: function() {
if(framework.features) {
return framework.features;
}
var helperEl = framework.createEl(),
Function startAnimation
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
var startAnimation = function() {
var closeWithRaf = _closedByScroll,
fadeEverything = !self.currItem.src || self.currItem.loadError || _options.showHideOpacity;
// apply hw-acceleration to image
Function _onDragStart
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
_onDragStart = function(e) {
// Allow dragging only via left mouse button.
// As this handler is not added in IE8 - we ignore e.which
//
Function _finishSwipeMainScrollGesture
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
_finishSwipeMainScrollGesture = function(gestureType, _releaseAnimData) {
var itemChanged;
if(!_mainScrollAnimating) {
_currZoomedItemIndex = _currentItemIndex;
}
Function initHistory
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
initHistory: function() {
framework.extend(_options, _historyDefaultOptions, true);
if( !_options.history ) {
Function updateSize
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateSize: function(force) {
if(!_isFixedPosition && _options.modal) {
var windowScrollY = framework.getScrollY();
if(_currentWindowScrollY !== windowScrollY) {
Function initController
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
initController: function() {
framework.extend(_options, _controllerDefaultOptions, true);
self.items = _items = items;
_getItemAt = self.getItemAt;
_getNumItems = _options.getNumItemsFn; //self.getNumItems;
Function initGestures
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
initGestures: function() {
// helper function that builds touch/pointer/mouse events
var addEventNames = function(pref, down, move, up, cancel) {
_dragStartEvent = pref + down;
Function handleMouseWheel
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleMouseWheel: function(e) {
if(_currZoomLevel <= self.currItem.fitRatio) {
if( _options.modal ) {
Function _calculateItemSize
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
_calculateItemSize = function(item, viewportSize, zoomLevel) {
if (item.src && !item.loadError) {
var isInitial = !zoomLevel;
Function updateCurrItem
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateCurrItem: function(beforeAnimation) {
if(_indexDiff === 0) {
return;
}
Function setupDesktopZoom
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupDesktopZoom: function(onInit) {
_wheelDelta = {};
var events = 'wheel mousewheel DOMMouseScroll';
Function _updateHash
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
_updateHash = function() {
if(_hashAnimCheckTimeout) {
clearTimeout(_hashAnimCheckTimeout);
}
Function zoomTo
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
zoomTo: function(destZoomLevel, centerPoint, speed, easingFn, updateFn) {
/*
if(destZoomLevel === 'fit') {
destZoomLevel = self.currItem.fitRatio;
} else if(destZoomLevel === 'fill') {
Function loadComplete
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
item.loadComplete = function(item) {
// gallery closed before image finished loading
if(!_isOpen) {
return;
Function _setupTransforms
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupTransforms = function() {
if(_transformKey) {
// setup 3d transforms
var allow3dTransform = _features.perspective && !_likelyTouchDevice;
Function _parseItemIndexFromURL
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_parseItemIndexFromURL = function() {
var hash = _getHash(),
params = {};
if(hash.length < 5) { // pid=1
Function _getTouchPoints
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getTouchPoints = function(e) {
// clean up previous points, without recreating array
while(_tempPointsArr.length > 0) {
_tempPointsArr.pop();
}
Function onTapRelease
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
onTapRelease: function(e, releasePoint) {
if(!releasePoint) {
return;
}
Function _animateProp
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
_animateProp = function(name, b, endProp, d, easingFn, onUpdate, onComplete) {
Avoid deeply nested control flow statements. Open
if(mainScrollDiff < 0 && newMainScrollPosition > _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
}
Avoid deeply nested control flow statements. Open
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
newPanPos = newOffset;
}
Function _appendImage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
_appendImage = function(index, item, baseDiv, img, preventAnimation, keepPlaceholder) {
Avoid deeply nested control flow statements. Open
if(!unbind) {
listener['oldIE' + evName] = _handleEv;
} else {
if(!listener['oldIE' + evName]) {
return false;
Avoid deeply nested control flow statements. Open
if(_currPanBounds.min.x !== _currPanBounds.max.x) {
newPanPos = newOffset;
}
Avoid deeply nested control flow statements. Open
if(mainScrollDiff > 0 && newMainScrollPosition < _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
}
Function _applyZoomTransform
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
_applyZoomTransform = function(styleObj,x,y,zoom,item) {
Function addEventNames
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var addEventNames = function(pref, down, move, up, cancel) {
Function zoomTo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
zoomTo: function(destZoomLevel, centerPoint, speed, easingFn, updateFn) {
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return ;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Similar blocks of code found in 2 locations. Consider refactoring. Open
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 83.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(y > _currPanBounds.min.y) {
y = _currPanBounds.min.y;
} else if(y < _currPanBounds.max.y) {
y = _currPanBounds.max.y;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(x > _currPanBounds.min.x) {
x = _currPanBounds.min.x;
} else if(x < _currPanBounds.max.x) {
x = _currPanBounds.max.x;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if( (startOverDiff <= 0 || mainScrollDiff < 0) && _getNumItems() > 1 ) {
newMainScrollPos = newMainScrollPosition;
if(mainScrollDiff < 0 && newMainScrollPosition > _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if( (startOverDiff <= 0 || mainScrollDiff > 0) && _getNumItems() > 1 ) {
newMainScrollPos = newMainScrollPosition;
if(mainScrollDiff > 0 && newMainScrollPosition < _startMainScrollPos.x) {
newMainScrollPos = _startMainScrollPos.x;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76