diff options
author | Karl <kc0bfv@gmail.com> | 2020-12-19 23:14:38 +0300 |
---|---|---|
committer | Karl <kc0bfv@gmail.com> | 2020-12-19 23:14:38 +0300 |
commit | 0b48244c550b0238c15f91edaf8e190030c90ecd (patch) | |
tree | 5006ae4d209686fea7b5726751f2207b38ce9bdf /assets | |
parent | 0414cffeffaad3c1584053dc0dfd48c7f7b374d1 (diff) |
Retab main.js as all spaces
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/main.js | 486 |
1 files changed, 243 insertions, 243 deletions
diff --git a/assets/js/main.js b/assets/js/main.js index 90627e9..ee3b10b 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,314 +1,314 @@ (function($) { - skel.breakpoints({ - xlarge: '(max-width: 1680px)', - large: '(max-width: 1280px)', - medium: '(max-width: 980px)', - small: '(max-width: 736px)', - xsmall: '(max-width: 480px)' - }); + skel.breakpoints({ + xlarge: '(max-width: 1680px)', + large: '(max-width: 1280px)', + medium: '(max-width: 980px)', + small: '(max-width: 736px)', + xsmall: '(max-width: 480px)' + }); - $(function() { + $(function() { - var $window = $(window), - $body = $('body'), - $wrapper = $('#wrapper'); + var $window = $(window), + $body = $('body'), + $wrapper = $('#wrapper'); - // Hack: Enable IE workarounds. - if (skel.vars.IEVersion < 12) - $body.addClass('ie'); + // Hack: Enable IE workarounds. + if (skel.vars.IEVersion < 12) + $body.addClass('ie'); - // Touch? - if (skel.vars.mobile) - $body.addClass('touch'); + // Touch? + if (skel.vars.mobile) + $body.addClass('touch'); - // Transitions supported? - if (skel.canUse('transition')) { + // Transitions supported? + if (skel.canUse('transition')) { - // Add (and later, on load, remove) "loading" class. - $body.addClass('loading'); + // Add (and later, on load, remove) "loading" class. + $body.addClass('loading'); - $window.on('load', function() { - window.setTimeout(function() { - $body.removeClass('loading'); - }, 100); - }); + $window.on('load', function() { + window.setTimeout(function() { + $body.removeClass('loading'); + }, 100); + }); - // Prevent transitions/animations on resize. - var resizeTimeout; + // Prevent transitions/animations on resize. + var resizeTimeout; - $window.on('resize', function() { + $window.on('resize', function() { - window.clearTimeout(resizeTimeout); + window.clearTimeout(resizeTimeout); - $body.addClass('resizing'); + $body.addClass('resizing'); - resizeTimeout = window.setTimeout(function() { - $body.removeClass('resizing'); - }, 100); + resizeTimeout = window.setTimeout(function() { + $body.removeClass('resizing'); + }, 100); - }); + }); - } + } - // Scroll back to top. - $window.scrollTop(0); + // Scroll back to top. + $window.scrollTop(0); - // Fix: Placeholder polyfill. - $('form').placeholder(); + // Fix: Placeholder polyfill. + $('form').placeholder(); - // Panels. - var $panels = $('.panel'); + // Panels. + var $panels = $('.panel'); - $panels.each(function() { + $panels.each(function() { - var $this = $(this), - $toggles = $('[href="#' + $this.attr('id') + '"]'), - $closer = $('<div class="closer" />').appendTo($this); + var $this = $(this), + $toggles = $('[href="#' + $this.attr('id') + '"]'), + $closer = $('<div class="closer" />').appendTo($this); - // Closer. - $closer - .on('click', function(event) { - $this.trigger('---hide'); - }); + // Closer. + $closer + .on('click', function(event) { + $this.trigger('---hide'); + }); - // Events. - $this - .on('click', function(event) { - event.stopPropagation(); - }) - .on('---toggle', function() { + // Events. + $this + .on('click', function(event) { + event.stopPropagation(); + }) + .on('---toggle', function() { - if ($this.hasClass('active')) - $this.triggerHandler('---hide'); - else - $this.triggerHandler('---show'); + if ($this.hasClass('active')) + $this.triggerHandler('---hide'); + else + $this.triggerHandler('---show'); - }) - .on('---show', function() { + }) + .on('---show', function() { - // Hide other content. - if ($body.hasClass('content-active')) - $panels.trigger('---hide'); + // Hide other content. + if ($body.hasClass('content-active')) + $panels.trigger('---hide'); - // Activate content, toggles. - $this.addClass('active'); - $toggles.addClass('active'); + // Activate content, toggles. + $this.addClass('active'); + $toggles.addClass('active'); - // Activate body. - $body.addClass('content-active'); + // Activate body. + $body.addClass('content-active'); - }) - .on('---hide', function() { + }) + .on('---hide', function() { - // Deactivate content, toggles. - $this.removeClass('active'); - $toggles.removeClass('active'); + // Deactivate content, toggles. + $this.removeClass('active'); + $toggles.removeClass('active'); - // Deactivate body. - $body.removeClass('content-active'); + // Deactivate body. + $body.removeClass('content-active'); - }); + }); - // Toggles. - $toggles - .removeAttr('href') - .css('cursor', 'pointer') - .on('click', function(event) { + // Toggles. + $toggles + .removeAttr('href') + .css('cursor', 'pointer') + .on('click', function(event) { - event.preventDefault(); - event.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); - $this.trigger('---toggle'); + $this.trigger('---toggle'); - }); + }); - }); + }); - // Global events. - $body - .on('click', function(event) { + // Global events. + $body + .on('click', function(event) { - if ($body.hasClass('content-active')) { + if ($body.hasClass('content-active')) { - event.preventDefault(); - event.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); - $panels.trigger('---hide'); + $panels.trigger('---hide'); - } + } - }); + }); - $window - .on('keyup', function(event) { + $window + .on('keyup', function(event) { - if (event.keyCode == 27 - && $body.hasClass('content-active')) { + if (event.keyCode == 27 + && $body.hasClass('content-active')) { - event.preventDefault(); - event.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); - $panels.trigger('---hide'); + $panels.trigger('---hide'); - } + } - }); + }); - // Header. - var $header = $('#header'); + // Header. + var $header = $('#header'); - // Links. - $header.find('a').each(function() { + // Links. + $header.find('a').each(function() { - var $this = $(this), - href = $this.attr('href'); + var $this = $(this), + href = $this.attr('href'); - // Internal link? Skip. - if (!href - || href.charAt(0) == '#') - return; + // Internal link? Skip. + if (!href + || href.charAt(0) == '#') + return; - // Redirect on click. - $this - .removeAttr('href') - .css('cursor', 'pointer') - .on('click', function(event) { + // Redirect on click. + $this + .removeAttr('href') + .css('cursor', 'pointer') + .on('click', function(event) { - event.preventDefault(); - event.stopPropagation(); + event.preventDefault(); + event.stopPropagation(); - window.location.href = href; + window.location.href = href; - }); + }); - }); + }); - // Footer. - var $footer = $('#footer'); + // Footer. + var $footer = $('#footer'); - // Copyright. - // This basically just moves the copyright line to the end of the *last* sibling of its current parent - // when the "medium" breakpoint activates, and moves it back when it deactivates. - $footer.find('.copyright').each(function() { + // Copyright. + // This basically just moves the copyright line to the end of the *last* sibling of its current parent + // when the "medium" breakpoint activates, and moves it back when it deactivates. + $footer.find('.copyright').each(function() { - var $this = $(this), - $parent = $this.parent(), - $lastParent = $parent.parent().children().last(); + var $this = $(this), + $parent = $this.parent(), + $lastParent = $parent.parent().children().last(); - skel - .on('+medium', function() { - $this.appendTo($lastParent); - }) - .on('-medium', function() { - $this.appendTo($parent); - }); + skel + .on('+medium', function() { + $this.appendTo($lastParent); + }) + .on('-medium', function() { + $this.appendTo($parent); + }); - }); + }); - // Main. - var $main = $('#main'); + // Main. + var $main = $('#main'); - // Thumbs. - $main.children('.thumb').each(function() { + // Thumbs. + $main.children('.thumb').each(function() { - var $this = $(this), - $image = $this.find('.image'), $image_img = $image.children('img'), - x; + var $this = $(this), + $image = $this.find('.image'), $image_img = $image.children('img'), + x; - // No image? Bail. - if ($image.length == 0) - return; + // No image? Bail. + if ($image.length == 0) + return; - // Image. - // This sets the background of the "image" <span> to the image pointed to by its child - // <img> (which is then hidden). Gives us way more flexibility. + // Image. + // This sets the background of the "image" <span> to the image pointed to by its child + // <img> (which is then hidden). Gives us way more flexibility. - // Set background. - $image.css('background-image', 'url(' + $image_img.attr('src') + ')'); - - // Set background position. - if (x = $image_img.data('position')) - $image.css('background-position', x); - - // Hide original img. - $image_img.hide(); - - // Hack: IE<11 doesn't support pointer-events, which means clicks to our image never - // land as they're blocked by the thumbnail's caption overlay gradient. This just forces - // the click through to the image. - if (skel.vars.IEVersion < 11) - $this - .css('cursor', 'pointer') - .on('click', function() { - $image.trigger('click'); - }); - - }); - - // Thumbs Index. - $main.children('.thumb').each(function() { - - var $this = $(this), - $link = $this.find('.link'), $link_img = $link.children('img'), - x; - - // No link? Bail. - if ($link.length == 0) - return; - - // link. - // This sets the background of the "link" <span> to the link pointed to by its child - // <img> (which is then hidden). Gives us way more flexibility. - - // Set background. - $link.css('background-image', 'url(' + $link_img.attr('src') + ')'); - - // Set background position. - if (x = $link_img.data('position')) - $link.css('background-position', x); - - // Hide original img. - $link_img.hide(); - - // Hack: IE<11 doesn't support pointer-events, which means clicks to our link never - // land as they're blocked by the thumbnail's caption overlay gradient. This just forces - // the click through to the link. - if (skel.vars.IEVersion < 11) - $this - .css('cursor', 'pointer') - .on('click', function() { - $link.trigger('click'); - }); - - }); - - $(".gallery-item").magnificPopup({ - type: "image", - image: { - titleSrc: function(item) { - let caption = '<div title="Download" ' + - 'class="download-button"><a href=' + - item.el.attr("href") + ' download="' + - item.el.attr("orig_name") + - '"><i class="fa fa-download"></i></a></div>' + - '<div class="caption-surround">'; - if( item.el.attr("phototitle") ) { - caption += "<h2>" + item.el.attr("phototitle") + "</h2>"; - } - if( item.el.attr("description") ) { - caption += '<p class="description">' + - item.el.attr("description") + "</p>"; - } - caption += "</div>"; - return caption; - }, - }, - gallery:{ - enabled:true, - arrowMarkup: '<button title="%title%" class="nav-%dir%"></button>', - }, - }); - }); + // Set background. + $image.css('background-image', 'url(' + $image_img.attr('src') + ')'); + + // Set background position. + if (x = $image_img.data('position')) + $image.css('background-position', x); + + // Hide original img. + $image_img.hide(); + + // Hack: IE<11 doesn't support pointer-events, which means clicks to our image never + // land as they're blocked by the thumbnail's caption overlay gradient. This just forces + // the click through to the image. + if (skel.vars.IEVersion < 11) + $this + .css('cursor', 'pointer') + .on('click', function() { + $image.trigger('click'); + }); + + }); + + // Thumbs Index. + $main.children('.thumb').each(function() { + + var $this = $(this), + $link = $this.find('.link'), $link_img = $link.children('img'), + x; + + // No link? Bail. + if ($link.length == 0) + return; + + // link. + // This sets the background of the "link" <span> to the link pointed to by its child + // <img> (which is then hidden). Gives us way more flexibility. + + // Set background. + $link.css('background-image', 'url(' + $link_img.attr('src') + ')'); + + // Set background position. + if (x = $link_img.data('position')) + $link.css('background-position', x); + + // Hide original img. + $link_img.hide(); + + // Hack: IE<11 doesn't support pointer-events, which means clicks to our link never + // land as they're blocked by the thumbnail's caption overlay gradient. This just forces + // the click through to the link. + if (skel.vars.IEVersion < 11) + $this + .css('cursor', 'pointer') + .on('click', function() { + $link.trigger('click'); + }); + + }); + + $(".gallery-item").magnificPopup({ + type: "image", + image: { + titleSrc: function(item) { + let caption = '<div title="Download" ' + + 'class="download-button"><a href=' + + item.el.attr("href") + ' download="' + + item.el.attr("orig_name") + + '"><i class="fa fa-download"></i></a></div>' + + '<div class="caption-surround">'; + if( item.el.attr("phototitle") ) { + caption += "<h2>" + item.el.attr("phototitle") + "</h2>"; + } + if( item.el.attr("description") ) { + caption += '<p class="description">' + + item.el.attr("description") + "</p>"; + } + caption += "</div>"; + return caption; + }, + }, + gallery:{ + enabled:true, + arrowMarkup: '<button title="%title%" class="nav-%dir%"></button>', + }, + }); + }); })(jQuery); |