[extensions-web] Do a better hack for the jQuery plugin issue



commit 8d89626ec6abf6ce6aef3ea4c120f0e4426a00ad
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Sep 26 02:07:35 2012 -0300

    Do a better hack for the jQuery plugin issue
    
    Suggested by James Burke

 sweettooth/review/templates/review/review.html |    5 +++--
 sweettooth/static/js/main.js                   |    3 ---
 sweettooth/static/js/review-main.js            |    2 +-
 sweettooth/templates/base.html                 |   10 ++++++++--
 4 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/sweettooth/review/templates/review/review.html b/sweettooth/review/templates/review/review.html
index 222b4e8..19f27dd 100644
--- a/sweettooth/review/templates/review/review.html
+++ b/sweettooth/review/templates/review/review.html
@@ -128,9 +128,10 @@
 
 {% endblock %}
 
-{% block js-main %}review-main{% endblock %}
-
 {% block head %}
   {{ block.super }}
   <link rel="stylesheet" href="/static/css/review.css" />
+  <script>
+    require(['review-main'], function(){});
+  </script>
 {% endblock %}
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index eaf2d24..2afb0ee 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -1,8 +1,5 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-// Do a horrible hack to fix jQuery plugin loading.
-require.s.contexts._.defined['jquery'] = jQuery;
-
 define(['jquery', 'messages', 'modal', 'hashParamUtils',
         'templates', 'extensions', 'uploader', 'fsui',
         'jquery.cookie', 'jquery.jeditable',
diff --git a/sweettooth/static/js/review-main.js b/sweettooth/static/js/review-main.js
index 7c6a628..c1d9ed4 100644
--- a/sweettooth/static/js/review-main.js
+++ b/sweettooth/static/js/review-main.js
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-define(['jquery', 'main', 'review'], function($) {
+define(['review'], function($) {
     "use strict";
 
     $(document).ready(function() {
diff --git a/sweettooth/templates/base.html b/sweettooth/templates/base.html
index c95826b..045e683 100644
--- a/sweettooth/templates/base.html
+++ b/sweettooth/templates/base.html
@@ -6,10 +6,16 @@
     <link rel="shortcut icon" href="/static/images/favicon.png" />
     <link rel="alternate" type="application/rss+xml"
           href="{% url extensions-rss-feed %}" title="Latest extensions in GNOME Shell Extensions" />
-    {% block head %} {% endblock %}
     <title>{% block title %}GNOME Shell Extensions{% endblock %}</title>
+    <script>
+      var require = { baseUrl: '/static/js/' };
+    </script>
+    <script src="/static/js/require.js"></script>
     <script src="/static/js/jquery.js"></script>
-    <script data-main="/static/js/{% block js-main %}main{% endblock %}.js" src="/static/js/require.js"></script>
+    <script>
+      require(['main'], function(){});
+    </script>
+    {% block head %} {% endblock %}
   </head>
   <body>
     <div id="global_domain_bar">



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]