mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-18 16:36:56 +03:00
d16e1a4a4a
This updates our fork to match the latest code in jsdoc v4.0.0-dev. This was done by diffing our forked template against v3.5.5, then reapplying the same changes to the latest default template from v4.0.0-dev. Fixes #1312 (regex backtracking vulnerability in jsdoc template) Change-Id: I6bbac557ad45a443b0faa58be0842f2f30a85848
67 lines
2.0 KiB
JavaScript
67 lines
2.0 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Code to show and hide classes in the docs based on their
|
|
* access: private, public, or exported.
|
|
*
|
|
* Written and maintained by Shaka Player team.
|
|
*/
|
|
|
|
function onShowChange() {
|
|
const value = document.getElementById('show').value;
|
|
localStorage.setItem('show', value);
|
|
|
|
const setVisibilityByAccess = (access, visible) => {
|
|
const selector = '.access-' + access;
|
|
const list = document.querySelectorAll(selector);
|
|
// querySelectorAll returns an array-like object, not an array.
|
|
for (const element of Array.from(list)) {
|
|
if (visible) {
|
|
element.classList.add('show');
|
|
} else {
|
|
element.classList.remove('show');
|
|
}
|
|
}
|
|
};
|
|
|
|
if (value == 'exported') {
|
|
setVisibilityByAccess('public', false);
|
|
setVisibilityByAccess('private', false);
|
|
} else if (value == 'public') {
|
|
setVisibilityByAccess('public', true);
|
|
setVisibilityByAccess('private', false);
|
|
} else {
|
|
setVisibilityByAccess('public', true);
|
|
setVisibilityByAccess('private', true);
|
|
}
|
|
}
|
|
|
|
function initShowWidget() {
|
|
// get the previous setting from storage and populate the form.
|
|
const storedSetting = localStorage.getItem('show');
|
|
document.getElementById('show').value = storedSetting;
|
|
|
|
if (!document.getElementById('show').value) {
|
|
// fix nonsense, missing, or corrupted values.
|
|
document.getElementById('show').value = 'exported';
|
|
}
|
|
|
|
// enact the setting we loaded.
|
|
onShowChange();
|
|
}
|