Skip to content

Commit

Permalink
Merge branch 'master' into cv-tilt
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Jan 2, 2017
2 parents b7c45a4 + 5ccc548 commit 80aef7c
Show file tree
Hide file tree
Showing 358 changed files with 10,653 additions and 6,761 deletions.
13 changes: 0 additions & 13 deletions .idea/misc.xml

This file was deleted.

1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
/index.release.html
/Instrumented
/launches
/logo.png
/server.js
/Source/copyrightHeader.js
/Source/main.js
Expand Down
2 changes: 0 additions & 2 deletions Apps/CesiumViewer/CesiumViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ define([
'Cesium/Core/Cartesian3',
'Cesium/Core/defined',
'Cesium/Core/formatError',
'Cesium/Core/getFilenameFromUri',
'Cesium/Core/Math',
'Cesium/Core/objectToQuery',
'Cesium/Core/queryToObject',
Expand All @@ -19,7 +18,6 @@ define([
Cartesian3,
defined,
formatError,
getFilenameFromUri,
CesiumMath,
objectToQuery,
queryToObject,
Expand Down
Binary file modified Apps/CesiumViewer/favicon.ico
Binary file not shown.
59 changes: 44 additions & 15 deletions Apps/Sandcastle/CesiumSandcastle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*global require,Blob,JSHINT*/
/*global gallery_demos*/// defined by gallery/gallery-index.js, created by build
/*global hello_world_index*/// defined in gallery/gallery-index.js, created by build
/*global sandcastleJsHintOptions*/// defined by jsHintOptions.js, created by build
require({
baseUrl : '../../Source',
Expand Down Expand Up @@ -138,6 +139,7 @@ require({
var subtabs = {};
var docError = false;
var galleryError = false;
var notFound = false;
var galleryTooltipTimer;
var activeGalleryTooltipDemo;
var demoTileHeightRule = findCssStyle('.demoTileThumbnail');
Expand All @@ -160,12 +162,16 @@ require({
var currentTab = '';
var newDemo;
var demoHtml = '';
var demoJs = '';
var demoCode = '';
var previousCode = '';
var previousHtml = '';
var runGist = false;
var gistCode;
var gistHtml;
var sandcastleUrl = '';

var defaultHtml = '<style>\n@import url(../templates/bucket.css);\n</style>\n<div id=\"cesiumContainer\" class=\"fullSize\"></div>\n<div id=\"loadingOverlay\"><h1>Loading...</h1></div>\n<div id=\"toolbar\"></div>';

var galleryErrorMsg = document.createElement('span');
galleryErrorMsg.className = 'galleryError';
galleryErrorMsg.style.display = 'none';
Expand Down Expand Up @@ -301,7 +307,7 @@ require({
var selectedTabName = registry.byId('innerPanel').selectedChildWidget.title;
var suffix = selectedTabName + 'Demos';
if (selectedTabName === 'All') {
suffix = '';
suffix = 'all';
} else if (selectedTabName === 'Search Results') {
suffix = 'searchDemo';
}
Expand Down Expand Up @@ -504,7 +510,7 @@ require({
window.onbeforeunload = function (e) {
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
if (demoHtml !== htmlText || demoJs !== jsText) {
if (demoHtml !== htmlText || demoCode !== jsText) {
return 'Be sure to save a copy of any important edits before leaving this page.';
}
};
Expand Down Expand Up @@ -689,13 +695,14 @@ require({
}

function loadFromGallery(demo) {
notFound = false;
document.getElementById('saveAsFile').download = demo.name + '.html';
registry.byId('description').set('value', decodeHTML(demo.description).replace(/\\n/g, '\n'));
registry.byId('label').set('value', decodeHTML(demo.label).replace(/\\n/g, '\n'));

if (demo.name === 'Gist Import') {
jsEditor.setValue(gistCode);
htmlEditor.setValue('<style>\n@import url(../templates/bucket.css);\n</style>\n<div id=\"cesiumContainer\" class=\"fullSize\"></div>\n<div id=\"loadingOverlay\"><h1>Loading...</h1></div>\n<div id=\"toolbar\"></div>');
htmlEditor.setValue(gistHtml);
document.title = 'Gist Import - Cesium Sandcastle';
CodeMirror.commands.runCesium(jsEditor);
return;
Expand All @@ -719,17 +726,23 @@ require({
}

var scriptCode = scriptMatch[1];
demoJs = scriptCode.replace(/\s/g, '');
demoCode = scriptCode.replace(/\s/g, '');

if (Cesium.defined(queryObject.gistId)) {
Cesium.loadJsonp('https://api.github.com/gists/' + queryObject.gistId + '?access_token=dd8f755c2e5d9bbb26806bb93eaa2291f2047c60')
.then(function(data) {
var files = data.data.files;
var code = files[Object.keys(files)[0]].content;
var code = files['Cesium-Sandcastle.js'].content;
var htmlFile = files['Cesium-Sandcastle.html'];
var html = Cesium.defined(htmlFile) ? htmlFile.content : defaultHtml; // Use the default html for old gists
jsEditor.setValue(code);
demoJs = code.replace(/\s/g, '');
htmlEditor.setValue(html);
demoCode = code.replace(/\s/g, '');
demoHtml = html.replace(/\s/g, '');
gistCode = code;
gistHtml = html;
previousCode = code;
previousHtml = html;
sandcastleUrl = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
CodeMirror.commands.runCesium(jsEditor);
clearRun();
Expand Down Expand Up @@ -793,6 +806,9 @@ require({
if (galleryError) {
appendConsole('consoleError', 'Error loading gallery, please run the build script.', true);
}
if (notFound) {
appendConsole('consoleLog', 'Unable to load demo named ' + queryObject.src.replace('.html', '') + '\n', true);
}
}
} else if (Cesium.defined(e.data.log)) {
// Console log messages from the iframe display in Sandcastle.
Expand Down Expand Up @@ -885,17 +901,22 @@ require({
var textArea = document.getElementById('link');
textArea.value = '\n\n';
var code = jsEditor.getValue();
if (code === previousCode) {
var html = htmlEditor.getValue();
if (code === previousCode && html === previousHtml) {
textArea.value = sandcastleUrl;
textArea.select();
return;
}
previousCode = code;
previousHtml = html;
var data = {
public : true,
files : {
'Cesium-Sandcastle.js' : {
content : code
},
'Cesium-Sandcastle.html' : {
content : html
}
}
};
Expand All @@ -915,9 +936,10 @@ require({

registry.byId('buttonImport').on('click', function() {
gistId = document.getElementById("gistId").value;
if (gistId.indexOf('/') !== -1) {
var index = gistId.lastIndexOf('/');
gistId = gistId.substring(index + 1);
var gistParameter = '&gist=';
var gistIndex = gistId.indexOf(gistParameter);
if (gistIndex !== -1) {
gistId = gistId.substring(gistIndex + gistParameter.length);
}
window.location.href = Cesium.getBaseUri(window.location.href) + '?src=Hello%20World.html&label=Showcases&gist=' + gistId;
});
Expand All @@ -926,7 +948,7 @@ require({
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
var confirmChange = true;
if (demoHtml !== htmlText || demoJs !== jsText) {
if (demoHtml !== htmlText || demoCode !== jsText) {
confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?');
}
if (confirmChange) {
Expand Down Expand Up @@ -1038,8 +1060,15 @@ require({
url : 'gallery/' + name + '.html',
handleAs : 'text',
error : function(error) {
appendConsole('consoleError', error, true);
galleryError = true;
if (error.status === 404) {
loadFromGallery(gallery_demos[hello_world_index])
.then(function() {
notFound = true;
});
} else {
galleryError = true;
appendConsole('consoleError', error, true);
}
}
});
}
Expand Down Expand Up @@ -1169,7 +1198,7 @@ require({
var htmlText = (htmlEditor.getValue()).replace(/\s/g, '');
var jsText = (jsEditor.getValue()).replace(/\s/g, '');
var confirmChange = true;
if (demoHtml !== htmlText || demoJs !== jsText) {
if (demoHtml !== htmlText || demoCode !== jsText) {
confirmChange = window.confirm('You have unsaved changes. Are you sure you want to navigate away from this demo?');
}
if (confirmChange) {
Expand Down
24 changes: 24 additions & 0 deletions Apps/Sandcastle/Sandcastle-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@

document.body.className = document.body.className.replace(/(?:\s|^)sandcastle-loading(?:\s|$)/, ' ');
},
addToggleButton : function(text, checked, onchange, toolbarID) {
window.Sandcastle.declare(onchange);
var input = document.createElement('input');
input.checked = checked;
input.type = 'checkbox';
input.style.pointerEvents = 'none';
var label = document.createElement('label');
label.appendChild(input);
label.appendChild(document.createTextNode(text));
label.style.pointerEvents = 'none';
var button = document.createElement('button');
button.type = 'button';
button.className = 'cesium-button';
button.appendChild(label);

button.onclick = function() {
window.Sandcastle.reset();
window.Sandcastle.highlight(onchange);
input.checked = !input.checked;
onchange(input.checked);
};

document.getElementById(toolbarID || 'toolbar').appendChild(button);
},
addToolbarButton : function(text, onclick, toolbarID) {
window.Sandcastle.declare(onclick);
var button = document.createElement('button');
Expand Down
Loading

0 comments on commit 80aef7c

Please sign in to comment.