From f1cbc9ff297dc15f5d65ccc4194ad31025bb076b Mon Sep 17 00:00:00 2001 From: Mark Cooney Date: Tue, 3 Jul 2018 10:44:35 -0700 Subject: [PATCH] Swipe 1.15.0 --- Swipe/Gruntfile.js | 522 ++-- Swipe/package.json | 32 +- Swipe/src/app/storymaps/builder/Builder.js | 61 +- Swipe/src/app/storymaps/core/Core.js | 51 +- .../storymaps/swipe/ui/desktop/SidePanel.js | 2 + .../src/app/storymaps/ui/EmbedBar/EmbedBar.js | 520 ++++ .../bannerNotification/BannerNotification.js | 100 +- .../ui/inlineFieldEdit/InlineFieldEdit.js | 56 +- .../storymaps/utils/arcgis-html-sanitizer.js | 2201 +++++++++++++++++ Swipe/src/app/swipe-config.js | 3 + Swipe/src/index.html | 17 +- Swipe/src/resources/icons/esri-logo-black.png | Bin 0 -> 12474 bytes Swipe/src/resources/nls/ar/template.js | 26 + Swipe/src/resources/nls/bs/template.js | 26 + Swipe/src/resources/nls/ca/template.js | 337 +++ Swipe/src/resources/nls/cs/template.js | 26 + Swipe/src/resources/nls/da/template.js | 26 + Swipe/src/resources/nls/de/template.js | 26 + Swipe/src/resources/nls/el/template.js | 26 + Swipe/src/resources/nls/es/template.js | 26 + Swipe/src/resources/nls/et/template.js | 26 + Swipe/src/resources/nls/fi/template.js | 26 + Swipe/src/resources/nls/fr/template.js | 26 + Swipe/src/resources/nls/he/template.js | 26 + Swipe/src/resources/nls/hi/template.js | 26 + Swipe/src/resources/nls/hr/template.js | 26 + Swipe/src/resources/nls/hu/template.js | 337 +++ Swipe/src/resources/nls/id/template.js | 26 + Swipe/src/resources/nls/it/template.js | 26 + Swipe/src/resources/nls/ja/template.js | 26 + Swipe/src/resources/nls/ko/template.js | 26 + Swipe/src/resources/nls/lt/template.js | 26 + Swipe/src/resources/nls/lv/template.js | 26 + Swipe/src/resources/nls/nb/template.js | 26 + Swipe/src/resources/nls/nl/template.js | 26 + Swipe/src/resources/nls/pl/template.js | 26 + Swipe/src/resources/nls/pt-br/template.js | 26 + Swipe/src/resources/nls/pt-pt/template.js | 26 + Swipe/src/resources/nls/ro/template.js | 26 + Swipe/src/resources/nls/ru/template.js | 26 + Swipe/src/resources/nls/sl/template.js | 26 + Swipe/src/resources/nls/sr/template.js | 26 + Swipe/src/resources/nls/sv/template.js | 26 + Swipe/src/resources/nls/template.js | 30 +- Swipe/src/resources/nls/th/template.js | 26 + Swipe/src/resources/nls/tr/template.js | 26 + Swipe/src/resources/nls/vi/template.js | 26 + Swipe/src/resources/nls/zh-cn/template.js | 26 + Swipe/src/resources/nls/zh-hk/template.js | 26 + Swipe/src/resources/nls/zh-tw/template.js | 26 + 50 files changed, 4823 insertions(+), 356 deletions(-) create mode 100644 Swipe/src/app/storymaps/ui/EmbedBar/EmbedBar.js create mode 100644 Swipe/src/app/storymaps/utils/arcgis-html-sanitizer.js create mode 100644 Swipe/src/resources/icons/esri-logo-black.png create mode 100644 Swipe/src/resources/nls/ca/template.js create mode 100644 Swipe/src/resources/nls/hu/template.js diff --git a/Swipe/Gruntfile.js b/Swipe/Gruntfile.js index c8ab7cf..d34293f 100644 --- a/Swipe/Gruntfile.js +++ b/Swipe/Gruntfile.js @@ -1,261 +1,261 @@ -(function() { - module.exports = function(grunt) { - var APP_NAME = 'swipe'; - - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - - clean: { - deploy: ['deploy/*'], - css: [ - 'deploy/app/Responsive.css', - 'deploy/app/css/', - 'deploy/app/' + APP_NAME + '-css-app-min.css', - 'deploy/app/' + APP_NAME + '-css-lib-min.css' - ], - jsLib: ['deploy/app/lib/'], - jsTmp: [ - 'deploy/app/' + APP_NAME + '-app-viewer-min.js', - 'deploy/app/' + APP_NAME + '-app-builder-min.js', - 'deploy/app/' + APP_NAME + '-lib-min.js' - ] - }, - - concat: { - options: {separator: ';'}, - jsLib: { - src: ['deploy/app/lib/**/*.js'], - dest: 'deploy/app/' + APP_NAME + '-lib-min.js' - }, - viewerJS: { - src: ['deploy/app/' + APP_NAME + '-lib-min.js', 'deploy/app/' + APP_NAME + '-app-viewer-min.js'], - dest: 'deploy/app/' + APP_NAME + '-viewer-min.js' - }, - builderJS: { - src: ['deploy/app/' + APP_NAME + '-lib-min.js', 'deploy/app/' + APP_NAME + '-app-builder-min.js'], - dest: 'deploy/app/' + APP_NAME + '-builder-min.js' - }, - css: { - src: ['deploy/app/' + APP_NAME + '-css-lib-min.css', 'deploy/app/' + APP_NAME + '-css-app-min.css'], - dest: 'deploy/app/' + APP_NAME + '-min.css' - } - }, - - uglify: { - jsLib: { - files: [{ - expand: true, - cwd: 'src/lib', - src:['**/*.js'], - dest: 'deploy/app/lib', - }] - } - }, - - requirejs: { - options: { - baseUrl: "src/app/", - paths: { - 'dojo': 'empty:', - 'esri': 'empty:', - 'dijit': 'empty:', - 'dojox': 'empty:', - // SelectMapWidget config - 'dgrid': 'empty:', - 'put-selector': 'empty:', - 'lib-build': '../lib-build/', - 'text': '../lib-build/text' - }, - stubModules: [ - 'text' - ] - }, - viewer: { - options: { - name: 'storymaps/' + APP_NAME + '/BuildConfigViewer', - out: 'deploy/app/' + APP_NAME + '-app-viewer-min.js' - } - }, - builder: { - options: { - name: 'storymaps/' + APP_NAME + '/BuildConfigBuilder', - out: 'deploy/app/' + APP_NAME + '-app-builder-min.js' - } - } - }, - - cssmin: { - app: { - src: ['deploy/app/css/**/*.css', 'deploy/app/Responsive.css'], - dest: 'deploy/app/' + APP_NAME + '-css-app-min.css' - }, - lib: { - src: ['src/lib/**/*.css'], - dest: 'deploy/app/' + APP_NAME + '-css-lib-min.css' - } - - }, - - copy: { - css: { - files: [ - { - expand: 'true', - cwd: 'src/app/', - src: ['**/*.css'], - dest: 'deploy/app/css/' - } - ] - }, - html: { - files: [{ - expand: true, - cwd: 'src', - src:['*.html'], - dest: 'deploy/' - }] - }, - resources: { - files: [{ - expand: true, - cwd: 'src', - src:['resources/**'], - dest: 'deploy/' - }] - }, - config: { - files: [{ - expand: true, - cwd: 'src', - src:['app/' + APP_NAME + '-config.js'], - dest: 'deploy/' - }] - }, - mainApp: { - files: [{ - expand: true, - cwd: 'src', - src:['app/main-app.js'], - dest: 'deploy/' - }] - }, - bootstrapResources: { - files: [{ - expand: true, - cwd: 'src/lib/bootstrap/img/', - src:['*'], - dest: 'deploy/resources/bootstrap/' - }] - } - }, - - rename: { - moveResponsiveCss: { - src: 'deploy/app/css/storymaps/' + APP_NAME + '/ui/Responsive.css', - dest: 'deploy/app/Responsive.css' - } - }, - - "regex-replace": { - css: { - src: ['deploy/app/' + APP_NAME + '-min.css'], - actions: [ - { - name: 'Project images path', - search: '../../(../)*', - replace: '../', - flags: 'g' - }, - { - name: 'Bootstrap images path', - search: '../img/', - replace: '../resources/bootstrap/', - flags: 'g' - } - ] - }, - js: { - src: ['deploy/app/*.js'], - actions: [ - { - name: 'Minified JS variable 1', - search: 'TPL_ENV_DEV', - replace: 'TPL_ENV_PRODUCTION' - } - ] - }, - index: { - src: ['deploy/index.html'], - actions: [ - { - name: 'Index.html variables', - search: 'var isProduction = false;', - replace: 'var isProduction = true;' - } - ] - } - }, - - jshint: { - files: ['src/app/**/*.js'], - options: {jshintrc: '.jshintrc'} - } - }); - - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-requirejs'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-regex-replace'); - grunt.loadNpmTasks('grunt-rename'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - - grunt.registerTask('test', ['jshint']); - - grunt.registerTask('default', [ - 'clean:deploy', - - /* - * Minify and concat external libraries JS using uglify - */ - 'uglify:jsLib', - 'concat:jsLib', - 'clean:jsLib', - - /* - * Minify project JS using require.js - * - require.js output a .js for with only the viewer and a .js with viewer and builder - * - concat those .js with lib's JS - * - perform production mode replacement in JS files - */ - 'requirejs', - 'concat:viewerJS', - 'concat:builderJS', - 'clean:jsTmp', - 'regex-replace:js', - - /* - * Minify CSS - * - start by copying all project's css in a tmp folder and exclude Responsive.css - * - minify CSS of the application (Responsive.css is added at the end) and libraries CSS - * - concat libraries css and application css - * - perform resources path replacement - */ - 'copy:css', - 'rename:moveResponsiveCss', - 'cssmin', - 'concat:css', - 'regex-replace:css', - 'clean:css', - - 'copy:html', - 'regex-replace:index', - 'copy:config', - 'copy:mainApp', - 'copy:bootstrapResources', - 'copy:resources' - ]); - }; -})(); +(function() { + module.exports = function(grunt) { + var APP_NAME = 'swipe'; + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + + clean: { + deploy: ['deploy/*'], + css: [ + 'deploy/app/Responsive.css', + 'deploy/app/css/', + 'deploy/app/' + APP_NAME + '-css-app-min.css', + 'deploy/app/' + APP_NAME + '-css-lib-min.css' + ], + jsLib: ['deploy/app/lib/'], + jsTmp: [ + 'deploy/app/' + APP_NAME + '-app-viewer-min.js', + 'deploy/app/' + APP_NAME + '-app-builder-min.js', + 'deploy/app/' + APP_NAME + '-lib-min.js' + ] + }, + + concat: { + options: {separator: ';'}, + jsLib: { + src: ['deploy/app/lib/**/*.js'], + dest: 'deploy/app/' + APP_NAME + '-lib-min.js' + }, + viewerJS: { + src: ['deploy/app/' + APP_NAME + '-lib-min.js', 'deploy/app/' + APP_NAME + '-app-viewer-min.js'], + dest: 'deploy/app/' + APP_NAME + '-viewer-min.js' + }, + builderJS: { + src: ['deploy/app/' + APP_NAME + '-lib-min.js', 'deploy/app/' + APP_NAME + '-app-builder-min.js'], + dest: 'deploy/app/' + APP_NAME + '-builder-min.js' + }, + css: { + src: ['deploy/app/' + APP_NAME + '-css-lib-min.css', 'deploy/app/' + APP_NAME + '-css-app-min.css'], + dest: 'deploy/app/' + APP_NAME + '-min.css' + } + }, + + uglify: { + jsLib: { + files: [{ + expand: true, + cwd: 'src/lib', + src:['**/*.js'], + dest: 'deploy/app/lib', + }] + } + }, + + requirejs: { + options: { + baseUrl: "src/app/", + paths: { + 'dojo': 'empty:', + 'esri': 'empty:', + 'dijit': 'empty:', + 'dojox': 'empty:', + // SelectMapWidget config + 'dgrid': 'empty:', + 'put-selector': 'empty:', + 'lib-build': '../lib-build/', + 'text': '../lib-build/text' + }, + stubModules: [ + 'text' + ] + }, + viewer: { + options: { + name: 'storymaps/' + APP_NAME + '/BuildConfigViewer', + out: 'deploy/app/' + APP_NAME + '-app-viewer-min.js' + } + }, + builder: { + options: { + name: 'storymaps/' + APP_NAME + '/BuildConfigBuilder', + out: 'deploy/app/' + APP_NAME + '-app-builder-min.js' + } + } + }, + + cssmin: { + app: { + src: ['deploy/app/css/**/*.css', 'deploy/app/Responsive.css'], + dest: 'deploy/app/' + APP_NAME + '-css-app-min.css' + }, + lib: { + src: ['src/lib/**/*.css'], + dest: 'deploy/app/' + APP_NAME + '-css-lib-min.css' + } + + }, + + copy: { + css: { + files: [ + { + expand: 'true', + cwd: 'src/app/', + src: ['**/*.css'], + dest: 'deploy/app/css/' + } + ] + }, + html: { + files: [{ + expand: true, + cwd: 'src', + src:['*.html'], + dest: 'deploy/' + }] + }, + resources: { + files: [{ + expand: true, + cwd: 'src', + src:['resources/**'], + dest: 'deploy/' + }] + }, + config: { + files: [{ + expand: true, + cwd: 'src', + src:['app/' + APP_NAME + '-config.js'], + dest: 'deploy/' + }] + }, + mainApp: { + files: [{ + expand: true, + cwd: 'src', + src:['app/main-app.js'], + dest: 'deploy/' + }] + }, + bootstrapResources: { + files: [{ + expand: true, + cwd: 'src/lib/bootstrap/img/', + src:['*'], + dest: 'deploy/resources/bootstrap/' + }] + } + }, + + rename: { + moveResponsiveCss: { + src: 'deploy/app/css/storymaps/' + APP_NAME + '/ui/Responsive.css', + dest: 'deploy/app/Responsive.css' + } + }, + + "regex-replace": { + css: { + src: ['deploy/app/' + APP_NAME + '-min.css'], + actions: [ + { + name: 'Project images path', + search: '../../(../)*', + replace: '../', + flags: 'g' + }, + { + name: 'Bootstrap images path', + search: '../img/', + replace: '../resources/bootstrap/', + flags: 'g' + } + ] + }, + js: { + src: ['deploy/app/*.js'], + actions: [ + { + name: 'Minified JS variable 1', + search: 'TPL_ENV_DEV', + replace: 'TPL_ENV_PRODUCTION' + } + ] + }, + index: { + src: ['deploy/index.html'], + actions: [ + { + name: 'Index.html variables', + search: 'var isProduction = false;', + replace: 'var isProduction = true;' + } + ] + } + }, + + jshint: { + files: ['src/app/**/*.js'], + options: {jshintrc: '.jshintrc'} + } + }); + + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-requirejs'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-regex-replace'); + grunt.loadNpmTasks('grunt-rename'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + + grunt.registerTask('test', ['jshint']); + + grunt.registerTask('default', [ + 'clean:deploy', + + /* + * Minify and concat external libraries JS using uglify + */ + 'uglify:jsLib', + 'concat:jsLib', + 'clean:jsLib', + + /* + * Minify project JS using require.js + * - require.js output a .js for with only the viewer and a .js with viewer and builder + * - concat those .js with lib's JS + * - perform production mode replacement in JS files + */ + 'requirejs', + 'concat:viewerJS', + 'concat:builderJS', + 'clean:jsTmp', + 'regex-replace:js', + + /* + * Minify CSS + * - start by copying all project's css in a tmp folder and exclude Responsive.css + * - minify CSS of the application (Responsive.css is added at the end) and libraries CSS + * - concat libraries css and application css + * - perform resources path replacement + */ + 'copy:css', + 'rename:moveResponsiveCss', + 'cssmin', + 'concat:css', + 'regex-replace:css', + 'clean:css', + + 'copy:html', + 'regex-replace:index', + 'copy:config', + 'copy:mainApp', + 'copy:bootstrapResources', + 'copy:resources' + ]); + }; +})(); diff --git a/Swipe/package.json b/Swipe/package.json index 9222830..1c4c979 100644 --- a/Swipe/package.json +++ b/Swipe/package.json @@ -1,16 +1,16 @@ -{ - "name": "StorytellingSwipe", - "version": "1.14.0", - "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-clean": "~0.4.0", - "grunt-contrib-concat": "~0.2.0", - "grunt-contrib-uglify": "~0.2.0", - "grunt-contrib-requirejs": "~0.4.1", - "grunt-contrib-copy": "~0.4.1", - "grunt-contrib-cssmin": "~0.6.1", - "grunt-regex-replace": "~0.2.5", - "grunt-rename": "~0.1.2", - "grunt-contrib-jshint": "~0.4.3" - } -} +{ + "name": "StorytellingSwipe", + "version": "1.15.0", + "devDependencies": { + "grunt": "~0.4.1", + "grunt-contrib-clean": "~0.4.0", + "grunt-contrib-concat": "~0.2.0", + "grunt-contrib-uglify": "~0.2.0", + "grunt-contrib-requirejs": "~0.4.1", + "grunt-contrib-copy": "~0.4.1", + "grunt-contrib-cssmin": "~0.6.1", + "grunt-regex-replace": "~0.2.5", + "grunt-rename": "~0.1.2", + "grunt-contrib-jshint": "~0.4.3" + } +} diff --git a/Swipe/src/app/storymaps/builder/Builder.js b/Swipe/src/app/storymaps/builder/Builder.js index af84bd8..3b8f626 100644 --- a/Swipe/src/app/storymaps/builder/Builder.js +++ b/Swipe/src/app/storymaps/builder/Builder.js @@ -91,42 +91,75 @@ define(["esri/arcgis/Portal", app.cleanApp = cleanApp; // Show https-transition notification when app loads - if (!app.data.isOrga()) { + if (!app.isPortal) { topic.subscribe('SWIPE_READY', function() { - var strings = i18n.viewer.httpsTransitionMessage; + var stringsSurvey = i18n.june2018SurveyMessage; + var stringsHttps = i18n.httpsTransitionNotification; + new BannerNotification({ + id: "storymapsSurvey", + bannerMsg: stringsSurvey.bannerMsg, + primaryColor: '#1e8a87', + mainMsgHtml: '\ +

' + stringsSurvey.s1h1 + '

\ +

' + stringsSurvey.s1p1 + '

\ +

' + stringsSurvey.s2p1 + '

\ + ', + 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: strings.bannerMsg, + bannerMsg: i18n.viewer.httpsTransitionMessage.bannerMsg, mainMsgHtml: '\ -

' + strings.s1h1 + '

\ -

' + strings.s1p1 + '

\ -

' + strings.s1p2 + '

\ -

' + strings.s2h1 + '

\ -

' + strings.s2p1 + '

\ - ', +

' + stringsHttps.s1h1 + '

\ +

' + stringsHttps.s1p1 + '

\ +

' + stringsHttps.s1p2 + '

\ +

' + stringsHttps.s2h1 + '

\ +

' + stringsHttps.s2p1 + '

\ + ', actions: [ { primary: true, - string: strings.action1, + string: stringsHttps.action1, closeOnAction: true }, { - string: strings.action2, + string: stringsHttps.action2, action: function() { window.open('https://storymaps.arcgis.com/en/my-stories/'); } }, { - string: strings.action3, + string: stringsHttps.action3, action: function() { window.open('https://links.esri.com/storymaps/web_security_faq'); } } ], cookie: { - domain: window.location.hostname, + domain: 'arcgis.com', + path: '/', maxAge: 60 * 60 * 24 * 365 - } + }, + blockingNotifications: 'storymapsSurvey' }); }); } diff --git a/Swipe/src/app/storymaps/core/Core.js b/Swipe/src/app/storymaps/core/Core.js index c80fe1c..2b651d8 100644 --- a/Swipe/src/app/storymaps/core/Core.js +++ b/Swipe/src/app/storymaps/core/Core.js @@ -3,6 +3,7 @@ define(["esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "storymaps/utils/Helper", + "storymaps/utils/arcgis-html-sanitizer", // Core "storymaps/swipe/core/Config", "storymaps/swipe/core/Data", @@ -12,6 +13,8 @@ define(["esri/map", "storymaps/ui/header/Header", "storymaps/ui/mapCommand/MapCommand", "storymaps/ui/SelectMapWidget/browse-dialog/js/BrowseIdDlg", + //Embed bar + "storymaps/ui/EmbedBar/EmbedBar", // Utils "dojo/has", "esri/IdentityManager", @@ -37,6 +40,7 @@ define(["esri/map", arcgisUtils, Legend, Helper, + Sanitizer, Config, Data, WebApplicationData, @@ -44,6 +48,7 @@ define(["esri/map", Header, MapCommand, BrowseIdDlg, + EmbedBar, has, IdentityManager, ArcGISOAuthInfo, @@ -141,6 +146,14 @@ define(["esri/map", popup: [], isPopup: false, search: null, + sanitizer: new Sanitizer({ + whiteList: { + ul: [], + li: [], + u: [], + font: ['face', 'size'] + } + }, true), // Builder builder: builder, isInBuilderMode: isInBuilderMode, @@ -464,7 +477,12 @@ define(["esri/map", }, callbackParamName: "callback", load: function (response) { - WebApplicationData.set(response); + if(app.data.getAppItem().created > APPCFG.HTML_SANITIZER_DATE){ + var sanitizedValues = app.sanitizer.sanitize(response); + WebApplicationData.set(sanitizedValues); + } else{ + WebApplicationData.set(response); + } }, error: function(){ } }); @@ -958,6 +976,35 @@ define(["esri/map", { console.log("swipe.core.Core - initMap"); + // Initialize Embed bar + var urlParams = esri.urlToObject(document.location.search).query || {}; + var classicEmbedMode = urlParams.classicEmbedMode ? true : urlParams.classicEmbedMode === "" ? true : urlParams.classicembedmode ? true : urlParams.classicembedmode === "" ? true : false; + var isEsriLogo = app.data.getWebAppData().logoURL == null ? true : false; + var strings = i18n.embedBar; + lang.mixin(strings, { + open: i18n.swipe.share.shareLinkOpen, + close: i18n.viewer.bannerNotification.close, + shareFacebook: i18n.viewer.desktopView.facebookTooltip, + shareTwitter: i18n.viewer.desktopView.twitterTooltip + }); + + var shareElements = [$(".shareIcon")]; + + app.embedBar = new EmbedBar({ + classicEmbedMode: classicEmbedMode, + strings: strings, + appCreationDate: app.data.getAppItem().created, + june2018ReleaseDate: APPCFG.JUNE_RELEASE_DATE, + isBuilder: app.isInBuilderMode, + isEsriLogo: isEsriLogo, + logoPath: "resources/icons/esri-logo-black.png", + logoElements: [$(".logo")], + taglineElements: [$(".msLink")], + shareElements: shareElements, + appTitle: app.data.getWebAppData().title, + bitlyCreds: [APPCFG.HEADER_SOCIAL.bitly.key, APPCFG.HEADER_SOCIAL.bitly.login] + }); + var index = 0; new MapCommand( @@ -1118,7 +1165,7 @@ define(["esri/map", var heightViewport = $("body").height(); var heightHeader = $("#header").height(); var heightSeriesPanel = $("#seriesPanel").height(); - var heightMiddle = heightViewport - heightHeader - heightSeriesPanel; + var heightMiddle = heightViewport - heightHeader - heightSeriesPanel - (app.embedBar && app.embedBar.initiated ? 26 : 0); if(isMobileView && heightSeriesPanel > 0) heightMiddle -= ($('#footerMobile').height() - heightSeriesPanel); app.header.resize(widthViewport); diff --git a/Swipe/src/app/storymaps/swipe/ui/desktop/SidePanel.js b/Swipe/src/app/storymaps/swipe/ui/desktop/SidePanel.js index 797f298..b7cada6 100644 --- a/Swipe/src/app/storymaps/swipe/ui/desktop/SidePanel.js +++ b/Swipe/src/app/storymaps/swipe/ui/desktop/SidePanel.js @@ -119,6 +119,8 @@ define(["storymaps/swipe/core/WebApplicationData", this.checkDescription = function(fromSaveButton) { + if(!app.isInBuilderMode) + return; //Blur method from component isnt good, have to check for real change setTimeout(function(){ //Blur method from component isnt good, have to check for real change diff --git a/Swipe/src/app/storymaps/ui/EmbedBar/EmbedBar.js b/Swipe/src/app/storymaps/ui/EmbedBar/EmbedBar.js new file mode 100644 index 0000000..fe09450 --- /dev/null +++ b/Swipe/src/app/storymaps/ui/EmbedBar/EmbedBar.js @@ -0,0 +1,520 @@ +define([ +], function() { + 'use strict'; + + return function(options) { + this.initiated = false; + + if(options.isBuilder || options.classicEmbedMode || options.appCreationDate < options.june2018ReleaseDate){ + return; + } + + // Defines current app/frame as a story map + window.app.isEsriStoryMap = true; + if (window.top !== window.self) { + // Check if parent app/frame is story map + try { + if (parent.window.app.isEsriStoryMap) { + window.app.isEmbeddedInEsriStoryMap = true; + } + } catch(err) { + window.app.isEmbeddedInEsriStoryMap = false; + } + + if (window.app.isEmbeddedInEsriStoryMap) { + return; + } + } else { + return; + } + + var embedBarStyleTag = '\ + \ + '; + + var embedBarTemplate = '\ +
\ +
\ + \ + Esri logo\ + \ +
\ + \ +
\ +
\ + \ +
\ + \ + \ + \ +
\ +
\ + \ + \ +
\ +
\ + '; + + var shareModalStyleTag = '\ + \ + '; + + var shareModalTemplate = '\ +
\ +
\ + \ +
\ +

' + options.strings.share + '

\ +
\ +
\ + \ +
\ + \ + \ +
\ +
\ + \ +
\ +
\ + '; + + var createMessage = function() { + // Add DOM elements + document.querySelector('body').appendChild(embedBarWrapper); + document.querySelector('body').appendChild(shareModalWrapper); + + if(!document.fullscreenEnabled && !document.webkitFullscreenEnabled && !document.mozFullScreenEnabled && !document.msFullscreenEnabled){ + document.querySelector(".fullscreen-embed").style.display = "none"; + } else { + document.querySelector(".open-newtab-embed").style.display = "none"; + } + + hideParentElements(); + createEvents(); + }; + + var hideParentElements = function() { + if(options.isEsriLogo){ + for (var i = 0; i 1) { + for (var k = 0; k 1) { + for (var m = 0; m