Permalink
Browse files

Merge pull request #1055 from tlemburg/events-widget-https-fix

Force events widgets to use https to retrieve events
  • Loading branch information...
mfairchild365 committed Mar 7, 2017
2 parents 2bde94c + 8e51e22 commit 9dae8df39db9839268e3a6537ebb1afd789e2b76
@@ -19,7 +19,7 @@ define([
},
container = '#events-band',
defaultCal = '//events.unl.edu/';
defaultCal = 'https://events.unl.edu/';
var fetchEvents = function(localConfig) {
var upcoming = 'upcoming/',
@@ -94,6 +94,13 @@ define([
},
localConfig = $.extend({}, defaultConfig, config);
// ensure that the URL we are about to use is forced into an https:// protocol. (add https if it starts with //)
if (localConfig.url && localConfig.url.match(/^\/\//)) {
localConfig.url = 'https:' + localConfig.url;
} else if (localConfig.url && localConfig.url.match(/^http:\/\//)) {
localConfig.url = localConfig.url.replace('http://', 'https://');
}
if (localConfig.url && $(localConfig.container).length) {
fetchEvents(localConfig);
}
@@ -18,7 +18,7 @@ define([
return eventParams || {};
},
container = '#wdn_calendarDisplay',
defaultCal = '//events.unl.edu/';
defaultCal = 'https://events.unl.edu/';
var display = function(data, config) {
var $container = $(config.container).addClass('wdn-calendar');
@@ -97,6 +97,13 @@ define([
},
localConfig = $.extend({}, defaultConfig, config);
// ensure that the URL we are about to use is forced into an https:// protocol. (add https if it starts with //)
if (localConfig.url && localConfig.url.match(/^\/\//)) {
localConfig.url = 'https:' + localConfig.url;
} else if (localConfig.url && localConfig.url.match(/^http:\/\//)) {
localConfig.url = localConfig.url.replace('http://', 'https://');
}
if (localConfig.url && $(localConfig.container).length) {
$(this.container).addClass('wdn-calendar');
$.getJSON(localConfig.url + 'upcoming/?format=json&limit=' + encodeURIComponent(localConfig.limit), function(data) {
@@ -21,7 +21,7 @@ define([
return eventParams || {};
},
container = '#monthwidget',
defaultCal = '//events.unl.edu/';
defaultCal = 'https://events.unl.edu/';
var display = function(data, config) {
var $container = $(config.container);
@@ -109,6 +109,13 @@ define([
},
localConfig = $.extend({}, defaultConfig, config);
// ensure that the URL we are about to use is forced into an https:// protocol. (add https if it starts with //)
if (localConfig.url && localConfig.url.match(/^\/\//)) {
localConfig.url = 'https:' + localConfig.url;
} else if (localConfig.url && localConfig.url.match(/^http:\/\//)) {
localConfig.url = localConfig.url.replace('http://', 'https://');
}
if (localConfig.url && $(localConfig.container).length) {
$.get(localConfig.url + '?monthwidget&format=hcalendar', function(data) {
display(data, localConfig);

0 comments on commit 9dae8df

Please sign in to comment.