mirror of
https://github.com/google/pebble.git
synced 2025-07-04 22:00:38 -04:00
Import the pebble dev site into devsite/
This commit is contained in:
parent
3b92768480
commit
527858cf4c
1359 changed files with 265431 additions and 0 deletions
58
devsite/source/assets/js/404.js
Normal file
58
devsite/source/assets/js/404.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
---
|
||||
|
||||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var $results = $('#js-404-search');
|
||||
|
||||
var search = new Search({
|
||||
appId: '{{ site.algolia_app_id }}',
|
||||
apiKey: '{{ site.algolia_api_key }}',
|
||||
prefix: '{{ site.algolia_prefix }}',
|
||||
options: {
|
||||
hitsPerPage: 2,
|
||||
getRankingInfo: true,
|
||||
distinct: true,
|
||||
removeWordsIfNoResults: 'firstWords',
|
||||
analytics: false
|
||||
}
|
||||
});
|
||||
|
||||
search.on('results', showResults);
|
||||
search.on('error', function (err) {
|
||||
Rollbar.error('404 search error', err);
|
||||
});
|
||||
|
||||
search.search(window.location.pathname.split('/').join(' '));
|
||||
|
||||
function showResults(results) {
|
||||
Object.keys(results).forEach(function (index) {
|
||||
var type = Search.indexes[index];
|
||||
var typeResults = results[index];
|
||||
$results.append('<li style="margin-top: 0.5em;"><strong>' + type.title + '</strong></li>');
|
||||
typeResults.hits.forEach(function (result) {
|
||||
$results.append(buildResult(result));
|
||||
});
|
||||
});
|
||||
$('#js-404-search-intro').show()
|
||||
}
|
||||
|
||||
function buildResult(result) {
|
||||
var $result = $('<li>');
|
||||
$result.append($('<a/>').text(result.title).attr('href', result.url));
|
||||
return $result;
|
||||
}
|
208
devsite/source/assets/js/app.js
Normal file
208
devsite/source/assets/js/app.js
Normal file
|
@ -0,0 +1,208 @@
|
|||
---
|
||||
---
|
||||
|
||||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
$.get('/mobilenav.html', function (response) {
|
||||
$('body').append(response);
|
||||
$(".js-mobile-nav a").each(function (index, elem) {
|
||||
if ($(elem).attr('href') == window.location.pathname) {
|
||||
$(elem).parent().addClass('active');
|
||||
}
|
||||
});
|
||||
$(".js-mobile-nav").mmenu({
|
||||
footer: {
|
||||
add: true,
|
||||
content: '<a href="{{ site.links.legal.privacy }}" target="_blank">Privacy Policy</a> · <a href="{{ site.links.legal.cookies }}" target="_blank">Cookie Policy</a>'
|
||||
}
|
||||
}, {
|
||||
classNames: {
|
||||
selected: 'active'
|
||||
}
|
||||
});
|
||||
$('body').trigger('pbl-menu-loaded');
|
||||
});
|
||||
|
||||
$('.js-toc-select').on('change', function () {
|
||||
var url = $(this).val();
|
||||
if (! url) {
|
||||
return;
|
||||
}
|
||||
if (url[0] == '/') {
|
||||
window.location = url;
|
||||
}
|
||||
else {
|
||||
window.location = '#' + url;
|
||||
}
|
||||
});
|
||||
|
||||
$('.js-mobile-nav-toggle').on('click', function () {
|
||||
$('.js-mobile-nav').trigger("open.mm");
|
||||
});
|
||||
|
||||
// Handles affixing the gray-box to the right hand side of the page
|
||||
// so it will stay in position when you scroll.
|
||||
$('.gray-box--fixed').each(function (index, elem) {
|
||||
var $graybox = $(elem);
|
||||
var $parent = $graybox.parent();
|
||||
$graybox.css('position', 'fixed');
|
||||
$(window).on('resize', function () {
|
||||
updateGraybox();
|
||||
});
|
||||
updateGraybox();
|
||||
|
||||
function updateGraybox() {
|
||||
$graybox.css('height', 'auto');
|
||||
$graybox.css('left', $parent.offset().left);
|
||||
$graybox.css('width', $parent.width());
|
||||
var maxHeight = $(window).height() - $graybox.position().top - 10;
|
||||
if ($graybox.height() > maxHeight) {
|
||||
$graybox.css('height', maxHeight);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ($('.gray-box--scrollspy').length) {
|
||||
var triggers = [];
|
||||
$('.toc__item').each(function (index, item) {
|
||||
var url = $(item).find('a').attr('href');
|
||||
var id = url.substr(url.indexOf('#') + 1);
|
||||
var $header = $('[id="' + id + '"]');
|
||||
if ($header && $header.length) {
|
||||
triggers.push({
|
||||
from: $header.position().top,
|
||||
item: $(item)
|
||||
});
|
||||
}
|
||||
});
|
||||
$(window).on('scroll', function () {
|
||||
var pos = $(window).scrollTop();
|
||||
pos += $(window).height() / 8;
|
||||
triggers.forEach(function (trigger) {
|
||||
if (pos >= trigger.from) {
|
||||
$('.toc__item--active').removeClass('toc__item--active');
|
||||
trigger.item.addClass('toc__item--active');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// OSS: disabled because PrettyEmbed has no clear license and cannot be included.
|
||||
// $().prettyEmbed({
|
||||
// useFitVids: true
|
||||
// });
|
||||
|
||||
$('body').on('mouseover', '.code-copy-link', function () {
|
||||
$(this).prepend('<span>COPY</span>');
|
||||
});
|
||||
|
||||
$('body').on('mouseout', '.code-copy-link', function () {
|
||||
$('span', this).remove();
|
||||
});
|
||||
|
||||
$('.js-doc-menu-toggle').click(function (e) {
|
||||
e.preventDefault();
|
||||
$('.js-doc-menu').toggleClass('documentation-menu--visible');
|
||||
});
|
||||
|
||||
/* SDK Platform */
|
||||
|
||||
if (Cookies.get('sdk-platform')) {
|
||||
showPlatformSpecifics(Cookies.get('sdk-platform'));
|
||||
}
|
||||
else if (queryString.parse(location.search).sdk === 'local') {
|
||||
setPlatform('local');
|
||||
}
|
||||
else if (queryString.parse(location.search).sdk === 'cloudpebble') {
|
||||
setPlatform('cloudpebble');
|
||||
}
|
||||
else {
|
||||
$('.platform-choice--large').show();
|
||||
}
|
||||
|
||||
$('.js-platform-choice').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
setPlatform($(this).data('sdk-platform'));
|
||||
});
|
||||
|
||||
function setPlatform(platform) {
|
||||
Cookies.set('sdk-platform', platform);
|
||||
showPlatformSpecifics(platform);
|
||||
}
|
||||
|
||||
function showPlatformSpecifics(platform) {
|
||||
$('.platform-choice--large').hide();
|
||||
$('.platform-specific').hide();
|
||||
$('.platform-specific[data-sdk-platform="' + platform + '"]').show();
|
||||
$('.platform-choice--small').show();
|
||||
}
|
||||
|
||||
$('a[data-modal-target]').on('show.r.modal', function(event) {
|
||||
// TODO: Track this in the analytics.
|
||||
});
|
||||
|
||||
$('body').on('pbl-menu-loaded', function () {
|
||||
$('.video--autoplay').each(function () {
|
||||
this.play();
|
||||
});
|
||||
});
|
||||
|
||||
// SCREENSHOT VIEWER
|
||||
|
||||
$('.js-screenshot-tabs h4').on('click', function () {
|
||||
var $viewer = $(this).parents('.screenshot-viewer');
|
||||
if (!$viewer.hasClass('screenshot-viewer--tabbed')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var platform = $(this).data('platform');
|
||||
|
||||
$('.js-screenshot-tabs h4').removeClass('selected');
|
||||
$('.js-screenshot-tabs h4[data-platform="' + platform + '"]').addClass('selected');
|
||||
|
||||
$('.screenshot-viewer__platform').hide();
|
||||
$('.screenshot-viewer__platform[data-platform="' + platform + '"]').show();
|
||||
});
|
||||
|
||||
function updateScreenshotViewers() {
|
||||
$('.screenshot-viewer').each(function (index, elem) {
|
||||
var $viewer = $(elem);
|
||||
if ($viewer.hasClass('screenshot-viewer--tabbed')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $screenshots = $viewer.find('.screenshot-viewer__screenshots');
|
||||
var width = $screenshots.find('.screenshot-viewer__platform').map(function (index, elem) {
|
||||
return $(elem).width();
|
||||
}).toArray().reduce(function (previous, current) {
|
||||
return previous + current;
|
||||
});
|
||||
if (width > $viewer.width()) {
|
||||
$viewer.addClass('screenshot-viewer--tabbed');
|
||||
$('.js-screenshot-tabs h4:last-child').click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(window).on('resize', function () {
|
||||
updateScreenshotViewers();
|
||||
});
|
||||
updateScreenshotViewers();
|
||||
|
||||
}());
|
36
devsite/source/assets/js/disqus.js
Normal file
36
devsite/source/assets/js/disqus.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
---
|
||||
|
||||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
|
||||
var $thread = $('#disqus_thread');
|
||||
if (! $thread || $thread.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var disqus_shortname = '{{ site.disqus.short_name }}';
|
||||
window.disqus_identifier = $thread.data('post-url');
|
||||
window.disqus_url = $thread.data('post-url');
|
||||
(function () {
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
}());
|
||||
|
||||
});
|
42
devsite/source/assets/js/docs/c.js
Normal file
42
devsite/source/assets/js/docs/c.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
|
||||
$('.docs__item__tabs a[data-platform]').on('click', function () {
|
||||
var offset = $(this).position().top - $('body').scrollTop();
|
||||
var platform = $(this).data('platform');
|
||||
showPlatform(platform);
|
||||
savePlatform(platform);
|
||||
var newOffset = $(this).position().top - $('body').scrollTop();
|
||||
$('body').scrollTop($('body').scrollTop() + (newOffset - offset));
|
||||
});
|
||||
|
||||
function showPlatform(platform) {
|
||||
$('.docs__item__tabs a[data-platform]').removeClass('active');
|
||||
$('.docs__item__tabs a[data-platform="' + platform + '"]').addClass('active');
|
||||
$('section[data-platform]').hide();
|
||||
$('section[data-platform="' + platform + '"]').show();
|
||||
}
|
||||
|
||||
function savePlatform(platform) {
|
||||
Cookies.set('docs-platform', platform);
|
||||
}
|
||||
|
||||
var defaultPlatform = $('[data-basalt-only]').length ? 'basalt' : 'aplite';
|
||||
showPlatform(Cookies.get('docs-platform') || defaultPlatform);
|
||||
|
||||
});
|
25
devsite/source/assets/js/docs/pebblejs.js
Normal file
25
devsite/source/assets/js/docs/pebblejs.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
var hash = window.location.hash;
|
||||
if (hash.length) {
|
||||
var $link = $('.section-menu a[href$="' + hash + '"]');
|
||||
if ($link && $link.length) {
|
||||
$('.section-menu').scrollTo($link);
|
||||
}
|
||||
}
|
||||
});
|
76
devsite/source/assets/js/examples.js
Normal file
76
devsite/source/assets/js/examples.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var exampleFilters = {};
|
||||
|
||||
$('.js-examples-tag').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $tag = $(this);
|
||||
var $filters = $tag.parents('.examples__filters');
|
||||
|
||||
if ($tag.hasClass('js-selected-tag')) {
|
||||
$tag.removeClass('js-selected-tag');
|
||||
$tag.removeClass('selected');
|
||||
$filters.removeClass('examples__filters--selected');
|
||||
|
||||
exampleFilters[$filters.data('filter-type')] = null;
|
||||
updateExamples();
|
||||
}
|
||||
else {
|
||||
var $selectedTag = $filters.find('.js-selected-tag');
|
||||
$selectedTag.removeClass('js-selected-tag');
|
||||
$selectedTag.removeClass('selected');
|
||||
|
||||
$tag.addClass('js-selected-tag');
|
||||
$tag.addClass('selected');
|
||||
$filters.addClass('examples__filters--selected');
|
||||
|
||||
exampleFilters[$filters.data('filter-type')] = $tag.text();
|
||||
updateExamples();
|
||||
}
|
||||
});
|
||||
|
||||
function updateExamples() {
|
||||
$('.js-example').each(function (index, elem) {
|
||||
var $example = $(elem);
|
||||
var tags = $example.data('tags').split('|');
|
||||
var languages = $example.data('languages').split('|');
|
||||
var hardwarePlatforms = $example.data('hardware-platforms').split('|');
|
||||
|
||||
if (exampleFilters['tags'] && tags.indexOf(exampleFilters['tags']) === -1) {
|
||||
$example.hide();
|
||||
return;
|
||||
}
|
||||
if (exampleFilters['languages'] && languages.indexOf(exampleFilters['languages']) === -1) {
|
||||
$example.hide();
|
||||
return;
|
||||
}
|
||||
if (exampleFilters['hardware-platforms'] && hardwarePlatforms.indexOf(exampleFilters['hardware-platforms']) === -1) {
|
||||
$example.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
$example.show();
|
||||
});
|
||||
|
||||
if ($('.js-example:visible').length > 0) {
|
||||
$('.js-no-examples').hide();
|
||||
}
|
||||
else {
|
||||
$('.js-no-examples').show();
|
||||
}
|
||||
}
|
105
devsite/source/assets/js/landing-page.js
Normal file
105
devsite/source/assets/js/landing-page.js
Normal file
|
@ -0,0 +1,105 @@
|
|||
---
|
||||
---
|
||||
|
||||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function willPlayVideo() {
|
||||
return ! (/iPad|iPhone|iPod/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent));
|
||||
}
|
||||
|
||||
$('body').on('pbl-menu-loaded', function () {
|
||||
if (! willPlayVideo()) {
|
||||
return;
|
||||
}
|
||||
$('.js-video-slide').each(function (index, elem) {
|
||||
$(elem).vide({
|
||||
mp4: $(elem).data('video'),
|
||||
ogv: $(elem).data('video').replace(/\.mp4$/, '.ogv'),
|
||||
webm: $(elem).data('video').replace(/\.mp4$/, '.webm')
|
||||
}, {
|
||||
loop: false,
|
||||
posterType: 'none'
|
||||
});
|
||||
$(elem).data('vide').getVideoObject().onended = function (event) {
|
||||
$(elem).trigger('video-ended');
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
var slideTimeout = null;
|
||||
var previousSlide = null;
|
||||
var indexSlick = $('.js-slider').slick({
|
||||
autoplay: false,
|
||||
arrows: false,
|
||||
dots: true,
|
||||
onBeforeChange: function (event, from, to) {
|
||||
if (slideTimeout) {
|
||||
clearTimeout(slideTimeout);
|
||||
slideTimeout = null;
|
||||
}
|
||||
var toSlide = findSlideByIndex(to);
|
||||
if (isVideoSlide(toSlide) && willPlayVideo()) {
|
||||
var video = toSlide.data('vide').getVideoObject();
|
||||
if (video) {
|
||||
video.currentTime = 0;
|
||||
video.play();
|
||||
}
|
||||
}
|
||||
previousSlide = findSlideByIndex(from);
|
||||
},
|
||||
onAfterChange: function (event) {
|
||||
if (previousSlide && isVideoSlide(previousSlide) && willPlayVideo()) {
|
||||
var video = previousSlide.data('vide').getVideoObject();
|
||||
if (video) {
|
||||
video.pause();
|
||||
video.currentTime = 0;
|
||||
}
|
||||
}
|
||||
previousSlide = null;
|
||||
}
|
||||
});
|
||||
|
||||
function setupSlideTransition() {
|
||||
var slide = $('.js-slide[data-slide-index="' + indexSlick.slickCurrentSlide() + '"]:not(.slick-cloned)');
|
||||
var isVideoSlide = slide.hasClass('js-video-slide');
|
||||
if (isVideoSlide && willPlayVideo()) {
|
||||
slide.on('video-ended', function () {
|
||||
if (slide.data('slide-index') === indexSlick.slickCurrentSlide()) {
|
||||
indexSlick.slickNext();
|
||||
setupSlideTransition();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
var duration = slide.data('duration');
|
||||
slideTimeout = setTimeout(function () {
|
||||
indexSlick.slickNext();
|
||||
setupSlideTransition();
|
||||
slideTimeout = null;
|
||||
}, duration);
|
||||
}
|
||||
}
|
||||
|
||||
function findSlideByIndex(index) {
|
||||
return $('.js-slide[data-slide-index="' + index + '"]:not(.slick-cloned)');
|
||||
}
|
||||
|
||||
function isVideoSlide(slide) {
|
||||
return slide.hasClass('js-video-slide');
|
||||
}
|
||||
|
||||
setupSlideTransition();
|
24
devsite/source/assets/js/menu.js
Normal file
24
devsite/source/assets/js/menu.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
|
||||
$('.sidebar__menu a span').on('click', function () {
|
||||
$(this).parent().parent().toggleClass('expanded');
|
||||
$(this).parent().parent().toggleClass('collapsed');
|
||||
});
|
||||
|
||||
});
|
177
devsite/source/assets/js/quicksearch.js
Normal file
177
devsite/source/assets/js/quicksearch.js
Normal file
|
@ -0,0 +1,177 @@
|
|||
---
|
||||
---
|
||||
|
||||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
var searchLayouts = {
|
||||
1: [ 1 ],
|
||||
2: [ 1, 1 ],
|
||||
3: [ 1, 1, 1 ],
|
||||
4: [ 1, 1, 2 ],
|
||||
5: [ 1, 2, 2 ],
|
||||
6: [ 2, 2, 2 ],
|
||||
};
|
||||
|
||||
var search = new Search({
|
||||
appId: '{{ site.algolia_app_id }}',
|
||||
apiKey: '{{ site.algolia_api_key }}',
|
||||
prefix: '{{ site.algolia_prefix }}',
|
||||
options: {
|
||||
hitsPerPage: 8,
|
||||
getRankingInfo: true,
|
||||
distinct: true
|
||||
}
|
||||
});
|
||||
search.on('results', showResults);
|
||||
search.on('clear', clearResults);
|
||||
search.on('error', function (err) {
|
||||
Rollbar.error('Quicksearch error', err);
|
||||
});
|
||||
|
||||
|
||||
var $input = $('#quicksearch');
|
||||
var $results = $('#quicksearch__results');
|
||||
var $blackout = $('#search__blackout');
|
||||
var selectedResult = [-1, -1];
|
||||
|
||||
$input.on('keyup', function (event) {
|
||||
switch (event.keyCode) {
|
||||
case 40: // DOWN
|
||||
updateSelectedResult(1, 0);
|
||||
break;
|
||||
case 38: // UP
|
||||
updateSelectedResult(-1, 0);
|
||||
break;
|
||||
case 39: // RIGHT
|
||||
updateSelectedResult(0, 1);
|
||||
break;
|
||||
case 37: // LEFT
|
||||
updateSelectedResult(0, -1);
|
||||
break;
|
||||
case 13: // ENTER
|
||||
if (selectedResult[0] >= 0 && selectedResult[1] >= 0) {
|
||||
gotoSelectedResult();
|
||||
}
|
||||
break;
|
||||
case 27: // ESCAPE
|
||||
clearResults();
|
||||
$input.blur();
|
||||
break;
|
||||
}
|
||||
search.search($input.val());
|
||||
});
|
||||
|
||||
$blackout.on('click', function () {
|
||||
hideResults();
|
||||
});
|
||||
|
||||
function getOrderedIndexNames(results) {
|
||||
return Object.keys(results);
|
||||
}
|
||||
|
||||
function isEmpty(obj) {
|
||||
var hasOwn = object.prototype.hasOwnProperty;
|
||||
for(var x in obj) {
|
||||
if (hasOwn.call(obj, x)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function showResults(results) {
|
||||
$results.html('');
|
||||
if (isEmpty(results)) {
|
||||
showEmptyResults();
|
||||
return;
|
||||
}
|
||||
var indexes = getOrderedIndexNames(results);
|
||||
var numResults = Object.keys(results).length;
|
||||
var layout = searchLayouts[numResults];
|
||||
var $row = $('<div>').addClass('row');
|
||||
buildLayout($row, layout);
|
||||
indexes.forEach(function (index, pos) {
|
||||
var $container = getContainer($row, pos);
|
||||
$container.addClass('quicksearch__block--' + Search.indexes[index].cssClass);
|
||||
var searchResults = new SearchResults(results[index], Search.indexes[index], $container.data('result-limit'));
|
||||
searchResults.render($container);
|
||||
});
|
||||
$results.append($row).show();
|
||||
$blackout.fadeIn(100);
|
||||
$('body').addClass('stop-scrolling');
|
||||
}
|
||||
|
||||
function showEmptyResults() {
|
||||
$results.html(Handlebars.templates['quicksearch-no-results']());
|
||||
}
|
||||
|
||||
/**
|
||||
* buildLayout
|
||||
* Takes a layout array and builds the DOM elements inside the given row
|
||||
* param $row The DOM element to build the search layout inside of
|
||||
* param layout The search layout array to build the layout from.
|
||||
**/
|
||||
function buildLayout($row, layout) {
|
||||
var colWidth = Math.min(12 / layout.length, 12);
|
||||
var index = 0;
|
||||
layout.forEach(function (col, c) {
|
||||
var $col = $('<div>').addClass('col-l-' + colWidth);
|
||||
for (var r = 0; r < col; r += 1) {
|
||||
var $block = $('<div>').addClass('quicksearch__block')
|
||||
.attr('data-result-container', index)
|
||||
.attr('data-result-limit', col == 2 ? 3 : 6);
|
||||
$col.append($block);
|
||||
index += 1;
|
||||
}
|
||||
$row.append($col);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* getContainer
|
||||
* Finds a search result container that was built using buildLayout
|
||||
* @param $row The DOM element that contains all of the result containers
|
||||
* @param pos The index of the container
|
||||
* @returns The results container for the given index as a DOM element
|
||||
**/
|
||||
function getContainer($row, index) {
|
||||
return $row.find('[data-result-container="' + index + '"]');
|
||||
}
|
||||
|
||||
function clearResults() {
|
||||
hideResults();
|
||||
$results.find('ul').html('');
|
||||
}
|
||||
|
||||
function hideResults() {
|
||||
$blackout.fadeOut(100, function () {
|
||||
$results.hide();
|
||||
$('body').removeClass('stop-scrolling');
|
||||
});
|
||||
}
|
||||
|
||||
function updateSelectedResult(dx, dy) {
|
||||
|
||||
}
|
||||
|
||||
function gotoSelectedResult() {
|
||||
|
||||
}
|
||||
|
||||
}());
|
38
devsite/source/assets/js/sdk/index.js
Normal file
38
devsite/source/assets/js/sdk/index.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
$sdkLink = $('.js-sdk-link');
|
||||
$('.instructions-other').hide();
|
||||
if ((navigator.userAgent.match(/MSIE/i)) || (navigator.userAgent.match(/Windows/i))) {
|
||||
$sdkLink.attr('href', '/sdk/install/windows/');
|
||||
$('.instructions-windows').show();
|
||||
}
|
||||
else if (navigator.userAgent.match(/Macintosh/i)) {
|
||||
$sdkLink.attr('href', '/sdk/install/mac/');
|
||||
$('.instructions-mac').show();
|
||||
if (document.location.hash === '#homebrew') {
|
||||
setTimeout(function () {
|
||||
$('a[data-modal-target="#modal-mac-auto"]').click();
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
else if (navigator.userAgent.match(/Linux/i) && ! navigator.userAgent.match(/Android/i)) {
|
||||
$sdkLink.attr('href', '/sdk/install/linux/');
|
||||
$('.instructions-linux').show();
|
||||
}
|
||||
else {
|
||||
$('.instructions-other').show();
|
||||
}
|
148
devsite/source/assets/js/search.js
Normal file
148
devsite/source/assets/js/search.js
Normal file
|
@ -0,0 +1,148 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* export SearchResults */
|
||||
/* export Search */
|
||||
|
||||
function SearchResults(results, type, limit) {
|
||||
this.results = results;
|
||||
this.type = type;
|
||||
this.limit = limit;
|
||||
};
|
||||
|
||||
SearchResults.prototype.render = function($container) {
|
||||
this.results.hits.splice(this.limit, this.results.hits.length);
|
||||
this.results.hits.forEach(processResult.bind(this));
|
||||
var $resultGroup = $(Handlebars.templates['quicksearch-result-group']({
|
||||
title: this.type.title,
|
||||
results: this.results.hits
|
||||
}));
|
||||
$container.append($resultGroup);
|
||||
};
|
||||
|
||||
function processResult(result) {
|
||||
if (result._snippetResult && result._snippetResult.content) {
|
||||
result.summary = result._snippetResult.content.value;
|
||||
}
|
||||
else if (result._snippetResult && result._snippetResult.summary) {
|
||||
result.summary = result._snippetResult.summary.value;
|
||||
}
|
||||
if (this.type.section) {
|
||||
result.section = this.type.section(result).join(' · ');
|
||||
}
|
||||
else {
|
||||
result.section = '';
|
||||
}
|
||||
}
|
||||
|
||||
function Search(config) {
|
||||
this.client = new AlgoliaSearch(config.appId, config.apiKey);
|
||||
this.prefix = config.prefix;
|
||||
this.searchNumber = 0;
|
||||
this.lastQuery = null;
|
||||
this.searchOptions = config.options;
|
||||
}
|
||||
|
||||
heir.inherit(Search, EventEmitter);
|
||||
|
||||
Search.indexes = {
|
||||
'guides': {
|
||||
title: 'Guides',
|
||||
cssClass: 'guides',
|
||||
section: function (hit) {
|
||||
var section = [ hit.group ];
|
||||
if (hit.subgroup && hit.subgroup.length) {
|
||||
section.push(hit.subgroup);
|
||||
}
|
||||
return section;
|
||||
}
|
||||
},
|
||||
'documentation': {
|
||||
title: 'Documentation',
|
||||
cssClass: 'docs',
|
||||
section: function (hit) {
|
||||
return [ hit.language ]
|
||||
}
|
||||
},
|
||||
'blog-posts': {
|
||||
title: 'Blog Posts',
|
||||
cssClass: 'more',
|
||||
section: function (hit) {
|
||||
var dateString = hit.posted.split(" ")[0];
|
||||
if (!dateString) return "Invalid Date";
|
||||
|
||||
return [ moment(dateString).format('MMM DD YYYY')];
|
||||
}
|
||||
},
|
||||
'examples': {
|
||||
title: 'Examples',
|
||||
cssClass: 'more',
|
||||
},
|
||||
'community-resources': {
|
||||
title: 'Community Resources',
|
||||
cssClass: 'community',
|
||||
section: function (hit) {
|
||||
switch(hit.resourceType) {
|
||||
case 'community_tools':
|
||||
return ['Tool'];
|
||||
case 'community_apps':
|
||||
return ['App'];
|
||||
case 'community_libraries':
|
||||
return ['Library']
|
||||
}
|
||||
return [];
|
||||
}
|
||||
},
|
||||
'other': {
|
||||
title: 'Other',
|
||||
cssClass: 'other'
|
||||
}
|
||||
};
|
||||
|
||||
Search.prototype.search = function (query) {
|
||||
if (query === this.lastQuery) {
|
||||
return;
|
||||
}
|
||||
if (query.length <= 2) {
|
||||
this.emitEvent('clear');
|
||||
return;
|
||||
}
|
||||
this.searchNumber += 1;
|
||||
var thisNumber = this.searchNumber;
|
||||
this.client.startQueriesBatch();
|
||||
Object.keys(Search.indexes).forEach(function (type) {
|
||||
this.client.addQueryInBatch(this.prefix + type, query, this.searchOptions);
|
||||
}.bind(this));
|
||||
this.client.sendQueriesBatch(function (success, content) {
|
||||
if (thisNumber !== this.searchNumber) {
|
||||
return;
|
||||
}
|
||||
if (! success) {
|
||||
this.emitEvent('error', new Error('Algolia responded with a failure event.'));
|
||||
}
|
||||
if (! content.results) {
|
||||
this.emitEvent('error', new Error('No results returned from Algolia.'));
|
||||
}
|
||||
var results = {};
|
||||
content.results.forEach(function (result) {
|
||||
if (result.hits.length > 0) {
|
||||
var index = result.index.replace(this.prefix, '');
|
||||
results[index] = result;
|
||||
}
|
||||
}.bind(this));
|
||||
this.emitEvent('results', [ results ]);
|
||||
}.bind(this));
|
||||
};
|
20
devsite/source/assets/js/search/page.js
Normal file
20
devsite/source/assets/js/search/page.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var query = queryString.parse(location.search).query;
|
||||
if (query) {
|
||||
$('#quicksearch').val(query).trigger('keyup');
|
||||
}
|
76
devsite/source/assets/js/templates.js
Normal file
76
devsite/source/assets/js/templates.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
templates['color-picker-sample-window'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
var helper;
|
||||
|
||||
return "<div class=\"highlight\"><pre><span class=\"n\">Window</span> <span class=\"o\">*</span><span class=\"n\">window</span> <span class=\"o\">=</span> <span class=\"n\">window_create</span><span class=\"p\">();</span>\n<span class=\"n\">window_set_background_color</span><span class=\"p\">(</span><span class=\"n\">window</span><span class=\"p\">,</span> <span class=\"k\">"
|
||||
+ container.escapeExpression(((helper = (helper = helpers.color_name || (depth0 != null ? depth0.color_name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"color_name","hash":{},"data":data}) : helper)))
|
||||
+ "</span><span class=\"p\">);</span>\n<span class=\"n\">window_stack_push</span><span class=\"p\">(</span><span class=\"n\">window</span><span class=\"p\">,</span> <span class=\"nb\">true</span><span class=\"p\">);</span>\n</pre></div>\n";
|
||||
},"useData":true});
|
||||
templates['events-info-none'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
||||
|
||||
return "<div class=\"alert alert--fg-white alert--bg-green\">\n <p>There are currenly no events scheduled for "
|
||||
+ alias4(((helper = (helper = helpers.month || (depth0 != null ? depth0.month : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"month","hash":{},"data":data}) : helper)))
|
||||
+ ".</p>\n <p>Try changing the month using the calendar controls on the map above.</p>\n <p>If you know about an event happening in "
|
||||
+ alias4(((helper = (helper = helpers.month || (depth0 != null ? depth0.month : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"month","hash":{},"data":data}) : helper)))
|
||||
+ ", use <a href=\"javascript:void();\" data-modal-target=\"#overlay-events-form\">the submission form</a> to let us know!</p>\n</div>\n";
|
||||
},"useData":true});
|
||||
templates['events-info'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
||||
|
||||
return "<div class=\"col-m-12\">\n <article class=\"event\" data-event-number=\""
|
||||
+ alias4(((helper = (helper = helpers.number || (depth0 != null ? depth0.number : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"number","hash":{},"data":data}) : helper)))
|
||||
+ "\">\n <h3><a href=\""
|
||||
+ alias4(((helper = (helper = helpers.website || (depth0 != null ? depth0.website : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"website","hash":{},"data":data}) : helper)))
|
||||
+ "\">"
|
||||
+ alias4(((helper = (helper = helpers.dateString || (depth0 != null ? depth0.dateString : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"dateString","hash":{},"data":data}) : helper)))
|
||||
+ " - "
|
||||
+ alias4(((helper = (helper = helpers.location || (depth0 != null ? depth0.location : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"location","hash":{},"data":data}) : helper)))
|
||||
+ "</a></h3>\n <p class=\"event__meta\">"
|
||||
+ alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper)))
|
||||
+ " | <a href=\"javascript:void(0);\" class=\"event__toggle\">More</a></p>\n <div class=\"event__description hidden\" hidden>"
|
||||
+ ((stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"description","hash":{},"data":data}) : helper))) != null ? stack1 : "")
|
||||
+ "</div>\n </article>\n</div>\n";
|
||||
},"useData":true});
|
||||
templates['quicksearch-no-results'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
return "<div class=\"row\">\n <div class=\"col-l-12\">\n <p class=\"quicksearch__no-results\">There were no search results.</p>\n </div>\n</div>\n";
|
||||
},"useData":true});
|
||||
templates['quicksearch-result-group'] = template({"1":function(container,depth0,helpers,partials,data) {
|
||||
var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
||||
|
||||
return " <li class=\"quicksearch__result\">\n <a href=\""
|
||||
+ alias4(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"url","hash":{},"data":data}) : helper)))
|
||||
+ "\">"
|
||||
+ alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper)))
|
||||
+ "</a>\n <p class=\"quicksearch__section\">"
|
||||
+ ((stack1 = ((helper = (helper = helpers.section || (depth0 != null ? depth0.section : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"section","hash":{},"data":data}) : helper))) != null ? stack1 : "")
|
||||
+ "</p>\n <p class=\"quicksearch__summary\">"
|
||||
+ ((stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"summary","hash":{},"data":data}) : helper))) != null ? stack1 : "")
|
||||
+ "</p>\n </li>\n";
|
||||
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||
var stack1, helper, alias1=depth0 != null ? depth0 : {};
|
||||
|
||||
return "<h3>"
|
||||
+ container.escapeExpression(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper)))
|
||||
+ "</h3>\n<ul>\n"
|
||||
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.results : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||
+ "</ul>\n";
|
||||
},"useData":true});
|
||||
})();
|
3346
devsite/source/assets/js/tools/color-dict.js
Normal file
3346
devsite/source/assets/js/tools/color-dict.js
Normal file
File diff suppressed because it is too large
Load diff
82
devsite/source/assets/js/tools/color-mapping-sunlight.js
Normal file
82
devsite/source/assets/js/tools/color-mapping-sunlight.js
Normal file
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var colorMappingSunlight = {
|
||||
"#000000": "#000000",
|
||||
"#000055": "#001e41",
|
||||
"#0000aa": "#004387",
|
||||
"#0000ff": "#0068ca",
|
||||
"#005500": "#2b4a2c",
|
||||
"#005555": "#27514f",
|
||||
"#0055aa": "#16638d",
|
||||
"#0055ff": "#007dce",
|
||||
"#00aa00": "#5e9860",
|
||||
"#00aa55": "#5c9b72",
|
||||
"#00aaaa": "#57a5a2",
|
||||
"#00aaff": "#4cb4db",
|
||||
"#00ff00": "#8ee391",
|
||||
"#00ff55": "#8ee69e",
|
||||
"#00ffaa": "#8aebc0",
|
||||
"#00ffff": "#84f5f1",
|
||||
"#550000": "#4a161b",
|
||||
"#550055": "#482748",
|
||||
"#5500aa": "#40488a",
|
||||
"#5500ff": "#2f6bcc",
|
||||
"#555500": "#564e36",
|
||||
"#555555": "#545454",
|
||||
"#5555aa": "#4f6790",
|
||||
"#5555ff": "#4180d0",
|
||||
"#55aa00": "#759a64",
|
||||
"#55aa55": "#759d76",
|
||||
"#55aaaa": "#71a6a4",
|
||||
"#55aaff": "#69b5dd",
|
||||
"#55ff00": "#9ee594",
|
||||
"#55ff55": "#9de7a0",
|
||||
"#55ffaa": "#9becc2",
|
||||
"#55ffff": "#95f6f2",
|
||||
"#aa0000": "#99353f",
|
||||
"#aa0055": "#983e5a",
|
||||
"#aa00aa": "#955694",
|
||||
"#aa00ff": "#8f74d2",
|
||||
"#aa5500": "#9d5b4d",
|
||||
"#aa5555": "#9d6064",
|
||||
"#aa55aa": "#9a7099",
|
||||
"#aa55ff": "#9587d5",
|
||||
"#aaaa00": "#afa072",
|
||||
"#aaaa55": "#aea382",
|
||||
"#aaaaaa": "#ababab",
|
||||
"#ffffff": "#ffffff",
|
||||
"#aaaaff": "#a7bae2",
|
||||
"#aaff00": "#c9e89d",
|
||||
"#aaff55": "#c9eaa7",
|
||||
"#aaffaa": "#c7f0c8",
|
||||
"#aaffff": "#c3f9f7",
|
||||
"#ff0000": "#e35462",
|
||||
"#ff0055": "#e25874",
|
||||
"#ff00aa": "#e16aa3",
|
||||
"#ff00ff": "#de83dc",
|
||||
"#ff5500": "#e66e6b",
|
||||
"#ff5555": "#e6727c",
|
||||
"#ff55aa": "#e37fa7",
|
||||
"#ff55ff": "#e194df",
|
||||
"#ffaa00": "#f1aa86",
|
||||
"#ffaa55": "#f1ad93",
|
||||
"#ffaaaa": "#efb5b8",
|
||||
"#ffaaff": "#ecc3eb",
|
||||
"#ffff00": "#ffeeab",
|
||||
"#ffff55": "#fff1b5",
|
||||
"#ffffaa": "#fff6d3"
|
||||
};
|
122
devsite/source/assets/js/tools/color-picker.js
Normal file
122
devsite/source/assets/js/tools/color-picker.js
Normal file
|
@ -0,0 +1,122 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var titleBackup = document.title;
|
||||
|
||||
function updateFavicon(hex) {
|
||||
var canvas = document.createElement('canvas');
|
||||
if (! canvas.getContext) {
|
||||
return;
|
||||
}
|
||||
var ctx = canvas.getContext('2d');
|
||||
var img = document.createElement('img');
|
||||
img.onload = function () {
|
||||
canvas.height = this.height;
|
||||
canvas.width = this.width;
|
||||
ctx.drawImage(this, 0, 0);
|
||||
ctx.fillStyle = hex;
|
||||
ctx.fillRect(2, 4, 9, 8);
|
||||
$('#favicon').attr('href', canvas.toDataURL('image/png'));
|
||||
};
|
||||
img.src = '/assets/favicon.png';
|
||||
}
|
||||
|
||||
function selectColor($polygon) {
|
||||
var hexValue = $polygon.data('hex');
|
||||
var correctedHexValue = $polygon.attr('fill');
|
||||
var name = color_picker_colors[hexValue].name;
|
||||
$('#color-picker polygon').attr('stroke', '#fff').attr('stroke-width', '1.5');
|
||||
$polygon.attr('stroke', '#000').attr('stroke-width', '3');
|
||||
$polygon.parent().append($polygon);
|
||||
|
||||
if (color_picker_colors[hexValue].url) {
|
||||
$('#js-picker-name-no-url').hide();
|
||||
$('#js-picker-name').text(name).attr('href', color_picker_colors[hexValue].url).show();
|
||||
}
|
||||
else {
|
||||
$('#js-picker-name-no-url').show().text(name);
|
||||
$('#js-picker-name').hide();
|
||||
}
|
||||
$('#js-picker-block').css('background-color', correctedHexValue);
|
||||
if (hexValue === '#FFFFFF') {
|
||||
$('#js-picker-block').css('border', '1px solid #000');
|
||||
}
|
||||
else {
|
||||
$('#js-picker-block').css('border', '0');
|
||||
}
|
||||
$('#js-picker-constant').text(color_picker_colors[hexValue].c_identifier);
|
||||
$('#js-picker-html').text(correctedHexValue.toUpperCase());
|
||||
$('#js-picker-html-uncorrected').text(hexValue.toUpperCase());
|
||||
$('#js-picker-rgb').text(color_picker_colors[hexValue].literals[1].value);
|
||||
$('#js-picker-hex').text(color_picker_colors[hexValue].literals[2].value);
|
||||
$('#js-picker-sample').html(Handlebars.templates['color-picker-sample-window']({ color_name: color_picker_colors[hexValue].c_identifier }));
|
||||
document.title = titleBackup.replace('Color Picker Tool', name + ' // Color Picker Tool');
|
||||
updateFavicon(hexValue);
|
||||
|
||||
if (window.location.hash !== hexValue) {
|
||||
window.location = hexValue;
|
||||
}
|
||||
}
|
||||
|
||||
function selectUrlColor() {
|
||||
if (! document.location.hash) {
|
||||
return;
|
||||
}
|
||||
var polygon = $('#color-picker polygon[data-hex="' + document.location.hash + '"]');
|
||||
if (polygon && polygon.length) {
|
||||
selectColor(polygon);
|
||||
}
|
||||
}
|
||||
|
||||
function applyColorMap(map) {
|
||||
$('#color-picker polygon').each(function (index, elem) {
|
||||
if (map) {
|
||||
$(elem).attr('fill', map[$(elem).data('hex').toLowerCase()]);
|
||||
}
|
||||
else {
|
||||
$(elem).attr('fill', $(elem).data('hex'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('#color-picker polygon').on('click', function (event) {
|
||||
selectColor($(this));
|
||||
});
|
||||
|
||||
$('#color-picker polygon').each(function (index, elem) {
|
||||
$(elem).attr('data-hex', $(elem).attr('fill'));
|
||||
});
|
||||
|
||||
$('.js-btn-colormap').on('click', function (event) {
|
||||
var type = $(this).data('colormap');
|
||||
switch (type) {
|
||||
case 'none':
|
||||
applyColorMap(null);
|
||||
break;
|
||||
case 'sunlight':
|
||||
applyColorMap(colorMappingSunlight);
|
||||
break;
|
||||
}
|
||||
selectUrlColor();
|
||||
});
|
||||
|
||||
window.onpopstate = function(event) {
|
||||
selectUrlColor();
|
||||
};
|
||||
|
||||
selectUrlColor();
|
||||
});
|
18
devsite/source/assets/js/videos.js
Normal file
18
devsite/source/assets/js/videos.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// OSS: removed because PrettyEmbed has no clear license and cannot be included.
|
||||
// $().prettyEmbed({ useFitVids: true });
|
Loading…
Add table
Add a link
Reference in a new issue