diff --git a/dist/js/scripts.js b/dist/js/scripts.js index f7aced5..e938075 100644 --- a/dist/js/scripts.js +++ b/dist/js/scripts.js @@ -1,2 +1,2 @@ -!function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([,function(e,t){var r,n,o;r=Drupal,n=jQuery,o=this,r.behaviors.stanford_starter={attach:function(){n(o).load(function(){}),n(o).resize(function(){}),n(o).scroll(function(){})}}}]); +!function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1)}([,function(e,t,n){"use strict";n.r(t);n(2)},function(e,t){window.Drupal.behaviors.stanford_starter={attach:function(){},detach:function(){}}}]); //# sourceMappingURL=scripts.js.map \ No newline at end of file diff --git a/src/js/scripts.js b/src/js/scripts.js index 14a6a98..1f1f0c1 100644 --- a/src/js/scripts.js +++ b/src/js/scripts.js @@ -1,36 +1,2 @@ -/** - * @file - * A JavaScript file for the theme. - * - * In order for this JavaScript to be loaded on pages, see the instructions in - * the README.txt next to this file. - */ - -// JavaScript should be made compatible with libraries other than jQuery by -// wrapping it with an "anonymous closure". See: -// - https://drupal.org/node/1446420 -// - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth -(function (Drupal, $, window) { - - // To understand behaviors, see https://www.drupal.org/node/2269515 - Drupal.behaviors.stanford_starter = { - attach: function (context, settings) { - - // Execute code once the DOM is ready. $(document).ready() not required within Drupal.behaviors. - - $(window).load(function () { - // Execute code once the window is fully loaded. - }); - - $(window).resize(function () { - // Execute code when the window is resized. - }); - - $(window).scroll(function () { - // Execute code when the window scrolls. - }); - - } - }; - -} (Drupal, jQuery, this)); +// Theme code. +import './stanford_starter.behaviors.js'; diff --git a/src/js/stanford_starter.behaviors.js b/src/js/stanford_starter.behaviors.js new file mode 100644 index 0000000..12bce00 --- /dev/null +++ b/src/js/stanford_starter.behaviors.js @@ -0,0 +1,21 @@ +/** + * Behavior Example that works with Webpack. + * + * @see: https://www.npmjs.com/package/drupal-behaviors-loader + * + * Webpack wraps everything in enclosures and hides the global variables from + * scripts so special handling is needed. + */ + +export default { + + // Attach Drupal Behavior. + attach (context, settings) { + // console.log("Attached."); + }, + + // Detach Example. + detach () { + // console.log("Detached."); + } +}