Skip to content
Snippets Groups Projects
Commit 3cfbf3b4 authored by Laurent's avatar Laurent
Browse files

dev #65510 butterfly jquery compatibility

parent 61a706d4
Branches
Tags
2 merge requests!2366Dev#65510 maj jquery,!2358Dev#65510 maj jquery
Pipeline #2600 passed with stage
in 22 minutes and 17 seconds
...@@ -768,9 +768,8 @@ class Class_ScriptLoader { ...@@ -768,9 +768,8 @@ class Class_ScriptLoader {
public function loadButterflyLightbox() { public function loadButterflyLightbox() {
return $this->addOPACScript('butterfly/jquery.resize-events') return $this->addOPACScript('butterfly/jquery.resize-events')
->addOPACScript('butterfly/jquery.history') ->addOPACScript('butterfly/jquery.history')
->addOPACScript('butterfly/jquery.butterfly.min') ->addOPACScript('butterfly/jquery.butterfly')
->addOPACScriptStyleSheet('butterfly/butterfly') ->addOPACScriptStyleSheet('butterfly/butterfly');
->addOPACScriptStyleSheet('butterfly/butterfly-ie', ['ie_version' => 6]);
} }
......
...@@ -899,12 +899,12 @@ jQuery.butterfly.linkCount = 0; ...@@ -899,12 +899,12 @@ jQuery.butterfly.linkCount = 0;
'<img src="'+href+'" alt="" style="max-width: 100%; max-height: 100%; float: left;" />'+caption '<img src="'+href+'" alt="" style="max-width: 100%; max-height: 100%; float: left;" />'+caption
); );
$('#jb-window-content img') $('#jb-window-content img')
.error(function(){ .on('error', function(){
checkForContent.apply(this, [options.linkType, href, callback]); checkForContent.apply(this, [options.linkType, href, callback]);
}) })
.data('full-width', '') .data('full-width', '')
.data('full-height', '') .data('full-height', '')
.load(callback) .on('load', callback)
; ;
break; break;
...@@ -925,10 +925,10 @@ jQuery.butterfly.linkCount = 0; ...@@ -925,10 +925,10 @@ jQuery.butterfly.linkCount = 0;
$('#jb-window-content > iframe') $('#jb-window-content > iframe')
.width(contentDefaultWidth) .width(contentDefaultWidth)
.height(contentDefaultHeight) .height(contentDefaultHeight)
.error(function(){ .on('error', function(){
checkForContent.apply(this, [options.linkType, href, callback]); checkForContent.apply(this, [options.linkType, href, callback]);
}) })
.load(callback) .on('load', callback)
; ;
break; break;
...@@ -1054,28 +1054,13 @@ jQuery.butterfly.linkCount = 0; ...@@ -1054,28 +1054,13 @@ jQuery.butterfly.linkCount = 0;
fullWidth fullWidth
; ;
// relax size for measurement jbWindowInner.css({
if (
$.browser.msie &&
$.browser.version === 7 &&
isImageType &&
isImageMedia &&
this.find('img').outerWidth(true) === 0 // IE7 width === 0 on initial load
) { // only works with '100%' for IE7 on initial load
jbWindowInner.css({
width: '100%',
height: '100%',
left:0,
top:0
});
} else { // must use 'auto' for all other situations
jbWindowInner.css({
width: 'auto', width: 'auto',
height: 'auto', height: 'auto',
left:0, left:0,
top:0 top:0
}); });
}
// if element is hidden, unhide it, then measure // if element is hidden, unhide it, then measure
...@@ -1133,23 +1118,11 @@ jQuery.butterfly.linkCount = 0; ...@@ -1133,23 +1118,11 @@ jQuery.butterfly.linkCount = 0;
relaxWidth = typeof relaxWidth !== 'undefined' ? relaxWidth : true; relaxWidth = typeof relaxWidth !== 'undefined' ? relaxWidth : true;
// relax size for measurement // relax size for measurement
if ( // must use 'auto' for all other situations
$.browser.msie &&
$.browser.version === 7 &&
isImageType &&
isImageMedia &&
this.find('img').outerWidth(true) === 0 // IE7 width === 0 on initial load
) { // only works with '100%' for IE7 on initial load
$('#jb-window-inner').height('100%');
if (relaxWidth) {
$('#jb-window-inner').width('100%').css({left:0,top:0});
}
} else { // must use 'auto' for all other situations
$('#jb-window-inner').height('auto'); $('#jb-window-inner').height('auto');
if (relaxWidth) { if (relaxWidth) {
$('#jb-window-inner').width('auto').css({left:0,top:0}); $('#jb-window-inner').width('auto').css({left:0,top:0});
} }
}
// if element is hidden, unhide it, then measure // if element is hidden, unhide it, then measure
if ( this.css('display') === 'none' ) { if ( this.css('display') === 'none' ) {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
get: function(win) { get: function(win) {
var hash = ((win || window).location.hash).replace(/^#/, ''); var hash = ((win || window).location.hash).replace(/^#/, '');
try { try {
return $.browser.mozilla ? hash : decodeURIComponent(hash); return hash;
} }
catch (error) { catch (error) {
return hash; return hash;
...@@ -181,9 +181,7 @@ ...@@ -181,9 +181,7 @@
var self = $.extend({}, implementations.base); var self = $.extend({}, implementations.base);
if($.browser.msie && ($.browser.version < 8 || document.documentMode < 8)) { if("onhashchange" in window) {
self.type = 'iframeTimer';
} else if("onhashchange" in window) {
self.type = 'hashchangeEvent'; self.type = 'hashchangeEvent';
} else { } else {
self.type = 'timer'; self.type = 'timer';
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment