From 3b2f5ad9a6bc93db024ddec69b8ea34ed4b86144 Mon Sep 17 00:00:00 2001
From: Dries <dries@buytaert.net>
Date: Wed, 27 Jun 2012 16:41:36 -0400
Subject: [PATCH] - Patch #1260800 by David_Rothstein, lewisnyman, yoroy, nod_,
 thedavidmeister, effulgentsia: kill the overlay for widths below 640 pixels.

---
 core/misc/drupal.js                    | 9 +++++++++
 core/modules/overlay/overlay-parent.js | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/core/misc/drupal.js b/core/misc/drupal.js
index b2b01641c231..8da29fd8d41e 100644
--- a/core/misc/drupal.js
+++ b/core/misc/drupal.js
@@ -112,6 +112,15 @@ Drupal.detachBehaviors = function (context, settings, trigger) {
   }
 };
 
+/**
+ * Helper to test document width for mobile configurations.
+ * @todo Temporary solution for the mobile initiative.
+ */
+Drupal.checkWidthBreakpoint = function (width) {
+  width = width || Drupal.settings.widthBreakpoint || 640;
+  return (document.documentElement.clientWidth > width);
+};
+
 /**
  * Encode special characters in a plain-text string for display as HTML.
  *
diff --git a/core/modules/overlay/overlay-parent.js b/core/modules/overlay/overlay-parent.js
index 48a206bafedb..9c0b527f6097 100644
--- a/core/modules/overlay/overlay-parent.js
+++ b/core/modules/overlay/overlay-parent.js
@@ -23,6 +23,12 @@ Drupal.behaviors.overlayParent = {
       // permalinks open the overlay.
       .triggerHandler('hashchange.drupal-overlay');
 
+    // Do not use the overlay on devices with low screen width.
+    // @todo Replace with conditional loading.
+    if(!Drupal.checkWidthBreakpoint()) {
+      return;
+    }
+
     $(document)
       // Instead of binding a click event handler to every link we bind one to
       // the document and only handle events that bubble up. This allows other
-- 
GitLab