1
- // Patternslib 2.0.13
1
+ // Patternslib 2.0.14
2
2
3
3
/**
4
4
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
@@ -12732,9 +12732,9 @@ define('pat-logger',[
12732
12732
12733
12733
define('pat-utils',[
12734
12734
"jquery",
12735
- "jquery.browser ",
12736
- "underscore"
12737
- ], function($) {
12735
+ "underscore ",
12736
+ "jquery.browser" // adds itself to the jquery object, no need to pass to the define callback.
12737
+ ], function($, _ ) {
12738
12738
12739
12739
$.fn.safeClone = function () {
12740
12740
var $clone = this.clone();
@@ -14342,7 +14342,7 @@ define('pat-parser',[
14342
14342
if (!part) { return; }
14343
14343
var matches = part.match(this.named_param_pattern);
14344
14344
if (!matches) {
14345
- this.log.warn("Invalid parameter: " + part);
14345
+ this.log.warn("Invalid parameter: " + part + ": " + argstring );
14346
14346
return;
14347
14347
}
14348
14348
var name = matches[1],
@@ -18433,8 +18433,7 @@ define('pat-store',[],function() {
18433
18433
}
18434
18434
}
18435
18435
return options;
18436
- },
18437
-
18436
+ }
18438
18437
};
18439
18438
18440
18439
// Perform the test separately since this may throw a SecurityError as
@@ -30830,7 +30829,8 @@ define('pat-inject',[
30830
30829
formaction = $button.attr("formaction"),
30831
30830
$form = $button.parents(".pat-inject").first(),
30832
30831
opts = {url: formaction},
30833
- cfgs = inject.extractConfig($form, opts);
30832
+ $cfg_node = $button.closest("[data-pat-inject]"),
30833
+ cfgs = inject.extractConfig($cfg_node, opts);
30834
30834
30835
30835
ev.preventDefault();
30836
30836
$form.trigger("patterns-inject-triggered");
@@ -38333,7 +38333,10 @@ define('pat-modal',[
38333
38333
38334
38334
// Restore focus in case the active element was a child of $el and
38335
38335
// the focus was lost during the wrapping.
38336
- document.activeElement.focus();
38336
+ // Only if we have an activeElement, as IE10/11 can have undefined as activeElement
38337
+ if (document.activeElement) {
38338
+ document.activeElement.focus();
38339
+ }
38337
38340
this._init_handlers();
38338
38341
this.resize();
38339
38342
this.setPosition();
@@ -43698,7 +43701,7 @@ define("pat-gallery", [
43698
43701
});
43699
43702
gallery.init();
43700
43703
});
43701
- },
43704
+ }
43702
43705
});
43703
43706
});
43704
43707
@@ -50796,8 +50799,9 @@ define('pat-scroll',[
50796
50799
"pat-utils",
50797
50800
"pat-logger",
50798
50801
"pat-parser",
50799
- "underscore"
50800
- ], function($, patterns, Base, utils, logging, Parser, _) {
50802
+ "underscore",
50803
+ "imagesloaded"
50804
+ ], function($, patterns, Base, utils, logging, Parser, _, imagesLoaded) {
50801
50805
var log = logging.getLogger("scroll"),
50802
50806
parser = new Parser("scroll");
50803
50807
parser.addArgument("trigger", "click", ["click", "auto"]);
@@ -50813,7 +50817,11 @@ define('pat-scroll',[
50813
50817
init: function($el, opts) {
50814
50818
this.options = parser.parse(this.$el, opts);
50815
50819
if (this.options.trigger == "auto") {
50816
- this.smoothScroll();
50820
+ // Only calculate the offset when all images are loaded
50821
+ var that = this;
50822
+ $('body').imagesLoaded( function() {
50823
+ that.smoothScroll();
50824
+ });
50817
50825
} else if (this.options.trigger == "click") {
50818
50826
this.$el.click(this.onClick.bind(this));
50819
50827
}
@@ -50909,15 +50917,40 @@ define('pat-scroll',[
50909
50917
$el = this.options.selector ? $(this.options.selector) : this.$el;
50910
50918
options[scroll] = this.options.offset;
50911
50919
} else {
50912
- $el = $('body, html');
50913
- options[scroll] = $(this.$el.attr('href')).offset().top;
50914
- }
50915
- $el.animate(options, {
50916
- duration: 500,
50917
- start: function() {
50918
- $('.pat-scroll').addClass('pat-scroll-animated');
50920
+ // Get the first element with overflow auto starting from the trigger
50921
+ // (the scroll container)
50922
+ // Then calculate the offset relatively to that container
50923
+ $el = $(this.$el.parents()
50924
+ .filter(function() {
50925
+ return $(this).css('overflow') === 'auto'; })
50926
+ .first())
50927
+ if (typeof $el[0] === 'undefined') {
50928
+ $el = $('html, body');
50929
+ }
50930
+
50931
+ var scroll_container = Math.floor( $el.offset().top );
50932
+ var target = Math.floor( $(this.$el.attr('href')).offset().top );
50933
+
50934
+ if (target == scroll_container) {
50935
+ options[scroll] = scroll_container;
50936
+ } else if (target >= scroll_container) {
50937
+ options[scroll] = target - scroll_container;
50938
+ $el.animate(options, {
50939
+ duration: 500,
50940
+ start: function() {
50941
+ $('.pat-scroll').addClass('pat-scroll-animated');
50942
+ }
50943
+ });
50944
+ } else {
50945
+ options[scroll] = target + scroll_container ;
50946
+ $el.animate(options, {
50947
+ duration: 500,
50948
+ start: function() {
50949
+ $('.pat-scroll').addClass('pat-scroll-animated');
50950
+ }
50951
+ });
50919
50952
}
50920
- });
50953
+ }
50921
50954
}
50922
50955
});
50923
50956
});
0 commit comments