From 7902987900983b9e8eba914eaaa1828b716072a8 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 3 Aug 2016 13:10:39 -0400 Subject: [PATCH] added jqueryUI to list of prefetched resources, and updated its loader to not use $.getScript(). Updated require.js files to use ?v= in the url argument for cache buster --- public/src/app.js | 6 +++++- src/meta/tags.js | 5 ++++- src/views/partials/requirejs-config.tpl | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/public/src/app.js b/public/src/app.js index e9b52ef0bf..390bde2f04 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -466,7 +466,11 @@ app.cacheBuster = null; return callback(); } - $.getScript(config.relative_path + '/vendor/jquery/js/jquery-ui-1.10.4.custom.js', callback); + var scriptEl = document.createElement('script'); + scriptEl.type = 'text/javascript'; + scriptEl.src = config.relative_path + '/vendor/jquery/js/jquery-ui-1.10.4.custom.js' + (app.cacheBuster ? '?v=' + app.cacheBuster : ''); + scriptEl.onload = callback; + document.head.appendChild(scriptEl); }; app.showEmailConfirmWarning = function(err) { diff --git a/src/meta/tags.js b/src/meta/tags.js index 3747db61da..50afe9a1db 100644 --- a/src/meta/tags.js +++ b/src/meta/tags.js @@ -46,10 +46,13 @@ module.exports = function(Meta) { var defaultLinks = [{ rel: "icon", type: "image/x-icon", - href: nconf.get('relative_path') + '/favicon.ico?' + Meta.config['cache-buster'] + href: nconf.get('relative_path') + '/favicon.ico' + (Meta.config['cache-buster'] ? '?' + Meta.config['cache-buster'] : '') }, { rel: "manifest", href: nconf.get('relative_path') + '/manifest.json' + }, { + rel: "prefetch", + href: nconf.get('relative_path') + '/vendor/jquery/js/jquery-ui-1.10.4.custom.js' + (Meta.config['cache-buster'] ? '?v=' + Meta.config['cache-buster'] : '') }]; // Touch icons for mobile-devices diff --git a/src/views/partials/requirejs-config.tpl b/src/views/partials/requirejs-config.tpl index addb5cfcaa..c11b4aa9a3 100644 --- a/src/views/partials/requirejs-config.tpl +++ b/src/views/partials/requirejs-config.tpl @@ -2,7 +2,7 @@ require.config({ baseUrl: "{relative_path}/src/modules", waitSeconds: 3, - urlArgs: "{config.cache-buster}", + urlArgs: "v={config.cache-buster}", paths: { 'forum': '../client', 'admin': '../admin',