<commit_before>/*jslint browser: true, indent: 2, todo: true, unparam: true */
/*global jQuery,Ornament /*/

/*
  Shifty is a way of moving entire blocks of dom to new areas of the page
  when a certain breakpoint is met 

  uiElements are defined on the page eg:

  $(document).on("ornament:refresh", function(){
    Ornament.C.Shifty.uiElements = [{
      desktop: $("[data-element-desktop]"),
      mobile: $("[data-element-mobile]"),
      desktopCallback: function(desktop, mobile){
        // do something when moved to desktop
      },
      mobileCallback: function(desktop, mobile){
        // do something when moved to mobile
      }
    }];
  });

  You can also customise the global layoutBreakpoint if necessary here too:
  layoutBreakpoint: 900

  Then make sure you init the listeners:
  Shifty.init();

*/

(function (document, window, $) {

  "use strict";

  var Shifty = Ornament.C.Shifty = {

    uiElements: [],
    layout: "desktop",
    layoutBreakpoint: Ornament.headerBreakpoint,

    resizeListener: function(){
      // Test to see what size the viewport is compared to the breakpoint
      if(Ornament.windowWidth() >= Shifty.layoutBreakpoint + 1) {
        // Move to desktop
        if(Shifty.layout === "mobile") {
          $.each(Shifty.uiElements, function(){
            var uiElement = this;
            uiElement.mobile.find("[data-shifty-target]").appendTo(uiElement.desktop);
            if(uiElement.desktopCallback) {
              uiElement.desktopCallback(uiElement.desktop, uiElement.mobile);
            }
          });
          Shifty.layout = "desktop";
        }
      } else {
        // Move to mobile
        if(Shifty.layout === "desktop") {
          $.each(Shifty.uiElements, function(){
            var uiElement = this;
            uiElement.desktop.find("[data-shifty-target]").appendTo(uiElement.mobile);
            if(uiElement.mobileCallback) {
              uiElement.mobileCallback(uiElement.desktop, uiElement.mobile);
            }
          });
          Shifty.layout = "mobile";
        }
      }
    },

    init: function(){
      if(Shifty.uiElements.length > 0) {
        // Update UI based on initial screen size
        Shifty.resizeListener();
        // Update UI when the screen size changes
        $(window).on("resize", Shifty.resizeListener);
      }
    }

  };

}(document, window, jQuery));<commit_msg>Removed shifty's resize listener before attaching it incase init() gets called multiple times.<commit_after>/*jslint browser: true, indent: 2, todo: true, unparam: true */
/*global jQuery,Ornament /*/

/*
  Shifty is a way of moving entire blocks of dom to new areas of the page
  when a certain breakpoint is met 

  uiElements are defined on the page eg:

  $(document).on("ornament:refresh", function(){
    Ornament.C.Shifty.uiElements = [{
      desktop: $("[data-element-desktop]"),
      mobile: $("[data-element-mobile]"),
      desktopCallback: function(desktop, mobile){
        // do something when moved to desktop
      },
      mobileCallback: function(desktop, mobile){
        // do something when moved to mobile
      }
    }];
  });

  You can also customise the global layoutBreakpoint if necessary here too:
  layoutBreakpoint: 900

  Then make sure you init the listeners:
  Shifty.init();

*/

(function (document, window, $) {

  "use strict";

  var Shifty = Ornament.C.Shifty = {

    uiElements: [],
    layout: "desktop",
    layoutBreakpoint: Ornament.headerBreakpoint,

    _resizeListener: function(){
      // Test to see what size the viewport is compared to the breakpoint
      if(Ornament.windowWidth() >= Shifty.layoutBreakpoint + 1) {
        // Move to desktop
        if(Shifty.layout === "mobile") {
          $.each(Shifty.uiElements, function(){
            var uiElement = this;
            uiElement.mobile.find("[data-shifty-target]").appendTo(uiElement.desktop);
            if(uiElement.desktopCallback) {
              uiElement.desktopCallback(uiElement.desktop, uiElement.mobile);
            }
          });
          Shifty.layout = "desktop";
        }
      } else {
        // Move to mobile
        if(Shifty.layout === "desktop") {
          $.each(Shifty.uiElements, function(){
            var uiElement = this;
            uiElement.desktop.find("[data-shifty-target]").appendTo(uiElement.mobile);
            if(uiElement.mobileCallback) {
              uiElement.mobileCallback(uiElement.desktop, uiElement.mobile);
            }
          });
          Shifty.layout = "mobile";
        }
      }
    },

    init: function(){
      if(Shifty.uiElements.length > 0) {
        // Update UI based on initial screen size
        Shifty._resizeListener();
        // Update UI when the screen size changes
        $(window).off("resize", Shifty._resizeListener).on("resize", Shifty._resizeListener);
      }
    }

  };

}(document, window, jQuery));
{'fraction_non_alphanumeric': 0.1231114740710494, 'fraction_numerical': 0.002449979583503471, 'mean_word_length': 2.3716448726772197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6543868', 'n_tokens_mistral': 1435, 'n_tokens_neox': 1380, 'n_words': 358}