From ad3953f7942129e79cefbe792cfdc3fc4eca0d08 Mon Sep 17 00:00:00 2001 From: vangheem Date: Tue, 10 Feb 2015 16:21:17 -0600 Subject: [PATCH] use requirejs if available --- CHANGES.rst | 3 +++ .../app/discussion/browser/javascripts/comments.js | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 437ae9a..b0bbbb8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changelog 2.4.0 (unreleased) ------------------ +- use requirejs if available + [vangheem] + - Rename @@discussion-settings to @@discussion-controlpanel [maartenkling] diff --git a/plone/app/discussion/browser/javascripts/comments.js b/plone/app/discussion/browser/javascripts/comments.js index 927c00d..4b2ea30 100644 --- a/plone/app/discussion/browser/javascripts/comments.js +++ b/plone/app/discussion/browser/javascripts/comments.js @@ -3,7 +3,17 @@ * jQuery functions for the plone.app.discussion comment viewlet and form. * ******************************************************************************/ -(function ($) { + +if(require === undefined){ + require = function(reqs, torun){ + 'use strict'; + return torun(window.jQuery); + } +} + +require([ + 'jquery' +], function ($) { // This unnamed function allows us to use $ inside of a block of code // without permanently overwriting $. // http://docs.jquery.com/Using_jQuery_with_Other_Libraries @@ -249,4 +259,4 @@ //#JSCOVERAGE_ENDIF -}(jQuery)); +});