From bf21bc2d483e234bdfcf41a43b8214b11707591e Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Tue, 16 Feb 2016 14:06:02 -0800 Subject: [PATCH] reworked exporting properties --- .../particle_explorer/particleExplorer.html | 22 +++++++++++++++++++ .../particle_explorer/particleExplorer.js | 17 +++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/examples/particle_explorer/particleExplorer.html b/examples/particle_explorer/particleExplorer.html index a7700a8c05..a369eaf648 100644 --- a/examples/particle_explorer/particleExplorer.html +++ b/examples/particle_explorer/particleExplorer.html @@ -35,6 +35,26 @@ body{ .importer{ margin-bottom:4px; } +.exported-props-section { + width: 50%; + margin: 0 auto; + +} +#exported-props { + /* Set the margin-left and margin-right automatically set */ + color: white; + white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* css-3 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ + white-space: -webkit-pre-wrap; /* Newer versions of Chrome/Safari*/ + word-break: break-all; + white-space: normal; + + +} + ::-webkit-input-placeholder { text-align: center; @@ -52,6 +72,8 @@ body{
+
+
diff --git a/examples/particle_explorer/particleExplorer.js b/examples/particle_explorer/particleExplorer.js index 7749c93120..66e9c1616a 100644 --- a/examples/particle_explorer/particleExplorer.js +++ b/examples/particle_explorer/particleExplorer.js @@ -383,9 +383,9 @@ function importSettings() { var keys = _.keys(importedSettings); _.each(keys, function(key) { - var shouldIgnore = _.contains(keysToIgnore, key); + var shouldAllow = _.contains(keysToAllow, key); - if (shouldIgnore) { + if (!shouldAllow) { return; } @@ -406,9 +406,9 @@ function prepareSettingsForExport() { var exportSettings = {}; _.each(keys, function(key) { - var shouldIgnore = _.contains(keysToIgnore, key); + var shouldAllow = _.contains(keysToAllow, key); - if (shouldIgnore) { + if (!shouldAllow) { return; } @@ -424,7 +424,14 @@ function prepareSettingsForExport() { } function showPreselectedPrompt() { - window.prompt("Ctrl-C to copy, then Enter.", prepareSettingsForExport()); + var elem = document.getElementById("exported-props"); + var exportSettings = prepareSettingsForExport(); + elem.innerHTML = ""; + elem.appendChild(document.createTextNode(exportSettings)); + elem.select(); + document.execCopy('copy'); + + //window.alert("Ctrl-C to copy, then Enter.", prepareSettingsForExport()); } function removeContainerDomElement() {