Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mcrwfrd/hugo-frances-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Crawford <michael@crawford.io>2019-08-09 21:27:30 +0300
committerMichael Crawford <michael@crawford.io>2019-08-09 21:27:30 +0300
commit9e16eef401db0ee6013956b92c70eae95246a313 (patch)
tree86d04bdc52c67840755a295405463abfcbdd6615
parentce6bec3d2175689eeea90b62a48a98bba7c5029b (diff)
move debounceresized to own file
-rw-r--r--layouts/partials/head.html3
-rw-r--r--static/js/debouncedresize.js40
-rw-r--r--static/js/grid.js41
3 files changed, 42 insertions, 42 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 4d7efdd..9da50c7 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -17,6 +17,7 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
-
+
+ <script src="/js/debouncedresize.js"></script>
<script src="/js/modernizr.custom.js"></script>
</head> \ No newline at end of file
diff --git a/static/js/debouncedresize.js b/static/js/debouncedresize.js
new file mode 100644
index 0000000..9f2c276
--- /dev/null
+++ b/static/js/debouncedresize.js
@@ -0,0 +1,40 @@
+/*
+* debouncedresize: special jQuery event that happens once after a window resize
+*
+* latest version and complete README available on Github:
+* https://github.com/louisremi/jquery-smartresize/blob/master/jquery.debouncedresize.js
+*
+* Copyright 2011 @louis_remi
+* Licensed under the MIT license.
+*/
+var $event = $.event,
+ $special,
+ resizeTimeout;
+
+$special = $event.special.debouncedresize = {
+ setup: function() {
+ $( this ).on( "resize", $special.handler );
+ },
+ teardown: function() {
+ $( this ).off( "resize", $special.handler );
+ },
+ handler: function( event, execAsap ) {
+ // Save the context
+ var context = this,
+ args = arguments,
+ dispatch = function() {
+ // set correct event type
+ event.type = "debouncedresize";
+ $event.dispatch.apply( context, args );
+ };
+
+ if ( resizeTimeout ) {
+ clearTimeout( resizeTimeout );
+ }
+
+ execAsap ?
+ dispatch() :
+ resizeTimeout = setTimeout( dispatch, $special.threshold );
+ },
+ threshold: 250
+}; \ No newline at end of file
diff --git a/static/js/grid.js b/static/js/grid.js
index e22695e..42ae34b 100644
--- a/static/js/grid.js
+++ b/static/js/grid.js
@@ -1,44 +1,3 @@
-/*
-* debouncedresize: special jQuery event that happens once after a window resize
-*
-* latest version and complete README available on Github:
-* https://github.com/louisremi/jquery-smartresize/blob/master/jquery.debouncedresize.js
-*
-* Copyright 2011 @louis_remi
-* Licensed under the MIT license.
-*/
-var $event = $.event,
- $special,
- resizeTimeout;
-
-$special = $event.special.debouncedresize = {
- setup: function() {
- $( this ).on( "resize", $special.handler );
- },
- teardown: function() {
- $( this ).off( "resize", $special.handler );
- },
- handler: function( event, execAsap ) {
- // Save the context
- var context = this,
- args = arguments,
- dispatch = function() {
- // set correct event type
- event.type = "debouncedresize";
- $event.dispatch.apply( context, args );
- };
-
- if ( resizeTimeout ) {
- clearTimeout( resizeTimeout );
- }
-
- execAsap ?
- dispatch() :
- resizeTimeout = setTimeout( dispatch, $special.threshold );
- },
- threshold: 250
-};
-
// ======================= imagesLoaded Plugin ===============================
// https://github.com/desandro/imagesloaded