github.com/googleapis/api-linter@v1.65.2/docs/assets/js/global.js (about) 1 // Copyright 2019 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // This file contains JavaScript-applied rules that can be applied 16 // to documentation sites using this Jekyll theme generally. 17 $.when($.ready).then(() => { 18 // Make callouts for notes, warnings, etc. work. 19 for (let callout of ['Important', 'Note', 'TL;DR', 'Warning']) { 20 $(`p strong:contains(${callout}:)`) 21 .parent() 22 .addClass(callout.replace(';', '').toLowerCase()); 23 } 24 25 // Make "spec terms" (must, should, may, must not, should not) that 26 // are bold-faced be further emphasized. 27 for (let directive of ['may', 'must', 'must not', 'should', 'should not']) { 28 $('strong') 29 .filter((i, el) => $(el).text() === directive) 30 .addClass('spec-directive') 31 .addClass(`spec-${directive.split(' ')[0]}`); 32 } 33 34 // Make "correct" and "incorrect" be further emphasized. 35 for (let desc of ['correct', 'incorrect']) { 36 $('strong') 37 .filter( 38 (i, el) => 39 $(el) 40 .text() 41 .toLowerCase() === desc 42 ) 43 .addClass(`desc-${desc}`); 44 } 45 });