Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Map Tour 2.13.0
  • Loading branch information
cooney committed Oct 1, 2018
1 parent 663f3d4 commit 28d7059
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 58 deletions.
2 changes: 1 addition & 1 deletion MapTour/package.json
@@ -1,6 +1,6 @@
{
"name": "StorytellingMapTour",
"version": "2.12.0",
"version": "2.13.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.4.0",
Expand Down
31 changes: 0 additions & 31 deletions MapTour/src/app/storymaps/builder/Builder.js
Expand Up @@ -103,38 +103,7 @@ define(["esri/arcgis/Portal",
// Show https-transition notification when app loads
if (!app.isPortal) {
topic.subscribe('maptour-ready', function() {
var stringsSurvey = i18n.viewer.june2018SurveyMessage;
var stringsHttps = i18n.viewer.httpsTransitionNotification;
new BannerNotification({
id: "storymapsSurvey",
bannerMsg: stringsSurvey.bannerMsg,
primaryColor: '#1e8a87',
mainMsgHtml: '\
<h2>' + stringsSurvey.s1h1 + '</h2>\
<p>' + stringsSurvey.s1p1 + '</p>\
<p>' + stringsSurvey.s2p1 + '</p>\
',
actions: [
{
string: stringsSurvey.action1,
closeOnAction: true
},
{
primary: true,
string: stringsSurvey.action2,
closeOnAction: true,
action: function() {
window.open('https://links.esri.com/storymaps/june2018-survey');
}
}
],
cookie: {
domain: 'arcgis.com',
path: '/',
maxAge: 60 * 60 * 24 * 365
},
autohideAfter: new Date() > new Date(/*'July 31 2018'*/) ? 0 : 2
});
new BannerNotification({
id: "httpsTransitionMessage",
bannerMsg: stringsHttps.bannerMsg,
Expand Down
6 changes: 5 additions & 1 deletion MapTour/src/app/storymaps/core/Core.js
Expand Up @@ -176,7 +176,11 @@ define(["esri/map",
userCanEdit: false,
sanitizer: new Sanitizer({
whiteList: {
hr: []
hr: [],
// needed for <audio> and <video> tags
// in featurecollections (because src gets
// stripped by agol)
source: ['src', 'type']
}
}, true)
};
Expand Down
Expand Up @@ -63,6 +63,8 @@ define([
// The number of times to show the banner message before it doesn't shown
// again.
autohideAfter: typeof options.autohideAfter !== 'undefined' ? options.autohideAfter : 2,
// The number of milliseconds after which the banner will disappear.
fadeAfter: typeof options.fadeAfter !== 'undefined' ? options.fadeAfter : 30000,
// The IDs of other banner notification that will block this banner from
// showing if their hidden cookie has not been set. This allows you to
// only show a single banner per app load.
Expand All @@ -73,48 +75,54 @@ define([
var cookieKey = 'bannerNotification_' + settings.id + '_hidden';

var setDontShowCookie = function(incrementAutoHide) {
var domain = settings.cookie.domain ? "domain=" + settings.cookie.domain + ";" : "";
var path = settings.cookie.path ? "path=" + settings.cookie.path + ";" : "";
var domain = settings.cookie.domain ? 'domain=' + settings.cookie.domain + ';' : '';
var path = settings.cookie.path ? 'path=' + settings.cookie.path + ';' : '';
var maxAge = new Date(new Date().getTime() + (settings.cookie.maxAge * 1000)).toUTCString();
var dontShowCheckbox = document.querySelector('#'+ settings.id + '-banner-notification-dont-show');
if (dontShowCheckbox && dontShowCheckbox.checked) {
document.cookie = cookieKey + "=true;expires=" + maxAge + ";" + domain + path;
} else if (incrementAutoHide === true) {
var cookieValue = document.cookie.replace(new RegExp("(?:(?:^|.*;\\s*)" + cookieKey + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
var cookieInt = parseInt(cookieValue, 0);
document.cookie = cookieKey + '=true;expires=' + maxAge + ';' + domain + path;
}
else if (incrementAutoHide === true) {
var cookieValue = document.cookie.replace(new RegExp('(?:(?:^|.*;\\s*)' + cookieKey + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1');
var cookieInt = parseInt(cookieValue, 10);
if (settings.autohideAfter === 0) {
document.cookie = cookieKey + "=true;expires=" + maxAge + ";" + domain + path;
} else if (cookieValue.length === 0) {
document.cookie = cookieKey + "=0;expires=" + maxAge + ";" + domain + path;
} else if (cookieInt !== isNaN && cookieInt < settings.autohideAfter - 1) {
document.cookie = cookieKey + "=" + (cookieInt + 1) + ";expires=" + maxAge + ";" + domain + path;
} else if (cookieInt !== isNaN && cookieInt >= settings.autohideAfter - 1) {
document.cookie = cookieKey + '=true;expires=' + maxAge + ';' + domain + path;
}
else if (cookieValue.length === 0) {
document.cookie = cookieKey + '=0;expires=' + maxAge + ';' + domain + path;
}
else if (cookieInt !== isNaN && cookieInt < settings.autohideAfter - 1) {
document.cookie = cookieKey + '=' + (cookieInt + 1) + ';expires=' + maxAge + ';' + domain + path;
}
else if (cookieInt !== isNaN && cookieInt >= settings.autohideAfter - 1) {
window.onbeforeunload = function() {
var cv = document.cookie.replace(new RegExp("(?:(?:^|.*;\\s*)" + cookieKey + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
var cv = document.cookie.replace(new RegExp('(?:(?:^|.*;\\s*)' + cookieKey + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1');
if (cv !== 'false') {
document.cookie = cookieKey + "=true;expires=" + maxAge + ";" + domain + path;
document.cookie = cookieKey + '=true;expires=' + maxAge + ';' + domain + path;
}
};
}
} else {
document.cookie = cookieKey + "=false;expires=" + maxAge + ";" + domain + path;
}
else {
document.cookie = cookieKey + '=false;expires=' + maxAge + ';' + domain + path;
}
};

var bannerTimer;
var isNotificationBlocked = function() {
var isBlocked = false;
var blockingNotifications = [].concat(settings.blockingNotifications);

for (var i = 0; i < blockingNotifications.length; i++) {
if (document.cookie.replace(new RegExp("(?:(?:^|.*;\\s*)bannerNotification_" + blockingNotifications[i] + "_hidden\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1") !== 'true') {
if (document.cookie.replace(new RegExp('(?:(?:^|.*;\\s*)bannerNotification_' + blockingNotifications[i] + '_hidden\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1') !== 'true') {
isBlocked = true;
}
}
return isBlocked;
};

var isHidden = function () {
var cookieValue = document.cookie.replace(new RegExp("(?:(?:^|.*;\\s*)" + cookieKey + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
var cookieValue = document.cookie.replace(new RegExp('(?:(?:^|.*;\\s*)' + cookieKey + '\\s*\\=\\s*([^;]*).*$)|^.*$'), "$1");
if (settings.autohideAfter === 0) {
setDontShowCookie(true);
return true;
Expand Down Expand Up @@ -154,6 +162,7 @@ define([
margin: 0;\
padding: 3px 6px;\
border-radius: 3px;\
text-transform: uppercase;\
width: auto;\
overflow: visible;\
background: inherit;\
Expand Down Expand Up @@ -407,10 +416,13 @@ define([

document.querySelector('#' + settings.id + '-banner-notification-dont-show').checked = true;
setDontShowCookie();
clearTimeout(bannerTimer);
};

var closeMessage = function (e) {
e.stopPropagation();
if (e && e.stopPropagation) {
e.stopPropagation();
}

document.removeEventListener('keyup', escapeEvent);
window.removeEventListener('resize', resizeMainMsg);
Expand Down Expand Up @@ -456,6 +468,8 @@ define([
}
});
}
// Close message if ignored by author when bannerTimer expires
bannerTimer = setTimeout(closeMessage, settings.fadeAfter);

// Don't show again checkbox
dontShowCheckbox.addEventListener('click', setDontShowCookie);
Expand Down
4 changes: 2 additions & 2 deletions MapTour/src/app/storymaps/utils/PicasaConnector.js
Expand Up @@ -62,8 +62,8 @@ define(["dojo/Deferred"],

// If the builder is used in HTTPS, the picture will have an HTTPS url
// Some browser won't load picture using HTTPS when the app is accessed over HTTP
picUrl = picUrl.replace('https://', 'http://');
thumbUrl = thumbUrl.replace('https://', 'http://');
picUrl = picUrl.replace('http://', 'https://');
thumbUrl = thumbUrl.replace('http://', 'https://');

var photo = {
name: item["media$group"]["media$description"]["$t"] || '',
Expand Down
3 changes: 3 additions & 0 deletions MapTour/src/app/storymaps/utils/YoutubeConnector.js
Expand Up @@ -21,6 +21,7 @@ define(["dojo/Deferred"],

$.ajax({
url: userRqStr,
dataType: 'json',
timeout: 4000
}).then(
function(userRqResponse){
Expand All @@ -40,6 +41,7 @@ define(["dojo/Deferred"],

$.ajax({
url: rqStr + '&maxResults=' + nbResultRq1,
dataType: 'json',
timeout: 4000
}).then(
function(response){
Expand All @@ -52,6 +54,7 @@ define(["dojo/Deferred"],

$.ajax({
url: rqStr,
dataType: 'json',
timeout: 4000
}).then(
function(response){
Expand Down
8 changes: 4 additions & 4 deletions MapTour/src/index.html
Expand Up @@ -72,7 +72,7 @@
</script>

<script type="text/javascript">
var version = '2.12.1';
var version = '2.13.0';
var isProduction = false;
// IE 9 and below are not compatible with script async attribute.
var canUseAsyncAttr = true;
Expand Down Expand Up @@ -115,8 +115,8 @@
document.getElementsByTagName("head")[0].appendChild(el);
}

loadCSS("https://js.arcgis.com/3.25/esri/css/esri.css", true);
loadCSS("https://js.arcgis.com/3.25/dijit/themes/claro/claro.css", true);
loadCSS("https://js.arcgis.com/3.26/esri/css/esri.css", true);
loadCSS("https://js.arcgis.com/3.26/dijit/themes/claro/claro.css", true);

if( isProduction ) {
loadCSS("app/maptour-min.css");
Expand Down Expand Up @@ -1250,7 +1250,7 @@ <h3></h3>
</table>
</div>

<script src="https://js.arcgis.com/3.25/init.js"></script>
<script src="https://js.arcgis.com/3.26/init.js"></script>
<script type="text/javascript">
loadJS('app/maptour-config.js');

Expand Down

0 comments on commit 28d7059

Please sign in to comment.