summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2014-09-17 10:03:33 +0200
committerFabien Meghazi <fme@openerp.com>2014-09-17 14:50:12 +0200
commit8d08e067584587e9cd06a738258f2771534d6000 (patch)
tree320536040c08b5f2cb949bc4250446c7712d861d /addons/website/static/src
parent5bfad4dd52cc96ff6a290a69b5f85d7d48ef6c8f (diff)
[FIX] Bundlification remains (Fixes #2463)
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/website.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js
index f6185201035..76756c08e47 100644
--- a/addons/website/static/src/js/website.js
+++ b/addons/website/static/src/js/website.js
@@ -255,6 +255,22 @@
if($.fn.placeholder) $('input, textarea').placeholder();
});
+ /**
+ * Execute a function if the dom contains at least one element matched
+ * through the given jQuery selector. Will first wait for the dom to be ready.
+ *
+ * @param {String} selector A jQuery selector used to match the element(s)
+ * @param {Function} fn Callback to execute if at least one element has been matched
+ */
+ website.if_dom_contains = function(selector, fn) {
+ website.dom_ready.then(function () {
+ var elems = $(selector);
+ if (elems.length) {
+ fn(elems);
+ }
+ });
+ };
+
var all_ready = null;
/**
* Returns a deferred resolved when the templates are loaded
@@ -282,7 +298,7 @@
website.inject_tour = function() {
// if a tour is active inject tour js
- }
+ };
website.dom_ready.then(function () {
/* ----- PUBLISHING STUFF ---- */